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
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import dataclasses
|
|
4
3
|
import json
|
|
5
4
|
import logging
|
|
6
5
|
import math
|
|
7
6
|
import time
|
|
8
7
|
from typing import TYPE_CHECKING, Any, ClassVar, Optional, TypeVar, cast
|
|
9
8
|
|
|
10
|
-
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
|
9
|
+
from chia_rs import AugSchemeMPL, CoinSpend, CoinState, G1Element, G2Element
|
|
11
10
|
from chia_rs.sized_bytes import bytes32
|
|
12
11
|
from chia_rs.sized_ints import uint16, uint32, uint64, uint128
|
|
13
|
-
from clvm.casts import int_from_bytes, int_to_bytes
|
|
14
12
|
from typing_extensions import Unpack
|
|
15
13
|
|
|
16
|
-
from chia.protocols.wallet_protocol import CoinState
|
|
17
14
|
from chia.server.ws_connection import WSChiaConnection
|
|
18
15
|
from chia.types.blockchain_format.coin import Coin
|
|
19
16
|
from chia.types.blockchain_format.program import Program
|
|
20
|
-
from chia.types.coin_spend import
|
|
17
|
+
from chia.types.coin_spend import make_spend
|
|
21
18
|
from chia.types.signing_mode import CHIP_0002_SIGN_MESSAGE_PREFIX, SigningMode
|
|
19
|
+
from chia.util.casts import int_from_bytes, int_to_bytes
|
|
22
20
|
from chia.util.hash import std_hash
|
|
23
21
|
from chia.wallet.conditions import (
|
|
24
22
|
AssertCoinAnnouncement,
|
|
@@ -50,6 +48,7 @@ from chia.wallet.singleton import SINGLETON_LAUNCHER_PUZZLE, SINGLETON_LAUNCHER_
|
|
|
50
48
|
from chia.wallet.trading.offer import OFFER_MOD, OFFER_MOD_HASH, NotarizedPayment, Offer
|
|
51
49
|
from chia.wallet.transaction_record import TransactionRecord
|
|
52
50
|
from chia.wallet.uncurried_puzzle import uncurry_puzzle
|
|
51
|
+
from chia.wallet.util.compute_additions import compute_additions
|
|
53
52
|
from chia.wallet.util.compute_memos import compute_memos
|
|
54
53
|
from chia.wallet.util.transaction_type import TransactionType
|
|
55
54
|
from chia.wallet.util.wallet_types import WalletType
|
|
@@ -212,7 +211,7 @@ class NFTWallet:
|
|
|
212
211
|
minter_did = None
|
|
213
212
|
if uncurried_nft.supports_did:
|
|
214
213
|
inner_puzzle = nft_puzzle_utils.recurry_nft_puzzle(
|
|
215
|
-
uncurried_nft, data.parent_coin_spend.solution
|
|
214
|
+
uncurried_nft, Program.from_serialized(data.parent_coin_spend.solution), p2_puzzle
|
|
216
215
|
)
|
|
217
216
|
minter_did = await self.wallet_state_manager.get_minter_did(launcher_coin_states[0].coin, peer)
|
|
218
217
|
else:
|
|
@@ -358,7 +357,7 @@ class NFTWallet:
|
|
|
358
357
|
launcher_coin = Coin(origin.name(), SINGLETON_LAUNCHER_PUZZLE_HASH, uint64(amount))
|
|
359
358
|
self.log.debug("Generating NFT with launcher coin %s and metadata: %s", launcher_coin, metadata)
|
|
360
359
|
|
|
361
|
-
p2_inner_puzzle = await
|
|
360
|
+
p2_inner_puzzle = await action_scope.get_puzzle(self.wallet_state_manager)
|
|
362
361
|
if not target_puzzle_hash:
|
|
363
362
|
target_puzzle_hash = p2_inner_puzzle.get_tree_hash()
|
|
364
363
|
self.log.debug("Attempt to generate a new NFT to %s", target_puzzle_hash.hex())
|
|
@@ -820,9 +819,7 @@ class NFTWallet:
|
|
|
820
819
|
royalty_payments[asset] = payment_list
|
|
821
820
|
|
|
822
821
|
# Generate the requested_payments to be notarized
|
|
823
|
-
p2_ph = await
|
|
824
|
-
new=not action_scope.config.tx_config.reuse_puzhash
|
|
825
|
-
)
|
|
822
|
+
p2_ph = await action_scope.get_puzzle_hash(wallet_state_manager)
|
|
826
823
|
requested_payments: dict[Optional[bytes32], list[CreateCoin]] = {}
|
|
827
824
|
for asset, amount in offer_dict.items():
|
|
828
825
|
if amount > 0:
|
|
@@ -1153,7 +1150,7 @@ class NFTWallet:
|
|
|
1153
1150
|
new_p2_puzhash: Optional[bytes32] = None,
|
|
1154
1151
|
did_coin: Optional[Coin] = None,
|
|
1155
1152
|
did_lineage_parent: Optional[bytes32] = None,
|
|
1156
|
-
fee:
|
|
1153
|
+
fee: uint64 = uint64(0),
|
|
1157
1154
|
extra_conditions: tuple[Condition, ...] = tuple(),
|
|
1158
1155
|
) -> None:
|
|
1159
1156
|
"""
|
|
@@ -1165,10 +1162,10 @@ class NFTWallet:
|
|
|
1165
1162
|
- The launcher coins are then spent along with the created eve spend
|
|
1166
1163
|
and an xch spend that funds the transactions and pays fees.
|
|
1167
1164
|
- There is also an option to pass in a list of target puzzlehashes. If
|
|
1168
|
-
provided this method will create an additional transaction
|
|
1165
|
+
provided this method will create an additional transaction transferring
|
|
1169
1166
|
the minted NFTs to the row-matched target.
|
|
1170
1167
|
:param metadata_list: A list of dicts containing the metadata for each NFT to be minted
|
|
1171
|
-
:param target_list: [Optional] a list of targets for
|
|
1168
|
+
:param target_list: [Optional] a list of targets for transferring minted NFTs (aka airdrop)
|
|
1172
1169
|
:param mint_number_start: [Optional] The starting point for mint number used in intermediate launcher
|
|
1173
1170
|
puzzle. Default: 1
|
|
1174
1171
|
:param mint_total: [Optional] The total number of NFTs being minted
|
|
@@ -1207,6 +1204,7 @@ class NFTWallet:
|
|
|
1207
1204
|
# Ensure we have a did coin and its next inner puzzle hash
|
|
1208
1205
|
if did_coin is None:
|
|
1209
1206
|
did_coin = await did_wallet.get_coin()
|
|
1207
|
+
assert did_coin is not None
|
|
1210
1208
|
innerpuz: Program = did_wallet.did_info.current_inner
|
|
1211
1209
|
if new_innerpuzhash is None:
|
|
1212
1210
|
new_innerpuzhash = innerpuz.get_tree_hash()
|
|
@@ -1218,13 +1216,6 @@ class NFTWallet:
|
|
|
1218
1216
|
# make the primaries for the DID spend
|
|
1219
1217
|
primaries = [CreateCoin(new_innerpuzhash, uint64(did_coin.amount), [bytes(new_p2_puzhash)])]
|
|
1220
1218
|
|
|
1221
|
-
# Ensure we have an xch coin of high enough amount
|
|
1222
|
-
assert isinstance(fee, uint64)
|
|
1223
|
-
total_amount = len(metadata_list) + fee
|
|
1224
|
-
if xch_coins is None:
|
|
1225
|
-
xch_coins = await self.standard_wallet.select_coins(uint64(total_amount), action_scope)
|
|
1226
|
-
assert len(xch_coins) > 0
|
|
1227
|
-
|
|
1228
1219
|
# set the chunk size for the spend bundle we're going to create
|
|
1229
1220
|
chunk_size = len(metadata_list)
|
|
1230
1221
|
|
|
@@ -1242,7 +1233,7 @@ class NFTWallet:
|
|
|
1242
1233
|
intermediate_coin_spends = []
|
|
1243
1234
|
launcher_spends = []
|
|
1244
1235
|
launcher_ids = []
|
|
1245
|
-
p2_inner_puzzle = await self.
|
|
1236
|
+
p2_inner_puzzle = await action_scope.get_puzzle(self.wallet_state_manager)
|
|
1246
1237
|
p2_inner_ph = p2_inner_puzzle.get_tree_hash()
|
|
1247
1238
|
|
|
1248
1239
|
# Loop to create each intermediate coin, launcher, eve and (optional) transfer spends
|
|
@@ -1337,7 +1328,7 @@ class NFTWallet:
|
|
|
1337
1328
|
tx.spend_bundle for tx in inner_action_scope.side_effects.transactions if tx.spend_bundle is not None
|
|
1338
1329
|
)
|
|
1339
1330
|
# Extract Puzzle Announcement from eve spend
|
|
1340
|
-
eve_sol = eve_sb.coin_spends[0].solution
|
|
1331
|
+
eve_sol = Program.from_serialized(eve_sb.coin_spends[0].solution)
|
|
1341
1332
|
conds = eve_fullpuz.run(eve_sol)
|
|
1342
1333
|
eve_puzzle_announcement = next(x for x in conds.as_python() if int_from_bytes(x[0]) == 62)[1]
|
|
1343
1334
|
assertion = std_hash(eve_fullpuz.get_tree_hash() + eve_puzzle_announcement)
|
|
@@ -1345,45 +1336,28 @@ class NFTWallet:
|
|
|
1345
1336
|
|
|
1346
1337
|
# We've now created all the intermediate, launcher, eve and transfer spends.
|
|
1347
1338
|
# Create the xch spend to fund the minting.
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
xch_payment = CreateCoin(xch_change_ph, change, [xch_change_ph])
|
|
1353
|
-
|
|
1354
|
-
xch_coins_iter = iter(xch_coins)
|
|
1355
|
-
xch_coin = next(xch_coins_iter)
|
|
1356
|
-
|
|
1339
|
+
total_amount = len(metadata_list) + fee
|
|
1340
|
+
if xch_coins is None:
|
|
1341
|
+
xch_coins = await self.standard_wallet.select_coins(uint64(total_amount), action_scope)
|
|
1342
|
+
assert len(xch_coins) > 0
|
|
1357
1343
|
message_list: list[bytes32] = [c.name() for c in xch_coins]
|
|
1358
|
-
message_list.append(Coin(xch_coin.name(), xch_payment.puzzle_hash, xch_payment.amount).name())
|
|
1359
1344
|
message: bytes32 = std_hash(b"".join(message_list))
|
|
1360
1345
|
|
|
1361
1346
|
xch_extra_conditions: tuple[Condition, ...] = (
|
|
1362
1347
|
AssertCoinAnnouncement(asserted_id=did_coin.name(), asserted_msg=message),
|
|
1363
1348
|
)
|
|
1364
|
-
if len(xch_coins) > 1:
|
|
1365
|
-
xch_extra_conditions += (CreateCoinAnnouncement(message),)
|
|
1366
1349
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1350
|
+
await self.standard_wallet.create_tandem_xch_tx(
|
|
1351
|
+
uint64(total_amount),
|
|
1352
|
+
action_scope,
|
|
1353
|
+
coins=xch_coins,
|
|
1354
|
+
extra_conditions=xch_extra_conditions,
|
|
1355
|
+
reserve_fee=fee,
|
|
1356
|
+
preferred_change_puzzle_hash=xch_change_ph,
|
|
1371
1357
|
)
|
|
1372
|
-
primary_announcement_hash = AssertCoinAnnouncement(asserted_id=xch_coin.name(), asserted_msg=message).msg_calc
|
|
1373
|
-
# connect this coin assertion to the DID announcement
|
|
1374
|
-
did_coin_announcement = CreateCoinAnnouncement(message)
|
|
1375
|
-
puzzle = await self.standard_wallet.puzzle_for_puzzle_hash(xch_coin.puzzle_hash)
|
|
1376
|
-
xch_spends = [make_spend(xch_coin, puzzle, solution)]
|
|
1377
|
-
|
|
1378
|
-
for xch_coin in xch_coins_iter:
|
|
1379
|
-
puzzle = await self.standard_wallet.puzzle_for_puzzle_hash(xch_coin.puzzle_hash)
|
|
1380
|
-
solution = self.standard_wallet.make_solution(
|
|
1381
|
-
primaries=[], conditions=(AssertCoinAnnouncement(primary_announcement_hash),)
|
|
1382
|
-
)
|
|
1383
|
-
xch_spends.append(make_spend(xch_coin, puzzle, solution))
|
|
1384
|
-
xch_spend = WalletSpendBundle(xch_spends, G2Element())
|
|
1385
1358
|
|
|
1386
1359
|
# Create the DID spend using the announcements collected when making the intermediate launcher coins
|
|
1360
|
+
did_coin_announcement = CreateCoinAnnouncement(message)
|
|
1387
1361
|
did_p2_solution = self.standard_wallet.make_solution(
|
|
1388
1362
|
primaries=primaries,
|
|
1389
1363
|
conditions=(
|
|
@@ -1423,22 +1397,30 @@ class NFTWallet:
|
|
|
1423
1397
|
did_spend = make_spend(did_coin, did_full_puzzle, did_full_sol)
|
|
1424
1398
|
|
|
1425
1399
|
# Collect up all the coin spends and sign them
|
|
1426
|
-
list_of_coinspends = [did_spend, *intermediate_coin_spends, *launcher_spends
|
|
1400
|
+
list_of_coinspends = [did_spend, *intermediate_coin_spends, *launcher_spends]
|
|
1427
1401
|
unsigned_spend_bundle = WalletSpendBundle(list_of_coinspends, G2Element())
|
|
1428
1402
|
|
|
1429
|
-
# Aggregate everything into a single spend bundle
|
|
1430
1403
|
async with action_scope.use() as interface:
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1404
|
+
interface.side_effects.transactions.append(
|
|
1405
|
+
TransactionRecord(
|
|
1406
|
+
confirmed_at_height=uint32(0),
|
|
1407
|
+
created_at_time=uint64(int(time.time())),
|
|
1408
|
+
to_puzzle_hash=innerpuz.get_tree_hash(),
|
|
1409
|
+
amount=uint64(1),
|
|
1410
|
+
fee_amount=fee,
|
|
1411
|
+
confirmed=False,
|
|
1412
|
+
sent=uint32(0),
|
|
1413
|
+
spend_bundle=unsigned_spend_bundle,
|
|
1414
|
+
additions=list(unsigned_spend_bundle.additions()),
|
|
1415
|
+
removals=list(unsigned_spend_bundle.removals()),
|
|
1416
|
+
wallet_id=did_wallet.id(),
|
|
1417
|
+
sent_to=[],
|
|
1418
|
+
trade_id=None,
|
|
1419
|
+
type=uint32(TransactionType.OUTGOING_TX.value),
|
|
1420
|
+
name=unsigned_spend_bundle.name(),
|
|
1421
|
+
memos=list(compute_memos(unsigned_spend_bundle).items()),
|
|
1422
|
+
valid_times=parse_timelock_info(extra_conditions),
|
|
1439
1423
|
)
|
|
1440
|
-
interface.side_effects.transactions[0] = dataclasses.replace(
|
|
1441
|
-
interface.side_effects.transactions[0], spend_bundle=new_spend, name=new_spend.name()
|
|
1442
1424
|
)
|
|
1443
1425
|
|
|
1444
1426
|
async def mint_from_xch(
|
|
@@ -1450,13 +1432,13 @@ class NFTWallet:
|
|
|
1450
1432
|
mint_total: Optional[int] = None,
|
|
1451
1433
|
xch_coins: Optional[set[Coin]] = None,
|
|
1452
1434
|
xch_change_ph: Optional[bytes32] = None,
|
|
1453
|
-
fee:
|
|
1435
|
+
fee: uint64 = uint64(0),
|
|
1454
1436
|
extra_conditions: tuple[Condition, ...] = tuple(),
|
|
1455
1437
|
) -> None:
|
|
1456
1438
|
"""
|
|
1457
1439
|
Minting NFTs from a single XCH spend using intermediate launcher puzzle
|
|
1458
1440
|
:param metadata_list: A list of dicts containing the metadata for each NFT to be minted
|
|
1459
|
-
:param target_list: [Optional] a list of targets for
|
|
1441
|
+
:param target_list: [Optional] a list of targets for transferring minted NFTs (aka airdrop)
|
|
1460
1442
|
:param mint_number_start: [Optional] The starting point for mint number used in intermediate launcher
|
|
1461
1443
|
puzzle. Default: 1
|
|
1462
1444
|
:param mint_total: [Optional] The total number of NFTs being minted
|
|
@@ -1474,7 +1456,6 @@ class NFTWallet:
|
|
|
1474
1456
|
assert len(metadata_list) <= mint_total + 1 - mint_number_start
|
|
1475
1457
|
|
|
1476
1458
|
# Ensure we have an xch coin of high enough amount
|
|
1477
|
-
assert isinstance(fee, uint64)
|
|
1478
1459
|
total_amount = len(metadata_list) + fee
|
|
1479
1460
|
if xch_coins is None:
|
|
1480
1461
|
xch_coins = await self.standard_wallet.select_coins(uint64(total_amount), action_scope)
|
|
@@ -1500,7 +1481,7 @@ class NFTWallet:
|
|
|
1500
1481
|
intermediate_coin_spends = []
|
|
1501
1482
|
launcher_spends = []
|
|
1502
1483
|
launcher_ids = []
|
|
1503
|
-
p2_inner_puzzle = await self.
|
|
1484
|
+
p2_inner_puzzle = await action_scope.get_puzzle(self.wallet_state_manager)
|
|
1504
1485
|
p2_inner_ph = p2_inner_puzzle.get_tree_hash()
|
|
1505
1486
|
|
|
1506
1487
|
# Loop to create each intermediate coin, launcher, eve and (optional) transfer spends
|
|
@@ -1594,7 +1575,7 @@ class NFTWallet:
|
|
|
1594
1575
|
tx.spend_bundle for tx in inner_action_scope.side_effects.transactions if tx.spend_bundle is not None
|
|
1595
1576
|
)
|
|
1596
1577
|
# Extract Puzzle Announcement from eve spend
|
|
1597
|
-
eve_sol = eve_sb.coin_spends[0].solution
|
|
1578
|
+
eve_sol = Program.from_serialized(eve_sb.coin_spends[0].solution)
|
|
1598
1579
|
conds = eve_fullpuz.run(eve_sol)
|
|
1599
1580
|
eve_puzzle_announcement = next(x for x in conds.as_python() if int_from_bytes(x[0]) == 62)[1]
|
|
1600
1581
|
assertion = std_hash(eve_fullpuz.get_tree_hash() + eve_puzzle_announcement)
|
|
@@ -1602,54 +1583,30 @@ class NFTWallet:
|
|
|
1602
1583
|
|
|
1603
1584
|
# We've now created all the intermediate, launcher, eve and transfer spends.
|
|
1604
1585
|
# Create the xch spend to fund the minting.
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
xch_spends = []
|
|
1608
|
-
if xch_change_ph is None:
|
|
1609
|
-
xch_change_ph = await self.standard_wallet.get_new_puzzlehash()
|
|
1610
|
-
xch_payment = CreateCoin(xch_change_ph, change, [xch_change_ph])
|
|
1586
|
+
message_list: list[bytes32] = [c.name() for c in xch_coins]
|
|
1587
|
+
message: bytes32 = std_hash(b"".join(message_list))
|
|
1611
1588
|
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
message_list: list[bytes32] = [c.name() for c in xch_coins]
|
|
1617
|
-
message_list.append(Coin(xch_coin.name(), xch_payment.puzzle_hash, xch_payment.amount).name())
|
|
1618
|
-
message: bytes32 = std_hash(b"".join(message_list))
|
|
1619
|
-
|
|
1620
|
-
if len(xch_coins) > 1:
|
|
1621
|
-
extra_conditions += (CreateCoinAnnouncement(message),)
|
|
1622
|
-
extra_conditions += tuple(AssertCoinAnnouncement(ann) for ann in coin_announcements)
|
|
1623
|
-
extra_conditions += tuple(AssertPuzzleAnnouncement(ann) for ann in puzzle_assertions)
|
|
1624
|
-
|
|
1625
|
-
solution: Program = self.standard_wallet.make_solution(
|
|
1626
|
-
primaries=[xch_payment, *primaries],
|
|
1627
|
-
fee=fee,
|
|
1628
|
-
conditions=extra_conditions,
|
|
1629
|
-
)
|
|
1630
|
-
primary_announcement = AssertCoinAnnouncement(asserted_id=xch_coin.name(), asserted_msg=message)
|
|
1631
|
-
first = False
|
|
1632
|
-
else:
|
|
1633
|
-
solution = self.standard_wallet.make_solution(primaries=[], conditions=(primary_announcement,))
|
|
1634
|
-
xch_spends.append(make_spend(xch_coin, puzzle, solution))
|
|
1589
|
+
if len(xch_coins) > 1:
|
|
1590
|
+
extra_conditions += (CreateCoinAnnouncement(message),)
|
|
1591
|
+
extra_conditions += tuple(AssertCoinAnnouncement(ann) for ann in coin_announcements)
|
|
1592
|
+
extra_conditions += tuple(AssertPuzzleAnnouncement(ann) for ann in puzzle_assertions)
|
|
1635
1593
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1594
|
+
await self.standard_wallet.generate_signed_transaction(
|
|
1595
|
+
[p.amount for p in primaries],
|
|
1596
|
+
[p.puzzle_hash for p in primaries],
|
|
1597
|
+
action_scope,
|
|
1598
|
+
fee=fee,
|
|
1599
|
+
coins=xch_coins,
|
|
1600
|
+
# Not ideal to be forced to output at least a [] here.
|
|
1601
|
+
# We should have a better API to generate_signed_transaction that takes the whole CreateCoin in the API.
|
|
1602
|
+
memos=[p.memos if p.memos is not None else [] for p in primaries],
|
|
1603
|
+
extra_conditions=extra_conditions,
|
|
1604
|
+
preferred_change_puzzle_hash=xch_change_ph,
|
|
1605
|
+
)
|
|
1639
1606
|
|
|
1640
|
-
# Aggregate everything into a single spend bundle
|
|
1641
1607
|
async with action_scope.use() as interface:
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
# is out of scope so for now we're using this hack.
|
|
1645
|
-
if interface.side_effects.transactions[0].spend_bundle is None:
|
|
1646
|
-
new_spend = unsigned_spend_bundle
|
|
1647
|
-
else:
|
|
1648
|
-
new_spend = WalletSpendBundle.aggregate(
|
|
1649
|
-
[interface.side_effects.transactions[0].spend_bundle, unsigned_spend_bundle]
|
|
1650
|
-
)
|
|
1651
|
-
interface.side_effects.transactions[0] = dataclasses.replace(
|
|
1652
|
-
interface.side_effects.transactions[0], spend_bundle=new_spend, name=new_spend.name()
|
|
1608
|
+
interface.side_effects.extra_spends.append(
|
|
1609
|
+
WalletSpendBundle(intermediate_coin_spends + launcher_spends, G2Element())
|
|
1653
1610
|
)
|
|
1654
1611
|
|
|
1655
1612
|
async def select_coins(
|
|
@@ -33,7 +33,7 @@ class OwnershipOuterPuzzle:
|
|
|
33
33
|
_match: Callable[[UncurriedPuzzle], Optional[PuzzleInfo]]
|
|
34
34
|
_construct: Callable[[PuzzleInfo, Program], Program]
|
|
35
35
|
_solve: Callable[[PuzzleInfo, Solver, Program, Program], Program]
|
|
36
|
-
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle], Optional[Program]]
|
|
36
|
+
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle, Optional[Program]], Optional[Program]]
|
|
37
37
|
_get_inner_solution: Callable[[PuzzleInfo, Program], Optional[Program]]
|
|
38
38
|
|
|
39
39
|
def match(self, puzzle: UncurriedPuzzle) -> Optional[PuzzleInfo]:
|
|
@@ -68,13 +68,15 @@ class OwnershipOuterPuzzle:
|
|
|
68
68
|
transfer_program = self._construct(transfer_program_info, inner_puzzle)
|
|
69
69
|
return puzzle_for_ownership_layer(constructor["owner"], transfer_program, inner_puzzle)
|
|
70
70
|
|
|
71
|
-
def get_inner_puzzle(
|
|
71
|
+
def get_inner_puzzle(
|
|
72
|
+
self, constructor: PuzzleInfo, puzzle_reveal: UncurriedPuzzle, solution: Optional[Program] = None
|
|
73
|
+
) -> Optional[Program]:
|
|
72
74
|
matched, curried_args = match_ownership_layer_puzzle(puzzle_reveal)
|
|
73
75
|
if matched:
|
|
74
76
|
_, _, _, inner_puzzle = curried_args
|
|
75
77
|
also = constructor.also()
|
|
76
78
|
if also is not None:
|
|
77
|
-
deep_inner_puzzle: Optional[Program] = self._get_inner_puzzle(also, uncurry_puzzle(inner_puzzle))
|
|
79
|
+
deep_inner_puzzle: Optional[Program] = self._get_inner_puzzle(also, uncurry_puzzle(inner_puzzle), None)
|
|
78
80
|
return deep_inner_puzzle
|
|
79
81
|
else:
|
|
80
82
|
return inner_puzzle
|
|
@@ -3,12 +3,12 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Any, Callable, Optional
|
|
5
5
|
|
|
6
|
+
from chia_rs import CoinSpend
|
|
6
7
|
from chia_rs.sized_bytes import bytes32
|
|
7
8
|
from chia_rs.sized_ints import uint64
|
|
8
9
|
|
|
9
10
|
from chia.types.blockchain_format.coin import Coin
|
|
10
11
|
from chia.types.blockchain_format.program import Program
|
|
11
|
-
from chia.types.coin_spend import CoinSpend
|
|
12
12
|
from chia.wallet.lineage_proof import LineageProof
|
|
13
13
|
from chia.wallet.puzzle_drivers import PuzzleInfo, Solver
|
|
14
14
|
from chia.wallet.puzzles.singleton_top_layer_v1_1 import (
|
|
@@ -25,7 +25,7 @@ class SingletonOuterPuzzle:
|
|
|
25
25
|
_match: Callable[[UncurriedPuzzle], Optional[PuzzleInfo]]
|
|
26
26
|
_construct: Callable[[PuzzleInfo, Program], Program]
|
|
27
27
|
_solve: Callable[[PuzzleInfo, Solver, Program, Program], Program]
|
|
28
|
-
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle], Optional[Program]]
|
|
28
|
+
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle, Optional[Program]], Optional[Program]]
|
|
29
29
|
_get_inner_solution: Callable[[PuzzleInfo, Program], Optional[Program]]
|
|
30
30
|
|
|
31
31
|
def match(self, puzzle: UncurriedPuzzle) -> Optional[PuzzleInfo]:
|
|
@@ -62,13 +62,15 @@ class SingletonOuterPuzzle:
|
|
|
62
62
|
launcher_hash = constructor["launcher_ph"] if "launcher_ph" in constructor else SINGLETON_LAUNCHER_HASH
|
|
63
63
|
return puzzle_for_singleton(constructor["launcher_id"], inner_puzzle, launcher_hash)
|
|
64
64
|
|
|
65
|
-
def get_inner_puzzle(
|
|
65
|
+
def get_inner_puzzle(
|
|
66
|
+
self, constructor: PuzzleInfo, puzzle_reveal: UncurriedPuzzle, solution: Optional[Program] = None
|
|
67
|
+
) -> Optional[Program]:
|
|
66
68
|
matched, curried_args = match_singleton_puzzle(puzzle_reveal)
|
|
67
69
|
if matched:
|
|
68
70
|
_, inner_puzzle = curried_args
|
|
69
71
|
also = constructor.also()
|
|
70
72
|
if also is not None:
|
|
71
|
-
deep_inner_puzzle: Optional[Program] = self._get_inner_puzzle(also, uncurry_puzzle(inner_puzzle))
|
|
73
|
+
deep_inner_puzzle: Optional[Program] = self._get_inner_puzzle(also, uncurry_puzzle(inner_puzzle), None)
|
|
72
74
|
return deep_inner_puzzle
|
|
73
75
|
else:
|
|
74
76
|
return inner_puzzle
|
|
@@ -43,7 +43,7 @@ class TransferProgramPuzzle:
|
|
|
43
43
|
_match: Callable[[UncurriedPuzzle], Optional[PuzzleInfo]]
|
|
44
44
|
_construct: Callable[[PuzzleInfo, Program], Program]
|
|
45
45
|
_solve: Callable[[PuzzleInfo, Solver, Program, Program], Program]
|
|
46
|
-
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle], Optional[Program]]
|
|
46
|
+
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle, Optional[Program]], Optional[Program]]
|
|
47
47
|
_get_inner_solution: Callable[[PuzzleInfo, Program], Optional[Program]]
|
|
48
48
|
|
|
49
49
|
def match(self, puzzle: UncurriedPuzzle) -> Optional[PuzzleInfo]:
|
|
@@ -68,7 +68,9 @@ class TransferProgramPuzzle:
|
|
|
68
68
|
constructor["launcher_id"], constructor["royalty_address"], constructor["royalty_percentage"]
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
def get_inner_puzzle(
|
|
71
|
+
def get_inner_puzzle(
|
|
72
|
+
self, constructor: PuzzleInfo, puzzle_reveal: UncurriedPuzzle, solution: Optional[Program] = None
|
|
73
|
+
) -> Optional[Program]:
|
|
72
74
|
return None
|
|
73
75
|
|
|
74
76
|
def get_inner_solution(self, constructor: PuzzleInfo, solution: Program) -> Optional[Program]:
|
|
@@ -2,14 +2,14 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
-
from typing import Optional
|
|
5
|
+
from typing import Optional
|
|
6
6
|
|
|
7
|
+
from chia_rs import CoinSpend, CoinState
|
|
7
8
|
from chia_rs.sized_bytes import bytes32
|
|
8
9
|
from chia_rs.sized_ints import uint16
|
|
10
|
+
from typing_extensions import Self
|
|
9
11
|
|
|
10
|
-
from chia.protocols.wallet_protocol import CoinState
|
|
11
12
|
from chia.types.blockchain_format.program import Program
|
|
12
|
-
from chia.types.coin_spend import CoinSpend
|
|
13
13
|
from chia.util.streamable import Streamable, streamable
|
|
14
14
|
from chia.wallet.nft_wallet.nft_puzzles import NFT_OWNERSHIP_LAYER
|
|
15
15
|
from chia.wallet.nft_wallet.nft_puzzles import NFT_STATE_LAYER_MOD as NFT_MOD
|
|
@@ -17,8 +17,6 @@ from chia.wallet.singleton import SINGLETON_TOP_LAYER_MOD
|
|
|
17
17
|
|
|
18
18
|
log = logging.getLogger(__name__)
|
|
19
19
|
|
|
20
|
-
_T_UncurriedNFT = TypeVar("_T_UncurriedNFT", bound="UncurriedNFT")
|
|
21
|
-
|
|
22
20
|
|
|
23
21
|
@streamable
|
|
24
22
|
@dataclass(frozen=True)
|
|
@@ -89,7 +87,7 @@ class UncurriedNFT(Streamable):
|
|
|
89
87
|
trade_price_percentage: Optional[uint16]
|
|
90
88
|
|
|
91
89
|
@classmethod
|
|
92
|
-
def uncurry(cls
|
|
90
|
+
def uncurry(cls, mod: Program, curried_args: Program) -> Optional[Self]:
|
|
93
91
|
"""
|
|
94
92
|
Try to uncurry a NFT puzzle
|
|
95
93
|
:param cls UncurriedNFT class
|
|
@@ -3,14 +3,13 @@ from __future__ import annotations
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Any, Optional
|
|
5
5
|
|
|
6
|
-
from chia_rs import G2Element
|
|
6
|
+
from chia_rs import CoinSpend, CoinState, G2Element
|
|
7
7
|
from chia_rs.sized_bytes import bytes32
|
|
8
8
|
from chia_rs.sized_ints import uint32, uint64
|
|
9
9
|
|
|
10
|
-
from chia.protocols.wallet_protocol import CoinState
|
|
11
10
|
from chia.types.blockchain_format.coin import Coin
|
|
12
11
|
from chia.types.blockchain_format.program import Program
|
|
13
|
-
from chia.types.coin_spend import
|
|
12
|
+
from chia.types.coin_spend import make_spend
|
|
14
13
|
from chia.util.db_wrapper import DBWrapper2
|
|
15
14
|
from chia.wallet.conditions import AssertCoinAnnouncement, Condition
|
|
16
15
|
from chia.wallet.notification_store import Notification, NotificationStore
|
chia/wallet/outer_puzzles.py
CHANGED
|
@@ -15,6 +15,7 @@ from chia.wallet.nft_wallet.transfer_program_puzzle import TransferProgramPuzzle
|
|
|
15
15
|
from chia.wallet.puzzle_drivers import PuzzleInfo, Solver
|
|
16
16
|
from chia.wallet.uncurried_puzzle import UncurriedPuzzle
|
|
17
17
|
from chia.wallet.vc_wallet.cr_outer_puzzle import CROuterPuzzle
|
|
18
|
+
from chia.wallet.vc_wallet.vc_drivers import RevocationOuterPuzzle
|
|
18
19
|
|
|
19
20
|
"""
|
|
20
21
|
This file provides a central location for acquiring drivers for outer puzzles like CATs, NFTs, etc.
|
|
@@ -43,6 +44,7 @@ class AssetType(Enum):
|
|
|
43
44
|
OWNERSHIP = "ownership"
|
|
44
45
|
ROYALTY_TRANSFER_PROGRAM = "royalty transfer program"
|
|
45
46
|
CR = "credential restricted"
|
|
47
|
+
REVOCATION_LAYER = "revocation layer"
|
|
46
48
|
|
|
47
49
|
|
|
48
50
|
def match_puzzle(puzzle: UncurriedPuzzle) -> Optional[PuzzleInfo]:
|
|
@@ -61,8 +63,10 @@ def solve_puzzle(constructor: PuzzleInfo, solver: Solver, inner_puzzle: Program,
|
|
|
61
63
|
return driver_lookup[AssetType(constructor.type())].solve(constructor, solver, inner_puzzle, inner_solution)
|
|
62
64
|
|
|
63
65
|
|
|
64
|
-
def get_inner_puzzle(
|
|
65
|
-
|
|
66
|
+
def get_inner_puzzle(
|
|
67
|
+
constructor: PuzzleInfo, puzzle_reveal: UncurriedPuzzle, solution: Optional[Program] = None
|
|
68
|
+
) -> Optional[Program]:
|
|
69
|
+
return driver_lookup[AssetType(constructor.type())].get_inner_puzzle(constructor, puzzle_reveal, solution)
|
|
66
70
|
|
|
67
71
|
|
|
68
72
|
def get_inner_solution(constructor: PuzzleInfo, solution: Program) -> Optional[Program]:
|
|
@@ -82,4 +86,5 @@ driver_lookup: dict[AssetType, DriverProtocol] = {
|
|
|
82
86
|
AssetType.OWNERSHIP: OwnershipOuterPuzzle(*function_args),
|
|
83
87
|
AssetType.ROYALTY_TRANSFER_PROGRAM: TransferProgramPuzzle(*function_args),
|
|
84
88
|
AssetType.CR: CROuterPuzzle(*function_args),
|
|
89
|
+
AssetType.REVOCATION_LAYER: RevocationOuterPuzzle(),
|
|
85
90
|
}
|
chia/wallet/puzzle_drivers.py
CHANGED
|
@@ -3,12 +3,12 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Any, Optional
|
|
5
5
|
|
|
6
|
-
from clvm.casts import int_from_bytes
|
|
7
6
|
from clvm.SExp import SExp
|
|
8
7
|
from clvm_tools.binutils import assemble, type_for_atom
|
|
9
8
|
from ir.Type import Type
|
|
10
9
|
|
|
11
10
|
from chia.types.blockchain_format.program import Program
|
|
11
|
+
from chia.util.casts import int_from_bytes
|
|
12
12
|
|
|
13
13
|
"""
|
|
14
14
|
The following two classes act as wrapper classes around dictionaries of strings.
|
|
@@ -16,16 +16,17 @@ from chia_puzzles_py.programs import (
|
|
|
16
16
|
P2_PUZZLE_HASH,
|
|
17
17
|
P2_PUZZLE_HASH_HASH,
|
|
18
18
|
)
|
|
19
|
+
from chia_rs import CoinSpend
|
|
19
20
|
from chia_rs.sized_bytes import bytes32
|
|
20
21
|
from chia_rs.sized_ints import uint64
|
|
21
22
|
|
|
23
|
+
from chia.consensus.condition_tools import conditions_for_solution
|
|
22
24
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
|
23
25
|
from chia.types.blockchain_format.coin import Coin
|
|
24
26
|
from chia.types.blockchain_format.program import Program
|
|
25
27
|
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
26
|
-
from chia.types.coin_spend import
|
|
28
|
+
from chia.types.coin_spend import make_spend
|
|
27
29
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
28
|
-
from chia.util.condition_tools import conditions_for_solution
|
|
29
30
|
from chia.util.streamable import VersionedBlob
|
|
30
31
|
from chia.wallet.puzzles.clawback.metadata import ClawbackMetadata
|
|
31
32
|
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import MOD
|
|
@@ -143,9 +144,9 @@ def match_clawback_puzzle(
|
|
|
143
144
|
if MOD != uncurried.mod:
|
|
144
145
|
return None
|
|
145
146
|
if not isinstance(inner_puzzle, SerializedProgram):
|
|
146
|
-
inner_puzzle =
|
|
147
|
+
inner_puzzle = inner_puzzle.to_serialized()
|
|
147
148
|
if not isinstance(inner_solution, SerializedProgram):
|
|
148
|
-
inner_solution =
|
|
149
|
+
inner_solution = inner_solution.to_serialized()
|
|
149
150
|
# Fetch Remark condition
|
|
150
151
|
conditions = conditions_for_solution(
|
|
151
152
|
inner_puzzle,
|
|
@@ -65,9 +65,9 @@ from typing import Union
|
|
|
65
65
|
from chia_puzzles_py.programs import P2_DELEGATED_PUZZLE_OR_HIDDEN_PUZZLE
|
|
66
66
|
from chia_rs import G1Element, PrivateKey
|
|
67
67
|
from chia_rs.sized_bytes import bytes32
|
|
68
|
-
from clvm.casts import int_from_bytes
|
|
69
68
|
|
|
70
69
|
from chia.types.blockchain_format.program import Program
|
|
70
|
+
from chia.util.casts import int_from_bytes
|
|
71
71
|
from chia.wallet.puzzles.p2_conditions import puzzle_for_conditions
|
|
72
72
|
from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash, shatree_atom
|
|
73
73
|
|
|
@@ -17,12 +17,13 @@ from chia_puzzles_py.programs import (
|
|
|
17
17
|
from chia_puzzles_py.programs import (
|
|
18
18
|
SINGLETON_LAUNCHER_HASH as SINGLETON_LAUNCHER_HASH_BYTES,
|
|
19
19
|
)
|
|
20
|
+
from chia_rs import CoinSpend
|
|
20
21
|
from chia_rs.sized_bytes import bytes32
|
|
21
22
|
from chia_rs.sized_ints import uint64
|
|
22
23
|
|
|
23
24
|
from chia.types.blockchain_format.coin import Coin
|
|
24
25
|
from chia.types.blockchain_format.program import Program
|
|
25
|
-
from chia.types.coin_spend import
|
|
26
|
+
from chia.types.coin_spend import make_spend
|
|
26
27
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
27
28
|
from chia.util.hash import std_hash
|
|
28
29
|
from chia.wallet.lineage_proof import LineageProof
|
|
@@ -15,12 +15,13 @@ from chia_puzzles_py.programs import (
|
|
|
15
15
|
from chia_puzzles_py.programs import (
|
|
16
16
|
SINGLETON_LAUNCHER_HASH as SINGLETON_LAUNCHER_HASH_BYTES,
|
|
17
17
|
)
|
|
18
|
+
from chia_rs import CoinSpend
|
|
18
19
|
from chia_rs.sized_bytes import bytes32
|
|
19
20
|
from chia_rs.sized_ints import uint64
|
|
20
21
|
|
|
21
22
|
from chia.types.blockchain_format.coin import Coin
|
|
22
23
|
from chia.types.blockchain_format.program import Program
|
|
23
|
-
from chia.types.coin_spend import
|
|
24
|
+
from chia.types.coin_spend import make_spend
|
|
24
25
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
25
26
|
from chia.util.hash import std_hash
|
|
26
27
|
from chia.wallet.lineage_proof import LineageProof
|
chia/wallet/puzzles/tails.py
CHANGED
|
@@ -94,9 +94,7 @@ class GenesisById(LimitationsProgram):
|
|
|
94
94
|
origin = coins.copy().pop()
|
|
95
95
|
origin_id = origin.name()
|
|
96
96
|
|
|
97
|
-
cat_inner: Program = await
|
|
98
|
-
new=not action_scope.config.tx_config.reuse_puzhash
|
|
99
|
-
)
|
|
97
|
+
cat_inner: Program = await action_scope.get_puzzle(wallet.wallet_state_manager)
|
|
100
98
|
tail: Program = cls.construct([Program.to(origin_id)])
|
|
101
99
|
|
|
102
100
|
wallet.lineage_store = await CATLineageStore.create(
|