コード例 #1
0
ファイル: rpc.py プロジェクト: bryceweiner/Infiniti
def newaddress(fn,passphrase,addr_type=0):
	"""
	getnetaddress
	"""
	#try:
	wallet = Wallet(fn).fromFile(passphrase)
	# Address Types
	# addr_type == 0, deposit
	# addr_type == 1, change
	# addr_type == 2, staking
	# addr_type == 3, Dealer
	# Address types aren't programmatically important, but help to organize
	if addr_type is None:
		addr_type = 0
	children = (_k for _k in wallet.Keys if _k.addr_type() == int(addr_type))
	child = 0
	for c in children:
		child += 1
	k = wallet.create_address(save=True,addr_type=addr_type,child=child)
	dump = ({
			'address_type':k.address_type(),
			NETWORK : k.address(),
			'infiniti' : k.address(True),
		})
	d = { "address" : dump }
	return json.dumps(d, sort_keys=True, indent=4)
コード例 #2
0
def newaddress(fn, passphrase, addr_type=0):
    """
	getnetaddress
	"""
    wallet = Wallet(fn).fromFile(passphrase)
    # Address Types
    # addr_type == 0, deposit
    # addr_type == 1, change
    # addr_type == 2, staking
    # addr_type == 3, Dealer
    # Address types aren't programmatically important, but help to organize
    if addr_type is None:
        addr_type = 0
    k = wallet.create_address(save=True, addr_type=addr_type)
    d = {"new_address": (k.address_type(), k.address(), k.address(True))}
    return json.dumps(d, sort_keys=True, indent=4)