def test_base58_roundtrip(self): priv = PrivateKey.random() assert PrivateKey.from_base58(priv.to_base58()) == priv assert priv.public_key.from_base58(priv.public_key.to_base58()) == priv.public_key
from agora.utils import kin_to_quarks ap = argparse.ArgumentParser() ap.add_argument('-s', '--sender', required=True, help='The private seed of the sender account') ap.add_argument('-d', '--destination', required=True, help='The public address of the destination account') args = vars(ap.parse_args()) client = Client(Environment.TEST, 1) # 1 is the test app index source = PrivateKey.from_base58(args['sender']) dest = PublicKey.from_base58(args['destination']) # Send a payment of 1 Kin payment = Payment(source, dest, TransactionType.EARN, kin_to_quarks('1')) try: tx_id = client.submit_payment(p) print( f'transaction successfully submitted with hash: {base58.b58encode(tx_id)}' ) except Error as e: print(f'transaction failed: {repr(e)}') if isinstance(e, TransactionErrors): print( f'tx_error={repr(e.tx_error)}, len(op_errors)={len(e.op_errors)}') for op_error in e.op_errors:
from agora.client import Client, Environment from agora.error import AccountExistsError from agora.keys import PrivateKey ap = argparse.ArgumentParser() ap.add_argument( '-s', '--seed', required=True, help='The base58-encoded private seed of the account to create') args = vars(ap.parse_args()) client = Client(Environment.TEST, 1) # 1 is the test app index private_key = PrivateKey.from_base58(args['seed']) addr = private_key.public_key.to_base58() print(f'creating account with address {addr}') try: client.create_account(private_key) print('account created') except AccountExistsError: print(f'account {private_key.public_key.to_base58()} already exists') token_accounts = client.resolve_token_accounts(private_key.public_key) for token_account in token_accounts: print( f'balance of {token_account.to_base58()}: {client.get_balance(token_account)}' )