chia-blockchain 2.5.7rc4__py3-none-any.whl → 2.5.8rc1__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.
Files changed (528) hide show
  1. chia/__init__.py +8 -4
  2. chia/_tests/blockchain/blockchain_test_utils.py +6 -8
  3. chia/_tests/blockchain/test_augmented_chain.py +4 -4
  4. chia/_tests/blockchain/test_blockchain.py +165 -190
  5. chia/_tests/blockchain/test_build_chains.py +2 -4
  6. chia/_tests/blockchain/test_get_block_generator.py +2 -3
  7. chia/_tests/clvm/coin_store.py +4 -7
  8. chia/_tests/clvm/test_clvm_step.py +4 -4
  9. chia/_tests/clvm/test_puzzle_compression.py +2 -1
  10. chia/_tests/clvm/test_puzzle_drivers.py +2 -2
  11. chia/_tests/clvm/test_singletons.py +2 -4
  12. chia/_tests/clvm/test_spend_sim.py +2 -2
  13. chia/_tests/cmds/cmd_test_utils.py +27 -45
  14. chia/_tests/cmds/test_cmd_framework.py +6 -6
  15. chia/_tests/cmds/test_daemon.py +3 -3
  16. chia/_tests/cmds/test_show.py +4 -4
  17. chia/_tests/cmds/test_tx_config_args.py +1 -2
  18. chia/_tests/cmds/testing_classes.py +4 -5
  19. chia/_tests/cmds/wallet/test_did.py +24 -27
  20. chia/_tests/cmds/wallet/test_nft.py +12 -10
  21. chia/_tests/cmds/wallet/test_vcs.py +11 -12
  22. chia/_tests/cmds/wallet/test_wallet.py +134 -89
  23. chia/_tests/conftest.py +59 -30
  24. chia/_tests/connection_utils.py +2 -2
  25. chia/_tests/core/cmds/test_beta.py +4 -4
  26. chia/_tests/core/cmds/test_keys.py +2 -3
  27. chia/_tests/core/cmds/test_wallet.py +15 -15
  28. chia/_tests/core/consensus/test_pot_iterations.py +19 -73
  29. chia/_tests/core/custom_types/test_proof_of_space.py +124 -98
  30. chia/_tests/core/daemon/test_daemon.py +11 -11
  31. chia/_tests/core/data_layer/conftest.py +2 -2
  32. chia/_tests/core/data_layer/test_data_rpc.py +28 -14
  33. chia/_tests/core/data_layer/test_data_store.py +10 -10
  34. chia/_tests/core/data_layer/util.py +11 -11
  35. chia/_tests/core/farmer/test_farmer_api.py +2 -4
  36. chia/_tests/core/full_node/full_sync/test_full_sync.py +8 -7
  37. chia/_tests/core/full_node/stores/test_block_store.py +5 -4
  38. chia/_tests/core/full_node/stores/test_coin_store.py +5 -11
  39. chia/_tests/core/full_node/stores/test_full_node_store.py +8 -8
  40. chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
  41. chia/_tests/core/full_node/test_block_height_map.py +3 -4
  42. chia/_tests/core/full_node/test_conditions.py +21 -23
  43. chia/_tests/core/full_node/test_full_node.py +225 -62
  44. chia/_tests/core/full_node/test_hint_management.py +2 -4
  45. chia/_tests/core/full_node/test_performance.py +0 -1
  46. chia/_tests/core/full_node/test_prev_tx_block.py +88 -11
  47. chia/_tests/core/full_node/test_transactions.py +1 -2
  48. chia/_tests/core/full_node/test_tx_processing_queue.py +109 -25
  49. chia/_tests/core/mempool/test_mempool.py +29 -37
  50. chia/_tests/core/mempool/test_mempool_fee_estimator.py +39 -39
  51. chia/_tests/core/mempool/test_mempool_fee_protocol.py +2 -6
  52. chia/_tests/core/mempool/test_mempool_manager.py +963 -839
  53. chia/_tests/core/mempool/test_singleton_fast_forward.py +6 -6
  54. chia/_tests/core/server/serve.py +7 -7
  55. chia/_tests/core/server/test_dos.py +1 -2
  56. chia/_tests/core/server/test_event_loop.py +12 -4
  57. chia/_tests/core/server/test_loop.py +7 -8
  58. chia/_tests/core/server/test_rate_limits.py +9 -8
  59. chia/_tests/core/server/test_server.py +61 -1
  60. chia/_tests/core/services/test_services.py +2 -2
  61. chia/_tests/core/ssl/test_ssl.py +2 -2
  62. chia/_tests/core/test_cost_calculation.py +2 -6
  63. chia/_tests/core/test_farmer_harvester_rpc.py +3 -5
  64. chia/_tests/core/test_filter.py +0 -1
  65. chia/_tests/core/test_full_node_rpc.py +2 -2
  66. chia/_tests/core/test_merkle_set.py +1 -2
  67. chia/_tests/core/test_seeder.py +4 -4
  68. chia/_tests/core/util/test_config.py +4 -4
  69. chia/_tests/core/util/test_jsonify.py +2 -2
  70. chia/_tests/core/util/test_keychain.py +3 -3
  71. chia/_tests/core/util/test_lockfile.py +2 -1
  72. chia/_tests/core/util/test_log_exceptions.py +1 -2
  73. chia/_tests/core/util/test_streamable.py +17 -17
  74. chia/_tests/db/test_db_wrapper.py +3 -2
  75. chia/_tests/environments/wallet.py +14 -14
  76. chia/_tests/ether.py +4 -3
  77. chia/_tests/farmer_harvester/test_farmer.py +41 -24
  78. chia/_tests/farmer_harvester/test_farmer_harvester.py +50 -17
  79. chia/_tests/farmer_harvester/test_filter_prefix_bits.py +27 -27
  80. chia/_tests/farmer_harvester/test_third_party_harvesters.py +21 -22
  81. chia/_tests/fee_estimation/test_fee_estimation_integration.py +18 -18
  82. chia/_tests/fee_estimation/test_fee_estimation_rpc.py +11 -9
  83. chia/_tests/harvester/test_harvester_api.py +11 -4
  84. chia/_tests/plot_sync/test_plot_sync.py +13 -11
  85. chia/_tests/plot_sync/test_receiver.py +11 -10
  86. chia/_tests/plot_sync/test_sync_simulated.py +2 -2
  87. chia/_tests/plot_sync/util.py +1 -2
  88. chia/_tests/plotting/test_plot_manager.py +7 -6
  89. chia/_tests/plotting/test_prover.py +30 -38
  90. chia/_tests/pools/test_pool_cmdline.py +4 -6
  91. chia/_tests/pools/test_pool_rpc.py +203 -61
  92. chia/_tests/pools/test_pool_wallet.py +3 -3
  93. chia/_tests/pools/test_wallet_pool_store.py +1 -4
  94. chia/_tests/process_junit.py +2 -2
  95. chia/_tests/rpc/test_rpc_client.py +4 -4
  96. chia/_tests/rpc/test_rpc_server.py +3 -3
  97. chia/_tests/simulation/test_simulation.py +12 -25
  98. chia/_tests/solver/test_solver_service.py +13 -4
  99. chia/_tests/testconfig.py +2 -2
  100. chia/_tests/timelord/test_new_peak.py +22 -11
  101. chia/_tests/tools/test_run_block.py +0 -2
  102. chia/_tests/tools/test_virtual_project.py +2 -1
  103. chia/_tests/util/benchmarks.py +1 -0
  104. chia/_tests/util/blockchain.py +38 -36
  105. chia/_tests/util/blockchain_mock.py +11 -11
  106. chia/_tests/util/build_network_protocol_files.py +2 -1
  107. chia/_tests/util/coin_store.py +2 -1
  108. chia/_tests/util/config.py +1 -1
  109. chia/_tests/util/db_connection.py +2 -3
  110. chia/_tests/util/full_sync.py +9 -11
  111. chia/_tests/util/gen_ssl_certs.py +4 -5
  112. chia/_tests/util/get_name_puzzle_conditions.py +2 -0
  113. chia/_tests/util/misc.py +24 -24
  114. chia/_tests/util/network_protocol_data.py +20 -3
  115. chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
  116. chia/_tests/util/protocol_messages_json.py +292 -3
  117. chia/_tests/util/setup_nodes.py +62 -47
  118. chia/_tests/util/spend_sim.py +57 -57
  119. chia/_tests/util/test_async_pool.py +2 -3
  120. chia/_tests/util/test_chia_version.py +1 -3
  121. chia/_tests/util/test_config.py +3 -3
  122. chia/_tests/util/test_full_block_utils.py +6 -3
  123. chia/_tests/util/test_limited_semaphore.py +1 -2
  124. chia/_tests/util/test_misc.py +2 -2
  125. chia/_tests/util/test_network.py +1 -2
  126. chia/_tests/util/test_priority_mutex.py +3 -3
  127. chia/_tests/util/test_recursive_replace.py +5 -6
  128. chia/_tests/util/test_replace_str_to_bytes.py +8 -10
  129. chia/_tests/util/test_testnet_overrides.py +3 -3
  130. chia/_tests/util/time_out_assert.py +2 -2
  131. chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +4 -6
  132. chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +2 -4
  133. chia/_tests/wallet/cat_wallet/test_cat_wallet.py +19 -13
  134. chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +13 -13
  135. chia/_tests/wallet/cat_wallet/test_trades.py +40 -38
  136. chia/_tests/wallet/clawback/test_clawback_lifecycle.py +2 -4
  137. chia/_tests/wallet/conftest.py +6 -6
  138. chia/_tests/wallet/db_wallet/test_db_graftroot.py +1 -1
  139. chia/_tests/wallet/db_wallet/test_dl_offers.py +34 -34
  140. chia/_tests/wallet/did_wallet/test_did.py +16 -6
  141. chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +21 -21
  142. chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +20 -6
  143. chia/_tests/wallet/nft_wallet/test_nft_offers.py +19 -21
  144. chia/_tests/wallet/nft_wallet/test_nft_puzzles.py +1 -2
  145. chia/_tests/wallet/nft_wallet/test_nft_wallet.py +121 -2
  146. chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py +6 -9
  147. chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +44 -1
  148. chia/_tests/wallet/rpc/test_wallet_rpc.py +1672 -896
  149. chia/_tests/wallet/sync/test_wallet_sync.py +43 -47
  150. chia/_tests/wallet/test_clvm_streamable.py +2 -3
  151. chia/_tests/wallet/test_coin_management.py +2 -2
  152. chia/_tests/wallet/test_conditions.py +45 -51
  153. chia/_tests/wallet/test_debug_spend_bundle.py +2 -2
  154. chia/_tests/wallet/test_new_wallet_protocol.py +4 -6
  155. chia/_tests/wallet/test_notifications.py +14 -14
  156. chia/_tests/wallet/test_signer_protocol.py +5 -5
  157. chia/_tests/wallet/test_singleton_lifecycle_fast.py +4 -3
  158. chia/_tests/wallet/test_transaction_store.py +20 -20
  159. chia/_tests/wallet/test_util.py +2 -2
  160. chia/_tests/wallet/test_wallet.py +380 -228
  161. chia/_tests/wallet/test_wallet_action_scope.py +4 -4
  162. chia/_tests/wallet/test_wallet_blockchain.py +12 -12
  163. chia/_tests/wallet/test_wallet_coin_store.py +3 -4
  164. chia/_tests/wallet/test_wallet_node.py +14 -14
  165. chia/_tests/wallet/test_wallet_test_framework.py +2 -1
  166. chia/_tests/wallet/test_wallet_utils.py +2 -3
  167. chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py +3 -5
  168. chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +14 -15
  169. chia/_tests/wallet/vc_wallet/test_vc_wallet.py +29 -24
  170. chia/_tests/wallet/wallet_block_tools.py +12 -11
  171. chia/_tests/weight_proof/config.py +1 -0
  172. chia/_tests/weight_proof/test_weight_proof.py +5 -4
  173. chia/apis/__init__.py +21 -0
  174. chia/apis/farmer_stub.py +102 -0
  175. chia/apis/full_node_stub.py +372 -0
  176. chia/apis/harvester_stub.py +57 -0
  177. chia/apis/introducer_stub.py +35 -0
  178. chia/apis/solver_stub.py +30 -0
  179. chia/apis/stub_protocol_registry.py +21 -0
  180. chia/apis/timelord_stub.py +39 -0
  181. chia/apis/wallet_stub.py +161 -0
  182. chia/cmds/beta.py +3 -4
  183. chia/cmds/beta_funcs.py +4 -3
  184. chia/cmds/check_wallet_db.py +4 -4
  185. chia/cmds/chia.py +1 -2
  186. chia/cmds/cmd_classes.py +11 -13
  187. chia/cmds/cmd_helpers.py +11 -11
  188. chia/cmds/cmds_util.py +15 -15
  189. chia/cmds/coin_funcs.py +6 -7
  190. chia/cmds/coins.py +2 -3
  191. chia/cmds/configure.py +1 -2
  192. chia/cmds/data.py +42 -42
  193. chia/cmds/data_funcs.py +81 -81
  194. chia/cmds/db.py +4 -5
  195. chia/cmds/db_backup_func.py +2 -2
  196. chia/cmds/db_upgrade_func.py +3 -3
  197. chia/cmds/db_validate_func.py +2 -2
  198. chia/cmds/dev/data.py +4 -4
  199. chia/cmds/dev/gh.py +5 -5
  200. chia/cmds/dev/installers.py +2 -3
  201. chia/cmds/dev/mempool.py +3 -4
  202. chia/cmds/dev/mempool_funcs.py +4 -4
  203. chia/cmds/dev/sim.py +8 -8
  204. chia/cmds/dump_keyring.py +3 -3
  205. chia/cmds/farm.py +6 -8
  206. chia/cmds/farm_funcs.py +25 -24
  207. chia/cmds/init_funcs.py +4 -4
  208. chia/cmds/keys.py +16 -18
  209. chia/cmds/keys_funcs.py +36 -36
  210. chia/cmds/netspace.py +1 -3
  211. chia/cmds/netspace_funcs.py +1 -2
  212. chia/cmds/options.py +3 -2
  213. chia/cmds/param_types.py +17 -16
  214. chia/cmds/passphrase.py +6 -7
  215. chia/cmds/passphrase_funcs.py +11 -13
  216. chia/cmds/peer.py +1 -3
  217. chia/cmds/peer_funcs.py +3 -3
  218. chia/cmds/plotnft.py +6 -7
  219. chia/cmds/plotnft_funcs.py +37 -26
  220. chia/cmds/rpc.py +3 -3
  221. chia/cmds/show.py +3 -5
  222. chia/cmds/show_funcs.py +9 -9
  223. chia/cmds/sim_funcs.py +25 -26
  224. chia/cmds/solver.py +1 -3
  225. chia/cmds/solver_funcs.py +1 -2
  226. chia/cmds/start_funcs.py +2 -2
  227. chia/cmds/wallet.py +76 -81
  228. chia/cmds/wallet_funcs.py +206 -177
  229. chia/consensus/augmented_chain.py +6 -6
  230. chia/consensus/block_body_validation.py +19 -15
  231. chia/consensus/block_creation.py +25 -21
  232. chia/consensus/block_header_validation.py +27 -13
  233. chia/consensus/block_height_map.py +3 -6
  234. chia/consensus/block_height_map_protocol.py +2 -2
  235. chia/consensus/block_record.py +2 -4
  236. chia/consensus/blockchain.py +58 -40
  237. chia/consensus/blockchain_interface.py +7 -7
  238. chia/consensus/coin_store_protocol.py +5 -6
  239. chia/consensus/condition_tools.py +4 -4
  240. chia/consensus/cost_calculator.py +2 -3
  241. chia/consensus/default_constants.py +16 -13
  242. chia/consensus/deficit.py +1 -3
  243. chia/consensus/difficulty_adjustment.py +3 -5
  244. chia/consensus/find_fork_point.py +2 -4
  245. chia/consensus/full_block_to_block_record.py +11 -13
  246. chia/consensus/generator_tools.py +2 -3
  247. chia/consensus/get_block_challenge.py +42 -26
  248. chia/consensus/get_block_generator.py +2 -3
  249. chia/consensus/make_sub_epoch_summary.py +8 -7
  250. chia/consensus/multiprocess_validation.py +31 -20
  251. chia/consensus/pos_quality.py +6 -23
  252. chia/consensus/pot_iterations.py +17 -44
  253. chia/consensus/signage_point.py +4 -5
  254. chia/consensus/vdf_info_computation.py +2 -4
  255. chia/daemon/client.py +8 -8
  256. chia/daemon/keychain_proxy.py +31 -37
  257. chia/daemon/server.py +32 -33
  258. chia/daemon/windows_signal.py +4 -3
  259. chia/data_layer/data_layer.py +86 -77
  260. chia/data_layer/data_layer_rpc_api.py +9 -9
  261. chia/data_layer/data_layer_rpc_client.py +13 -15
  262. chia/data_layer/data_layer_server.py +3 -3
  263. chia/data_layer/data_layer_util.py +14 -14
  264. chia/data_layer/data_layer_wallet.py +94 -101
  265. chia/data_layer/data_store.py +50 -50
  266. chia/data_layer/dl_wallet_store.py +9 -12
  267. chia/data_layer/download_data.py +8 -9
  268. chia/data_layer/s3_plugin_service.py +5 -9
  269. chia/data_layer/start_data_layer.py +5 -5
  270. chia/farmer/farmer.py +31 -31
  271. chia/farmer/farmer_api.py +45 -33
  272. chia/farmer/farmer_rpc_api.py +5 -4
  273. chia/farmer/farmer_rpc_client.py +6 -6
  274. chia/farmer/start_farmer.py +6 -6
  275. chia/full_node/block_store.py +13 -16
  276. chia/full_node/check_fork_next_block.py +1 -2
  277. chia/full_node/coin_store.py +15 -16
  278. chia/full_node/eligible_coin_spends.py +3 -3
  279. chia/full_node/fee_estimate_store.py +2 -3
  280. chia/full_node/fee_tracker.py +1 -2
  281. chia/full_node/full_block_utils.py +4 -4
  282. chia/full_node/full_node.py +238 -224
  283. chia/full_node/full_node_api.py +193 -150
  284. chia/full_node/full_node_rpc_api.py +53 -31
  285. chia/full_node/full_node_rpc_client.py +18 -19
  286. chia/full_node/full_node_store.py +45 -43
  287. chia/full_node/hint_management.py +2 -2
  288. chia/full_node/mempool.py +17 -19
  289. chia/full_node/mempool_manager.py +89 -42
  290. chia/full_node/pending_tx_cache.py +2 -3
  291. chia/full_node/start_full_node.py +5 -5
  292. chia/full_node/sync_store.py +3 -4
  293. chia/full_node/tx_processing_queue.py +34 -13
  294. chia/full_node/weight_proof.py +61 -48
  295. chia/harvester/harvester.py +25 -24
  296. chia/harvester/harvester_api.py +61 -38
  297. chia/harvester/harvester_rpc_api.py +10 -10
  298. chia/harvester/start_harvester.py +4 -4
  299. chia/introducer/introducer.py +3 -3
  300. chia/introducer/introducer_api.py +6 -4
  301. chia/introducer/start_introducer.py +4 -4
  302. chia/legacy/keyring.py +3 -3
  303. chia/plot_sync/delta.py +1 -2
  304. chia/plot_sync/receiver.py +20 -17
  305. chia/plot_sync/sender.py +15 -10
  306. chia/plotters/bladebit.py +7 -7
  307. chia/plotters/chiapos.py +2 -2
  308. chia/plotters/madmax.py +4 -4
  309. chia/plotters/plotters.py +4 -4
  310. chia/plotters/plotters_util.py +3 -3
  311. chia/plotting/cache.py +20 -14
  312. chia/plotting/check_plots.py +26 -35
  313. chia/plotting/create_plots.py +22 -23
  314. chia/plotting/manager.py +21 -14
  315. chia/plotting/prover.py +59 -42
  316. chia/plotting/util.py +16 -16
  317. chia/pools/pool_config.py +2 -1
  318. chia/pools/pool_puzzles.py +11 -12
  319. chia/pools/pool_wallet.py +34 -57
  320. chia/pools/pool_wallet_info.py +39 -10
  321. chia/protocols/farmer_protocol.py +8 -9
  322. chia/protocols/fee_estimate.py +3 -4
  323. chia/protocols/full_node_protocol.py +3 -4
  324. chia/protocols/harvester_protocol.py +27 -15
  325. chia/protocols/outbound_message.py +3 -3
  326. chia/protocols/pool_protocol.py +8 -9
  327. chia/protocols/shared_protocol.py +1 -2
  328. chia/protocols/solver_protocol.py +9 -2
  329. chia/protocols/timelord_protocol.py +4 -7
  330. chia/protocols/wallet_protocol.py +11 -12
  331. chia/rpc/rpc_client.py +9 -9
  332. chia/rpc/rpc_server.py +17 -17
  333. chia/rpc/util.py +2 -2
  334. chia/seeder/crawler.py +8 -8
  335. chia/seeder/crawler_api.py +21 -27
  336. chia/seeder/crawler_rpc_api.py +2 -2
  337. chia/seeder/dns_server.py +21 -21
  338. chia/seeder/start_crawler.py +4 -4
  339. chia/server/address_manager.py +15 -16
  340. chia/server/api_protocol.py +11 -11
  341. chia/server/chia_policy.py +46 -26
  342. chia/server/introducer_peers.py +2 -3
  343. chia/server/node_discovery.py +19 -19
  344. chia/server/rate_limit_numbers.py +4 -5
  345. chia/server/rate_limits.py +4 -4
  346. chia/server/resolve_peer_info.py +4 -4
  347. chia/server/server.py +49 -52
  348. chia/server/signal_handlers.py +6 -6
  349. chia/server/start_service.py +17 -17
  350. chia/server/upnp.py +4 -6
  351. chia/server/ws_connection.py +52 -37
  352. chia/simulator/add_blocks_in_batches.py +1 -3
  353. chia/simulator/block_tools.py +312 -200
  354. chia/simulator/full_node_simulator.py +56 -35
  355. chia/simulator/keyring.py +2 -3
  356. chia/simulator/setup_services.py +15 -15
  357. chia/simulator/simulator_full_node_rpc_api.py +1 -2
  358. chia/simulator/simulator_full_node_rpc_client.py +1 -2
  359. chia/simulator/simulator_protocol.py +1 -2
  360. chia/simulator/simulator_test_tools.py +3 -3
  361. chia/simulator/start_simulator.py +7 -7
  362. chia/simulator/wallet_tools.py +10 -10
  363. chia/solver/solver.py +10 -10
  364. chia/solver/solver_api.py +10 -8
  365. chia/solver/solver_rpc_api.py +2 -2
  366. chia/solver/start_solver.py +4 -4
  367. chia/ssl/cacert.pem +148 -90
  368. chia/ssl/chia_ca.crt +14 -10
  369. chia/ssl/chia_ca_old.crt +19 -0
  370. chia/ssl/create_ssl.py +4 -4
  371. chia/ssl/renewedselfsignedca.conf +4 -0
  372. chia/ssl/ssl_check.py +1 -2
  373. chia/timelord/iters_from_block.py +1 -4
  374. chia/timelord/start_timelord.py +4 -4
  375. chia/timelord/timelord.py +44 -40
  376. chia/timelord/timelord_api.py +6 -4
  377. chia/timelord/timelord_launcher.py +2 -2
  378. chia/timelord/timelord_rpc_api.py +2 -2
  379. chia/timelord/timelord_state.py +11 -12
  380. chia/types/block_protocol.py +1 -3
  381. chia/types/blockchain_format/coin.py +1 -3
  382. chia/types/blockchain_format/program.py +11 -8
  383. chia/types/blockchain_format/proof_of_space.py +123 -76
  384. chia/types/blockchain_format/tree_hash.py +3 -3
  385. chia/types/blockchain_format/vdf.py +1 -2
  386. chia/types/coin_spend.py +3 -3
  387. chia/types/mempool_item.py +5 -5
  388. chia/types/mempool_submission_status.py +2 -3
  389. chia/types/peer_info.py +1 -2
  390. chia/types/unfinished_header_block.py +3 -4
  391. chia/types/validation_state.py +1 -2
  392. chia/util/action_scope.py +8 -8
  393. chia/util/async_pool.py +5 -5
  394. chia/util/bech32m.py +1 -2
  395. chia/util/beta_metrics.py +2 -2
  396. chia/util/block_cache.py +4 -4
  397. chia/util/chia_logging.py +2 -2
  398. chia/util/chia_version.py +1 -2
  399. chia/util/config.py +15 -16
  400. chia/util/db_wrapper.py +26 -27
  401. chia/util/default_root.py +1 -2
  402. chia/util/errors.py +3 -3
  403. chia/util/file_keyring.py +14 -14
  404. chia/util/files.py +2 -3
  405. chia/util/hash.py +4 -4
  406. chia/util/initial-config.yaml +3 -5
  407. chia/util/inline_executor.py +2 -1
  408. chia/util/ip_address.py +1 -2
  409. chia/util/keychain.py +25 -27
  410. chia/util/keyring_wrapper.py +18 -19
  411. chia/util/lock.py +3 -4
  412. chia/util/log_exceptions.py +1 -2
  413. chia/util/lru_cache.py +2 -2
  414. chia/util/network.py +6 -6
  415. chia/util/path.py +2 -3
  416. chia/util/priority_mutex.py +2 -2
  417. chia/util/profiler.py +1 -2
  418. chia/util/safe_cancel_task.py +1 -2
  419. chia/util/streamable.py +22 -8
  420. chia/util/task_referencer.py +1 -1
  421. chia/util/timing.py +3 -3
  422. chia/util/virtual_project_analysis.py +6 -5
  423. chia/util/ws_message.py +2 -2
  424. chia/wallet/cat_wallet/cat_info.py +3 -4
  425. chia/wallet/cat_wallet/cat_outer_puzzle.py +12 -11
  426. chia/wallet/cat_wallet/cat_utils.py +3 -4
  427. chia/wallet/cat_wallet/cat_wallet.py +61 -83
  428. chia/wallet/cat_wallet/lineage_store.py +3 -4
  429. chia/wallet/cat_wallet/r_cat_wallet.py +19 -22
  430. chia/wallet/coin_selection.py +9 -10
  431. chia/wallet/conditions.py +120 -105
  432. chia/wallet/db_wallet/db_wallet_puzzles.py +4 -5
  433. chia/wallet/derivation_record.py +1 -2
  434. chia/wallet/derive_keys.py +2 -4
  435. chia/wallet/did_wallet/did_info.py +10 -11
  436. chia/wallet/did_wallet/did_wallet.py +36 -82
  437. chia/wallet/did_wallet/did_wallet_puzzles.py +7 -8
  438. chia/wallet/driver_protocol.py +5 -7
  439. chia/wallet/lineage_proof.py +4 -4
  440. chia/wallet/nft_wallet/metadata_outer_puzzle.py +11 -11
  441. chia/wallet/nft_wallet/nft_info.py +8 -9
  442. chia/wallet/nft_wallet/nft_puzzle_utils.py +8 -8
  443. chia/wallet/nft_wallet/nft_wallet.py +79 -116
  444. chia/wallet/nft_wallet/ownership_outer_puzzle.py +14 -14
  445. chia/wallet/nft_wallet/singleton_outer_puzzle.py +12 -11
  446. chia/wallet/nft_wallet/transfer_program_puzzle.py +11 -11
  447. chia/wallet/nft_wallet/uncurry_nft.py +10 -11
  448. chia/wallet/notification_manager.py +3 -3
  449. chia/wallet/notification_store.py +44 -61
  450. chia/wallet/outer_puzzles.py +6 -7
  451. chia/wallet/puzzle_drivers.py +34 -6
  452. chia/wallet/puzzles/clawback/drivers.py +6 -6
  453. chia/wallet/puzzles/deployed_puzzle_hashes.json +1 -54
  454. chia/wallet/puzzles/load_clvm.py +1 -1
  455. chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +1 -2
  456. chia/wallet/puzzles/singleton_top_layer.py +2 -3
  457. chia/wallet/puzzles/singleton_top_layer_v1_1.py +3 -4
  458. chia/wallet/puzzles/tails.py +3 -3
  459. chia/wallet/singleton.py +5 -7
  460. chia/wallet/singleton_record.py +3 -3
  461. chia/wallet/start_wallet.py +5 -5
  462. chia/wallet/trade_manager.py +37 -58
  463. chia/wallet/trade_record.py +4 -4
  464. chia/wallet/trading/offer.py +59 -46
  465. chia/wallet/trading/trade_store.py +8 -9
  466. chia/wallet/transaction_record.py +8 -8
  467. chia/wallet/uncurried_puzzle.py +1 -2
  468. chia/wallet/util/clvm_streamable.py +12 -12
  469. chia/wallet/util/compute_hints.py +4 -5
  470. chia/wallet/util/curry_and_treehash.py +1 -2
  471. chia/wallet/util/merkle_tree.py +2 -3
  472. chia/wallet/util/peer_request_cache.py +8 -8
  473. chia/wallet/util/signing.py +85 -0
  474. chia/wallet/util/tx_config.py +15 -6
  475. chia/wallet/util/wallet_sync_utils.py +14 -16
  476. chia/wallet/util/wallet_types.py +2 -2
  477. chia/wallet/vc_wallet/cr_cat_drivers.py +10 -11
  478. chia/wallet/vc_wallet/cr_cat_wallet.py +50 -68
  479. chia/wallet/vc_wallet/cr_outer_puzzle.py +14 -13
  480. chia/wallet/vc_wallet/vc_drivers.py +27 -27
  481. chia/wallet/vc_wallet/vc_store.py +5 -6
  482. chia/wallet/vc_wallet/vc_wallet.py +33 -61
  483. chia/wallet/wallet.py +50 -78
  484. chia/wallet/wallet_action_scope.py +11 -11
  485. chia/wallet/wallet_blockchain.py +12 -12
  486. chia/wallet/wallet_coin_record.py +12 -6
  487. chia/wallet/wallet_coin_store.py +24 -25
  488. chia/wallet/wallet_interested_store.py +3 -5
  489. chia/wallet/wallet_nft_store.py +10 -11
  490. chia/wallet/wallet_node.py +53 -61
  491. chia/wallet/wallet_node_api.py +5 -3
  492. chia/wallet/wallet_protocol.py +23 -23
  493. chia/wallet/wallet_puzzle_store.py +15 -18
  494. chia/wallet/wallet_request_types.py +778 -114
  495. chia/wallet/wallet_retry_store.py +1 -3
  496. chia/wallet/wallet_rpc_api.py +572 -909
  497. chia/wallet/wallet_rpc_client.py +87 -279
  498. chia/wallet/wallet_singleton_store.py +3 -4
  499. chia/wallet/wallet_state_manager.py +332 -106
  500. chia/wallet/wallet_transaction_store.py +11 -14
  501. chia/wallet/wallet_user_store.py +4 -6
  502. chia/wallet/wallet_weight_proof_handler.py +4 -4
  503. {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/METADATA +6 -5
  504. {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/RECORD +507 -516
  505. chia/apis.py +0 -21
  506. chia/consensus/check_time_locks.py +0 -57
  507. chia/data_layer/puzzles/__init__.py +0 -0
  508. chia/data_layer/puzzles/graftroot_dl_offers.clsp +0 -100
  509. chia/data_layer/puzzles/graftroot_dl_offers.clsp.hex +0 -1
  510. chia/types/coin_record.py +0 -44
  511. chia/wallet/nft_wallet/puzzles/__init__.py +0 -0
  512. chia/wallet/nft_wallet/puzzles/create_nft_launcher_from_did.clsp +0 -6
  513. chia/wallet/nft_wallet/puzzles/create_nft_launcher_from_did.clsp.hex +0 -1
  514. chia/wallet/nft_wallet/puzzles/nft_intermediate_launcher.clsp +0 -6
  515. chia/wallet/nft_wallet/puzzles/nft_intermediate_launcher.clsp.hex +0 -1
  516. chia/wallet/nft_wallet/puzzles/nft_metadata_updater_default.clsp +0 -30
  517. chia/wallet/nft_wallet/puzzles/nft_metadata_updater_default.clsp.hex +0 -1
  518. chia/wallet/nft_wallet/puzzles/nft_metadata_updater_updateable.clsp +0 -28
  519. chia/wallet/nft_wallet/puzzles/nft_metadata_updater_updateable.clsp.hex +0 -1
  520. chia/wallet/nft_wallet/puzzles/nft_ownership_layer.clsp +0 -100
  521. chia/wallet/nft_wallet/puzzles/nft_ownership_layer.clsp.hex +0 -1
  522. chia/wallet/nft_wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp +0 -78
  523. chia/wallet/nft_wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp.hex +0 -1
  524. chia/wallet/nft_wallet/puzzles/nft_state_layer.clsp +0 -74
  525. chia/wallet/nft_wallet/puzzles/nft_state_layer.clsp.hex +0 -1
  526. {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/WHEEL +0 -0
  527. {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/entry_points.txt +0 -0
  528. {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/licenses/LICENSE +0 -0
chia/cmds/wallet_funcs.py CHANGED
@@ -6,10 +6,10 @@ import os
6
6
  import pathlib
7
7
  import sys
8
8
  import time
9
- from collections.abc import Awaitable, Sequence
9
+ from collections.abc import Awaitable, Callable, Sequence
10
10
  from datetime import datetime, timezone
11
11
  from decimal import Decimal
12
- from typing import Any, Callable, Optional, Union
12
+ from typing import Any
13
13
 
14
14
  from chia_rs.sized_bytes import bytes32
15
15
  from chia_rs.sized_ints import uint16, uint32, uint64
@@ -45,6 +45,7 @@ from chia.wallet.util.wallet_types import WalletType
45
45
  from chia.wallet.vc_wallet.vc_store import VCProofs
46
46
  from chia.wallet.wallet_coin_store import GetCoinRecords
47
47
  from chia.wallet.wallet_request_types import (
48
+ CancelOffer,
48
49
  CATAssetIDToName,
49
50
  CATAssetIDToNameResponse,
50
51
  CATGetName,
@@ -52,6 +53,10 @@ from chia.wallet.wallet_request_types import (
52
53
  CATSpend,
53
54
  CATSpendResponse,
54
55
  ClawbackPuzzleDecoratorOverride,
56
+ CRCATApprovePending,
57
+ CreateNewWallet,
58
+ CreateNewWalletType,
59
+ CreateOfferForIDs,
55
60
  DeleteNotifications,
56
61
  DeleteUnconfirmedTransactions,
57
62
  DIDFindLostDID,
@@ -60,11 +65,14 @@ from chia.wallet.wallet_request_types import (
60
65
  DIDMessageSpend,
61
66
  DIDSetWalletName,
62
67
  DIDTransferDID,
68
+ DIDType,
63
69
  DIDUpdateMetadata,
64
70
  ExtendDerivationIndex,
65
71
  FungibleAsset,
72
+ GetAllOffers,
66
73
  GetNextAddress,
67
74
  GetNotifications,
75
+ GetOffer,
68
76
  GetTransaction,
69
77
  GetTransactions,
70
78
  GetWalletBalance,
@@ -87,6 +95,7 @@ from chia.wallet.wallet_request_types import (
87
95
  SignMessageByID,
88
96
  SignMessageByIDResponse,
89
97
  SpendClawbackCoins,
98
+ TakeOffer,
90
99
  VCAddProofs,
91
100
  VCGet,
92
101
  VCGetList,
@@ -94,6 +103,7 @@ from chia.wallet.wallet_request_types import (
94
103
  VCMint,
95
104
  VCRevoke,
96
105
  VCSpend,
106
+ WalletCreationMode,
97
107
  )
98
108
  from chia.wallet.wallet_rpc_client import WalletRpcClient
99
109
 
@@ -122,7 +132,7 @@ def print_transaction(
122
132
  name: str,
123
133
  address_prefix: str,
124
134
  mojo_per_unit: int,
125
- coin_record: Optional[dict[str, Any]] = None,
135
+ coin_record: dict[str, Any] | None = None,
126
136
  ) -> None:
127
137
  if verbose:
128
138
  print(tx)
@@ -197,7 +207,7 @@ async def get_unit_name_for_wallet_id(
197
207
 
198
208
 
199
209
  async def get_transaction(
200
- *, root_path: pathlib.Path, wallet_rpc_port: Optional[int], fingerprint: Optional[int], tx_id: str, verbose: int
210
+ *, root_path: pathlib.Path, wallet_rpc_port: int | None, fingerprint: int | None, tx_id: str, verbose: int
201
211
  ) -> None:
202
212
  async with get_wallet_client(root_path, wallet_rpc_port, fingerprint) as (wallet_client, _, config):
203
213
  transaction_id = bytes32.from_hexstr(tx_id)
@@ -231,11 +241,11 @@ async def get_transaction(
231
241
  async def get_transactions(
232
242
  *,
233
243
  root_path: pathlib.Path,
234
- wallet_rpc_port: Optional[int],
235
- fp: Optional[int],
244
+ wallet_rpc_port: int | None,
245
+ fp: int | None,
236
246
  wallet_id: int,
237
247
  verbose: int,
238
- paginate: Optional[bool],
248
+ paginate: bool | None,
239
249
  offset: int,
240
250
  limit: int,
241
251
  sort_key: SortKey,
@@ -256,8 +266,8 @@ async def get_transactions(
256
266
  await wallet_client.get_transactions(
257
267
  GetTransactions(
258
268
  uint32(wallet_id),
259
- start=uint16(offset),
260
- end=uint16(offset + limit),
269
+ start=uint32(offset),
270
+ end=uint32(offset + limit),
261
271
  sort_key=sort_key.name,
262
272
  reverse=reverse,
263
273
  type_filter=type_filter,
@@ -288,7 +298,7 @@ async def get_transactions(
288
298
  for j in range(num_per_screen):
289
299
  if i + j + skipped >= len(txs):
290
300
  break
291
- coin_record: Optional[dict[str, Any]] = None
301
+ coin_record: dict[str, Any] | None = None
292
302
  if txs[i + j + skipped].type in CLAWBACK_INCOMING_TRANSACTION_TYPES:
293
303
  coin_records = await wallet_client.get_coin_records(
294
304
  GetCoinRecords(coin_id_filter=HashFilter.include([txs[i + j + skipped].additions[0].name()]))
@@ -327,18 +337,18 @@ def check_unusual_transaction(amount: uint64, fee: uint64) -> bool:
327
337
  async def send(
328
338
  *,
329
339
  root_path: pathlib.Path,
330
- wallet_rpc_port: Optional[int],
331
- fp: Optional[int],
340
+ wallet_rpc_port: int | None,
341
+ fp: int | None,
332
342
  wallet_id: int,
333
343
  amount: CliAmount,
334
- memo: Optional[str],
344
+ memo: str | None,
335
345
  fee: uint64,
336
346
  address: CliAddress,
337
347
  override: bool,
338
348
  min_coin_amount: CliAmount,
339
349
  max_coin_amount: CliAmount,
340
350
  excluded_coin_ids: Sequence[bytes32],
341
- reuse_puzhash: Optional[bool],
351
+ reuse_puzhash: bool | None,
342
352
  clawback_time_lock: int,
343
353
  push: bool,
344
354
  condition_valid_times: ConditionValidTimes,
@@ -373,7 +383,7 @@ async def send(
373
383
 
374
384
  if typ == WalletType.STANDARD_WALLET:
375
385
  print("Submitting transaction...")
376
- res: Union[CATSpendResponse, SendTransactionResponse] = await wallet_client.send_transaction(
386
+ res: CATSpendResponse | SendTransactionResponse = await wallet_client.send_transaction(
377
387
  SendTransaction(
378
388
  wallet_id=uint32(wallet_id),
379
389
  amount=final_amount,
@@ -441,7 +451,7 @@ async def send(
441
451
 
442
452
 
443
453
  async def get_address(
444
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id: int, new_address: bool
454
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, wallet_id: int, new_address: bool
445
455
  ) -> None:
446
456
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
447
457
  res = (await wallet_client.get_next_address(GetNextAddress(uint32(wallet_id), new_address))).address
@@ -449,21 +459,21 @@ async def get_address(
449
459
 
450
460
 
451
461
  async def delete_unconfirmed_transactions(
452
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id: int
462
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, wallet_id: int
453
463
  ) -> None:
454
464
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, fingerprint, _):
455
465
  await wallet_client.delete_unconfirmed_transactions(DeleteUnconfirmedTransactions(uint32(wallet_id)))
456
466
  print(f"Successfully deleted all unconfirmed transactions for wallet id {wallet_id} on key {fingerprint}")
457
467
 
458
468
 
459
- async def get_derivation_index(root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int]) -> None:
469
+ async def get_derivation_index(root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None) -> None:
460
470
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
461
471
  res = await wallet_client.get_current_derivation_index()
462
472
  print(f"Last derivation index: {res.index}")
463
473
 
464
474
 
465
475
  async def update_derivation_index(
466
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], index: int
476
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, index: int
467
477
  ) -> None:
468
478
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
469
479
  print("Updating derivation index... This may take a while.")
@@ -473,14 +483,22 @@ async def update_derivation_index(
473
483
 
474
484
 
475
485
  async def add_token(
476
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], asset_id: bytes32, token_name: str
486
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, asset_id: bytes32, token_name: str
477
487
  ) -> None:
478
488
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, fingerprint, _):
479
489
  existing_info = await wallet_client.cat_asset_id_to_name(CATAssetIDToName(asset_id))
480
490
 
481
491
  if existing_info.wallet_id is None:
482
- response = await wallet_client.create_wallet_for_existing_cat(asset_id)
483
- wallet_id = response["wallet_id"]
492
+ response = await wallet_client.create_new_wallet(
493
+ CreateNewWallet(
494
+ wallet_type=CreateNewWalletType.CAT_WALLET,
495
+ mode=WalletCreationMode.EXISTING,
496
+ asset_id=asset_id,
497
+ push=True,
498
+ ),
499
+ tx_config=DEFAULT_TX_CONFIG,
500
+ )
501
+ wallet_id = response.wallet_id
484
502
  await wallet_client.set_cat_name(CATSetName(wallet_id, token_name))
485
503
  print(f"Successfully added {token_name} with wallet id {wallet_id} on key {fingerprint}")
486
504
  else:
@@ -494,21 +512,21 @@ async def add_token(
494
512
  async def make_offer(
495
513
  *,
496
514
  root_path: pathlib.Path,
497
- wallet_rpc_port: Optional[int],
498
- fp: Optional[int],
515
+ wallet_rpc_port: int | None,
516
+ fp: int | None,
499
517
  fee: uint64,
500
518
  offers: Sequence[str],
501
519
  requests: Sequence[str],
502
520
  filepath: pathlib.Path,
503
- reuse_puzhash: Optional[bool],
521
+ reuse_puzhash: bool | None,
504
522
  condition_valid_times: ConditionValidTimes,
505
523
  ) -> None:
506
524
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, fingerprint, config):
507
525
  if offers == [] or requests == []:
508
526
  print("Not creating offer: Must be offering and requesting at least one asset")
509
527
  else:
510
- offer_dict: dict[Union[uint32, str], int] = {}
511
- driver_dict: dict[str, Any] = {}
528
+ offer_dict: dict[str, str] = {}
529
+ driver_dict: dict[bytes32, PuzzleInfo] = {}
512
530
  printable_dict: dict[str, tuple[str, int, int]] = {} # dict[asset_name, tuple[amount, unit, multiplier]]
513
531
  royalty_assets: list[RoyaltyAsset] = []
514
532
  fungible_assets: list[FungibleAsset] = []
@@ -516,7 +534,7 @@ async def make_offer(
516
534
  name, amount = tuple(item.split(":")[0:2])
517
535
  try:
518
536
  b32_id = bytes32.from_hexstr(name)
519
- id: Union[uint32, str] = b32_id.hex()
537
+ id: str = b32_id.hex()
520
538
  result = await wallet_client.cat_asset_id_to_name(CATAssetIDToName(b32_id))
521
539
  if result.name is not None:
522
540
  name = result.name
@@ -535,7 +553,7 @@ async def make_offer(
535
553
  id = info.launcher_id.hex()
536
554
  assert isinstance(id, str)
537
555
  if item in requests:
538
- driver_dict[id] = {
556
+ puzzle_info_dict: dict[str, Any] = {
539
557
  "type": "singleton",
540
558
  "launcher_id": "0x" + id,
541
559
  "launcher_ph": "0x" + info.launcher_puzhash.hex(),
@@ -548,7 +566,7 @@ async def make_offer(
548
566
  if info.supports_did:
549
567
  assert info.royalty_puzzle_hash is not None
550
568
  assert info.royalty_percentage is not None
551
- driver_dict[id]["also"]["also"] = {
569
+ puzzle_info_dict["also"]["also"] = {
552
570
  "type": "ownership",
553
571
  "owner": "()",
554
572
  "transfer_program": {
@@ -565,17 +583,18 @@ async def make_offer(
565
583
  info.royalty_percentage,
566
584
  )
567
585
  )
586
+ driver_dict[info.launcher_id] = PuzzleInfo(puzzle_info_dict)
568
587
  else:
569
588
  id = decode_puzzle_hash(name).hex()
570
589
  assert hrp is not None
571
590
  unit = units[hrp]
572
591
  except ValueError:
573
- id = uint32(name)
574
- if id == 1:
592
+ id = str(uint32(name))
593
+ if id == "1":
575
594
  name = "XCH"
576
595
  unit = units["chia"]
577
596
  else:
578
- name = (await wallet_client.get_cat_name(CATGetName(id))).name
597
+ name = (await wallet_client.get_cat_name(CATGetName(uint32(name)))).name
579
598
  unit = units["cat"]
580
599
  if item in offers:
581
600
  fungible_assets.append(FungibleAsset(name, uint64(abs(int(Decimal(amount) * unit)))))
@@ -585,7 +604,7 @@ async def make_offer(
585
604
  print("Not creating offer: Cannot offer and request the same asset in a trade")
586
605
  break
587
606
  else:
588
- offer_dict[id] = int(Decimal(amount) * unit) * multiplier
607
+ offer_dict[id] = str(int(Decimal(amount) * unit) * multiplier)
589
608
  else:
590
609
  print("Creating Offer")
591
610
  print("--------------")
@@ -642,9 +661,11 @@ async def make_offer(
642
661
 
643
662
  with filepath.open(mode="w") as file:
644
663
  res = await wallet_client.create_offer_for_ids(
645
- offer_dict,
646
- driver_dict=driver_dict,
647
- fee=fee,
664
+ CreateOfferForIDs(
665
+ offer=offer_dict,
666
+ driver_dict=driver_dict,
667
+ fee=fee,
668
+ ),
648
669
  tx_config=CMDTXConfigLoader(
649
670
  reuse_puzhash=reuse_puzhash,
650
671
  ).to_tx_config(units["chia"], config, fingerprint),
@@ -666,7 +687,7 @@ def timestamp_to_time(timestamp: int) -> str:
666
687
 
667
688
 
668
689
  async def print_offer_summary(
669
- cat_name_resolver: CATNameResolver, sum_dict: dict[str, int], has_fee: bool = False, network_xch: str = "XCH"
690
+ cat_name_resolver: CATNameResolver, sum_dict: dict[str, str], has_fee: bool = False, network_xch: str = "XCH"
670
691
  ) -> None:
671
692
  for asset_id, amount in sum_dict.items():
672
693
  description: str = ""
@@ -717,7 +738,7 @@ async def print_trade_record(record: TradeRecord, wallet_client: WalletRpcClient
717
738
  print("Summary:")
718
739
  offer = Offer.from_bytes(record.offer)
719
740
  offered, requested, _, _ = offer.summary()
720
- outbound_balances: dict[str, int] = offer.get_pending_amounts()
741
+ outbound_balances: dict[str, str] = {k: str(v) for k, v in offer.get_pending_amounts().items()}
721
742
  fees: Decimal = Decimal(offer.fees())
722
743
  cat_name_resolver = wallet_client.cat_asset_id_to_name
723
744
  print(" OFFERED:")
@@ -742,10 +763,10 @@ async def print_trade_record(record: TradeRecord, wallet_client: WalletRpcClient
742
763
  async def get_offers(
743
764
  *,
744
765
  root_path: pathlib.Path,
745
- wallet_rpc_port: Optional[int],
746
- fp: Optional[int],
747
- offer_id: Optional[bytes32],
748
- filepath: Optional[str],
766
+ wallet_rpc_port: int | None,
767
+ fp: int | None,
768
+ offer_id: bytes32 | None,
769
+ filepath: str | None,
749
770
  exclude_my_offers: bool = False,
750
771
  exclude_taken_offers: bool = False,
751
772
  include_completed: bool = False,
@@ -763,16 +784,20 @@ async def get_offers(
763
784
 
764
785
  # Traverse offers page by page
765
786
  while True:
766
- new_records: list[TradeRecord] = await wallet_client.get_all_offers(
767
- start,
768
- end,
769
- sort_key="RELEVANCE" if sort_by_relevance else "CONFIRMED_AT_HEIGHT",
770
- reverse=reverse,
771
- file_contents=file_contents,
772
- exclude_my_offers=exclude_my_offers,
773
- exclude_taken_offers=exclude_taken_offers,
774
- include_completed=include_completed,
775
- )
787
+ new_records: list[TradeRecord] = (
788
+ await wallet_client.get_all_offers(
789
+ GetAllOffers(
790
+ start=uint16(start),
791
+ end=uint16(end),
792
+ sort_key="RELEVANCE" if sort_by_relevance else "CONFIRMED_AT_HEIGHT",
793
+ reverse=reverse,
794
+ file_contents=file_contents,
795
+ exclude_my_offers=exclude_my_offers,
796
+ exclude_taken_offers=exclude_taken_offers,
797
+ include_completed=include_completed,
798
+ )
799
+ )
800
+ ).trade_records
776
801
  records.extend(new_records)
777
802
 
778
803
  # If fewer records were returned than requested, we're done
@@ -782,7 +807,7 @@ async def get_offers(
782
807
  start = end
783
808
  end += batch_size
784
809
  else:
785
- records = [await wallet_client.get_offer(offer_id, file_contents)]
810
+ records = [(await wallet_client.get_offer(GetOffer(offer_id, file_contents))).trade_record]
786
811
  if filepath is not None:
787
812
  with open(pathlib.Path(filepath), "w") as file:
788
813
  file.write(Offer.from_bytes(records[0].offer).to_bech32())
@@ -794,8 +819,8 @@ async def get_offers(
794
819
 
795
820
  async def take_offer(
796
821
  root_path: pathlib.Path,
797
- wallet_rpc_port: Optional[int],
798
- fp: Optional[int],
822
+ wallet_rpc_port: int | None,
823
+ fp: int | None,
799
824
  fee: uint64,
800
825
  file: str,
801
826
  examine_only: bool,
@@ -888,11 +913,9 @@ async def take_offer(
888
913
  print()
889
914
  cli_confirm("Would you like to take this offer? (y/n): ")
890
915
  res = await wallet_client.take_offer(
891
- offer,
892
- fee=fee,
893
- tx_config=CMDTXConfigLoader().to_tx_config(units["chia"], config, fingerprint),
894
- push=push,
916
+ TakeOffer(offer=offer.to_bech32(), fee=fee, push=push),
895
917
  timelock_info=condition_valid_times,
918
+ tx_config=CMDTXConfigLoader().to_tx_config(units["chia"], config, fingerprint),
896
919
  )
897
920
  if push:
898
921
  print(f"Accepted offer with ID {res.trade_record.trade_id}")
@@ -907,8 +930,8 @@ async def take_offer(
907
930
 
908
931
  async def cancel_offer(
909
932
  root_path: pathlib.Path,
910
- wallet_rpc_port: Optional[int],
911
- fp: Optional[int],
933
+ wallet_rpc_port: int | None,
934
+ fp: int | None,
912
935
  fee: uint64,
913
936
  offer_id: bytes32,
914
937
  secure: bool,
@@ -916,16 +939,13 @@ async def cancel_offer(
916
939
  condition_valid_times: ConditionValidTimes,
917
940
  ) -> list[TransactionRecord]:
918
941
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, fingerprint, config):
919
- trade_record = await wallet_client.get_offer(offer_id, file_contents=True)
942
+ trade_record = (await wallet_client.get_offer(GetOffer(offer_id, file_contents=True))).trade_record
920
943
  await print_trade_record(trade_record, wallet_client, summaries=True)
921
944
 
922
945
  cli_confirm(f"Are you sure you wish to cancel offer with ID: {trade_record.trade_id}? (y/n): ")
923
946
  res = await wallet_client.cancel_offer(
924
- offer_id,
925
- CMDTXConfigLoader().to_tx_config(units["chia"], config, fingerprint),
926
- secure=secure,
927
- fee=fee,
928
- push=push,
947
+ CancelOffer(trade_id=offer_id, secure=secure, fee=fee, push=push),
948
+ tx_config=CMDTXConfigLoader().to_tx_config(units["chia"], config, fingerprint),
929
949
  timelock_info=condition_valid_times,
930
950
  )
931
951
  if push or not secure:
@@ -956,7 +976,7 @@ def print_balance(amount: int, scale: int, address_prefix: str, *, decimal_only:
956
976
 
957
977
 
958
978
  async def print_balances(
959
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], wallet_type: Optional[WalletType] = None
979
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, wallet_type: WalletType | None = None
960
980
  ) -> None:
961
981
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, fingerprint, config):
962
982
  summaries_response = await wallet_client.get_wallets(GetWallets(uint16.construct_optional(wallet_type)))
@@ -992,7 +1012,7 @@ async def print_balances(
992
1012
  balances.unconfirmed_wallet_balance, scale, address_prefix
993
1013
  )
994
1014
  spendable_balance: str = print_balance(balances.spendable_balance, scale, address_prefix)
995
- my_did: Optional[str] = None
1015
+ my_did: str | None = None
996
1016
  ljust = 23
997
1017
  if typ == WalletType.CRCAT:
998
1018
  ljust = 36
@@ -1028,26 +1048,30 @@ async def print_balances(
1028
1048
 
1029
1049
  async def create_did_wallet(
1030
1050
  root_path: pathlib.Path,
1031
- wallet_rpc_port: Optional[int],
1032
- fp: Optional[int],
1051
+ wallet_rpc_port: int | None,
1052
+ fp: int | None,
1033
1053
  fee: uint64,
1034
- name: Optional[str],
1054
+ name: str | None,
1035
1055
  amount: int,
1036
1056
  push: bool,
1037
1057
  condition_valid_times: ConditionValidTimes,
1038
1058
  ) -> list[TransactionRecord]:
1039
1059
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, fingerprint, config):
1040
1060
  try:
1041
- response = await wallet_client.create_new_did_wallet(
1042
- amount,
1043
- CMDTXConfigLoader().to_tx_config(units["chia"], config, fingerprint),
1044
- fee,
1045
- name,
1046
- push=push,
1061
+ response = await wallet_client.create_new_wallet(
1062
+ CreateNewWallet(
1063
+ wallet_type=CreateNewWalletType.DID_WALLET,
1064
+ did_type=DIDType.NEW,
1065
+ amount=uint64(amount),
1066
+ fee=fee,
1067
+ wallet_name=name,
1068
+ push=push,
1069
+ ),
1070
+ tx_config=CMDTXConfigLoader().to_tx_config(units["chia"], config, fingerprint),
1047
1071
  timelock_info=condition_valid_times,
1048
1072
  )
1049
- wallet_id = response["wallet_id"]
1050
- my_did = response["my_did"]
1073
+ wallet_id = response.wallet_id
1074
+ my_did = response.my_did
1051
1075
  print(f"Successfully created a DID wallet with name {name} and id {wallet_id} on key {fingerprint}")
1052
1076
  print(f"Successfully created a DID {my_did} in the newly created DID wallet")
1053
1077
  return [] # TODO: fix this endpoint to return transactions
@@ -1057,7 +1081,7 @@ async def create_did_wallet(
1057
1081
 
1058
1082
 
1059
1083
  async def did_set_wallet_name(
1060
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id: int, name: str
1084
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, wallet_id: int, name: str
1061
1085
  ) -> None:
1062
1086
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1063
1087
  try:
@@ -1067,9 +1091,7 @@ async def did_set_wallet_name(
1067
1091
  print(f"Failed to set DID wallet name: {e}")
1068
1092
 
1069
1093
 
1070
- async def get_did(
1071
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], did_wallet_id: int
1072
- ) -> None:
1094
+ async def get_did(root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, did_wallet_id: int) -> None:
1073
1095
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1074
1096
  try:
1075
1097
  response = await wallet_client.get_did_id(DIDGetDID(uint32(did_wallet_id)))
@@ -1080,7 +1102,7 @@ async def get_did(
1080
1102
 
1081
1103
 
1082
1104
  async def get_did_info(
1083
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], coin_id: str, latest: bool
1105
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, coin_id: str, latest: bool
1084
1106
  ) -> None:
1085
1107
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1086
1108
  did_padding_length = 23
@@ -1107,8 +1129,8 @@ async def get_did_info(
1107
1129
 
1108
1130
  async def update_did_metadata(
1109
1131
  root_path: pathlib.Path,
1110
- wallet_rpc_port: Optional[int],
1111
- fp: Optional[int],
1132
+ wallet_rpc_port: int | None,
1133
+ fp: int | None,
1112
1134
  did_wallet_id: int,
1113
1135
  metadata: str,
1114
1136
  reuse_puzhash: bool,
@@ -1141,8 +1163,8 @@ async def update_did_metadata(
1141
1163
 
1142
1164
  async def did_message_spend(
1143
1165
  root_path: pathlib.Path,
1144
- wallet_rpc_port: Optional[int],
1145
- fp: Optional[int],
1166
+ wallet_rpc_port: int | None,
1167
+ fp: int | None,
1146
1168
  did_wallet_id: int,
1147
1169
  puzzle_announcements: list[str],
1148
1170
  coin_announcements: list[str],
@@ -1169,13 +1191,13 @@ async def did_message_spend(
1169
1191
 
1170
1192
  async def transfer_did(
1171
1193
  root_path: pathlib.Path,
1172
- wallet_rpc_port: Optional[int],
1173
- fp: Optional[int],
1194
+ wallet_rpc_port: int | None,
1195
+ fp: int | None,
1174
1196
  did_wallet_id: int,
1175
1197
  fee: uint64,
1176
1198
  target_cli_address: CliAddress,
1177
1199
  with_recovery: bool,
1178
- reuse_puzhash: Optional[bool],
1200
+ reuse_puzhash: bool | None,
1179
1201
  push: bool,
1180
1202
  condition_valid_times: ConditionValidTimes,
1181
1203
  ) -> list[TransactionRecord]:
@@ -1208,12 +1230,12 @@ async def transfer_did(
1208
1230
  async def find_lost_did(
1209
1231
  *,
1210
1232
  root_path: pathlib.Path,
1211
- wallet_rpc_port: Optional[int],
1212
- fp: Optional[int],
1233
+ wallet_rpc_port: int | None,
1234
+ fp: int | None,
1213
1235
  coin_id: str,
1214
- metadata: Optional[str],
1215
- recovery_list_hash: Optional[str],
1216
- num_verification: Optional[int],
1236
+ metadata: str | None,
1237
+ recovery_list_hash: str | None,
1238
+ num_verification: int | None,
1217
1239
  ) -> None:
1218
1240
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1219
1241
  try:
@@ -1232,16 +1254,23 @@ async def find_lost_did(
1232
1254
 
1233
1255
  async def create_nft_wallet(
1234
1256
  root_path: pathlib.Path,
1235
- wallet_rpc_port: Optional[int],
1236
- fp: Optional[int],
1237
- did_id: Optional[CliAddress] = None,
1238
- name: Optional[str] = None,
1257
+ wallet_rpc_port: int | None,
1258
+ fp: int | None,
1259
+ did_id: CliAddress | None = None,
1260
+ name: str | None = None,
1239
1261
  ) -> None:
1240
1262
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, fingerprint, _):
1241
1263
  try:
1242
- response = await wallet_client.create_new_nft_wallet(did_id.original_address if did_id else None, name)
1243
- wallet_id = response["wallet_id"]
1244
- print(f"Successfully created an NFT wallet with id {wallet_id} on key {fingerprint}")
1264
+ response = await wallet_client.create_new_wallet(
1265
+ CreateNewWallet(
1266
+ wallet_type=CreateNewWalletType.NFT_WALLET,
1267
+ did_id=(did_id.original_address if did_id else None),
1268
+ name=name,
1269
+ push=True,
1270
+ ),
1271
+ DEFAULT_TX_CONFIG,
1272
+ )
1273
+ print(f"Successfully created an NFT wallet with id {response.wallet_id} on key {fingerprint}")
1245
1274
  except Exception as e:
1246
1275
  print(f"Failed to create NFT wallet: {e}")
1247
1276
 
@@ -1249,23 +1278,23 @@ async def create_nft_wallet(
1249
1278
  async def mint_nft(
1250
1279
  *,
1251
1280
  root_path: pathlib.Path,
1252
- wallet_rpc_port: Optional[int],
1253
- fp: Optional[int],
1281
+ wallet_rpc_port: int | None,
1282
+ fp: int | None,
1254
1283
  wallet_id: int,
1255
- royalty_cli_address: Optional[CliAddress],
1256
- target_cli_address: Optional[CliAddress],
1284
+ royalty_cli_address: CliAddress | None,
1285
+ target_cli_address: CliAddress | None,
1257
1286
  no_did_ownership: bool,
1258
1287
  hash: str,
1259
1288
  uris: list[str],
1260
- metadata_hash: Optional[str],
1289
+ metadata_hash: str | None,
1261
1290
  metadata_uris: list[str],
1262
- license_hash: Optional[str],
1291
+ license_hash: str | None,
1263
1292
  license_uris: list[str],
1264
- edition_total: Optional[int],
1265
- edition_number: Optional[int],
1293
+ edition_total: int | None,
1294
+ edition_number: int | None,
1266
1295
  fee: uint64,
1267
1296
  royalty_percentage: int,
1268
- reuse_puzhash: Optional[bool],
1297
+ reuse_puzhash: bool | None,
1269
1298
  push: bool,
1270
1299
  condition_valid_times: ConditionValidTimes,
1271
1300
  ) -> list[TransactionRecord]:
@@ -1276,7 +1305,7 @@ async def mint_nft(
1276
1305
  response = await wallet_client.get_nft_wallet_did(NFTGetWalletDID(uint32(wallet_id)))
1277
1306
  wallet_did = response.did_id
1278
1307
  wallet_has_did = wallet_did is not None
1279
- did_id: Optional[str] = wallet_did
1308
+ did_id: str | None = wallet_did
1280
1309
  # Handle the case when the user wants to disable DID ownership
1281
1310
  if no_did_ownership:
1282
1311
  if wallet_has_did:
@@ -1321,15 +1350,15 @@ async def mint_nft(
1321
1350
  async def add_uri_to_nft(
1322
1351
  *,
1323
1352
  root_path: pathlib.Path,
1324
- wallet_rpc_port: Optional[int],
1325
- fp: Optional[int],
1353
+ wallet_rpc_port: int | None,
1354
+ fp: int | None,
1326
1355
  wallet_id: int,
1327
1356
  fee: uint64,
1328
1357
  nft_coin_id: str,
1329
- uri: Optional[str],
1330
- metadata_uri: Optional[str],
1331
- license_uri: Optional[str],
1332
- reuse_puzhash: Optional[bool],
1358
+ uri: str | None,
1359
+ metadata_uri: str | None,
1360
+ license_uri: str | None,
1361
+ reuse_puzhash: bool | None,
1333
1362
  push: bool,
1334
1363
  condition_valid_times: ConditionValidTimes,
1335
1364
  ) -> list[TransactionRecord]:
@@ -1374,13 +1403,13 @@ async def add_uri_to_nft(
1374
1403
  async def transfer_nft(
1375
1404
  *,
1376
1405
  root_path: pathlib.Path,
1377
- wallet_rpc_port: Optional[int],
1378
- fp: Optional[int],
1406
+ wallet_rpc_port: int | None,
1407
+ fp: int | None,
1379
1408
  wallet_id: int,
1380
1409
  fee: uint64,
1381
1410
  nft_coin_id: str,
1382
1411
  target_cli_address: CliAddress,
1383
- reuse_puzhash: Optional[bool],
1412
+ reuse_puzhash: bool | None,
1384
1413
  push: bool,
1385
1414
  condition_valid_times: ConditionValidTimes,
1386
1415
  ) -> list[TransactionRecord]:
@@ -1449,8 +1478,8 @@ def print_nft_info(nft: NFTInfo, *, config: dict[str, Any]) -> None:
1449
1478
 
1450
1479
  async def list_nfts(
1451
1480
  root_path: pathlib.Path,
1452
- wallet_rpc_port: Optional[int],
1453
- fp: Optional[int],
1481
+ wallet_rpc_port: int | None,
1482
+ fp: int | None,
1454
1483
  wallet_id: int,
1455
1484
  num: int,
1456
1485
  start_index: int,
@@ -1471,13 +1500,13 @@ async def list_nfts(
1471
1500
  async def set_nft_did(
1472
1501
  *,
1473
1502
  root_path: pathlib.Path,
1474
- wallet_rpc_port: Optional[int],
1475
- fp: Optional[int],
1503
+ wallet_rpc_port: int | None,
1504
+ fp: int | None,
1476
1505
  wallet_id: int,
1477
1506
  fee: uint64,
1478
1507
  nft_coin_id: str,
1479
1508
  did_id: str,
1480
- reuse_puzhash: Optional[bool],
1509
+ reuse_puzhash: bool | None,
1481
1510
  push: bool,
1482
1511
  condition_valid_times: ConditionValidTimes,
1483
1512
  ) -> list[TransactionRecord]:
@@ -1504,9 +1533,7 @@ async def set_nft_did(
1504
1533
  return []
1505
1534
 
1506
1535
 
1507
- async def get_nft_info(
1508
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], nft_coin_id: str
1509
- ) -> None:
1536
+ async def get_nft_info(root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, nft_coin_id: str) -> None:
1510
1537
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, config):
1511
1538
  try:
1512
1539
  response = await wallet_client.get_nft_info(NFTGetInfo(nft_coin_id))
@@ -1562,7 +1589,7 @@ def nft_coin_ids_supporting_royalties_from_offer(offer: Offer) -> list[bytes32]:
1562
1589
  ]
1563
1590
 
1564
1591
 
1565
- def fungible_assets_from_offer(offer: Offer) -> list[Optional[bytes32]]:
1592
+ def fungible_assets_from_offer(offer: Offer) -> list[bytes32 | None]:
1566
1593
  return [
1567
1594
  asset for asset in offer.arbitrage() if asset is None or driver_dict_asset_is_fungible(offer.driver_dict, asset)
1568
1595
  ]
@@ -1570,8 +1597,8 @@ def fungible_assets_from_offer(offer: Offer) -> list[Optional[bytes32]]:
1570
1597
 
1571
1598
  async def send_notification(
1572
1599
  root_path: pathlib.Path,
1573
- wallet_rpc_port: Optional[int],
1574
- fp: Optional[int],
1600
+ wallet_rpc_port: int | None,
1601
+ fp: int | None,
1575
1602
  fee: uint64,
1576
1603
  address: CliAddress,
1577
1604
  message: bytes,
@@ -1605,11 +1632,11 @@ async def send_notification(
1605
1632
 
1606
1633
  async def get_notifications(
1607
1634
  root_path: pathlib.Path,
1608
- wallet_rpc_port: Optional[int],
1609
- fp: Optional[int],
1610
- ids: Optional[Sequence[bytes32]],
1611
- start: Optional[int],
1612
- end: Optional[int],
1635
+ wallet_rpc_port: int | None,
1636
+ fp: int | None,
1637
+ ids: Sequence[bytes32] | None,
1638
+ start: int | None,
1639
+ end: int | None,
1613
1640
  ) -> None:
1614
1641
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1615
1642
  if ids is not None:
@@ -1625,7 +1652,7 @@ async def get_notifications(
1625
1652
 
1626
1653
 
1627
1654
  async def delete_notifications(
1628
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], ids: Sequence[bytes32], delete_all: bool
1655
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, ids: Sequence[bytes32], delete_all: bool
1629
1656
  ) -> None:
1630
1657
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1631
1658
  if delete_all:
@@ -1639,16 +1666,16 @@ async def delete_notifications(
1639
1666
  async def sign_message(
1640
1667
  *,
1641
1668
  root_path: pathlib.Path,
1642
- wallet_rpc_port: Optional[int],
1643
- fp: Optional[int],
1669
+ wallet_rpc_port: int | None,
1670
+ fp: int | None,
1644
1671
  addr_type: AddressType,
1645
1672
  message: str,
1646
- address: Optional[CliAddress] = None,
1647
- did_id: Optional[CliAddress] = None,
1648
- nft_id: Optional[CliAddress] = None,
1673
+ address: CliAddress | None = None,
1674
+ did_id: CliAddress | None = None,
1675
+ nft_id: CliAddress | None = None,
1649
1676
  ) -> None:
1650
1677
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1651
- response: Union[SignMessageByAddressResponse, SignMessageByIDResponse]
1678
+ response: SignMessageByAddressResponse | SignMessageByIDResponse
1652
1679
  if addr_type == AddressType.XCH:
1653
1680
  if address is None:
1654
1681
  print("Address is required for XCH address type.")
@@ -1679,8 +1706,8 @@ async def sign_message(
1679
1706
  async def spend_clawback(
1680
1707
  *,
1681
1708
  root_path: pathlib.Path,
1682
- wallet_rpc_port: Optional[int],
1683
- fp: Optional[int],
1709
+ wallet_rpc_port: int | None,
1710
+ fp: int | None,
1684
1711
  fee: uint64,
1685
1712
  tx_ids_str: str,
1686
1713
  force: bool = False,
@@ -1708,11 +1735,11 @@ async def spend_clawback(
1708
1735
 
1709
1736
  async def mint_vc(
1710
1737
  root_path: pathlib.Path,
1711
- wallet_rpc_port: Optional[int],
1712
- fp: Optional[int],
1738
+ wallet_rpc_port: int | None,
1739
+ fp: int | None,
1713
1740
  did: CliAddress,
1714
1741
  fee: uint64,
1715
- target_address: Optional[CliAddress],
1742
+ target_address: CliAddress | None,
1716
1743
  push: bool,
1717
1744
  condition_valid_times: ConditionValidTimes,
1718
1745
  ) -> list[TransactionRecord]:
@@ -1743,9 +1770,7 @@ async def mint_vc(
1743
1770
  return res.transactions
1744
1771
 
1745
1772
 
1746
- async def get_vcs(
1747
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], start: int, count: int
1748
- ) -> None:
1773
+ async def get_vcs(root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, start: int, count: int) -> None:
1749
1774
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, config):
1750
1775
  get_list_response = await wallet_client.vc_get_list(VCGetList(uint32(start), uint32(count)))
1751
1776
  print("Proofs:")
@@ -1771,11 +1796,11 @@ async def get_vcs(
1771
1796
  async def spend_vc(
1772
1797
  *,
1773
1798
  root_path: pathlib.Path,
1774
- wallet_rpc_port: Optional[int],
1775
- fp: Optional[int],
1799
+ wallet_rpc_port: int | None,
1800
+ fp: int | None,
1776
1801
  vc_id: bytes32,
1777
1802
  fee: uint64,
1778
- new_puzhash: Optional[bytes32],
1803
+ new_puzhash: bytes32 | None,
1779
1804
  new_proof_hash: str,
1780
1805
  reuse_puzhash: bool,
1781
1806
  push: bool,
@@ -1814,7 +1839,7 @@ async def spend_vc(
1814
1839
 
1815
1840
 
1816
1841
  async def add_proof_reveal(
1817
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], proofs: Sequence[str], root_only: bool
1842
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, proofs: Sequence[str], root_only: bool
1818
1843
  ) -> None:
1819
1844
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1820
1845
  if len(proofs) == 0:
@@ -1832,7 +1857,7 @@ async def add_proof_reveal(
1832
1857
 
1833
1858
 
1834
1859
  async def get_proofs_for_root(
1835
- root_path: pathlib.Path, wallet_rpc_port: Optional[int], fp: Optional[int], proof_hash: str
1860
+ root_path: pathlib.Path, wallet_rpc_port: int | None, fp: int | None, proof_hash: str
1836
1861
  ) -> None:
1837
1862
  async with get_wallet_client(root_path, wallet_rpc_port, fp) as (wallet_client, _, _):
1838
1863
  proof_dict: dict[str, str] = (
@@ -1847,10 +1872,10 @@ async def get_proofs_for_root(
1847
1872
 
1848
1873
  async def revoke_vc(
1849
1874
  root_path: pathlib.Path,
1850
- wallet_rpc_port: Optional[int],
1851
- fp: Optional[int],
1852
- parent_coin_id: Optional[bytes32],
1853
- vc_id: Optional[bytes32],
1875
+ wallet_rpc_port: int | None,
1876
+ fp: int | None,
1877
+ parent_coin_id: bytes32 | None,
1878
+ vc_id: bytes32 | None,
1854
1879
  fee: uint64,
1855
1880
  reuse_puzhash: bool,
1856
1881
  push: bool,
@@ -1899,7 +1924,7 @@ async def revoke_vc(
1899
1924
 
1900
1925
  async def approve_r_cats(
1901
1926
  root_path: pathlib.Path,
1902
- wallet_rpc_port: Optional[int],
1927
+ wallet_rpc_port: int | None,
1903
1928
  fingerprint: int,
1904
1929
  wallet_id: uint32,
1905
1930
  min_amount_to_claim: CliAmount,
@@ -1913,18 +1938,22 @@ async def approve_r_cats(
1913
1938
  async with get_wallet_client(root_path, wallet_rpc_port, fingerprint) as (wallet_client, fp, config):
1914
1939
  if wallet_client is None:
1915
1940
  return
1916
- txs = await wallet_client.crcat_approve_pending(
1917
- wallet_id=wallet_id,
1918
- min_amount_to_claim=min_amount_to_claim.convert_amount(units["cat"]),
1919
- fee=fee,
1920
- tx_config=CMDTXConfigLoader(
1921
- min_coin_amount=min_coin_amount,
1922
- max_coin_amount=max_coin_amount,
1923
- reuse_puzhash=reuse,
1924
- ).to_tx_config(units["cat"], config, fp),
1925
- push=push,
1926
- timelock_info=condition_valid_times,
1927
- )
1941
+ txs = (
1942
+ await wallet_client.crcat_approve_pending(
1943
+ CRCATApprovePending(
1944
+ wallet_id=wallet_id,
1945
+ min_amount_to_claim=min_amount_to_claim.convert_amount(units["cat"]),
1946
+ fee=fee,
1947
+ push=push,
1948
+ ),
1949
+ tx_config=CMDTXConfigLoader(
1950
+ min_coin_amount=min_coin_amount,
1951
+ max_coin_amount=max_coin_amount,
1952
+ reuse_puzhash=reuse,
1953
+ ).to_tx_config(units["cat"], config, fp),
1954
+ timelock_info=condition_valid_times,
1955
+ )
1956
+ ).transactions
1928
1957
 
1929
1958
  if push:
1930
1959
  print("VC successfully approved R-CATs!")