예제 #1
0
파일: tw.py 프로젝트: totaltrader/mmgen
	async def remove_address(self,addr):
		r = self.data_root

		if is_coin_addr(self.proto,addr):
			have_match = lambda k: k == addr
		elif is_mmgen_id(self.proto,addr):
			have_match = lambda k: r[k]['mmid'] == addr
		else:
			die(1,f'{addr!r} is not an Ethereum address or MMGen ID')

		for k in r:
			if have_match(k):
				# return the addr resolved to mmid if possible
				ret = r[k]['mmid'] if is_mmgen_id(self.proto,r[k]['mmid']) else addr
				del r[k]
				self.write()
				return ret
		else:
			msg(f'Address {addr!r} not found in {self.data_root_desc!r} section of tracking wallet')
			return None
예제 #2
0
    def remove_address(self, addr):
        r = self.data_root

        if is_coin_addr(addr):
            have_match = lambda k: k == addr
        elif is_mmgen_id(addr):
            have_match = lambda k: r[k]['mmid'] == addr
        else:
            die(1, "'{}' is not an Ethereum address or MMGen ID".format(addr))

        for k in r:
            if have_match(k):
                # return the addr resolved to mmid if possible
                ret = r[k]['mmid'] if is_mmgen_id(r[k]['mmid']) else addr
                del r[k]
                self.write()
                return ret
        else:
            m = "Address '{}' not found in '{}' section of tracking wallet"
            msg(m.format(addr, self.data_root_desc))
            return None
예제 #3
0
파일: tw.py 프로젝트: mmgen/mmgen
	def remove_address(self,addr):
		root = self.data_root()

		from mmgen.obj import is_coin_addr,is_mmgen_id
		if is_coin_addr(addr):
			have_match = lambda k: k == addr
		elif is_mmgen_id(addr):
			have_match = lambda k: root[k]['mmid'] == addr
		else:
			die(1,"'{}' is not an Ethereum address or MMGen ID".format(addr))

		for k in root:
			if have_match(k):
				# return the addr resolved to mmid if possible
				ret = root[k]['mmid'] if is_mmgen_id(root[k]['mmid']) else addr
				del root[k]
				self.write()
				return ret
		else:
			m = "Address '{}' not found in '{}' section of tracking wallet"
			msg(m.format(addr,self.data_root_desc()))
			return None