def test_signing_keystore_load(): a = Account.load_from_keystore( os.path.join(os.path.dirname(os.path.realpath(__file__)), "testdata", "keystore.json"), "aeternity") assert a.get_address( ) == "ak_Jt6AzQEiXiEMFXum8NtTXcCQtE9P1RfpkeVSZX87pFddzzynW"
def test_signing_keystore_load(): a = Account.from_keystore( os.path.join(os.path.dirname(os.path.realpath(__file__)), "testdata", "keystore.json"), "aeternity") assert a.get_address( ) == "ak_2hSFmdK98bhUw4ar7MUdTRzNQuMJfBFQYxdhN9kaiopDGqj3Cr"
def test_cli_phases_spend(chain_fixture, tempdir): account_path = _account_path(tempdir, chain_fixture.ALICE) # generate a new address recipient_id = Account.generate().get_address() # step one, generate transaction nonce = chain_fixture.NODE_CLI.get_account_by_pubkey( pubkey=chain_fixture.ALICE.get_address()).nonce + 1 j = call_aecli('tx', 'spend', chain_fixture.ALICE.get_address(), recipient_id, '100', '--nonce', f'{nonce}') # assert chain_fixture.ALICE.get_address == j.get("Sender account") assert recipient_id == j.get("data", {}).get("recipient_id") # step 2, sign the transaction tx_unsigned = j.get("tx") s = call_aecli('account', 'sign', account_path, tx_unsigned, '--password', 'aeternity_bc', '--network-id', NETWORK_ID) tx_signed = s.get("tx") # recipient_account = chain_fixture.NODE_CLI.get_account_by_pubkey(pubkey=recipient_id) # assert recipient_account.balance == 0 # step 3 broadcast call_aecli('tx', 'broadcast', tx_signed, "--wait") # b.get("Transaction hash") # verify recipient_account = chain_fixture.NODE_CLI.get_account_by_pubkey( pubkey=recipient_id) assert recipient_account.balance == 100
def _delegate_common(self, account: Account, *kwargs): """ Utility method to create a delegate signature for a contract Args: account: the account authorizing the transaction kwargs: the list of additional entity ids to be added to the data to be signed Returns: the signature to use for delegation """ sig_data = self.config.network_id.encode("utf8") + hashing.decode(account.get_address()) for _id in kwargs: sig_data += hashing.decode(_id) # sign the data sig = account.sign(sig_data) return sig
def test_spend_by_name(chain_fixture): # claim a domain domain = random_domain( tld='chain' if chain_fixture.NODE_CLI.get_consensus_protocol_version() >= PROTOCOL_LIMA else 'test', length=20) print(f"domain is {domain}") name = chain_fixture.NODE_CLI.AEName(domain) print("Claim name ", domain) # generate a new address target_address = Account.generate().get_address() print(f"Target address {target_address}") name.full_claim_blocking(chain_fixture.ALICE, target_address) # domain claimed name.update_status() assert not chain_fixture.NODE_CLI.AEName( domain).is_available(), 'The name should be claimed now' name.update_status() print(f"domain is {name.domain} name_id {name.name_id}") print("pointers", name.pointers) tx = chain_fixture.NODE_CLI.spend(chain_fixture.ALICE, domain, '1AE') print("DATA ", tx) recipient_account = chain_fixture.NODE_CLI.get_account_by_pubkey( pubkey=target_address) print( f"recipient address {target_address}, balance {recipient_account.balance}" ) assert recipient_account.balance == 1000000000000000000
def account_basic_to_ga( self, account: Account, ga_contract: str, init_calldata: str = defaults.CONTRACT_INIT_CALLDATA, auth_fun: str = defaults.GA_AUTH_FUNCTION, fee: int = defaults.FEE, tx_ttl: int = defaults.TX_TTL, gas: int = defaults.CONTRACT_GAS, gas_price: int = defaults.CONTRACT_GAS_PRICE): """ Transform a POA (Plain Old Account) to a GA (Generalized Account) :param account: the account to transform :param contract: the compiled contract associated to the GA :param auth_fun: the name of the contract function to use for authorization (default: authorize) """ # check the auth_fun name if auth_fun is None or len(auth_fun) == 0: raise TypeError("The parameter auth_fun is required") # decode the contract and search for the authorization function auth_fun_hash = None contract_data = contract.CompilerClient.decode_bytecode(ga_contract) if len(contract_data.type_info) == 0: # TODO: we assume is a FATE env, but is a bit weak auth_fun_hash = hashing.hash(auth_fun.encode('utf-8')) for ti in contract_data.type_info: if ti.fun_name == auth_fun: auth_fun_hash = ti.fun_hash # if the function is not found then raise an error if auth_fun_hash is None: raise TypeError(f"Authorization function not found: '{auth_fun}'") # get the nonce nonce = self.get_next_nonce(account.get_address()) # compute the ttl ttl = self.compute_absolute_ttl(tx_ttl).absolute_ttl # get abi and vm version vm_version, abi_version = self.get_vm_abi_versions() # build the transaction tx = self.tx_builder.tx_ga_attach(account.get_address(), nonce, ga_contract, auth_fun_hash, vm_version, abi_version, fee, ttl, gas, gas_price, init_calldata) # sign the transaction tx = self.sign_transaction(account, tx) # broadcast the transaction self.broadcast_transaction(tx) return tx
def _test_node_spend(node_cli, sender_account): account = Account.generate().get_address() tx = node_cli.spend(sender_account, account, 100) assert account == tx.data.recipient_id assert sender_account.get_address() == tx.data.sender_id account = node_cli.get_account_by_pubkey(pubkey=account) balance = account.balance assert balance > 0
def sign(priv_key, data): acc = Account.from_secret_key_string(priv_key) tx_signer = TxSigner(acc, 'ae_uat') tx_builder = TxBuilder() tx = TxObject(tx=data) signature = tx_signer.sign_transaction(tx, None) signed = tx_builder.tx_signed([signature], tx, metadata=None) return signed.tx
def get_account(self, address: str) -> Account: """ Retrieve an account by it's public key """ if not utils.is_valid_hash(address, identifiers.ACCOUNT_ID): raise TypeError(f"Input {address} is not a valid aeternity address") remote_account = self.get_account_by_pubkey(pubkey=address) return Account.from_node_api(remote_account)
def test_signing_keystore_save_load(tempdir): original_account = Account.generate() filename = original_account.save_to_keystore(tempdir, "whatever") path = os.path.join(tempdir, filename) print(f"\nAccount keystore is {path}") # now load again the same a = Account.from_keystore(path, "whatever") assert a.get_address() == original_account.get_address() ###### original_account = Account.generate() filename = "account_ks" filename = original_account.save_to_keystore(tempdir, "whatever") path = os.path.join(tempdir, filename) print(f"\nAccount keystore is {path}") # now load again the same a = Account.from_keystore(path, "whatever") assert a.get_address() == original_account.get_address()
def sign_transaction(self, account: Account, tx: transactions.TxObject, metadata: dict = {}, **kwargs) -> tuple: """ Sign a transaction :return: the transaction for the transaction """ # first retrieve the account from the node # so we can check if it is generalized or not on_chain_account = self.get_account(account.get_address()) # if the account is not generalized sign and return the transaction if not on_chain_account.is_generalized(): s = transactions.TxSigner(account, self.config.network_id) signature = s.sign_transaction(tx, metadata) return self.tx_builder.tx_signed([signature], tx, metadata=metadata) # if the account is generalized then prepare the ga_meta_tx # 1. wrap the tx into a signed tx (without signatures) sg_tx = self.tx_builder.tx_signed([], tx) # 2. wrap the tx into a ga_meta_tx # get the absolute ttl ttl = self.compute_absolute_ttl(kwargs.get("ttl", defaults.TX_TTL)).absolute_ttl # get abi version _, abi = self.get_vm_abi_versions() # check that the parameter auth_data is provided auth_data = kwargs.get("auth_data") if auth_data is None: raise TypeError("the auth_data parameter is required for ga accounts") # verify the gas amount TODO: add a tx verification gas = kwargs.get("gas", defaults.GA_MAX_AUTH_FUN_GAS) if gas > defaults.GA_MAX_AUTH_FUN_GAS: raise TypeError(f"the maximum gas value for ga auth_fun is {defaults.GA_MAX_AUTH_FUN_GAS}, got {gas}") # build the ga_sg_tx = self.tx_builder.tx_ga_meta( account.get_address(), auth_data, kwargs.get("abi_version", abi), kwargs.get("fee", defaults.FEE), gas, kwargs.get("gas_price", defaults.CONTRACT_GAS_PRICE), ttl, sg_tx ) # 3. wrap the the ga into a signed transaction sg_ga_sg_tx = self.tx_builder.tx_signed([], ga_sg_tx, metadata=metadata) return sg_ga_sg_tx
def test_signing_keystore_save_load_wrong_pwd(): with tempdir() as tmp_path: filename = ACCOUNT.save_to_keystore(tmp_path, "whatever") path = os.path.join(tmp_path, filename) print(f"\nAccount keystore is {path}") # now load again the same with raises(ValueError): a = Account.load_from_keystore(path, "nononon") assert a.get_address() == ACCOUNT.get_address()
def test_signing_keystore_save_load(): with tempdir() as tmp_path: filename = ACCOUNT.save_to_keystore(tmp_path, "whatever") path = os.path.join(tmp_path, filename) print(f"\nAccount keystore is {path}") # now load again the same a = Account.load_from_keystore(path, "whatever") assert a.get_address() == ACCOUNT.get_address() with tempdir() as tmp_path: filename = "account_ks" filename = ACCOUNT.save_to_keystore(tmp_path, "whatever", filename=filename) path = os.path.join(tmp_path, filename) print(f"\nAccount keystore is {path}") # now load again the same a = Account.load_from_keystore(path, "whatever") assert a.get_address() == ACCOUNT.get_address()
def test_transaction_spend(): recipient_id = Account.generate().get_address() tts = [ { "native": (recipient_id, 1000, 1, 100, "payload"), "debug": (recipient_id, 1000, 1, 100, "payload"), "match": True }, { "native": (recipient_id, 9845, 1, 500, "another payload"), "debug": (recipient_id, 9845, 1, 500, "another payload"), "match": True }, { "native": (recipient_id, 9845, 1, 500, "another payload"), "debug": (Account.generate().get_address(), 9845, 1, 500, "another payload"), "match": False }, ] for tt in tts: # get a native transaction txbn = transactions.TxBuilder(EPOCH_CLI, ACCOUNT, native=True) txn, sn, txhn = txbn.tx_spend(tt["native"][0], tt["native"][1], tt["native"][4], tt["native"][2], tt["native"][3]) # get a debug transaction txbd = transactions.TxBuilder(EPOCH_CLI, ACCOUNT, native=False) txd, sd, txhd = txbd.tx_spend(tt["debug"][0], tt["debug"][1], tt["debug"][4], tt["debug"][2], tt["debug"][3]) # theys should be the same if tt["match"]: assert txn == txd assert sn == sd assert txhn == txhd else: assert txn != txd assert sn != sd assert txhn != txhd
def test_signing_get_address(): a = Account.from_private_key_string( '3960180c89e27fcc1559f631d664a4b56b569aa5768ba827ddc9ba9616fecd9d8134464ef14b1433790e259d40b6ad8ca39f397a2bbc5261eeba1018a67ce35a') assert(a.get_address() == 'ak_yuMB5S3yiTwRVJC1NcNEGppcGAbq26qFWNJTCJWnLqoihCpCG') assert(a.get_address(format=identifiers.ACCOUNT_API_FORMAT) == 'ak_yuMB5S3yiTwRVJC1NcNEGppcGAbq26qFWNJTCJWnLqoihCpCG') assert(a.get_address(format=identifiers.ACCOUNT_API_FORMAT) != 'ak_xuMB5S3yiTwRVJC1NcNEGppcGAbq26qFWNJTCJWnLqoihCpCG') assert(a.get_address(format=identifiers.ACCOUNT_SOFIA_FORMAT) == '0x8134464ef14b1433790e259d40b6ad8ca39f397a2bbc5261eeba1018a67ce35a') assert(a.get_address(format=identifiers.ACCOUNT_SOFIA_FORMAT) != '8134464ef14b1433790e259d40b6ad8ca39f397a2bbc5261eeba1018a67ce35a') assert(a.get_address(format=identifiers.ACCOUNT_RAW_FORMAT) == b'\x814FN\xf1K\x143y\x0e%\x9d@\xb6\xad\x8c\xa3\x9f9z+\xbcRa\xee\xba\x10\x18\xa6|\xe3Z') assert(a.get_address(format=identifiers.ACCOUNT_RAW_FORMAT) != b'\x814FN\xf1K\x143y\x0e%\x9d@\xb6\x00\x8c\xa3\x9f9z+\xbcRa\xee\xba\x10\x18\xa6|\xe3Z')
def test_cli_spend(account_path): # generate a new address recipient_address = Account.generate().get_address() # call the cli call_aecli('account', 'spend', account_path, recipient_address, "90", '--password', 'aeternity_bc') # test that the recipient account has the requested amount print(f"recipient address is {recipient_address}") recipient_account = EPOCH_CLI.get_account_by_pubkey(pubkey=recipient_address) print(f"recipient address {recipient_address}, balance {recipient_account.balance}") assert recipient_account.balance == 90
def _get_account(secret_key): """ Generate Account from secret key Args: secret_key(bytes): secret key in bytes Returns: Account instance with generated signing key and verifying key """ sign_key = SigningKey(secret_key) return Account(sign_key, sign_key.verify_key)
def test_hdwallet_keystore_save_load_wrong_type(tempdir): try: original_account = Account.generate() filename = original_account.save_to_keystore(tempdir, "whatever") path = os.path.join(tempdir, filename) print(f"\nAccount keystore is {path}") hdwallet_decrypted = HDWallet.from_keystore(path, "whatever") except Exception as e: assert str( e ) == "Invalid keystore. Expected keystore of type ed25519-bip39-mnemonic"
def spend(self, account: Account, recipient_id: str, amount: int, payload: str = "", fee: int = defaults.FEE, tx_ttl: int = defaults.TX_TTL): """ Create and execute a spend transaction """ # retrieve the nonce account.nonce = self.get_next_nonce(account.get_address()) if account.nonce == 0 else account.nonce + 1 # retrieve ttl tx_ttl = self.compute_absolute_ttl(tx_ttl) # build the transaction tx = self.tx_builder.tx_spend(account.get_address(), recipient_id, amount, payload, fee, tx_ttl.absolute_ttl, account.nonce) # execute the transaction tx = self.sign_transaction(account, tx.tx) # post the transaction self.broadcast_transaction(tx.tx, tx_hash=tx.hash) return tx
def test_cli_inspect_transaction_by_hash(): # fill the account from genesys na = Account.generate() amount = random.randint(50, 150) _, _, tx_hash = EPOCH_CLI.spend(ACCOUNT, na.get_address(), amount) # now inspect the transaction j = call_aecli('inspect', tx_hash) assert j.get("hash") == tx_hash assert j.get("block_height") > 0 assert j.get("tx", {}).get("recipient_id") == na.get_address() assert j.get("tx", {}).get("sender_id") == ACCOUNT.get_address() assert j.get("tx", {}).get("amount") == amount
def spend(self, account: Account, recipient_id: str, amount, payload: str = "", fee: int = defaults.FEE, tx_ttl: int = defaults.TX_TTL) -> transactions.TxObject: """ Create and execute a spend transaction, automatically retrieve the nonce for the siging account and calculate the absolut ttl. :param account: the account signing the spend transaction (sender) :param recipient_id: the recipient address or name_id :param amount: the amount to spend :param payload: the payload for the transaction :param fee: the fee for the transaction (automatically calculated if not provided) :param tx_ttl: the transaction ttl expressed in relative number of blocks :return: the TxObject of the transaction :raises TypeError: if the recipient_id is not a valid name_id or address """ if utils.is_valid_aens_name(recipient_id): recipient_id = hashing.name_id(recipient_id) elif not utils.is_valid_hash(recipient_id, prefix="ak"): raise TypeError("Invalid recipient_id. Please provide a valid AENS name or account pub_key.") # parse amount and fee amount, fee = utils._amounts_to_aettos(amount, fee) # retrieve the nonce account.nonce = self.get_next_nonce(account.get_address()) if account.nonce == 0 else account.nonce + 1 # retrieve ttl tx_ttl = self.compute_absolute_ttl(tx_ttl) # build the transaction tx = self.tx_builder.tx_spend(account.get_address(), recipient_id, amount, payload, fee, tx_ttl.absolute_ttl, account.nonce) # get the signature tx = self.sign_transaction(account, tx) # post the signed transaction transaction self.broadcast_transaction(tx) return tx
def transfer_funds(self, account: Account, recipient_id: str, percentage: float, payload: str = "", tx_ttl: int = defaults.TX_TTL, fee: int = defaults.FEE, include_fee=True): """ Create and execute a spend transaction """ if percentage < 0 or percentage > 1: raise ValueError( f"Percentage should be a number between 0 and 1, got {percentage}" ) account_on_chain = self.get_account_by_pubkey( pubkey=account.get_address()) request_transfer_amount = int(account_on_chain.balance * percentage) # retrieve the nonce account.nonce = account_on_chain.nonce + 1 # retrieve ttl tx_ttl = self.compute_absolute_ttl(tx_ttl) # build the transaction tx = self.tx_builder.tx_spend(account.get_address(), recipient_id, request_transfer_amount, payload, fee, tx_ttl.absolute_ttl, account.nonce) # if the request_transfer_amount should include the fee keep calculating the fee if include_fee: amount = request_transfer_amount while (amount + tx.data.fee) > request_transfer_amount: amount = request_transfer_amount - tx.data.fee tx = self.tx_builder.tx_spend(account.get_address(), recipient_id, amount, payload, fee, tx_ttl.absolute_ttl, account.nonce) # execute the transaction tx = self.sign_transaction(account, tx) # post the transaction self.broadcast_transaction(tx) return tx
def test_signing_create_transaction(): # generate a new account new_account = Account.generate() receiver_address = new_account.get_address() # create a spend transaction txb = TxBuilder(EPOCH_CLI, ACCOUNT) tx, sg, tx_hash = txb.tx_spend(receiver_address, 321, "test test ", TEST_FEE, TEST_TTL) # this call will fail if the hashes of the transaction do not match txb.post_transaction(tx, tx_hash) # make sure this works for very short block times spend_tx = EPOCH_CLI.get_transaction_by_hash(hash=tx_hash) assert spend_tx.signatures[0] == sg
def cmd_export(args): try: a = Account.from_keystore(args.keystore_path, args.password) print( json.dumps( { "keystore": args.keystore_path, "secret_key": a.get_secret_key(), "address": a.get_address() }, indent=2)) except Exception as e: print(f"Invalid keystore or password: {e}")
def test_signing_create_transaction_signature(chain_fixture): # generate a new account new_account = Account.generate() receiver_address = new_account.get_address() # create a spend transaction nonce, ttl = chain_fixture.NODE_CLI._get_nonce_ttl(chain_fixture.ALICE.get_address(), TEST_TTL) tx = chain_fixture.NODE_CLI.tx_builder.tx_spend(chain_fixture.ALICE.get_address(), receiver_address, 321, "test test ", 0, ttl, nonce) tx_signed = chain_fixture.NODE_CLI.sign_transaction(chain_fixture.ALICE, tx) # this call will fail if the hashes of the transaction do not match chain_fixture.NODE_CLI.broadcast_transaction(tx_signed) # make sure this works for very short block times spend_tx = chain_fixture.NODE_CLI.get_transaction_by_hash(hash=tx_signed.hash) assert spend_tx.signatures[0] == tx_signed.get_signature(0)
def transfer_funds(self, account: Account, recipient_id: str, percentage: float, payload: str = "", tx_ttl: int = defaults.TX_TTL, fee: int = defaults.FEE, include_fee=True): """ Create and execute a spend transaction """ if utils.is_valid_aens_name(recipient_id): recipient_id = hashing.name_id(recipient_id) elif not utils.is_valid_hash(recipient_id, prefix="ak"): raise TypeError("Invalid recipient_id. Please provide a valid AENS name or account pub_key.") if percentage < 0 or percentage > 1: raise ValueError(f"Percentage should be a number between 0 and 1, got {percentage}") # parse amounts fee = utils.amount_to_aettos(fee) # retrieve the balance account_on_chain = self.get_account_by_pubkey(pubkey=account.get_address()) request_transfer_amount = int(account_on_chain.balance * percentage) # retrieve the nonce account.nonce = account_on_chain.nonce + 1 # retrieve ttl tx_ttl = self.compute_absolute_ttl(tx_ttl) # build the transaction tx = self.tx_builder.tx_spend(account.get_address(), recipient_id, request_transfer_amount, payload, fee, tx_ttl.absolute_ttl, account.nonce) # if the request_transfer_amount should include the fee keep calculating the fee if include_fee: amount = request_transfer_amount while (amount + tx.data.fee) > request_transfer_amount: amount = request_transfer_amount - tx.data.fee tx = self.tx_builder.tx_spend(account.get_address(), recipient_id, amount, payload, fee, tx_ttl.absolute_ttl, account.nonce) # execute the transaction tx = self.sign_transaction(account, tx) # post the transaction self.broadcast_transaction(tx) return tx
def chain_fixture(scope="module"): # create a new account and fill it with some money ACCOUNT = Account.generate() ACCOUNT_1 = Account.generate() # used by for oracles # set the key folder as environment variables genesis = Account.from_private_key_string(PRIVATE_KEY) # Instantiate the node client for the tests NODE_CLI = NodeClient( Config( external_url=NODE_URL, internal_url=NODE_URL_DEBUG, # network_id=NETWORK_ID, blocking_mode=True, debug=True, )) NODE_CLI.spend(genesis, ACCOUNT.get_address(), 5000000000000000000000) # 5000AE a = NODE_CLI.get_account_by_pubkey(pubkey=ACCOUNT.get_address()) print(f"Test account is {ACCOUNT.get_address()} with balance {a.balance}") NODE_CLI.spend(genesis, ACCOUNT_1.get_address(), 5000000000000000000000) # 5000AE a = NODE_CLI.get_account_by_pubkey(pubkey=ACCOUNT_1.get_address()) print( f"Test account (1) is {ACCOUNT_1.get_address()} with balance {a.balance}" ) return namedtupled.map( { "NODE_CLI": NODE_CLI, "ALICE": ACCOUNT, "BOB": ACCOUNT_1 }, _nt_name="TestData")
def test_node_ga_meta_spend(chain_fixture, compiler_fixture): ae_cli = chain_fixture.NODE_CLI account = chain_fixture.ACCOUNT c_cli = compiler_fixture.COMPILER # make the account poa # transform the account # compile the contract ga_contract = c_cli.compile(blind_auth_contract).bytecode # now encode the call data init_calldata = c_cli.encode_calldata(blind_auth_contract, "init", [account.get_address()]).calldata # this will return an object # init_calldata.calldata # now we can execute the transaction tx = ae_cli.account_basic_to_ga(account, ga_contract, init_calldata=init_calldata, gas=500) print("ACCOUNT is now GA", account.get_address()) # retrieve the account data ga_account = ae_cli.get_account(account.get_address()) # create a dummy account recipient_id = Account.generate().get_address() # generate the spend transactions amount = 54321 payload = "ga spend tx" fee = defaults.FEE ttl = defaults.TX_TTL spend_tx = ae_cli.tx_builder.tx_spend(account.get_address(), recipient_id, amount, payload, fee, ttl, 0) # encode the call data for the transaction calldata = c_cli.encode_calldata(blind_auth_contract, ga_account.auth_fun, [hashing.randint()]).calldata # now we can sign the transaction (it will use the auth for do that) spend_tx = ae_cli.sign_transaction(ga_account, spend_tx.tx, auth_data=calldata) # broadcast tx_hash = ae_cli.broadcast_transaction(spend_tx.tx) print(f"GA_META_TX {tx_hash}") # check that the account received the tokens assert ae_cli.get_account_by_pubkey(pubkey=recipient_id).balance == amount
def test_cli_spend(chain_fixture, tempdir): account_path = _account_path(tempdir, chain_fixture.ALICE) # generate a new address recipient_address = Account.generate().get_address() # call the cli call_aecli('account', 'spend', account_path, recipient_address, "90", '--password', 'aeternity_bc', '--wait') # test that the recipient account has the requested amount print(f"recipient address is {recipient_address}") recipient_account = chain_fixture.NODE_CLI.get_account_by_pubkey( pubkey=recipient_address) print( f"recipient address {recipient_address}, balance {recipient_account.balance}" ) assert recipient_account.balance == 90
def test_cli_transfer_by_name(chain_fixture, tempdir): account_alice_path = _account_path(tempdir, chain_fixture.ALICE) # generate a new address recipient_address = Account.generate().get_address() domain = __fullclaim_domain(chain_fixture, tempdir, recipient_address) val = call_aecli('account', 'transfer', account_alice_path, domain, "0.01", '--password', 'aeternity_bc', '--wait') # test that the recipient account has the requested amount print(f"recipient domain is {domain}") recipient_account = chain_fixture.NODE_CLI.get_account_by_pubkey( pubkey=recipient_address) print( f"recipient address {recipient_address}, balance {recipient_account.balance}" ) assert recipient_account.balance == val['data']['tx']['data']['amount']