chia-blockchain 2.5.4rc2__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 +26 -40
- 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.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/METADATA +7 -7
- {chia_blockchain-2.5.4rc2.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.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/entry_points.txt +0 -0
|
@@ -7,21 +7,13 @@ from typing import Any, Callable
|
|
|
7
7
|
import pytest
|
|
8
8
|
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
|
9
9
|
from chia_rs.sized_bytes import bytes32
|
|
10
|
-
from chia_rs.sized_ints import uint32, uint64
|
|
10
|
+
from chia_rs.sized_ints import uint16, uint32, uint64
|
|
11
11
|
from clvm_tools.binutils import disassemble
|
|
12
12
|
|
|
13
13
|
from chia._tests.conftest import ConsensusMode
|
|
14
14
|
from chia._tests.environments.wallet import WalletStateTransition, WalletTestFramework
|
|
15
15
|
from chia._tests.util.time_out_assert import time_out_assert
|
|
16
16
|
from chia.rpc.rpc_client import ResponseFailureError
|
|
17
|
-
from chia.rpc.wallet_request_types import (
|
|
18
|
-
NFTCoin,
|
|
19
|
-
NFTGetByDID,
|
|
20
|
-
NFTSetDIDBulk,
|
|
21
|
-
NFTSetNFTStatus,
|
|
22
|
-
NFTTransferBulk,
|
|
23
|
-
NFTWalletWithDID,
|
|
24
|
-
)
|
|
25
17
|
from chia.simulator.simulator_protocol import ReorgProtocol
|
|
26
18
|
from chia.types.blockchain_format.program import Program
|
|
27
19
|
from chia.types.signing_mode import CHIP_0002_SIGN_MESSAGE_PREFIX
|
|
@@ -34,6 +26,23 @@ from chia.wallet.nft_wallet.nft_wallet import NFTWallet
|
|
|
34
26
|
from chia.wallet.util.address_type import AddressType
|
|
35
27
|
from chia.wallet.util.compute_memos import compute_memos
|
|
36
28
|
from chia.wallet.util.wallet_types import WalletType
|
|
29
|
+
from chia.wallet.wallet_request_types import (
|
|
30
|
+
NFTAddURI,
|
|
31
|
+
NFTCoin,
|
|
32
|
+
NFTCountNFTs,
|
|
33
|
+
NFTGetByDID,
|
|
34
|
+
NFTGetInfo,
|
|
35
|
+
NFTGetNFTs,
|
|
36
|
+
NFTGetWalletDID,
|
|
37
|
+
NFTMintNFTRequest,
|
|
38
|
+
NFTSetDIDBulk,
|
|
39
|
+
NFTSetNFTDID,
|
|
40
|
+
NFTSetNFTStatus,
|
|
41
|
+
NFTTransferBulk,
|
|
42
|
+
NFTTransferNFT,
|
|
43
|
+
NFTWalletWithDID,
|
|
44
|
+
)
|
|
45
|
+
from chia.wallet.wallet_rpc_api import MAX_NFT_CHUNK_SIZE
|
|
37
46
|
from chia.wallet.wallet_state_manager import WalletStateManager
|
|
38
47
|
|
|
39
48
|
|
|
@@ -98,7 +107,10 @@ async def test_nft_wallet_creation_automatically(wallet_environments: WalletTest
|
|
|
98
107
|
wallet_node_0.wallet_state_manager, wallet_0, name="NFT WALLET 1"
|
|
99
108
|
)
|
|
100
109
|
metadata = Program.to(
|
|
101
|
-
[
|
|
110
|
+
[
|
|
111
|
+
("u", ["https://www.chia.net/img/branding/chia-logo.svg"]),
|
|
112
|
+
("h", "0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
113
|
+
]
|
|
102
114
|
)
|
|
103
115
|
|
|
104
116
|
async with nft_wallet_0.wallet_state_manager.new_action_scope(
|
|
@@ -154,12 +166,14 @@ async def test_nft_wallet_creation_automatically(wallet_environments: WalletTest
|
|
|
154
166
|
coins = await nft_wallet_0.get_current_nfts()
|
|
155
167
|
assert len(coins) == 1, "nft not generated"
|
|
156
168
|
|
|
169
|
+
async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
170
|
+
wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
|
|
157
171
|
async with nft_wallet_0.wallet_state_manager.new_action_scope(
|
|
158
172
|
wallet_environments.tx_config, push=True
|
|
159
173
|
) as action_scope:
|
|
160
174
|
await nft_wallet_0.generate_signed_transaction(
|
|
161
175
|
[uint64(coins[0].coin.amount)],
|
|
162
|
-
[
|
|
176
|
+
[wallet_1_ph],
|
|
163
177
|
action_scope,
|
|
164
178
|
coins={coins[0].coin},
|
|
165
179
|
)
|
|
@@ -237,7 +251,10 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
|
|
|
237
251
|
wallet_node_0.wallet_state_manager, wallet_0, name="NFT WALLET 1"
|
|
238
252
|
)
|
|
239
253
|
metadata = Program.to(
|
|
240
|
-
[
|
|
254
|
+
[
|
|
255
|
+
("u", ["https://www.chia.net/img/branding/chia-logo.svg"]),
|
|
256
|
+
("h", "0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
257
|
+
]
|
|
241
258
|
)
|
|
242
259
|
async with nft_wallet_0.wallet_state_manager.new_action_scope(
|
|
243
260
|
wallet_environments.tx_config, push=True
|
|
@@ -375,12 +392,14 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
|
|
|
375
392
|
nft_wallet_1 = await NFTWallet.create_new_nft_wallet(
|
|
376
393
|
wallet_node_1.wallet_state_manager, wallet_1, name="NFT WALLET 2"
|
|
377
394
|
)
|
|
395
|
+
async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
396
|
+
wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
|
|
378
397
|
async with nft_wallet_0.wallet_state_manager.new_action_scope(
|
|
379
398
|
wallet_environments.tx_config, push=True
|
|
380
399
|
) as action_scope:
|
|
381
400
|
await nft_wallet_0.generate_signed_transaction(
|
|
382
401
|
[uint64(coins[1].coin.amount)],
|
|
383
|
-
[
|
|
402
|
+
[wallet_1_ph],
|
|
384
403
|
action_scope,
|
|
385
404
|
coins={coins[1].coin},
|
|
386
405
|
)
|
|
@@ -432,12 +451,14 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
|
|
|
432
451
|
assert len(coins) == 1
|
|
433
452
|
|
|
434
453
|
# Send it back to original owner
|
|
454
|
+
async with wallet_0.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
455
|
+
wallet_0_ph = await action_scope.get_puzzle_hash(wallet_0.wallet_state_manager)
|
|
435
456
|
async with nft_wallet_1.wallet_state_manager.new_action_scope(
|
|
436
457
|
wallet_environments.tx_config, push=True
|
|
437
458
|
) as action_scope:
|
|
438
459
|
await nft_wallet_1.generate_signed_transaction(
|
|
439
460
|
[uint64(coins[0].coin.amount)],
|
|
440
|
-
[
|
|
461
|
+
[wallet_0_ph],
|
|
441
462
|
action_scope,
|
|
442
463
|
coins={coins[0].coin},
|
|
443
464
|
)
|
|
@@ -506,6 +527,19 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
|
|
|
506
527
|
await time_out_assert(30, get_nft_count, 1, nft_wallet_0)
|
|
507
528
|
await time_out_assert(30, get_nft_count, 1, nft_wallet_1)
|
|
508
529
|
|
|
530
|
+
# Test an error case
|
|
531
|
+
with pytest.raises(ResponseFailureError, match="The NFT doesn't support setting a DID."):
|
|
532
|
+
await env_1.rpc_client.set_nft_did(
|
|
533
|
+
NFTSetNFTDID(
|
|
534
|
+
wallet_id=uint32(env_1.wallet_aliases["nft"]),
|
|
535
|
+
did_id=None,
|
|
536
|
+
nft_coin_id=(await env_1.rpc_client.list_nfts(NFTGetNFTs(uint32(env_1.wallet_aliases["nft"]))))
|
|
537
|
+
.nft_list[0]
|
|
538
|
+
.nft_coin_id,
|
|
539
|
+
),
|
|
540
|
+
tx_config=wallet_environments.tx_config,
|
|
541
|
+
)
|
|
542
|
+
|
|
509
543
|
|
|
510
544
|
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
|
|
511
545
|
@pytest.mark.parametrize("wallet_environments", [{"num_environments": 1, "blocks_needed": [1]}], indirect=True)
|
|
@@ -525,14 +559,17 @@ async def test_nft_wallet_rpc_creation_and_list(wallet_environments: WalletTestF
|
|
|
525
559
|
assert nft_wallet_0.get("success")
|
|
526
560
|
assert env.wallet_aliases["nft"] == nft_wallet_0["wallet_id"]
|
|
527
561
|
|
|
562
|
+
async with wallet.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
563
|
+
wallet_ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
528
564
|
await env.rpc_client.mint_nft(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
565
|
+
request=NFTMintNFTRequest(
|
|
566
|
+
wallet_id=uint32(env.wallet_aliases["nft"]),
|
|
567
|
+
royalty_address=encode_puzzle_hash(wallet_ph, AddressType.NFT.hrp(wallet_node.config)),
|
|
568
|
+
target_address=None,
|
|
569
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
570
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
571
|
+
push=True,
|
|
532
572
|
),
|
|
533
|
-
target_address=None,
|
|
534
|
-
hash="0xD4584AD463139FA8C0D9F68F4B59F185",
|
|
535
|
-
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
536
573
|
tx_config=wallet_environments.tx_config,
|
|
537
574
|
)
|
|
538
575
|
|
|
@@ -558,18 +595,19 @@ async def test_nft_wallet_rpc_creation_and_list(wallet_environments: WalletTestF
|
|
|
558
595
|
30, env.rpc_client.fetch, ["nft_get_nfts", dict(wallet_id=env.wallet_aliases["nft"])], lambda x: x["nft_list"]
|
|
559
596
|
)
|
|
560
597
|
second_mint = await env.rpc_client.mint_nft(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
598
|
+
request=NFTMintNFTRequest(
|
|
599
|
+
wallet_id=uint32(env.wallet_aliases["nft"]),
|
|
600
|
+
royalty_address=encode_puzzle_hash(wallet_ph, AddressType.NFT.hrp(wallet_node.config)),
|
|
601
|
+
target_address=None,
|
|
602
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F184D4584AD463139FA8C0D9F68F4B59F184"),
|
|
603
|
+
uris=["https://chialisp.com/img/logo.svg"],
|
|
604
|
+
meta_uris=[
|
|
605
|
+
"https://bafybeigzcazxeu7epmm4vtkuadrvysv74lbzzbl2evphtae6k57yhgynp4.ipfs.nftstorage.link/6590.json"
|
|
606
|
+
],
|
|
607
|
+
meta_hash=bytes32.from_hexstr("0x6a9cb99b7b9a987309e8dd4fd14a7ca2423858585da68cc9ec689669dd6dd6ab"),
|
|
608
|
+
push=True,
|
|
564
609
|
),
|
|
565
|
-
target_address=None,
|
|
566
610
|
tx_config=wallet_environments.tx_config,
|
|
567
|
-
hash="0xD4584AD463139FA8C0D9F68F4B59F184",
|
|
568
|
-
uris=["https://chialisp.com/img/logo.svg"],
|
|
569
|
-
meta_uris=[
|
|
570
|
-
"https://bafybeigzcazxeu7epmm4vtkuadrvysv74lbzzbl2evphtae6k57yhgynp4.ipfs.nftstorage.link/6590.json"
|
|
571
|
-
],
|
|
572
|
-
meta_hash="0x6a9cb99b7b9a987309e8dd4fd14a7ca2423858585da68cc9ec689669dd6dd6ab",
|
|
573
611
|
)
|
|
574
612
|
|
|
575
613
|
await wallet_environments.process_pending_states(
|
|
@@ -616,20 +654,13 @@ async def test_nft_wallet_rpc_creation_and_list(wallet_environments: WalletTestF
|
|
|
616
654
|
)
|
|
617
655
|
coins = [NFTInfo.from_json_dict(d) for d in coins_response["nft_list"]]
|
|
618
656
|
assert len(coins) == 1
|
|
619
|
-
assert coins[0].data_hash.hex() == "
|
|
657
|
+
assert coins[0].data_hash.hex() == "0xD4584AD463139FA8C0D9F68F4B59F184D4584AD463139FA8C0D9F68F4B59F184"[2:].lower()
|
|
620
658
|
|
|
621
659
|
# test counts
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
10, env.rpc_client.fetch, ["nft_count_nfts", {"wallet_id": env.wallet_aliases["nft"]}], lambda x: x["success"]
|
|
625
|
-
)
|
|
626
|
-
assert resp["count"] == 2
|
|
627
|
-
resp = await wait_rpc_state_condition(10, env.rpc_client.fetch, ["nft_count_nfts", {}], lambda x: x["success"])
|
|
628
|
-
assert resp["count"] == 2
|
|
660
|
+
assert (await env.rpc_client.count_nfts(NFTCountNFTs(uint32(env.wallet_aliases["nft"])))).count == 2
|
|
661
|
+
assert (await env.rpc_client.count_nfts(NFTCountNFTs())).count == 2
|
|
629
662
|
with pytest.raises(ResponseFailureError, match="Wallet 50 not found."):
|
|
630
|
-
|
|
631
|
-
10, env.rpc_client.fetch, ["nft_count_nfts", {"wallet_id": 50}], lambda x: x["success"] is False
|
|
632
|
-
)
|
|
663
|
+
await env.rpc_client.count_nfts(NFTCountNFTs(uint32(50)))
|
|
633
664
|
|
|
634
665
|
|
|
635
666
|
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
|
|
@@ -648,11 +679,14 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
|
|
|
648
679
|
nft_wallet = await NFTWallet.create_new_nft_wallet(wallet_node.wallet_state_manager, wallet, name="NFT WALLET 1")
|
|
649
680
|
|
|
650
681
|
await env.rpc_client.mint_nft(
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
682
|
+
request=NFTMintNFTRequest(
|
|
683
|
+
wallet_id=nft_wallet.id(),
|
|
684
|
+
royalty_address=None,
|
|
685
|
+
target_address=None,
|
|
686
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
687
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
688
|
+
push=True,
|
|
689
|
+
),
|
|
656
690
|
tx_config=wallet_environments.tx_config,
|
|
657
691
|
)
|
|
658
692
|
|
|
@@ -671,15 +705,17 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
|
|
|
671
705
|
]
|
|
672
706
|
)
|
|
673
707
|
|
|
674
|
-
coins: list[
|
|
708
|
+
coins: list[NFTInfo] = (
|
|
709
|
+
await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))
|
|
710
|
+
).nft_list
|
|
675
711
|
coin = coins[0]
|
|
676
|
-
assert coin
|
|
677
|
-
assert coin
|
|
678
|
-
assert coin
|
|
712
|
+
assert coin.mint_height > 0
|
|
713
|
+
assert coin.data_hash == bytes32.from_hexstr("0xd4584ad463139fa8c0d9f68f4b59f185d4584ad463139fa8c0d9f68f4b59f185")
|
|
714
|
+
assert coin.chain_info == disassemble(
|
|
679
715
|
Program.to(
|
|
680
716
|
[
|
|
681
717
|
("u", ["https://www.chia.net/img/branding/chia-logo.svg"]),
|
|
682
|
-
("h", hexstr_to_bytes("
|
|
718
|
+
("h", hexstr_to_bytes("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185")),
|
|
683
719
|
("mu", []),
|
|
684
720
|
("lu", []),
|
|
685
721
|
("sn", uint64(1)),
|
|
@@ -688,18 +724,21 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
|
|
|
688
724
|
)
|
|
689
725
|
)
|
|
690
726
|
|
|
691
|
-
nft_coin_id = encode_puzzle_hash(
|
|
727
|
+
nft_coin_id = encode_puzzle_hash(coin.nft_coin_id, AddressType.NFT.hrp(env.node.config))
|
|
692
728
|
await env.rpc_client.add_uri_to_nft(
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
729
|
+
NFTAddURI(
|
|
730
|
+
wallet_id=nft_wallet.id(),
|
|
731
|
+
nft_coin_id=nft_coin_id,
|
|
732
|
+
uri="http://metadata",
|
|
733
|
+
key="mu",
|
|
734
|
+
fee=uint64(0),
|
|
735
|
+
push=True,
|
|
736
|
+
),
|
|
698
737
|
tx_config=wallet_environments.tx_config,
|
|
699
738
|
)
|
|
700
739
|
|
|
701
|
-
coins = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))
|
|
702
|
-
assert coins[0]
|
|
740
|
+
coins = (await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))).nft_list
|
|
741
|
+
assert coins[0].pending_transaction
|
|
703
742
|
|
|
704
743
|
await wallet_environments.process_pending_states(
|
|
705
744
|
[
|
|
@@ -717,25 +756,27 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
|
|
|
717
756
|
)
|
|
718
757
|
|
|
719
758
|
# check that new URI was added
|
|
720
|
-
coins = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))
|
|
759
|
+
coins = (await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))).nft_list
|
|
721
760
|
assert len(coins) == 1
|
|
722
761
|
coin = coins[0]
|
|
723
|
-
assert coin
|
|
724
|
-
uris = coin
|
|
762
|
+
assert coin.mint_height > 0
|
|
763
|
+
uris = coin.data_uris
|
|
725
764
|
assert len(uris) == 1
|
|
726
765
|
assert "https://www.chia.net/img/branding/chia-logo.svg" in uris
|
|
727
|
-
assert len(coin
|
|
728
|
-
assert "http://metadata" == coin
|
|
729
|
-
assert len(coin
|
|
766
|
+
assert len(coin.metadata_uris) == 1
|
|
767
|
+
assert "http://metadata" == coin.metadata_uris[0]
|
|
768
|
+
assert len(coin.license_uris) == 0
|
|
730
769
|
|
|
731
770
|
# add yet another URI, this time using a hex nft_coin_id
|
|
732
|
-
nft_coin_id = coin["nft_coin_id"]
|
|
733
771
|
await env.rpc_client.add_uri_to_nft(
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
772
|
+
NFTAddURI(
|
|
773
|
+
wallet_id=nft_wallet.id(),
|
|
774
|
+
nft_coin_id=coin.nft_coin_id.hex(),
|
|
775
|
+
uri="http://data",
|
|
776
|
+
key="u",
|
|
777
|
+
fee=uint64(0),
|
|
778
|
+
push=True,
|
|
779
|
+
),
|
|
739
780
|
tx_config=wallet_environments.tx_config,
|
|
740
781
|
)
|
|
741
782
|
|
|
@@ -754,14 +795,14 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
|
|
|
754
795
|
]
|
|
755
796
|
)
|
|
756
797
|
|
|
757
|
-
coins = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))
|
|
798
|
+
coins = (await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))).nft_list
|
|
758
799
|
assert len(coins) == 1
|
|
759
800
|
coin = coins[0]
|
|
760
|
-
assert coin
|
|
761
|
-
uris = coin
|
|
801
|
+
assert coin.mint_height > 0
|
|
802
|
+
uris = coin.data_uris
|
|
762
803
|
assert len(uris) == 2
|
|
763
|
-
assert len(coin
|
|
764
|
-
assert "http://data" == coin
|
|
804
|
+
assert len(coin.metadata_uris) == 1
|
|
805
|
+
assert "http://data" == coin.data_uris[0]
|
|
765
806
|
|
|
766
807
|
|
|
767
808
|
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
|
|
@@ -826,6 +867,8 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
|
|
|
826
867
|
assert res["wallet_id"] != nft_wallet.id()
|
|
827
868
|
nft_wallet_p2_puzzle = res["wallet_id"]
|
|
828
869
|
|
|
870
|
+
with pytest.raises(ResponseFailureError, match="Cannot find a NFT wallet DID"):
|
|
871
|
+
await env.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=encode_puzzle_hash(bytes32.zeros, "did")))
|
|
829
872
|
wallet_by_did_response = await env.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=hmr_did_id))
|
|
830
873
|
assert nft_wallet.id() == wallet_by_did_response.wallet_id
|
|
831
874
|
|
|
@@ -842,17 +885,21 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
|
|
|
842
885
|
NFTWalletWithDID(wallet_id=nft_wallet.id(), did_id=hmr_did_id, did_wallet_id=did_wallet.id())
|
|
843
886
|
]
|
|
844
887
|
|
|
845
|
-
|
|
846
|
-
assert
|
|
888
|
+
get_did_res = await env.rpc_client.get_nft_wallet_did(NFTGetWalletDID(nft_wallet.id()))
|
|
889
|
+
assert get_did_res.did_id == hmr_did_id
|
|
847
890
|
|
|
848
891
|
# Create a NFT with DID
|
|
849
|
-
|
|
892
|
+
async with wallet.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
893
|
+
nft_ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
850
894
|
resp = await env.rpc_client.mint_nft(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
895
|
+
request=NFTMintNFTRequest(
|
|
896
|
+
wallet_id=nft_wallet.id(),
|
|
897
|
+
royalty_address=None,
|
|
898
|
+
target_address=encode_puzzle_hash(nft_ph, "txch"),
|
|
899
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
900
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
901
|
+
push=True,
|
|
902
|
+
),
|
|
856
903
|
tx_config=wallet_environments.tx_config,
|
|
857
904
|
)
|
|
858
905
|
# ensure hints are generated correctly
|
|
@@ -896,12 +943,15 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
|
|
|
896
943
|
)
|
|
897
944
|
# Create a NFT without DID, this will go the unassigned NFT wallet
|
|
898
945
|
resp = await env.rpc_client.mint_nft(
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
946
|
+
request=NFTMintNFTRequest(
|
|
947
|
+
wallet_id=nft_wallet.id(),
|
|
948
|
+
royalty_address=None,
|
|
949
|
+
target_address=None,
|
|
950
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F181D4584AD463139FA8C0D9F68F4B59F181"),
|
|
951
|
+
uris=["https://url1"],
|
|
952
|
+
did_id="",
|
|
953
|
+
push=True,
|
|
954
|
+
),
|
|
905
955
|
tx_config=wallet_environments.tx_config,
|
|
906
956
|
)
|
|
907
957
|
|
|
@@ -930,28 +980,34 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
|
|
|
930
980
|
]
|
|
931
981
|
)
|
|
932
982
|
# Check DID NFT
|
|
933
|
-
coins: list[
|
|
983
|
+
coins: list[NFTInfo] = (
|
|
984
|
+
await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))
|
|
985
|
+
).nft_list
|
|
934
986
|
assert len(coins) == 1
|
|
935
987
|
did_nft = coins[0]
|
|
936
|
-
assert did_nft
|
|
937
|
-
assert did_nft
|
|
938
|
-
assert did_nft
|
|
939
|
-
assert did_nft
|
|
940
|
-
|
|
988
|
+
assert did_nft.mint_height > 0
|
|
989
|
+
assert did_nft.supports_did
|
|
990
|
+
assert did_nft.data_uris[0] == "https://www.chia.net/img/branding/chia-logo.svg"
|
|
991
|
+
assert did_nft.data_hash == bytes32.from_hexstr(
|
|
992
|
+
"0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"
|
|
993
|
+
)
|
|
994
|
+
assert did_nft.owner_did is not None
|
|
995
|
+
assert did_nft.owner_did.hex() == hex_did_id
|
|
941
996
|
# Check unassigned NFT
|
|
942
997
|
nft_wallets = await env.wallet_state_manager.get_all_wallet_info_entries(WalletType.NFT)
|
|
943
998
|
assert len(nft_wallets) == 2
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
coins = coins_response["nft_list"]
|
|
999
|
+
coins = (
|
|
1000
|
+
await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet_p2_puzzle, start_index=uint32(0), num=uint32(1)))
|
|
1001
|
+
).nft_list
|
|
948
1002
|
assert len(coins) == 1
|
|
949
1003
|
non_did_nft = coins[0]
|
|
950
|
-
assert non_did_nft
|
|
951
|
-
assert non_did_nft
|
|
952
|
-
assert non_did_nft
|
|
953
|
-
assert non_did_nft
|
|
954
|
-
|
|
1004
|
+
assert non_did_nft.mint_height > 0
|
|
1005
|
+
assert non_did_nft.supports_did
|
|
1006
|
+
assert non_did_nft.data_uris[0] == "https://url1"
|
|
1007
|
+
assert non_did_nft.data_hash == bytes32.from_hexstr(
|
|
1008
|
+
"0xD4584AD463139FA8C0D9F68F4B59F181D4584AD463139FA8C0D9F68F4B59F181"
|
|
1009
|
+
)
|
|
1010
|
+
assert non_did_nft.owner_did is None
|
|
955
1011
|
|
|
956
1012
|
|
|
957
1013
|
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
|
|
@@ -1006,30 +1062,34 @@ async def test_nft_rpc_mint(wallet_environments: WalletTestFramework) -> None:
|
|
|
1006
1062
|
)
|
|
1007
1063
|
|
|
1008
1064
|
# Create a NFT with DID
|
|
1009
|
-
|
|
1065
|
+
async with wallet.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
1066
|
+
royalty_address = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
1010
1067
|
royalty_bech32 = encode_puzzle_hash(royalty_address, AddressType.NFT.hrp(env.node.config))
|
|
1011
|
-
data_hash_param = "
|
|
1068
|
+
data_hash_param = "0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"
|
|
1012
1069
|
license_uris = ["http://mylicenseuri"]
|
|
1013
|
-
license_hash = "
|
|
1070
|
+
license_hash = "0xcafef00dcafef00dcafef00dcafef00dcafef00dcafef00dcafef00dcafef00d"
|
|
1014
1071
|
meta_uris = ["http://metauri"]
|
|
1015
|
-
meta_hash = "
|
|
1072
|
+
meta_hash = "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
|
|
1016
1073
|
royalty_percentage = 200
|
|
1017
1074
|
sn = 10
|
|
1018
1075
|
st = 100
|
|
1019
1076
|
resp = await env.rpc_client.mint_nft(
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1077
|
+
request=NFTMintNFTRequest(
|
|
1078
|
+
wallet_id=uint32(env.wallet_aliases["nft_w_did"]),
|
|
1079
|
+
royalty_address=royalty_bech32,
|
|
1080
|
+
target_address=royalty_bech32, # doesn't matter so we'll just reuse
|
|
1081
|
+
hash=bytes32.from_hexstr(data_hash_param),
|
|
1082
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1083
|
+
meta_hash=bytes32.from_hexstr(meta_hash),
|
|
1084
|
+
meta_uris=meta_uris,
|
|
1085
|
+
license_hash=bytes32.from_hexstr(license_hash),
|
|
1086
|
+
license_uris=license_uris,
|
|
1087
|
+
edition_total=uint64(st),
|
|
1088
|
+
edition_number=uint64(sn),
|
|
1089
|
+
royalty_amount=uint16(royalty_percentage),
|
|
1090
|
+
push=True,
|
|
1091
|
+
),
|
|
1025
1092
|
tx_config=wallet_environments.tx_config,
|
|
1026
|
-
meta_hash=meta_hash,
|
|
1027
|
-
meta_uris=meta_uris,
|
|
1028
|
-
license_hash=license_hash,
|
|
1029
|
-
license_uris=license_uris,
|
|
1030
|
-
edition_total=st,
|
|
1031
|
-
edition_number=sn,
|
|
1032
|
-
royalty_percentage=royalty_percentage,
|
|
1033
1093
|
)
|
|
1034
1094
|
nft_id = resp.nft_id
|
|
1035
1095
|
|
|
@@ -1063,11 +1123,13 @@ async def test_nft_rpc_mint(wallet_environments: WalletTestFramework) -> None:
|
|
|
1063
1123
|
]
|
|
1064
1124
|
)
|
|
1065
1125
|
|
|
1066
|
-
coins: list[
|
|
1067
|
-
await env.rpc_client.list_nfts(
|
|
1068
|
-
|
|
1126
|
+
coins: list[NFTInfo] = (
|
|
1127
|
+
await env.rpc_client.list_nfts(
|
|
1128
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(1))
|
|
1129
|
+
)
|
|
1130
|
+
).nft_list
|
|
1069
1131
|
assert len(coins) == 1
|
|
1070
|
-
did_nft =
|
|
1132
|
+
did_nft = coins[0]
|
|
1071
1133
|
assert did_nft.royalty_puzzle_hash == royalty_address
|
|
1072
1134
|
assert did_nft.data_hash == bytes.fromhex(data_hash_param[2:])
|
|
1073
1135
|
assert did_nft.metadata_hash == bytes.fromhex(meta_hash[2:])
|
|
@@ -1149,14 +1211,17 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
|
|
|
1149
1211
|
# Create a NFT with DID
|
|
1150
1212
|
fee = 100
|
|
1151
1213
|
await env_0.rpc_client.mint_nft(
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1214
|
+
request=NFTMintNFTRequest(
|
|
1215
|
+
wallet_id=uint32(env_0.wallet_aliases["nft"]),
|
|
1216
|
+
royalty_address=None,
|
|
1217
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
1218
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
1219
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1220
|
+
fee=uint64(fee),
|
|
1221
|
+
did_id=hmr_did_id,
|
|
1222
|
+
push=True,
|
|
1223
|
+
),
|
|
1157
1224
|
tx_config=wallet_environments.tx_config,
|
|
1158
|
-
fee=fee,
|
|
1159
|
-
did_id=hmr_did_id,
|
|
1160
1225
|
)
|
|
1161
1226
|
|
|
1162
1227
|
await wallet_environments.process_pending_states(
|
|
@@ -1200,11 +1265,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
|
|
|
1200
1265
|
)
|
|
1201
1266
|
|
|
1202
1267
|
# Check DID NFT
|
|
1203
|
-
coins: list[
|
|
1204
|
-
|
|
1205
|
-
|
|
1268
|
+
coins: list[NFTInfo] = (
|
|
1269
|
+
await env_0.rpc_client.list_nfts(
|
|
1270
|
+
NFTGetNFTs(uint32(env_0.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
1271
|
+
)
|
|
1272
|
+
).nft_list
|
|
1206
1273
|
assert len(coins) == 1
|
|
1207
|
-
coin =
|
|
1274
|
+
coin = coins[0]
|
|
1208
1275
|
assert coin.owner_did is not None
|
|
1209
1276
|
assert coin.owner_did.hex() == hex_did_id
|
|
1210
1277
|
|
|
@@ -1212,10 +1279,12 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
|
|
|
1212
1279
|
assert len(env_0.wallet_state_manager.wallets) == 3
|
|
1213
1280
|
|
|
1214
1281
|
# transfer DID to the other wallet
|
|
1282
|
+
async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
1283
|
+
wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
|
|
1215
1284
|
async with did_wallet.wallet_state_manager.new_action_scope(
|
|
1216
1285
|
wallet_environments.tx_config, push=True
|
|
1217
1286
|
) as action_scope:
|
|
1218
|
-
await did_wallet.transfer_did(
|
|
1287
|
+
await did_wallet.transfer_did(wallet_1_ph, uint64(0), True, action_scope)
|
|
1219
1288
|
|
|
1220
1289
|
await wallet_environments.process_pending_states(
|
|
1221
1290
|
[
|
|
@@ -1243,13 +1312,29 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
|
|
|
1243
1312
|
)
|
|
1244
1313
|
|
|
1245
1314
|
# Transfer NFT, wallet will be deleted
|
|
1315
|
+
async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
1316
|
+
wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
|
|
1317
|
+
mint_resp_reference = await env_0.rpc_client.transfer_nft(
|
|
1318
|
+
NFTTransferNFT(
|
|
1319
|
+
wallet_id=uint32(env_0.wallet_aliases["nft"]),
|
|
1320
|
+
nft_coin_id=encode_puzzle_hash(coin.launcher_id, "nft"), # difference
|
|
1321
|
+
target_address=encode_puzzle_hash(wallet_1_ph, "xch"),
|
|
1322
|
+
fee=uint64(fee),
|
|
1323
|
+
push=False, # difference
|
|
1324
|
+
),
|
|
1325
|
+
tx_config=wallet_environments.tx_config,
|
|
1326
|
+
)
|
|
1246
1327
|
mint_resp = await env_0.rpc_client.transfer_nft(
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1328
|
+
NFTTransferNFT(
|
|
1329
|
+
wallet_id=uint32(env_0.wallet_aliases["nft"]),
|
|
1330
|
+
nft_coin_id=coin.nft_coin_id.hex(),
|
|
1331
|
+
target_address=encode_puzzle_hash(wallet_1_ph, "xch"),
|
|
1332
|
+
fee=uint64(fee),
|
|
1333
|
+
push=True,
|
|
1334
|
+
),
|
|
1251
1335
|
tx_config=wallet_environments.tx_config,
|
|
1252
1336
|
)
|
|
1337
|
+
assert mint_resp_reference.spend_bundle == mint_resp.spend_bundle
|
|
1253
1338
|
assert len(compute_memos(mint_resp.spend_bundle)) > 0
|
|
1254
1339
|
|
|
1255
1340
|
await wallet_environments.process_pending_states(
|
|
@@ -1288,9 +1373,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
|
|
|
1288
1373
|
# Check if the NFT owner DID is reset
|
|
1289
1374
|
wallet_by_did_response = await env_1.rpc_client.get_nft_wallet_by_did(NFTGetByDID())
|
|
1290
1375
|
assert env_1.wallet_aliases["nft"] == wallet_by_did_response.wallet_id
|
|
1291
|
-
coins = (
|
|
1376
|
+
coins = (
|
|
1377
|
+
await env_1.rpc_client.list_nfts(
|
|
1378
|
+
NFTGetNFTs(uint32(env_1.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
1379
|
+
)
|
|
1380
|
+
).nft_list
|
|
1292
1381
|
assert len(coins) == 1
|
|
1293
|
-
coin =
|
|
1382
|
+
coin = coins[0]
|
|
1294
1383
|
assert coin.owner_did is None
|
|
1295
1384
|
assert coin.minter_did is not None
|
|
1296
1385
|
assert coin.minter_did.hex() == hex_did_id
|
|
@@ -1298,10 +1387,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
|
|
|
1298
1387
|
|
|
1299
1388
|
# Set DID
|
|
1300
1389
|
await env_1.rpc_client.set_nft_did(
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1390
|
+
NFTSetNFTDID(
|
|
1391
|
+
wallet_id=uint32(env_1.wallet_aliases["nft"]),
|
|
1392
|
+
did_id=hmr_did_id,
|
|
1393
|
+
nft_coin_id=nft_coin_id,
|
|
1394
|
+
fee=uint64(fee),
|
|
1395
|
+
push=True,
|
|
1396
|
+
),
|
|
1305
1397
|
tx_config=wallet_environments.tx_config,
|
|
1306
1398
|
)
|
|
1307
1399
|
|
|
@@ -1349,9 +1441,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
|
|
|
1349
1441
|
wallet_by_did_response = await env_1.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=hmr_did_id))
|
|
1350
1442
|
assert env_1.wallet_aliases["nft_w_did"] == wallet_by_did_response.wallet_id
|
|
1351
1443
|
# Check NFT DID is set now
|
|
1352
|
-
coins = (
|
|
1444
|
+
coins = (
|
|
1445
|
+
await env_1.rpc_client.list_nfts(
|
|
1446
|
+
NFTGetNFTs(uint32(env_1.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(1))
|
|
1447
|
+
)
|
|
1448
|
+
).nft_list
|
|
1353
1449
|
assert len(coins) == 1
|
|
1354
|
-
coin =
|
|
1450
|
+
coin = coins[0]
|
|
1355
1451
|
assert coin.owner_did is not None
|
|
1356
1452
|
assert coin.owner_did.hex() == hex_did_id
|
|
1357
1453
|
|
|
@@ -1412,14 +1508,17 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
|
|
|
1412
1508
|
|
|
1413
1509
|
# Create a NFT with DID
|
|
1414
1510
|
mint_resp = await env.rpc_client.mint_nft(
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1511
|
+
request=NFTMintNFTRequest(
|
|
1512
|
+
wallet_id=uint32(env.wallet_aliases["nft"]),
|
|
1513
|
+
royalty_address=None,
|
|
1514
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
1515
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
1516
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1517
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1518
|
+
did_id=hmr_did_id,
|
|
1519
|
+
push=True,
|
|
1520
|
+
),
|
|
1421
1521
|
tx_config=wallet_environments.tx_config,
|
|
1422
|
-
did_id=hmr_did_id,
|
|
1423
1522
|
)
|
|
1424
1523
|
|
|
1425
1524
|
# ensure hints are generated
|
|
@@ -1466,9 +1565,13 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
|
|
|
1466
1565
|
|
|
1467
1566
|
# Check DID NFT
|
|
1468
1567
|
|
|
1469
|
-
coins = (
|
|
1568
|
+
coins = (
|
|
1569
|
+
await env.rpc_client.list_nfts(
|
|
1570
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
1571
|
+
)
|
|
1572
|
+
).nft_list
|
|
1470
1573
|
assert len(coins) == 1
|
|
1471
|
-
coin =
|
|
1574
|
+
coin = coins[0]
|
|
1472
1575
|
assert coin.minter_did is not None
|
|
1473
1576
|
assert coin.minter_did.hex() == hex_did_id
|
|
1474
1577
|
nft_coin_id = coin.nft_coin_id
|
|
@@ -1476,17 +1579,24 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
|
|
|
1476
1579
|
# add another URI
|
|
1477
1580
|
fee = 100
|
|
1478
1581
|
await env.rpc_client.add_uri_to_nft(
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1582
|
+
NFTAddURI(
|
|
1583
|
+
wallet_id=uint32(env.wallet_aliases["nft"]),
|
|
1584
|
+
nft_coin_id=nft_coin_id.hex(),
|
|
1585
|
+
key="mu",
|
|
1586
|
+
uri="http://metadata",
|
|
1587
|
+
fee=uint64(fee),
|
|
1588
|
+
push=True,
|
|
1589
|
+
),
|
|
1484
1590
|
tx_config=wallet_environments.tx_config,
|
|
1485
1591
|
)
|
|
1486
1592
|
|
|
1487
|
-
coins = (
|
|
1593
|
+
coins = (
|
|
1594
|
+
await env.rpc_client.list_nfts(
|
|
1595
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
1596
|
+
)
|
|
1597
|
+
).nft_list
|
|
1488
1598
|
assert len(coins) == 1
|
|
1489
|
-
coin =
|
|
1599
|
+
coin = coins[0]
|
|
1490
1600
|
assert coin.pending_transaction
|
|
1491
1601
|
|
|
1492
1602
|
await wallet_environments.process_pending_states(
|
|
@@ -1517,17 +1627,22 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
|
|
|
1517
1627
|
)
|
|
1518
1628
|
|
|
1519
1629
|
# check that new URI was added
|
|
1520
|
-
coins = (
|
|
1630
|
+
coins = (
|
|
1631
|
+
await env.rpc_client.list_nfts(
|
|
1632
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
1633
|
+
)
|
|
1634
|
+
).nft_list
|
|
1521
1635
|
assert len(coins) == 1
|
|
1522
1636
|
|
|
1523
|
-
assert coins[0]
|
|
1524
|
-
assert coins[0]
|
|
1525
|
-
|
|
1637
|
+
assert coins[0].minter_did is not None
|
|
1638
|
+
assert coins[0].minter_did.hex() == hex_did_id
|
|
1639
|
+
assert coins[0].mint_height > 0
|
|
1640
|
+
uris = coins[0].data_uris
|
|
1526
1641
|
assert len(uris) == 1
|
|
1527
1642
|
assert "https://www.chia.net/img/branding/chia-logo.svg" in uris
|
|
1528
|
-
assert len(coins[0]
|
|
1529
|
-
assert "http://metadata" == coins[0]
|
|
1530
|
-
assert len(coins[0]
|
|
1643
|
+
assert len(coins[0].metadata_uris) == 2
|
|
1644
|
+
assert "http://metadata" == coins[0].metadata_uris[0]
|
|
1645
|
+
assert len(coins[0].license_uris) == 0
|
|
1531
1646
|
|
|
1532
1647
|
|
|
1533
1648
|
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
|
|
@@ -1590,14 +1705,17 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
|
|
|
1590
1705
|
|
|
1591
1706
|
# Create an NFT with DID
|
|
1592
1707
|
mint_resp_1 = await env.rpc_client.mint_nft(
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1708
|
+
request=NFTMintNFTRequest(
|
|
1709
|
+
wallet_id=uint32(env.wallet_aliases["nft_w_did"]),
|
|
1710
|
+
royalty_address=None,
|
|
1711
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
1712
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
1713
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1714
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1715
|
+
did_id=hmr_did_id,
|
|
1716
|
+
push=True,
|
|
1717
|
+
),
|
|
1599
1718
|
tx_config=wallet_environments.tx_config,
|
|
1600
|
-
did_id=hmr_did_id,
|
|
1601
1719
|
)
|
|
1602
1720
|
assert len(compute_memos(mint_resp_1.spend_bundle)) > 0
|
|
1603
1721
|
|
|
@@ -1642,14 +1760,17 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
|
|
|
1642
1760
|
|
|
1643
1761
|
# And one w/o
|
|
1644
1762
|
mint_resp_2 = await env.rpc_client.mint_nft(
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1763
|
+
request=NFTMintNFTRequest(
|
|
1764
|
+
wallet_id=uint32(env.wallet_aliases["nft_no_did"]),
|
|
1765
|
+
royalty_address=None,
|
|
1766
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
1767
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
1768
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1769
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1770
|
+
did_id="",
|
|
1771
|
+
push=True,
|
|
1772
|
+
),
|
|
1651
1773
|
tx_config=wallet_environments.tx_config,
|
|
1652
|
-
did_id="",
|
|
1653
1774
|
)
|
|
1654
1775
|
assert len(compute_memos(mint_resp_2.spend_bundle)) > 0
|
|
1655
1776
|
|
|
@@ -1682,14 +1803,17 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
|
|
|
1682
1803
|
|
|
1683
1804
|
# Make a second one w/ DID to test "bulk" updating in same wallet
|
|
1684
1805
|
mint_resp_3 = await env.rpc_client.mint_nft(
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1806
|
+
request=NFTMintNFTRequest(
|
|
1807
|
+
wallet_id=uint32(env.wallet_aliases["nft_w_did"]),
|
|
1808
|
+
royalty_address=None,
|
|
1809
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
1810
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
1811
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1812
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
1813
|
+
did_id=hmr_did_id,
|
|
1814
|
+
push=True,
|
|
1815
|
+
),
|
|
1691
1816
|
tx_config=wallet_environments.tx_config,
|
|
1692
|
-
did_id=hmr_did_id,
|
|
1693
1817
|
)
|
|
1694
1818
|
assert len(compute_memos(mint_resp_3.spend_bundle)) > 0
|
|
1695
1819
|
|
|
@@ -1733,32 +1857,53 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
|
|
|
1733
1857
|
)
|
|
1734
1858
|
|
|
1735
1859
|
# Check DID NFT
|
|
1736
|
-
coins = (
|
|
1860
|
+
coins = (
|
|
1861
|
+
await env.rpc_client.list_nfts(
|
|
1862
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(2))
|
|
1863
|
+
)
|
|
1864
|
+
).nft_list
|
|
1737
1865
|
assert len(coins) == 2
|
|
1738
|
-
nft1 =
|
|
1739
|
-
nft12 =
|
|
1866
|
+
nft1 = coins[0]
|
|
1867
|
+
nft12 = coins[1]
|
|
1740
1868
|
assert nft1.owner_did is not None
|
|
1741
1869
|
assert nft12.owner_did is not None
|
|
1742
|
-
coins = (
|
|
1870
|
+
coins = (
|
|
1871
|
+
await env.rpc_client.list_nfts(
|
|
1872
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
|
|
1873
|
+
)
|
|
1874
|
+
).nft_list
|
|
1743
1875
|
assert len(coins) == 1
|
|
1744
|
-
nft2 =
|
|
1876
|
+
nft2 = coins[0]
|
|
1745
1877
|
assert nft2.owner_did is None
|
|
1746
1878
|
nft_coin_list = [
|
|
1747
1879
|
NFTCoin(wallet_id=uint32(env.wallet_aliases["nft_w_did"]), nft_coin_id=nft1.nft_coin_id.hex()),
|
|
1748
|
-
NFTCoin(
|
|
1880
|
+
NFTCoin(
|
|
1881
|
+
wallet_id=uint32(env.wallet_aliases["nft_w_did"]), nft_coin_id=encode_puzzle_hash(nft12.launcher_id, "nft")
|
|
1882
|
+
),
|
|
1749
1883
|
NFTCoin(wallet_id=uint32(env.wallet_aliases["nft_no_did"]), nft_coin_id=nft2.nft_coin_id.hex()),
|
|
1750
1884
|
]
|
|
1751
1885
|
fee = uint64(1000)
|
|
1886
|
+
with pytest.raises(ResponseFailureError, match="You can only set"):
|
|
1887
|
+
await env.rpc_client.set_nft_did_bulk(
|
|
1888
|
+
NFTSetDIDBulk(
|
|
1889
|
+
did_id=hmr_did_id, nft_coin_list=[nft_coin_list[0]] * (MAX_NFT_CHUNK_SIZE + 1), fee=fee, push=True
|
|
1890
|
+
),
|
|
1891
|
+
wallet_environments.tx_config,
|
|
1892
|
+
)
|
|
1752
1893
|
set_did_bulk_resp = await env.rpc_client.set_nft_did_bulk(
|
|
1753
1894
|
NFTSetDIDBulk(did_id=hmr_did_id, nft_coin_list=nft_coin_list, fee=fee, push=True),
|
|
1754
1895
|
wallet_environments.tx_config,
|
|
1755
1896
|
)
|
|
1756
1897
|
assert len(set_did_bulk_resp.spend_bundle.coin_spends) == 5
|
|
1757
1898
|
assert set_did_bulk_resp.tx_num == 5 # 1 for each NFT being spent (3), 1 for fee tx, 1 for did tx
|
|
1758
|
-
coins = (
|
|
1899
|
+
coins = (
|
|
1900
|
+
await env.rpc_client.list_nfts(
|
|
1901
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(2))
|
|
1902
|
+
)
|
|
1903
|
+
).nft_list
|
|
1759
1904
|
assert len(coins) == 2
|
|
1760
|
-
nft1 =
|
|
1761
|
-
nft12 =
|
|
1905
|
+
nft1 = coins[0]
|
|
1906
|
+
nft12 = coins[1]
|
|
1762
1907
|
assert nft1.pending_transaction
|
|
1763
1908
|
assert nft12.pending_transaction
|
|
1764
1909
|
|
|
@@ -1805,11 +1950,15 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
|
|
|
1805
1950
|
|
|
1806
1951
|
wallet_by_did_response = await env.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=hmr_did_id))
|
|
1807
1952
|
assert env.wallet_aliases["nft_w_did"] == wallet_by_did_response.wallet_id
|
|
1808
|
-
coins = (
|
|
1953
|
+
coins = (
|
|
1954
|
+
await env.rpc_client.list_nfts(
|
|
1955
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(3))
|
|
1956
|
+
)
|
|
1957
|
+
).nft_list
|
|
1809
1958
|
assert len(coins) == 3
|
|
1810
|
-
nft1 =
|
|
1811
|
-
nft12 =
|
|
1812
|
-
nft13 =
|
|
1959
|
+
nft1 = coins[0]
|
|
1960
|
+
nft12 = coins[1]
|
|
1961
|
+
nft13 = coins[2]
|
|
1813
1962
|
nft_wallet_to_check = env.wallet_state_manager.wallets[uint32(env.wallet_aliases["nft_w_did"])]
|
|
1814
1963
|
assert isinstance(nft_wallet_to_check, NFTWallet)
|
|
1815
1964
|
assert await nft_wallet_to_check.get_nft_count() == 3
|
|
@@ -1892,14 +2041,17 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
|
|
|
1892
2041
|
|
|
1893
2042
|
# Create an NFT with DID
|
|
1894
2043
|
mint_resp_1 = await env_0.rpc_client.mint_nft(
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
2044
|
+
request=NFTMintNFTRequest(
|
|
2045
|
+
wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]),
|
|
2046
|
+
royalty_address=None,
|
|
2047
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
2048
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
2049
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2050
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2051
|
+
did_id=hmr_did_id,
|
|
2052
|
+
push=True,
|
|
2053
|
+
),
|
|
1901
2054
|
tx_config=wallet_environments.tx_config,
|
|
1902
|
-
did_id=hmr_did_id,
|
|
1903
2055
|
)
|
|
1904
2056
|
assert len(compute_memos(mint_resp_1.spend_bundle)) > 0
|
|
1905
2057
|
|
|
@@ -1944,14 +2096,17 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
|
|
|
1944
2096
|
|
|
1945
2097
|
# And one w/o
|
|
1946
2098
|
mint_resp_2 = await env_0.rpc_client.mint_nft(
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2099
|
+
request=NFTMintNFTRequest(
|
|
2100
|
+
wallet_id=uint32(env_0.wallet_aliases["nft_no_did"]),
|
|
2101
|
+
royalty_address=None,
|
|
2102
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
2103
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
2104
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2105
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2106
|
+
did_id="",
|
|
2107
|
+
push=True,
|
|
2108
|
+
),
|
|
1953
2109
|
tx_config=wallet_environments.tx_config,
|
|
1954
|
-
did_id="",
|
|
1955
2110
|
)
|
|
1956
2111
|
assert len(compute_memos(mint_resp_2.spend_bundle)) > 0
|
|
1957
2112
|
|
|
@@ -1984,14 +2139,17 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
|
|
|
1984
2139
|
|
|
1985
2140
|
# Make a second one w/ DID to test "bulk" updating in same wallet
|
|
1986
2141
|
mint_resp_3 = await env_0.rpc_client.mint_nft(
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
2142
|
+
request=NFTMintNFTRequest(
|
|
2143
|
+
wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]),
|
|
2144
|
+
royalty_address=None,
|
|
2145
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
2146
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
2147
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2148
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2149
|
+
did_id=hmr_did_id,
|
|
2150
|
+
push=True,
|
|
2151
|
+
),
|
|
1993
2152
|
tx_config=wallet_environments.tx_config,
|
|
1994
|
-
did_id=hmr_did_id,
|
|
1995
2153
|
)
|
|
1996
2154
|
assert len(compute_memos(mint_resp_3.spend_bundle)) > 0
|
|
1997
2155
|
|
|
@@ -2035,24 +2193,42 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
|
|
|
2035
2193
|
)
|
|
2036
2194
|
|
|
2037
2195
|
# Check DID NFT
|
|
2038
|
-
coins = (
|
|
2196
|
+
coins = (
|
|
2197
|
+
await env_0.rpc_client.list_nfts(
|
|
2198
|
+
NFTGetNFTs(uint32(env_0.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(2))
|
|
2199
|
+
)
|
|
2200
|
+
).nft_list
|
|
2039
2201
|
assert len(coins) == 2
|
|
2040
|
-
nft1 =
|
|
2041
|
-
nft12 =
|
|
2202
|
+
nft1 = coins[0]
|
|
2203
|
+
nft12 = coins[1]
|
|
2042
2204
|
assert nft1.owner_did is not None
|
|
2043
2205
|
assert nft12.owner_did is not None
|
|
2044
|
-
coins = (
|
|
2206
|
+
coins = (
|
|
2207
|
+
await env_0.rpc_client.list_nfts(
|
|
2208
|
+
NFTGetNFTs(uint32(env_0.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
|
|
2209
|
+
)
|
|
2210
|
+
).nft_list
|
|
2045
2211
|
assert len(coins) == 1
|
|
2046
|
-
nft2 =
|
|
2212
|
+
nft2 = coins[0]
|
|
2047
2213
|
assert nft2.owner_did is None
|
|
2048
2214
|
nft_coin_list = [
|
|
2049
2215
|
NFTCoin(wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]), nft_coin_id=nft1.nft_coin_id.hex()),
|
|
2050
|
-
NFTCoin(
|
|
2216
|
+
NFTCoin(
|
|
2217
|
+
wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]),
|
|
2218
|
+
nft_coin_id=encode_puzzle_hash(nft12.launcher_id, "nft"),
|
|
2219
|
+
),
|
|
2051
2220
|
NFTCoin(wallet_id=uint32(env_0.wallet_aliases["nft_no_did"]), nft_coin_id=nft2.nft_coin_id.hex()),
|
|
2052
2221
|
]
|
|
2053
2222
|
|
|
2223
|
+
async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
|
|
2224
|
+
wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
|
|
2054
2225
|
fee = uint64(1000)
|
|
2055
|
-
address = encode_puzzle_hash(
|
|
2226
|
+
address = encode_puzzle_hash(wallet_1_ph, AddressType.XCH.hrp(env_1.node.config))
|
|
2227
|
+
with pytest.raises(ResponseFailureError, match="You can only transfer"):
|
|
2228
|
+
await env_0.rpc_client.transfer_nft_bulk(
|
|
2229
|
+
NFTTransferBulk(target_address=address, nft_coin_list=[nft_coin_list[0]] * (MAX_NFT_CHUNK_SIZE + 1)),
|
|
2230
|
+
wallet_environments.tx_config,
|
|
2231
|
+
)
|
|
2056
2232
|
bulk_transfer_resp = await env_0.rpc_client.transfer_nft_bulk(
|
|
2057
2233
|
NFTTransferBulk(target_address=address, nft_coin_list=nft_coin_list, fee=fee, push=True),
|
|
2058
2234
|
wallet_environments.tx_config,
|
|
@@ -2101,11 +2277,15 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
|
|
|
2101
2277
|
)
|
|
2102
2278
|
|
|
2103
2279
|
await time_out_assert(30, get_wallet_number, 2, env_1.wallet_state_manager)
|
|
2104
|
-
coins = (
|
|
2280
|
+
coins = (
|
|
2281
|
+
await env_1.rpc_client.list_nfts(
|
|
2282
|
+
NFTGetNFTs(uint32(env_1.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(3))
|
|
2283
|
+
)
|
|
2284
|
+
).nft_list
|
|
2105
2285
|
assert len(coins) == 3
|
|
2106
|
-
nft0 =
|
|
2107
|
-
nft02 =
|
|
2108
|
-
nft03 =
|
|
2286
|
+
nft0 = coins[0]
|
|
2287
|
+
nft02 = coins[1]
|
|
2288
|
+
nft03 = coins[2]
|
|
2109
2289
|
nft_set = {nft1.launcher_id, nft12.launcher_id, nft2.launcher_id}
|
|
2110
2290
|
assert nft0.launcher_id in nft_set
|
|
2111
2291
|
assert nft02.launcher_id in nft_set
|
|
@@ -2165,14 +2345,17 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
|
|
|
2165
2345
|
)
|
|
2166
2346
|
|
|
2167
2347
|
mint_resp = await env.rpc_client.mint_nft(
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2348
|
+
request=NFTMintNFTRequest(
|
|
2349
|
+
wallet_id=uint32(env.wallet_aliases["nft_w_did1"]),
|
|
2350
|
+
royalty_address=None,
|
|
2351
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
2352
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
2353
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2354
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2355
|
+
did_id="",
|
|
2356
|
+
push=True,
|
|
2357
|
+
),
|
|
2174
2358
|
tx_config=wallet_environments.tx_config,
|
|
2175
|
-
did_id="",
|
|
2176
2359
|
)
|
|
2177
2360
|
assert len(compute_memos(mint_resp.spend_bundle)) > 0
|
|
2178
2361
|
|
|
@@ -2205,9 +2388,13 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
|
|
|
2205
2388
|
)
|
|
2206
2389
|
|
|
2207
2390
|
# Check DID NFT
|
|
2208
|
-
coins = (
|
|
2391
|
+
coins = (
|
|
2392
|
+
await env.rpc_client.list_nfts(
|
|
2393
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
|
|
2394
|
+
)
|
|
2395
|
+
).nft_list
|
|
2209
2396
|
assert len(coins) == 1
|
|
2210
|
-
coin =
|
|
2397
|
+
coin = coins[0]
|
|
2211
2398
|
assert coin.owner_did is None
|
|
2212
2399
|
nft_coin_id = coin.nft_coin_id
|
|
2213
2400
|
|
|
@@ -2232,11 +2419,14 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
|
|
|
2232
2419
|
)
|
|
2233
2420
|
|
|
2234
2421
|
await env.rpc_client.set_nft_did(
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2422
|
+
NFTSetNFTDID(
|
|
2423
|
+
wallet_id=uint32(env.wallet_aliases["nft_no_did"]),
|
|
2424
|
+
did_id=hmr_did_id,
|
|
2425
|
+
nft_coin_id=nft_coin_id,
|
|
2426
|
+
fee=uint64(0),
|
|
2427
|
+
push=True,
|
|
2428
|
+
),
|
|
2238
2429
|
tx_config=wallet_environments.tx_config,
|
|
2239
|
-
fee=0,
|
|
2240
2430
|
)
|
|
2241
2431
|
|
|
2242
2432
|
await wallet_environments.process_pending_states(
|
|
@@ -2271,26 +2461,32 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
|
|
|
2271
2461
|
assert isinstance(nft_wallet_to_check, NFTWallet)
|
|
2272
2462
|
assert len(await nft_wallet_to_check.get_current_nfts()) == 0
|
|
2273
2463
|
|
|
2274
|
-
coins = (
|
|
2464
|
+
coins = (
|
|
2465
|
+
await env.rpc_client.list_nfts(
|
|
2466
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did1"]), start_index=uint32(0), num=uint32(1))
|
|
2467
|
+
)
|
|
2468
|
+
).nft_list
|
|
2275
2469
|
assert len(coins) == 1
|
|
2276
|
-
coin =
|
|
2470
|
+
coin = coins[0]
|
|
2277
2471
|
assert coin.owner_did is not None
|
|
2278
2472
|
assert coin.owner_did.hex() == hex_did_id
|
|
2279
2473
|
nft_coin_id = coin.nft_coin_id
|
|
2280
2474
|
|
|
2281
|
-
|
|
2282
|
-
assert
|
|
2283
|
-
assert coins[0] == res["nft_info"]
|
|
2475
|
+
nft_get_info_res = await env.rpc_client.get_nft_info(NFTGetInfo(coin_id=nft_coin_id.hex(), latest=True))
|
|
2476
|
+
assert coins[0] == nft_get_info_res.nft_info
|
|
2284
2477
|
|
|
2285
2478
|
# Test set DID1 -> DID2
|
|
2286
2479
|
hex_did_id2 = did_wallet2.get_my_DID()
|
|
2287
2480
|
hmr_did_id2 = encode_puzzle_hash(bytes32.from_hexstr(hex_did_id2), AddressType.DID.hrp(env.node.config))
|
|
2288
2481
|
await env.rpc_client.set_nft_did(
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2482
|
+
NFTSetNFTDID(
|
|
2483
|
+
wallet_id=uint32(env.wallet_aliases["nft_w_did1"]),
|
|
2484
|
+
did_id=hmr_did_id2,
|
|
2485
|
+
nft_coin_id=nft_coin_id,
|
|
2486
|
+
fee=uint64(0),
|
|
2487
|
+
push=True,
|
|
2488
|
+
),
|
|
2292
2489
|
tx_config=wallet_environments.tx_config,
|
|
2293
|
-
fee=0,
|
|
2294
2490
|
)
|
|
2295
2491
|
|
|
2296
2492
|
await wallet_environments.process_pending_states(
|
|
@@ -2322,23 +2518,29 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
|
|
|
2322
2518
|
)
|
|
2323
2519
|
|
|
2324
2520
|
# Check NFT DID
|
|
2325
|
-
coins = (
|
|
2521
|
+
coins = (
|
|
2522
|
+
await env.rpc_client.list_nfts(
|
|
2523
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did2"]), start_index=uint32(0), num=uint32(1))
|
|
2524
|
+
)
|
|
2525
|
+
).nft_list
|
|
2326
2526
|
assert len(coins) == 1
|
|
2327
|
-
coin =
|
|
2527
|
+
coin = coins[0]
|
|
2328
2528
|
assert coin.owner_did is not None
|
|
2329
2529
|
assert coin.owner_did.hex() == hex_did_id2
|
|
2330
2530
|
nft_coin_id = coin.nft_coin_id
|
|
2331
|
-
|
|
2332
|
-
assert
|
|
2333
|
-
assert coins[0] == res["nft_info"]
|
|
2531
|
+
nft_get_info_res = await env.rpc_client.get_nft_info(NFTGetInfo(coin_id=nft_coin_id.hex(), latest=True))
|
|
2532
|
+
assert coins[0] == nft_get_info_res.nft_info
|
|
2334
2533
|
|
|
2335
2534
|
# Test set DID2 -> None
|
|
2336
2535
|
await env.rpc_client.set_nft_did(
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2536
|
+
NFTSetNFTDID(
|
|
2537
|
+
wallet_id=uint32(env.wallet_aliases["nft_w_did2"]),
|
|
2538
|
+
did_id=None,
|
|
2539
|
+
nft_coin_id=nft_coin_id,
|
|
2540
|
+
fee=uint64(0),
|
|
2541
|
+
push=True,
|
|
2542
|
+
),
|
|
2340
2543
|
tx_config=wallet_environments.tx_config,
|
|
2341
|
-
fee=0,
|
|
2342
2544
|
)
|
|
2343
2545
|
|
|
2344
2546
|
await wallet_environments.process_pending_states(
|
|
@@ -2358,13 +2560,16 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
|
|
|
2358
2560
|
)
|
|
2359
2561
|
|
|
2360
2562
|
# Check NFT DID
|
|
2361
|
-
coins = (
|
|
2563
|
+
coins = (
|
|
2564
|
+
await env.rpc_client.list_nfts(
|
|
2565
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
|
|
2566
|
+
)
|
|
2567
|
+
).nft_list
|
|
2362
2568
|
assert len(coins) == 1
|
|
2363
|
-
coin =
|
|
2569
|
+
coin = coins[0]
|
|
2364
2570
|
assert coin.owner_did is None
|
|
2365
|
-
|
|
2366
|
-
assert
|
|
2367
|
-
assert coins[0] == res["nft_info"]
|
|
2571
|
+
nft_get_info_res = await env.rpc_client.get_nft_info(NFTGetInfo(coin_id=nft_coin_id.hex(), latest=True))
|
|
2572
|
+
assert coins[0] == nft_get_info_res.nft_info
|
|
2368
2573
|
|
|
2369
2574
|
|
|
2370
2575
|
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
|
|
@@ -2399,14 +2604,17 @@ async def test_set_nft_status(wallet_environments: WalletTestFramework) -> None:
|
|
|
2399
2604
|
|
|
2400
2605
|
# Create a NFT without DID
|
|
2401
2606
|
await env.rpc_client.mint_nft(
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2607
|
+
request=NFTMintNFTRequest(
|
|
2608
|
+
wallet_id=uint32(env.wallet_aliases["nft"]),
|
|
2609
|
+
royalty_address=None,
|
|
2610
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
2611
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
2612
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2613
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2614
|
+
did_id="",
|
|
2615
|
+
push=True,
|
|
2616
|
+
),
|
|
2408
2617
|
tx_config=wallet_environments.tx_config,
|
|
2409
|
-
did_id="",
|
|
2410
2618
|
)
|
|
2411
2619
|
|
|
2412
2620
|
await wallet_environments.process_pending_states(
|
|
@@ -2437,9 +2645,13 @@ async def test_set_nft_status(wallet_environments: WalletTestFramework) -> None:
|
|
|
2437
2645
|
)
|
|
2438
2646
|
|
|
2439
2647
|
# Check DID NFT
|
|
2440
|
-
coins = (
|
|
2648
|
+
coins = (
|
|
2649
|
+
await env.rpc_client.list_nfts(
|
|
2650
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
2651
|
+
)
|
|
2652
|
+
).nft_list
|
|
2441
2653
|
assert len(coins) == 1
|
|
2442
|
-
coin =
|
|
2654
|
+
coin = coins[0]
|
|
2443
2655
|
assert coin.owner_did is None
|
|
2444
2656
|
assert not coin.pending_transaction
|
|
2445
2657
|
nft_coin_id = coin.nft_coin_id
|
|
@@ -2447,9 +2659,13 @@ async def test_set_nft_status(wallet_environments: WalletTestFramework) -> None:
|
|
|
2447
2659
|
await env.rpc_client.set_nft_status(
|
|
2448
2660
|
NFTSetNFTStatus(wallet_id=uint32(env.wallet_aliases["nft"]), coin_id=nft_coin_id, in_transaction=True)
|
|
2449
2661
|
)
|
|
2450
|
-
coins = (
|
|
2662
|
+
coins = (
|
|
2663
|
+
await env.rpc_client.list_nfts(
|
|
2664
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
2665
|
+
)
|
|
2666
|
+
).nft_list
|
|
2451
2667
|
assert len(coins) == 1
|
|
2452
|
-
coin =
|
|
2668
|
+
coin = coins[0]
|
|
2453
2669
|
assert coin.pending_transaction
|
|
2454
2670
|
|
|
2455
2671
|
|
|
@@ -2489,14 +2705,17 @@ async def test_nft_sign_message(wallet_environments: WalletTestFramework) -> Non
|
|
|
2489
2705
|
|
|
2490
2706
|
# Create a NFT without DID
|
|
2491
2707
|
await env.rpc_client.mint_nft(
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2708
|
+
request=NFTMintNFTRequest(
|
|
2709
|
+
wallet_id=uint32(env.wallet_aliases["nft"]),
|
|
2710
|
+
royalty_address=None,
|
|
2711
|
+
target_address=None, # doesn't matter so we'll just reuse
|
|
2712
|
+
hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
|
|
2713
|
+
uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2714
|
+
meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
|
|
2715
|
+
did_id="",
|
|
2716
|
+
push=True,
|
|
2717
|
+
),
|
|
2498
2718
|
tx_config=wallet_environments.tx_config,
|
|
2499
|
-
did_id="",
|
|
2500
2719
|
)
|
|
2501
2720
|
|
|
2502
2721
|
await wallet_environments.process_pending_states(
|
|
@@ -2527,9 +2746,13 @@ async def test_nft_sign_message(wallet_environments: WalletTestFramework) -> Non
|
|
|
2527
2746
|
)
|
|
2528
2747
|
|
|
2529
2748
|
# Check DID NFT
|
|
2530
|
-
coins = (
|
|
2749
|
+
coins = (
|
|
2750
|
+
await env.rpc_client.list_nfts(
|
|
2751
|
+
NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
|
|
2752
|
+
)
|
|
2753
|
+
).nft_list
|
|
2531
2754
|
assert len(coins) == 1
|
|
2532
|
-
coin =
|
|
2755
|
+
coin = coins[0]
|
|
2533
2756
|
assert coin.owner_did is None
|
|
2534
2757
|
assert not coin.pending_transaction
|
|
2535
2758
|
# Test general string
|