def get_transaction_from_address(symbol, address): print_section('Searching for transaction:', address) network = get_network_by_symbol(symbol) tx = network.get_transaction(address) if not tx: print_section('Cannot find such transaction') exit(1) return tx['hex']
def test_get_network_obj_on_existing_networks(network): symbol = network.symbols[0] is_test_network = network.is_test_network() network_object = get_network_by_symbol(f"{symbol}{'-TESTNET' if is_test_network else ''}") assert type(network_object) == network assert network_object.symbols[0] == symbol assert network_object.is_test_network() == is_test_network
def test_valid_address(network_symbol, address, is_valid): network = get_network_by_symbol(network_symbol) assert network.is_valid_address(address) == is_valid
def test_get_network_obj_on_not_existing_network(): assert get_network_by_symbol('NON_EXISTING_NETWORK_SYMBOL') is None
help='Initial transaction network', type=str, required=True) parser.add_argument('-n', '--network', help='Network for creating transaction in', type=str, required=True) parser.add_argument('-a', '--amount', help='Transaction amount', type=float, required=True) args = parser.parse_args() network = get_network_by_symbol(args.network) wallet = network.get_wallet(private_key=args.private_key) tx_hex = get_transaction_from_address(args.initial_network, args.transaction) print_section('Found transaction:', tx_hex) print_section('Transaction audit...') contract = network.audit_contract(args.contract, tx_hex) pprint(contract.show_details()) utxo = network.get_utxo(wallet.address, args.amount) if not utxo: print_error('UTXO not found') exit(1) print_section(f'Found {len(utxo)} UTXO\'s')