chia-blockchain 2.5.4rc2__py3-none-any.whl → 2.5.5__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 (453) hide show
  1. chia/_tests/blockchain/blockchain_test_utils.py +2 -3
  2. chia/_tests/blockchain/test_augmented_chain.py +2 -3
  3. chia/_tests/blockchain/test_blockchain.py +261 -44
  4. chia/_tests/blockchain/test_blockchain_transactions.py +4 -3
  5. chia/_tests/blockchain/test_build_chains.py +197 -1
  6. chia/_tests/blockchain/test_get_block_generator.py +1 -1
  7. chia/_tests/blockchain/test_lookup_fork_chain.py +1 -1
  8. chia/_tests/clvm/benchmark_costs.py +1 -1
  9. chia/_tests/clvm/coin_store.py +3 -4
  10. chia/_tests/clvm/test_message_conditions.py +2 -2
  11. chia/_tests/clvm/test_puzzle_compression.py +2 -3
  12. chia/_tests/clvm/test_puzzles.py +1 -2
  13. chia/_tests/clvm/test_singletons.py +2 -3
  14. chia/_tests/clvm/test_spend_sim.py +7 -7
  15. chia/_tests/cmds/cmd_test_utils.py +30 -25
  16. chia/_tests/cmds/test_dev_gh.py +1 -1
  17. chia/_tests/cmds/test_farm_cmd.py +1 -1
  18. chia/_tests/cmds/test_show.py +1 -2
  19. chia/_tests/cmds/wallet/test_did.py +101 -56
  20. chia/_tests/cmds/wallet/test_nft.py +109 -84
  21. chia/_tests/cmds/wallet/test_notifications.py +1 -1
  22. chia/_tests/cmds/wallet/test_offer.toffer +1 -1
  23. chia/_tests/cmds/wallet/test_vcs.py +8 -8
  24. chia/_tests/cmds/wallet/test_wallet.py +100 -46
  25. chia/_tests/conftest.py +31 -20
  26. chia/_tests/connection_utils.py +1 -1
  27. chia/_tests/core/consensus/stores/__init__.py +0 -0
  28. chia/_tests/core/consensus/stores/test_coin_store_protocol.py +40 -0
  29. chia/_tests/core/consensus/test_block_creation.py +2 -31
  30. chia/_tests/core/consensus/test_pot_iterations.py +38 -3
  31. chia/_tests/core/custom_types/test_proof_of_space.py +154 -26
  32. chia/_tests/core/custom_types/test_spend_bundle.py +2 -3
  33. chia/_tests/core/daemon/test_daemon.py +80 -0
  34. chia/_tests/core/data_layer/test_data_layer.py +1 -1
  35. chia/_tests/core/data_layer/test_data_layer_util.py +1 -1
  36. chia/_tests/core/data_layer/test_data_rpc.py +14 -10
  37. chia/_tests/core/data_layer/test_data_store.py +5 -5
  38. chia/_tests/core/farmer/test_farmer_api.py +2 -2
  39. chia/_tests/core/full_node/full_sync/test_full_sync.py +446 -406
  40. chia/_tests/core/full_node/ram_db.py +3 -1
  41. chia/_tests/core/full_node/stores/test_block_store.py +28 -16
  42. chia/_tests/core/full_node/stores/test_coin_store.py +277 -185
  43. chia/_tests/core/full_node/stores/test_full_node_store.py +11 -4
  44. chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
  45. chia/_tests/core/full_node/test_address_manager.py +200 -27
  46. chia/_tests/core/full_node/test_block_height_map.py +2 -2
  47. chia/_tests/core/full_node/test_conditions.py +7 -6
  48. chia/_tests/core/full_node/test_full_node.py +456 -40
  49. chia/_tests/core/full_node/test_generator_tools.py +32 -2
  50. chia/_tests/core/full_node/test_hint_management.py +1 -1
  51. chia/_tests/core/full_node/test_node_load.py +20 -21
  52. chia/_tests/core/full_node/test_performance.py +3 -4
  53. chia/_tests/core/full_node/test_prev_tx_block.py +43 -0
  54. chia/_tests/core/full_node/test_subscriptions.py +1 -2
  55. chia/_tests/core/full_node/test_transactions.py +9 -5
  56. chia/_tests/core/full_node/test_tx_processing_queue.py +1 -2
  57. chia/_tests/core/large_block.py +1 -2
  58. chia/_tests/core/make_block_generator.py +3 -4
  59. chia/_tests/core/mempool/test_mempool.py +36 -86
  60. chia/_tests/core/mempool/test_mempool_fee_estimator.py +1 -1
  61. chia/_tests/core/mempool/test_mempool_item_queries.py +1 -3
  62. chia/_tests/core/mempool/test_mempool_manager.py +529 -69
  63. chia/_tests/core/mempool/test_mempool_performance.py +3 -2
  64. chia/_tests/core/mempool/test_singleton_fast_forward.py +61 -132
  65. chia/_tests/core/server/flood.py +1 -1
  66. chia/_tests/core/server/test_dos.py +1 -1
  67. chia/_tests/core/server/test_node_discovery.py +41 -27
  68. chia/_tests/core/server/test_rate_limits.py +1 -1
  69. chia/_tests/core/server/test_server.py +1 -1
  70. chia/_tests/core/services/test_services.py +5 -5
  71. chia/_tests/core/ssl/test_ssl.py +1 -1
  72. chia/_tests/core/test_cost_calculation.py +6 -6
  73. chia/_tests/core/test_crawler.py +2 -2
  74. chia/_tests/core/test_crawler_rpc.py +1 -1
  75. chia/_tests/core/test_db_conversion.py +3 -1
  76. chia/_tests/core/test_db_validation.py +5 -3
  77. chia/_tests/core/test_farmer_harvester_rpc.py +15 -15
  78. chia/_tests/core/test_filter.py +4 -1
  79. chia/_tests/core/test_full_node_rpc.py +99 -82
  80. chia/_tests/core/test_program.py +2 -2
  81. chia/_tests/core/util/test_block_cache.py +1 -1
  82. chia/_tests/core/util/test_keychain.py +2 -2
  83. chia/_tests/core/util/test_lockfile.py +1 -1
  84. chia/_tests/core/util/test_log_exceptions.py +5 -5
  85. chia/_tests/core/util/test_streamable.py +81 -22
  86. chia/_tests/db/test_db_wrapper.py +1 -3
  87. chia/_tests/environments/wallet.py +5 -5
  88. chia/_tests/farmer_harvester/test_farmer.py +9 -7
  89. chia/_tests/farmer_harvester/test_farmer_harvester.py +11 -4
  90. chia/_tests/farmer_harvester/test_filter_prefix_bits.py +6 -5
  91. chia/_tests/farmer_harvester/test_third_party_harvesters.py +15 -9
  92. chia/_tests/fee_estimation/test_fee_estimation_integration.py +1 -2
  93. chia/_tests/fee_estimation/test_fee_estimation_rpc.py +7 -5
  94. chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +1 -1
  95. chia/_tests/generator/test_compression.py +1 -2
  96. chia/_tests/generator/test_rom.py +8 -4
  97. chia/_tests/plot_sync/test_plot_sync.py +3 -3
  98. chia/_tests/plot_sync/test_receiver.py +3 -3
  99. chia/_tests/plot_sync/test_sender.py +1 -1
  100. chia/_tests/plot_sync/test_sync_simulated.py +3 -3
  101. chia/_tests/plot_sync/util.py +2 -2
  102. chia/_tests/pools/test_pool_cmdline.py +48 -21
  103. chia/_tests/pools/test_pool_puzzles_lifecycle.py +2 -3
  104. chia/_tests/pools/test_pool_rpc.py +237 -105
  105. chia/_tests/pools/test_pool_wallet.py +11 -2
  106. chia/_tests/pools/test_wallet_pool_store.py +5 -4
  107. chia/_tests/rpc/test_rpc_client.py +1 -1
  108. chia/_tests/simulation/test_simulation.py +13 -8
  109. chia/_tests/simulation/test_simulator.py +2 -2
  110. chia/_tests/timelord/test_new_peak.py +191 -47
  111. chia/_tests/timelord/test_timelord.py +1 -1
  112. chia/_tests/tools/test_full_sync.py +0 -2
  113. chia/_tests/tools/test_run_block.py +3 -1
  114. chia/_tests/util/benchmark_cost.py +3 -3
  115. chia/_tests/util/benchmarks.py +2 -2
  116. chia/_tests/util/blockchain.py +11 -5
  117. chia/_tests/util/blockchain_mock.py +1 -4
  118. chia/_tests/util/coin_store.py +29 -0
  119. chia/_tests/util/constants.py +2 -18
  120. chia/_tests/util/full_sync.py +3 -3
  121. chia/_tests/util/generator_tools_testing.py +2 -3
  122. chia/_tests/util/key_tool.py +2 -3
  123. chia/_tests/util/misc.py +33 -31
  124. chia/_tests/util/network_protocol_data.py +19 -17
  125. chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
  126. chia/_tests/util/protocol_messages_json.py +3 -1
  127. chia/_tests/util/run_block.py +2 -2
  128. chia/_tests/util/setup_nodes.py +7 -7
  129. chia/_tests/util/spend_sim.py +47 -55
  130. chia/_tests/util/test_condition_tools.py +5 -4
  131. chia/_tests/util/test_config.py +2 -2
  132. chia/_tests/util/test_dump_keyring.py +1 -1
  133. chia/_tests/util/test_full_block_utils.py +12 -14
  134. chia/_tests/util/test_misc.py +2 -2
  135. chia/_tests/util/test_paginator.py +4 -4
  136. chia/_tests/util/test_priority_mutex.py +2 -2
  137. chia/_tests/util/test_replace_str_to_bytes.py +15 -5
  138. chia/_tests/util/test_ssl_check.py +1 -1
  139. chia/_tests/util/test_testnet_overrides.py +13 -3
  140. chia/_tests/util/time_out_assert.py +4 -2
  141. chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +1 -1
  142. chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +1 -2
  143. chia/_tests/wallet/cat_wallet/test_cat_wallet.py +352 -432
  144. chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +3 -6
  145. chia/_tests/wallet/cat_wallet/test_trades.py +53 -77
  146. chia/_tests/wallet/clawback/test_clawback_decorator.py +3 -1
  147. chia/_tests/wallet/clawback/test_clawback_lifecycle.py +3 -3
  148. chia/_tests/wallet/clawback/test_clawback_metadata.py +4 -2
  149. chia/_tests/wallet/conftest.py +11 -12
  150. chia/_tests/wallet/db_wallet/test_db_graftroot.py +11 -4
  151. chia/_tests/wallet/db_wallet/test_dl_offers.py +433 -130
  152. chia/_tests/wallet/db_wallet/test_dl_wallet.py +3 -3
  153. chia/_tests/wallet/did_wallet/test_did.py +2132 -2000
  154. chia/_tests/wallet/nft_wallet/config.py +1 -1
  155. chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +1610 -742
  156. chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +486 -907
  157. chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +4 -4
  158. chia/_tests/wallet/nft_wallet/test_nft_wallet.py +517 -294
  159. chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +133 -62
  160. chia/_tests/wallet/rpc/test_wallet_rpc.py +495 -265
  161. chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +10 -6
  162. chia/_tests/wallet/sync/test_wallet_sync.py +89 -60
  163. chia/_tests/wallet/test_clvm_casts.py +88 -0
  164. chia/_tests/wallet/test_coin_management.py +1 -1
  165. chia/_tests/wallet/test_coin_selection.py +1 -1
  166. chia/_tests/wallet/test_conditions.py +1 -1
  167. chia/_tests/wallet/test_new_wallet_protocol.py +13 -11
  168. chia/_tests/wallet/test_notifications.py +5 -3
  169. chia/_tests/wallet/test_sign_coin_spends.py +6 -6
  170. chia/_tests/wallet/test_signer_protocol.py +13 -12
  171. chia/_tests/wallet/test_singleton.py +1 -1
  172. chia/_tests/wallet/test_singleton_lifecycle_fast.py +5 -7
  173. chia/_tests/wallet/test_util.py +2 -2
  174. chia/_tests/wallet/test_wallet.py +108 -29
  175. chia/_tests/wallet/test_wallet_action_scope.py +9 -2
  176. chia/_tests/wallet/test_wallet_blockchain.py +2 -3
  177. chia/_tests/wallet/test_wallet_key_val_store.py +1 -2
  178. chia/_tests/wallet/test_wallet_node.py +2 -4
  179. chia/_tests/wallet/test_wallet_retry.py +4 -2
  180. chia/_tests/wallet/test_wallet_state_manager.py +191 -5
  181. chia/_tests/wallet/test_wallet_test_framework.py +1 -1
  182. chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +8 -8
  183. chia/_tests/wallet/vc_wallet/test_vc_wallet.py +29 -12
  184. chia/_tests/wallet/wallet_block_tools.py +6 -6
  185. chia/_tests/weight_proof/test_weight_proof.py +10 -48
  186. chia/apis.py +1 -1
  187. chia/cmds/beta.py +1 -1
  188. chia/cmds/chia.py +9 -9
  189. chia/cmds/cmd_classes.py +12 -11
  190. chia/cmds/cmd_helpers.py +1 -1
  191. chia/cmds/cmds_util.py +12 -9
  192. chia/cmds/coin_funcs.py +2 -2
  193. chia/cmds/configure.py +2 -2
  194. chia/cmds/data.py +0 -2
  195. chia/cmds/data_funcs.py +1 -1
  196. chia/cmds/db_validate_func.py +1 -2
  197. chia/cmds/dev/__init__.py +0 -0
  198. chia/cmds/dev/data.py +273 -0
  199. chia/cmds/{gh.py → dev/gh.py} +5 -5
  200. chia/cmds/dev/main.py +22 -0
  201. chia/cmds/dev/mempool.py +78 -0
  202. chia/cmds/dev/mempool_funcs.py +63 -0
  203. chia/cmds/farm_funcs.py +5 -4
  204. chia/cmds/init_funcs.py +11 -11
  205. chia/cmds/keys.py +2 -2
  206. chia/cmds/keys_funcs.py +4 -4
  207. chia/cmds/netspace_funcs.py +1 -1
  208. chia/cmds/peer_funcs.py +2 -2
  209. chia/cmds/plotnft_funcs.py +72 -26
  210. chia/cmds/rpc.py +1 -1
  211. chia/cmds/show_funcs.py +5 -5
  212. chia/cmds/signer.py +8 -7
  213. chia/cmds/sim_funcs.py +8 -9
  214. chia/cmds/wallet.py +2 -2
  215. chia/cmds/wallet_funcs.py +165 -131
  216. chia/{util → consensus}/augmented_chain.py +1 -2
  217. chia/consensus/block_body_validation.py +54 -40
  218. chia/consensus/block_creation.py +42 -76
  219. chia/consensus/block_header_validation.py +32 -26
  220. chia/consensus/block_record.py +0 -3
  221. chia/consensus/blockchain.py +23 -32
  222. chia/consensus/blockchain_interface.py +1 -5
  223. chia/consensus/check_time_locks.py +57 -0
  224. chia/consensus/coin_store_protocol.py +151 -0
  225. chia/consensus/coinbase.py +0 -6
  226. chia/consensus/condition_costs.py +4 -0
  227. chia/{util → consensus}/condition_tools.py +4 -5
  228. chia/consensus/cost_calculator.py +1 -1
  229. chia/consensus/default_constants.py +32 -9
  230. chia/consensus/deficit.py +1 -3
  231. chia/consensus/difficulty_adjustment.py +1 -2
  232. chia/consensus/find_fork_point.py +1 -3
  233. chia/consensus/full_block_to_block_record.py +1 -6
  234. chia/{util → consensus}/generator_tools.py +1 -3
  235. chia/consensus/get_block_challenge.py +30 -7
  236. chia/consensus/make_sub_epoch_summary.py +1 -5
  237. chia/consensus/multiprocess_validation.py +21 -20
  238. chia/consensus/pot_iterations.py +74 -13
  239. chia/{util → consensus}/prev_transaction_block.py +1 -1
  240. chia/consensus/vdf_info_computation.py +1 -3
  241. chia/daemon/keychain_proxy.py +5 -5
  242. chia/daemon/server.py +22 -5
  243. chia/data_layer/data_layer.py +92 -51
  244. chia/{rpc → data_layer}/data_layer_rpc_api.py +1 -1
  245. chia/{rpc → data_layer}/data_layer_rpc_util.py +3 -6
  246. chia/data_layer/data_layer_util.py +4 -6
  247. chia/data_layer/data_layer_wallet.py +42 -69
  248. chia/data_layer/dl_wallet_store.py +12 -6
  249. chia/data_layer/download_data.py +3 -3
  250. chia/data_layer/s3_plugin_service.py +0 -1
  251. chia/farmer/farmer.py +3 -4
  252. chia/farmer/farmer_api.py +11 -7
  253. chia/{rpc → farmer}/farmer_rpc_client.py +1 -1
  254. chia/full_node/block_height_map.py +7 -6
  255. chia/full_node/block_store.py +5 -7
  256. chia/full_node/bundle_tools.py +1 -2
  257. chia/full_node/coin_store.py +153 -124
  258. chia/{types → full_node}/eligible_coin_spends.py +39 -70
  259. chia/full_node/fee_estimator.py +1 -1
  260. chia/full_node/fee_estimator_interface.py +0 -8
  261. chia/full_node/fee_tracker.py +25 -25
  262. chia/full_node/full_node.py +70 -53
  263. chia/full_node/full_node_api.py +57 -40
  264. chia/{rpc → full_node}/full_node_rpc_api.py +87 -8
  265. chia/{rpc → full_node}/full_node_rpc_client.py +7 -6
  266. chia/full_node/full_node_store.py +23 -8
  267. chia/full_node/mempool.py +206 -53
  268. chia/full_node/mempool_check_conditions.py +20 -63
  269. chia/full_node/mempool_manager.py +47 -45
  270. chia/full_node/subscriptions.py +1 -3
  271. chia/full_node/tx_processing_queue.py +50 -3
  272. chia/full_node/weight_proof.py +46 -37
  273. chia/harvester/harvester.py +1 -1
  274. chia/harvester/harvester_api.py +22 -7
  275. chia/introducer/introducer.py +1 -1
  276. chia/introducer/introducer_api.py +1 -1
  277. chia/plot_sync/exceptions.py +1 -1
  278. chia/plot_sync/receiver.py +1 -1
  279. chia/plot_sync/sender.py +2 -2
  280. chia/pools/pool_puzzles.py +13 -18
  281. chia/pools/pool_wallet.py +23 -46
  282. chia/protocols/farmer_protocol.py +11 -3
  283. chia/protocols/full_node_protocol.py +1 -4
  284. chia/protocols/harvester_protocol.py +3 -3
  285. chia/protocols/pool_protocol.py +1 -2
  286. chia/protocols/shared_protocol.py +3 -3
  287. chia/protocols/timelord_protocol.py +1 -3
  288. chia/protocols/wallet_protocol.py +3 -3
  289. chia/rpc/rpc_client.py +7 -8
  290. chia/rpc/rpc_server.py +3 -3
  291. chia/rpc/util.py +3 -1
  292. chia/seeder/crawler.py +1 -1
  293. chia/seeder/crawler_api.py +1 -1
  294. chia/seeder/dns_server.py +2 -0
  295. chia/seeder/start_crawler.py +3 -3
  296. chia/server/address_manager.py +286 -38
  297. chia/server/address_manager_store.py +0 -215
  298. chia/{types → server}/aliases.py +7 -7
  299. chia/server/api_protocol.py +1 -1
  300. chia/server/chia_policy.py +1 -1
  301. chia/server/node_discovery.py +76 -113
  302. chia/server/rate_limits.py +1 -1
  303. chia/server/resolve_peer_info.py +43 -0
  304. chia/server/server.py +5 -5
  305. chia/server/start_data_layer.py +4 -4
  306. chia/server/start_farmer.py +5 -4
  307. chia/server/start_full_node.py +5 -4
  308. chia/server/start_harvester.py +7 -5
  309. chia/server/start_introducer.py +2 -2
  310. chia/server/start_service.py +1 -1
  311. chia/server/start_timelord.py +7 -5
  312. chia/server/start_wallet.py +7 -5
  313. chia/server/ws_connection.py +1 -1
  314. chia/simulator/add_blocks_in_batches.py +2 -2
  315. chia/simulator/block_tools.py +245 -201
  316. chia/simulator/full_node_simulator.py +38 -10
  317. chia/simulator/setup_services.py +12 -12
  318. chia/simulator/simulator_full_node_rpc_api.py +2 -2
  319. chia/simulator/simulator_full_node_rpc_client.py +2 -2
  320. chia/simulator/simulator_test_tools.py +2 -2
  321. chia/simulator/start_simulator.py +1 -1
  322. chia/simulator/wallet_tools.py +10 -18
  323. chia/ssl/create_ssl.py +1 -1
  324. chia/timelord/iters_from_block.py +14 -14
  325. chia/timelord/timelord.py +15 -11
  326. chia/timelord/timelord_api.py +14 -2
  327. chia/timelord/timelord_state.py +20 -14
  328. chia/types/blockchain_format/program.py +53 -10
  329. chia/types/blockchain_format/proof_of_space.py +73 -19
  330. chia/types/coin_spend.py +3 -56
  331. chia/types/generator_types.py +28 -0
  332. chia/types/internal_mempool_item.py +1 -2
  333. chia/types/mempool_item.py +12 -7
  334. chia/types/unfinished_header_block.py +1 -2
  335. chia/types/validation_state.py +1 -2
  336. chia/types/weight_proof.py +1 -3
  337. chia/util/action_scope.py +3 -3
  338. chia/util/block_cache.py +1 -2
  339. chia/util/byte_types.py +1 -1
  340. chia/util/casts.py +21 -0
  341. chia/util/config.py +0 -37
  342. chia/util/db_wrapper.py +8 -1
  343. chia/util/errors.py +3 -2
  344. chia/util/initial-config.yaml +21 -5
  345. chia/util/keychain.py +6 -7
  346. chia/util/keyring_wrapper.py +5 -5
  347. chia/util/limited_semaphore.py +1 -1
  348. chia/util/priority_mutex.py +1 -1
  349. chia/util/streamable.py +63 -5
  350. chia/util/task_timing.py +1 -1
  351. chia/util/virtual_project_analysis.py +1 -1
  352. chia/wallet/cat_wallet/cat_info.py +7 -3
  353. chia/wallet/cat_wallet/cat_outer_puzzle.py +9 -5
  354. chia/wallet/cat_wallet/cat_utils.py +1 -1
  355. chia/wallet/cat_wallet/cat_wallet.py +44 -36
  356. chia/wallet/cat_wallet/lineage_store.py +7 -0
  357. chia/wallet/cat_wallet/r_cat_wallet.py +274 -0
  358. chia/wallet/conditions.py +5 -10
  359. chia/wallet/db_wallet/db_wallet_puzzles.py +4 -4
  360. chia/wallet/derivation_record.py +33 -0
  361. chia/wallet/derive_keys.py +3 -3
  362. chia/wallet/did_wallet/did_info.py +12 -3
  363. chia/wallet/did_wallet/did_wallet.py +132 -101
  364. chia/wallet/did_wallet/did_wallet_puzzles.py +9 -9
  365. chia/wallet/driver_protocol.py +3 -1
  366. chia/{types/spend_bundle.py → wallet/estimate_fees.py} +2 -7
  367. chia/wallet/nft_wallet/metadata_outer_puzzle.py +5 -3
  368. chia/wallet/nft_wallet/nft_puzzle_utils.py +1 -1
  369. chia/wallet/nft_wallet/nft_wallet.py +69 -112
  370. chia/wallet/nft_wallet/ownership_outer_puzzle.py +5 -3
  371. chia/wallet/nft_wallet/singleton_outer_puzzle.py +6 -4
  372. chia/wallet/nft_wallet/transfer_program_puzzle.py +4 -2
  373. chia/wallet/nft_wallet/uncurry_nft.py +4 -6
  374. chia/wallet/notification_manager.py +2 -3
  375. chia/wallet/outer_puzzles.py +7 -2
  376. chia/wallet/puzzle_drivers.py +1 -1
  377. chia/wallet/puzzles/clawback/drivers.py +5 -4
  378. chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +1 -1
  379. chia/wallet/puzzles/singleton_top_layer.py +2 -1
  380. chia/wallet/puzzles/singleton_top_layer_v1_1.py +2 -1
  381. chia/wallet/puzzles/tails.py +1 -3
  382. chia/wallet/signer_protocol.py +5 -6
  383. chia/wallet/singleton.py +5 -4
  384. chia/wallet/singleton_record.py +1 -1
  385. chia/wallet/trade_manager.py +18 -20
  386. chia/wallet/trade_record.py +3 -6
  387. chia/wallet/trading/offer.py +12 -13
  388. chia/wallet/uncurried_puzzle.py +2 -2
  389. chia/wallet/util/compute_additions.py +58 -0
  390. chia/wallet/util/compute_hints.py +3 -3
  391. chia/wallet/util/compute_memos.py +4 -4
  392. chia/wallet/util/curry_and_treehash.py +2 -1
  393. chia/wallet/util/debug_spend_bundle.py +1 -1
  394. chia/wallet/util/merkle_tree.py +1 -1
  395. chia/wallet/util/peer_request_cache.py +1 -2
  396. chia/wallet/util/tx_config.py +3 -8
  397. chia/wallet/util/wallet_sync_utils.py +10 -5
  398. chia/wallet/util/wallet_types.py +1 -0
  399. chia/wallet/vc_wallet/cr_cat_drivers.py +17 -18
  400. chia/wallet/vc_wallet/cr_cat_wallet.py +30 -28
  401. chia/wallet/vc_wallet/cr_outer_puzzle.py +5 -3
  402. chia/wallet/vc_wallet/vc_drivers.py +50 -8
  403. chia/wallet/vc_wallet/vc_store.py +3 -5
  404. chia/wallet/vc_wallet/vc_wallet.py +15 -22
  405. chia/wallet/wallet.py +36 -46
  406. chia/wallet/wallet_action_scope.py +73 -4
  407. chia/wallet/wallet_blockchain.py +1 -3
  408. chia/wallet/wallet_interested_store.py +1 -1
  409. chia/wallet/wallet_nft_store.py +3 -3
  410. chia/wallet/wallet_node.py +17 -16
  411. chia/wallet/wallet_node_api.py +4 -5
  412. chia/wallet/wallet_pool_store.py +1 -1
  413. chia/wallet/wallet_protocol.py +2 -0
  414. chia/wallet/wallet_puzzle_store.py +1 -1
  415. chia/{rpc → wallet}/wallet_request_types.py +670 -81
  416. chia/{rpc → wallet}/wallet_rpc_api.py +735 -766
  417. chia/{rpc → wallet}/wallet_rpc_client.py +268 -420
  418. chia/wallet/wallet_singleton_store.py +8 -7
  419. chia/wallet/wallet_spend_bundle.py +4 -3
  420. chia/wallet/wallet_state_manager.py +320 -191
  421. chia/wallet/wallet_weight_proof_handler.py +1 -2
  422. chia/wallet/wsm_apis.py +98 -0
  423. {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.dist-info}/METADATA +7 -7
  424. {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.dist-info}/RECORD +443 -436
  425. mozilla-ca/cacert.pem +3 -165
  426. chia/_tests/fee_estimation/test_mempoolitem_height_added.py +0 -145
  427. chia/cmds/dev.py +0 -18
  428. chia/types/blockchain_format/slots.py +0 -9
  429. chia/types/blockchain_format/sub_epoch_summary.py +0 -5
  430. chia/types/end_of_slot_bundle.py +0 -5
  431. chia/types/full_block.py +0 -5
  432. chia/types/header_block.py +0 -5
  433. chia/types/spend_bundle_conditions.py +0 -7
  434. chia/types/transaction_queue_entry.py +0 -56
  435. chia/types/unfinished_block.py +0 -5
  436. /chia/cmds/{installers.py → dev/installers.py} +0 -0
  437. /chia/cmds/{sim.py → dev/sim.py} +0 -0
  438. /chia/{util → cmds}/dump_keyring.py +0 -0
  439. /chia/{full_node → consensus}/signage_point.py +0 -0
  440. /chia/{rpc → data_layer}/data_layer_rpc_client.py +0 -0
  441. /chia/{rpc → farmer}/farmer_rpc_api.py +0 -0
  442. /chia/{util → full_node}/full_block_utils.py +0 -0
  443. /chia/{rpc → harvester}/harvester_rpc_api.py +0 -0
  444. /chia/{rpc → harvester}/harvester_rpc_client.py +0 -0
  445. /chia/{full_node → protocols}/fee_estimate.py +0 -0
  446. /chia/{server → protocols}/outbound_message.py +0 -0
  447. /chia/{rpc → seeder}/crawler_rpc_api.py +0 -0
  448. /chia/{util → simulator}/vdf_prover.py +0 -0
  449. /chia/{util → ssl}/ssl_check.py +0 -0
  450. /chia/{rpc → timelord}/timelord_rpc_api.py +0 -0
  451. {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.dist-info}/LICENSE +0 -0
  452. {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.dist-info}/WHEEL +0 -0
  453. {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.dist-info}/entry_points.txt +0 -0
@@ -7,21 +7,13 @@ from typing import Any, Callable
7
7
  import pytest
8
8
  from chia_rs import AugSchemeMPL, G1Element, G2Element
9
9
  from chia_rs.sized_bytes import bytes32
10
- from chia_rs.sized_ints import uint32, uint64
10
+ from chia_rs.sized_ints import uint16, uint32, uint64
11
11
  from clvm_tools.binutils import disassemble
12
12
 
13
13
  from chia._tests.conftest import ConsensusMode
14
14
  from chia._tests.environments.wallet import WalletStateTransition, WalletTestFramework
15
15
  from chia._tests.util.time_out_assert import time_out_assert
16
16
  from chia.rpc.rpc_client import ResponseFailureError
17
- from chia.rpc.wallet_request_types import (
18
- NFTCoin,
19
- NFTGetByDID,
20
- NFTSetDIDBulk,
21
- NFTSetNFTStatus,
22
- NFTTransferBulk,
23
- NFTWalletWithDID,
24
- )
25
17
  from chia.simulator.simulator_protocol import ReorgProtocol
26
18
  from chia.types.blockchain_format.program import Program
27
19
  from chia.types.signing_mode import CHIP_0002_SIGN_MESSAGE_PREFIX
@@ -34,6 +26,23 @@ from chia.wallet.nft_wallet.nft_wallet import NFTWallet
34
26
  from chia.wallet.util.address_type import AddressType
35
27
  from chia.wallet.util.compute_memos import compute_memos
36
28
  from chia.wallet.util.wallet_types import WalletType
29
+ from chia.wallet.wallet_request_types import (
30
+ NFTAddURI,
31
+ NFTCoin,
32
+ NFTCountNFTs,
33
+ NFTGetByDID,
34
+ NFTGetInfo,
35
+ NFTGetNFTs,
36
+ NFTGetWalletDID,
37
+ NFTMintNFTRequest,
38
+ NFTSetDIDBulk,
39
+ NFTSetNFTDID,
40
+ NFTSetNFTStatus,
41
+ NFTTransferBulk,
42
+ NFTTransferNFT,
43
+ NFTWalletWithDID,
44
+ )
45
+ from chia.wallet.wallet_rpc_api import MAX_NFT_CHUNK_SIZE
37
46
  from chia.wallet.wallet_state_manager import WalletStateManager
38
47
 
39
48
 
@@ -98,7 +107,10 @@ async def test_nft_wallet_creation_automatically(wallet_environments: WalletTest
98
107
  wallet_node_0.wallet_state_manager, wallet_0, name="NFT WALLET 1"
99
108
  )
100
109
  metadata = Program.to(
101
- [("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185")]
110
+ [
111
+ ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]),
112
+ ("h", "0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
113
+ ]
102
114
  )
103
115
 
104
116
  async with nft_wallet_0.wallet_state_manager.new_action_scope(
@@ -154,12 +166,14 @@ async def test_nft_wallet_creation_automatically(wallet_environments: WalletTest
154
166
  coins = await nft_wallet_0.get_current_nfts()
155
167
  assert len(coins) == 1, "nft not generated"
156
168
 
169
+ async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
170
+ wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
157
171
  async with nft_wallet_0.wallet_state_manager.new_action_scope(
158
172
  wallet_environments.tx_config, push=True
159
173
  ) as action_scope:
160
174
  await nft_wallet_0.generate_signed_transaction(
161
175
  [uint64(coins[0].coin.amount)],
162
- [await wallet_1.get_puzzle_hash(new=False)],
176
+ [wallet_1_ph],
163
177
  action_scope,
164
178
  coins={coins[0].coin},
165
179
  )
@@ -237,7 +251,10 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
237
251
  wallet_node_0.wallet_state_manager, wallet_0, name="NFT WALLET 1"
238
252
  )
239
253
  metadata = Program.to(
240
- [("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185")]
254
+ [
255
+ ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]),
256
+ ("h", "0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
257
+ ]
241
258
  )
242
259
  async with nft_wallet_0.wallet_state_manager.new_action_scope(
243
260
  wallet_environments.tx_config, push=True
@@ -375,12 +392,14 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
375
392
  nft_wallet_1 = await NFTWallet.create_new_nft_wallet(
376
393
  wallet_node_1.wallet_state_manager, wallet_1, name="NFT WALLET 2"
377
394
  )
395
+ async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
396
+ wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
378
397
  async with nft_wallet_0.wallet_state_manager.new_action_scope(
379
398
  wallet_environments.tx_config, push=True
380
399
  ) as action_scope:
381
400
  await nft_wallet_0.generate_signed_transaction(
382
401
  [uint64(coins[1].coin.amount)],
383
- [await wallet_1.get_puzzle_hash(False)],
402
+ [wallet_1_ph],
384
403
  action_scope,
385
404
  coins={coins[1].coin},
386
405
  )
@@ -432,12 +451,14 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
432
451
  assert len(coins) == 1
433
452
 
434
453
  # Send it back to original owner
454
+ async with wallet_0.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
455
+ wallet_0_ph = await action_scope.get_puzzle_hash(wallet_0.wallet_state_manager)
435
456
  async with nft_wallet_1.wallet_state_manager.new_action_scope(
436
457
  wallet_environments.tx_config, push=True
437
458
  ) as action_scope:
438
459
  await nft_wallet_1.generate_signed_transaction(
439
460
  [uint64(coins[0].coin.amount)],
440
- [await wallet_0.get_puzzle_hash(False)],
461
+ [wallet_0_ph],
441
462
  action_scope,
442
463
  coins={coins[0].coin},
443
464
  )
@@ -506,6 +527,19 @@ async def test_nft_wallet_creation_and_transfer(wallet_environments: WalletTestF
506
527
  await time_out_assert(30, get_nft_count, 1, nft_wallet_0)
507
528
  await time_out_assert(30, get_nft_count, 1, nft_wallet_1)
508
529
 
530
+ # Test an error case
531
+ with pytest.raises(ResponseFailureError, match="The NFT doesn't support setting a DID."):
532
+ await env_1.rpc_client.set_nft_did(
533
+ NFTSetNFTDID(
534
+ wallet_id=uint32(env_1.wallet_aliases["nft"]),
535
+ did_id=None,
536
+ nft_coin_id=(await env_1.rpc_client.list_nfts(NFTGetNFTs(uint32(env_1.wallet_aliases["nft"]))))
537
+ .nft_list[0]
538
+ .nft_coin_id,
539
+ ),
540
+ tx_config=wallet_environments.tx_config,
541
+ )
542
+
509
543
 
510
544
  @pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
511
545
  @pytest.mark.parametrize("wallet_environments", [{"num_environments": 1, "blocks_needed": [1]}], indirect=True)
@@ -525,14 +559,17 @@ async def test_nft_wallet_rpc_creation_and_list(wallet_environments: WalletTestF
525
559
  assert nft_wallet_0.get("success")
526
560
  assert env.wallet_aliases["nft"] == nft_wallet_0["wallet_id"]
527
561
 
562
+ async with wallet.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
563
+ wallet_ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
528
564
  await env.rpc_client.mint_nft(
529
- wallet_id=env.wallet_aliases["nft"],
530
- royalty_address=encode_puzzle_hash(
531
- await wallet.get_puzzle_hash(new=False), AddressType.NFT.hrp(wallet_node.config)
565
+ request=NFTMintNFTRequest(
566
+ wallet_id=uint32(env.wallet_aliases["nft"]),
567
+ royalty_address=encode_puzzle_hash(wallet_ph, AddressType.NFT.hrp(wallet_node.config)),
568
+ target_address=None,
569
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
570
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
571
+ push=True,
532
572
  ),
533
- target_address=None,
534
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
535
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
536
573
  tx_config=wallet_environments.tx_config,
537
574
  )
538
575
 
@@ -558,18 +595,19 @@ async def test_nft_wallet_rpc_creation_and_list(wallet_environments: WalletTestF
558
595
  30, env.rpc_client.fetch, ["nft_get_nfts", dict(wallet_id=env.wallet_aliases["nft"])], lambda x: x["nft_list"]
559
596
  )
560
597
  second_mint = await env.rpc_client.mint_nft(
561
- wallet_id=env.wallet_aliases["nft"],
562
- royalty_address=encode_puzzle_hash(
563
- await wallet.get_puzzle_hash(new=False), AddressType.NFT.hrp(wallet_node.config)
598
+ request=NFTMintNFTRequest(
599
+ wallet_id=uint32(env.wallet_aliases["nft"]),
600
+ royalty_address=encode_puzzle_hash(wallet_ph, AddressType.NFT.hrp(wallet_node.config)),
601
+ target_address=None,
602
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F184D4584AD463139FA8C0D9F68F4B59F184"),
603
+ uris=["https://chialisp.com/img/logo.svg"],
604
+ meta_uris=[
605
+ "https://bafybeigzcazxeu7epmm4vtkuadrvysv74lbzzbl2evphtae6k57yhgynp4.ipfs.nftstorage.link/6590.json"
606
+ ],
607
+ meta_hash=bytes32.from_hexstr("0x6a9cb99b7b9a987309e8dd4fd14a7ca2423858585da68cc9ec689669dd6dd6ab"),
608
+ push=True,
564
609
  ),
565
- target_address=None,
566
610
  tx_config=wallet_environments.tx_config,
567
- hash="0xD4584AD463139FA8C0D9F68F4B59F184",
568
- uris=["https://chialisp.com/img/logo.svg"],
569
- meta_uris=[
570
- "https://bafybeigzcazxeu7epmm4vtkuadrvysv74lbzzbl2evphtae6k57yhgynp4.ipfs.nftstorage.link/6590.json"
571
- ],
572
- meta_hash="0x6a9cb99b7b9a987309e8dd4fd14a7ca2423858585da68cc9ec689669dd6dd6ab",
573
611
  )
574
612
 
575
613
  await wallet_environments.process_pending_states(
@@ -616,20 +654,13 @@ async def test_nft_wallet_rpc_creation_and_list(wallet_environments: WalletTestF
616
654
  )
617
655
  coins = [NFTInfo.from_json_dict(d) for d in coins_response["nft_list"]]
618
656
  assert len(coins) == 1
619
- assert coins[0].data_hash.hex() == "0xD4584AD463139FA8C0D9F68F4B59F184"[2:].lower()
657
+ assert coins[0].data_hash.hex() == "0xD4584AD463139FA8C0D9F68F4B59F184D4584AD463139FA8C0D9F68F4B59F184"[2:].lower()
620
658
 
621
659
  # test counts
622
-
623
- resp = await wait_rpc_state_condition(
624
- 10, env.rpc_client.fetch, ["nft_count_nfts", {"wallet_id": env.wallet_aliases["nft"]}], lambda x: x["success"]
625
- )
626
- assert resp["count"] == 2
627
- resp = await wait_rpc_state_condition(10, env.rpc_client.fetch, ["nft_count_nfts", {}], lambda x: x["success"])
628
- assert resp["count"] == 2
660
+ assert (await env.rpc_client.count_nfts(NFTCountNFTs(uint32(env.wallet_aliases["nft"])))).count == 2
661
+ assert (await env.rpc_client.count_nfts(NFTCountNFTs())).count == 2
629
662
  with pytest.raises(ResponseFailureError, match="Wallet 50 not found."):
630
- resp = await wait_rpc_state_condition(
631
- 10, env.rpc_client.fetch, ["nft_count_nfts", {"wallet_id": 50}], lambda x: x["success"] is False
632
- )
663
+ await env.rpc_client.count_nfts(NFTCountNFTs(uint32(50)))
633
664
 
634
665
 
635
666
  @pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
@@ -648,11 +679,14 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
648
679
  nft_wallet = await NFTWallet.create_new_nft_wallet(wallet_node.wallet_state_manager, wallet, name="NFT WALLET 1")
649
680
 
650
681
  await env.rpc_client.mint_nft(
651
- wallet_id=nft_wallet.id(),
652
- royalty_address=None,
653
- target_address=None,
654
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
655
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
682
+ request=NFTMintNFTRequest(
683
+ wallet_id=nft_wallet.id(),
684
+ royalty_address=None,
685
+ target_address=None,
686
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
687
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
688
+ push=True,
689
+ ),
656
690
  tx_config=wallet_environments.tx_config,
657
691
  )
658
692
 
@@ -671,15 +705,17 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
671
705
  ]
672
706
  )
673
707
 
674
- coins: list[dict[str, Any]] = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))["nft_list"]
708
+ coins: list[NFTInfo] = (
709
+ await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))
710
+ ).nft_list
675
711
  coin = coins[0]
676
- assert coin["mint_height"] > 0
677
- assert coin["data_hash"] == "0xd4584ad463139fa8c0d9f68f4b59f185"
678
- assert coin["chain_info"] == disassemble(
712
+ assert coin.mint_height > 0
713
+ assert coin.data_hash == bytes32.from_hexstr("0xd4584ad463139fa8c0d9f68f4b59f185d4584ad463139fa8c0d9f68f4b59f185")
714
+ assert coin.chain_info == disassemble(
679
715
  Program.to(
680
716
  [
681
717
  ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]),
682
- ("h", hexstr_to_bytes("0xD4584AD463139FA8C0D9F68F4B59F185")),
718
+ ("h", hexstr_to_bytes("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185")),
683
719
  ("mu", []),
684
720
  ("lu", []),
685
721
  ("sn", uint64(1)),
@@ -688,18 +724,21 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
688
724
  )
689
725
  )
690
726
 
691
- nft_coin_id = encode_puzzle_hash(bytes32.from_hexstr(coin["nft_coin_id"]), AddressType.NFT.hrp(env.node.config))
727
+ nft_coin_id = encode_puzzle_hash(coin.nft_coin_id, AddressType.NFT.hrp(env.node.config))
692
728
  await env.rpc_client.add_uri_to_nft(
693
- wallet_id=nft_wallet.id(),
694
- nft_coin_id=nft_coin_id,
695
- uri="http://metadata",
696
- key="mu",
697
- fee=0,
729
+ NFTAddURI(
730
+ wallet_id=nft_wallet.id(),
731
+ nft_coin_id=nft_coin_id,
732
+ uri="http://metadata",
733
+ key="mu",
734
+ fee=uint64(0),
735
+ push=True,
736
+ ),
698
737
  tx_config=wallet_environments.tx_config,
699
738
  )
700
739
 
701
- coins = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))["nft_list"]
702
- assert coins[0]["pending_transaction"]
740
+ coins = (await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))).nft_list
741
+ assert coins[0].pending_transaction
703
742
 
704
743
  await wallet_environments.process_pending_states(
705
744
  [
@@ -717,25 +756,27 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
717
756
  )
718
757
 
719
758
  # check that new URI was added
720
- coins = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))["nft_list"]
759
+ coins = (await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))).nft_list
721
760
  assert len(coins) == 1
722
761
  coin = coins[0]
723
- assert coin["mint_height"] > 0
724
- uris = coin["data_uris"]
762
+ assert coin.mint_height > 0
763
+ uris = coin.data_uris
725
764
  assert len(uris) == 1
726
765
  assert "https://www.chia.net/img/branding/chia-logo.svg" in uris
727
- assert len(coin["metadata_uris"]) == 1
728
- assert "http://metadata" == coin["metadata_uris"][0]
729
- assert len(coin["license_uris"]) == 0
766
+ assert len(coin.metadata_uris) == 1
767
+ assert "http://metadata" == coin.metadata_uris[0]
768
+ assert len(coin.license_uris) == 0
730
769
 
731
770
  # add yet another URI, this time using a hex nft_coin_id
732
- nft_coin_id = coin["nft_coin_id"]
733
771
  await env.rpc_client.add_uri_to_nft(
734
- wallet_id=nft_wallet.id(),
735
- nft_coin_id=nft_coin_id,
736
- uri="http://data",
737
- key="u",
738
- fee=0,
772
+ NFTAddURI(
773
+ wallet_id=nft_wallet.id(),
774
+ nft_coin_id=coin.nft_coin_id.hex(),
775
+ uri="http://data",
776
+ key="u",
777
+ fee=uint64(0),
778
+ push=True,
779
+ ),
739
780
  tx_config=wallet_environments.tx_config,
740
781
  )
741
782
 
@@ -754,14 +795,14 @@ async def test_nft_wallet_rpc_update_metadata(wallet_environments: WalletTestFra
754
795
  ]
755
796
  )
756
797
 
757
- coins = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))["nft_list"]
798
+ coins = (await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))).nft_list
758
799
  assert len(coins) == 1
759
800
  coin = coins[0]
760
- assert coin["mint_height"] > 0
761
- uris = coin["data_uris"]
801
+ assert coin.mint_height > 0
802
+ uris = coin.data_uris
762
803
  assert len(uris) == 2
763
- assert len(coin["metadata_uris"]) == 1
764
- assert "http://data" == coin["data_uris"][0]
804
+ assert len(coin.metadata_uris) == 1
805
+ assert "http://data" == coin.data_uris[0]
765
806
 
766
807
 
767
808
  @pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
@@ -826,6 +867,8 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
826
867
  assert res["wallet_id"] != nft_wallet.id()
827
868
  nft_wallet_p2_puzzle = res["wallet_id"]
828
869
 
870
+ with pytest.raises(ResponseFailureError, match="Cannot find a NFT wallet DID"):
871
+ await env.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=encode_puzzle_hash(bytes32.zeros, "did")))
829
872
  wallet_by_did_response = await env.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=hmr_did_id))
830
873
  assert nft_wallet.id() == wallet_by_did_response.wallet_id
831
874
 
@@ -842,17 +885,21 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
842
885
  NFTWalletWithDID(wallet_id=nft_wallet.id(), did_id=hmr_did_id, did_wallet_id=did_wallet.id())
843
886
  ]
844
887
 
845
- res = await env.rpc_client.get_nft_wallet_did(wallet_id=nft_wallet.id())
846
- assert res.get("did_id") == hmr_did_id
888
+ get_did_res = await env.rpc_client.get_nft_wallet_did(NFTGetWalletDID(nft_wallet.id()))
889
+ assert get_did_res.did_id == hmr_did_id
847
890
 
848
891
  # Create a NFT with DID
849
- nft_ph = await wallet.get_puzzle_hash(new=False)
892
+ async with wallet.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
893
+ nft_ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
850
894
  resp = await env.rpc_client.mint_nft(
851
- wallet_id=nft_wallet.id(),
852
- royalty_address=None,
853
- target_address=encode_puzzle_hash(nft_ph, "txch"),
854
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
855
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
895
+ request=NFTMintNFTRequest(
896
+ wallet_id=nft_wallet.id(),
897
+ royalty_address=None,
898
+ target_address=encode_puzzle_hash(nft_ph, "txch"),
899
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
900
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
901
+ push=True,
902
+ ),
856
903
  tx_config=wallet_environments.tx_config,
857
904
  )
858
905
  # ensure hints are generated correctly
@@ -896,12 +943,15 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
896
943
  )
897
944
  # Create a NFT without DID, this will go the unassigned NFT wallet
898
945
  resp = await env.rpc_client.mint_nft(
899
- wallet_id=nft_wallet.id(),
900
- royalty_address=None,
901
- target_address=None,
902
- hash="0xD4584AD463139FA8C0D9F68F4B59F181",
903
- uris=["https://url1"],
904
- did_id="",
946
+ request=NFTMintNFTRequest(
947
+ wallet_id=nft_wallet.id(),
948
+ royalty_address=None,
949
+ target_address=None,
950
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F181D4584AD463139FA8C0D9F68F4B59F181"),
951
+ uris=["https://url1"],
952
+ did_id="",
953
+ push=True,
954
+ ),
905
955
  tx_config=wallet_environments.tx_config,
906
956
  )
907
957
 
@@ -930,28 +980,34 @@ async def test_nft_with_did_wallet_creation(wallet_environments: WalletTestFrame
930
980
  ]
931
981
  )
932
982
  # Check DID NFT
933
- coins: list[dict[str, Any]] = (await env.rpc_client.list_nfts(nft_wallet.id(), start_index=0, num=1))["nft_list"]
983
+ coins: list[NFTInfo] = (
984
+ await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet.id(), start_index=uint32(0), num=uint32(1)))
985
+ ).nft_list
934
986
  assert len(coins) == 1
935
987
  did_nft = coins[0]
936
- assert did_nft["mint_height"] > 0
937
- assert did_nft["supports_did"]
938
- assert did_nft["data_uris"][0] == "https://www.chia.net/img/branding/chia-logo.svg"
939
- assert did_nft["data_hash"] == "0xD4584AD463139FA8C0D9F68F4B59F185".lower()
940
- assert did_nft["owner_did"][2:] == hex_did_id
988
+ assert did_nft.mint_height > 0
989
+ assert did_nft.supports_did
990
+ assert did_nft.data_uris[0] == "https://www.chia.net/img/branding/chia-logo.svg"
991
+ assert did_nft.data_hash == bytes32.from_hexstr(
992
+ "0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"
993
+ )
994
+ assert did_nft.owner_did is not None
995
+ assert did_nft.owner_did.hex() == hex_did_id
941
996
  # Check unassigned NFT
942
997
  nft_wallets = await env.wallet_state_manager.get_all_wallet_info_entries(WalletType.NFT)
943
998
  assert len(nft_wallets) == 2
944
- coins_response = await env.rpc_client.list_nfts(nft_wallet_p2_puzzle, start_index=0, num=1)
945
- assert coins_response["nft_list"]
946
- assert coins_response.get("success")
947
- coins = coins_response["nft_list"]
999
+ coins = (
1000
+ await env.rpc_client.list_nfts(NFTGetNFTs(nft_wallet_p2_puzzle, start_index=uint32(0), num=uint32(1)))
1001
+ ).nft_list
948
1002
  assert len(coins) == 1
949
1003
  non_did_nft = coins[0]
950
- assert non_did_nft["mint_height"] > 0
951
- assert non_did_nft["supports_did"]
952
- assert non_did_nft["data_uris"][0] == "https://url1"
953
- assert non_did_nft["data_hash"] == "0xD4584AD463139FA8C0D9F68F4B59F181".lower()
954
- assert non_did_nft["owner_did"] is None
1004
+ assert non_did_nft.mint_height > 0
1005
+ assert non_did_nft.supports_did
1006
+ assert non_did_nft.data_uris[0] == "https://url1"
1007
+ assert non_did_nft.data_hash == bytes32.from_hexstr(
1008
+ "0xD4584AD463139FA8C0D9F68F4B59F181D4584AD463139FA8C0D9F68F4B59F181"
1009
+ )
1010
+ assert non_did_nft.owner_did is None
955
1011
 
956
1012
 
957
1013
  @pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
@@ -1006,30 +1062,34 @@ async def test_nft_rpc_mint(wallet_environments: WalletTestFramework) -> None:
1006
1062
  )
1007
1063
 
1008
1064
  # Create a NFT with DID
1009
- royalty_address = await wallet.get_puzzle_hash(new=False)
1065
+ async with wallet.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
1066
+ royalty_address = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
1010
1067
  royalty_bech32 = encode_puzzle_hash(royalty_address, AddressType.NFT.hrp(env.node.config))
1011
- data_hash_param = "0xD4584AD463139FA8C0D9F68F4B59F185"
1068
+ data_hash_param = "0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"
1012
1069
  license_uris = ["http://mylicenseuri"]
1013
- license_hash = "0xcafef00d"
1070
+ license_hash = "0xcafef00dcafef00dcafef00dcafef00dcafef00dcafef00dcafef00dcafef00d"
1014
1071
  meta_uris = ["http://metauri"]
1015
- meta_hash = "0xdeadbeef"
1072
+ meta_hash = "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
1016
1073
  royalty_percentage = 200
1017
1074
  sn = 10
1018
1075
  st = 100
1019
1076
  resp = await env.rpc_client.mint_nft(
1020
- wallet_id=env.wallet_aliases["nft_w_did"],
1021
- royalty_address=royalty_bech32,
1022
- target_address=royalty_bech32, # doesn't matter so we'll just reuse
1023
- hash=data_hash_param,
1024
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1077
+ request=NFTMintNFTRequest(
1078
+ wallet_id=uint32(env.wallet_aliases["nft_w_did"]),
1079
+ royalty_address=royalty_bech32,
1080
+ target_address=royalty_bech32, # doesn't matter so we'll just reuse
1081
+ hash=bytes32.from_hexstr(data_hash_param),
1082
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1083
+ meta_hash=bytes32.from_hexstr(meta_hash),
1084
+ meta_uris=meta_uris,
1085
+ license_hash=bytes32.from_hexstr(license_hash),
1086
+ license_uris=license_uris,
1087
+ edition_total=uint64(st),
1088
+ edition_number=uint64(sn),
1089
+ royalty_amount=uint16(royalty_percentage),
1090
+ push=True,
1091
+ ),
1025
1092
  tx_config=wallet_environments.tx_config,
1026
- meta_hash=meta_hash,
1027
- meta_uris=meta_uris,
1028
- license_hash=license_hash,
1029
- license_uris=license_uris,
1030
- edition_total=st,
1031
- edition_number=sn,
1032
- royalty_percentage=royalty_percentage,
1033
1093
  )
1034
1094
  nft_id = resp.nft_id
1035
1095
 
@@ -1063,11 +1123,13 @@ async def test_nft_rpc_mint(wallet_environments: WalletTestFramework) -> None:
1063
1123
  ]
1064
1124
  )
1065
1125
 
1066
- coins: list[dict[str, Any]] = (
1067
- await env.rpc_client.list_nfts(env.wallet_aliases["nft_w_did"], start_index=0, num=1)
1068
- )["nft_list"]
1126
+ coins: list[NFTInfo] = (
1127
+ await env.rpc_client.list_nfts(
1128
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(1))
1129
+ )
1130
+ ).nft_list
1069
1131
  assert len(coins) == 1
1070
- did_nft = NFTInfo.from_json_dict(coins[0])
1132
+ did_nft = coins[0]
1071
1133
  assert did_nft.royalty_puzzle_hash == royalty_address
1072
1134
  assert did_nft.data_hash == bytes.fromhex(data_hash_param[2:])
1073
1135
  assert did_nft.metadata_hash == bytes.fromhex(meta_hash[2:])
@@ -1149,14 +1211,17 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
1149
1211
  # Create a NFT with DID
1150
1212
  fee = 100
1151
1213
  await env_0.rpc_client.mint_nft(
1152
- wallet_id=env_0.wallet_aliases["nft"],
1153
- royalty_address=None,
1154
- target_address=None, # doesn't matter so we'll just reuse
1155
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1156
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1214
+ request=NFTMintNFTRequest(
1215
+ wallet_id=uint32(env_0.wallet_aliases["nft"]),
1216
+ royalty_address=None,
1217
+ target_address=None, # doesn't matter so we'll just reuse
1218
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
1219
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1220
+ fee=uint64(fee),
1221
+ did_id=hmr_did_id,
1222
+ push=True,
1223
+ ),
1157
1224
  tx_config=wallet_environments.tx_config,
1158
- fee=fee,
1159
- did_id=hmr_did_id,
1160
1225
  )
1161
1226
 
1162
1227
  await wallet_environments.process_pending_states(
@@ -1200,11 +1265,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
1200
1265
  )
1201
1266
 
1202
1267
  # Check DID NFT
1203
- coins: list[dict[str, Any]] = (await env_0.rpc_client.list_nfts(env_0.wallet_aliases["nft"], start_index=0, num=1))[
1204
- "nft_list"
1205
- ]
1268
+ coins: list[NFTInfo] = (
1269
+ await env_0.rpc_client.list_nfts(
1270
+ NFTGetNFTs(uint32(env_0.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
1271
+ )
1272
+ ).nft_list
1206
1273
  assert len(coins) == 1
1207
- coin = NFTInfo.from_json_dict(coins[0])
1274
+ coin = coins[0]
1208
1275
  assert coin.owner_did is not None
1209
1276
  assert coin.owner_did.hex() == hex_did_id
1210
1277
 
@@ -1212,10 +1279,12 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
1212
1279
  assert len(env_0.wallet_state_manager.wallets) == 3
1213
1280
 
1214
1281
  # transfer DID to the other wallet
1282
+ async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
1283
+ wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
1215
1284
  async with did_wallet.wallet_state_manager.new_action_scope(
1216
1285
  wallet_environments.tx_config, push=True
1217
1286
  ) as action_scope:
1218
- await did_wallet.transfer_did(await wallet_1.get_puzzle_hash(new=False), uint64(0), True, action_scope)
1287
+ await did_wallet.transfer_did(wallet_1_ph, uint64(0), True, action_scope)
1219
1288
 
1220
1289
  await wallet_environments.process_pending_states(
1221
1290
  [
@@ -1243,13 +1312,29 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
1243
1312
  )
1244
1313
 
1245
1314
  # Transfer NFT, wallet will be deleted
1315
+ async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
1316
+ wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
1317
+ mint_resp_reference = await env_0.rpc_client.transfer_nft(
1318
+ NFTTransferNFT(
1319
+ wallet_id=uint32(env_0.wallet_aliases["nft"]),
1320
+ nft_coin_id=encode_puzzle_hash(coin.launcher_id, "nft"), # difference
1321
+ target_address=encode_puzzle_hash(wallet_1_ph, "xch"),
1322
+ fee=uint64(fee),
1323
+ push=False, # difference
1324
+ ),
1325
+ tx_config=wallet_environments.tx_config,
1326
+ )
1246
1327
  mint_resp = await env_0.rpc_client.transfer_nft(
1247
- wallet_id=env_0.wallet_aliases["nft"],
1248
- nft_coin_id=coin.nft_coin_id.hex(),
1249
- target_address=encode_puzzle_hash(await wallet_1.get_puzzle_hash(new=False), "xch"),
1250
- fee=fee,
1328
+ NFTTransferNFT(
1329
+ wallet_id=uint32(env_0.wallet_aliases["nft"]),
1330
+ nft_coin_id=coin.nft_coin_id.hex(),
1331
+ target_address=encode_puzzle_hash(wallet_1_ph, "xch"),
1332
+ fee=uint64(fee),
1333
+ push=True,
1334
+ ),
1251
1335
  tx_config=wallet_environments.tx_config,
1252
1336
  )
1337
+ assert mint_resp_reference.spend_bundle == mint_resp.spend_bundle
1253
1338
  assert len(compute_memos(mint_resp.spend_bundle)) > 0
1254
1339
 
1255
1340
  await wallet_environments.process_pending_states(
@@ -1288,9 +1373,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
1288
1373
  # Check if the NFT owner DID is reset
1289
1374
  wallet_by_did_response = await env_1.rpc_client.get_nft_wallet_by_did(NFTGetByDID())
1290
1375
  assert env_1.wallet_aliases["nft"] == wallet_by_did_response.wallet_id
1291
- coins = (await env_1.rpc_client.list_nfts(env_1.wallet_aliases["nft"], start_index=0, num=1))["nft_list"]
1376
+ coins = (
1377
+ await env_1.rpc_client.list_nfts(
1378
+ NFTGetNFTs(uint32(env_1.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
1379
+ )
1380
+ ).nft_list
1292
1381
  assert len(coins) == 1
1293
- coin = NFTInfo.from_json_dict(coins[0])
1382
+ coin = coins[0]
1294
1383
  assert coin.owner_did is None
1295
1384
  assert coin.minter_did is not None
1296
1385
  assert coin.minter_did.hex() == hex_did_id
@@ -1298,10 +1387,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
1298
1387
 
1299
1388
  # Set DID
1300
1389
  await env_1.rpc_client.set_nft_did(
1301
- wallet_id=env_1.wallet_aliases["nft"],
1302
- did_id=hmr_did_id,
1303
- nft_coin_id=nft_coin_id.hex(),
1304
- fee=fee,
1390
+ NFTSetNFTDID(
1391
+ wallet_id=uint32(env_1.wallet_aliases["nft"]),
1392
+ did_id=hmr_did_id,
1393
+ nft_coin_id=nft_coin_id,
1394
+ fee=uint64(fee),
1395
+ push=True,
1396
+ ),
1305
1397
  tx_config=wallet_environments.tx_config,
1306
1398
  )
1307
1399
 
@@ -1349,9 +1441,13 @@ async def test_nft_transfer_nft_with_did(wallet_environments: WalletTestFramewor
1349
1441
  wallet_by_did_response = await env_1.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=hmr_did_id))
1350
1442
  assert env_1.wallet_aliases["nft_w_did"] == wallet_by_did_response.wallet_id
1351
1443
  # Check NFT DID is set now
1352
- coins = (await env_1.rpc_client.list_nfts(env_1.wallet_aliases["nft_w_did"], start_index=0, num=1))["nft_list"]
1444
+ coins = (
1445
+ await env_1.rpc_client.list_nfts(
1446
+ NFTGetNFTs(uint32(env_1.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(1))
1447
+ )
1448
+ ).nft_list
1353
1449
  assert len(coins) == 1
1354
- coin = NFTInfo.from_json_dict(coins[0])
1450
+ coin = coins[0]
1355
1451
  assert coin.owner_did is not None
1356
1452
  assert coin.owner_did.hex() == hex_did_id
1357
1453
 
@@ -1412,14 +1508,17 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
1412
1508
 
1413
1509
  # Create a NFT with DID
1414
1510
  mint_resp = await env.rpc_client.mint_nft(
1415
- wallet_id=env.wallet_aliases["nft"],
1416
- royalty_address=None,
1417
- target_address=None, # doesn't matter so we'll just reuse
1418
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1419
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1420
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1511
+ request=NFTMintNFTRequest(
1512
+ wallet_id=uint32(env.wallet_aliases["nft"]),
1513
+ royalty_address=None,
1514
+ target_address=None, # doesn't matter so we'll just reuse
1515
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
1516
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1517
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1518
+ did_id=hmr_did_id,
1519
+ push=True,
1520
+ ),
1421
1521
  tx_config=wallet_environments.tx_config,
1422
- did_id=hmr_did_id,
1423
1522
  )
1424
1523
 
1425
1524
  # ensure hints are generated
@@ -1466,9 +1565,13 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
1466
1565
 
1467
1566
  # Check DID NFT
1468
1567
 
1469
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft"], start_index=0, num=1))["nft_list"]
1568
+ coins = (
1569
+ await env.rpc_client.list_nfts(
1570
+ NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
1571
+ )
1572
+ ).nft_list
1470
1573
  assert len(coins) == 1
1471
- coin = NFTInfo.from_json_dict(coins[0])
1574
+ coin = coins[0]
1472
1575
  assert coin.minter_did is not None
1473
1576
  assert coin.minter_did.hex() == hex_did_id
1474
1577
  nft_coin_id = coin.nft_coin_id
@@ -1476,17 +1579,24 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
1476
1579
  # add another URI
1477
1580
  fee = 100
1478
1581
  await env.rpc_client.add_uri_to_nft(
1479
- wallet_id=env.wallet_aliases["nft"],
1480
- nft_coin_id=nft_coin_id.hex(),
1481
- key="mu",
1482
- uri="http://metadata",
1483
- fee=fee,
1582
+ NFTAddURI(
1583
+ wallet_id=uint32(env.wallet_aliases["nft"]),
1584
+ nft_coin_id=nft_coin_id.hex(),
1585
+ key="mu",
1586
+ uri="http://metadata",
1587
+ fee=uint64(fee),
1588
+ push=True,
1589
+ ),
1484
1590
  tx_config=wallet_environments.tx_config,
1485
1591
  )
1486
1592
 
1487
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft"], start_index=0, num=1))["nft_list"]
1593
+ coins = (
1594
+ await env.rpc_client.list_nfts(
1595
+ NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
1596
+ )
1597
+ ).nft_list
1488
1598
  assert len(coins) == 1
1489
- coin = NFTInfo.from_json_dict(coins[0])
1599
+ coin = coins[0]
1490
1600
  assert coin.pending_transaction
1491
1601
 
1492
1602
  await wallet_environments.process_pending_states(
@@ -1517,17 +1627,22 @@ async def test_update_metadata_for_nft_did(wallet_environments: WalletTestFramew
1517
1627
  )
1518
1628
 
1519
1629
  # check that new URI was added
1520
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft"], start_index=0, num=1))["nft_list"]
1630
+ coins = (
1631
+ await env.rpc_client.list_nfts(
1632
+ NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
1633
+ )
1634
+ ).nft_list
1521
1635
  assert len(coins) == 1
1522
1636
 
1523
- assert coins[0]["minter_did"][2:] == hex_did_id
1524
- assert coins[0]["mint_height"] > 0
1525
- uris = coins[0]["data_uris"]
1637
+ assert coins[0].minter_did is not None
1638
+ assert coins[0].minter_did.hex() == hex_did_id
1639
+ assert coins[0].mint_height > 0
1640
+ uris = coins[0].data_uris
1526
1641
  assert len(uris) == 1
1527
1642
  assert "https://www.chia.net/img/branding/chia-logo.svg" in uris
1528
- assert len(coins[0]["metadata_uris"]) == 2
1529
- assert "http://metadata" == coins[0]["metadata_uris"][0]
1530
- assert len(coins[0]["license_uris"]) == 0
1643
+ assert len(coins[0].metadata_uris) == 2
1644
+ assert "http://metadata" == coins[0].metadata_uris[0]
1645
+ assert len(coins[0].license_uris) == 0
1531
1646
 
1532
1647
 
1533
1648
  @pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
@@ -1590,14 +1705,17 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
1590
1705
 
1591
1706
  # Create an NFT with DID
1592
1707
  mint_resp_1 = await env.rpc_client.mint_nft(
1593
- wallet_id=env.wallet_aliases["nft_w_did"],
1594
- royalty_address=None,
1595
- target_address=None, # doesn't matter so we'll just reuse
1596
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1597
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1598
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1708
+ request=NFTMintNFTRequest(
1709
+ wallet_id=uint32(env.wallet_aliases["nft_w_did"]),
1710
+ royalty_address=None,
1711
+ target_address=None, # doesn't matter so we'll just reuse
1712
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
1713
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1714
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1715
+ did_id=hmr_did_id,
1716
+ push=True,
1717
+ ),
1599
1718
  tx_config=wallet_environments.tx_config,
1600
- did_id=hmr_did_id,
1601
1719
  )
1602
1720
  assert len(compute_memos(mint_resp_1.spend_bundle)) > 0
1603
1721
 
@@ -1642,14 +1760,17 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
1642
1760
 
1643
1761
  # And one w/o
1644
1762
  mint_resp_2 = await env.rpc_client.mint_nft(
1645
- wallet_id=env.wallet_aliases["nft_no_did"],
1646
- royalty_address=None,
1647
- target_address=None, # doesn't matter so we'll just reuse
1648
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1649
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1650
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1763
+ request=NFTMintNFTRequest(
1764
+ wallet_id=uint32(env.wallet_aliases["nft_no_did"]),
1765
+ royalty_address=None,
1766
+ target_address=None, # doesn't matter so we'll just reuse
1767
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
1768
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1769
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1770
+ did_id="",
1771
+ push=True,
1772
+ ),
1651
1773
  tx_config=wallet_environments.tx_config,
1652
- did_id="",
1653
1774
  )
1654
1775
  assert len(compute_memos(mint_resp_2.spend_bundle)) > 0
1655
1776
 
@@ -1682,14 +1803,17 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
1682
1803
 
1683
1804
  # Make a second one w/ DID to test "bulk" updating in same wallet
1684
1805
  mint_resp_3 = await env.rpc_client.mint_nft(
1685
- wallet_id=env.wallet_aliases["nft_w_did"],
1686
- royalty_address=None,
1687
- target_address=None, # doesn't matter so we'll just reuse
1688
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1689
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1690
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1806
+ request=NFTMintNFTRequest(
1807
+ wallet_id=uint32(env.wallet_aliases["nft_w_did"]),
1808
+ royalty_address=None,
1809
+ target_address=None, # doesn't matter so we'll just reuse
1810
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
1811
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1812
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1813
+ did_id=hmr_did_id,
1814
+ push=True,
1815
+ ),
1691
1816
  tx_config=wallet_environments.tx_config,
1692
- did_id=hmr_did_id,
1693
1817
  )
1694
1818
  assert len(compute_memos(mint_resp_3.spend_bundle)) > 0
1695
1819
 
@@ -1733,32 +1857,53 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
1733
1857
  )
1734
1858
 
1735
1859
  # Check DID NFT
1736
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_w_did"], start_index=0, num=2))["nft_list"]
1860
+ coins = (
1861
+ await env.rpc_client.list_nfts(
1862
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(2))
1863
+ )
1864
+ ).nft_list
1737
1865
  assert len(coins) == 2
1738
- nft1 = NFTInfo.from_json_dict(coins[0])
1739
- nft12 = NFTInfo.from_json_dict(coins[1])
1866
+ nft1 = coins[0]
1867
+ nft12 = coins[1]
1740
1868
  assert nft1.owner_did is not None
1741
1869
  assert nft12.owner_did is not None
1742
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_no_did"], start_index=0, num=1))["nft_list"]
1870
+ coins = (
1871
+ await env.rpc_client.list_nfts(
1872
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
1873
+ )
1874
+ ).nft_list
1743
1875
  assert len(coins) == 1
1744
- nft2 = NFTInfo.from_json_dict(coins[0])
1876
+ nft2 = coins[0]
1745
1877
  assert nft2.owner_did is None
1746
1878
  nft_coin_list = [
1747
1879
  NFTCoin(wallet_id=uint32(env.wallet_aliases["nft_w_did"]), nft_coin_id=nft1.nft_coin_id.hex()),
1748
- NFTCoin(wallet_id=uint32(env.wallet_aliases["nft_w_did"]), nft_coin_id=nft12.nft_coin_id.hex()),
1880
+ NFTCoin(
1881
+ wallet_id=uint32(env.wallet_aliases["nft_w_did"]), nft_coin_id=encode_puzzle_hash(nft12.launcher_id, "nft")
1882
+ ),
1749
1883
  NFTCoin(wallet_id=uint32(env.wallet_aliases["nft_no_did"]), nft_coin_id=nft2.nft_coin_id.hex()),
1750
1884
  ]
1751
1885
  fee = uint64(1000)
1886
+ with pytest.raises(ResponseFailureError, match="You can only set"):
1887
+ await env.rpc_client.set_nft_did_bulk(
1888
+ NFTSetDIDBulk(
1889
+ did_id=hmr_did_id, nft_coin_list=[nft_coin_list[0]] * (MAX_NFT_CHUNK_SIZE + 1), fee=fee, push=True
1890
+ ),
1891
+ wallet_environments.tx_config,
1892
+ )
1752
1893
  set_did_bulk_resp = await env.rpc_client.set_nft_did_bulk(
1753
1894
  NFTSetDIDBulk(did_id=hmr_did_id, nft_coin_list=nft_coin_list, fee=fee, push=True),
1754
1895
  wallet_environments.tx_config,
1755
1896
  )
1756
1897
  assert len(set_did_bulk_resp.spend_bundle.coin_spends) == 5
1757
1898
  assert set_did_bulk_resp.tx_num == 5 # 1 for each NFT being spent (3), 1 for fee tx, 1 for did tx
1758
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_w_did"], start_index=0, num=2))["nft_list"]
1899
+ coins = (
1900
+ await env.rpc_client.list_nfts(
1901
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(2))
1902
+ )
1903
+ ).nft_list
1759
1904
  assert len(coins) == 2
1760
- nft1 = NFTInfo.from_json_dict(coins[0])
1761
- nft12 = NFTInfo.from_json_dict(coins[1])
1905
+ nft1 = coins[0]
1906
+ nft12 = coins[1]
1762
1907
  assert nft1.pending_transaction
1763
1908
  assert nft12.pending_transaction
1764
1909
 
@@ -1805,11 +1950,15 @@ async def test_nft_bulk_set_did(wallet_environments: WalletTestFramework) -> Non
1805
1950
 
1806
1951
  wallet_by_did_response = await env.rpc_client.get_nft_wallet_by_did(NFTGetByDID(did_id=hmr_did_id))
1807
1952
  assert env.wallet_aliases["nft_w_did"] == wallet_by_did_response.wallet_id
1808
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_w_did"], start_index=0, num=3))["nft_list"]
1953
+ coins = (
1954
+ await env.rpc_client.list_nfts(
1955
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(3))
1956
+ )
1957
+ ).nft_list
1809
1958
  assert len(coins) == 3
1810
- nft1 = NFTInfo.from_json_dict(coins[0])
1811
- nft12 = NFTInfo.from_json_dict(coins[1])
1812
- nft13 = NFTInfo.from_json_dict(coins[2])
1959
+ nft1 = coins[0]
1960
+ nft12 = coins[1]
1961
+ nft13 = coins[2]
1813
1962
  nft_wallet_to_check = env.wallet_state_manager.wallets[uint32(env.wallet_aliases["nft_w_did"])]
1814
1963
  assert isinstance(nft_wallet_to_check, NFTWallet)
1815
1964
  assert await nft_wallet_to_check.get_nft_count() == 3
@@ -1892,14 +2041,17 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
1892
2041
 
1893
2042
  # Create an NFT with DID
1894
2043
  mint_resp_1 = await env_0.rpc_client.mint_nft(
1895
- wallet_id=env_0.wallet_aliases["nft_w_did"],
1896
- royalty_address=None,
1897
- target_address=None, # doesn't matter so we'll just reuse
1898
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1899
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1900
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2044
+ request=NFTMintNFTRequest(
2045
+ wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]),
2046
+ royalty_address=None,
2047
+ target_address=None, # doesn't matter so we'll just reuse
2048
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
2049
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2050
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2051
+ did_id=hmr_did_id,
2052
+ push=True,
2053
+ ),
1901
2054
  tx_config=wallet_environments.tx_config,
1902
- did_id=hmr_did_id,
1903
2055
  )
1904
2056
  assert len(compute_memos(mint_resp_1.spend_bundle)) > 0
1905
2057
 
@@ -1944,14 +2096,17 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
1944
2096
 
1945
2097
  # And one w/o
1946
2098
  mint_resp_2 = await env_0.rpc_client.mint_nft(
1947
- wallet_id=env_0.wallet_aliases["nft_no_did"],
1948
- royalty_address=None,
1949
- target_address=None, # doesn't matter so we'll just reuse
1950
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1951
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1952
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2099
+ request=NFTMintNFTRequest(
2100
+ wallet_id=uint32(env_0.wallet_aliases["nft_no_did"]),
2101
+ royalty_address=None,
2102
+ target_address=None, # doesn't matter so we'll just reuse
2103
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
2104
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2105
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2106
+ did_id="",
2107
+ push=True,
2108
+ ),
1953
2109
  tx_config=wallet_environments.tx_config,
1954
- did_id="",
1955
2110
  )
1956
2111
  assert len(compute_memos(mint_resp_2.spend_bundle)) > 0
1957
2112
 
@@ -1984,14 +2139,17 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
1984
2139
 
1985
2140
  # Make a second one w/ DID to test "bulk" updating in same wallet
1986
2141
  mint_resp_3 = await env_0.rpc_client.mint_nft(
1987
- wallet_id=env_0.wallet_aliases["nft_w_did"],
1988
- royalty_address=None,
1989
- target_address=None, # doesn't matter so we'll just reuse
1990
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
1991
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
1992
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2142
+ request=NFTMintNFTRequest(
2143
+ wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]),
2144
+ royalty_address=None,
2145
+ target_address=None, # doesn't matter so we'll just reuse
2146
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
2147
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2148
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2149
+ did_id=hmr_did_id,
2150
+ push=True,
2151
+ ),
1993
2152
  tx_config=wallet_environments.tx_config,
1994
- did_id=hmr_did_id,
1995
2153
  )
1996
2154
  assert len(compute_memos(mint_resp_3.spend_bundle)) > 0
1997
2155
 
@@ -2035,24 +2193,42 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
2035
2193
  )
2036
2194
 
2037
2195
  # Check DID NFT
2038
- coins = (await env_0.rpc_client.list_nfts(env_0.wallet_aliases["nft_w_did"], start_index=0, num=2))["nft_list"]
2196
+ coins = (
2197
+ await env_0.rpc_client.list_nfts(
2198
+ NFTGetNFTs(uint32(env_0.wallet_aliases["nft_w_did"]), start_index=uint32(0), num=uint32(2))
2199
+ )
2200
+ ).nft_list
2039
2201
  assert len(coins) == 2
2040
- nft1 = NFTInfo.from_json_dict(coins[0])
2041
- nft12 = NFTInfo.from_json_dict(coins[1])
2202
+ nft1 = coins[0]
2203
+ nft12 = coins[1]
2042
2204
  assert nft1.owner_did is not None
2043
2205
  assert nft12.owner_did is not None
2044
- coins = (await env_0.rpc_client.list_nfts(env_0.wallet_aliases["nft_no_did"], start_index=0, num=1))["nft_list"]
2206
+ coins = (
2207
+ await env_0.rpc_client.list_nfts(
2208
+ NFTGetNFTs(uint32(env_0.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
2209
+ )
2210
+ ).nft_list
2045
2211
  assert len(coins) == 1
2046
- nft2 = NFTInfo.from_json_dict(coins[0])
2212
+ nft2 = coins[0]
2047
2213
  assert nft2.owner_did is None
2048
2214
  nft_coin_list = [
2049
2215
  NFTCoin(wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]), nft_coin_id=nft1.nft_coin_id.hex()),
2050
- NFTCoin(wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]), nft_coin_id=nft12.nft_coin_id.hex()),
2216
+ NFTCoin(
2217
+ wallet_id=uint32(env_0.wallet_aliases["nft_w_did"]),
2218
+ nft_coin_id=encode_puzzle_hash(nft12.launcher_id, "nft"),
2219
+ ),
2051
2220
  NFTCoin(wallet_id=uint32(env_0.wallet_aliases["nft_no_did"]), nft_coin_id=nft2.nft_coin_id.hex()),
2052
2221
  ]
2053
2222
 
2223
+ async with wallet_1.wallet_state_manager.new_action_scope(wallet_environments.tx_config, push=True) as action_scope:
2224
+ wallet_1_ph = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
2054
2225
  fee = uint64(1000)
2055
- address = encode_puzzle_hash(await wallet_1.get_puzzle_hash(new=False), AddressType.XCH.hrp(env_1.node.config))
2226
+ address = encode_puzzle_hash(wallet_1_ph, AddressType.XCH.hrp(env_1.node.config))
2227
+ with pytest.raises(ResponseFailureError, match="You can only transfer"):
2228
+ await env_0.rpc_client.transfer_nft_bulk(
2229
+ NFTTransferBulk(target_address=address, nft_coin_list=[nft_coin_list[0]] * (MAX_NFT_CHUNK_SIZE + 1)),
2230
+ wallet_environments.tx_config,
2231
+ )
2056
2232
  bulk_transfer_resp = await env_0.rpc_client.transfer_nft_bulk(
2057
2233
  NFTTransferBulk(target_address=address, nft_coin_list=nft_coin_list, fee=fee, push=True),
2058
2234
  wallet_environments.tx_config,
@@ -2101,11 +2277,15 @@ async def test_nft_bulk_transfer(wallet_environments: WalletTestFramework) -> No
2101
2277
  )
2102
2278
 
2103
2279
  await time_out_assert(30, get_wallet_number, 2, env_1.wallet_state_manager)
2104
- coins = (await env_1.rpc_client.list_nfts(env_1.wallet_aliases["nft"], start_index=0, num=3))["nft_list"]
2280
+ coins = (
2281
+ await env_1.rpc_client.list_nfts(
2282
+ NFTGetNFTs(uint32(env_1.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(3))
2283
+ )
2284
+ ).nft_list
2105
2285
  assert len(coins) == 3
2106
- nft0 = NFTInfo.from_json_dict(coins[0])
2107
- nft02 = NFTInfo.from_json_dict(coins[1])
2108
- nft03 = NFTInfo.from_json_dict(coins[2])
2286
+ nft0 = coins[0]
2287
+ nft02 = coins[1]
2288
+ nft03 = coins[2]
2109
2289
  nft_set = {nft1.launcher_id, nft12.launcher_id, nft2.launcher_id}
2110
2290
  assert nft0.launcher_id in nft_set
2111
2291
  assert nft02.launcher_id in nft_set
@@ -2165,14 +2345,17 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
2165
2345
  )
2166
2346
 
2167
2347
  mint_resp = await env.rpc_client.mint_nft(
2168
- wallet_id=env.wallet_aliases["nft_w_did1"],
2169
- royalty_address=None,
2170
- target_address=None, # doesn't matter so we'll just reuse
2171
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
2172
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2173
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2348
+ request=NFTMintNFTRequest(
2349
+ wallet_id=uint32(env.wallet_aliases["nft_w_did1"]),
2350
+ royalty_address=None,
2351
+ target_address=None, # doesn't matter so we'll just reuse
2352
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
2353
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2354
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2355
+ did_id="",
2356
+ push=True,
2357
+ ),
2174
2358
  tx_config=wallet_environments.tx_config,
2175
- did_id="",
2176
2359
  )
2177
2360
  assert len(compute_memos(mint_resp.spend_bundle)) > 0
2178
2361
 
@@ -2205,9 +2388,13 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
2205
2388
  )
2206
2389
 
2207
2390
  # Check DID NFT
2208
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_no_did"], start_index=0, num=1))["nft_list"]
2391
+ coins = (
2392
+ await env.rpc_client.list_nfts(
2393
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
2394
+ )
2395
+ ).nft_list
2209
2396
  assert len(coins) == 1
2210
- coin = NFTInfo.from_json_dict(coins[0])
2397
+ coin = coins[0]
2211
2398
  assert coin.owner_did is None
2212
2399
  nft_coin_id = coin.nft_coin_id
2213
2400
 
@@ -2232,11 +2419,14 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
2232
2419
  )
2233
2420
 
2234
2421
  await env.rpc_client.set_nft_did(
2235
- wallet_id=env.wallet_aliases["nft_no_did"],
2236
- did_id=hmr_did_id,
2237
- nft_coin_id=nft_coin_id.hex(),
2422
+ NFTSetNFTDID(
2423
+ wallet_id=uint32(env.wallet_aliases["nft_no_did"]),
2424
+ did_id=hmr_did_id,
2425
+ nft_coin_id=nft_coin_id,
2426
+ fee=uint64(0),
2427
+ push=True,
2428
+ ),
2238
2429
  tx_config=wallet_environments.tx_config,
2239
- fee=0,
2240
2430
  )
2241
2431
 
2242
2432
  await wallet_environments.process_pending_states(
@@ -2271,26 +2461,32 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
2271
2461
  assert isinstance(nft_wallet_to_check, NFTWallet)
2272
2462
  assert len(await nft_wallet_to_check.get_current_nfts()) == 0
2273
2463
 
2274
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_w_did1"], start_index=0, num=1))["nft_list"]
2464
+ coins = (
2465
+ await env.rpc_client.list_nfts(
2466
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did1"]), start_index=uint32(0), num=uint32(1))
2467
+ )
2468
+ ).nft_list
2275
2469
  assert len(coins) == 1
2276
- coin = NFTInfo.from_json_dict(coins[0])
2470
+ coin = coins[0]
2277
2471
  assert coin.owner_did is not None
2278
2472
  assert coin.owner_did.hex() == hex_did_id
2279
2473
  nft_coin_id = coin.nft_coin_id
2280
2474
 
2281
- res = await env.rpc_client.get_nft_info(coin_id=nft_coin_id.hex(), latest=True)
2282
- assert res["success"]
2283
- assert coins[0] == res["nft_info"]
2475
+ nft_get_info_res = await env.rpc_client.get_nft_info(NFTGetInfo(coin_id=nft_coin_id.hex(), latest=True))
2476
+ assert coins[0] == nft_get_info_res.nft_info
2284
2477
 
2285
2478
  # Test set DID1 -> DID2
2286
2479
  hex_did_id2 = did_wallet2.get_my_DID()
2287
2480
  hmr_did_id2 = encode_puzzle_hash(bytes32.from_hexstr(hex_did_id2), AddressType.DID.hrp(env.node.config))
2288
2481
  await env.rpc_client.set_nft_did(
2289
- wallet_id=env.wallet_aliases["nft_w_did1"],
2290
- did_id=hmr_did_id2,
2291
- nft_coin_id=nft_coin_id.hex(),
2482
+ NFTSetNFTDID(
2483
+ wallet_id=uint32(env.wallet_aliases["nft_w_did1"]),
2484
+ did_id=hmr_did_id2,
2485
+ nft_coin_id=nft_coin_id,
2486
+ fee=uint64(0),
2487
+ push=True,
2488
+ ),
2292
2489
  tx_config=wallet_environments.tx_config,
2293
- fee=0,
2294
2490
  )
2295
2491
 
2296
2492
  await wallet_environments.process_pending_states(
@@ -2322,23 +2518,29 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
2322
2518
  )
2323
2519
 
2324
2520
  # Check NFT DID
2325
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_w_did2"], start_index=0, num=1))["nft_list"]
2521
+ coins = (
2522
+ await env.rpc_client.list_nfts(
2523
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_w_did2"]), start_index=uint32(0), num=uint32(1))
2524
+ )
2525
+ ).nft_list
2326
2526
  assert len(coins) == 1
2327
- coin = NFTInfo.from_json_dict(coins[0])
2527
+ coin = coins[0]
2328
2528
  assert coin.owner_did is not None
2329
2529
  assert coin.owner_did.hex() == hex_did_id2
2330
2530
  nft_coin_id = coin.nft_coin_id
2331
- res = await env.rpc_client.get_nft_info(coin_id=nft_coin_id.hex(), latest=True)
2332
- assert res["success"]
2333
- assert coins[0] == res["nft_info"]
2531
+ nft_get_info_res = await env.rpc_client.get_nft_info(NFTGetInfo(coin_id=nft_coin_id.hex(), latest=True))
2532
+ assert coins[0] == nft_get_info_res.nft_info
2334
2533
 
2335
2534
  # Test set DID2 -> None
2336
2535
  await env.rpc_client.set_nft_did(
2337
- wallet_id=env.wallet_aliases["nft_w_did2"],
2338
- did_id=None,
2339
- nft_coin_id=nft_coin_id.hex(),
2536
+ NFTSetNFTDID(
2537
+ wallet_id=uint32(env.wallet_aliases["nft_w_did2"]),
2538
+ did_id=None,
2539
+ nft_coin_id=nft_coin_id,
2540
+ fee=uint64(0),
2541
+ push=True,
2542
+ ),
2340
2543
  tx_config=wallet_environments.tx_config,
2341
- fee=0,
2342
2544
  )
2343
2545
 
2344
2546
  await wallet_environments.process_pending_states(
@@ -2358,13 +2560,16 @@ async def test_nft_set_did(wallet_environments: WalletTestFramework) -> None:
2358
2560
  )
2359
2561
 
2360
2562
  # Check NFT DID
2361
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft_no_did"], start_index=0, num=1))["nft_list"]
2563
+ coins = (
2564
+ await env.rpc_client.list_nfts(
2565
+ NFTGetNFTs(uint32(env.wallet_aliases["nft_no_did"]), start_index=uint32(0), num=uint32(1))
2566
+ )
2567
+ ).nft_list
2362
2568
  assert len(coins) == 1
2363
- coin = NFTInfo.from_json_dict(coins[0])
2569
+ coin = coins[0]
2364
2570
  assert coin.owner_did is None
2365
- res = await env.rpc_client.get_nft_info(coin_id=nft_coin_id.hex(), latest=True)
2366
- assert res["success"]
2367
- assert coins[0] == res["nft_info"]
2571
+ nft_get_info_res = await env.rpc_client.get_nft_info(NFTGetInfo(coin_id=nft_coin_id.hex(), latest=True))
2572
+ assert coins[0] == nft_get_info_res.nft_info
2368
2573
 
2369
2574
 
2370
2575
  @pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN], reason="irrelevant")
@@ -2399,14 +2604,17 @@ async def test_set_nft_status(wallet_environments: WalletTestFramework) -> None:
2399
2604
 
2400
2605
  # Create a NFT without DID
2401
2606
  await env.rpc_client.mint_nft(
2402
- wallet_id=env.wallet_aliases["nft"],
2403
- royalty_address=None,
2404
- target_address=None, # doesn't matter so we'll just reuse
2405
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
2406
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2407
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2607
+ request=NFTMintNFTRequest(
2608
+ wallet_id=uint32(env.wallet_aliases["nft"]),
2609
+ royalty_address=None,
2610
+ target_address=None, # doesn't matter so we'll just reuse
2611
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
2612
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2613
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2614
+ did_id="",
2615
+ push=True,
2616
+ ),
2408
2617
  tx_config=wallet_environments.tx_config,
2409
- did_id="",
2410
2618
  )
2411
2619
 
2412
2620
  await wallet_environments.process_pending_states(
@@ -2437,9 +2645,13 @@ async def test_set_nft_status(wallet_environments: WalletTestFramework) -> None:
2437
2645
  )
2438
2646
 
2439
2647
  # Check DID NFT
2440
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft"], start_index=0, num=1))["nft_list"]
2648
+ coins = (
2649
+ await env.rpc_client.list_nfts(
2650
+ NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
2651
+ )
2652
+ ).nft_list
2441
2653
  assert len(coins) == 1
2442
- coin = NFTInfo.from_json_dict(coins[0])
2654
+ coin = coins[0]
2443
2655
  assert coin.owner_did is None
2444
2656
  assert not coin.pending_transaction
2445
2657
  nft_coin_id = coin.nft_coin_id
@@ -2447,9 +2659,13 @@ async def test_set_nft_status(wallet_environments: WalletTestFramework) -> None:
2447
2659
  await env.rpc_client.set_nft_status(
2448
2660
  NFTSetNFTStatus(wallet_id=uint32(env.wallet_aliases["nft"]), coin_id=nft_coin_id, in_transaction=True)
2449
2661
  )
2450
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft"], start_index=0, num=1))["nft_list"]
2662
+ coins = (
2663
+ await env.rpc_client.list_nfts(
2664
+ NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
2665
+ )
2666
+ ).nft_list
2451
2667
  assert len(coins) == 1
2452
- coin = NFTInfo.from_json_dict(coins[0])
2668
+ coin = coins[0]
2453
2669
  assert coin.pending_transaction
2454
2670
 
2455
2671
 
@@ -2489,14 +2705,17 @@ async def test_nft_sign_message(wallet_environments: WalletTestFramework) -> Non
2489
2705
 
2490
2706
  # Create a NFT without DID
2491
2707
  await env.rpc_client.mint_nft(
2492
- wallet_id=env.wallet_aliases["nft"],
2493
- royalty_address=None,
2494
- target_address=None, # doesn't matter so we'll just reuse
2495
- hash="0xD4584AD463139FA8C0D9F68F4B59F185",
2496
- uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2497
- meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2708
+ request=NFTMintNFTRequest(
2709
+ wallet_id=uint32(env.wallet_aliases["nft"]),
2710
+ royalty_address=None,
2711
+ target_address=None, # doesn't matter so we'll just reuse
2712
+ hash=bytes32.from_hexstr("0xD4584AD463139FA8C0D9F68F4B59F185D4584AD463139FA8C0D9F68F4B59F185"),
2713
+ uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2714
+ meta_uris=["https://www.chia.net/img/branding/chia-logo.svg"],
2715
+ did_id="",
2716
+ push=True,
2717
+ ),
2498
2718
  tx_config=wallet_environments.tx_config,
2499
- did_id="",
2500
2719
  )
2501
2720
 
2502
2721
  await wallet_environments.process_pending_states(
@@ -2527,9 +2746,13 @@ async def test_nft_sign_message(wallet_environments: WalletTestFramework) -> Non
2527
2746
  )
2528
2747
 
2529
2748
  # Check DID NFT
2530
- coins = (await env.rpc_client.list_nfts(env.wallet_aliases["nft"], start_index=0, num=1))["nft_list"]
2749
+ coins = (
2750
+ await env.rpc_client.list_nfts(
2751
+ NFTGetNFTs(uint32(env.wallet_aliases["nft"]), start_index=uint32(0), num=uint32(1))
2752
+ )
2753
+ ).nft_list
2531
2754
  assert len(coins) == 1
2532
- coin = NFTInfo.from_json_dict(coins[0])
2755
+ coin = coins[0]
2533
2756
  assert coin.owner_did is None
2534
2757
  assert not coin.pending_transaction
2535
2758
  # Test general string