chia-blockchain 2.5.4rc1__py3-none-any.whl → 2.5.5rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chia/_tests/blockchain/blockchain_test_utils.py +2 -3
- chia/_tests/blockchain/test_augmented_chain.py +2 -3
- chia/_tests/blockchain/test_blockchain.py +261 -44
- chia/_tests/blockchain/test_blockchain_transactions.py +4 -3
- chia/_tests/blockchain/test_build_chains.py +197 -1
- chia/_tests/blockchain/test_get_block_generator.py +1 -1
- chia/_tests/blockchain/test_lookup_fork_chain.py +1 -1
- chia/_tests/clvm/benchmark_costs.py +1 -1
- chia/_tests/clvm/coin_store.py +3 -4
- chia/_tests/clvm/test_message_conditions.py +2 -2
- chia/_tests/clvm/test_puzzle_compression.py +2 -3
- chia/_tests/clvm/test_puzzles.py +1 -2
- chia/_tests/clvm/test_singletons.py +2 -3
- chia/_tests/clvm/test_spend_sim.py +7 -7
- chia/_tests/cmds/cmd_test_utils.py +30 -25
- chia/_tests/cmds/test_dev_gh.py +1 -1
- chia/_tests/cmds/test_farm_cmd.py +1 -1
- chia/_tests/cmds/test_show.py +1 -2
- chia/_tests/cmds/wallet/test_did.py +101 -56
- chia/_tests/cmds/wallet/test_nft.py +109 -84
- chia/_tests/cmds/wallet/test_notifications.py +1 -1
- chia/_tests/cmds/wallet/test_offer.toffer +1 -1
- chia/_tests/cmds/wallet/test_vcs.py +8 -8
- chia/_tests/cmds/wallet/test_wallet.py +100 -46
- chia/_tests/conftest.py +31 -20
- chia/_tests/connection_utils.py +1 -1
- chia/_tests/core/consensus/stores/__init__.py +0 -0
- chia/_tests/core/consensus/stores/test_coin_store_protocol.py +40 -0
- chia/_tests/core/consensus/test_block_creation.py +2 -31
- chia/_tests/core/consensus/test_pot_iterations.py +38 -3
- chia/_tests/core/custom_types/test_proof_of_space.py +154 -26
- chia/_tests/core/custom_types/test_spend_bundle.py +2 -3
- chia/_tests/core/daemon/test_daemon.py +80 -0
- chia/_tests/core/data_layer/test_data_layer.py +1 -1
- chia/_tests/core/data_layer/test_data_layer_util.py +1 -1
- chia/_tests/core/data_layer/test_data_rpc.py +14 -10
- chia/_tests/core/data_layer/test_data_store.py +5 -5
- chia/_tests/core/farmer/test_farmer_api.py +2 -2
- chia/_tests/core/full_node/full_sync/test_full_sync.py +446 -406
- chia/_tests/core/full_node/ram_db.py +3 -1
- chia/_tests/core/full_node/stores/test_block_store.py +28 -16
- chia/_tests/core/full_node/stores/test_coin_store.py +277 -185
- chia/_tests/core/full_node/stores/test_full_node_store.py +11 -4
- chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
- chia/_tests/core/full_node/test_address_manager.py +200 -27
- chia/_tests/core/full_node/test_block_height_map.py +2 -2
- chia/_tests/core/full_node/test_conditions.py +7 -6
- chia/_tests/core/full_node/test_full_node.py +456 -40
- chia/_tests/core/full_node/test_generator_tools.py +32 -2
- chia/_tests/core/full_node/test_hint_management.py +1 -1
- chia/_tests/core/full_node/test_node_load.py +20 -21
- chia/_tests/core/full_node/test_performance.py +3 -4
- chia/_tests/core/full_node/test_prev_tx_block.py +43 -0
- chia/_tests/core/full_node/test_subscriptions.py +1 -2
- chia/_tests/core/full_node/test_transactions.py +9 -5
- chia/_tests/core/full_node/test_tx_processing_queue.py +1 -2
- chia/_tests/core/large_block.py +1 -2
- chia/_tests/core/make_block_generator.py +3 -4
- chia/_tests/core/mempool/test_mempool.py +36 -86
- chia/_tests/core/mempool/test_mempool_fee_estimator.py +1 -1
- chia/_tests/core/mempool/test_mempool_item_queries.py +1 -3
- chia/_tests/core/mempool/test_mempool_manager.py +421 -69
- chia/_tests/core/mempool/test_mempool_performance.py +3 -2
- chia/_tests/core/mempool/test_singleton_fast_forward.py +60 -131
- chia/_tests/core/server/flood.py +1 -1
- chia/_tests/core/server/test_dos.py +1 -1
- chia/_tests/core/server/test_node_discovery.py +41 -27
- chia/_tests/core/server/test_rate_limits.py +1 -1
- chia/_tests/core/server/test_server.py +1 -1
- chia/_tests/core/services/test_services.py +5 -5
- chia/_tests/core/ssl/test_ssl.py +1 -1
- chia/_tests/core/test_cost_calculation.py +6 -6
- chia/_tests/core/test_crawler.py +2 -2
- chia/_tests/core/test_crawler_rpc.py +1 -1
- chia/_tests/core/test_db_conversion.py +3 -1
- chia/_tests/core/test_db_validation.py +5 -3
- chia/_tests/core/test_farmer_harvester_rpc.py +15 -15
- chia/_tests/core/test_filter.py +4 -1
- chia/_tests/core/test_full_node_rpc.py +99 -82
- chia/_tests/core/test_program.py +2 -2
- chia/_tests/core/util/test_block_cache.py +1 -1
- chia/_tests/core/util/test_keychain.py +2 -2
- chia/_tests/core/util/test_lockfile.py +1 -1
- chia/_tests/core/util/test_log_exceptions.py +5 -5
- chia/_tests/core/util/test_streamable.py +81 -22
- chia/_tests/db/test_db_wrapper.py +1 -3
- chia/_tests/environments/wallet.py +5 -5
- chia/_tests/farmer_harvester/test_farmer.py +9 -7
- chia/_tests/farmer_harvester/test_farmer_harvester.py +11 -4
- chia/_tests/farmer_harvester/test_filter_prefix_bits.py +6 -5
- chia/_tests/farmer_harvester/test_third_party_harvesters.py +15 -9
- chia/_tests/fee_estimation/test_fee_estimation_integration.py +1 -2
- chia/_tests/fee_estimation/test_fee_estimation_rpc.py +7 -5
- chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +1 -1
- chia/_tests/generator/test_compression.py +1 -2
- chia/_tests/generator/test_rom.py +8 -4
- chia/_tests/plot_sync/test_plot_sync.py +3 -3
- chia/_tests/plot_sync/test_receiver.py +3 -3
- chia/_tests/plot_sync/test_sender.py +1 -1
- chia/_tests/plot_sync/test_sync_simulated.py +3 -3
- chia/_tests/plot_sync/util.py +2 -2
- chia/_tests/pools/test_pool_cmdline.py +48 -21
- chia/_tests/pools/test_pool_puzzles_lifecycle.py +2 -3
- chia/_tests/pools/test_pool_rpc.py +237 -105
- chia/_tests/pools/test_pool_wallet.py +11 -2
- chia/_tests/pools/test_wallet_pool_store.py +5 -4
- chia/_tests/rpc/test_rpc_client.py +1 -1
- chia/_tests/simulation/test_simulation.py +13 -8
- chia/_tests/simulation/test_simulator.py +2 -2
- chia/_tests/timelord/test_new_peak.py +191 -47
- chia/_tests/timelord/test_timelord.py +1 -1
- chia/_tests/tools/test_full_sync.py +0 -2
- chia/_tests/tools/test_run_block.py +3 -1
- chia/_tests/util/benchmark_cost.py +3 -3
- chia/_tests/util/benchmarks.py +2 -2
- chia/_tests/util/blockchain.py +11 -5
- chia/_tests/util/blockchain_mock.py +1 -4
- chia/_tests/util/coin_store.py +29 -0
- chia/_tests/util/constants.py +2 -18
- chia/_tests/util/full_sync.py +3 -3
- chia/_tests/util/generator_tools_testing.py +2 -3
- chia/_tests/util/key_tool.py +2 -3
- chia/_tests/util/misc.py +33 -31
- chia/_tests/util/network_protocol_data.py +19 -17
- chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
- chia/_tests/util/protocol_messages_json.py +3 -1
- chia/_tests/util/run_block.py +2 -2
- chia/_tests/util/setup_nodes.py +7 -7
- chia/_tests/util/spend_sim.py +47 -55
- chia/_tests/util/test_condition_tools.py +5 -4
- chia/_tests/util/test_config.py +2 -2
- chia/_tests/util/test_dump_keyring.py +1 -1
- chia/_tests/util/test_full_block_utils.py +12 -14
- chia/_tests/util/test_misc.py +2 -2
- chia/_tests/util/test_paginator.py +4 -4
- chia/_tests/util/test_priority_mutex.py +2 -2
- chia/_tests/util/test_replace_str_to_bytes.py +15 -5
- chia/_tests/util/test_ssl_check.py +1 -1
- chia/_tests/util/test_testnet_overrides.py +13 -3
- chia/_tests/util/time_out_assert.py +4 -2
- chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +1 -1
- chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +1 -2
- chia/_tests/wallet/cat_wallet/test_cat_wallet.py +352 -432
- chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +3 -6
- chia/_tests/wallet/cat_wallet/test_trades.py +53 -77
- chia/_tests/wallet/clawback/test_clawback_decorator.py +3 -1
- chia/_tests/wallet/clawback/test_clawback_lifecycle.py +3 -3
- chia/_tests/wallet/clawback/test_clawback_metadata.py +4 -2
- chia/_tests/wallet/conftest.py +11 -12
- chia/_tests/wallet/db_wallet/test_db_graftroot.py +11 -4
- chia/_tests/wallet/db_wallet/test_dl_offers.py +433 -130
- chia/_tests/wallet/db_wallet/test_dl_wallet.py +3 -3
- chia/_tests/wallet/did_wallet/test_did.py +2132 -2000
- chia/_tests/wallet/nft_wallet/config.py +1 -1
- chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +1610 -742
- chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +486 -907
- chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +4 -4
- chia/_tests/wallet/nft_wallet/test_nft_wallet.py +517 -294
- chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +133 -62
- chia/_tests/wallet/rpc/test_wallet_rpc.py +305 -184
- chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +10 -6
- chia/_tests/wallet/sync/test_wallet_sync.py +89 -60
- chia/_tests/wallet/test_clvm_casts.py +88 -0
- chia/_tests/wallet/test_coin_management.py +1 -1
- chia/_tests/wallet/test_coin_selection.py +1 -1
- chia/_tests/wallet/test_conditions.py +1 -1
- chia/_tests/wallet/test_new_wallet_protocol.py +13 -11
- chia/_tests/wallet/test_notifications.py +5 -3
- chia/_tests/wallet/test_sign_coin_spends.py +6 -6
- chia/_tests/wallet/test_signer_protocol.py +13 -12
- chia/_tests/wallet/test_singleton.py +1 -1
- chia/_tests/wallet/test_singleton_lifecycle_fast.py +5 -7
- chia/_tests/wallet/test_util.py +2 -2
- chia/_tests/wallet/test_wallet.py +108 -29
- chia/_tests/wallet/test_wallet_action_scope.py +9 -2
- chia/_tests/wallet/test_wallet_blockchain.py +2 -3
- chia/_tests/wallet/test_wallet_key_val_store.py +1 -2
- chia/_tests/wallet/test_wallet_node.py +2 -4
- chia/_tests/wallet/test_wallet_retry.py +4 -2
- chia/_tests/wallet/test_wallet_state_manager.py +191 -5
- chia/_tests/wallet/test_wallet_test_framework.py +1 -1
- chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +8 -8
- chia/_tests/wallet/vc_wallet/test_vc_wallet.py +29 -12
- chia/_tests/wallet/wallet_block_tools.py +6 -6
- chia/_tests/weight_proof/test_weight_proof.py +10 -48
- chia/apis.py +1 -1
- chia/cmds/beta.py +1 -1
- chia/cmds/chia.py +9 -9
- chia/cmds/cmd_classes.py +12 -11
- chia/cmds/cmd_helpers.py +1 -1
- chia/cmds/cmds_util.py +12 -9
- chia/cmds/coin_funcs.py +2 -2
- chia/cmds/configure.py +2 -2
- chia/cmds/data.py +0 -2
- chia/cmds/data_funcs.py +1 -1
- chia/cmds/db_validate_func.py +1 -2
- chia/cmds/dev/__init__.py +0 -0
- chia/cmds/dev/data.py +273 -0
- chia/cmds/{gh.py → dev/gh.py} +5 -5
- chia/cmds/dev/main.py +22 -0
- chia/cmds/dev/mempool.py +78 -0
- chia/cmds/dev/mempool_funcs.py +63 -0
- chia/cmds/farm_funcs.py +5 -4
- chia/cmds/init_funcs.py +11 -11
- chia/cmds/keys.py +2 -2
- chia/cmds/keys_funcs.py +4 -4
- chia/cmds/netspace_funcs.py +1 -1
- chia/cmds/peer_funcs.py +2 -2
- chia/cmds/plotnft_funcs.py +72 -26
- chia/cmds/rpc.py +1 -1
- chia/cmds/show_funcs.py +5 -5
- chia/cmds/signer.py +8 -7
- chia/cmds/sim_funcs.py +8 -9
- chia/cmds/wallet.py +2 -2
- chia/cmds/wallet_funcs.py +165 -131
- chia/{util → consensus}/augmented_chain.py +1 -2
- chia/consensus/block_body_validation.py +54 -40
- chia/consensus/block_creation.py +42 -76
- chia/consensus/block_header_validation.py +32 -26
- chia/consensus/block_record.py +0 -3
- chia/consensus/blockchain.py +23 -32
- chia/consensus/blockchain_interface.py +1 -5
- chia/consensus/check_time_locks.py +57 -0
- chia/consensus/coin_store_protocol.py +151 -0
- chia/consensus/coinbase.py +0 -6
- chia/consensus/condition_costs.py +4 -0
- chia/{util → consensus}/condition_tools.py +4 -5
- chia/consensus/cost_calculator.py +1 -1
- chia/consensus/default_constants.py +32 -9
- chia/consensus/deficit.py +1 -3
- chia/consensus/difficulty_adjustment.py +1 -2
- chia/consensus/find_fork_point.py +1 -3
- chia/consensus/full_block_to_block_record.py +1 -6
- chia/{util → consensus}/generator_tools.py +1 -3
- chia/consensus/get_block_challenge.py +30 -7
- chia/consensus/make_sub_epoch_summary.py +1 -5
- chia/consensus/multiprocess_validation.py +21 -20
- chia/consensus/pot_iterations.py +74 -13
- chia/{util → consensus}/prev_transaction_block.py +1 -1
- chia/consensus/vdf_info_computation.py +1 -3
- chia/daemon/keychain_proxy.py +5 -5
- chia/daemon/server.py +22 -5
- chia/data_layer/data_layer.py +92 -51
- chia/{rpc → data_layer}/data_layer_rpc_api.py +1 -1
- chia/{rpc → data_layer}/data_layer_rpc_util.py +3 -6
- chia/data_layer/data_layer_util.py +4 -6
- chia/data_layer/data_layer_wallet.py +42 -69
- chia/data_layer/dl_wallet_store.py +12 -6
- chia/data_layer/download_data.py +3 -3
- chia/data_layer/s3_plugin_service.py +0 -1
- chia/farmer/farmer.py +3 -4
- chia/farmer/farmer_api.py +11 -7
- chia/{rpc → farmer}/farmer_rpc_client.py +1 -1
- chia/full_node/block_height_map.py +7 -6
- chia/full_node/block_store.py +5 -7
- chia/full_node/bundle_tools.py +1 -2
- chia/full_node/coin_store.py +143 -124
- chia/{types → full_node}/eligible_coin_spends.py +39 -70
- chia/full_node/fee_estimator.py +1 -1
- chia/full_node/fee_estimator_interface.py +0 -8
- chia/full_node/fee_tracker.py +25 -25
- chia/full_node/full_node.py +70 -53
- chia/full_node/full_node_api.py +57 -40
- chia/{rpc → full_node}/full_node_rpc_api.py +87 -8
- chia/{rpc → full_node}/full_node_rpc_client.py +7 -6
- chia/full_node/full_node_store.py +23 -8
- chia/full_node/mempool.py +206 -53
- chia/full_node/mempool_check_conditions.py +20 -63
- chia/full_node/mempool_manager.py +32 -42
- chia/full_node/subscriptions.py +1 -3
- chia/full_node/tx_processing_queue.py +50 -3
- chia/full_node/weight_proof.py +46 -37
- chia/harvester/harvester.py +1 -1
- chia/harvester/harvester_api.py +22 -7
- chia/introducer/introducer.py +1 -1
- chia/introducer/introducer_api.py +1 -1
- chia/plot_sync/exceptions.py +1 -1
- chia/plot_sync/receiver.py +1 -1
- chia/plot_sync/sender.py +2 -2
- chia/pools/pool_puzzles.py +13 -18
- chia/pools/pool_wallet.py +23 -46
- chia/protocols/farmer_protocol.py +11 -3
- chia/protocols/full_node_protocol.py +1 -4
- chia/protocols/harvester_protocol.py +3 -3
- chia/protocols/pool_protocol.py +1 -2
- chia/protocols/shared_protocol.py +3 -3
- chia/protocols/timelord_protocol.py +1 -3
- chia/protocols/wallet_protocol.py +3 -3
- chia/rpc/rpc_client.py +7 -8
- chia/rpc/rpc_server.py +3 -3
- chia/rpc/util.py +3 -1
- chia/seeder/crawler.py +1 -1
- chia/seeder/crawler_api.py +1 -1
- chia/seeder/dns_server.py +2 -0
- chia/seeder/start_crawler.py +3 -3
- chia/server/address_manager.py +286 -38
- chia/server/address_manager_store.py +0 -215
- chia/{types → server}/aliases.py +7 -7
- chia/server/api_protocol.py +1 -1
- chia/server/chia_policy.py +1 -1
- chia/server/node_discovery.py +76 -113
- chia/server/rate_limits.py +1 -1
- chia/server/resolve_peer_info.py +43 -0
- chia/server/server.py +5 -5
- chia/server/start_data_layer.py +4 -4
- chia/server/start_farmer.py +5 -4
- chia/server/start_full_node.py +5 -4
- chia/server/start_harvester.py +7 -5
- chia/server/start_introducer.py +2 -2
- chia/server/start_service.py +1 -1
- chia/server/start_timelord.py +7 -5
- chia/server/start_wallet.py +7 -5
- chia/server/ws_connection.py +1 -1
- chia/simulator/add_blocks_in_batches.py +2 -2
- chia/simulator/block_tools.py +245 -201
- chia/simulator/full_node_simulator.py +38 -10
- chia/simulator/setup_services.py +12 -12
- chia/simulator/simulator_full_node_rpc_api.py +2 -2
- chia/simulator/simulator_full_node_rpc_client.py +2 -2
- chia/simulator/simulator_test_tools.py +2 -2
- chia/simulator/start_simulator.py +1 -1
- chia/simulator/wallet_tools.py +10 -18
- chia/ssl/create_ssl.py +1 -1
- chia/timelord/iters_from_block.py +14 -14
- chia/timelord/timelord.py +15 -11
- chia/timelord/timelord_api.py +14 -2
- chia/timelord/timelord_state.py +20 -14
- chia/types/blockchain_format/program.py +53 -10
- chia/types/blockchain_format/proof_of_space.py +73 -19
- chia/types/coin_spend.py +3 -56
- chia/types/generator_types.py +28 -0
- chia/types/internal_mempool_item.py +1 -2
- chia/types/mempool_item.py +12 -7
- chia/types/unfinished_header_block.py +1 -2
- chia/types/validation_state.py +1 -2
- chia/types/weight_proof.py +1 -3
- chia/util/action_scope.py +3 -3
- chia/util/block_cache.py +1 -2
- chia/util/byte_types.py +1 -1
- chia/util/casts.py +21 -0
- chia/util/config.py +0 -37
- chia/util/db_wrapper.py +8 -1
- chia/util/errors.py +3 -2
- chia/util/initial-config.yaml +21 -5
- chia/util/keychain.py +6 -7
- chia/util/keyring_wrapper.py +5 -5
- chia/util/limited_semaphore.py +1 -1
- chia/util/priority_mutex.py +1 -1
- chia/util/streamable.py +63 -5
- chia/util/task_timing.py +1 -1
- chia/util/virtual_project_analysis.py +1 -1
- chia/wallet/cat_wallet/cat_info.py +7 -3
- chia/wallet/cat_wallet/cat_outer_puzzle.py +9 -5
- chia/wallet/cat_wallet/cat_utils.py +1 -1
- chia/wallet/cat_wallet/cat_wallet.py +44 -36
- chia/wallet/cat_wallet/lineage_store.py +7 -0
- chia/wallet/cat_wallet/r_cat_wallet.py +273 -0
- chia/wallet/conditions.py +5 -10
- chia/wallet/db_wallet/db_wallet_puzzles.py +4 -4
- chia/wallet/derivation_record.py +33 -0
- chia/wallet/derive_keys.py +3 -3
- chia/wallet/did_wallet/did_info.py +12 -3
- chia/wallet/did_wallet/did_wallet.py +132 -101
- chia/wallet/did_wallet/did_wallet_puzzles.py +9 -9
- chia/wallet/driver_protocol.py +3 -1
- chia/{types/spend_bundle.py → wallet/estimate_fees.py} +2 -7
- chia/wallet/nft_wallet/metadata_outer_puzzle.py +5 -3
- chia/wallet/nft_wallet/nft_puzzle_utils.py +1 -1
- chia/wallet/nft_wallet/nft_wallet.py +69 -112
- chia/wallet/nft_wallet/ownership_outer_puzzle.py +5 -3
- chia/wallet/nft_wallet/singleton_outer_puzzle.py +6 -4
- chia/wallet/nft_wallet/transfer_program_puzzle.py +4 -2
- chia/wallet/nft_wallet/uncurry_nft.py +4 -6
- chia/wallet/notification_manager.py +2 -3
- chia/wallet/outer_puzzles.py +7 -2
- chia/wallet/puzzle_drivers.py +1 -1
- chia/wallet/puzzles/clawback/drivers.py +5 -4
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +1 -1
- chia/wallet/puzzles/singleton_top_layer.py +2 -1
- chia/wallet/puzzles/singleton_top_layer_v1_1.py +2 -1
- chia/wallet/puzzles/tails.py +1 -3
- chia/wallet/signer_protocol.py +5 -6
- chia/wallet/singleton.py +5 -4
- chia/wallet/singleton_record.py +1 -1
- chia/wallet/trade_manager.py +18 -20
- chia/wallet/trade_record.py +3 -6
- chia/wallet/trading/offer.py +12 -13
- chia/wallet/uncurried_puzzle.py +2 -2
- chia/wallet/util/compute_additions.py +58 -0
- chia/wallet/util/compute_hints.py +3 -3
- chia/wallet/util/compute_memos.py +4 -4
- chia/wallet/util/curry_and_treehash.py +2 -1
- chia/wallet/util/debug_spend_bundle.py +1 -1
- chia/wallet/util/merkle_tree.py +1 -1
- chia/wallet/util/peer_request_cache.py +1 -2
- chia/wallet/util/tx_config.py +3 -8
- chia/wallet/util/wallet_sync_utils.py +10 -5
- chia/wallet/util/wallet_types.py +1 -0
- chia/wallet/vc_wallet/cr_cat_drivers.py +17 -18
- chia/wallet/vc_wallet/cr_cat_wallet.py +30 -28
- chia/wallet/vc_wallet/cr_outer_puzzle.py +5 -3
- chia/wallet/vc_wallet/vc_drivers.py +50 -8
- chia/wallet/vc_wallet/vc_store.py +3 -5
- chia/wallet/vc_wallet/vc_wallet.py +15 -22
- chia/wallet/wallet.py +36 -46
- chia/wallet/wallet_action_scope.py +73 -4
- chia/wallet/wallet_blockchain.py +1 -3
- chia/wallet/wallet_interested_store.py +1 -1
- chia/wallet/wallet_nft_store.py +3 -3
- chia/wallet/wallet_node.py +17 -16
- chia/wallet/wallet_node_api.py +4 -5
- chia/wallet/wallet_pool_store.py +1 -1
- chia/wallet/wallet_protocol.py +2 -0
- chia/wallet/wallet_puzzle_store.py +1 -1
- chia/{rpc → wallet}/wallet_request_types.py +670 -81
- chia/{rpc → wallet}/wallet_rpc_api.py +735 -766
- chia/{rpc → wallet}/wallet_rpc_client.py +268 -420
- chia/wallet/wallet_singleton_store.py +8 -7
- chia/wallet/wallet_spend_bundle.py +4 -3
- chia/wallet/wallet_state_manager.py +320 -191
- chia/wallet/wallet_weight_proof_handler.py +1 -2
- chia/wallet/wsm_apis.py +98 -0
- {chia_blockchain-2.5.4rc1.dist-info → chia_blockchain-2.5.5rc1.dist-info}/METADATA +7 -7
- {chia_blockchain-2.5.4rc1.dist-info → chia_blockchain-2.5.5rc1.dist-info}/RECORD +443 -436
- mozilla-ca/cacert.pem +3 -165
- chia/_tests/fee_estimation/test_mempoolitem_height_added.py +0 -145
- chia/cmds/dev.py +0 -18
- chia/types/blockchain_format/slots.py +0 -9
- chia/types/blockchain_format/sub_epoch_summary.py +0 -5
- chia/types/end_of_slot_bundle.py +0 -5
- chia/types/full_block.py +0 -5
- chia/types/header_block.py +0 -5
- chia/types/spend_bundle_conditions.py +0 -7
- chia/types/transaction_queue_entry.py +0 -56
- chia/types/unfinished_block.py +0 -5
- /chia/cmds/{installers.py → dev/installers.py} +0 -0
- /chia/cmds/{sim.py → dev/sim.py} +0 -0
- /chia/{util → cmds}/dump_keyring.py +0 -0
- /chia/{full_node → consensus}/signage_point.py +0 -0
- /chia/{rpc → data_layer}/data_layer_rpc_client.py +0 -0
- /chia/{rpc → farmer}/farmer_rpc_api.py +0 -0
- /chia/{util → full_node}/full_block_utils.py +0 -0
- /chia/{rpc → harvester}/harvester_rpc_api.py +0 -0
- /chia/{rpc → harvester}/harvester_rpc_client.py +0 -0
- /chia/{full_node → protocols}/fee_estimate.py +0 -0
- /chia/{server → protocols}/outbound_message.py +0 -0
- /chia/{rpc → seeder}/crawler_rpc_api.py +0 -0
- /chia/{util → simulator}/vdf_prover.py +0 -0
- /chia/{util → ssl}/ssl_check.py +0 -0
- /chia/{rpc → timelord}/timelord_rpc_api.py +0 -0
- {chia_blockchain-2.5.4rc1.dist-info → chia_blockchain-2.5.5rc1.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.4rc1.dist-info → chia_blockchain-2.5.5rc1.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.4rc1.dist-info → chia_blockchain-2.5.5rc1.dist-info}/entry_points.txt +0 -0
|
@@ -6,17 +6,19 @@ import io
|
|
|
6
6
|
import json
|
|
7
7
|
import logging
|
|
8
8
|
import random
|
|
9
|
+
from collections.abc import AsyncIterator
|
|
9
10
|
from operator import attrgetter
|
|
10
11
|
from typing import Any, Optional, cast
|
|
11
12
|
from unittest.mock import patch
|
|
12
13
|
|
|
13
14
|
import aiosqlite
|
|
14
15
|
import pytest
|
|
15
|
-
from chia_rs import G1Element, G2Element
|
|
16
|
+
from chia_rs import CoinSpend, G1Element, G2Element
|
|
16
17
|
from chia_rs.sized_bytes import bytes32
|
|
17
|
-
from chia_rs.sized_ints import uint16, uint32, uint64
|
|
18
|
+
from chia_rs.sized_ints import uint16, uint32, uint64, uint128
|
|
18
19
|
|
|
19
20
|
from chia._tests.environments.wallet import WalletStateTransition, WalletTestFramework
|
|
21
|
+
from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices
|
|
20
22
|
from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none
|
|
21
23
|
from chia._tests.wallet.test_wallet_coin_store import (
|
|
22
24
|
get_coin_records_amount_filter_tests,
|
|
@@ -47,39 +49,16 @@ from chia._tests.wallet.test_wallet_coin_store import (
|
|
|
47
49
|
from chia.cmds.coins import CombineCMD, SplitCMD
|
|
48
50
|
from chia.cmds.param_types import CliAmount
|
|
49
51
|
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
|
50
|
-
from chia.
|
|
51
|
-
from chia.rpc.full_node_rpc_client import FullNodeRpcClient
|
|
52
|
+
from chia.full_node.full_node_rpc_client import FullNodeRpcClient
|
|
52
53
|
from chia.rpc.rpc_client import ResponseFailureError
|
|
53
|
-
from chia.
|
|
54
|
-
from chia.rpc.wallet_request_types import (
|
|
55
|
-
AddKey,
|
|
56
|
-
CheckDeleteKey,
|
|
57
|
-
CombineCoins,
|
|
58
|
-
DefaultCAT,
|
|
59
|
-
DeleteKey,
|
|
60
|
-
DIDGetPubkey,
|
|
61
|
-
GetNotifications,
|
|
62
|
-
GetPrivateKey,
|
|
63
|
-
GetSyncStatusResponse,
|
|
64
|
-
GetTimestampForHeight,
|
|
65
|
-
LogIn,
|
|
66
|
-
PushTransactions,
|
|
67
|
-
PushTX,
|
|
68
|
-
SetWalletResyncOnStartup,
|
|
69
|
-
SplitCoins,
|
|
70
|
-
VerifySignature,
|
|
71
|
-
VerifySignatureResponse,
|
|
72
|
-
)
|
|
73
|
-
from chia.rpc.wallet_rpc_api import WalletRpcApi
|
|
74
|
-
from chia.rpc.wallet_rpc_client import WalletRpcClient
|
|
54
|
+
from chia.server.aliases import WalletService
|
|
75
55
|
from chia.server.server import ChiaServer
|
|
76
|
-
from chia.server.start_service import Service
|
|
77
56
|
from chia.simulator.full_node_simulator import FullNodeSimulator
|
|
78
57
|
from chia.simulator.simulator_protocol import FarmNewBlockProtocol
|
|
79
58
|
from chia.types.blockchain_format.coin import Coin, coin_as_list
|
|
80
59
|
from chia.types.blockchain_format.program import Program
|
|
81
60
|
from chia.types.coin_record import CoinRecord
|
|
82
|
-
from chia.types.coin_spend import
|
|
61
|
+
from chia.types.coin_spend import make_spend
|
|
83
62
|
from chia.types.peer_info import PeerInfo
|
|
84
63
|
from chia.types.signing_mode import SigningMode
|
|
85
64
|
from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash
|
|
@@ -101,7 +80,10 @@ from chia.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_
|
|
|
101
80
|
from chia.wallet.did_wallet.did_wallet import DIDWallet
|
|
102
81
|
from chia.wallet.nft_wallet.nft_wallet import NFTWallet
|
|
103
82
|
from chia.wallet.puzzles.clawback.metadata import AutoClaimSettings
|
|
83
|
+
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_hash_for_pk
|
|
104
84
|
from chia.wallet.signer_protocol import UnsignedTransaction
|
|
85
|
+
from chia.wallet.trade_record import TradeRecord
|
|
86
|
+
from chia.wallet.trading.offer import Offer
|
|
105
87
|
from chia.wallet.trading.trade_status import TradeStatus
|
|
106
88
|
from chia.wallet.transaction_record import TransactionRecord
|
|
107
89
|
from chia.wallet.transaction_sorting import SortKey
|
|
@@ -119,6 +101,44 @@ from chia.wallet.wallet_coin_record import WalletCoinRecord
|
|
|
119
101
|
from chia.wallet.wallet_coin_store import GetCoinRecords
|
|
120
102
|
from chia.wallet.wallet_node import WalletNode
|
|
121
103
|
from chia.wallet.wallet_protocol import WalletProtocol
|
|
104
|
+
from chia.wallet.wallet_request_types import (
|
|
105
|
+
AddKey,
|
|
106
|
+
CheckDeleteKey,
|
|
107
|
+
CombineCoins,
|
|
108
|
+
DefaultCAT,
|
|
109
|
+
DeleteKey,
|
|
110
|
+
DIDCreateBackupFile,
|
|
111
|
+
DIDGetDID,
|
|
112
|
+
DIDGetMetadata,
|
|
113
|
+
DIDGetPubkey,
|
|
114
|
+
DIDGetRecoveryList,
|
|
115
|
+
DIDGetWalletName,
|
|
116
|
+
DIDMessageSpend,
|
|
117
|
+
DIDSetWalletName,
|
|
118
|
+
DIDTransferDID,
|
|
119
|
+
DIDUpdateMetadata,
|
|
120
|
+
DIDUpdateRecoveryIDs,
|
|
121
|
+
FungibleAsset,
|
|
122
|
+
GetNotifications,
|
|
123
|
+
GetPrivateKey,
|
|
124
|
+
GetSyncStatusResponse,
|
|
125
|
+
GetTimestampForHeight,
|
|
126
|
+
LogIn,
|
|
127
|
+
NFTCalculateRoyalties,
|
|
128
|
+
NFTGetInfo,
|
|
129
|
+
NFTGetNFTs,
|
|
130
|
+
NFTMintNFTRequest,
|
|
131
|
+
NFTTransferNFT,
|
|
132
|
+
PushTransactions,
|
|
133
|
+
PushTX,
|
|
134
|
+
RoyaltyAsset,
|
|
135
|
+
SetWalletResyncOnStartup,
|
|
136
|
+
SplitCoins,
|
|
137
|
+
VerifySignature,
|
|
138
|
+
VerifySignatureResponse,
|
|
139
|
+
)
|
|
140
|
+
from chia.wallet.wallet_rpc_api import WalletRpcApi
|
|
141
|
+
from chia.wallet.wallet_rpc_client import WalletRpcClient
|
|
122
142
|
from chia.wallet.wallet_spend_bundle import WalletSpendBundle
|
|
123
143
|
|
|
124
144
|
log = logging.getLogger(__name__)
|
|
@@ -126,7 +146,7 @@ log = logging.getLogger(__name__)
|
|
|
126
146
|
|
|
127
147
|
@dataclasses.dataclass
|
|
128
148
|
class WalletBundle:
|
|
129
|
-
service:
|
|
149
|
+
service: WalletService
|
|
130
150
|
node: WalletNode
|
|
131
151
|
rpc_client: WalletRpcClient
|
|
132
152
|
wallet: Wallet
|
|
@@ -150,29 +170,30 @@ async def check_client_synced(wallet_client: WalletRpcClient) -> bool:
|
|
|
150
170
|
return (await wallet_client.get_sync_status()).synced
|
|
151
171
|
|
|
152
172
|
|
|
153
|
-
async def farm_transaction_block(full_node_api: FullNodeSimulator, wallet_node: WalletNode):
|
|
173
|
+
async def farm_transaction_block(full_node_api: FullNodeSimulator, wallet_node: WalletNode) -> None:
|
|
154
174
|
await full_node_api.farm_blocks_to_puzzlehash(count=1)
|
|
155
175
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
156
176
|
|
|
157
177
|
|
|
158
|
-
def check_mempool_spend_count(full_node_api: FullNodeSimulator, num_of_spends):
|
|
178
|
+
def check_mempool_spend_count(full_node_api: FullNodeSimulator, num_of_spends: int) -> bool:
|
|
159
179
|
return full_node_api.full_node.mempool_manager.mempool.size() == num_of_spends
|
|
160
180
|
|
|
161
181
|
|
|
162
|
-
async def farm_transaction(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
)
|
|
182
|
+
async def farm_transaction(
|
|
183
|
+
full_node_api: FullNodeSimulator, wallet_node: WalletNode, spend_bundle: WalletSpendBundle
|
|
184
|
+
) -> None:
|
|
185
|
+
spend_bundle_name = spend_bundle.name()
|
|
186
|
+
await time_out_assert(20, full_node_api.full_node.mempool_manager.get_spendbundle, spend_bundle, spend_bundle_name)
|
|
166
187
|
await farm_transaction_block(full_node_api, wallet_node)
|
|
167
|
-
assert full_node_api.full_node.mempool_manager.get_spendbundle(
|
|
188
|
+
assert full_node_api.full_node.mempool_manager.get_spendbundle(spend_bundle_name) is None
|
|
168
189
|
|
|
169
190
|
|
|
170
|
-
async def generate_funds(full_node_api: FullNodeSimulator, wallet_bundle: WalletBundle, num_blocks: int = 1):
|
|
191
|
+
async def generate_funds(full_node_api: FullNodeSimulator, wallet_bundle: WalletBundle, num_blocks: int = 1) -> int:
|
|
171
192
|
wallet_id = 1
|
|
172
193
|
initial_balances = await wallet_bundle.rpc_client.get_wallet_balance(wallet_id)
|
|
173
194
|
ph: bytes32 = decode_puzzle_hash(await wallet_bundle.rpc_client.get_next_address(wallet_id, True))
|
|
174
195
|
generated_funds = 0
|
|
175
|
-
for
|
|
196
|
+
for _ in range(num_blocks):
|
|
176
197
|
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
|
177
198
|
peak_height = full_node_api.full_node.blockchain.get_peak_height()
|
|
178
199
|
assert peak_height is not None
|
|
@@ -191,7 +212,9 @@ async def generate_funds(full_node_api: FullNodeSimulator, wallet_bundle: Wallet
|
|
|
191
212
|
|
|
192
213
|
|
|
193
214
|
@pytest.fixture(scope="function", params=[True, False])
|
|
194
|
-
async def wallet_rpc_environment(
|
|
215
|
+
async def wallet_rpc_environment(
|
|
216
|
+
two_wallet_nodes_services: SimulatorsAndWalletsServices, request: pytest.FixtureRequest, self_hostname: str
|
|
217
|
+
) -> AsyncIterator[WalletRpcTestEnvironment]:
|
|
195
218
|
full_node, wallets, bt = two_wallet_nodes_services
|
|
196
219
|
full_node_service = full_node[0]
|
|
197
220
|
full_node_api = full_node_service._api
|
|
@@ -216,33 +239,42 @@ async def wallet_rpc_environment(two_wallet_nodes_services, request, self_hostna
|
|
|
216
239
|
await wallet_node.server.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
|
217
240
|
await wallet_node_2.server.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
|
218
241
|
|
|
242
|
+
assert wallet_service.rpc_server is not None
|
|
219
243
|
async with WalletRpcClient.create_as_context(
|
|
220
244
|
hostname, wallet_service.rpc_server.listen_port, wallet_service.root_path, wallet_service.config
|
|
221
245
|
) as client:
|
|
246
|
+
assert wallet_service_2.rpc_server is not None
|
|
222
247
|
async with WalletRpcClient.create_as_context(
|
|
223
248
|
hostname, wallet_service_2.rpc_server.listen_port, wallet_service_2.root_path, wallet_service_2.config
|
|
224
249
|
) as client_2:
|
|
250
|
+
assert full_node_service.rpc_server is not None
|
|
225
251
|
async with FullNodeRpcClient.create_as_context(
|
|
226
252
|
hostname,
|
|
227
253
|
full_node_service.rpc_server.listen_port,
|
|
228
254
|
full_node_service.root_path,
|
|
229
255
|
full_node_service.config,
|
|
230
256
|
) as client_node:
|
|
231
|
-
wallet_bundle_1
|
|
232
|
-
wallet_bundle_2
|
|
233
|
-
node_bundle
|
|
257
|
+
wallet_bundle_1 = WalletBundle(wallet_service, wallet_node, client, wallet)
|
|
258
|
+
wallet_bundle_2 = WalletBundle(wallet_service_2, wallet_node_2, client_2, wallet_2)
|
|
259
|
+
node_bundle = FullNodeBundle(full_node_server, full_node_api, client_node)
|
|
234
260
|
|
|
235
261
|
yield WalletRpcTestEnvironment(wallet_bundle_1, wallet_bundle_2, node_bundle)
|
|
236
262
|
|
|
237
263
|
|
|
238
264
|
async def create_tx_outputs(wallet: Wallet, output_args: list[tuple[int, Optional[list[str]]]]) -> list[dict[str, Any]]:
|
|
239
265
|
outputs = []
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
266
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
267
|
+
for args in output_args:
|
|
268
|
+
output = {
|
|
269
|
+
"amount": uint64(args[0]),
|
|
270
|
+
"puzzle_hash": await action_scope.get_puzzle_hash(
|
|
271
|
+
wallet.wallet_state_manager, override_reuse_puzhash_with=False
|
|
272
|
+
),
|
|
273
|
+
}
|
|
274
|
+
if args[1] is not None:
|
|
275
|
+
assert len(args[1]) > 0
|
|
276
|
+
output["memos"] = args[1]
|
|
277
|
+
outputs.append(output)
|
|
246
278
|
return outputs
|
|
247
279
|
|
|
248
280
|
|
|
@@ -278,7 +310,7 @@ def assert_tx_amounts(
|
|
|
278
310
|
assert (sum(removal_amounts) - sum(addition_amounts)) == amount_fee
|
|
279
311
|
|
|
280
312
|
|
|
281
|
-
async def assert_push_tx_error(node_rpc: FullNodeRpcClient, tx: TransactionRecord):
|
|
313
|
+
async def assert_push_tx_error(node_rpc: FullNodeRpcClient, tx: TransactionRecord) -> None:
|
|
282
314
|
spend_bundle = tx.spend_bundle
|
|
283
315
|
assert spend_bundle is not None
|
|
284
316
|
# check error for a ASSERT_ANNOUNCE_CONSUMED_FAILED and if the error is not there throw a value error
|
|
@@ -290,7 +322,7 @@ async def assert_push_tx_error(node_rpc: FullNodeRpcClient, tx: TransactionRecor
|
|
|
290
322
|
raise ValueError from error
|
|
291
323
|
|
|
292
324
|
|
|
293
|
-
async def assert_get_balance(rpc_client: WalletRpcClient, wallet_node: WalletNode, wallet: WalletProtocol) -> None:
|
|
325
|
+
async def assert_get_balance(rpc_client: WalletRpcClient, wallet_node: WalletNode, wallet: WalletProtocol[Any]) -> None:
|
|
294
326
|
expected_balance = await wallet_node.get_balance(wallet.id())
|
|
295
327
|
expected_balance_dict = expected_balance.to_json_dict()
|
|
296
328
|
expected_balance_dict["wallet_id"] = wallet.id()
|
|
@@ -302,21 +334,25 @@ async def assert_get_balance(rpc_client: WalletRpcClient, wallet_node: WalletNod
|
|
|
302
334
|
assert await rpc_client.get_wallet_balance(wallet.id()) == expected_balance_dict
|
|
303
335
|
|
|
304
336
|
|
|
305
|
-
async def tx_in_mempool(client: WalletRpcClient, transaction_id: bytes32):
|
|
337
|
+
async def tx_in_mempool(client: WalletRpcClient, transaction_id: bytes32) -> bool:
|
|
306
338
|
tx = await client.get_transaction(transaction_id)
|
|
307
339
|
return tx.is_in_mempool()
|
|
308
340
|
|
|
309
341
|
|
|
310
|
-
async def get_confirmed_balance(client: WalletRpcClient, wallet_id: int):
|
|
311
|
-
|
|
342
|
+
async def get_confirmed_balance(client: WalletRpcClient, wallet_id: int) -> uint128:
|
|
343
|
+
balance = await client.get_wallet_balance(wallet_id)
|
|
344
|
+
# TODO: casting due to lack of type checked deserialization
|
|
345
|
+
return cast(uint128, balance["confirmed_wallet_balance"])
|
|
312
346
|
|
|
313
347
|
|
|
314
|
-
async def get_unconfirmed_balance(client: WalletRpcClient, wallet_id: int):
|
|
315
|
-
|
|
348
|
+
async def get_unconfirmed_balance(client: WalletRpcClient, wallet_id: int) -> uint128:
|
|
349
|
+
balance = await client.get_wallet_balance(wallet_id)
|
|
350
|
+
# TODO: casting due to lack of type checked deserialization
|
|
351
|
+
return cast(uint128, balance["unconfirmed_wallet_balance"])
|
|
316
352
|
|
|
317
353
|
|
|
318
354
|
@pytest.mark.anyio
|
|
319
|
-
async def test_send_transaction(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
355
|
+
async def test_send_transaction(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
320
356
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
321
357
|
|
|
322
358
|
wallet_2: Wallet = env.wallet_2.wallet
|
|
@@ -326,7 +362,8 @@ async def test_send_transaction(wallet_rpc_environment: WalletRpcTestEnvironment
|
|
|
326
362
|
|
|
327
363
|
generated_funds = await generate_funds(full_node_api, env.wallet_1)
|
|
328
364
|
|
|
329
|
-
|
|
365
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
366
|
+
addr = encode_puzzle_hash(await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager), "txch")
|
|
330
367
|
tx_amount = uint64(15600000)
|
|
331
368
|
with pytest.raises(ValueError):
|
|
332
369
|
await client.send_transaction(1, uint64(100000000000000001), addr, DEFAULT_TX_CONFIG)
|
|
@@ -396,7 +433,7 @@ async def test_send_transaction(wallet_rpc_environment: WalletRpcTestEnvironment
|
|
|
396
433
|
|
|
397
434
|
|
|
398
435
|
@pytest.mark.anyio
|
|
399
|
-
async def test_push_transactions(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
436
|
+
async def test_push_transactions(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
400
437
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
401
438
|
|
|
402
439
|
wallet: Wallet = env.wallet_1.wallet
|
|
@@ -443,7 +480,7 @@ async def test_push_transactions(wallet_rpc_environment: WalletRpcTestEnvironmen
|
|
|
443
480
|
|
|
444
481
|
|
|
445
482
|
@pytest.mark.anyio
|
|
446
|
-
async def test_get_balance(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
483
|
+
async def test_get_balance(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
447
484
|
env = wallet_rpc_environment
|
|
448
485
|
wallet: Wallet = env.wallet_1.wallet
|
|
449
486
|
wallet_node: WalletNode = env.wallet_1.node
|
|
@@ -465,7 +502,7 @@ async def test_get_balance(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
465
502
|
|
|
466
503
|
|
|
467
504
|
@pytest.mark.anyio
|
|
468
|
-
async def test_get_farmed_amount(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
505
|
+
async def test_get_farmed_amount(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
469
506
|
env = wallet_rpc_environment
|
|
470
507
|
wallet: Wallet = env.wallet_1.wallet
|
|
471
508
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
@@ -491,7 +528,7 @@ async def test_get_farmed_amount(wallet_rpc_environment: WalletRpcTestEnvironmen
|
|
|
491
528
|
|
|
492
529
|
|
|
493
530
|
@pytest.mark.anyio
|
|
494
|
-
async def test_get_farmed_amount_with_fee(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
531
|
+
async def test_get_farmed_amount_with_fee(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
495
532
|
env = wallet_rpc_environment
|
|
496
533
|
wallet: Wallet = env.wallet_1.wallet
|
|
497
534
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
@@ -508,8 +545,8 @@ async def test_get_farmed_amount_with_fee(wallet_rpc_environment: WalletRpcTestE
|
|
|
508
545
|
action_scope=action_scope,
|
|
509
546
|
fee=uint64(fee_amount),
|
|
510
547
|
)
|
|
548
|
+
our_ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
511
549
|
|
|
512
|
-
our_ph = await wallet.get_new_puzzlehash()
|
|
513
550
|
await full_node_api.wait_transaction_records_entered_mempool(records=action_scope.side_effects.transactions)
|
|
514
551
|
await full_node_api.farm_blocks_to_puzzlehash(count=2, farm_to=our_ph, guarantee_transaction_blocks=True)
|
|
515
552
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
@@ -519,7 +556,7 @@ async def test_get_farmed_amount_with_fee(wallet_rpc_environment: WalletRpcTestE
|
|
|
519
556
|
|
|
520
557
|
|
|
521
558
|
@pytest.mark.anyio
|
|
522
|
-
async def test_get_timestamp_for_height(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
559
|
+
async def test_get_timestamp_for_height(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
523
560
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
524
561
|
|
|
525
562
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
@@ -554,7 +591,7 @@ async def test_create_signed_transaction(
|
|
|
554
591
|
fee: int,
|
|
555
592
|
select_coin: bool,
|
|
556
593
|
is_cat: bool,
|
|
557
|
-
):
|
|
594
|
+
) -> None:
|
|
558
595
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
559
596
|
|
|
560
597
|
wallet_2: Wallet = env.wallet_2.wallet
|
|
@@ -574,7 +611,7 @@ async def test_create_signed_transaction(
|
|
|
574
611
|
wallet_id = res["wallet_id"]
|
|
575
612
|
|
|
576
613
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
577
|
-
for
|
|
614
|
+
for _ in range(5):
|
|
578
615
|
if check_mempool_spend_count(full_node_api, 0):
|
|
579
616
|
break
|
|
580
617
|
await farm_transaction_block(full_node_api, wallet_1_node)
|
|
@@ -652,7 +689,9 @@ async def test_create_signed_transaction(
|
|
|
652
689
|
|
|
653
690
|
|
|
654
691
|
@pytest.mark.anyio
|
|
655
|
-
async def test_create_signed_transaction_with_coin_announcement(
|
|
692
|
+
async def test_create_signed_transaction_with_coin_announcement(
|
|
693
|
+
wallet_rpc_environment: WalletRpcTestEnvironment,
|
|
694
|
+
) -> None:
|
|
656
695
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
657
696
|
|
|
658
697
|
wallet_2: Wallet = env.wallet_2.wallet
|
|
@@ -684,7 +723,9 @@ async def test_create_signed_transaction_with_coin_announcement(wallet_rpc_envir
|
|
|
684
723
|
|
|
685
724
|
|
|
686
725
|
@pytest.mark.anyio
|
|
687
|
-
async def test_create_signed_transaction_with_puzzle_announcement(
|
|
726
|
+
async def test_create_signed_transaction_with_puzzle_announcement(
|
|
727
|
+
wallet_rpc_environment: WalletRpcTestEnvironment,
|
|
728
|
+
) -> None:
|
|
688
729
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
689
730
|
|
|
690
731
|
wallet_2: Wallet = env.wallet_2.wallet
|
|
@@ -765,7 +806,7 @@ async def test_create_signed_transaction_with_excluded_coins(wallet_rpc_environm
|
|
|
765
806
|
|
|
766
807
|
|
|
767
808
|
@pytest.mark.anyio
|
|
768
|
-
async def test_spend_clawback_coins(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
809
|
+
async def test_spend_clawback_coins(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
769
810
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
770
811
|
|
|
771
812
|
wallet_1_node: WalletNode = env.wallet_1.node
|
|
@@ -779,9 +820,11 @@ async def test_spend_clawback_coins(wallet_rpc_environment: WalletRpcTestEnviron
|
|
|
779
820
|
|
|
780
821
|
generated_funds = await generate_funds(full_node_api, env.wallet_1, 1)
|
|
781
822
|
await generate_funds(full_node_api, env.wallet_2, 1)
|
|
782
|
-
|
|
823
|
+
async with wallet_1.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
824
|
+
wallet_1_puzhash = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
|
|
783
825
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_1_node, timeout=20)
|
|
784
|
-
|
|
826
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
827
|
+
wallet_2_puzhash = await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager)
|
|
785
828
|
tx = (
|
|
786
829
|
await wallet_1_rpc.send_transaction(
|
|
787
830
|
wallet_id=1,
|
|
@@ -884,7 +927,7 @@ async def test_spend_clawback_coins(wallet_rpc_environment: WalletRpcTestEnviron
|
|
|
884
927
|
|
|
885
928
|
|
|
886
929
|
@pytest.mark.anyio
|
|
887
|
-
async def test_send_transaction_multi(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
930
|
+
async def test_send_transaction_multi(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
888
931
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
889
932
|
|
|
890
933
|
wallet_2: Wallet = env.wallet_2.wallet
|
|
@@ -935,7 +978,7 @@ async def test_send_transaction_multi(wallet_rpc_environment: WalletRpcTestEnvir
|
|
|
935
978
|
|
|
936
979
|
|
|
937
980
|
@pytest.mark.anyio
|
|
938
|
-
async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
981
|
+
async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
939
982
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
940
983
|
|
|
941
984
|
wallet: Wallet = env.wallet_1.wallet
|
|
@@ -960,7 +1003,8 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment
|
|
|
960
1003
|
assert all_transactions == sorted(all_transactions, key=attrgetter("confirmed_at_height"), reverse=True)
|
|
961
1004
|
|
|
962
1005
|
# Test RELEVANCE
|
|
963
|
-
|
|
1006
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1007
|
+
puzhash = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
964
1008
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
965
1009
|
await client.send_transaction(
|
|
966
1010
|
1, uint64(1), encode_puzzle_hash(puzhash, "txch"), DEFAULT_TX_CONFIG
|
|
@@ -979,7 +1023,8 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment
|
|
|
979
1023
|
assert all_transactions == sorted_transactions
|
|
980
1024
|
|
|
981
1025
|
# Test get_transactions to address
|
|
982
|
-
|
|
1026
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1027
|
+
ph_by_addr = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
983
1028
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
984
1029
|
await client.send_transaction(1, uint64(1), encode_puzzle_hash(ph_by_addr, "txch"), DEFAULT_TX_CONFIG)
|
|
985
1030
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
@@ -992,7 +1037,7 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment
|
|
|
992
1037
|
1, type_filter=TransactionTypeFilter.include([TransactionType.COINBASE_REWARD])
|
|
993
1038
|
)
|
|
994
1039
|
assert len(all_transactions) == 5
|
|
995
|
-
assert all(transaction.type == TransactionType.COINBASE_REWARD for transaction in all_transactions)
|
|
1040
|
+
assert all(transaction.type == TransactionType.COINBASE_REWARD.value for transaction in all_transactions)
|
|
996
1041
|
# Test confirmed filter
|
|
997
1042
|
all_transactions = await client.get_transactions(1, confirmed=True)
|
|
998
1043
|
assert len(all_transactions) == 10
|
|
@@ -1012,7 +1057,7 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment
|
|
|
1012
1057
|
|
|
1013
1058
|
|
|
1014
1059
|
@pytest.mark.anyio
|
|
1015
|
-
async def test_get_transaction_count(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
1060
|
+
async def test_get_transaction_count(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
1016
1061
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1017
1062
|
|
|
1018
1063
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
@@ -1033,7 +1078,7 @@ async def test_get_transaction_count(wallet_rpc_environment: WalletRpcTestEnviro
|
|
|
1033
1078
|
|
|
1034
1079
|
|
|
1035
1080
|
@pytest.mark.anyio
|
|
1036
|
-
async def test_cat_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
1081
|
+
async def test_cat_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
1037
1082
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1038
1083
|
|
|
1039
1084
|
wallet_node: WalletNode = env.wallet_1.node
|
|
@@ -1196,7 +1241,7 @@ async def test_cat_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1196
1241
|
|
|
1197
1242
|
|
|
1198
1243
|
@pytest.mark.anyio
|
|
1199
|
-
async def test_offer_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
1244
|
+
async def test_offer_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
1200
1245
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1201
1246
|
|
|
1202
1247
|
wallet_node: WalletNode = env.wallet_1.node
|
|
@@ -1315,14 +1360,14 @@ async def test_offer_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment)
|
|
|
1315
1360
|
|
|
1316
1361
|
await farm_transaction_block(full_node_api, wallet_node)
|
|
1317
1362
|
|
|
1318
|
-
async def is_trade_confirmed(client,
|
|
1319
|
-
trade_record = await client.get_offer(
|
|
1363
|
+
async def is_trade_confirmed(client: WalletRpcClient, offer: Offer) -> bool:
|
|
1364
|
+
trade_record = await client.get_offer(offer.name())
|
|
1320
1365
|
return TradeStatus(trade_record.status) == TradeStatus.CONFIRMED
|
|
1321
1366
|
|
|
1322
1367
|
await time_out_assert(15, is_trade_confirmed, True, wallet_1_rpc, offer)
|
|
1323
1368
|
|
|
1324
1369
|
# Test trade sorting
|
|
1325
|
-
def only_ids(trades):
|
|
1370
|
+
def only_ids(trades: list[TradeRecord]) -> list[bytes32]:
|
|
1326
1371
|
return [t.trade_id for t in trades]
|
|
1327
1372
|
|
|
1328
1373
|
trade_record = await wallet_1_rpc.get_offer(offer.name())
|
|
@@ -1403,7 +1448,10 @@ async def test_get_coin_records_by_names(wallet_rpc_environment: WalletRpcTestEn
|
|
|
1403
1448
|
full_node_api = env.full_node.api
|
|
1404
1449
|
# Generate some funds
|
|
1405
1450
|
generated_funds = await generate_funds(full_node_api, env.wallet_1, 5)
|
|
1406
|
-
|
|
1451
|
+
async with env.wallet_1.wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1452
|
+
address = encode_puzzle_hash(
|
|
1453
|
+
await action_scope.get_puzzle_hash(env.wallet_1.wallet.wallet_state_manager), "txch"
|
|
1454
|
+
)
|
|
1407
1455
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
1408
1456
|
|
|
1409
1457
|
# Spend half of it back to the same wallet get some spent coins in the wallet
|
|
@@ -1448,7 +1496,7 @@ async def test_get_coin_records_by_names(wallet_rpc_environment: WalletRpcTestEn
|
|
|
1448
1496
|
|
|
1449
1497
|
|
|
1450
1498
|
@pytest.mark.anyio
|
|
1451
|
-
async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
1499
|
+
async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
1452
1500
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1453
1501
|
|
|
1454
1502
|
wallet_1: Wallet = env.wallet_1.wallet
|
|
@@ -1469,57 +1517,67 @@ async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1469
1517
|
did_id_0 = res["my_did"]
|
|
1470
1518
|
|
|
1471
1519
|
# Get wallet name
|
|
1472
|
-
|
|
1473
|
-
assert
|
|
1474
|
-
|
|
1475
|
-
nft_wallet: WalletProtocol = wallet_1_node.wallet_state_manager.wallets[did_wallet_id_0 + 1]
|
|
1520
|
+
get_name_res = await wallet_1_rpc.did_get_wallet_name(DIDGetWalletName(did_wallet_id_0))
|
|
1521
|
+
assert get_name_res.name == "Profile 1"
|
|
1522
|
+
nft_wallet = wallet_1_node.wallet_state_manager.wallets[did_wallet_id_0 + 1]
|
|
1476
1523
|
assert isinstance(nft_wallet, NFTWallet)
|
|
1477
1524
|
assert nft_wallet.get_name() == "Profile 1 NFT Wallet"
|
|
1478
1525
|
|
|
1479
1526
|
# Set wallet name
|
|
1480
1527
|
new_wallet_name = "test name"
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
assert res["success"]
|
|
1485
|
-
assert res["name"] == new_wallet_name
|
|
1528
|
+
await wallet_1_rpc.did_set_wallet_name(DIDSetWalletName(did_wallet_id_0, new_wallet_name))
|
|
1529
|
+
get_name_res = await wallet_1_rpc.did_get_wallet_name(DIDGetWalletName(did_wallet_id_0))
|
|
1530
|
+
assert get_name_res.name == new_wallet_name
|
|
1486
1531
|
with pytest.raises(ValueError, match="wallet id 1 is of type Wallet but type DIDWallet is required"):
|
|
1487
|
-
await wallet_1_rpc.did_set_wallet_name(wallet_1_id, new_wallet_name)
|
|
1532
|
+
await wallet_1_rpc.did_set_wallet_name(DIDSetWalletName(wallet_1_id, new_wallet_name))
|
|
1488
1533
|
|
|
1489
1534
|
# Check DID ID
|
|
1490
|
-
|
|
1491
|
-
assert
|
|
1492
|
-
assert did_id_0 == res["my_did"]
|
|
1535
|
+
did_id_res = await wallet_1_rpc.get_did_id(DIDGetDID(did_wallet_id_0))
|
|
1536
|
+
assert did_id_0 == did_id_res.my_did
|
|
1493
1537
|
# Create backup file
|
|
1494
|
-
|
|
1495
|
-
assert res["success"]
|
|
1538
|
+
await wallet_1_rpc.create_did_backup_file(DIDCreateBackupFile(did_wallet_id_0))
|
|
1496
1539
|
|
|
1497
1540
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
1498
1541
|
await farm_transaction_block(full_node_api, wallet_1_node)
|
|
1499
1542
|
# Update recovery list
|
|
1500
|
-
update_res = await wallet_1_rpc.update_did_recovery_list(
|
|
1543
|
+
update_res = await wallet_1_rpc.update_did_recovery_list(
|
|
1544
|
+
DIDUpdateRecoveryIDs(
|
|
1545
|
+
wallet_id=uint32(did_wallet_id_0), new_list=[did_id_0], num_verifications_required=uint64(1), push=True
|
|
1546
|
+
),
|
|
1547
|
+
DEFAULT_TX_CONFIG,
|
|
1548
|
+
)
|
|
1501
1549
|
assert len(update_res.transactions) > 0
|
|
1502
|
-
|
|
1503
|
-
assert
|
|
1504
|
-
assert
|
|
1550
|
+
recovery_list_res = await wallet_1_rpc.get_did_recovery_list(DIDGetRecoveryList(did_wallet_id_0))
|
|
1551
|
+
assert recovery_list_res.num_required == 1
|
|
1552
|
+
assert recovery_list_res.recovery_list[0] == did_id_0
|
|
1505
1553
|
|
|
1506
1554
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
1507
1555
|
await farm_transaction_block(full_node_api, wallet_1_node)
|
|
1508
1556
|
|
|
1509
1557
|
# Update metadata
|
|
1510
1558
|
with pytest.raises(ValueError, match="wallet id 1 is of type Wallet but type DIDWallet is required"):
|
|
1511
|
-
await wallet_1_rpc.update_did_metadata(
|
|
1512
|
-
|
|
1559
|
+
await wallet_1_rpc.update_did_metadata(
|
|
1560
|
+
DIDUpdateMetadata(wallet_id=wallet_1_id, metadata={"Twitter": "Https://test"}, push=True), DEFAULT_TX_CONFIG
|
|
1561
|
+
)
|
|
1562
|
+
await wallet_1_rpc.update_did_metadata(
|
|
1563
|
+
DIDUpdateMetadata(wallet_id=did_wallet_id_0, metadata={"Twitter": "Https://test"}, push=True), DEFAULT_TX_CONFIG
|
|
1564
|
+
)
|
|
1513
1565
|
|
|
1514
|
-
|
|
1515
|
-
assert
|
|
1566
|
+
get_metadata_res = await wallet_1_rpc.get_did_metadata(DIDGetMetadata(did_wallet_id_0))
|
|
1567
|
+
assert get_metadata_res.metadata["Twitter"] == "Https://test"
|
|
1516
1568
|
|
|
1517
1569
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
1518
1570
|
await farm_transaction_block(full_node_api, wallet_1_node)
|
|
1519
1571
|
|
|
1520
1572
|
# Transfer DID
|
|
1521
|
-
|
|
1522
|
-
|
|
1573
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1574
|
+
addr = encode_puzzle_hash(await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager), "txch")
|
|
1575
|
+
await wallet_1_rpc.did_transfer_did(
|
|
1576
|
+
DIDTransferDID(
|
|
1577
|
+
wallet_id=did_wallet_id_0, inner_address=addr, fee=uint64(0), with_recovery_info=True, push=True
|
|
1578
|
+
),
|
|
1579
|
+
DEFAULT_TX_CONFIG,
|
|
1580
|
+
)
|
|
1523
1581
|
|
|
1524
1582
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
1525
1583
|
await farm_transaction_block(full_node_api, wallet_1_node)
|
|
@@ -1531,11 +1589,11 @@ async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1531
1589
|
|
|
1532
1590
|
did_wallets = list(
|
|
1533
1591
|
filter(
|
|
1534
|
-
lambda w: (w.type == WalletType.DECENTRALIZED_ID),
|
|
1592
|
+
lambda w: (w.type == WalletType.DECENTRALIZED_ID.value),
|
|
1535
1593
|
await wallet_2_node.wallet_state_manager.get_all_wallet_info_entries(),
|
|
1536
1594
|
)
|
|
1537
1595
|
)
|
|
1538
|
-
did_wallet_2
|
|
1596
|
+
did_wallet_2 = wallet_2_node.wallet_state_manager.wallets[did_wallets[0].id]
|
|
1539
1597
|
assert isinstance(did_wallet_2, DIDWallet)
|
|
1540
1598
|
assert (
|
|
1541
1599
|
encode_puzzle_hash(bytes32.from_hexstr(did_wallet_2.get_my_DID()), AddressType.DID.hrp(wallet_2_node.config))
|
|
@@ -1545,7 +1603,7 @@ async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1545
1603
|
assert metadata["Twitter"] == "Https://test"
|
|
1546
1604
|
|
|
1547
1605
|
last_did_coin = await did_wallet_2.get_coin()
|
|
1548
|
-
await wallet_2_rpc.did_message_spend(did_wallet_2.id(),
|
|
1606
|
+
await wallet_2_rpc.did_message_spend(DIDMessageSpend(wallet_id=did_wallet_2.id(), push=True), DEFAULT_TX_CONFIG)
|
|
1549
1607
|
await wallet_2_node.wallet_state_manager.add_interested_coin_ids([last_did_coin.name()])
|
|
1550
1608
|
|
|
1551
1609
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
@@ -1555,7 +1613,9 @@ async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1555
1613
|
assert next_did_coin.parent_coin_info == last_did_coin.name()
|
|
1556
1614
|
last_did_coin = next_did_coin
|
|
1557
1615
|
|
|
1558
|
-
await wallet_2_rpc.did_message_spend(
|
|
1616
|
+
await wallet_2_rpc.did_message_spend(
|
|
1617
|
+
DIDMessageSpend(wallet_id=did_wallet_2.id(), push=True), DEFAULT_TX_CONFIG.override(reuse_puzhash=True)
|
|
1618
|
+
)
|
|
1559
1619
|
await wallet_2_node.wallet_state_manager.add_interested_coin_ids([last_did_coin.name()])
|
|
1560
1620
|
|
|
1561
1621
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
@@ -1571,7 +1631,7 @@ async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1571
1631
|
|
|
1572
1632
|
|
|
1573
1633
|
@pytest.mark.anyio
|
|
1574
|
-
async def test_nft_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
1634
|
+
async def test_nft_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
1575
1635
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1576
1636
|
wallet_1_node: WalletNode = env.wallet_1.node
|
|
1577
1637
|
wallet_1_rpc: WalletRpcClient = env.wallet_1.rpc_client
|
|
@@ -1585,12 +1645,15 @@ async def test_nft_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1585
1645
|
res = await wallet_1_rpc.create_new_nft_wallet(None)
|
|
1586
1646
|
nft_wallet_id = res["wallet_id"]
|
|
1587
1647
|
mint_res = await wallet_1_rpc.mint_nft(
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1648
|
+
request=NFTMintNFTRequest(
|
|
1649
|
+
wallet_id=nft_wallet_id,
|
|
1650
|
+
royalty_address=None,
|
|
1651
|
+
target_address=None,
|
|
1652
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
1653
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1654
|
+
push=True,
|
|
1655
|
+
),
|
|
1656
|
+
tx_config=DEFAULT_TX_CONFIG,
|
|
1594
1657
|
)
|
|
1595
1658
|
|
|
1596
1659
|
spend_bundle = mint_res.spend_bundle
|
|
@@ -1599,27 +1662,32 @@ async def test_nft_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1599
1662
|
|
|
1600
1663
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_1_node, timeout=15)
|
|
1601
1664
|
|
|
1602
|
-
nft_wallet
|
|
1665
|
+
nft_wallet = wallet_1_node.wallet_state_manager.wallets[nft_wallet_id]
|
|
1603
1666
|
assert isinstance(nft_wallet, NFTWallet)
|
|
1604
1667
|
|
|
1605
|
-
async def have_nfts():
|
|
1668
|
+
async def have_nfts() -> bool:
|
|
1606
1669
|
return await nft_wallet.get_nft_count() > 0
|
|
1607
1670
|
|
|
1608
1671
|
await time_out_assert(15, have_nfts, True)
|
|
1609
1672
|
|
|
1610
1673
|
# Test with the hex version of nft_id
|
|
1611
1674
|
nft_id = (await nft_wallet.get_current_nfts())[0].coin.name().hex()
|
|
1612
|
-
|
|
1613
|
-
|
|
1675
|
+
with pytest.raises(ResponseFailureError, match="Invalid Coin ID format for 'coin_id'"):
|
|
1676
|
+
await wallet_1_rpc.get_nft_info(NFTGetInfo("error"))
|
|
1677
|
+
nft_info = (await wallet_1_rpc.get_nft_info(NFTGetInfo(nft_id))).nft_info
|
|
1678
|
+
assert nft_info.nft_coin_id == (await nft_wallet.get_current_nfts())[0].coin.name()
|
|
1614
1679
|
# Test with the bech32m version of nft_id
|
|
1615
1680
|
hmr_nft_id = encode_puzzle_hash(
|
|
1616
1681
|
(await nft_wallet.get_current_nfts())[0].coin.name(), AddressType.NFT.hrp(wallet_1_node.config)
|
|
1617
1682
|
)
|
|
1618
|
-
nft_info = (await wallet_1_rpc.get_nft_info(hmr_nft_id))
|
|
1619
|
-
assert nft_info
|
|
1683
|
+
nft_info = (await wallet_1_rpc.get_nft_info(NFTGetInfo(hmr_nft_id))).nft_info
|
|
1684
|
+
assert nft_info.nft_coin_id == (await nft_wallet.get_current_nfts())[0].coin.name()
|
|
1620
1685
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1686
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1687
|
+
addr = encode_puzzle_hash(await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager), "txch")
|
|
1688
|
+
await wallet_1_rpc.transfer_nft(
|
|
1689
|
+
NFTTransferNFT(wallet_id=nft_wallet_id, nft_coin_id=nft_id, target_address=addr, push=True), DEFAULT_TX_CONFIG
|
|
1690
|
+
)
|
|
1623
1691
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
1624
1692
|
await farm_transaction_block(full_node_api, wallet_1_node)
|
|
1625
1693
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 0)
|
|
@@ -1630,26 +1698,71 @@ async def test_nft_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
1630
1698
|
nft_wallet_id_1 = (
|
|
1631
1699
|
await wallet_2_node.wallet_state_manager.get_all_wallet_info_entries(wallet_type=WalletType.NFT)
|
|
1632
1700
|
)[0].id
|
|
1633
|
-
nft_wallet_1
|
|
1701
|
+
nft_wallet_1 = wallet_2_node.wallet_state_manager.wallets[nft_wallet_id_1]
|
|
1634
1702
|
assert isinstance(nft_wallet_1, NFTWallet)
|
|
1635
|
-
nft_info_1 = (await wallet_1_rpc.get_nft_info(nft_id, False))
|
|
1703
|
+
nft_info_1 = (await wallet_1_rpc.get_nft_info(NFTGetInfo(nft_id, False))).nft_info
|
|
1636
1704
|
assert nft_info_1 == nft_info
|
|
1637
|
-
nft_info_1 = (await wallet_1_rpc.get_nft_info(nft_id))
|
|
1638
|
-
assert nft_info_1
|
|
1705
|
+
nft_info_1 = (await wallet_1_rpc.get_nft_info(NFTGetInfo(nft_id))).nft_info
|
|
1706
|
+
assert nft_info_1.nft_coin_id == (await nft_wallet_1.get_current_nfts())[0].coin.name()
|
|
1639
1707
|
# Cross-check NFT
|
|
1640
|
-
nft_info_2 = (await wallet_2_rpc.list_nfts(nft_wallet_id_1))
|
|
1708
|
+
nft_info_2 = (await wallet_2_rpc.list_nfts(NFTGetNFTs(nft_wallet_id_1))).nft_list[0]
|
|
1709
|
+
assert nft_info_1 == nft_info_2
|
|
1710
|
+
nft_info_2 = (await wallet_2_rpc.list_nfts(NFTGetNFTs())).nft_list[0]
|
|
1641
1711
|
assert nft_info_1 == nft_info_2
|
|
1642
1712
|
|
|
1643
1713
|
# Test royalty endpoint
|
|
1714
|
+
with pytest.raises(ValueError, match="Multiple royalty assets with same name specified"):
|
|
1715
|
+
await wallet_1_rpc.nft_calculate_royalties(
|
|
1716
|
+
NFTCalculateRoyalties(
|
|
1717
|
+
[
|
|
1718
|
+
RoyaltyAsset(
|
|
1719
|
+
"my asset",
|
|
1720
|
+
"my address",
|
|
1721
|
+
uint16(10000),
|
|
1722
|
+
),
|
|
1723
|
+
RoyaltyAsset(
|
|
1724
|
+
"my asset",
|
|
1725
|
+
"some other address",
|
|
1726
|
+
uint16(11111),
|
|
1727
|
+
),
|
|
1728
|
+
],
|
|
1729
|
+
[],
|
|
1730
|
+
)
|
|
1731
|
+
)
|
|
1732
|
+
with pytest.raises(ValueError, match="Multiple fungible assets with same name specified"):
|
|
1733
|
+
await wallet_1_rpc.nft_calculate_royalties(
|
|
1734
|
+
NFTCalculateRoyalties(
|
|
1735
|
+
[],
|
|
1736
|
+
[
|
|
1737
|
+
FungibleAsset(
|
|
1738
|
+
None,
|
|
1739
|
+
uint64(10000),
|
|
1740
|
+
),
|
|
1741
|
+
FungibleAsset(
|
|
1742
|
+
None,
|
|
1743
|
+
uint64(11111),
|
|
1744
|
+
),
|
|
1745
|
+
],
|
|
1746
|
+
)
|
|
1747
|
+
)
|
|
1644
1748
|
royalty_summary = await wallet_1_rpc.nft_calculate_royalties(
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1749
|
+
NFTCalculateRoyalties(
|
|
1750
|
+
[
|
|
1751
|
+
RoyaltyAsset(
|
|
1752
|
+
"my asset",
|
|
1753
|
+
"my address",
|
|
1754
|
+
uint16(10000),
|
|
1755
|
+
)
|
|
1756
|
+
],
|
|
1757
|
+
[
|
|
1758
|
+
FungibleAsset(
|
|
1759
|
+
None,
|
|
1760
|
+
uint64(10000),
|
|
1761
|
+
)
|
|
1762
|
+
],
|
|
1763
|
+
)
|
|
1651
1764
|
)
|
|
1652
|
-
assert royalty_summary == {
|
|
1765
|
+
assert royalty_summary.to_json_dict() == {
|
|
1653
1766
|
"my asset": [
|
|
1654
1767
|
{
|
|
1655
1768
|
"asset": None,
|
|
@@ -1669,11 +1782,11 @@ async def _check_delete_key(
|
|
|
1669
1782
|
|
|
1670
1783
|
sk = await wallet_node.get_key_for_fingerprint(farmer_fp, private=True)
|
|
1671
1784
|
assert sk is not None
|
|
1672
|
-
farmer_ph =
|
|
1785
|
+
farmer_ph = puzzle_hash_for_pk(create_sk(sk, uint32(0)).get_g1())
|
|
1673
1786
|
|
|
1674
1787
|
sk = await wallet_node.get_key_for_fingerprint(pool_fp, private=True)
|
|
1675
1788
|
assert sk is not None
|
|
1676
|
-
pool_ph =
|
|
1789
|
+
pool_ph = puzzle_hash_for_pk(create_sk(sk, uint32(0)).get_g1())
|
|
1677
1790
|
|
|
1678
1791
|
with lock_and_load_config(wallet_node.root_path, "config.yaml") as test_config:
|
|
1679
1792
|
test_config["farmer"]["xch_target_address"] = encode_puzzle_hash(farmer_ph, "txch")
|
|
@@ -1700,7 +1813,7 @@ async def _check_delete_key(
|
|
|
1700
1813
|
|
|
1701
1814
|
|
|
1702
1815
|
@pytest.mark.anyio
|
|
1703
|
-
async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
1816
|
+
async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
1704
1817
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1705
1818
|
|
|
1706
1819
|
wallet: Wallet = env.wallet_1.wallet
|
|
@@ -1717,7 +1830,8 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn
|
|
|
1717
1830
|
|
|
1718
1831
|
assert (await client.get_height_info()).height > 0
|
|
1719
1832
|
|
|
1720
|
-
|
|
1833
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1834
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
1721
1835
|
addr = encode_puzzle_hash(ph, "txch")
|
|
1722
1836
|
tx_amount = uint64(15600000)
|
|
1723
1837
|
await env.full_node.api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
@@ -1792,7 +1906,7 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn
|
|
|
1792
1906
|
|
|
1793
1907
|
|
|
1794
1908
|
@pytest.mark.anyio
|
|
1795
|
-
async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
1909
|
+
async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
1796
1910
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1797
1911
|
|
|
1798
1912
|
wallet_2: Wallet = env.wallet_2.wallet
|
|
@@ -1803,7 +1917,8 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
|
|
|
1803
1917
|
|
|
1804
1918
|
funds = await generate_funds(full_node_api, env.wallet_1)
|
|
1805
1919
|
|
|
1806
|
-
|
|
1920
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1921
|
+
addr = encode_puzzle_hash(await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager), "txch")
|
|
1807
1922
|
coin_300: list[Coin]
|
|
1808
1923
|
tx_amounts: list[uint64] = [uint64(1000), uint64(300), uint64(1000), uint64(1000), uint64(10000)]
|
|
1809
1924
|
for tx_amount in tx_amounts:
|
|
@@ -1923,7 +2038,7 @@ async def test_get_coin_records_rpc(wallet_rpc_environment: WalletRpcTestEnviron
|
|
|
1923
2038
|
test_request: GetCoinRecords,
|
|
1924
2039
|
test_total_count: Optional[int],
|
|
1925
2040
|
test_records: list[WalletCoinRecord],
|
|
1926
|
-
):
|
|
2041
|
+
) -> None:
|
|
1927
2042
|
response = await client.get_coin_records(test_request)
|
|
1928
2043
|
assert response["coin_records"] == [coin.to_json_dict_parsed_metadata() for coin in test_records], test_case
|
|
1929
2044
|
assert response["total_count"] == test_total_count, test_case
|
|
@@ -1962,9 +2077,9 @@ async def test_get_coin_records_rpc_limits(
|
|
|
1962
2077
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
1963
2078
|
wallet_node: WalletNode = env.wallet_1.node
|
|
1964
2079
|
client: WalletRpcClient = env.wallet_1.rpc_client
|
|
1965
|
-
rpc_server
|
|
2080
|
+
rpc_server = wallet_rpc_environment.wallet_1.service.rpc_server
|
|
1966
2081
|
assert rpc_server is not None
|
|
1967
|
-
api: WalletRpcApi =
|
|
2082
|
+
api: WalletRpcApi = rpc_server.rpc_api
|
|
1968
2083
|
store = wallet_node.wallet_state_manager.coin_store
|
|
1969
2084
|
|
|
1970
2085
|
# Adjust the limits for faster testing
|
|
@@ -2034,9 +2149,9 @@ async def test_get_coin_records_rpc_failures(
|
|
|
2034
2149
|
) -> None:
|
|
2035
2150
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2036
2151
|
client: WalletRpcClient = env.wallet_1.rpc_client
|
|
2037
|
-
rpc_server
|
|
2152
|
+
rpc_server = wallet_rpc_environment.wallet_1.service.rpc_server
|
|
2038
2153
|
assert rpc_server is not None
|
|
2039
|
-
api =
|
|
2154
|
+
api = rpc_server.rpc_api
|
|
2040
2155
|
|
|
2041
2156
|
too_many_hashes = [bytes32.random(seeded_random) for _ in range(api.max_get_coin_records_filter_items + 1)]
|
|
2042
2157
|
too_many_amounts = [
|
|
@@ -2076,7 +2191,7 @@ async def test_get_coin_records_rpc_failures(
|
|
|
2076
2191
|
|
|
2077
2192
|
|
|
2078
2193
|
@pytest.mark.anyio
|
|
2079
|
-
async def test_notification_rpcs(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2194
|
+
async def test_notification_rpcs(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2080
2195
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2081
2196
|
|
|
2082
2197
|
wallet_2: Wallet = env.wallet_2.wallet
|
|
@@ -2089,12 +2204,13 @@ async def test_notification_rpcs(wallet_rpc_environment: WalletRpcTestEnvironmen
|
|
|
2089
2204
|
|
|
2090
2205
|
env.wallet_2.node.config["enable_notifications"] = True
|
|
2091
2206
|
env.wallet_2.node.config["required_notification_amount"] = 100000000000
|
|
2092
|
-
|
|
2093
|
-
await
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2207
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
2208
|
+
tx = await client.send_notification(
|
|
2209
|
+
await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager),
|
|
2210
|
+
b"hello",
|
|
2211
|
+
uint64(100000000000),
|
|
2212
|
+
fee=uint64(100000000000),
|
|
2213
|
+
)
|
|
2098
2214
|
|
|
2099
2215
|
assert tx.spend_bundle is not None
|
|
2100
2216
|
await time_out_assert(
|
|
@@ -2115,12 +2231,13 @@ async def test_notification_rpcs(wallet_rpc_environment: WalletRpcTestEnvironmen
|
|
|
2115
2231
|
assert await client_2.delete_notifications()
|
|
2116
2232
|
assert [] == (await client_2.get_notifications(GetNotifications([notification.id]))).notifications
|
|
2117
2233
|
|
|
2118
|
-
|
|
2119
|
-
await
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2234
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
2235
|
+
tx = await client.send_notification(
|
|
2236
|
+
await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager),
|
|
2237
|
+
b"hello",
|
|
2238
|
+
uint64(100000000000),
|
|
2239
|
+
fee=uint64(100000000000),
|
|
2240
|
+
)
|
|
2124
2241
|
|
|
2125
2242
|
assert tx.spend_bundle is not None
|
|
2126
2243
|
await time_out_assert(
|
|
@@ -2277,10 +2394,10 @@ async def test_notification_rpcs(wallet_rpc_environment: WalletRpcTestEnvironmen
|
|
|
2277
2394
|
async def test_verify_signature(
|
|
2278
2395
|
wallet_rpc_environment: WalletRpcTestEnvironment,
|
|
2279
2396
|
rpc_request: dict[str, Any],
|
|
2280
|
-
rpc_response:
|
|
2397
|
+
rpc_response: VerifySignatureResponse,
|
|
2281
2398
|
prefix_hex_strings: bool,
|
|
2282
|
-
):
|
|
2283
|
-
rpc_server
|
|
2399
|
+
) -> None:
|
|
2400
|
+
rpc_server = wallet_rpc_environment.wallet_1.service.rpc_server
|
|
2284
2401
|
assert rpc_server is not None
|
|
2285
2402
|
updated_request = rpc_request.copy()
|
|
2286
2403
|
updated_request["pubkey"] = ("0x" if prefix_hex_strings else "") + updated_request["pubkey"]
|
|
@@ -2293,13 +2410,13 @@ async def test_verify_signature(
|
|
|
2293
2410
|
|
|
2294
2411
|
@pytest.mark.anyio
|
|
2295
2412
|
@pytest.mark.limit_consensus_modes(reason="irrelevant")
|
|
2296
|
-
async def test_set_auto_claim(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2413
|
+
async def test_set_auto_claim(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2297
2414
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2298
2415
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
2299
|
-
rpc_server
|
|
2416
|
+
rpc_server = wallet_rpc_environment.wallet_1.service.rpc_server
|
|
2300
2417
|
await generate_funds(full_node_api, env.wallet_1)
|
|
2301
2418
|
assert rpc_server is not None
|
|
2302
|
-
api: WalletRpcApi =
|
|
2419
|
+
api: WalletRpcApi = rpc_server.rpc_api
|
|
2303
2420
|
req = {"enabled": False, "tx_fee": -1, "min_amount": 100}
|
|
2304
2421
|
has_exception = False
|
|
2305
2422
|
try:
|
|
@@ -2320,10 +2437,10 @@ async def test_set_auto_claim(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
2320
2437
|
|
|
2321
2438
|
@pytest.mark.anyio
|
|
2322
2439
|
@pytest.mark.limit_consensus_modes(reason="irrelevant")
|
|
2323
|
-
async def test_get_auto_claim(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2440
|
+
async def test_get_auto_claim(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2324
2441
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2325
2442
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
2326
|
-
rpc_server
|
|
2443
|
+
rpc_server = wallet_rpc_environment.wallet_1.service.rpc_server
|
|
2327
2444
|
await generate_funds(full_node_api, env.wallet_1)
|
|
2328
2445
|
assert rpc_server is not None
|
|
2329
2446
|
res = await env.wallet_1.rpc_client.get_auto_claim()
|
|
@@ -2334,7 +2451,7 @@ async def test_get_auto_claim(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
|
2334
2451
|
|
|
2335
2452
|
|
|
2336
2453
|
@pytest.mark.anyio
|
|
2337
|
-
async def test_set_wallet_resync_on_startup(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2454
|
+
async def test_set_wallet_resync_on_startup(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2338
2455
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2339
2456
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
2340
2457
|
client: WalletRpcClient = env.wallet_1.rpc_client
|
|
@@ -2349,12 +2466,15 @@ async def test_set_wallet_resync_on_startup(wallet_rpc_environment: WalletRpcTes
|
|
|
2349
2466
|
nft_wallet_id = nft_wallet["wallet_id"]
|
|
2350
2467
|
address = await wc.get_next_address(env.wallet_1.wallet.id(), True)
|
|
2351
2468
|
await wc.mint_nft(
|
|
2352
|
-
|
|
2469
|
+
request=NFTMintNFTRequest(
|
|
2470
|
+
wallet_id=nft_wallet_id,
|
|
2471
|
+
royalty_address=address,
|
|
2472
|
+
target_address=address,
|
|
2473
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
2474
|
+
uris=["http://test.nft"],
|
|
2475
|
+
push=True,
|
|
2476
|
+
),
|
|
2353
2477
|
tx_config=DEFAULT_TX_CONFIG,
|
|
2354
|
-
royalty_address=address,
|
|
2355
|
-
target_address=address,
|
|
2356
|
-
hash="deadbeef",
|
|
2357
|
-
uris=["http://test.nft"],
|
|
2358
2478
|
)
|
|
2359
2479
|
await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1)
|
|
2360
2480
|
await farm_transaction_block(full_node_api, env.wallet_1.node)
|
|
@@ -2431,7 +2551,7 @@ async def test_set_wallet_resync_on_startup(wallet_rpc_environment: WalletRpcTes
|
|
|
2431
2551
|
|
|
2432
2552
|
|
|
2433
2553
|
@pytest.mark.anyio
|
|
2434
|
-
async def test_set_wallet_resync_on_startup_disable(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2554
|
+
async def test_set_wallet_resync_on_startup_disable(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2435
2555
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2436
2556
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
2437
2557
|
client: WalletRpcClient = env.wallet_1.rpc_client
|
|
@@ -2471,13 +2591,13 @@ async def test_set_wallet_resync_on_startup_disable(wallet_rpc_environment: Wall
|
|
|
2471
2591
|
|
|
2472
2592
|
@pytest.mark.anyio
|
|
2473
2593
|
@pytest.mark.limit_consensus_modes(reason="irrelevant")
|
|
2474
|
-
async def test_set_wallet_resync_schema(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2594
|
+
async def test_set_wallet_resync_schema(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2475
2595
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2476
2596
|
full_node_api: FullNodeSimulator = env.full_node.api
|
|
2477
2597
|
await generate_funds(full_node_api, env.wallet_1)
|
|
2478
2598
|
wallet_node: WalletNode = env.wallet_1.node
|
|
2479
2599
|
fingerprint = wallet_node.logged_in_fingerprint
|
|
2480
|
-
assert fingerprint
|
|
2600
|
+
assert fingerprint is not None
|
|
2481
2601
|
db_path = wallet_node.wallet_state_manager.db_path
|
|
2482
2602
|
assert await wallet_node.reset_sync_db(db_path, fingerprint), (
|
|
2483
2603
|
"Schema has been changed, reset sync db won't work, please update WalletNode.reset_sync_db function"
|
|
@@ -2493,7 +2613,7 @@ async def test_set_wallet_resync_schema(wallet_rpc_environment: WalletRpcTestEnv
|
|
|
2493
2613
|
|
|
2494
2614
|
|
|
2495
2615
|
@pytest.mark.anyio
|
|
2496
|
-
async def test_cat_spend_run_tail(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2616
|
+
async def test_cat_spend_run_tail(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2497
2617
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2498
2618
|
|
|
2499
2619
|
wallet_node: WalletNode = env.wallet_1.node
|
|
@@ -2504,7 +2624,8 @@ async def test_cat_spend_run_tail(wallet_rpc_environment: WalletRpcTestEnvironme
|
|
|
2504
2624
|
await generate_funds(full_node_api, env.wallet_1, 1)
|
|
2505
2625
|
|
|
2506
2626
|
# Send to a CAT with an anyone can spend TAIL
|
|
2507
|
-
|
|
2627
|
+
async with env.wallet_1.wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
2628
|
+
our_ph = await action_scope.get_puzzle_hash(env.wallet_1.wallet.wallet_state_manager)
|
|
2508
2629
|
cat_puzzle: Program = construct_cat_puzzle(CAT_MOD, Program.to(None).get_tree_hash(), Program.to(1))
|
|
2509
2630
|
addr = encode_puzzle_hash(
|
|
2510
2631
|
cat_puzzle.get_tree_hash(),
|
|
@@ -2572,7 +2693,7 @@ async def test_cat_spend_run_tail(wallet_rpc_environment: WalletRpcTestEnvironme
|
|
|
2572
2693
|
|
|
2573
2694
|
|
|
2574
2695
|
@pytest.mark.anyio
|
|
2575
|
-
async def test_get_balances(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|
2696
|
+
async def test_get_balances(wallet_rpc_environment: WalletRpcTestEnvironment) -> None:
|
|
2576
2697
|
env: WalletRpcTestEnvironment = wallet_rpc_environment
|
|
2577
2698
|
|
|
2578
2699
|
client: WalletRpcClient = env.wallet_1.rpc_client
|
|
@@ -2930,7 +3051,7 @@ async def test_combine_coins(wallet_environments: WalletTestFramework, capsys: p
|
|
|
2930
3051
|
async with env.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
2931
3052
|
await cat_wallet.generate_signed_transaction(
|
|
2932
3053
|
[BIG_COIN_AMOUNT, SMALL_COIN_AMOUNT, REALLY_SMALL_COIN_AMOUNT],
|
|
2933
|
-
[await
|
|
3054
|
+
[await action_scope.get_puzzle_hash(env.wallet_state_manager)] * 3,
|
|
2934
3055
|
action_scope,
|
|
2935
3056
|
)
|
|
2936
3057
|
|