chia-blockchain 2.4.4__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/__init__.py +10 -0
- chia/__main__.py +5 -0
- chia/_tests/README.md +53 -0
- chia/_tests/__init__.py +0 -0
- chia/_tests/blockchain/__init__.py +0 -0
- chia/_tests/blockchain/blockchain_test_utils.py +197 -0
- chia/_tests/blockchain/config.py +4 -0
- chia/_tests/blockchain/test_augmented_chain.py +147 -0
- chia/_tests/blockchain/test_blockchain.py +4100 -0
- chia/_tests/blockchain/test_blockchain_transactions.py +1050 -0
- chia/_tests/blockchain/test_build_chains.py +61 -0
- chia/_tests/blockchain/test_get_block_generator.py +72 -0
- chia/_tests/blockchain/test_lookup_fork_chain.py +195 -0
- chia/_tests/build-init-files.py +93 -0
- chia/_tests/build-job-matrix.py +204 -0
- chia/_tests/check_pytest_monitor_output.py +34 -0
- chia/_tests/check_sql_statements.py +73 -0
- chia/_tests/chia-start-sim +42 -0
- chia/_tests/clvm/__init__.py +0 -0
- chia/_tests/clvm/benchmark_costs.py +23 -0
- chia/_tests/clvm/coin_store.py +147 -0
- chia/_tests/clvm/test_chialisp_deserialization.py +101 -0
- chia/_tests/clvm/test_clvm_step.py +37 -0
- chia/_tests/clvm/test_condition_codes.py +13 -0
- chia/_tests/clvm/test_curry_and_treehash.py +57 -0
- chia/_tests/clvm/test_program.py +150 -0
- chia/_tests/clvm/test_puzzle_compression.py +144 -0
- chia/_tests/clvm/test_puzzle_drivers.py +45 -0
- chia/_tests/clvm/test_puzzles.py +247 -0
- chia/_tests/clvm/test_singletons.py +540 -0
- chia/_tests/clvm/test_spend_sim.py +181 -0
- chia/_tests/cmds/__init__.py +0 -0
- chia/_tests/cmds/cmd_test_utils.py +472 -0
- chia/_tests/cmds/config.py +3 -0
- chia/_tests/cmds/conftest.py +23 -0
- chia/_tests/cmds/test_click_types.py +195 -0
- chia/_tests/cmds/test_cmd_framework.py +400 -0
- chia/_tests/cmds/test_cmds_util.py +97 -0
- chia/_tests/cmds/test_daemon.py +92 -0
- chia/_tests/cmds/test_farm_cmd.py +67 -0
- chia/_tests/cmds/test_show.py +116 -0
- chia/_tests/cmds/test_sim.py +207 -0
- chia/_tests/cmds/test_timelock_args.py +75 -0
- chia/_tests/cmds/test_tx_config_args.py +153 -0
- chia/_tests/cmds/testing_classes.py +59 -0
- chia/_tests/cmds/wallet/__init__.py +0 -0
- chia/_tests/cmds/wallet/test_coins.py +195 -0
- chia/_tests/cmds/wallet/test_consts.py +47 -0
- chia/_tests/cmds/wallet/test_dao.py +565 -0
- chia/_tests/cmds/wallet/test_did.py +403 -0
- chia/_tests/cmds/wallet/test_nft.py +470 -0
- chia/_tests/cmds/wallet/test_notifications.py +124 -0
- chia/_tests/cmds/wallet/test_offer.toffer +1 -0
- chia/_tests/cmds/wallet/test_tx_decorators.py +27 -0
- chia/_tests/cmds/wallet/test_vcs.py +376 -0
- chia/_tests/cmds/wallet/test_wallet.py +1126 -0
- chia/_tests/cmds/wallet/test_wallet_check.py +111 -0
- chia/_tests/conftest.py +1304 -0
- chia/_tests/connection_utils.py +124 -0
- chia/_tests/core/__init__.py +0 -0
- chia/_tests/core/cmds/__init__.py +0 -0
- chia/_tests/core/cmds/test_beta.py +382 -0
- chia/_tests/core/cmds/test_keys.py +1734 -0
- chia/_tests/core/cmds/test_wallet.py +126 -0
- chia/_tests/core/config.py +3 -0
- chia/_tests/core/consensus/__init__.py +0 -0
- chia/_tests/core/consensus/test_block_creation.py +56 -0
- chia/_tests/core/consensus/test_pot_iterations.py +117 -0
- chia/_tests/core/custom_types/__init__.py +0 -0
- chia/_tests/core/custom_types/test_coin.py +109 -0
- chia/_tests/core/custom_types/test_proof_of_space.py +144 -0
- chia/_tests/core/custom_types/test_spend_bundle.py +71 -0
- chia/_tests/core/daemon/__init__.py +0 -0
- chia/_tests/core/daemon/config.py +4 -0
- chia/_tests/core/daemon/test_daemon.py +2128 -0
- chia/_tests/core/daemon/test_daemon_register.py +109 -0
- chia/_tests/core/daemon/test_keychain_proxy.py +100 -0
- chia/_tests/core/data_layer/__init__.py +0 -0
- chia/_tests/core/data_layer/config.py +5 -0
- chia/_tests/core/data_layer/conftest.py +105 -0
- chia/_tests/core/data_layer/test_data_cli.py +57 -0
- chia/_tests/core/data_layer/test_data_layer.py +83 -0
- chia/_tests/core/data_layer/test_data_layer_util.py +219 -0
- chia/_tests/core/data_layer/test_data_rpc.py +3865 -0
- chia/_tests/core/data_layer/test_data_store.py +2423 -0
- chia/_tests/core/data_layer/test_data_store_schema.py +381 -0
- chia/_tests/core/data_layer/test_plugin.py +91 -0
- chia/_tests/core/data_layer/util.py +232 -0
- chia/_tests/core/farmer/__init__.py +0 -0
- chia/_tests/core/farmer/config.py +3 -0
- chia/_tests/core/farmer/test_farmer_api.py +101 -0
- chia/_tests/core/full_node/__init__.py +0 -0
- chia/_tests/core/full_node/config.py +4 -0
- chia/_tests/core/full_node/dos/__init__.py +0 -0
- chia/_tests/core/full_node/dos/config.py +3 -0
- chia/_tests/core/full_node/full_sync/__init__.py +0 -0
- chia/_tests/core/full_node/full_sync/config.py +4 -0
- chia/_tests/core/full_node/full_sync/test_full_sync.py +448 -0
- chia/_tests/core/full_node/ram_db.py +27 -0
- chia/_tests/core/full_node/stores/__init__.py +0 -0
- chia/_tests/core/full_node/stores/config.py +4 -0
- chia/_tests/core/full_node/stores/test_block_store.py +488 -0
- chia/_tests/core/full_node/stores/test_coin_store.py +888 -0
- chia/_tests/core/full_node/stores/test_full_node_store.py +1215 -0
- chia/_tests/core/full_node/stores/test_hint_store.py +230 -0
- chia/_tests/core/full_node/stores/test_sync_store.py +135 -0
- chia/_tests/core/full_node/test_address_manager.py +588 -0
- chia/_tests/core/full_node/test_block_height_map.py +556 -0
- chia/_tests/core/full_node/test_conditions.py +558 -0
- chia/_tests/core/full_node/test_full_node.py +2445 -0
- chia/_tests/core/full_node/test_generator_tools.py +82 -0
- chia/_tests/core/full_node/test_hint_management.py +104 -0
- chia/_tests/core/full_node/test_node_load.py +34 -0
- chia/_tests/core/full_node/test_performance.py +182 -0
- chia/_tests/core/full_node/test_subscriptions.py +492 -0
- chia/_tests/core/full_node/test_transactions.py +203 -0
- chia/_tests/core/full_node/test_tx_processing_queue.py +154 -0
- chia/_tests/core/large_block.py +2388 -0
- chia/_tests/core/make_block_generator.py +72 -0
- chia/_tests/core/mempool/__init__.py +0 -0
- chia/_tests/core/mempool/config.py +4 -0
- chia/_tests/core/mempool/test_mempool.py +3180 -0
- chia/_tests/core/mempool/test_mempool_fee_estimator.py +104 -0
- chia/_tests/core/mempool/test_mempool_fee_protocol.py +55 -0
- chia/_tests/core/mempool/test_mempool_item_queries.py +192 -0
- chia/_tests/core/mempool/test_mempool_manager.py +2054 -0
- chia/_tests/core/mempool/test_mempool_performance.py +65 -0
- chia/_tests/core/mempool/test_singleton_fast_forward.py +567 -0
- chia/_tests/core/node_height.py +28 -0
- chia/_tests/core/server/__init__.py +0 -0
- chia/_tests/core/server/config.py +3 -0
- chia/_tests/core/server/flood.py +82 -0
- chia/_tests/core/server/serve.py +132 -0
- chia/_tests/core/server/test_capabilities.py +68 -0
- chia/_tests/core/server/test_dos.py +320 -0
- chia/_tests/core/server/test_event_loop.py +109 -0
- chia/_tests/core/server/test_loop.py +290 -0
- chia/_tests/core/server/test_node_discovery.py +74 -0
- chia/_tests/core/server/test_rate_limits.py +370 -0
- chia/_tests/core/server/test_server.py +225 -0
- chia/_tests/core/server/test_upnp.py +8 -0
- chia/_tests/core/services/__init__.py +0 -0
- chia/_tests/core/services/config.py +3 -0
- chia/_tests/core/services/test_services.py +166 -0
- chia/_tests/core/ssl/__init__.py +0 -0
- chia/_tests/core/ssl/config.py +3 -0
- chia/_tests/core/ssl/test_ssl.py +198 -0
- chia/_tests/core/test_coins.py +33 -0
- chia/_tests/core/test_cost_calculation.py +314 -0
- chia/_tests/core/test_crawler.py +175 -0
- chia/_tests/core/test_crawler_rpc.py +53 -0
- chia/_tests/core/test_daemon_rpc.py +24 -0
- chia/_tests/core/test_db_conversion.py +129 -0
- chia/_tests/core/test_db_validation.py +161 -0
- chia/_tests/core/test_farmer_harvester_rpc.py +504 -0
- chia/_tests/core/test_filter.py +37 -0
- chia/_tests/core/test_full_node_rpc.py +794 -0
- chia/_tests/core/test_merkle_set.py +343 -0
- chia/_tests/core/test_program.py +49 -0
- chia/_tests/core/test_rpc_util.py +87 -0
- chia/_tests/core/test_seeder.py +308 -0
- chia/_tests/core/test_setproctitle.py +13 -0
- chia/_tests/core/util/__init__.py +0 -0
- chia/_tests/core/util/config.py +4 -0
- chia/_tests/core/util/test_block_cache.py +44 -0
- chia/_tests/core/util/test_cached_bls.py +57 -0
- chia/_tests/core/util/test_config.py +337 -0
- chia/_tests/core/util/test_file_keyring_synchronization.py +105 -0
- chia/_tests/core/util/test_files.py +391 -0
- chia/_tests/core/util/test_jsonify.py +146 -0
- chia/_tests/core/util/test_keychain.py +514 -0
- chia/_tests/core/util/test_keyring_wrapper.py +490 -0
- chia/_tests/core/util/test_lockfile.py +380 -0
- chia/_tests/core/util/test_log_exceptions.py +187 -0
- chia/_tests/core/util/test_lru_cache.py +56 -0
- chia/_tests/core/util/test_significant_bits.py +40 -0
- chia/_tests/core/util/test_streamable.py +883 -0
- chia/_tests/db/__init__.py +0 -0
- chia/_tests/db/test_db_wrapper.py +565 -0
- chia/_tests/environments/__init__.py +0 -0
- chia/_tests/environments/common.py +35 -0
- chia/_tests/environments/full_node.py +47 -0
- chia/_tests/environments/wallet.py +368 -0
- chia/_tests/ether.py +19 -0
- chia/_tests/farmer_harvester/__init__.py +0 -0
- chia/_tests/farmer_harvester/config.py +3 -0
- chia/_tests/farmer_harvester/test_farmer.py +1264 -0
- chia/_tests/farmer_harvester/test_farmer_harvester.py +292 -0
- chia/_tests/farmer_harvester/test_filter_prefix_bits.py +130 -0
- chia/_tests/farmer_harvester/test_third_party_harvesters.py +501 -0
- chia/_tests/farmer_harvester/test_third_party_harvesters_data.json +29 -0
- chia/_tests/fee_estimation/__init__.py +0 -0
- chia/_tests/fee_estimation/config.py +3 -0
- chia/_tests/fee_estimation/test_fee_estimation_integration.py +262 -0
- chia/_tests/fee_estimation/test_fee_estimation_rpc.py +287 -0
- chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +145 -0
- chia/_tests/fee_estimation/test_mempoolitem_height_added.py +146 -0
- chia/_tests/generator/__init__.py +0 -0
- chia/_tests/generator/puzzles/__init__.py +0 -0
- chia/_tests/generator/puzzles/test_generator_deserialize.clsp +3 -0
- chia/_tests/generator/puzzles/test_generator_deserialize.clsp.hex +1 -0
- chia/_tests/generator/puzzles/test_multiple_generator_input_arguments.clsp +19 -0
- chia/_tests/generator/puzzles/test_multiple_generator_input_arguments.clsp.hex +1 -0
- chia/_tests/generator/test_compression.py +218 -0
- chia/_tests/generator/test_generator_types.py +44 -0
- chia/_tests/generator/test_rom.py +182 -0
- chia/_tests/plot_sync/__init__.py +0 -0
- chia/_tests/plot_sync/config.py +3 -0
- chia/_tests/plot_sync/test_delta.py +102 -0
- chia/_tests/plot_sync/test_plot_sync.py +617 -0
- chia/_tests/plot_sync/test_receiver.py +451 -0
- chia/_tests/plot_sync/test_sender.py +116 -0
- chia/_tests/plot_sync/test_sync_simulated.py +450 -0
- chia/_tests/plot_sync/util.py +67 -0
- chia/_tests/plotting/__init__.py +0 -0
- chia/_tests/plotting/config.py +3 -0
- chia/_tests/plotting/test_plot_manager.py +738 -0
- chia/_tests/plotting/util.py +13 -0
- chia/_tests/pools/__init__.py +0 -0
- chia/_tests/pools/config.py +5 -0
- chia/_tests/pools/test_pool_cmdline.py +23 -0
- chia/_tests/pools/test_pool_config.py +44 -0
- chia/_tests/pools/test_pool_puzzles_lifecycle.py +398 -0
- chia/_tests/pools/test_pool_rpc.py +1010 -0
- chia/_tests/pools/test_pool_wallet.py +201 -0
- chia/_tests/pools/test_wallet_pool_store.py +161 -0
- chia/_tests/process_junit.py +349 -0
- chia/_tests/rpc/__init__.py +0 -0
- chia/_tests/rpc/test_rpc_client.py +81 -0
- chia/_tests/simulation/__init__.py +0 -0
- chia/_tests/simulation/config.py +6 -0
- chia/_tests/simulation/test_simulation.py +501 -0
- chia/_tests/simulation/test_simulator.py +234 -0
- chia/_tests/simulation/test_start_simulator.py +106 -0
- chia/_tests/testconfig.py +13 -0
- chia/_tests/timelord/__init__.py +0 -0
- chia/_tests/timelord/config.py +3 -0
- chia/_tests/timelord/test_new_peak.py +437 -0
- chia/_tests/timelord/test_timelord.py +11 -0
- chia/_tests/tools/1315537.json +170 -0
- chia/_tests/tools/1315544.json +160 -0
- chia/_tests/tools/1315630.json +150 -0
- chia/_tests/tools/300000.json +105 -0
- chia/_tests/tools/442734.json +140 -0
- chia/_tests/tools/466212.json +130 -0
- chia/_tests/tools/__init__.py +0 -0
- chia/_tests/tools/config.py +5 -0
- chia/_tests/tools/test-blockchain-db.sqlite +0 -0
- chia/_tests/tools/test_full_sync.py +30 -0
- chia/_tests/tools/test_legacy_keyring.py +82 -0
- chia/_tests/tools/test_run_block.py +129 -0
- chia/_tests/util/__init__.py +0 -0
- chia/_tests/util/benchmark_cost.py +170 -0
- chia/_tests/util/benchmarks.py +154 -0
- chia/_tests/util/bip39_test_vectors.json +148 -0
- chia/_tests/util/blockchain.py +133 -0
- chia/_tests/util/blockchain_mock.py +132 -0
- chia/_tests/util/build_network_protocol_files.py +302 -0
- chia/_tests/util/clvm_generator.bin +0 -0
- chia/_tests/util/config.py +3 -0
- chia/_tests/util/constants.py +20 -0
- chia/_tests/util/db_connection.py +36 -0
- chia/_tests/util/full_sync.py +245 -0
- chia/_tests/util/gen_ssl_certs.py +115 -0
- chia/_tests/util/generator_tools_testing.py +47 -0
- chia/_tests/util/key_tool.py +37 -0
- chia/_tests/util/misc.py +722 -0
- chia/_tests/util/network_protocol_data.py +1074 -0
- chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
- chia/_tests/util/protocol_messages_json.py +2700 -0
- chia/_tests/util/rpc.py +23 -0
- chia/_tests/util/run_block.py +163 -0
- chia/_tests/util/setup_nodes.py +479 -0
- chia/_tests/util/split_managers.py +99 -0
- chia/_tests/util/temp_file.py +14 -0
- chia/_tests/util/test_action_scope.py +143 -0
- chia/_tests/util/test_async_pool.py +366 -0
- chia/_tests/util/test_build_job_matrix.py +43 -0
- chia/_tests/util/test_build_network_protocol_files.py +7 -0
- chia/_tests/util/test_chia_version.py +50 -0
- chia/_tests/util/test_collection.py +11 -0
- chia/_tests/util/test_condition_tools.py +231 -0
- chia/_tests/util/test_config.py +426 -0
- chia/_tests/util/test_dump_keyring.py +60 -0
- chia/_tests/util/test_errors.py +10 -0
- chia/_tests/util/test_full_block_utils.py +271 -0
- chia/_tests/util/test_installed.py +20 -0
- chia/_tests/util/test_limited_semaphore.py +52 -0
- chia/_tests/util/test_logging_filter.py +43 -0
- chia/_tests/util/test_misc.py +444 -0
- chia/_tests/util/test_network.py +74 -0
- chia/_tests/util/test_network_protocol_files.py +579 -0
- chia/_tests/util/test_network_protocol_json.py +266 -0
- chia/_tests/util/test_network_protocol_test.py +257 -0
- chia/_tests/util/test_paginator.py +72 -0
- chia/_tests/util/test_pprint.py +17 -0
- chia/_tests/util/test_priority_mutex.py +487 -0
- chia/_tests/util/test_recursive_replace.py +116 -0
- chia/_tests/util/test_replace_str_to_bytes.py +137 -0
- chia/_tests/util/test_service_groups.py +15 -0
- chia/_tests/util/test_ssl_check.py +31 -0
- chia/_tests/util/test_testnet_overrides.py +19 -0
- chia/_tests/util/test_tests_misc.py +38 -0
- chia/_tests/util/test_timing.py +37 -0
- chia/_tests/util/test_trusted_peer.py +51 -0
- chia/_tests/util/time_out_assert.py +154 -0
- chia/_tests/wallet/__init__.py +0 -0
- chia/_tests/wallet/cat_wallet/__init__.py +0 -0
- chia/_tests/wallet/cat_wallet/config.py +4 -0
- chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +468 -0
- chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +69 -0
- chia/_tests/wallet/cat_wallet/test_cat_wallet.py +1738 -0
- chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +291 -0
- chia/_tests/wallet/cat_wallet/test_trades.py +2578 -0
- chia/_tests/wallet/clawback/__init__.py +0 -0
- chia/_tests/wallet/clawback/config.py +3 -0
- chia/_tests/wallet/clawback/test_clawback_decorator.py +80 -0
- chia/_tests/wallet/clawback/test_clawback_lifecycle.py +292 -0
- chia/_tests/wallet/clawback/test_clawback_metadata.py +51 -0
- chia/_tests/wallet/config.py +4 -0
- chia/_tests/wallet/conftest.py +217 -0
- chia/_tests/wallet/dao_wallet/__init__.py +0 -0
- chia/_tests/wallet/dao_wallet/config.py +3 -0
- chia/_tests/wallet/dao_wallet/test_dao_clvm.py +1322 -0
- chia/_tests/wallet/dao_wallet/test_dao_wallets.py +3488 -0
- chia/_tests/wallet/db_wallet/__init__.py +0 -0
- chia/_tests/wallet/db_wallet/config.py +3 -0
- chia/_tests/wallet/db_wallet/test_db_graftroot.py +143 -0
- chia/_tests/wallet/db_wallet/test_dl_offers.py +491 -0
- chia/_tests/wallet/db_wallet/test_dl_wallet.py +823 -0
- chia/_tests/wallet/did_wallet/__init__.py +0 -0
- chia/_tests/wallet/did_wallet/config.py +4 -0
- chia/_tests/wallet/did_wallet/test_did.py +1481 -0
- chia/_tests/wallet/nft_wallet/__init__.py +0 -0
- chia/_tests/wallet/nft_wallet/config.py +4 -0
- chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +1492 -0
- chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +1014 -0
- chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +376 -0
- chia/_tests/wallet/nft_wallet/test_nft_offers.py +1209 -0
- chia/_tests/wallet/nft_wallet/test_nft_puzzles.py +172 -0
- chia/_tests/wallet/nft_wallet/test_nft_wallet.py +2558 -0
- chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py +70 -0
- chia/_tests/wallet/rpc/__init__.py +0 -0
- chia/_tests/wallet/rpc/config.py +4 -0
- chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +287 -0
- chia/_tests/wallet/rpc/test_wallet_rpc.py +3106 -0
- chia/_tests/wallet/simple_sync/__init__.py +0 -0
- chia/_tests/wallet/simple_sync/config.py +3 -0
- chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +719 -0
- chia/_tests/wallet/sync/__init__.py +0 -0
- chia/_tests/wallet/sync/config.py +4 -0
- chia/_tests/wallet/sync/test_wallet_sync.py +1529 -0
- chia/_tests/wallet/test_address_type.py +189 -0
- chia/_tests/wallet/test_bech32m.py +45 -0
- chia/_tests/wallet/test_clvm_streamable.py +244 -0
- chia/_tests/wallet/test_coin_selection.py +589 -0
- chia/_tests/wallet/test_conditions.py +388 -0
- chia/_tests/wallet/test_debug_spend_bundle.py +76 -0
- chia/_tests/wallet/test_new_wallet_protocol.py +1176 -0
- chia/_tests/wallet/test_nft_store.py +193 -0
- chia/_tests/wallet/test_notifications.py +196 -0
- chia/_tests/wallet/test_offer_parsing_performance.py +48 -0
- chia/_tests/wallet/test_puzzle_store.py +133 -0
- chia/_tests/wallet/test_sign_coin_spends.py +159 -0
- chia/_tests/wallet/test_signer_protocol.py +948 -0
- chia/_tests/wallet/test_singleton.py +122 -0
- chia/_tests/wallet/test_singleton_lifecycle_fast.py +772 -0
- chia/_tests/wallet/test_singleton_store.py +152 -0
- chia/_tests/wallet/test_taproot.py +19 -0
- chia/_tests/wallet/test_transaction_store.py +941 -0
- chia/_tests/wallet/test_util.py +181 -0
- chia/_tests/wallet/test_wallet.py +2139 -0
- chia/_tests/wallet/test_wallet_action_scope.py +85 -0
- chia/_tests/wallet/test_wallet_blockchain.py +113 -0
- chia/_tests/wallet/test_wallet_coin_store.py +1002 -0
- chia/_tests/wallet/test_wallet_interested_store.py +43 -0
- chia/_tests/wallet/test_wallet_key_val_store.py +40 -0
- chia/_tests/wallet/test_wallet_node.py +783 -0
- chia/_tests/wallet/test_wallet_retry.py +95 -0
- chia/_tests/wallet/test_wallet_state_manager.py +252 -0
- chia/_tests/wallet/test_wallet_test_framework.py +275 -0
- chia/_tests/wallet/test_wallet_trade_store.py +218 -0
- chia/_tests/wallet/test_wallet_user_store.py +34 -0
- chia/_tests/wallet/test_wallet_utils.py +155 -0
- chia/_tests/wallet/vc_wallet/__init__.py +0 -0
- chia/_tests/wallet/vc_wallet/config.py +3 -0
- chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py +70 -0
- chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +883 -0
- chia/_tests/wallet/vc_wallet/test_vc_wallet.py +801 -0
- chia/_tests/wallet/wallet_block_tools.py +327 -0
- chia/_tests/weight_proof/__init__.py +0 -0
- chia/_tests/weight_proof/config.py +3 -0
- chia/_tests/weight_proof/test_weight_proof.py +528 -0
- chia/clvm/__init__.py +0 -0
- chia/clvm/spend_sim.py +488 -0
- chia/cmds/__init__.py +0 -0
- chia/cmds/beta.py +183 -0
- chia/cmds/beta_funcs.py +133 -0
- chia/cmds/check_wallet_db.py +418 -0
- chia/cmds/chia.py +143 -0
- chia/cmds/cmd_classes.py +315 -0
- chia/cmds/cmds_util.py +498 -0
- chia/cmds/coin_funcs.py +260 -0
- chia/cmds/coins.py +220 -0
- chia/cmds/completion.py +49 -0
- chia/cmds/configure.py +331 -0
- chia/cmds/dao.py +1008 -0
- chia/cmds/dao_funcs.py +576 -0
- chia/cmds/data.py +707 -0
- chia/cmds/data_funcs.py +380 -0
- chia/cmds/db.py +86 -0
- chia/cmds/db_backup_func.py +77 -0
- chia/cmds/db_upgrade_func.py +452 -0
- chia/cmds/db_validate_func.py +184 -0
- chia/cmds/dev.py +16 -0
- chia/cmds/farm.py +87 -0
- chia/cmds/farm_funcs.py +207 -0
- chia/cmds/init.py +70 -0
- chia/cmds/init_funcs.py +367 -0
- chia/cmds/installers.py +129 -0
- chia/cmds/keys.py +510 -0
- chia/cmds/keys_funcs.py +864 -0
- chia/cmds/netspace.py +47 -0
- chia/cmds/netspace_funcs.py +53 -0
- chia/cmds/options.py +32 -0
- chia/cmds/param_types.py +228 -0
- chia/cmds/passphrase.py +130 -0
- chia/cmds/passphrase_funcs.py +346 -0
- chia/cmds/peer.py +50 -0
- chia/cmds/peer_funcs.py +129 -0
- chia/cmds/plotnft.py +206 -0
- chia/cmds/plotnft_funcs.py +374 -0
- chia/cmds/plots.py +222 -0
- chia/cmds/plotters.py +17 -0
- chia/cmds/rpc.py +188 -0
- chia/cmds/show.py +71 -0
- chia/cmds/show_funcs.py +214 -0
- chia/cmds/signer.py +304 -0
- chia/cmds/sim.py +217 -0
- chia/cmds/sim_funcs.py +509 -0
- chia/cmds/start.py +24 -0
- chia/cmds/start_funcs.py +112 -0
- chia/cmds/stop.py +61 -0
- chia/cmds/units.py +11 -0
- chia/cmds/wallet.py +1745 -0
- chia/cmds/wallet_funcs.py +1800 -0
- chia/consensus/__init__.py +0 -0
- chia/consensus/block_body_validation.py +515 -0
- chia/consensus/block_creation.py +525 -0
- chia/consensus/block_header_validation.py +1064 -0
- chia/consensus/block_record.py +32 -0
- chia/consensus/block_rewards.py +53 -0
- chia/consensus/block_root_validation.py +46 -0
- chia/consensus/blockchain.py +1100 -0
- chia/consensus/blockchain_interface.py +56 -0
- chia/consensus/coinbase.py +30 -0
- chia/consensus/condition_costs.py +9 -0
- chia/consensus/constants.py +49 -0
- chia/consensus/cost_calculator.py +15 -0
- chia/consensus/default_constants.py +90 -0
- chia/consensus/deficit.py +55 -0
- chia/consensus/difficulty_adjustment.py +412 -0
- chia/consensus/find_fork_point.py +111 -0
- chia/consensus/full_block_to_block_record.py +167 -0
- chia/consensus/get_block_challenge.py +106 -0
- chia/consensus/get_block_generator.py +26 -0
- chia/consensus/make_sub_epoch_summary.py +210 -0
- chia/consensus/multiprocess_validation.py +365 -0
- chia/consensus/pos_quality.py +19 -0
- chia/consensus/pot_iterations.py +67 -0
- chia/consensus/puzzles/__init__.py +0 -0
- chia/consensus/puzzles/chialisp_deserialisation.clsp +69 -0
- chia/consensus/puzzles/chialisp_deserialisation.clsp.hex +1 -0
- chia/consensus/puzzles/rom_bootstrap_generator.clsp +37 -0
- chia/consensus/puzzles/rom_bootstrap_generator.clsp.hex +1 -0
- chia/consensus/vdf_info_computation.py +156 -0
- chia/daemon/__init__.py +0 -0
- chia/daemon/client.py +233 -0
- chia/daemon/keychain_proxy.py +501 -0
- chia/daemon/keychain_server.py +365 -0
- chia/daemon/server.py +1616 -0
- chia/daemon/windows_signal.py +56 -0
- chia/data_layer/__init__.py +0 -0
- chia/data_layer/data_layer.py +1303 -0
- chia/data_layer/data_layer_api.py +25 -0
- chia/data_layer/data_layer_errors.py +50 -0
- chia/data_layer/data_layer_server.py +170 -0
- chia/data_layer/data_layer_util.py +985 -0
- chia/data_layer/data_layer_wallet.py +1315 -0
- chia/data_layer/data_store.py +2267 -0
- chia/data_layer/dl_wallet_store.py +407 -0
- chia/data_layer/download_data.py +389 -0
- chia/data_layer/puzzles/__init__.py +0 -0
- chia/data_layer/puzzles/graftroot_dl_offers.clsp +100 -0
- chia/data_layer/puzzles/graftroot_dl_offers.clsp.hex +1 -0
- chia/data_layer/s3_plugin_config.yml +33 -0
- chia/data_layer/s3_plugin_service.py +468 -0
- chia/data_layer/util/__init__.py +0 -0
- chia/data_layer/util/benchmark.py +108 -0
- chia/data_layer/util/plugin.py +41 -0
- chia/farmer/__init__.py +0 -0
- chia/farmer/farmer.py +920 -0
- chia/farmer/farmer_api.py +814 -0
- chia/full_node/__init__.py +0 -0
- chia/full_node/bitcoin_fee_estimator.py +85 -0
- chia/full_node/block_height_map.py +271 -0
- chia/full_node/block_store.py +570 -0
- chia/full_node/bundle_tools.py +19 -0
- chia/full_node/coin_store.py +646 -0
- chia/full_node/fee_estimate.py +54 -0
- chia/full_node/fee_estimate_store.py +24 -0
- chia/full_node/fee_estimation.py +93 -0
- chia/full_node/fee_estimator.py +90 -0
- chia/full_node/fee_estimator_constants.py +38 -0
- chia/full_node/fee_estimator_interface.py +42 -0
- chia/full_node/fee_history.py +26 -0
- chia/full_node/fee_tracker.py +564 -0
- chia/full_node/full_node.py +3052 -0
- chia/full_node/full_node_api.py +1974 -0
- chia/full_node/full_node_store.py +1033 -0
- chia/full_node/hint_management.py +56 -0
- chia/full_node/hint_store.py +94 -0
- chia/full_node/mempool.py +583 -0
- chia/full_node/mempool_check_conditions.py +177 -0
- chia/full_node/mempool_manager.py +858 -0
- chia/full_node/pending_tx_cache.py +112 -0
- chia/full_node/puzzles/__init__.py +0 -0
- chia/full_node/puzzles/block_program_zero.clsp +14 -0
- chia/full_node/puzzles/block_program_zero.clsp.hex +1 -0
- chia/full_node/puzzles/decompress_coin_spend_entry.clsp +5 -0
- chia/full_node/puzzles/decompress_coin_spend_entry.clsp.hex +1 -0
- chia/full_node/puzzles/decompress_coin_spend_entry_with_prefix.clsp +7 -0
- chia/full_node/puzzles/decompress_coin_spend_entry_with_prefix.clsp.hex +1 -0
- chia/full_node/puzzles/decompress_puzzle.clsp +6 -0
- chia/full_node/puzzles/decompress_puzzle.clsp.hex +1 -0
- chia/full_node/signage_point.py +16 -0
- chia/full_node/subscriptions.py +248 -0
- chia/full_node/sync_store.py +145 -0
- chia/full_node/tx_processing_queue.py +78 -0
- chia/full_node/weight_proof.py +1719 -0
- chia/harvester/__init__.py +0 -0
- chia/harvester/harvester.py +271 -0
- chia/harvester/harvester_api.py +374 -0
- chia/introducer/__init__.py +0 -0
- chia/introducer/introducer.py +120 -0
- chia/introducer/introducer_api.py +64 -0
- chia/legacy/__init__.py +0 -0
- chia/legacy/keyring.py +154 -0
- chia/plot_sync/__init__.py +0 -0
- chia/plot_sync/delta.py +61 -0
- chia/plot_sync/exceptions.py +56 -0
- chia/plot_sync/receiver.py +385 -0
- chia/plot_sync/sender.py +337 -0
- chia/plot_sync/util.py +43 -0
- chia/plotters/__init__.py +0 -0
- chia/plotters/bladebit.py +388 -0
- chia/plotters/chiapos.py +63 -0
- chia/plotters/madmax.py +224 -0
- chia/plotters/plotters.py +577 -0
- chia/plotters/plotters_util.py +131 -0
- chia/plotting/__init__.py +0 -0
- chia/plotting/cache.py +212 -0
- chia/plotting/check_plots.py +283 -0
- chia/plotting/create_plots.py +278 -0
- chia/plotting/manager.py +436 -0
- chia/plotting/util.py +324 -0
- chia/pools/__init__.py +0 -0
- chia/pools/pool_config.py +110 -0
- chia/pools/pool_puzzles.py +459 -0
- chia/pools/pool_wallet.py +926 -0
- chia/pools/pool_wallet_info.py +118 -0
- chia/pools/puzzles/__init__.py +0 -0
- chia/pools/puzzles/pool_member_innerpuz.clsp +70 -0
- chia/pools/puzzles/pool_member_innerpuz.clsp.hex +1 -0
- chia/pools/puzzles/pool_waitingroom_innerpuz.clsp +69 -0
- chia/pools/puzzles/pool_waitingroom_innerpuz.clsp.hex +1 -0
- chia/protocols/__init__.py +0 -0
- chia/protocols/farmer_protocol.py +102 -0
- chia/protocols/full_node_protocol.py +219 -0
- chia/protocols/harvester_protocol.py +216 -0
- chia/protocols/introducer_protocol.py +26 -0
- chia/protocols/pool_protocol.py +177 -0
- chia/protocols/protocol_message_types.py +139 -0
- chia/protocols/protocol_state_machine.py +87 -0
- chia/protocols/protocol_timing.py +7 -0
- chia/protocols/shared_protocol.py +86 -0
- chia/protocols/timelord_protocol.py +93 -0
- chia/protocols/wallet_protocol.py +401 -0
- chia/py.typed +0 -0
- chia/rpc/__init__.py +0 -0
- chia/rpc/crawler_rpc_api.py +75 -0
- chia/rpc/data_layer_rpc_api.py +639 -0
- chia/rpc/data_layer_rpc_client.py +188 -0
- chia/rpc/data_layer_rpc_util.py +62 -0
- chia/rpc/farmer_rpc_api.py +360 -0
- chia/rpc/farmer_rpc_client.py +86 -0
- chia/rpc/full_node_rpc_api.py +954 -0
- chia/rpc/full_node_rpc_client.py +292 -0
- chia/rpc/harvester_rpc_api.py +136 -0
- chia/rpc/harvester_rpc_client.py +54 -0
- chia/rpc/rpc_client.py +144 -0
- chia/rpc/rpc_server.py +447 -0
- chia/rpc/timelord_rpc_api.py +27 -0
- chia/rpc/util.py +293 -0
- chia/rpc/wallet_request_types.py +688 -0
- chia/rpc/wallet_rpc_api.py +4779 -0
- chia/rpc/wallet_rpc_client.py +1844 -0
- chia/seeder/__init__.py +0 -0
- chia/seeder/crawl_store.py +427 -0
- chia/seeder/crawler.py +423 -0
- chia/seeder/crawler_api.py +129 -0
- chia/seeder/dns_server.py +544 -0
- chia/seeder/peer_record.py +146 -0
- chia/seeder/start_crawler.py +88 -0
- chia/server/__init__.py +0 -0
- chia/server/address_manager.py +658 -0
- chia/server/address_manager_store.py +237 -0
- chia/server/api_protocol.py +11 -0
- chia/server/capabilities.py +24 -0
- chia/server/chia_policy.py +345 -0
- chia/server/introducer_peers.py +76 -0
- chia/server/node_discovery.py +718 -0
- chia/server/outbound_message.py +33 -0
- chia/server/rate_limit_numbers.py +204 -0
- chia/server/rate_limits.py +113 -0
- chia/server/server.py +720 -0
- chia/server/signal_handlers.py +117 -0
- chia/server/ssl_context.py +32 -0
- chia/server/start_data_layer.py +137 -0
- chia/server/start_farmer.py +86 -0
- chia/server/start_full_node.py +106 -0
- chia/server/start_harvester.py +80 -0
- chia/server/start_introducer.py +69 -0
- chia/server/start_service.py +328 -0
- chia/server/start_timelord.py +82 -0
- chia/server/start_wallet.py +109 -0
- chia/server/upnp.py +117 -0
- chia/server/ws_connection.py +752 -0
- chia/simulator/__init__.py +0 -0
- chia/simulator/block_tools.py +2053 -0
- chia/simulator/full_node_simulator.py +802 -0
- chia/simulator/keyring.py +128 -0
- chia/simulator/setup_services.py +505 -0
- chia/simulator/simulator_constants.py +13 -0
- chia/simulator/simulator_full_node_rpc_api.py +101 -0
- chia/simulator/simulator_full_node_rpc_client.py +62 -0
- chia/simulator/simulator_protocol.py +29 -0
- chia/simulator/simulator_test_tools.py +163 -0
- chia/simulator/socket.py +27 -0
- chia/simulator/ssl_certs.py +114 -0
- chia/simulator/ssl_certs_1.py +699 -0
- chia/simulator/ssl_certs_10.py +699 -0
- chia/simulator/ssl_certs_2.py +699 -0
- chia/simulator/ssl_certs_3.py +699 -0
- chia/simulator/ssl_certs_4.py +699 -0
- chia/simulator/ssl_certs_5.py +699 -0
- chia/simulator/ssl_certs_6.py +699 -0
- chia/simulator/ssl_certs_7.py +699 -0
- chia/simulator/ssl_certs_8.py +699 -0
- chia/simulator/ssl_certs_9.py +699 -0
- chia/simulator/start_simulator.py +135 -0
- chia/simulator/wallet_tools.py +245 -0
- chia/ssl/__init__.py +0 -0
- chia/ssl/chia_ca.crt +19 -0
- chia/ssl/chia_ca.key +28 -0
- chia/ssl/create_ssl.py +249 -0
- chia/ssl/dst_root_ca.pem +20 -0
- chia/timelord/__init__.py +0 -0
- chia/timelord/iters_from_block.py +50 -0
- chia/timelord/timelord.py +1202 -0
- chia/timelord/timelord_api.py +132 -0
- chia/timelord/timelord_launcher.py +188 -0
- chia/timelord/timelord_state.py +244 -0
- chia/timelord/types.py +22 -0
- chia/types/__init__.py +0 -0
- chia/types/aliases.py +35 -0
- chia/types/block_protocol.py +20 -0
- chia/types/blockchain_format/__init__.py +0 -0
- chia/types/blockchain_format/classgroup.py +5 -0
- chia/types/blockchain_format/coin.py +28 -0
- chia/types/blockchain_format/foliage.py +8 -0
- chia/types/blockchain_format/pool_target.py +5 -0
- chia/types/blockchain_format/program.py +270 -0
- chia/types/blockchain_format/proof_of_space.py +135 -0
- chia/types/blockchain_format/reward_chain_block.py +6 -0
- chia/types/blockchain_format/serialized_program.py +5 -0
- chia/types/blockchain_format/sized_bytes.py +11 -0
- chia/types/blockchain_format/slots.py +9 -0
- chia/types/blockchain_format/sub_epoch_summary.py +5 -0
- chia/types/blockchain_format/tree_hash.py +72 -0
- chia/types/blockchain_format/vdf.py +86 -0
- chia/types/clvm_cost.py +13 -0
- chia/types/coin_record.py +43 -0
- chia/types/coin_spend.py +115 -0
- chia/types/condition_opcodes.py +73 -0
- chia/types/condition_with_args.py +17 -0
- chia/types/eligible_coin_spends.py +364 -0
- chia/types/end_of_slot_bundle.py +5 -0
- chia/types/fee_rate.py +38 -0
- chia/types/full_block.py +5 -0
- chia/types/generator_types.py +14 -0
- chia/types/header_block.py +5 -0
- chia/types/internal_mempool_item.py +19 -0
- chia/types/mempool_inclusion_status.py +9 -0
- chia/types/mempool_item.py +85 -0
- chia/types/mempool_submission_status.py +30 -0
- chia/types/mojos.py +7 -0
- chia/types/peer_info.py +64 -0
- chia/types/signing_mode.py +29 -0
- chia/types/spend_bundle.py +31 -0
- chia/types/spend_bundle_conditions.py +7 -0
- chia/types/transaction_queue_entry.py +55 -0
- chia/types/unfinished_block.py +5 -0
- chia/types/unfinished_header_block.py +37 -0
- chia/types/weight_proof.py +50 -0
- chia/util/__init__.py +0 -0
- chia/util/action_scope.py +168 -0
- chia/util/api_decorators.py +89 -0
- chia/util/async_pool.py +224 -0
- chia/util/augmented_chain.py +130 -0
- chia/util/batches.py +39 -0
- chia/util/bech32m.py +123 -0
- chia/util/beta_metrics.py +118 -0
- chia/util/block_cache.py +56 -0
- chia/util/byte_types.py +10 -0
- chia/util/check_fork_next_block.py +32 -0
- chia/util/chia_logging.py +124 -0
- chia/util/chia_version.py +33 -0
- chia/util/collection.py +17 -0
- chia/util/condition_tools.py +201 -0
- chia/util/config.py +366 -0
- chia/util/cpu.py +20 -0
- chia/util/db_synchronous.py +21 -0
- chia/util/db_version.py +30 -0
- chia/util/db_wrapper.py +427 -0
- chia/util/default_root.py +10 -0
- chia/util/dump_keyring.py +93 -0
- chia/util/english.txt +2048 -0
- chia/util/errors.py +351 -0
- chia/util/file_keyring.py +480 -0
- chia/util/files.py +95 -0
- chia/util/full_block_utils.py +321 -0
- chia/util/generator_tools.py +62 -0
- chia/util/hash.py +29 -0
- chia/util/initial-config.yaml +675 -0
- chia/util/inline_executor.py +24 -0
- chia/util/ints.py +19 -0
- chia/util/json_util.py +41 -0
- chia/util/keychain.py +673 -0
- chia/util/keyring_wrapper.py +266 -0
- chia/util/limited_semaphore.py +39 -0
- chia/util/lock.py +47 -0
- chia/util/log_exceptions.py +29 -0
- chia/util/logging.py +34 -0
- chia/util/lru_cache.py +29 -0
- chia/util/math.py +20 -0
- chia/util/network.py +240 -0
- chia/util/paginator.py +46 -0
- chia/util/path.py +29 -0
- chia/util/permissions.py +19 -0
- chia/util/pprint.py +40 -0
- chia/util/prev_transaction_block.py +23 -0
- chia/util/priority_mutex.py +92 -0
- chia/util/profiler.py +194 -0
- chia/util/recursive_replace.py +22 -0
- chia/util/safe_cancel_task.py +14 -0
- chia/util/service_groups.py +47 -0
- chia/util/setproctitle.py +20 -0
- chia/util/significant_bits.py +30 -0
- chia/util/ssl_check.py +213 -0
- chia/util/streamable.py +654 -0
- chia/util/task_timing.py +378 -0
- chia/util/timing.py +64 -0
- chia/util/vdf_prover.py +31 -0
- chia/util/ws_message.py +66 -0
- chia/wallet/__init__.py +0 -0
- chia/wallet/cat_wallet/__init__.py +0 -0
- chia/wallet/cat_wallet/cat_constants.py +75 -0
- chia/wallet/cat_wallet/cat_info.py +47 -0
- chia/wallet/cat_wallet/cat_outer_puzzle.py +120 -0
- chia/wallet/cat_wallet/cat_utils.py +163 -0
- chia/wallet/cat_wallet/cat_wallet.py +869 -0
- chia/wallet/cat_wallet/dao_cat_info.py +28 -0
- chia/wallet/cat_wallet/dao_cat_wallet.py +669 -0
- chia/wallet/cat_wallet/lineage_store.py +74 -0
- chia/wallet/cat_wallet/puzzles/__init__.py +0 -0
- chia/wallet/cat_wallet/puzzles/cat_truths.clib +31 -0
- chia/wallet/cat_wallet/puzzles/cat_v2.clsp +397 -0
- chia/wallet/cat_wallet/puzzles/cat_v2.clsp.hex +1 -0
- chia/wallet/cat_wallet/puzzles/delegated_tail.clsp +25 -0
- chia/wallet/cat_wallet/puzzles/delegated_tail.clsp.hex +1 -0
- chia/wallet/cat_wallet/puzzles/everything_with_signature.clsp +15 -0
- chia/wallet/cat_wallet/puzzles/everything_with_signature.clsp.hex +1 -0
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id.clsp +26 -0
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id.clsp.hex +1 -0
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id_or_singleton.clsp +42 -0
- chia/wallet/cat_wallet/puzzles/genesis_by_coin_id_or_singleton.clsp.hex +1 -0
- chia/wallet/cat_wallet/puzzles/genesis_by_puzzle_hash.clsp +24 -0
- chia/wallet/cat_wallet/puzzles/genesis_by_puzzle_hash.clsp.hex +1 -0
- chia/wallet/coin_selection.py +188 -0
- chia/wallet/conditions.py +1326 -0
- chia/wallet/dao_wallet/__init__.py +0 -0
- chia/wallet/dao_wallet/dao_info.py +61 -0
- chia/wallet/dao_wallet/dao_utils.py +810 -0
- chia/wallet/dao_wallet/dao_wallet.py +2121 -0
- chia/wallet/db_wallet/__init__.py +0 -0
- chia/wallet/db_wallet/db_wallet_puzzles.py +107 -0
- chia/wallet/derivation_record.py +30 -0
- chia/wallet/derive_keys.py +146 -0
- chia/wallet/did_wallet/__init__.py +0 -0
- chia/wallet/did_wallet/did_info.py +39 -0
- chia/wallet/did_wallet/did_wallet.py +1485 -0
- chia/wallet/did_wallet/did_wallet_puzzles.py +220 -0
- chia/wallet/did_wallet/puzzles/__init__.py +0 -0
- chia/wallet/did_wallet/puzzles/did_innerpuz.clsp +135 -0
- chia/wallet/did_wallet/puzzles/did_innerpuz.clsp.hex +1 -0
- chia/wallet/driver_protocol.py +26 -0
- chia/wallet/key_val_store.py +55 -0
- chia/wallet/lineage_proof.py +58 -0
- chia/wallet/nft_wallet/__init__.py +0 -0
- chia/wallet/nft_wallet/metadata_outer_puzzle.py +92 -0
- chia/wallet/nft_wallet/nft_info.py +120 -0
- chia/wallet/nft_wallet/nft_puzzles.py +305 -0
- chia/wallet/nft_wallet/nft_wallet.py +1686 -0
- chia/wallet/nft_wallet/ownership_outer_puzzle.py +101 -0
- chia/wallet/nft_wallet/puzzles/__init__.py +0 -0
- chia/wallet/nft_wallet/puzzles/create_nft_launcher_from_did.clsp +6 -0
- chia/wallet/nft_wallet/puzzles/create_nft_launcher_from_did.clsp.hex +1 -0
- chia/wallet/nft_wallet/puzzles/nft_intermediate_launcher.clsp +6 -0
- chia/wallet/nft_wallet/puzzles/nft_intermediate_launcher.clsp.hex +1 -0
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_default.clsp +30 -0
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_default.clsp.hex +1 -0
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_updateable.clsp +28 -0
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_updateable.clsp.hex +1 -0
- chia/wallet/nft_wallet/puzzles/nft_ownership_layer.clsp +100 -0
- chia/wallet/nft_wallet/puzzles/nft_ownership_layer.clsp.hex +1 -0
- chia/wallet/nft_wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp +78 -0
- chia/wallet/nft_wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp.hex +1 -0
- chia/wallet/nft_wallet/puzzles/nft_state_layer.clsp +74 -0
- chia/wallet/nft_wallet/puzzles/nft_state_layer.clsp.hex +1 -0
- chia/wallet/nft_wallet/singleton_outer_puzzle.py +101 -0
- chia/wallet/nft_wallet/transfer_program_puzzle.py +82 -0
- chia/wallet/nft_wallet/uncurry_nft.py +217 -0
- chia/wallet/notification_manager.py +117 -0
- chia/wallet/notification_store.py +178 -0
- chia/wallet/outer_puzzles.py +84 -0
- chia/wallet/payment.py +34 -0
- chia/wallet/puzzle_drivers.py +118 -0
- chia/wallet/puzzles/__init__.py +0 -0
- chia/wallet/puzzles/augmented_condition.clsp +13 -0
- chia/wallet/puzzles/augmented_condition.clsp.hex +1 -0
- chia/wallet/puzzles/clawback/__init__.py +0 -0
- chia/wallet/puzzles/clawback/drivers.py +188 -0
- chia/wallet/puzzles/clawback/metadata.py +38 -0
- chia/wallet/puzzles/clawback/puzzle_decorator.py +67 -0
- chia/wallet/puzzles/condition_codes.clib +77 -0
- chia/wallet/puzzles/curry-and-treehash.clib +102 -0
- chia/wallet/puzzles/curry.clib +135 -0
- chia/wallet/puzzles/curry_by_index.clib +16 -0
- chia/wallet/puzzles/dao_cat_eve.clsp +17 -0
- chia/wallet/puzzles/dao_cat_eve.clsp.hex +1 -0
- chia/wallet/puzzles/dao_cat_launcher.clsp +36 -0
- chia/wallet/puzzles/dao_cat_launcher.clsp.hex +1 -0
- chia/wallet/puzzles/dao_finished_state.clsp +35 -0
- chia/wallet/puzzles/dao_finished_state.clsp.hex +1 -0
- chia/wallet/puzzles/dao_finished_state.clsp.hex.sha256tree +1 -0
- chia/wallet/puzzles/dao_lockup.clsp +288 -0
- chia/wallet/puzzles/dao_lockup.clsp.hex +1 -0
- chia/wallet/puzzles/dao_lockup.clsp.hex.sha256tree +1 -0
- chia/wallet/puzzles/dao_proposal.clsp +377 -0
- chia/wallet/puzzles/dao_proposal.clsp.hex +1 -0
- chia/wallet/puzzles/dao_proposal.clsp.hex.sha256tree +1 -0
- chia/wallet/puzzles/dao_proposal_timer.clsp +78 -0
- chia/wallet/puzzles/dao_proposal_timer.clsp.hex +1 -0
- chia/wallet/puzzles/dao_proposal_timer.clsp.hex.sha256tree +1 -0
- chia/wallet/puzzles/dao_proposal_validator.clsp +87 -0
- chia/wallet/puzzles/dao_proposal_validator.clsp.hex +1 -0
- chia/wallet/puzzles/dao_proposal_validator.clsp.hex.sha256tree +1 -0
- chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp +240 -0
- chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex +1 -0
- chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex.sha256tree +1 -0
- chia/wallet/puzzles/dao_treasury.clsp +115 -0
- chia/wallet/puzzles/dao_treasury.clsp.hex +1 -0
- chia/wallet/puzzles/dao_update_proposal.clsp +44 -0
- chia/wallet/puzzles/dao_update_proposal.clsp.hex +1 -0
- chia/wallet/puzzles/deployed_puzzle_hashes.json +67 -0
- chia/wallet/puzzles/json.clib +25 -0
- chia/wallet/puzzles/load_clvm.py +162 -0
- chia/wallet/puzzles/merkle_utils.clib +18 -0
- chia/wallet/puzzles/notification.clsp +7 -0
- chia/wallet/puzzles/notification.clsp.hex +1 -0
- chia/wallet/puzzles/p2_1_of_n.clsp +22 -0
- chia/wallet/puzzles/p2_1_of_n.clsp.hex +1 -0
- chia/wallet/puzzles/p2_conditions.clsp +3 -0
- chia/wallet/puzzles/p2_conditions.clsp.hex +1 -0
- chia/wallet/puzzles/p2_conditions.py +27 -0
- chia/wallet/puzzles/p2_delegated_conditions.clsp +18 -0
- chia/wallet/puzzles/p2_delegated_conditions.clsp.hex +1 -0
- chia/wallet/puzzles/p2_delegated_conditions.py +22 -0
- chia/wallet/puzzles/p2_delegated_puzzle.clsp +19 -0
- chia/wallet/puzzles/p2_delegated_puzzle.clsp.hex +1 -0
- chia/wallet/puzzles/p2_delegated_puzzle.py +35 -0
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp +91 -0
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp.hex +1 -0
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +161 -0
- chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp +108 -0
- chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp.hex +1 -0
- chia/wallet/puzzles/p2_m_of_n_delegate_direct.py +22 -0
- chia/wallet/puzzles/p2_parent.clsp +19 -0
- chia/wallet/puzzles/p2_parent.clsp.hex +1 -0
- chia/wallet/puzzles/p2_puzzle_hash.clsp +18 -0
- chia/wallet/puzzles/p2_puzzle_hash.clsp.hex +1 -0
- chia/wallet/puzzles/p2_puzzle_hash.py +28 -0
- chia/wallet/puzzles/p2_singleton.clsp +30 -0
- chia/wallet/puzzles/p2_singleton.clsp.hex +1 -0
- chia/wallet/puzzles/p2_singleton_aggregator.clsp +81 -0
- chia/wallet/puzzles/p2_singleton_aggregator.clsp.hex +1 -0
- chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp +50 -0
- chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp.hex +1 -0
- chia/wallet/puzzles/p2_singleton_via_delegated_puzzle.clsp +47 -0
- chia/wallet/puzzles/p2_singleton_via_delegated_puzzle.clsp.hex +1 -0
- chia/wallet/puzzles/puzzle_utils.py +34 -0
- chia/wallet/puzzles/settlement_payments.clsp +49 -0
- chia/wallet/puzzles/settlement_payments.clsp.hex +1 -0
- chia/wallet/puzzles/sha256tree.clib +11 -0
- chia/wallet/puzzles/singleton_launcher.clsp +16 -0
- chia/wallet/puzzles/singleton_launcher.clsp.hex +1 -0
- chia/wallet/puzzles/singleton_top_layer.clsp +177 -0
- chia/wallet/puzzles/singleton_top_layer.clsp.hex +1 -0
- chia/wallet/puzzles/singleton_top_layer.py +295 -0
- chia/wallet/puzzles/singleton_top_layer_v1_1.clsp +107 -0
- chia/wallet/puzzles/singleton_top_layer_v1_1.clsp.hex +1 -0
- chia/wallet/puzzles/singleton_top_layer_v1_1.py +344 -0
- chia/wallet/puzzles/singleton_truths.clib +21 -0
- chia/wallet/puzzles/tails.py +344 -0
- chia/wallet/puzzles/utility_macros.clib +48 -0
- chia/wallet/signer_protocol.py +126 -0
- chia/wallet/singleton.py +106 -0
- chia/wallet/singleton_record.py +30 -0
- chia/wallet/trade_manager.py +1088 -0
- chia/wallet/trade_record.py +67 -0
- chia/wallet/trading/__init__.py +0 -0
- chia/wallet/trading/offer.py +703 -0
- chia/wallet/trading/trade_status.py +13 -0
- chia/wallet/trading/trade_store.py +526 -0
- chia/wallet/transaction_record.py +143 -0
- chia/wallet/transaction_sorting.py +14 -0
- chia/wallet/uncurried_puzzle.py +17 -0
- chia/wallet/util/__init__.py +0 -0
- chia/wallet/util/address_type.py +55 -0
- chia/wallet/util/blind_signer_tl.py +168 -0
- chia/wallet/util/clvm_streamable.py +203 -0
- chia/wallet/util/compute_hints.py +66 -0
- chia/wallet/util/compute_memos.py +45 -0
- chia/wallet/util/curry_and_treehash.py +90 -0
- chia/wallet/util/debug_spend_bundle.py +234 -0
- chia/wallet/util/merkle_tree.py +100 -0
- chia/wallet/util/merkle_utils.py +102 -0
- chia/wallet/util/new_peak_queue.py +82 -0
- chia/wallet/util/notifications.py +12 -0
- chia/wallet/util/peer_request_cache.py +174 -0
- chia/wallet/util/puzzle_compression.py +96 -0
- chia/wallet/util/puzzle_decorator.py +100 -0
- chia/wallet/util/puzzle_decorator_type.py +7 -0
- chia/wallet/util/query_filter.py +60 -0
- chia/wallet/util/transaction_type.py +23 -0
- chia/wallet/util/tx_config.py +158 -0
- chia/wallet/util/wallet_sync_utils.py +348 -0
- chia/wallet/util/wallet_types.py +65 -0
- chia/wallet/vc_wallet/__init__.py +0 -0
- chia/wallet/vc_wallet/cr_cat_drivers.py +663 -0
- chia/wallet/vc_wallet/cr_cat_wallet.py +875 -0
- chia/wallet/vc_wallet/cr_outer_puzzle.py +102 -0
- chia/wallet/vc_wallet/cr_puzzles/__init__.py +0 -0
- chia/wallet/vc_wallet/cr_puzzles/conditions_w_fee_announce.clsp +3 -0
- chia/wallet/vc_wallet/cr_puzzles/conditions_w_fee_announce.clsp.hex +1 -0
- chia/wallet/vc_wallet/cr_puzzles/credential_restriction.clsp +304 -0
- chia/wallet/vc_wallet/cr_puzzles/credential_restriction.clsp.hex +1 -0
- chia/wallet/vc_wallet/cr_puzzles/flag_proofs_checker.clsp +45 -0
- chia/wallet/vc_wallet/cr_puzzles/flag_proofs_checker.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_drivers.py +838 -0
- chia/wallet/vc_wallet/vc_puzzles/__init__.py +0 -0
- chia/wallet/vc_wallet/vc_puzzles/covenant_layer.clsp +30 -0
- chia/wallet/vc_wallet/vc_puzzles/covenant_layer.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/eml_covenant_morpher.clsp +75 -0
- chia/wallet/vc_wallet/vc_puzzles/eml_covenant_morpher.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/eml_transfer_program_covenant_adapter.clsp +32 -0
- chia/wallet/vc_wallet/vc_puzzles/eml_transfer_program_covenant_adapter.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/eml_update_metadata_with_DID.clsp +80 -0
- chia/wallet/vc_wallet/vc_puzzles/eml_update_metadata_with_DID.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/exigent_metadata_layer.clsp +163 -0
- chia/wallet/vc_wallet/vc_puzzles/exigent_metadata_layer.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/p2_announced_delegated_puzzle.clsp +16 -0
- chia/wallet/vc_wallet/vc_puzzles/p2_announced_delegated_puzzle.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/standard_vc_backdoor_puzzle.clsp +74 -0
- chia/wallet/vc_wallet/vc_puzzles/standard_vc_backdoor_puzzle.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/std_parent_morpher.clsp +23 -0
- chia/wallet/vc_wallet/vc_puzzles/std_parent_morpher.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_puzzles/viral_backdoor.clsp +64 -0
- chia/wallet/vc_wallet/vc_puzzles/viral_backdoor.clsp.hex +1 -0
- chia/wallet/vc_wallet/vc_store.py +263 -0
- chia/wallet/vc_wallet/vc_wallet.py +638 -0
- chia/wallet/wallet.py +698 -0
- chia/wallet/wallet_action_scope.py +95 -0
- chia/wallet/wallet_blockchain.py +244 -0
- chia/wallet/wallet_coin_record.py +72 -0
- chia/wallet/wallet_coin_store.py +351 -0
- chia/wallet/wallet_info.py +36 -0
- chia/wallet/wallet_interested_store.py +188 -0
- chia/wallet/wallet_nft_store.py +279 -0
- chia/wallet/wallet_node.py +1769 -0
- chia/wallet/wallet_node_api.py +201 -0
- chia/wallet/wallet_pool_store.py +120 -0
- chia/wallet/wallet_protocol.py +90 -0
- chia/wallet/wallet_puzzle_store.py +365 -0
- chia/wallet/wallet_retry_store.py +70 -0
- chia/wallet/wallet_singleton_store.py +258 -0
- chia/wallet/wallet_spend_bundle.py +41 -0
- chia/wallet/wallet_state_manager.py +2820 -0
- chia/wallet/wallet_transaction_store.py +470 -0
- chia/wallet/wallet_user_store.py +110 -0
- chia/wallet/wallet_weight_proof_handler.py +126 -0
- chia_blockchain-2.4.4.dist-info/LICENSE +201 -0
- chia_blockchain-2.4.4.dist-info/METADATA +161 -0
- chia_blockchain-2.4.4.dist-info/RECORD +1028 -0
- chia_blockchain-2.4.4.dist-info/WHEEL +4 -0
- chia_blockchain-2.4.4.dist-info/entry_points.txt +17 -0
- mozilla-ca/cacert.pem +3666 -0
|
@@ -0,0 +1,1844 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union, cast
|
|
4
|
+
|
|
5
|
+
from chia.data_layer.data_layer_util import DLProof, VerifyProofResponse
|
|
6
|
+
from chia.data_layer.data_layer_wallet import Mirror, SingletonRecord
|
|
7
|
+
from chia.pools.pool_wallet_info import PoolWalletInfo
|
|
8
|
+
from chia.rpc.rpc_client import RpcClient
|
|
9
|
+
from chia.rpc.wallet_request_types import (
|
|
10
|
+
AddKey,
|
|
11
|
+
AddKeyResponse,
|
|
12
|
+
ApplySignatures,
|
|
13
|
+
ApplySignaturesResponse,
|
|
14
|
+
CancelOfferResponse,
|
|
15
|
+
CancelOffersResponse,
|
|
16
|
+
CATSpendResponse,
|
|
17
|
+
CheckDeleteKey,
|
|
18
|
+
CheckDeleteKeyResponse,
|
|
19
|
+
CombineCoins,
|
|
20
|
+
CombineCoinsResponse,
|
|
21
|
+
CreateNewDAOWalletResponse,
|
|
22
|
+
CreateOfferForIDsResponse,
|
|
23
|
+
CreateSignedTransactionsResponse,
|
|
24
|
+
DAOAddFundsToTreasuryResponse,
|
|
25
|
+
DAOCloseProposalResponse,
|
|
26
|
+
DAOCreateProposalResponse,
|
|
27
|
+
DAOExitLockupResponse,
|
|
28
|
+
DAOFreeCoinsFromFinishedProposalsResponse,
|
|
29
|
+
DAOSendToLockupResponse,
|
|
30
|
+
DAOVoteOnProposalResponse,
|
|
31
|
+
DeleteKey,
|
|
32
|
+
DIDGetCurrentCoinInfo,
|
|
33
|
+
DIDGetCurrentCoinInfoResponse,
|
|
34
|
+
DIDGetPubkey,
|
|
35
|
+
DIDGetPubkeyResponse,
|
|
36
|
+
DIDGetRecoveryInfo,
|
|
37
|
+
DIDGetRecoveryInfoResponse,
|
|
38
|
+
DIDMessageSpendResponse,
|
|
39
|
+
DIDTransferDIDResponse,
|
|
40
|
+
DIDUpdateMetadataResponse,
|
|
41
|
+
DIDUpdateRecoveryIDsResponse,
|
|
42
|
+
ExecuteSigningInstructions,
|
|
43
|
+
ExecuteSigningInstructionsResponse,
|
|
44
|
+
GatherSigningInfo,
|
|
45
|
+
GatherSigningInfoResponse,
|
|
46
|
+
GenerateMnemonicResponse,
|
|
47
|
+
GetCATListResponse,
|
|
48
|
+
GetLoggedInFingerprintResponse,
|
|
49
|
+
GetNotifications,
|
|
50
|
+
GetNotificationsResponse,
|
|
51
|
+
GetOffersCountResponse,
|
|
52
|
+
GetPrivateKey,
|
|
53
|
+
GetPrivateKeyResponse,
|
|
54
|
+
GetPublicKeysResponse,
|
|
55
|
+
GetTransactionMemo,
|
|
56
|
+
GetTransactionMemoResponse,
|
|
57
|
+
LogIn,
|
|
58
|
+
LogInResponse,
|
|
59
|
+
NFTAddURIResponse,
|
|
60
|
+
NFTGetByDID,
|
|
61
|
+
NFTGetByDIDResponse,
|
|
62
|
+
NFTGetWalletsWithDIDsResponse,
|
|
63
|
+
NFTMintBulkResponse,
|
|
64
|
+
NFTMintNFTResponse,
|
|
65
|
+
NFTSetDIDBulk,
|
|
66
|
+
NFTSetDIDBulkResponse,
|
|
67
|
+
NFTSetNFTDIDResponse,
|
|
68
|
+
NFTSetNFTStatus,
|
|
69
|
+
NFTTransferBulk,
|
|
70
|
+
NFTTransferBulkResponse,
|
|
71
|
+
NFTTransferNFTResponse,
|
|
72
|
+
SendTransactionMultiResponse,
|
|
73
|
+
SendTransactionResponse,
|
|
74
|
+
SplitCoins,
|
|
75
|
+
SplitCoinsResponse,
|
|
76
|
+
SubmitTransactions,
|
|
77
|
+
SubmitTransactionsResponse,
|
|
78
|
+
TakeOfferResponse,
|
|
79
|
+
VCMintResponse,
|
|
80
|
+
VCRevokeResponse,
|
|
81
|
+
VCSpendResponse,
|
|
82
|
+
VerifySignature,
|
|
83
|
+
VerifySignatureResponse,
|
|
84
|
+
)
|
|
85
|
+
from chia.types.blockchain_format.coin import Coin
|
|
86
|
+
from chia.types.blockchain_format.program import Program
|
|
87
|
+
from chia.types.blockchain_format.sized_bytes import bytes32
|
|
88
|
+
from chia.types.coin_record import CoinRecord
|
|
89
|
+
from chia.util.bech32m import encode_puzzle_hash
|
|
90
|
+
from chia.util.ints import uint16, uint32, uint64
|
|
91
|
+
from chia.wallet.conditions import Condition, ConditionValidTimes, conditions_to_json_dicts
|
|
92
|
+
from chia.wallet.puzzles.clawback.metadata import AutoClaimSettings
|
|
93
|
+
from chia.wallet.trade_record import TradeRecord
|
|
94
|
+
from chia.wallet.trading.offer import Offer
|
|
95
|
+
from chia.wallet.transaction_record import TransactionRecord
|
|
96
|
+
from chia.wallet.transaction_sorting import SortKey
|
|
97
|
+
from chia.wallet.util.clvm_streamable import json_deserialize_with_clvm_streamable
|
|
98
|
+
from chia.wallet.util.query_filter import TransactionTypeFilter
|
|
99
|
+
from chia.wallet.util.tx_config import CoinSelectionConfig, TXConfig
|
|
100
|
+
from chia.wallet.util.wallet_types import WalletType
|
|
101
|
+
from chia.wallet.vc_wallet.vc_store import VCRecord
|
|
102
|
+
from chia.wallet.wallet_coin_store import GetCoinRecords
|
|
103
|
+
from chia.wallet.wallet_spend_bundle import WalletSpendBundle
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def parse_result_transactions(result: Dict[str, Any]) -> Dict[str, Any]:
|
|
107
|
+
result["transaction"] = TransactionRecord.from_json_dict(result["transaction"])
|
|
108
|
+
result["transactions"] = [TransactionRecord.from_json_dict_convenience(tx) for tx in result["transactions"]]
|
|
109
|
+
if result["fee_transaction"]:
|
|
110
|
+
result["fee_transaction"] = TransactionRecord.from_json_dict(result["fee_transaction"])
|
|
111
|
+
return result
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class WalletRpcClient(RpcClient):
|
|
115
|
+
"""
|
|
116
|
+
Client to Chia RPC, connects to a local wallet. Uses HTTP/JSON, and converts back from
|
|
117
|
+
JSON into native python objects before returning. All api calls use POST requests.
|
|
118
|
+
Note that this is not the same as the peer protocol, or wallet protocol (which run Chia's
|
|
119
|
+
protocol on top of TCP), it's a separate protocol on top of HTTP that provides easy access
|
|
120
|
+
to the full node.
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
# Key Management APIs
|
|
124
|
+
async def log_in(self, request: LogIn) -> LogInResponse:
|
|
125
|
+
return LogInResponse.from_json_dict(await self.fetch("log_in", request.to_json_dict()))
|
|
126
|
+
|
|
127
|
+
async def set_wallet_resync_on_startup(self, enable: bool = True) -> Dict[str, Any]:
|
|
128
|
+
return await self.fetch(path="set_wallet_resync_on_startup", request_json={"enable": enable})
|
|
129
|
+
|
|
130
|
+
async def get_logged_in_fingerprint(self) -> GetLoggedInFingerprintResponse:
|
|
131
|
+
return GetLoggedInFingerprintResponse.from_json_dict(await self.fetch("get_logged_in_fingerprint", {}))
|
|
132
|
+
|
|
133
|
+
async def get_public_keys(self) -> GetPublicKeysResponse:
|
|
134
|
+
return GetPublicKeysResponse.from_json_dict(await self.fetch("get_public_keys", {}))
|
|
135
|
+
|
|
136
|
+
async def get_private_key(self, request: GetPrivateKey) -> GetPrivateKeyResponse:
|
|
137
|
+
return GetPrivateKeyResponse.from_json_dict(await self.fetch("get_private_key", request.to_json_dict()))
|
|
138
|
+
|
|
139
|
+
async def generate_mnemonic(self) -> GenerateMnemonicResponse:
|
|
140
|
+
return GenerateMnemonicResponse.from_json_dict(await self.fetch("generate_mnemonic", {}))
|
|
141
|
+
|
|
142
|
+
async def add_key(self, request: AddKey) -> AddKeyResponse:
|
|
143
|
+
return AddKeyResponse.from_json_dict(await self.fetch("add_key", request.to_json_dict()))
|
|
144
|
+
|
|
145
|
+
async def delete_key(self, request: DeleteKey) -> None:
|
|
146
|
+
await self.fetch("delete_key", request.to_json_dict())
|
|
147
|
+
|
|
148
|
+
async def check_delete_key(self, request: CheckDeleteKey) -> CheckDeleteKeyResponse:
|
|
149
|
+
return CheckDeleteKeyResponse.from_json_dict(await self.fetch("check_delete_key", request.to_json_dict()))
|
|
150
|
+
|
|
151
|
+
async def delete_all_keys(self) -> None:
|
|
152
|
+
await self.fetch("delete_all_keys", {})
|
|
153
|
+
|
|
154
|
+
# Wallet Node APIs
|
|
155
|
+
async def get_sync_status(self) -> bool:
|
|
156
|
+
response = await self.fetch("get_sync_status", {})
|
|
157
|
+
# TODO: casting due to lack of type checked deserialization
|
|
158
|
+
return cast(bool, response["syncing"])
|
|
159
|
+
|
|
160
|
+
async def get_synced(self) -> bool:
|
|
161
|
+
response = await self.fetch("get_sync_status", {})
|
|
162
|
+
# TODO: casting due to lack of type checked deserialization
|
|
163
|
+
return cast(bool, response["synced"])
|
|
164
|
+
|
|
165
|
+
async def get_height_info(self) -> uint32:
|
|
166
|
+
response = await self.fetch("get_height_info", {})
|
|
167
|
+
# TODO: casting due to lack of type checked deserialization
|
|
168
|
+
return cast(uint32, response["height"])
|
|
169
|
+
|
|
170
|
+
async def push_tx(self, spend_bundle: WalletSpendBundle) -> Dict[str, Any]:
|
|
171
|
+
return await self.fetch("push_tx", {"spend_bundle": bytes(spend_bundle).hex()})
|
|
172
|
+
|
|
173
|
+
async def push_transactions(
|
|
174
|
+
self, txs: List[TransactionRecord], fee: uint64 = uint64(0), sign: bool = False
|
|
175
|
+
) -> Dict[str, Any]:
|
|
176
|
+
transactions = [bytes(tx).hex() for tx in txs]
|
|
177
|
+
|
|
178
|
+
return await self.fetch("push_transactions", {"transactions": transactions, "fee": fee, "sign": sign})
|
|
179
|
+
|
|
180
|
+
async def farm_block(self, address: str) -> Dict[str, Any]:
|
|
181
|
+
return await self.fetch("farm_block", {"address": address})
|
|
182
|
+
|
|
183
|
+
async def get_timestamp_for_height(self, height: uint32) -> uint64:
|
|
184
|
+
request = {"height": height}
|
|
185
|
+
response = await self.fetch("get_timestamp_for_height", request)
|
|
186
|
+
# TODO: casting due to lack of type checked deserialization
|
|
187
|
+
return cast(uint64, response["timestamp"])
|
|
188
|
+
|
|
189
|
+
async def set_auto_claim(self, request: AutoClaimSettings) -> AutoClaimSettings:
|
|
190
|
+
return AutoClaimSettings.from_json_dict(await self.fetch("set_auto_claim", {**request.to_json_dict()}))
|
|
191
|
+
|
|
192
|
+
async def get_auto_claim(self) -> AutoClaimSettings:
|
|
193
|
+
return AutoClaimSettings.from_json_dict(await self.fetch("get_auto_claim", {}))
|
|
194
|
+
|
|
195
|
+
# Wallet Management APIs
|
|
196
|
+
async def get_wallets(self, wallet_type: Optional[WalletType] = None) -> List[Dict[str, Any]]:
|
|
197
|
+
if wallet_type is None:
|
|
198
|
+
request = {}
|
|
199
|
+
else:
|
|
200
|
+
request = {"type": wallet_type}
|
|
201
|
+
response = await self.fetch("get_wallets", request)
|
|
202
|
+
# TODO: casting due to lack of type checked deserialization
|
|
203
|
+
return cast(List[Dict[str, Any]], response["wallets"])
|
|
204
|
+
|
|
205
|
+
# Wallet APIs
|
|
206
|
+
async def get_wallet_balance(self, wallet_id: int) -> Dict[str, Any]:
|
|
207
|
+
request = {"wallet_id": wallet_id}
|
|
208
|
+
response = await self.fetch("get_wallet_balance", request)
|
|
209
|
+
# TODO: casting due to lack of type checked deserialization
|
|
210
|
+
return cast(Dict[str, Any], response["wallet_balance"])
|
|
211
|
+
|
|
212
|
+
async def get_wallet_balances(self, wallet_ids: Optional[List[int]] = None) -> Dict[str, Dict[str, Any]]:
|
|
213
|
+
request = {"wallet_ids": wallet_ids}
|
|
214
|
+
response = await self.fetch("get_wallet_balances", request)
|
|
215
|
+
# TODO: casting due to lack of type checked deserialization
|
|
216
|
+
return cast(Dict[str, Dict[str, Any]], response["wallet_balances"])
|
|
217
|
+
|
|
218
|
+
async def get_transaction(self, transaction_id: bytes32) -> TransactionRecord:
|
|
219
|
+
request = {"transaction_id": transaction_id.hex()}
|
|
220
|
+
response = await self.fetch("get_transaction", request)
|
|
221
|
+
return TransactionRecord.from_json_dict_convenience(response["transaction"])
|
|
222
|
+
|
|
223
|
+
async def get_transactions(
|
|
224
|
+
self,
|
|
225
|
+
wallet_id: int,
|
|
226
|
+
start: Optional[int] = None,
|
|
227
|
+
end: Optional[int] = None,
|
|
228
|
+
sort_key: Optional[SortKey] = None,
|
|
229
|
+
reverse: bool = False,
|
|
230
|
+
to_address: Optional[str] = None,
|
|
231
|
+
type_filter: Optional[TransactionTypeFilter] = None,
|
|
232
|
+
confirmed: Optional[bool] = None,
|
|
233
|
+
) -> List[TransactionRecord]:
|
|
234
|
+
request: Dict[str, Any] = {"wallet_id": wallet_id}
|
|
235
|
+
|
|
236
|
+
if start is not None:
|
|
237
|
+
request["start"] = start
|
|
238
|
+
if end is not None:
|
|
239
|
+
request["end"] = end
|
|
240
|
+
if sort_key is not None:
|
|
241
|
+
request["sort_key"] = sort_key.name
|
|
242
|
+
request["reverse"] = reverse
|
|
243
|
+
|
|
244
|
+
if to_address is not None:
|
|
245
|
+
request["to_address"] = to_address
|
|
246
|
+
|
|
247
|
+
if type_filter is not None:
|
|
248
|
+
request["type_filter"] = type_filter.to_json_dict()
|
|
249
|
+
|
|
250
|
+
if confirmed is not None:
|
|
251
|
+
request["confirmed"] = confirmed
|
|
252
|
+
|
|
253
|
+
res = await self.fetch("get_transactions", request)
|
|
254
|
+
return [TransactionRecord.from_json_dict_convenience(tx) for tx in res["transactions"]]
|
|
255
|
+
|
|
256
|
+
async def get_transaction_count(
|
|
257
|
+
self, wallet_id: int, confirmed: Optional[bool] = None, type_filter: Optional[TransactionTypeFilter] = None
|
|
258
|
+
) -> int:
|
|
259
|
+
request: Dict[str, Any] = {"wallet_id": wallet_id}
|
|
260
|
+
if type_filter is not None:
|
|
261
|
+
request["type_filter"] = type_filter.to_json_dict()
|
|
262
|
+
if confirmed is not None:
|
|
263
|
+
request["confirmed"] = confirmed
|
|
264
|
+
res = await self.fetch("get_transaction_count", request)
|
|
265
|
+
# TODO: casting due to lack of type checked deserialization
|
|
266
|
+
return cast(int, res["count"])
|
|
267
|
+
|
|
268
|
+
async def get_next_address(self, wallet_id: int, new_address: bool) -> str:
|
|
269
|
+
request = {"wallet_id": wallet_id, "new_address": new_address}
|
|
270
|
+
response = await self.fetch("get_next_address", request)
|
|
271
|
+
# TODO: casting due to lack of type checked deserialization
|
|
272
|
+
return cast(str, response["address"])
|
|
273
|
+
|
|
274
|
+
async def send_transaction(
|
|
275
|
+
self,
|
|
276
|
+
wallet_id: int,
|
|
277
|
+
amount: uint64,
|
|
278
|
+
address: str,
|
|
279
|
+
tx_config: TXConfig,
|
|
280
|
+
fee: uint64 = uint64(0),
|
|
281
|
+
memos: Optional[List[str]] = None,
|
|
282
|
+
puzzle_decorator_override: Optional[List[Dict[str, Union[str, int, bool]]]] = None,
|
|
283
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
284
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
285
|
+
push: bool = True,
|
|
286
|
+
) -> SendTransactionResponse:
|
|
287
|
+
request = {
|
|
288
|
+
"wallet_id": wallet_id,
|
|
289
|
+
"amount": amount,
|
|
290
|
+
"address": address,
|
|
291
|
+
"fee": fee,
|
|
292
|
+
"puzzle_decorator": puzzle_decorator_override,
|
|
293
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
294
|
+
"push": push,
|
|
295
|
+
**tx_config.to_json_dict(),
|
|
296
|
+
**timelock_info.to_json_dict(),
|
|
297
|
+
}
|
|
298
|
+
if memos is not None:
|
|
299
|
+
request["memos"] = memos
|
|
300
|
+
response = await self.fetch("send_transaction", request)
|
|
301
|
+
return json_deserialize_with_clvm_streamable(response, SendTransactionResponse)
|
|
302
|
+
|
|
303
|
+
async def send_transaction_multi(
|
|
304
|
+
self,
|
|
305
|
+
wallet_id: int,
|
|
306
|
+
additions: List[Dict[str, Any]],
|
|
307
|
+
tx_config: TXConfig,
|
|
308
|
+
coins: Optional[List[Coin]] = None,
|
|
309
|
+
fee: uint64 = uint64(0),
|
|
310
|
+
push: bool = True,
|
|
311
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
312
|
+
) -> SendTransactionMultiResponse:
|
|
313
|
+
# Converts bytes to hex for puzzle hashes
|
|
314
|
+
additions_hex = []
|
|
315
|
+
for ad in additions:
|
|
316
|
+
additions_hex.append({"amount": ad["amount"], "puzzle_hash": ad["puzzle_hash"].hex()})
|
|
317
|
+
if "memos" in ad:
|
|
318
|
+
additions_hex[-1]["memos"] = ad["memos"]
|
|
319
|
+
request = {
|
|
320
|
+
"wallet_id": wallet_id,
|
|
321
|
+
"additions": additions_hex,
|
|
322
|
+
"fee": fee,
|
|
323
|
+
"push": push,
|
|
324
|
+
**tx_config.to_json_dict(),
|
|
325
|
+
**timelock_info.to_json_dict(),
|
|
326
|
+
}
|
|
327
|
+
if coins is not None and len(coins) > 0:
|
|
328
|
+
coins_json = [c.to_json_dict() for c in coins]
|
|
329
|
+
request["coins"] = coins_json
|
|
330
|
+
response = await self.fetch("send_transaction_multi", request)
|
|
331
|
+
return json_deserialize_with_clvm_streamable(response, SendTransactionMultiResponse)
|
|
332
|
+
|
|
333
|
+
async def spend_clawback_coins(
|
|
334
|
+
self,
|
|
335
|
+
coin_ids: List[bytes32],
|
|
336
|
+
fee: int = 0,
|
|
337
|
+
force: bool = False,
|
|
338
|
+
push: bool = True,
|
|
339
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
340
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
341
|
+
) -> Dict[str, Any]:
|
|
342
|
+
request = {
|
|
343
|
+
"coin_ids": [cid.hex() for cid in coin_ids],
|
|
344
|
+
"fee": fee,
|
|
345
|
+
"force": force,
|
|
346
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
347
|
+
"push": push,
|
|
348
|
+
**timelock_info.to_json_dict(),
|
|
349
|
+
}
|
|
350
|
+
response = await self.fetch("spend_clawback_coins", request)
|
|
351
|
+
return response
|
|
352
|
+
|
|
353
|
+
async def delete_unconfirmed_transactions(self, wallet_id: int) -> None:
|
|
354
|
+
await self.fetch("delete_unconfirmed_transactions", {"wallet_id": wallet_id})
|
|
355
|
+
|
|
356
|
+
async def get_current_derivation_index(self) -> str:
|
|
357
|
+
response = await self.fetch("get_current_derivation_index", {})
|
|
358
|
+
index = response["index"]
|
|
359
|
+
return str(index)
|
|
360
|
+
|
|
361
|
+
async def extend_derivation_index(self, index: int) -> str:
|
|
362
|
+
response = await self.fetch("extend_derivation_index", {"index": index})
|
|
363
|
+
updated_index = response["index"]
|
|
364
|
+
return str(updated_index)
|
|
365
|
+
|
|
366
|
+
async def get_farmed_amount(self) -> Dict[str, Any]:
|
|
367
|
+
return await self.fetch("get_farmed_amount", {})
|
|
368
|
+
|
|
369
|
+
async def create_signed_transactions(
|
|
370
|
+
self,
|
|
371
|
+
additions: List[Dict[str, Any]],
|
|
372
|
+
tx_config: TXConfig,
|
|
373
|
+
coins: Optional[List[Coin]] = None,
|
|
374
|
+
fee: uint64 = uint64(0),
|
|
375
|
+
wallet_id: Optional[int] = None,
|
|
376
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
377
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
378
|
+
push: bool = False,
|
|
379
|
+
) -> CreateSignedTransactionsResponse:
|
|
380
|
+
# Converts bytes to hex for puzzle hashes
|
|
381
|
+
additions_hex = []
|
|
382
|
+
for ad in additions:
|
|
383
|
+
additions_hex.append({"amount": ad["amount"], "puzzle_hash": ad["puzzle_hash"].hex()})
|
|
384
|
+
if "memos" in ad:
|
|
385
|
+
additions_hex[-1]["memos"] = ad["memos"]
|
|
386
|
+
|
|
387
|
+
request = {
|
|
388
|
+
"additions": additions_hex,
|
|
389
|
+
"fee": fee,
|
|
390
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
391
|
+
"push": push,
|
|
392
|
+
**tx_config.to_json_dict(),
|
|
393
|
+
**timelock_info.to_json_dict(),
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if coins is not None and len(coins) > 0:
|
|
397
|
+
coins_json = [c.to_json_dict() for c in coins]
|
|
398
|
+
request["coins"] = coins_json
|
|
399
|
+
|
|
400
|
+
if wallet_id:
|
|
401
|
+
request["wallet_id"] = wallet_id
|
|
402
|
+
|
|
403
|
+
response = await self.fetch("create_signed_transaction", request)
|
|
404
|
+
return json_deserialize_with_clvm_streamable(response, CreateSignedTransactionsResponse)
|
|
405
|
+
|
|
406
|
+
async def select_coins(self, amount: int, wallet_id: int, coin_selection_config: CoinSelectionConfig) -> List[Coin]:
|
|
407
|
+
request = {"amount": amount, "wallet_id": wallet_id, **coin_selection_config.to_json_dict()}
|
|
408
|
+
response = await self.fetch("select_coins", request)
|
|
409
|
+
return [Coin.from_json_dict(coin) for coin in response["coins"]]
|
|
410
|
+
|
|
411
|
+
async def get_coin_records(self, request: GetCoinRecords) -> Dict[str, Any]:
|
|
412
|
+
return await self.fetch("get_coin_records", request.to_json_dict())
|
|
413
|
+
|
|
414
|
+
async def get_spendable_coins(
|
|
415
|
+
self, wallet_id: int, coin_selection_config: CoinSelectionConfig
|
|
416
|
+
) -> Tuple[List[CoinRecord], List[CoinRecord], List[Coin]]:
|
|
417
|
+
"""
|
|
418
|
+
We return a tuple containing: (confirmed records, unconfirmed removals, unconfirmed additions)
|
|
419
|
+
"""
|
|
420
|
+
request = {"wallet_id": wallet_id, **coin_selection_config.to_json_dict()}
|
|
421
|
+
response = await self.fetch("get_spendable_coins", request)
|
|
422
|
+
confirmed_wrs = [CoinRecord.from_json_dict(coin) for coin in response["confirmed_records"]]
|
|
423
|
+
unconfirmed_removals = [CoinRecord.from_json_dict(coin) for coin in response["unconfirmed_removals"]]
|
|
424
|
+
unconfirmed_additions = [Coin.from_json_dict(coin) for coin in response["unconfirmed_additions"]]
|
|
425
|
+
return confirmed_wrs, unconfirmed_removals, unconfirmed_additions
|
|
426
|
+
|
|
427
|
+
async def get_coin_records_by_names(
|
|
428
|
+
self,
|
|
429
|
+
names: List[bytes32],
|
|
430
|
+
include_spent_coins: bool = True,
|
|
431
|
+
start_height: Optional[int] = None,
|
|
432
|
+
end_height: Optional[int] = None,
|
|
433
|
+
) -> List[CoinRecord]:
|
|
434
|
+
names_hex = [name.hex() for name in names]
|
|
435
|
+
request = {"names": names_hex, "include_spent_coins": include_spent_coins}
|
|
436
|
+
if start_height is not None:
|
|
437
|
+
request["start_height"] = start_height
|
|
438
|
+
if end_height is not None:
|
|
439
|
+
request["end_height"] = end_height
|
|
440
|
+
|
|
441
|
+
response = await self.fetch("get_coin_records_by_names", request)
|
|
442
|
+
return [CoinRecord.from_json_dict(cr) for cr in response["coin_records"]]
|
|
443
|
+
|
|
444
|
+
# DID wallet
|
|
445
|
+
async def create_new_did_wallet(
|
|
446
|
+
self,
|
|
447
|
+
amount: int,
|
|
448
|
+
tx_config: TXConfig,
|
|
449
|
+
fee: int = 0,
|
|
450
|
+
name: Optional[str] = "DID Wallet",
|
|
451
|
+
backup_ids: List[str] = [],
|
|
452
|
+
required_num: int = 0,
|
|
453
|
+
type: str = "new",
|
|
454
|
+
backup_data: str = "",
|
|
455
|
+
push: bool = True,
|
|
456
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
457
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
458
|
+
) -> Dict[str, Any]:
|
|
459
|
+
request = {
|
|
460
|
+
"wallet_type": "did_wallet",
|
|
461
|
+
"did_type": type,
|
|
462
|
+
"backup_dids": backup_ids,
|
|
463
|
+
"num_of_backup_ids_needed": required_num,
|
|
464
|
+
"amount": amount,
|
|
465
|
+
"fee": fee,
|
|
466
|
+
"wallet_name": name,
|
|
467
|
+
"push": push,
|
|
468
|
+
"backup_data": backup_data,
|
|
469
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
470
|
+
**tx_config.to_json_dict(),
|
|
471
|
+
**timelock_info.to_json_dict(),
|
|
472
|
+
}
|
|
473
|
+
response = await self.fetch("create_new_wallet", request)
|
|
474
|
+
return response
|
|
475
|
+
|
|
476
|
+
async def get_did_id(self, wallet_id: int) -> Dict[str, Any]:
|
|
477
|
+
request = {"wallet_id": wallet_id}
|
|
478
|
+
response = await self.fetch("did_get_did", request)
|
|
479
|
+
return response
|
|
480
|
+
|
|
481
|
+
async def get_did_info(self, coin_id: str, latest: bool) -> Dict[str, Any]:
|
|
482
|
+
request = {"coin_id": coin_id, "latest": latest}
|
|
483
|
+
response = await self.fetch("did_get_info", request)
|
|
484
|
+
return response
|
|
485
|
+
|
|
486
|
+
async def create_did_backup_file(self, wallet_id: int, filename: str) -> Dict[str, Any]:
|
|
487
|
+
request = {"wallet_id": wallet_id, "filename": filename}
|
|
488
|
+
response = await self.fetch("did_create_backup_file", request)
|
|
489
|
+
return response
|
|
490
|
+
|
|
491
|
+
async def update_did_recovery_list(
|
|
492
|
+
self,
|
|
493
|
+
wallet_id: int,
|
|
494
|
+
recovery_list: List[str],
|
|
495
|
+
num_verification: int,
|
|
496
|
+
tx_config: TXConfig,
|
|
497
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
498
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
499
|
+
push: bool = True,
|
|
500
|
+
) -> DIDUpdateRecoveryIDsResponse:
|
|
501
|
+
request = {
|
|
502
|
+
"wallet_id": wallet_id,
|
|
503
|
+
"new_list": recovery_list,
|
|
504
|
+
"num_verifications_required": num_verification,
|
|
505
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
506
|
+
"push": push,
|
|
507
|
+
**tx_config.to_json_dict(),
|
|
508
|
+
**timelock_info.to_json_dict(),
|
|
509
|
+
}
|
|
510
|
+
response = await self.fetch("did_update_recovery_ids", request)
|
|
511
|
+
return json_deserialize_with_clvm_streamable(response, DIDUpdateRecoveryIDsResponse)
|
|
512
|
+
|
|
513
|
+
async def get_did_recovery_list(self, wallet_id: int) -> Dict[str, Any]:
|
|
514
|
+
request = {"wallet_id": wallet_id}
|
|
515
|
+
response = await self.fetch("did_get_recovery_list", request)
|
|
516
|
+
return response
|
|
517
|
+
|
|
518
|
+
async def did_message_spend(
|
|
519
|
+
self,
|
|
520
|
+
wallet_id: int,
|
|
521
|
+
tx_config: TXConfig,
|
|
522
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
523
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
524
|
+
push: bool = False,
|
|
525
|
+
) -> DIDMessageSpendResponse:
|
|
526
|
+
request = {
|
|
527
|
+
"wallet_id": wallet_id,
|
|
528
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
529
|
+
"push": push,
|
|
530
|
+
**tx_config.to_json_dict(),
|
|
531
|
+
**timelock_info.to_json_dict(),
|
|
532
|
+
}
|
|
533
|
+
response = await self.fetch("did_message_spend", request)
|
|
534
|
+
return json_deserialize_with_clvm_streamable(response, DIDMessageSpendResponse)
|
|
535
|
+
|
|
536
|
+
async def update_did_metadata(
|
|
537
|
+
self,
|
|
538
|
+
wallet_id: int,
|
|
539
|
+
metadata: Dict[str, Any],
|
|
540
|
+
tx_config: TXConfig,
|
|
541
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
542
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
543
|
+
push: bool = True,
|
|
544
|
+
) -> DIDUpdateMetadataResponse:
|
|
545
|
+
request = {
|
|
546
|
+
"wallet_id": wallet_id,
|
|
547
|
+
"metadata": metadata,
|
|
548
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
549
|
+
"push": push,
|
|
550
|
+
**tx_config.to_json_dict(),
|
|
551
|
+
**timelock_info.to_json_dict(),
|
|
552
|
+
}
|
|
553
|
+
response = await self.fetch("did_update_metadata", request)
|
|
554
|
+
return json_deserialize_with_clvm_streamable(response, DIDUpdateMetadataResponse)
|
|
555
|
+
|
|
556
|
+
async def get_did_pubkey(self, request: DIDGetPubkey) -> DIDGetPubkeyResponse:
|
|
557
|
+
return DIDGetPubkeyResponse.from_json_dict(await self.fetch("did_get_pubkey", request.to_json_dict()))
|
|
558
|
+
|
|
559
|
+
async def get_did_metadata(self, wallet_id: int) -> Dict[str, Any]:
|
|
560
|
+
request = {"wallet_id": wallet_id}
|
|
561
|
+
response = await self.fetch("did_get_metadata", request)
|
|
562
|
+
return response
|
|
563
|
+
|
|
564
|
+
async def find_lost_did(
|
|
565
|
+
self,
|
|
566
|
+
coin_id: str,
|
|
567
|
+
recovery_list_hash: Optional[str],
|
|
568
|
+
metadata: Optional[Dict[str, Any]],
|
|
569
|
+
num_verification: Optional[int],
|
|
570
|
+
) -> Dict[str, Any]:
|
|
571
|
+
request: Dict[str, Any] = {"coin_id": coin_id}
|
|
572
|
+
if recovery_list_hash is not None:
|
|
573
|
+
request["recovery_list_hash"] = recovery_list_hash
|
|
574
|
+
if metadata is not None:
|
|
575
|
+
request["metadata"] = (metadata,)
|
|
576
|
+
if num_verification is not None:
|
|
577
|
+
request["num_verification"] = num_verification
|
|
578
|
+
response = await self.fetch("did_find_lost_did", request)
|
|
579
|
+
return response
|
|
580
|
+
|
|
581
|
+
async def create_new_did_wallet_from_recovery(self, filename: str) -> Dict[str, Any]:
|
|
582
|
+
request = {"wallet_type": "did_wallet", "did_type": "recovery", "filename": filename}
|
|
583
|
+
response = await self.fetch("create_new_wallet", request)
|
|
584
|
+
return response
|
|
585
|
+
|
|
586
|
+
async def did_create_attest(
|
|
587
|
+
self,
|
|
588
|
+
wallet_id: int,
|
|
589
|
+
coin_name: str,
|
|
590
|
+
pubkey: str,
|
|
591
|
+
puzhash: str,
|
|
592
|
+
file_name: str,
|
|
593
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
594
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
595
|
+
) -> Dict[str, Any]:
|
|
596
|
+
request = {
|
|
597
|
+
"wallet_id": wallet_id,
|
|
598
|
+
"coin_name": coin_name,
|
|
599
|
+
"pubkey": pubkey,
|
|
600
|
+
"puzhash": puzhash,
|
|
601
|
+
"filename": file_name,
|
|
602
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
603
|
+
**timelock_info.to_json_dict(),
|
|
604
|
+
}
|
|
605
|
+
response = await self.fetch("did_create_attest", request)
|
|
606
|
+
return response
|
|
607
|
+
|
|
608
|
+
async def did_get_recovery_info(self, request: DIDGetRecoveryInfo) -> DIDGetRecoveryInfoResponse:
|
|
609
|
+
return DIDGetRecoveryInfoResponse.from_json_dict(
|
|
610
|
+
await self.fetch("did_get_information_needed_for_recovery", request.to_json_dict())
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
async def did_get_current_coin_info(self, request: DIDGetCurrentCoinInfo) -> DIDGetCurrentCoinInfoResponse:
|
|
614
|
+
return DIDGetCurrentCoinInfoResponse.from_json_dict(
|
|
615
|
+
await self.fetch("did_get_current_coin_info", request.to_json_dict())
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
async def did_recovery_spend(self, wallet_id: int, attest_filenames: str) -> Dict[str, Any]:
|
|
619
|
+
request = {"wallet_id": wallet_id, "attest_filenames": attest_filenames}
|
|
620
|
+
response = await self.fetch("did_recovery_spend", request)
|
|
621
|
+
return response
|
|
622
|
+
|
|
623
|
+
async def did_transfer_did(
|
|
624
|
+
self,
|
|
625
|
+
wallet_id: int,
|
|
626
|
+
address: str,
|
|
627
|
+
fee: int,
|
|
628
|
+
with_recovery: bool,
|
|
629
|
+
tx_config: TXConfig,
|
|
630
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
631
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
632
|
+
push: bool = True,
|
|
633
|
+
) -> DIDTransferDIDResponse:
|
|
634
|
+
request = {
|
|
635
|
+
"wallet_id": wallet_id,
|
|
636
|
+
"inner_address": address,
|
|
637
|
+
"fee": fee,
|
|
638
|
+
"with_recovery_info": with_recovery,
|
|
639
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
640
|
+
"push": push,
|
|
641
|
+
**tx_config.to_json_dict(),
|
|
642
|
+
**timelock_info.to_json_dict(),
|
|
643
|
+
}
|
|
644
|
+
response = await self.fetch("did_transfer_did", request)
|
|
645
|
+
return json_deserialize_with_clvm_streamable(response, DIDTransferDIDResponse)
|
|
646
|
+
|
|
647
|
+
async def did_set_wallet_name(self, wallet_id: int, name: str) -> Dict[str, Any]:
|
|
648
|
+
request = {"wallet_id": wallet_id, "name": name}
|
|
649
|
+
response = await self.fetch("did_set_wallet_name", request)
|
|
650
|
+
return response
|
|
651
|
+
|
|
652
|
+
async def did_get_wallet_name(self, wallet_id: int) -> Dict[str, Any]:
|
|
653
|
+
request = {"wallet_id": wallet_id}
|
|
654
|
+
response = await self.fetch("did_get_wallet_name", request)
|
|
655
|
+
return response
|
|
656
|
+
|
|
657
|
+
# TODO: test all invocations of create_new_pool_wallet with new fee arg.
|
|
658
|
+
async def create_new_pool_wallet(
|
|
659
|
+
self,
|
|
660
|
+
target_puzzlehash: Optional[bytes32],
|
|
661
|
+
pool_url: Optional[str],
|
|
662
|
+
relative_lock_height: uint32,
|
|
663
|
+
backup_host: str,
|
|
664
|
+
mode: str,
|
|
665
|
+
state: str,
|
|
666
|
+
fee: uint64,
|
|
667
|
+
p2_singleton_delay_time: Optional[uint64] = None,
|
|
668
|
+
p2_singleton_delayed_ph: Optional[bytes32] = None,
|
|
669
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
670
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
671
|
+
) -> TransactionRecord:
|
|
672
|
+
request = {
|
|
673
|
+
"wallet_type": "pool_wallet",
|
|
674
|
+
"mode": mode,
|
|
675
|
+
"initial_target_state": {
|
|
676
|
+
"target_puzzle_hash": target_puzzlehash.hex() if target_puzzlehash else None,
|
|
677
|
+
"relative_lock_height": relative_lock_height,
|
|
678
|
+
"pool_url": pool_url,
|
|
679
|
+
"state": state,
|
|
680
|
+
},
|
|
681
|
+
"fee": fee,
|
|
682
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
683
|
+
**timelock_info.to_json_dict(),
|
|
684
|
+
}
|
|
685
|
+
if p2_singleton_delay_time is not None:
|
|
686
|
+
request["p2_singleton_delay_time"] = p2_singleton_delay_time
|
|
687
|
+
if p2_singleton_delayed_ph is not None:
|
|
688
|
+
request["p2_singleton_delayed_ph"] = p2_singleton_delayed_ph.hex()
|
|
689
|
+
res = await self.fetch("create_new_wallet", request)
|
|
690
|
+
return TransactionRecord.from_json_dict(res["transaction"])
|
|
691
|
+
|
|
692
|
+
async def pw_self_pool(self, wallet_id: int, fee: uint64) -> Dict[str, Any]:
|
|
693
|
+
reply = await self.fetch("pw_self_pool", {"wallet_id": wallet_id, "fee": fee})
|
|
694
|
+
reply = parse_result_transactions(reply)
|
|
695
|
+
return reply
|
|
696
|
+
|
|
697
|
+
async def pw_join_pool(
|
|
698
|
+
self, wallet_id: int, target_puzzlehash: bytes32, pool_url: str, relative_lock_height: uint32, fee: uint64
|
|
699
|
+
) -> Dict[str, Any]:
|
|
700
|
+
request = {
|
|
701
|
+
"wallet_id": int(wallet_id),
|
|
702
|
+
"target_puzzlehash": target_puzzlehash.hex(),
|
|
703
|
+
"relative_lock_height": relative_lock_height,
|
|
704
|
+
"pool_url": pool_url,
|
|
705
|
+
"fee": fee,
|
|
706
|
+
}
|
|
707
|
+
reply = await self.fetch("pw_join_pool", request)
|
|
708
|
+
reply = parse_result_transactions(reply)
|
|
709
|
+
return reply
|
|
710
|
+
|
|
711
|
+
async def pw_absorb_rewards(
|
|
712
|
+
self, wallet_id: int, fee: uint64 = uint64(0), max_spends_in_tx: Optional[int] = None
|
|
713
|
+
) -> Dict[str, Any]:
|
|
714
|
+
reply = await self.fetch(
|
|
715
|
+
"pw_absorb_rewards", {"wallet_id": wallet_id, "fee": fee, "max_spends_in_tx": max_spends_in_tx}
|
|
716
|
+
)
|
|
717
|
+
reply["state"] = PoolWalletInfo.from_json_dict(reply["state"])
|
|
718
|
+
reply = parse_result_transactions(reply)
|
|
719
|
+
return reply
|
|
720
|
+
|
|
721
|
+
async def pw_status(self, wallet_id: int) -> Tuple[PoolWalletInfo, List[TransactionRecord]]:
|
|
722
|
+
json_dict = await self.fetch("pw_status", {"wallet_id": wallet_id})
|
|
723
|
+
return (
|
|
724
|
+
PoolWalletInfo.from_json_dict(json_dict["state"]),
|
|
725
|
+
[TransactionRecord.from_json_dict(tr) for tr in json_dict["unconfirmed_transactions"]],
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
# CATS
|
|
729
|
+
async def create_new_cat_and_wallet(
|
|
730
|
+
self, amount: uint64, fee: uint64 = uint64(0), test: bool = False
|
|
731
|
+
) -> Dict[str, Any]:
|
|
732
|
+
request = {"wallet_type": "cat_wallet", "mode": "new", "amount": amount, "fee": fee, "test": test}
|
|
733
|
+
return await self.fetch("create_new_wallet", request)
|
|
734
|
+
|
|
735
|
+
async def create_wallet_for_existing_cat(self, asset_id: bytes) -> Dict[str, Any]:
|
|
736
|
+
request = {"wallet_type": "cat_wallet", "asset_id": asset_id.hex(), "mode": "existing"}
|
|
737
|
+
return await self.fetch("create_new_wallet", request)
|
|
738
|
+
|
|
739
|
+
async def get_cat_asset_id(self, wallet_id: int) -> bytes32:
|
|
740
|
+
request = {"wallet_id": wallet_id}
|
|
741
|
+
return bytes32.from_hexstr((await self.fetch("cat_get_asset_id", request))["asset_id"])
|
|
742
|
+
|
|
743
|
+
async def get_stray_cats(self) -> List[Dict[str, Any]]:
|
|
744
|
+
response = await self.fetch("get_stray_cats", {})
|
|
745
|
+
# TODO: casting due to lack of type checked deserialization
|
|
746
|
+
return cast(List[Dict[str, Any]], response["stray_cats"])
|
|
747
|
+
|
|
748
|
+
async def cat_asset_id_to_name(self, asset_id: bytes32) -> Optional[Tuple[Optional[uint32], str]]:
|
|
749
|
+
request = {"asset_id": asset_id.hex()}
|
|
750
|
+
try:
|
|
751
|
+
res = await self.fetch("cat_asset_id_to_name", request)
|
|
752
|
+
except ValueError:
|
|
753
|
+
return None
|
|
754
|
+
|
|
755
|
+
wallet_id: Optional[uint32] = None if res["wallet_id"] is None else uint32(int(res["wallet_id"]))
|
|
756
|
+
return wallet_id, res["name"]
|
|
757
|
+
|
|
758
|
+
async def get_cat_name(self, wallet_id: int) -> str:
|
|
759
|
+
request = {"wallet_id": wallet_id}
|
|
760
|
+
response = await self.fetch("cat_get_name", request)
|
|
761
|
+
# TODO: casting due to lack of type checked deserialization
|
|
762
|
+
return cast(str, response["name"])
|
|
763
|
+
|
|
764
|
+
async def set_cat_name(self, wallet_id: int, name: str) -> None:
|
|
765
|
+
request: Dict[str, Any] = {
|
|
766
|
+
"wallet_id": wallet_id,
|
|
767
|
+
"name": name,
|
|
768
|
+
}
|
|
769
|
+
await self.fetch("cat_set_name", request)
|
|
770
|
+
|
|
771
|
+
async def cat_spend(
|
|
772
|
+
self,
|
|
773
|
+
wallet_id: int,
|
|
774
|
+
tx_config: TXConfig,
|
|
775
|
+
amount: Optional[uint64] = None,
|
|
776
|
+
inner_address: Optional[str] = None,
|
|
777
|
+
fee: uint64 = uint64(0),
|
|
778
|
+
memos: Optional[List[str]] = None,
|
|
779
|
+
additions: Optional[List[Dict[str, Any]]] = None,
|
|
780
|
+
removals: Optional[List[Coin]] = None,
|
|
781
|
+
cat_discrepancy: Optional[Tuple[int, Program, Program]] = None, # (extra_delta, tail_reveal, tail_solution)
|
|
782
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
783
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
784
|
+
push: bool = True,
|
|
785
|
+
) -> CATSpendResponse:
|
|
786
|
+
send_dict: Dict[str, Any] = {
|
|
787
|
+
"wallet_id": wallet_id,
|
|
788
|
+
"fee": fee,
|
|
789
|
+
"memos": memos if memos is not None else [],
|
|
790
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
791
|
+
"push": push,
|
|
792
|
+
**tx_config.to_json_dict(),
|
|
793
|
+
**timelock_info.to_json_dict(),
|
|
794
|
+
}
|
|
795
|
+
if amount is not None and inner_address is not None:
|
|
796
|
+
send_dict["amount"] = amount
|
|
797
|
+
send_dict["inner_address"] = inner_address
|
|
798
|
+
elif additions is not None:
|
|
799
|
+
additions_hex = []
|
|
800
|
+
for ad in additions:
|
|
801
|
+
additions_hex.append({"amount": ad["amount"], "puzzle_hash": ad["puzzle_hash"].hex()})
|
|
802
|
+
if "memos" in ad:
|
|
803
|
+
additions_hex[-1]["memos"] = ad["memos"]
|
|
804
|
+
send_dict["additions"] = additions_hex
|
|
805
|
+
else:
|
|
806
|
+
raise ValueError("Must specify either amount and inner_address or additions")
|
|
807
|
+
if removals is not None and len(removals) > 0:
|
|
808
|
+
send_dict["coins"] = [c.to_json_dict() for c in removals]
|
|
809
|
+
if cat_discrepancy is not None:
|
|
810
|
+
send_dict["extra_delta"] = cat_discrepancy[0]
|
|
811
|
+
send_dict["tail_reveal"] = bytes(cat_discrepancy[1]).hex()
|
|
812
|
+
send_dict["tail_solution"] = bytes(cat_discrepancy[2]).hex()
|
|
813
|
+
res = await self.fetch("cat_spend", send_dict)
|
|
814
|
+
return json_deserialize_with_clvm_streamable(res, CATSpendResponse)
|
|
815
|
+
|
|
816
|
+
# Offers
|
|
817
|
+
async def create_offer_for_ids(
|
|
818
|
+
self,
|
|
819
|
+
offer_dict: Dict[Union[uint32, str], int],
|
|
820
|
+
tx_config: TXConfig,
|
|
821
|
+
driver_dict: Optional[Dict[str, Any]] = None,
|
|
822
|
+
solver: Optional[Dict[str, Any]] = None,
|
|
823
|
+
fee: int = 0,
|
|
824
|
+
validate_only: bool = False,
|
|
825
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
826
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
827
|
+
) -> CreateOfferForIDsResponse:
|
|
828
|
+
send_dict: Dict[str, int] = {str(key): value for key, value in offer_dict.items()}
|
|
829
|
+
|
|
830
|
+
req = {
|
|
831
|
+
"offer": send_dict,
|
|
832
|
+
"validate_only": validate_only,
|
|
833
|
+
"fee": fee,
|
|
834
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
835
|
+
**tx_config.to_json_dict(),
|
|
836
|
+
**timelock_info.to_json_dict(),
|
|
837
|
+
}
|
|
838
|
+
if driver_dict is not None:
|
|
839
|
+
req["driver_dict"] = driver_dict
|
|
840
|
+
if solver is not None:
|
|
841
|
+
req["solver"] = solver
|
|
842
|
+
res = await self.fetch("create_offer_for_ids", req)
|
|
843
|
+
return json_deserialize_with_clvm_streamable(res, CreateOfferForIDsResponse)
|
|
844
|
+
|
|
845
|
+
async def get_offer_summary(
|
|
846
|
+
self, offer: Offer, advanced: bool = False
|
|
847
|
+
) -> Tuple[bytes32, Dict[str, Dict[str, int]]]:
|
|
848
|
+
res = await self.fetch("get_offer_summary", {"offer": offer.to_bech32(), "advanced": advanced})
|
|
849
|
+
return bytes32.from_hexstr(res["id"]), res["summary"]
|
|
850
|
+
|
|
851
|
+
async def check_offer_validity(self, offer: Offer) -> Tuple[bytes32, bool]:
|
|
852
|
+
res = await self.fetch("check_offer_validity", {"offer": offer.to_bech32()})
|
|
853
|
+
return bytes32.from_hexstr(res["id"]), res["valid"]
|
|
854
|
+
|
|
855
|
+
async def take_offer(
|
|
856
|
+
self,
|
|
857
|
+
offer: Offer,
|
|
858
|
+
tx_config: TXConfig,
|
|
859
|
+
solver: Optional[Dict[str, Any]] = None,
|
|
860
|
+
fee: int = 0,
|
|
861
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
862
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
863
|
+
push: bool = True,
|
|
864
|
+
) -> TakeOfferResponse:
|
|
865
|
+
req = {
|
|
866
|
+
"offer": offer.to_bech32(),
|
|
867
|
+
"fee": fee,
|
|
868
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
869
|
+
"push": push,
|
|
870
|
+
**tx_config.to_json_dict(),
|
|
871
|
+
**timelock_info.to_json_dict(),
|
|
872
|
+
}
|
|
873
|
+
if solver is not None:
|
|
874
|
+
req["solver"] = solver
|
|
875
|
+
res = await self.fetch("take_offer", req)
|
|
876
|
+
return json_deserialize_with_clvm_streamable(res, TakeOfferResponse)
|
|
877
|
+
|
|
878
|
+
async def get_offer(self, trade_id: bytes32, file_contents: bool = False) -> TradeRecord:
|
|
879
|
+
res = await self.fetch("get_offer", {"trade_id": trade_id.hex(), "file_contents": file_contents})
|
|
880
|
+
offer_str = bytes(Offer.from_bech32(res["offer"])).hex() if file_contents else ""
|
|
881
|
+
return TradeRecord.from_json_dict_convenience(res["trade_record"], offer_str)
|
|
882
|
+
|
|
883
|
+
async def get_all_offers(
|
|
884
|
+
self,
|
|
885
|
+
start: int = 0,
|
|
886
|
+
end: int = 50,
|
|
887
|
+
sort_key: Optional[str] = None,
|
|
888
|
+
reverse: bool = False,
|
|
889
|
+
file_contents: bool = False,
|
|
890
|
+
exclude_my_offers: bool = False,
|
|
891
|
+
exclude_taken_offers: bool = False,
|
|
892
|
+
include_completed: bool = False,
|
|
893
|
+
) -> List[TradeRecord]:
|
|
894
|
+
res = await self.fetch(
|
|
895
|
+
"get_all_offers",
|
|
896
|
+
{
|
|
897
|
+
"start": start,
|
|
898
|
+
"end": end,
|
|
899
|
+
"sort_key": sort_key,
|
|
900
|
+
"reverse": reverse,
|
|
901
|
+
"file_contents": file_contents,
|
|
902
|
+
"exclude_my_offers": exclude_my_offers,
|
|
903
|
+
"exclude_taken_offers": exclude_taken_offers,
|
|
904
|
+
"include_completed": include_completed,
|
|
905
|
+
},
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
records = []
|
|
909
|
+
if file_contents:
|
|
910
|
+
optional_offers = [bytes(Offer.from_bech32(o)).hex() for o in res["offers"]]
|
|
911
|
+
else:
|
|
912
|
+
optional_offers = [""] * len(res["trade_records"])
|
|
913
|
+
for record, offer in zip(res["trade_records"], optional_offers):
|
|
914
|
+
records.append(TradeRecord.from_json_dict_convenience(record, offer))
|
|
915
|
+
|
|
916
|
+
return records
|
|
917
|
+
|
|
918
|
+
async def get_offers_count(self) -> GetOffersCountResponse:
|
|
919
|
+
return GetOffersCountResponse.from_json_dict(await self.fetch("get_offers_count", {}))
|
|
920
|
+
|
|
921
|
+
async def cancel_offer(
|
|
922
|
+
self,
|
|
923
|
+
trade_id: bytes32,
|
|
924
|
+
tx_config: TXConfig,
|
|
925
|
+
fee: int = 0,
|
|
926
|
+
secure: bool = True,
|
|
927
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
928
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
929
|
+
push: bool = True,
|
|
930
|
+
) -> CancelOfferResponse:
|
|
931
|
+
res = await self.fetch(
|
|
932
|
+
"cancel_offer",
|
|
933
|
+
{
|
|
934
|
+
"trade_id": trade_id.hex(),
|
|
935
|
+
"secure": secure,
|
|
936
|
+
"fee": fee,
|
|
937
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
938
|
+
"push": push,
|
|
939
|
+
**tx_config.to_json_dict(),
|
|
940
|
+
**timelock_info.to_json_dict(),
|
|
941
|
+
},
|
|
942
|
+
)
|
|
943
|
+
|
|
944
|
+
return json_deserialize_with_clvm_streamable(res, CancelOfferResponse)
|
|
945
|
+
|
|
946
|
+
async def cancel_offers(
|
|
947
|
+
self,
|
|
948
|
+
tx_config: TXConfig,
|
|
949
|
+
batch_fee: int = 0,
|
|
950
|
+
secure: bool = True,
|
|
951
|
+
batch_size: int = 5,
|
|
952
|
+
cancel_all: bool = False,
|
|
953
|
+
asset_id: Optional[bytes32] = None,
|
|
954
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
955
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
956
|
+
push: bool = True,
|
|
957
|
+
) -> CancelOffersResponse:
|
|
958
|
+
res = await self.fetch(
|
|
959
|
+
"cancel_offers",
|
|
960
|
+
{
|
|
961
|
+
"secure": secure,
|
|
962
|
+
"batch_fee": batch_fee,
|
|
963
|
+
"secure": secure,
|
|
964
|
+
"batch_size": batch_size,
|
|
965
|
+
"cancel_all": cancel_all,
|
|
966
|
+
"asset_id": None if asset_id is None else asset_id.hex(),
|
|
967
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
968
|
+
"push": push,
|
|
969
|
+
**tx_config.to_json_dict(),
|
|
970
|
+
**timelock_info.to_json_dict(),
|
|
971
|
+
},
|
|
972
|
+
)
|
|
973
|
+
|
|
974
|
+
return json_deserialize_with_clvm_streamable(res, CancelOffersResponse)
|
|
975
|
+
|
|
976
|
+
async def get_cat_list(self) -> GetCATListResponse:
|
|
977
|
+
return GetCATListResponse.from_json_dict(await self.fetch("get_cat_list", {}))
|
|
978
|
+
|
|
979
|
+
# NFT wallet
|
|
980
|
+
async def create_new_nft_wallet(self, did_id: Optional[str], name: Optional[str] = None) -> Dict[str, Any]:
|
|
981
|
+
request = {"wallet_type": "nft_wallet", "did_id": did_id, "name": name}
|
|
982
|
+
response = await self.fetch("create_new_wallet", request)
|
|
983
|
+
return response
|
|
984
|
+
|
|
985
|
+
async def mint_nft(
|
|
986
|
+
self,
|
|
987
|
+
wallet_id: int,
|
|
988
|
+
royalty_address: Optional[str],
|
|
989
|
+
target_address: Optional[str],
|
|
990
|
+
hash: str,
|
|
991
|
+
uris: List[str],
|
|
992
|
+
tx_config: TXConfig,
|
|
993
|
+
meta_hash: Optional[str] = "",
|
|
994
|
+
meta_uris: List[str] = [],
|
|
995
|
+
license_hash: Optional[str] = "",
|
|
996
|
+
license_uris: List[str] = [],
|
|
997
|
+
edition_total: Optional[int] = 1,
|
|
998
|
+
edition_number: Optional[int] = 1,
|
|
999
|
+
fee: int = 0,
|
|
1000
|
+
royalty_percentage: int = 0,
|
|
1001
|
+
did_id: Optional[str] = None,
|
|
1002
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1003
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1004
|
+
push: bool = True,
|
|
1005
|
+
) -> NFTMintNFTResponse:
|
|
1006
|
+
request = {
|
|
1007
|
+
"wallet_id": wallet_id,
|
|
1008
|
+
"royalty_address": royalty_address,
|
|
1009
|
+
"target_address": target_address,
|
|
1010
|
+
"hash": hash,
|
|
1011
|
+
"uris": uris,
|
|
1012
|
+
"meta_hash": meta_hash,
|
|
1013
|
+
"meta_uris": meta_uris,
|
|
1014
|
+
"license_hash": license_hash,
|
|
1015
|
+
"license_uris": license_uris,
|
|
1016
|
+
"edition_number": edition_number,
|
|
1017
|
+
"edition_total": edition_total,
|
|
1018
|
+
"royalty_percentage": royalty_percentage,
|
|
1019
|
+
"did_id": did_id,
|
|
1020
|
+
"fee": fee,
|
|
1021
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1022
|
+
"push": push,
|
|
1023
|
+
**tx_config.to_json_dict(),
|
|
1024
|
+
**timelock_info.to_json_dict(),
|
|
1025
|
+
}
|
|
1026
|
+
response = await self.fetch("nft_mint_nft", request)
|
|
1027
|
+
return json_deserialize_with_clvm_streamable(response, NFTMintNFTResponse)
|
|
1028
|
+
|
|
1029
|
+
async def add_uri_to_nft(
|
|
1030
|
+
self,
|
|
1031
|
+
wallet_id: int,
|
|
1032
|
+
nft_coin_id: str,
|
|
1033
|
+
key: str,
|
|
1034
|
+
uri: str,
|
|
1035
|
+
fee: int,
|
|
1036
|
+
tx_config: TXConfig,
|
|
1037
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1038
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1039
|
+
push: bool = True,
|
|
1040
|
+
) -> NFTAddURIResponse:
|
|
1041
|
+
request = {
|
|
1042
|
+
"wallet_id": wallet_id,
|
|
1043
|
+
"nft_coin_id": nft_coin_id,
|
|
1044
|
+
"uri": uri,
|
|
1045
|
+
"key": key,
|
|
1046
|
+
"fee": fee,
|
|
1047
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1048
|
+
"push": push,
|
|
1049
|
+
**tx_config.to_json_dict(),
|
|
1050
|
+
**timelock_info.to_json_dict(),
|
|
1051
|
+
}
|
|
1052
|
+
response = await self.fetch("nft_add_uri", request)
|
|
1053
|
+
return json_deserialize_with_clvm_streamable(response, NFTAddURIResponse)
|
|
1054
|
+
|
|
1055
|
+
async def nft_calculate_royalties(
|
|
1056
|
+
self,
|
|
1057
|
+
royalty_assets_dict: Dict[Any, Tuple[Any, uint16]],
|
|
1058
|
+
fungible_asset_dict: Dict[Any, uint64],
|
|
1059
|
+
) -> Dict[str, List[Dict[str, Any]]]:
|
|
1060
|
+
request = {
|
|
1061
|
+
"royalty_assets": [
|
|
1062
|
+
{"asset": id, "royalty_address": royalty_info[0], "royalty_percentage": royalty_info[1]}
|
|
1063
|
+
for id, royalty_info in royalty_assets_dict.items()
|
|
1064
|
+
],
|
|
1065
|
+
"fungible_assets": [{"asset": name, "amount": amount} for name, amount in fungible_asset_dict.items()],
|
|
1066
|
+
}
|
|
1067
|
+
response = await self.fetch("nft_calculate_royalties", request)
|
|
1068
|
+
del response["success"]
|
|
1069
|
+
return response
|
|
1070
|
+
|
|
1071
|
+
async def get_nft_info(self, coin_id: str, latest: bool = True) -> Dict[str, Any]:
|
|
1072
|
+
request = {"coin_id": coin_id, "latest": latest}
|
|
1073
|
+
response = await self.fetch("nft_get_info", request)
|
|
1074
|
+
return response
|
|
1075
|
+
|
|
1076
|
+
async def transfer_nft(
|
|
1077
|
+
self,
|
|
1078
|
+
wallet_id: int,
|
|
1079
|
+
nft_coin_id: str,
|
|
1080
|
+
target_address: str,
|
|
1081
|
+
fee: int,
|
|
1082
|
+
tx_config: TXConfig,
|
|
1083
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1084
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1085
|
+
push: bool = True,
|
|
1086
|
+
) -> NFTTransferNFTResponse:
|
|
1087
|
+
request = {
|
|
1088
|
+
"wallet_id": wallet_id,
|
|
1089
|
+
"nft_coin_id": nft_coin_id,
|
|
1090
|
+
"target_address": target_address,
|
|
1091
|
+
"fee": fee,
|
|
1092
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1093
|
+
"push": push,
|
|
1094
|
+
**tx_config.to_json_dict(),
|
|
1095
|
+
**timelock_info.to_json_dict(),
|
|
1096
|
+
}
|
|
1097
|
+
response = await self.fetch("nft_transfer_nft", request)
|
|
1098
|
+
return json_deserialize_with_clvm_streamable(response, NFTTransferNFTResponse)
|
|
1099
|
+
|
|
1100
|
+
async def count_nfts(self, wallet_id: Optional[int]) -> Dict[str, Any]:
|
|
1101
|
+
request = {"wallet_id": wallet_id}
|
|
1102
|
+
response = await self.fetch("nft_count_nfts", request)
|
|
1103
|
+
return response
|
|
1104
|
+
|
|
1105
|
+
async def list_nfts(self, wallet_id: int, num: int = 50, start_index: int = 0) -> Dict[str, Any]:
|
|
1106
|
+
request = {"wallet_id": wallet_id, "num": num, "start_index": start_index}
|
|
1107
|
+
response = await self.fetch("nft_get_nfts", request)
|
|
1108
|
+
return response
|
|
1109
|
+
|
|
1110
|
+
async def get_nft_wallet_by_did(self, request: NFTGetByDID) -> NFTGetByDIDResponse:
|
|
1111
|
+
return NFTGetByDIDResponse.from_json_dict(await self.fetch("nft_get_by_did", request.to_json_dict()))
|
|
1112
|
+
|
|
1113
|
+
async def set_nft_did(
|
|
1114
|
+
self,
|
|
1115
|
+
wallet_id: int,
|
|
1116
|
+
did_id: Optional[str],
|
|
1117
|
+
nft_coin_id: str,
|
|
1118
|
+
fee: int,
|
|
1119
|
+
tx_config: TXConfig,
|
|
1120
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1121
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1122
|
+
push: bool = True,
|
|
1123
|
+
) -> NFTSetNFTDIDResponse:
|
|
1124
|
+
request = {
|
|
1125
|
+
"wallet_id": wallet_id,
|
|
1126
|
+
"nft_coin_id": nft_coin_id,
|
|
1127
|
+
"fee": fee,
|
|
1128
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1129
|
+
"push": push,
|
|
1130
|
+
**tx_config.to_json_dict(),
|
|
1131
|
+
**timelock_info.to_json_dict(),
|
|
1132
|
+
}
|
|
1133
|
+
if did_id is not None:
|
|
1134
|
+
request["did_id"] = did_id
|
|
1135
|
+
response = await self.fetch("nft_set_nft_did", request)
|
|
1136
|
+
return json_deserialize_with_clvm_streamable(response, NFTSetNFTDIDResponse)
|
|
1137
|
+
|
|
1138
|
+
async def set_nft_status(self, request: NFTSetNFTStatus) -> None:
|
|
1139
|
+
await self.fetch("nft_set_nft_status", request.to_json_dict())
|
|
1140
|
+
|
|
1141
|
+
async def get_nft_wallet_did(self, wallet_id: int) -> Dict[str, Any]:
|
|
1142
|
+
request = {"wallet_id": wallet_id}
|
|
1143
|
+
response = await self.fetch("nft_get_wallet_did", request)
|
|
1144
|
+
return response
|
|
1145
|
+
|
|
1146
|
+
async def get_nft_wallets_with_dids(self) -> NFTGetWalletsWithDIDsResponse:
|
|
1147
|
+
return NFTGetWalletsWithDIDsResponse.from_json_dict(await self.fetch("nft_get_wallets_with_dids", {}))
|
|
1148
|
+
|
|
1149
|
+
async def nft_mint_bulk(
|
|
1150
|
+
self,
|
|
1151
|
+
wallet_id: int,
|
|
1152
|
+
metadata_list: List[Dict[str, Any]],
|
|
1153
|
+
royalty_percentage: Optional[int],
|
|
1154
|
+
royalty_address: Optional[str],
|
|
1155
|
+
tx_config: TXConfig,
|
|
1156
|
+
target_list: Optional[List[str]] = None,
|
|
1157
|
+
mint_number_start: Optional[int] = 1,
|
|
1158
|
+
mint_total: Optional[int] = None,
|
|
1159
|
+
xch_coins: Optional[List[Dict[str, Any]]] = None,
|
|
1160
|
+
xch_change_target: Optional[str] = None,
|
|
1161
|
+
new_innerpuzhash: Optional[str] = None,
|
|
1162
|
+
did_coin: Optional[Dict[str, Any]] = None,
|
|
1163
|
+
did_lineage_parent: Optional[str] = None,
|
|
1164
|
+
mint_from_did: Optional[bool] = False,
|
|
1165
|
+
fee: Optional[int] = 0,
|
|
1166
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1167
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1168
|
+
push: bool = False,
|
|
1169
|
+
) -> NFTMintBulkResponse:
|
|
1170
|
+
request = {
|
|
1171
|
+
"wallet_id": wallet_id,
|
|
1172
|
+
"metadata_list": metadata_list,
|
|
1173
|
+
"target_list": target_list,
|
|
1174
|
+
"royalty_percentage": royalty_percentage,
|
|
1175
|
+
"royalty_address": royalty_address,
|
|
1176
|
+
"mint_number_start": mint_number_start,
|
|
1177
|
+
"mint_total": mint_total,
|
|
1178
|
+
"xch_coins": xch_coins,
|
|
1179
|
+
"xch_change_target": xch_change_target,
|
|
1180
|
+
"new_innerpuzhash": new_innerpuzhash,
|
|
1181
|
+
"did_coin": did_coin,
|
|
1182
|
+
"did_lineage_parent": did_lineage_parent,
|
|
1183
|
+
"mint_from_did": mint_from_did,
|
|
1184
|
+
"fee": fee,
|
|
1185
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1186
|
+
"push": push,
|
|
1187
|
+
**tx_config.to_json_dict(),
|
|
1188
|
+
**timelock_info.to_json_dict(),
|
|
1189
|
+
}
|
|
1190
|
+
response = await self.fetch("nft_mint_bulk", request)
|
|
1191
|
+
return json_deserialize_with_clvm_streamable(response, NFTMintBulkResponse)
|
|
1192
|
+
|
|
1193
|
+
async def set_nft_did_bulk(
|
|
1194
|
+
self,
|
|
1195
|
+
request: NFTSetDIDBulk,
|
|
1196
|
+
tx_config: TXConfig,
|
|
1197
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1198
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1199
|
+
) -> NFTSetDIDBulkResponse:
|
|
1200
|
+
return NFTSetDIDBulkResponse.from_json_dict(
|
|
1201
|
+
await self.fetch(
|
|
1202
|
+
"nft_set_did_bulk", request.json_serialize_for_transport(tx_config, extra_conditions, timelock_info)
|
|
1203
|
+
)
|
|
1204
|
+
)
|
|
1205
|
+
|
|
1206
|
+
async def transfer_nft_bulk(
|
|
1207
|
+
self,
|
|
1208
|
+
request: NFTTransferBulk,
|
|
1209
|
+
tx_config: TXConfig,
|
|
1210
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1211
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1212
|
+
) -> NFTTransferBulkResponse:
|
|
1213
|
+
return NFTTransferBulkResponse.from_json_dict(
|
|
1214
|
+
await self.fetch(
|
|
1215
|
+
"nft_transfer_bulk", request.json_serialize_for_transport(tx_config, extra_conditions, timelock_info)
|
|
1216
|
+
)
|
|
1217
|
+
)
|
|
1218
|
+
|
|
1219
|
+
# DataLayer
|
|
1220
|
+
async def create_new_dl(
|
|
1221
|
+
self,
|
|
1222
|
+
root: bytes32,
|
|
1223
|
+
fee: uint64,
|
|
1224
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1225
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1226
|
+
) -> Tuple[List[TransactionRecord], bytes32]:
|
|
1227
|
+
request = {
|
|
1228
|
+
"root": root.hex(),
|
|
1229
|
+
"fee": fee,
|
|
1230
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1231
|
+
**timelock_info.to_json_dict(),
|
|
1232
|
+
}
|
|
1233
|
+
response = await self.fetch("create_new_dl", request)
|
|
1234
|
+
txs = [TransactionRecord.from_json_dict_convenience(tx) for tx in response["transactions"]]
|
|
1235
|
+
launcher_id = bytes32.from_hexstr(response["launcher_id"])
|
|
1236
|
+
return txs, launcher_id
|
|
1237
|
+
|
|
1238
|
+
async def dl_track_new(self, launcher_id: bytes32) -> None:
|
|
1239
|
+
request = {"launcher_id": launcher_id.hex()}
|
|
1240
|
+
await self.fetch("dl_track_new", request)
|
|
1241
|
+
|
|
1242
|
+
async def dl_stop_tracking(self, launcher_id: bytes32) -> None:
|
|
1243
|
+
request = {"launcher_id": launcher_id.hex()}
|
|
1244
|
+
await self.fetch("dl_stop_tracking", request)
|
|
1245
|
+
|
|
1246
|
+
async def dl_latest_singleton(
|
|
1247
|
+
self, launcher_id: bytes32, only_confirmed: bool = False
|
|
1248
|
+
) -> Optional[SingletonRecord]:
|
|
1249
|
+
request = {"launcher_id": launcher_id.hex(), "only_confirmed": only_confirmed}
|
|
1250
|
+
response = await self.fetch("dl_latest_singleton", request)
|
|
1251
|
+
return None if response["singleton"] is None else SingletonRecord.from_json_dict(response["singleton"])
|
|
1252
|
+
|
|
1253
|
+
async def dl_singletons_by_root(self, launcher_id: bytes32, root: bytes32) -> List[SingletonRecord]:
|
|
1254
|
+
request = {"launcher_id": launcher_id.hex(), "root": root.hex()}
|
|
1255
|
+
response = await self.fetch("dl_singletons_by_root", request)
|
|
1256
|
+
return [SingletonRecord.from_json_dict(single) for single in response["singletons"]]
|
|
1257
|
+
|
|
1258
|
+
async def dl_update_root(
|
|
1259
|
+
self,
|
|
1260
|
+
launcher_id: bytes32,
|
|
1261
|
+
new_root: bytes32,
|
|
1262
|
+
fee: uint64,
|
|
1263
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1264
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1265
|
+
) -> TransactionRecord:
|
|
1266
|
+
request = {
|
|
1267
|
+
"launcher_id": launcher_id.hex(),
|
|
1268
|
+
"new_root": new_root.hex(),
|
|
1269
|
+
"fee": fee,
|
|
1270
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1271
|
+
**timelock_info.to_json_dict(),
|
|
1272
|
+
}
|
|
1273
|
+
response = await self.fetch("dl_update_root", request)
|
|
1274
|
+
return TransactionRecord.from_json_dict_convenience(response["tx_record"])
|
|
1275
|
+
|
|
1276
|
+
async def dl_update_multiple(
|
|
1277
|
+
self,
|
|
1278
|
+
update_dictionary: Dict[bytes32, bytes32],
|
|
1279
|
+
fee: uint64,
|
|
1280
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1281
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1282
|
+
) -> List[TransactionRecord]:
|
|
1283
|
+
updates_as_strings = {str(lid): str(root) for lid, root in update_dictionary.items()}
|
|
1284
|
+
request = {
|
|
1285
|
+
"updates": updates_as_strings,
|
|
1286
|
+
"fee": fee,
|
|
1287
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1288
|
+
**timelock_info.to_json_dict(),
|
|
1289
|
+
}
|
|
1290
|
+
response = await self.fetch("dl_update_multiple", request)
|
|
1291
|
+
return [TransactionRecord.from_json_dict_convenience(tx) for tx in response["transactions"]]
|
|
1292
|
+
|
|
1293
|
+
async def dl_history(
|
|
1294
|
+
self,
|
|
1295
|
+
launcher_id: bytes32,
|
|
1296
|
+
min_generation: Optional[uint32] = None,
|
|
1297
|
+
max_generation: Optional[uint32] = None,
|
|
1298
|
+
num_results: Optional[uint32] = None,
|
|
1299
|
+
) -> List[SingletonRecord]:
|
|
1300
|
+
request = {"launcher_id": launcher_id.hex()}
|
|
1301
|
+
|
|
1302
|
+
if min_generation is not None:
|
|
1303
|
+
request["min_generation"] = str(min_generation)
|
|
1304
|
+
if max_generation is not None:
|
|
1305
|
+
request["max_generation"] = str(max_generation)
|
|
1306
|
+
if num_results is not None:
|
|
1307
|
+
request["num_results"] = str(num_results)
|
|
1308
|
+
|
|
1309
|
+
response = await self.fetch("dl_history", request)
|
|
1310
|
+
return [SingletonRecord.from_json_dict(single) for single in response["history"]]
|
|
1311
|
+
|
|
1312
|
+
async def dl_owned_singletons(self) -> List[SingletonRecord]:
|
|
1313
|
+
response = await self.fetch(path="dl_owned_singletons", request_json={})
|
|
1314
|
+
return [SingletonRecord.from_json_dict(singleton) for singleton in response["singletons"]]
|
|
1315
|
+
|
|
1316
|
+
async def dl_get_mirrors(self, launcher_id: bytes32) -> List[Mirror]:
|
|
1317
|
+
response = await self.fetch(path="dl_get_mirrors", request_json={"launcher_id": launcher_id.hex()})
|
|
1318
|
+
return [Mirror.from_json_dict(mirror) for mirror in response["mirrors"]]
|
|
1319
|
+
|
|
1320
|
+
async def dl_new_mirror(
|
|
1321
|
+
self,
|
|
1322
|
+
launcher_id: bytes32,
|
|
1323
|
+
amount: uint64,
|
|
1324
|
+
urls: List[bytes],
|
|
1325
|
+
fee: uint64 = uint64(0),
|
|
1326
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1327
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1328
|
+
) -> List[TransactionRecord]:
|
|
1329
|
+
response = await self.fetch(
|
|
1330
|
+
path="dl_new_mirror",
|
|
1331
|
+
request_json={
|
|
1332
|
+
"launcher_id": launcher_id.hex(),
|
|
1333
|
+
"amount": amount,
|
|
1334
|
+
"urls": [url.decode("utf8") for url in urls],
|
|
1335
|
+
"fee": fee,
|
|
1336
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1337
|
+
**timelock_info.to_json_dict(),
|
|
1338
|
+
},
|
|
1339
|
+
)
|
|
1340
|
+
return [TransactionRecord.from_json_dict_convenience(tx) for tx in response["transactions"]]
|
|
1341
|
+
|
|
1342
|
+
async def dl_delete_mirror(
|
|
1343
|
+
self,
|
|
1344
|
+
coin_id: bytes32,
|
|
1345
|
+
fee: uint64 = uint64(0),
|
|
1346
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1347
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1348
|
+
) -> List[TransactionRecord]:
|
|
1349
|
+
response = await self.fetch(
|
|
1350
|
+
path="dl_delete_mirror",
|
|
1351
|
+
request_json={
|
|
1352
|
+
"coin_id": coin_id.hex(),
|
|
1353
|
+
"fee": fee,
|
|
1354
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1355
|
+
**timelock_info.to_json_dict(),
|
|
1356
|
+
},
|
|
1357
|
+
)
|
|
1358
|
+
return [TransactionRecord.from_json_dict_convenience(tx) for tx in response["transactions"]]
|
|
1359
|
+
|
|
1360
|
+
async def dl_verify_proof(self, request: DLProof) -> VerifyProofResponse:
|
|
1361
|
+
response = await self.fetch(path="dl_verify_proof", request_json=request.to_json_dict())
|
|
1362
|
+
return json_deserialize_with_clvm_streamable(response, VerifyProofResponse)
|
|
1363
|
+
|
|
1364
|
+
async def get_notifications(self, request: GetNotifications) -> GetNotificationsResponse:
|
|
1365
|
+
response = await self.fetch("get_notifications", request.to_json_dict())
|
|
1366
|
+
return json_deserialize_with_clvm_streamable(response, GetNotificationsResponse)
|
|
1367
|
+
|
|
1368
|
+
async def delete_notifications(self, ids: Optional[Sequence[bytes32]] = None) -> bool:
|
|
1369
|
+
request = {}
|
|
1370
|
+
if ids is not None:
|
|
1371
|
+
request["ids"] = [id.hex() for id in ids]
|
|
1372
|
+
response = await self.fetch("delete_notifications", request)
|
|
1373
|
+
# TODO: casting due to lack of type checked deserialization
|
|
1374
|
+
result = cast(bool, response["success"])
|
|
1375
|
+
return result
|
|
1376
|
+
|
|
1377
|
+
async def send_notification(
|
|
1378
|
+
self,
|
|
1379
|
+
target: bytes32,
|
|
1380
|
+
msg: bytes,
|
|
1381
|
+
amount: uint64,
|
|
1382
|
+
fee: uint64 = uint64(0),
|
|
1383
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1384
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1385
|
+
push: bool = True,
|
|
1386
|
+
) -> TransactionRecord:
|
|
1387
|
+
response = await self.fetch(
|
|
1388
|
+
"send_notification",
|
|
1389
|
+
{
|
|
1390
|
+
"target": target.hex(),
|
|
1391
|
+
"message": msg.hex(),
|
|
1392
|
+
"amount": amount,
|
|
1393
|
+
"fee": fee,
|
|
1394
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1395
|
+
"push": push,
|
|
1396
|
+
**timelock_info.to_json_dict(),
|
|
1397
|
+
},
|
|
1398
|
+
)
|
|
1399
|
+
return TransactionRecord.from_json_dict_convenience(response["tx"])
|
|
1400
|
+
|
|
1401
|
+
async def sign_message_by_address(self, address: str, message: str) -> Tuple[str, str, str]:
|
|
1402
|
+
response = await self.fetch("sign_message_by_address", {"address": address, "message": message})
|
|
1403
|
+
return response["pubkey"], response["signature"], response["signing_mode"]
|
|
1404
|
+
|
|
1405
|
+
async def sign_message_by_id(
|
|
1406
|
+
self, id: str, message: str, is_hex: bool = False, safe_mode: bool = True
|
|
1407
|
+
) -> Tuple[str, str, str]:
|
|
1408
|
+
response = await self.fetch(
|
|
1409
|
+
"sign_message_by_id", {"id": id, "message": message, "is_hex": is_hex, "safe_mode": safe_mode}
|
|
1410
|
+
)
|
|
1411
|
+
return response["pubkey"], response["signature"], response["signing_mode"]
|
|
1412
|
+
|
|
1413
|
+
async def verify_signature(self, request: VerifySignature) -> VerifySignatureResponse:
|
|
1414
|
+
return VerifySignatureResponse.from_json_dict(await self.fetch("verify_signature", {**request.to_json_dict()}))
|
|
1415
|
+
|
|
1416
|
+
async def get_transaction_memo(self, request: GetTransactionMemo) -> GetTransactionMemoResponse:
|
|
1417
|
+
return GetTransactionMemoResponse.from_json_dict(
|
|
1418
|
+
await self.fetch("get_transaction_memo", {**request.to_json_dict()})
|
|
1419
|
+
)
|
|
1420
|
+
|
|
1421
|
+
# DAOs
|
|
1422
|
+
async def create_new_dao_wallet(
|
|
1423
|
+
self,
|
|
1424
|
+
mode: str,
|
|
1425
|
+
tx_config: TXConfig,
|
|
1426
|
+
dao_rules: Optional[Dict[str, uint64]] = None,
|
|
1427
|
+
amount_of_cats: Optional[uint64] = None,
|
|
1428
|
+
treasury_id: Optional[bytes32] = None,
|
|
1429
|
+
filter_amount: uint64 = uint64(1),
|
|
1430
|
+
name: Optional[str] = None,
|
|
1431
|
+
fee: uint64 = uint64(0),
|
|
1432
|
+
fee_for_cat: uint64 = uint64(0),
|
|
1433
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1434
|
+
push: bool = True,
|
|
1435
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1436
|
+
) -> CreateNewDAOWalletResponse:
|
|
1437
|
+
request: Dict[str, Any] = {
|
|
1438
|
+
"wallet_type": "dao_wallet",
|
|
1439
|
+
"mode": mode,
|
|
1440
|
+
"treasury_id": treasury_id.hex() if treasury_id is not None else treasury_id,
|
|
1441
|
+
"dao_rules": dao_rules,
|
|
1442
|
+
"amount_of_cats": amount_of_cats,
|
|
1443
|
+
"filter_amount": filter_amount,
|
|
1444
|
+
"name": name,
|
|
1445
|
+
"fee": fee,
|
|
1446
|
+
"fee_for_cat": fee_for_cat,
|
|
1447
|
+
"extra_conditions": list(extra_conditions),
|
|
1448
|
+
"push": push,
|
|
1449
|
+
**tx_config.to_json_dict(),
|
|
1450
|
+
**timelock_info.to_json_dict(),
|
|
1451
|
+
}
|
|
1452
|
+
response = await self.fetch("create_new_wallet", request)
|
|
1453
|
+
return json_deserialize_with_clvm_streamable(response, CreateNewDAOWalletResponse)
|
|
1454
|
+
|
|
1455
|
+
async def dao_get_treasury_id(self, wallet_id: int) -> Dict[str, Any]:
|
|
1456
|
+
request = {"wallet_id": wallet_id}
|
|
1457
|
+
response = await self.fetch("dao_get_treasury_id", request)
|
|
1458
|
+
return response
|
|
1459
|
+
|
|
1460
|
+
async def dao_get_rules(self, wallet_id: int) -> Dict[str, Any]:
|
|
1461
|
+
request = {"wallet_id": wallet_id}
|
|
1462
|
+
response = await self.fetch("dao_get_rules", request)
|
|
1463
|
+
return response
|
|
1464
|
+
|
|
1465
|
+
async def dao_create_proposal(
|
|
1466
|
+
self,
|
|
1467
|
+
wallet_id: int,
|
|
1468
|
+
proposal_type: str,
|
|
1469
|
+
tx_config: TXConfig,
|
|
1470
|
+
additions: Optional[List[Dict[str, Any]]] = None,
|
|
1471
|
+
amount: Optional[uint64] = None,
|
|
1472
|
+
inner_address: Optional[str] = None,
|
|
1473
|
+
asset_id: Optional[str] = None,
|
|
1474
|
+
cat_target_address: Optional[str] = None,
|
|
1475
|
+
vote_amount: Optional[int] = None,
|
|
1476
|
+
new_dao_rules: Optional[Dict[str, Optional[uint64]]] = None,
|
|
1477
|
+
fee: uint64 = uint64(0),
|
|
1478
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1479
|
+
push: bool = True,
|
|
1480
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1481
|
+
) -> DAOCreateProposalResponse:
|
|
1482
|
+
request: Dict[str, Any] = {
|
|
1483
|
+
"wallet_id": wallet_id,
|
|
1484
|
+
"proposal_type": proposal_type,
|
|
1485
|
+
"additions": additions,
|
|
1486
|
+
"amount": amount,
|
|
1487
|
+
"inner_address": inner_address,
|
|
1488
|
+
"asset_id": asset_id,
|
|
1489
|
+
"cat_target_address": cat_target_address,
|
|
1490
|
+
"vote_amount": vote_amount,
|
|
1491
|
+
"new_dao_rules": new_dao_rules,
|
|
1492
|
+
"fee": fee,
|
|
1493
|
+
"extra_conditions": list(extra_conditions),
|
|
1494
|
+
**tx_config.to_json_dict(),
|
|
1495
|
+
**timelock_info.to_json_dict(),
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
response = await self.fetch("dao_create_proposal", request)
|
|
1499
|
+
return json_deserialize_with_clvm_streamable(response, DAOCreateProposalResponse)
|
|
1500
|
+
|
|
1501
|
+
async def dao_get_proposal_state(self, wallet_id: int, proposal_id: str) -> Dict[str, Any]:
|
|
1502
|
+
request = {"wallet_id": wallet_id, "proposal_id": proposal_id}
|
|
1503
|
+
response = await self.fetch("dao_get_proposal_state", request)
|
|
1504
|
+
return response
|
|
1505
|
+
|
|
1506
|
+
async def dao_parse_proposal(self, wallet_id: int, proposal_id: str) -> Dict[str, Any]:
|
|
1507
|
+
request = {"wallet_id": wallet_id, "proposal_id": proposal_id}
|
|
1508
|
+
response = await self.fetch("dao_parse_proposal", request)
|
|
1509
|
+
return response
|
|
1510
|
+
|
|
1511
|
+
async def dao_vote_on_proposal(
|
|
1512
|
+
self,
|
|
1513
|
+
wallet_id: int,
|
|
1514
|
+
proposal_id: str,
|
|
1515
|
+
vote_amount: uint64,
|
|
1516
|
+
tx_config: TXConfig,
|
|
1517
|
+
is_yes_vote: bool = True,
|
|
1518
|
+
fee: uint64 = uint64(0),
|
|
1519
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1520
|
+
push: bool = True,
|
|
1521
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1522
|
+
) -> DAOVoteOnProposalResponse:
|
|
1523
|
+
request: Dict[str, Any] = {
|
|
1524
|
+
"wallet_id": wallet_id,
|
|
1525
|
+
"proposal_id": proposal_id,
|
|
1526
|
+
"vote_amount": vote_amount,
|
|
1527
|
+
"is_yes_vote": is_yes_vote,
|
|
1528
|
+
"fee": fee,
|
|
1529
|
+
"extra_conditions": list(extra_conditions),
|
|
1530
|
+
"push": push,
|
|
1531
|
+
**tx_config.to_json_dict(),
|
|
1532
|
+
**timelock_info.to_json_dict(),
|
|
1533
|
+
}
|
|
1534
|
+
response = await self.fetch("dao_vote_on_proposal", request)
|
|
1535
|
+
return json_deserialize_with_clvm_streamable(response, DAOVoteOnProposalResponse)
|
|
1536
|
+
|
|
1537
|
+
async def dao_get_proposals(self, wallet_id: int, include_closed: bool = True) -> Dict[str, Any]:
|
|
1538
|
+
request = {"wallet_id": wallet_id, "include_closed": include_closed}
|
|
1539
|
+
response = await self.fetch("dao_get_proposals", request)
|
|
1540
|
+
return response
|
|
1541
|
+
|
|
1542
|
+
async def dao_close_proposal(
|
|
1543
|
+
self,
|
|
1544
|
+
wallet_id: int,
|
|
1545
|
+
proposal_id: str,
|
|
1546
|
+
tx_config: TXConfig,
|
|
1547
|
+
self_destruct: Optional[bool] = None,
|
|
1548
|
+
fee: uint64 = uint64(0),
|
|
1549
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1550
|
+
push: bool = True,
|
|
1551
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1552
|
+
) -> DAOCloseProposalResponse:
|
|
1553
|
+
request: Dict[str, Any] = {
|
|
1554
|
+
"wallet_id": wallet_id,
|
|
1555
|
+
"proposal_id": proposal_id,
|
|
1556
|
+
"self_destruct": self_destruct,
|
|
1557
|
+
"fee": fee,
|
|
1558
|
+
"extra_conditions": list(extra_conditions),
|
|
1559
|
+
"push": push,
|
|
1560
|
+
**tx_config.to_json_dict(),
|
|
1561
|
+
**timelock_info.to_json_dict(),
|
|
1562
|
+
}
|
|
1563
|
+
response = await self.fetch("dao_close_proposal", request)
|
|
1564
|
+
return json_deserialize_with_clvm_streamable(response, DAOCloseProposalResponse)
|
|
1565
|
+
|
|
1566
|
+
async def dao_free_coins_from_finished_proposals(
|
|
1567
|
+
self,
|
|
1568
|
+
wallet_id: int,
|
|
1569
|
+
tx_config: TXConfig,
|
|
1570
|
+
fee: uint64 = uint64(0),
|
|
1571
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1572
|
+
push: bool = True,
|
|
1573
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1574
|
+
) -> DAOFreeCoinsFromFinishedProposalsResponse:
|
|
1575
|
+
request: Dict[str, Any] = {
|
|
1576
|
+
"wallet_id": wallet_id,
|
|
1577
|
+
"fee": fee,
|
|
1578
|
+
"extra_conditions": list(extra_conditions),
|
|
1579
|
+
**tx_config.to_json_dict(),
|
|
1580
|
+
**timelock_info.to_json_dict(),
|
|
1581
|
+
}
|
|
1582
|
+
response = await self.fetch("dao_free_coins_from_finished_proposals", request)
|
|
1583
|
+
return json_deserialize_with_clvm_streamable(response, DAOFreeCoinsFromFinishedProposalsResponse)
|
|
1584
|
+
|
|
1585
|
+
async def dao_get_treasury_balance(self, wallet_id: int) -> Dict[str, Any]:
|
|
1586
|
+
request = {"wallet_id": wallet_id}
|
|
1587
|
+
response = await self.fetch("dao_get_treasury_balance", request)
|
|
1588
|
+
return response
|
|
1589
|
+
|
|
1590
|
+
async def dao_add_funds_to_treasury(
|
|
1591
|
+
self,
|
|
1592
|
+
wallet_id: int,
|
|
1593
|
+
funding_wallet_id: int,
|
|
1594
|
+
amount: uint64,
|
|
1595
|
+
tx_config: TXConfig,
|
|
1596
|
+
fee: uint64 = uint64(0),
|
|
1597
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1598
|
+
push: bool = True,
|
|
1599
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1600
|
+
) -> DAOAddFundsToTreasuryResponse:
|
|
1601
|
+
request: Dict[str, Any] = {
|
|
1602
|
+
"wallet_id": wallet_id,
|
|
1603
|
+
"funding_wallet_id": funding_wallet_id,
|
|
1604
|
+
"amount": amount,
|
|
1605
|
+
"fee": fee,
|
|
1606
|
+
"extra_conditions": list(extra_conditions),
|
|
1607
|
+
"push": push,
|
|
1608
|
+
**tx_config.to_json_dict(),
|
|
1609
|
+
**timelock_info.to_json_dict(),
|
|
1610
|
+
}
|
|
1611
|
+
response = await self.fetch("dao_add_funds_to_treasury", request)
|
|
1612
|
+
return json_deserialize_with_clvm_streamable(response, DAOAddFundsToTreasuryResponse)
|
|
1613
|
+
|
|
1614
|
+
async def dao_send_to_lockup(
|
|
1615
|
+
self,
|
|
1616
|
+
wallet_id: int,
|
|
1617
|
+
amount: uint64,
|
|
1618
|
+
tx_config: TXConfig,
|
|
1619
|
+
fee: uint64 = uint64(0),
|
|
1620
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1621
|
+
push: bool = True,
|
|
1622
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1623
|
+
) -> DAOSendToLockupResponse:
|
|
1624
|
+
request: Dict[str, Any] = {
|
|
1625
|
+
"wallet_id": wallet_id,
|
|
1626
|
+
"amount": amount,
|
|
1627
|
+
"fee": fee,
|
|
1628
|
+
"extra_conditions": list(extra_conditions),
|
|
1629
|
+
"push": push,
|
|
1630
|
+
**tx_config.to_json_dict(),
|
|
1631
|
+
**timelock_info.to_json_dict(),
|
|
1632
|
+
}
|
|
1633
|
+
response = await self.fetch("dao_send_to_lockup", request)
|
|
1634
|
+
return json_deserialize_with_clvm_streamable(response, DAOSendToLockupResponse)
|
|
1635
|
+
|
|
1636
|
+
async def dao_exit_lockup(
|
|
1637
|
+
self,
|
|
1638
|
+
wallet_id: int,
|
|
1639
|
+
tx_config: TXConfig,
|
|
1640
|
+
coins: Optional[List[Dict[str, Any]]] = None,
|
|
1641
|
+
fee: uint64 = uint64(0),
|
|
1642
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1643
|
+
push: bool = True,
|
|
1644
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1645
|
+
) -> DAOExitLockupResponse:
|
|
1646
|
+
request: Dict[str, Any] = {
|
|
1647
|
+
"wallet_id": wallet_id,
|
|
1648
|
+
"coins": coins,
|
|
1649
|
+
"fee": fee,
|
|
1650
|
+
"extra_conditions": list(extra_conditions),
|
|
1651
|
+
"push": push,
|
|
1652
|
+
**tx_config.to_json_dict(),
|
|
1653
|
+
**timelock_info.to_json_dict(),
|
|
1654
|
+
}
|
|
1655
|
+
response = await self.fetch("dao_exit_lockup", request)
|
|
1656
|
+
return json_deserialize_with_clvm_streamable(response, DAOExitLockupResponse)
|
|
1657
|
+
|
|
1658
|
+
async def dao_adjust_filter_level(self, wallet_id: int, filter_level: int) -> Dict[str, Any]:
|
|
1659
|
+
request = {"wallet_id": wallet_id, "filter_level": filter_level}
|
|
1660
|
+
response = await self.fetch("dao_adjust_filter_level", request)
|
|
1661
|
+
return response
|
|
1662
|
+
|
|
1663
|
+
async def vc_mint(
|
|
1664
|
+
self,
|
|
1665
|
+
did_id: bytes32,
|
|
1666
|
+
tx_config: TXConfig,
|
|
1667
|
+
target_address: Optional[bytes32] = None,
|
|
1668
|
+
fee: uint64 = uint64(0),
|
|
1669
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1670
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1671
|
+
push: bool = True,
|
|
1672
|
+
) -> VCMintResponse:
|
|
1673
|
+
response = await self.fetch(
|
|
1674
|
+
"vc_mint",
|
|
1675
|
+
{
|
|
1676
|
+
"did_id": encode_puzzle_hash(did_id, "rpc"),
|
|
1677
|
+
"target_address": encode_puzzle_hash(target_address, "rpc") if target_address is not None else None,
|
|
1678
|
+
"fee": fee,
|
|
1679
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1680
|
+
"push": push,
|
|
1681
|
+
**tx_config.to_json_dict(),
|
|
1682
|
+
**timelock_info.to_json_dict(),
|
|
1683
|
+
},
|
|
1684
|
+
)
|
|
1685
|
+
return json_deserialize_with_clvm_streamable(response, VCMintResponse)
|
|
1686
|
+
|
|
1687
|
+
async def vc_get(self, vc_id: bytes32) -> Optional[VCRecord]:
|
|
1688
|
+
response = await self.fetch("vc_get", {"vc_id": vc_id.hex()})
|
|
1689
|
+
return None if response["vc_record"] is None else VCRecord.from_json_dict(response["vc_record"])
|
|
1690
|
+
|
|
1691
|
+
async def vc_get_list(self, start: int = 0, count: int = 50) -> Tuple[List[VCRecord], Dict[str, Any]]:
|
|
1692
|
+
response = await self.fetch("vc_get_list", {"start": start, "count": count})
|
|
1693
|
+
return [VCRecord.from_json_dict(rec) for rec in response["vc_records"]], response["proofs"]
|
|
1694
|
+
|
|
1695
|
+
async def vc_spend(
|
|
1696
|
+
self,
|
|
1697
|
+
vc_id: bytes32,
|
|
1698
|
+
tx_config: TXConfig,
|
|
1699
|
+
new_puzhash: Optional[bytes32] = None,
|
|
1700
|
+
new_proof_hash: Optional[bytes32] = None,
|
|
1701
|
+
provider_inner_puzhash: Optional[bytes32] = None,
|
|
1702
|
+
fee: uint64 = uint64(0),
|
|
1703
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1704
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1705
|
+
push: bool = True,
|
|
1706
|
+
) -> VCSpendResponse:
|
|
1707
|
+
response = await self.fetch(
|
|
1708
|
+
"vc_spend",
|
|
1709
|
+
{
|
|
1710
|
+
"vc_id": vc_id.hex(),
|
|
1711
|
+
"new_puzhash": new_puzhash.hex() if new_puzhash is not None else new_puzhash,
|
|
1712
|
+
"new_proof_hash": new_proof_hash.hex() if new_proof_hash is not None else new_proof_hash,
|
|
1713
|
+
"provider_inner_puzhash": (
|
|
1714
|
+
provider_inner_puzhash.hex() if provider_inner_puzhash is not None else provider_inner_puzhash
|
|
1715
|
+
),
|
|
1716
|
+
"fee": fee,
|
|
1717
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1718
|
+
"push": push,
|
|
1719
|
+
**tx_config.to_json_dict(),
|
|
1720
|
+
**timelock_info.to_json_dict(),
|
|
1721
|
+
},
|
|
1722
|
+
)
|
|
1723
|
+
return json_deserialize_with_clvm_streamable(response, VCSpendResponse)
|
|
1724
|
+
|
|
1725
|
+
async def vc_add_proofs(self, proofs: Dict[str, Any]) -> None:
|
|
1726
|
+
await self.fetch("vc_add_proofs", {"proofs": proofs})
|
|
1727
|
+
|
|
1728
|
+
async def vc_get_proofs_for_root(self, root: bytes32) -> Dict[str, Any]:
|
|
1729
|
+
response = await self.fetch("vc_get_proofs_for_root", {"root": root.hex()})
|
|
1730
|
+
return cast(Dict[str, Any], response["proofs"])
|
|
1731
|
+
|
|
1732
|
+
async def vc_revoke(
|
|
1733
|
+
self,
|
|
1734
|
+
vc_parent_id: bytes32,
|
|
1735
|
+
tx_config: TXConfig,
|
|
1736
|
+
fee: uint64 = uint64(0),
|
|
1737
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1738
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1739
|
+
push: bool = True,
|
|
1740
|
+
) -> VCRevokeResponse:
|
|
1741
|
+
response = await self.fetch(
|
|
1742
|
+
"vc_revoke",
|
|
1743
|
+
{
|
|
1744
|
+
"vc_parent_id": vc_parent_id.hex(),
|
|
1745
|
+
"fee": fee,
|
|
1746
|
+
"extra_conditions": conditions_to_json_dicts(extra_conditions),
|
|
1747
|
+
"push": push,
|
|
1748
|
+
**tx_config.to_json_dict(),
|
|
1749
|
+
**timelock_info.to_json_dict(),
|
|
1750
|
+
},
|
|
1751
|
+
)
|
|
1752
|
+
return json_deserialize_with_clvm_streamable(response, VCRevokeResponse)
|
|
1753
|
+
|
|
1754
|
+
async def crcat_approve_pending(
|
|
1755
|
+
self,
|
|
1756
|
+
wallet_id: uint32,
|
|
1757
|
+
min_amount_to_claim: uint64,
|
|
1758
|
+
tx_config: TXConfig,
|
|
1759
|
+
fee: uint64 = uint64(0),
|
|
1760
|
+
push: bool = True,
|
|
1761
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1762
|
+
) -> List[TransactionRecord]:
|
|
1763
|
+
response = await self.fetch(
|
|
1764
|
+
"crcat_approve_pending",
|
|
1765
|
+
{
|
|
1766
|
+
"wallet_id": wallet_id,
|
|
1767
|
+
"min_amount_to_claim": min_amount_to_claim,
|
|
1768
|
+
"fee": fee,
|
|
1769
|
+
"push": push,
|
|
1770
|
+
**tx_config.to_json_dict(),
|
|
1771
|
+
**timelock_info.to_json_dict(),
|
|
1772
|
+
},
|
|
1773
|
+
)
|
|
1774
|
+
return [TransactionRecord.from_json_dict_convenience(tx) for tx in response["transactions"]]
|
|
1775
|
+
|
|
1776
|
+
async def gather_signing_info(
|
|
1777
|
+
self,
|
|
1778
|
+
args: GatherSigningInfo,
|
|
1779
|
+
) -> GatherSigningInfoResponse:
|
|
1780
|
+
return json_deserialize_with_clvm_streamable(
|
|
1781
|
+
await self.fetch(
|
|
1782
|
+
"gather_signing_info",
|
|
1783
|
+
args.to_json_dict(),
|
|
1784
|
+
),
|
|
1785
|
+
GatherSigningInfoResponse,
|
|
1786
|
+
)
|
|
1787
|
+
|
|
1788
|
+
async def apply_signatures(
|
|
1789
|
+
self,
|
|
1790
|
+
args: ApplySignatures,
|
|
1791
|
+
) -> ApplySignaturesResponse:
|
|
1792
|
+
return json_deserialize_with_clvm_streamable(
|
|
1793
|
+
await self.fetch(
|
|
1794
|
+
"apply_signatures",
|
|
1795
|
+
args.to_json_dict(),
|
|
1796
|
+
),
|
|
1797
|
+
ApplySignaturesResponse,
|
|
1798
|
+
)
|
|
1799
|
+
|
|
1800
|
+
async def submit_transactions(
|
|
1801
|
+
self,
|
|
1802
|
+
args: SubmitTransactions,
|
|
1803
|
+
) -> SubmitTransactionsResponse:
|
|
1804
|
+
return json_deserialize_with_clvm_streamable(
|
|
1805
|
+
await self.fetch(
|
|
1806
|
+
"submit_transactions",
|
|
1807
|
+
args.to_json_dict(),
|
|
1808
|
+
),
|
|
1809
|
+
SubmitTransactionsResponse,
|
|
1810
|
+
)
|
|
1811
|
+
|
|
1812
|
+
async def execute_signing_instructions(
|
|
1813
|
+
self,
|
|
1814
|
+
args: ExecuteSigningInstructions,
|
|
1815
|
+
) -> ExecuteSigningInstructionsResponse:
|
|
1816
|
+
return ExecuteSigningInstructionsResponse.from_json_dict(
|
|
1817
|
+
await self.fetch("execute_signing_instructions", args.to_json_dict())
|
|
1818
|
+
)
|
|
1819
|
+
|
|
1820
|
+
async def split_coins(
|
|
1821
|
+
self,
|
|
1822
|
+
args: SplitCoins,
|
|
1823
|
+
tx_config: TXConfig,
|
|
1824
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1825
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1826
|
+
) -> SplitCoinsResponse:
|
|
1827
|
+
return SplitCoinsResponse.from_json_dict(
|
|
1828
|
+
await self.fetch(
|
|
1829
|
+
"split_coins", args.json_serialize_for_transport(tx_config, extra_conditions, timelock_info)
|
|
1830
|
+
)
|
|
1831
|
+
)
|
|
1832
|
+
|
|
1833
|
+
async def combine_coins(
|
|
1834
|
+
self,
|
|
1835
|
+
args: CombineCoins,
|
|
1836
|
+
tx_config: TXConfig,
|
|
1837
|
+
extra_conditions: Tuple[Condition, ...] = tuple(),
|
|
1838
|
+
timelock_info: ConditionValidTimes = ConditionValidTimes(),
|
|
1839
|
+
) -> CombineCoinsResponse:
|
|
1840
|
+
return CombineCoinsResponse.from_json_dict(
|
|
1841
|
+
await self.fetch(
|
|
1842
|
+
"combine_coins", args.json_serialize_for_transport(tx_config, extra_conditions, timelock_info)
|
|
1843
|
+
)
|
|
1844
|
+
)
|