wowok 2.1.10 → 2.1.13

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 (896) hide show
  1. package/dist/cjs/bcs/bcs.d.ts +199 -199
  2. package/dist/cjs/bcs/bcs.js +273 -318
  3. package/dist/cjs/bcs/bcs.js.map +1 -0
  4. package/dist/cjs/bcs/effects.d.ts +109 -109
  5. package/dist/cjs/bcs/effects.js +205 -230
  6. package/dist/cjs/bcs/effects.js.map +1 -0
  7. package/dist/cjs/bcs/index.d.ts +1 -2584
  8. package/dist/cjs/bcs/index.js +61 -76
  9. package/dist/cjs/bcs/index.js.map +1 -0
  10. package/dist/cjs/bcs/pure.js +38 -58
  11. package/dist/cjs/bcs/pure.js.map +1 -0
  12. package/dist/cjs/bcs/type-tag-serializer.js +102 -114
  13. package/dist/cjs/bcs/type-tag-serializer.js.map +1 -0
  14. package/dist/cjs/bcs/types.js +6 -23
  15. package/dist/cjs/bcs/types.js.map +1 -0
  16. package/dist/cjs/client/index.js +17 -33
  17. package/dist/cjs/client/index.js.map +1 -0
  18. package/dist/cjs/client/network.js +25 -40
  19. package/dist/cjs/client/network.js.map +1 -0
  20. package/dist/cjs/cryptography/index.js +29 -45
  21. package/dist/cjs/cryptography/index.js.map +1 -0
  22. package/dist/cjs/cryptography/intent.d.ts +1 -1
  23. package/dist/cjs/cryptography/intent.js +20 -31
  24. package/dist/cjs/cryptography/intent.js.map +1 -0
  25. package/dist/cjs/cryptography/keypair.js +102 -116
  26. package/dist/cjs/cryptography/keypair.js.map +1 -0
  27. package/dist/cjs/cryptography/mnemonics.js +43 -41
  28. package/dist/cjs/cryptography/mnemonics.js.map +1 -0
  29. package/dist/cjs/cryptography/publickey.js +112 -134
  30. package/dist/cjs/cryptography/publickey.js.map +1 -0
  31. package/dist/cjs/cryptography/signature-scheme.js +24 -43
  32. package/dist/cjs/cryptography/signature-scheme.js.map +1 -0
  33. package/dist/cjs/cryptography/signature.d.ts +2 -24
  34. package/dist/cjs/cryptography/signature.js +50 -67
  35. package/dist/cjs/cryptography/signature.js.map +1 -0
  36. package/dist/cjs/experimental/cache.js +65 -0
  37. package/dist/cjs/experimental/cache.js.map +1 -0
  38. package/dist/cjs/experimental/client.js +27 -0
  39. package/dist/cjs/experimental/client.js.map +1 -0
  40. package/dist/cjs/experimental/core.js +89 -0
  41. package/dist/cjs/experimental/core.js.map +1 -0
  42. package/dist/cjs/experimental/errors.js +32 -0
  43. package/dist/cjs/experimental/errors.js.map +1 -0
  44. package/dist/cjs/experimental/index.js +15 -0
  45. package/dist/cjs/experimental/index.js.map +1 -0
  46. package/dist/cjs/experimental/persistent-storage.js +343 -0
  47. package/dist/cjs/experimental/persistent-storage.js.map +1 -0
  48. package/dist/cjs/experimental/persistent-storage.test.js +200 -0
  49. package/dist/cjs/experimental/persistent-storage.test.js.map +1 -0
  50. package/dist/cjs/experimental/transports/utils.js +104 -0
  51. package/dist/cjs/experimental/transports/utils.js.map +1 -0
  52. package/dist/cjs/experimental/types.js +6 -0
  53. package/dist/cjs/experimental/types.js.map +1 -0
  54. package/dist/cjs/faucet/faucet.js +106 -124
  55. package/dist/cjs/faucet/faucet.js.map +1 -0
  56. package/dist/cjs/faucet/index.js +12 -28
  57. package/dist/cjs/faucet/index.js.map +1 -0
  58. package/dist/cjs/grpc/client.js +47 -62
  59. package/dist/cjs/grpc/client.js.map +1 -0
  60. package/dist/cjs/grpc/core.js +580 -617
  61. package/dist/cjs/grpc/core.js.map +1 -0
  62. package/dist/cjs/grpc/index.js +9 -25
  63. package/dist/cjs/grpc/index.js.map +1 -0
  64. package/dist/cjs/grpc/proto/google/protobuf/any.js +168 -135
  65. package/dist/cjs/grpc/proto/google/protobuf/any.js.map +1 -0
  66. package/dist/cjs/grpc/proto/google/protobuf/duration.js +105 -90
  67. package/dist/cjs/grpc/proto/google/protobuf/duration.js.map +1 -0
  68. package/dist/cjs/grpc/proto/google/protobuf/empty.js +50 -28
  69. package/dist/cjs/grpc/proto/google/protobuf/empty.js.map +1 -0
  70. package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +96 -75
  71. package/dist/cjs/grpc/proto/google/protobuf/field_mask.js.map +1 -0
  72. package/dist/cjs/grpc/proto/google/protobuf/struct.js +266 -215
  73. package/dist/cjs/grpc/proto/google/protobuf/struct.js.map +1 -0
  74. package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +150 -131
  75. package/dist/cjs/grpc/proto/google/protobuf/timestamp.js.map +1 -0
  76. package/dist/cjs/grpc/proto/google/rpc/error_details.js +331 -302
  77. package/dist/cjs/grpc/proto/google/rpc/error_details.js.map +1 -0
  78. package/dist/cjs/grpc/proto/google/rpc/status.js +50 -50
  79. package/dist/cjs/grpc/proto/google/rpc/status.js.map +1 -0
  80. package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +84 -68
  81. package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
  82. package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +45 -50
  83. package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
  84. package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +38 -43
  85. package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
  86. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +70 -75
  87. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
  88. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +79 -81
  89. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
  90. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +183 -166
  91. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
  92. package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +369 -296
  93. package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
  94. package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +80 -85
  95. package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
  96. package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +31 -28
  97. package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
  98. package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +81 -83
  99. package/dist/cjs/grpc/proto/sui/rpc/v2/event.js.map +1 -0
  100. package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +80 -85
  101. package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
  102. package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +876 -506
  103. package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
  104. package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +56 -61
  105. package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
  106. package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +103 -83
  107. package/dist/cjs/grpc/proto/sui/rpc/v2/input.js.map +1 -0
  108. package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +76 -78
  109. package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
  110. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +69 -119
  111. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
  112. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +392 -350
  113. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
  114. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +599 -473
  115. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
  116. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +46 -78
  117. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
  118. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +242 -224
  119. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
  120. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +32 -52
  121. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
  122. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +139 -134
  123. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
  124. package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +109 -111
  125. package/dist/cjs/grpc/proto/sui/rpc/v2/object.js.map +1 -0
  126. package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +46 -51
  127. package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
  128. package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +76 -61
  129. package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
  130. package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +46 -59
  131. package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
  132. package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +568 -522
  133. package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
  134. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +54 -32
  135. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
  136. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +27 -47
  137. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
  138. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +83 -86
  139. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
  140. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +53 -85
  141. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
  142. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +645 -529
  143. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
  144. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +37 -51
  145. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
  146. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +58 -61
  147. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
  148. package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +749 -730
  149. package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
  150. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1218 -975
  151. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
  152. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +32 -46
  153. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
  154. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +186 -167
  155. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
  156. package/dist/cjs/index.js +96 -91
  157. package/dist/cjs/index.js.map +1 -0
  158. package/dist/cjs/jsonRpc/client.js +654 -743
  159. package/dist/cjs/jsonRpc/client.js.map +1 -0
  160. package/dist/cjs/jsonRpc/core.d.ts +7 -7
  161. package/dist/cjs/jsonRpc/core.js +562 -606
  162. package/dist/cjs/jsonRpc/core.js.map +1 -0
  163. package/dist/cjs/jsonRpc/errors.js +38 -56
  164. package/dist/cjs/jsonRpc/errors.js.map +1 -0
  165. package/dist/cjs/jsonRpc/http-transport.js +70 -114
  166. package/dist/cjs/jsonRpc/http-transport.js.map +1 -0
  167. package/dist/cjs/jsonRpc/index.js +14 -30
  168. package/dist/cjs/jsonRpc/index.js.map +1 -0
  169. package/dist/cjs/jsonRpc/json-rpc-resolver.js +286 -290
  170. package/dist/cjs/jsonRpc/json-rpc-resolver.js.map +1 -0
  171. package/dist/cjs/jsonRpc/rpc-websocket-client.js +150 -207
  172. package/dist/cjs/jsonRpc/rpc-websocket-client.js.map +1 -0
  173. package/dist/cjs/jsonRpc/types/chain.js +4 -15
  174. package/dist/cjs/jsonRpc/types/chain.js.map +1 -0
  175. package/dist/cjs/jsonRpc/types/changes.js +4 -15
  176. package/dist/cjs/jsonRpc/types/changes.js.map +1 -0
  177. package/dist/cjs/jsonRpc/types/coins.js +4 -15
  178. package/dist/cjs/jsonRpc/types/coins.js.map +1 -0
  179. package/dist/cjs/jsonRpc/types/common.js +4 -15
  180. package/dist/cjs/jsonRpc/types/common.js.map +1 -0
  181. package/dist/cjs/jsonRpc/types/generated.d.ts +1 -1
  182. package/dist/cjs/jsonRpc/types/generated.js +4 -15
  183. package/dist/cjs/jsonRpc/types/generated.js.map +1 -0
  184. package/dist/cjs/jsonRpc/types/index.js +4 -15
  185. package/dist/cjs/jsonRpc/types/index.js.map +1 -0
  186. package/dist/cjs/jsonRpc/types/params.js +4 -15
  187. package/dist/cjs/jsonRpc/types/params.js.map +1 -0
  188. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +54 -69
  189. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
  190. package/dist/cjs/keypairs/ed25519/index.js +10 -26
  191. package/dist/cjs/keypairs/ed25519/index.js.map +1 -0
  192. package/dist/cjs/keypairs/ed25519/keypair.js +134 -159
  193. package/dist/cjs/keypairs/ed25519/keypair.js.map +1 -0
  194. package/dist/cjs/keypairs/ed25519/publickey.js +70 -84
  195. package/dist/cjs/keypairs/ed25519/publickey.js.map +1 -0
  196. package/dist/cjs/keypairs/index.js +21 -19
  197. package/dist/cjs/keypairs/index.js.map +1 -0
  198. package/dist/cjs/keypairs/passkey/index.js +11 -27
  199. package/dist/cjs/keypairs/passkey/index.js.map +1 -0
  200. package/dist/cjs/keypairs/passkey/keypair.js +245 -256
  201. package/dist/cjs/keypairs/passkey/keypair.js.map +1 -0
  202. package/dist/cjs/keypairs/passkey/publickey.js +163 -162
  203. package/dist/cjs/keypairs/passkey/publickey.js.map +1 -0
  204. package/dist/cjs/keypairs/passkey/types.js +4 -15
  205. package/dist/cjs/keypairs/passkey/types.js.map +1 -0
  206. package/dist/cjs/keypairs/secp256k1/index.js +10 -26
  207. package/dist/cjs/keypairs/secp256k1/index.js.map +1 -0
  208. package/dist/cjs/keypairs/secp256k1/keypair.js +129 -151
  209. package/dist/cjs/keypairs/secp256k1/keypair.js.map +1 -0
  210. package/dist/cjs/keypairs/secp256k1/publickey.js +71 -89
  211. package/dist/cjs/keypairs/secp256k1/publickey.js.map +1 -0
  212. package/dist/cjs/keypairs/secp256r1/index.js +10 -26
  213. package/dist/cjs/keypairs/secp256r1/index.js.map +1 -0
  214. package/dist/cjs/keypairs/secp256r1/keypair.js +127 -148
  215. package/dist/cjs/keypairs/secp256r1/keypair.js.map +1 -0
  216. package/dist/cjs/keypairs/secp256r1/publickey.js +72 -90
  217. package/dist/cjs/keypairs/secp256r1/publickey.js.map +1 -0
  218. package/dist/cjs/multisig/index.js +10 -26
  219. package/dist/cjs/multisig/index.js.map +1 -0
  220. package/dist/cjs/multisig/publickey.d.ts +1 -1
  221. package/dist/cjs/multisig/publickey.js +228 -276
  222. package/dist/cjs/multisig/publickey.js.map +1 -0
  223. package/dist/cjs/multisig/signer.js +62 -110
  224. package/dist/cjs/multisig/signer.js.map +1 -0
  225. package/dist/cjs/transactions/Arguments.d.ts +4 -4
  226. package/dist/cjs/transactions/Arguments.js +13 -34
  227. package/dist/cjs/transactions/Arguments.js.map +1 -0
  228. package/dist/cjs/transactions/Commands.js +111 -141
  229. package/dist/cjs/transactions/Commands.js.map +1 -0
  230. package/dist/cjs/transactions/Inputs.js +53 -82
  231. package/dist/cjs/transactions/Inputs.js.map +1 -0
  232. package/dist/cjs/transactions/ObjectCache.d.ts +8 -8
  233. package/dist/cjs/transactions/ObjectCache.js +204 -241
  234. package/dist/cjs/transactions/ObjectCache.js.map +1 -0
  235. package/dist/cjs/transactions/Transaction.d.ts +31 -31
  236. package/dist/cjs/transactions/Transaction.js +628 -719
  237. package/dist/cjs/transactions/Transaction.js.map +1 -0
  238. package/dist/cjs/transactions/TransactionData.d.ts +9 -9
  239. package/dist/cjs/transactions/TransactionData.js +396 -440
  240. package/dist/cjs/transactions/TransactionData.js.map +1 -0
  241. package/dist/cjs/transactions/__tests__/Transaction.test.js +169 -0
  242. package/dist/cjs/transactions/__tests__/Transaction.test.js.map +1 -0
  243. package/dist/cjs/transactions/__tests__/bcs.test.js +202 -0
  244. package/dist/cjs/transactions/__tests__/bcs.test.js.map +1 -0
  245. package/dist/cjs/transactions/data/internal.js +166 -207
  246. package/dist/cjs/transactions/data/internal.js.map +1 -0
  247. package/dist/cjs/transactions/data/v1.js +436 -495
  248. package/dist/cjs/transactions/data/v1.js.map +1 -0
  249. package/dist/cjs/transactions/data/v2.d.ts +5 -5
  250. package/dist/cjs/transactions/data/v2.js +94 -107
  251. package/dist/cjs/transactions/data/v2.js.map +1 -0
  252. package/dist/cjs/transactions/executor/caching.js +71 -113
  253. package/dist/cjs/transactions/executor/caching.js.map +1 -0
  254. package/dist/cjs/transactions/executor/parallel.js +339 -378
  255. package/dist/cjs/transactions/executor/parallel.js.map +1 -0
  256. package/dist/cjs/transactions/executor/queue.js +60 -80
  257. package/dist/cjs/transactions/executor/queue.js.map +1 -0
  258. package/dist/cjs/transactions/executor/serial.d.ts +4 -4
  259. package/dist/cjs/transactions/executor/serial.js +102 -131
  260. package/dist/cjs/transactions/executor/serial.js.map +1 -0
  261. package/dist/cjs/transactions/hash.js +17 -28
  262. package/dist/cjs/transactions/hash.js.map +1 -0
  263. package/dist/cjs/transactions/index.js +33 -49
  264. package/dist/cjs/transactions/index.js.map +1 -0
  265. package/dist/cjs/transactions/intents/CoinWithBalance.js +137 -191
  266. package/dist/cjs/transactions/intents/CoinWithBalance.js.map +1 -0
  267. package/dist/cjs/transactions/object.js +88 -111
  268. package/dist/cjs/transactions/object.js.map +1 -0
  269. package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +20 -32
  270. package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
  271. package/dist/cjs/transactions/pure.js +38 -60
  272. package/dist/cjs/transactions/pure.js.map +1 -0
  273. package/dist/cjs/transactions/resolve.js +62 -88
  274. package/dist/cjs/transactions/resolve.js.map +1 -0
  275. package/dist/cjs/transactions/serializer.js +150 -163
  276. package/dist/cjs/transactions/serializer.js.map +1 -0
  277. package/dist/cjs/transactions/utils.d.ts +1 -1
  278. package/dist/cjs/transactions/utils.js +114 -125
  279. package/dist/cjs/transactions/utils.js.map +1 -0
  280. package/dist/cjs/utils/constants.js +29 -56
  281. package/dist/cjs/utils/constants.js.map +1 -0
  282. package/dist/cjs/utils/derived-objects.js +14 -30
  283. package/dist/cjs/utils/derived-objects.js.map +1 -0
  284. package/dist/cjs/utils/dynamic-fields.js +20 -37
  285. package/dist/cjs/utils/dynamic-fields.js.map +1 -0
  286. package/dist/cjs/utils/format.js +14 -30
  287. package/dist/cjs/utils/format.js.map +1 -0
  288. package/dist/cjs/utils/index.js +50 -64
  289. package/dist/cjs/utils/index.js.map +1 -0
  290. package/dist/cjs/utils/move-registry.js +37 -35
  291. package/dist/cjs/utils/move-registry.js.map +1 -0
  292. package/dist/cjs/utils/sui-types.js +74 -68
  293. package/dist/cjs/utils/sui-types.js.map +1 -0
  294. package/dist/cjs/utils/suins.js +30 -46
  295. package/dist/cjs/utils/suins.js.map +1 -0
  296. package/dist/cjs/verify/index.js +12 -27
  297. package/dist/cjs/verify/index.js.map +1 -0
  298. package/dist/cjs/verify/verify.js +83 -110
  299. package/dist/cjs/verify/verify.js.map +1 -0
  300. package/dist/cjs/version.js +8 -25
  301. package/dist/cjs/version.js.map +1 -0
  302. package/dist/cjs/w/call/allocation.js +323 -413
  303. package/dist/cjs/w/call/allocation.js.map +1 -0
  304. package/dist/cjs/w/call/arb.js +105 -136
  305. package/dist/cjs/w/call/arb.js.map +1 -0
  306. package/dist/cjs/w/call/arbitration.js +1206 -1581
  307. package/dist/cjs/w/call/arbitration.js.map +1 -0
  308. package/dist/cjs/w/call/base.js +303 -333
  309. package/dist/cjs/w/call/base.js.map +1 -0
  310. package/dist/cjs/w/call/contact.js +335 -452
  311. package/dist/cjs/w/call/contact.js.map +1 -0
  312. package/dist/cjs/w/call/demand.js +690 -844
  313. package/dist/cjs/w/call/demand.js.map +1 -0
  314. package/dist/cjs/w/call/entity.js +167 -201
  315. package/dist/cjs/w/call/entity.js.map +1 -0
  316. package/dist/cjs/w/call/guard-ins.js +4376 -4389
  317. package/dist/cjs/w/call/guard-ins.js.map +1 -0
  318. package/dist/cjs/w/call/guard.js +1078 -1112
  319. package/dist/cjs/w/call/guard.js.map +1 -0
  320. package/dist/cjs/w/call/index.js +69 -70
  321. package/dist/cjs/w/call/index.js.map +1 -0
  322. package/dist/cjs/w/call/machine.js +1105 -1419
  323. package/dist/cjs/w/call/machine.js.map +1 -0
  324. package/dist/cjs/w/call/order.js +314 -454
  325. package/dist/cjs/w/call/order.js.map +1 -0
  326. package/dist/cjs/w/call/passport.js +214 -253
  327. package/dist/cjs/w/call/passport.js.map +1 -0
  328. package/dist/cjs/w/call/payment.js +187 -224
  329. package/dist/cjs/w/call/payment.js.map +1 -0
  330. package/dist/cjs/w/call/permission.js +1183 -1294
  331. package/dist/cjs/w/call/permission.js.map +1 -0
  332. package/dist/cjs/w/call/personal.js +132 -170
  333. package/dist/cjs/w/call/personal.js.map +1 -0
  334. package/dist/cjs/w/call/progress.js +634 -794
  335. package/dist/cjs/w/call/progress.js.map +1 -0
  336. package/dist/cjs/w/call/proof.js +67 -116
  337. package/dist/cjs/w/call/proof.js.map +1 -0
  338. package/dist/cjs/w/call/repository.js +1037 -1251
  339. package/dist/cjs/w/call/repository.js.map +1 -0
  340. package/dist/cjs/w/call/resource.js +111 -131
  341. package/dist/cjs/w/call/resource.js.map +1 -0
  342. package/dist/cjs/w/call/reward.js +675 -853
  343. package/dist/cjs/w/call/reward.js.map +1 -0
  344. package/dist/cjs/w/call/service.js +1879 -2385
  345. package/dist/cjs/w/call/service.js.map +1 -0
  346. package/dist/cjs/w/call/treasury.js +841 -1138
  347. package/dist/cjs/w/call/treasury.js.map +1 -0
  348. package/dist/cjs/w/call/util.js +593 -624
  349. package/dist/cjs/w/call/util.js.map +1 -0
  350. package/dist/cjs/w/common.d.ts +1 -1
  351. package/dist/cjs/w/common.js +548 -518
  352. package/dist/cjs/w/common.js.map +1 -0
  353. package/dist/cjs/w/exception.js +574 -584
  354. package/dist/cjs/w/exception.js.map +1 -0
  355. package/dist/cjs/w/index.js +26 -23
  356. package/dist/cjs/w/index.js.map +1 -0
  357. package/dist/cjs/w/local/account.js +664 -741
  358. package/dist/cjs/w/local/account.js.map +1 -0
  359. package/dist/cjs/w/local/cache.js +180 -166
  360. package/dist/cjs/w/local/cache.js.map +1 -0
  361. package/dist/cjs/w/local/config.js +51 -80
  362. package/dist/cjs/w/local/config.js.map +1 -0
  363. package/dist/cjs/w/local/index.js +225 -290
  364. package/dist/cjs/w/local/index.js.map +1 -0
  365. package/dist/cjs/w/local/local.d.ts +2 -2
  366. package/dist/cjs/w/local/local.js +638 -646
  367. package/dist/cjs/w/local/local.js.map +1 -0
  368. package/dist/cjs/w/local/storage.js +210 -164
  369. package/dist/cjs/w/local/storage.js.map +1 -0
  370. package/dist/cjs/w/local/token.js +158 -175
  371. package/dist/cjs/w/local/token.js.map +1 -0
  372. package/dist/cjs/w/local/util.js +80 -51
  373. package/dist/cjs/w/local/util.js.map +1 -0
  374. package/dist/cjs/w/local/wip.js +1078 -802
  375. package/dist/cjs/w/local/wip.js.map +1 -0
  376. package/dist/cjs/w/messenger/crypto.js +496 -389
  377. package/dist/cjs/w/messenger/crypto.js.map +1 -0
  378. package/dist/cjs/w/messenger/index.js +53 -35
  379. package/dist/cjs/w/messenger/index.js.map +1 -0
  380. package/dist/cjs/w/messenger/messenger-api.js +1159 -1035
  381. package/dist/cjs/w/messenger/messenger-api.js.map +1 -0
  382. package/dist/cjs/w/messenger/messenger-manager.js +954 -1083
  383. package/dist/cjs/w/messenger/messenger-manager.js.map +1 -0
  384. package/dist/cjs/w/messenger/messenger.d.ts +1 -1
  385. package/dist/cjs/w/messenger/messenger.js +1304 -1450
  386. package/dist/cjs/w/messenger/messenger.js.map +1 -0
  387. package/dist/cjs/w/messenger/server.js +390 -512
  388. package/dist/cjs/w/messenger/server.js.map +1 -0
  389. package/dist/cjs/w/messenger/session.js +399 -403
  390. package/dist/cjs/w/messenger/session.js.map +1 -0
  391. package/dist/cjs/w/messenger/storage.js +881 -777
  392. package/dist/cjs/w/messenger/storage.js.map +1 -0
  393. package/dist/cjs/w/messenger/types.d.ts +2 -2
  394. package/dist/cjs/w/messenger/types.js +83 -103
  395. package/dist/cjs/w/messenger/types.js.map +1 -0
  396. package/dist/cjs/w/messenger/utils.js +29 -34
  397. package/dist/cjs/w/messenger/utils.js.map +1 -0
  398. package/dist/cjs/w/query/bult-in.js +101 -110
  399. package/dist/cjs/w/query/bult-in.js.map +1 -0
  400. package/dist/cjs/w/query/event.js +134 -146
  401. package/dist/cjs/w/query/event.js.map +1 -0
  402. package/dist/cjs/w/query/index.js +22 -20
  403. package/dist/cjs/w/query/index.js.map +1 -0
  404. package/dist/cjs/w/query/object.js +1576 -1576
  405. package/dist/cjs/w/query/object.js.map +1 -0
  406. package/dist/cjs/w/query/received.js +66 -88
  407. package/dist/cjs/w/query/received.js.map +1 -0
  408. package/dist/cjs/w/query/util.js +53 -77
  409. package/dist/cjs/w/query/util.js.map +1 -0
  410. package/dist/cjs/w/util.js +589 -675
  411. package/dist/cjs/w/util.js.map +1 -0
  412. package/dist/esm/bcs/bcs.d.ts +199 -199
  413. package/dist/esm/bcs/bcs.js +269 -310
  414. package/dist/esm/bcs/bcs.js.map +1 -0
  415. package/dist/esm/bcs/effects.d.ts +109 -109
  416. package/dist/esm/bcs/effects.js +171 -179
  417. package/dist/esm/bcs/effects.js.map +1 -0
  418. package/dist/esm/bcs/index.d.ts +1 -2584
  419. package/dist/esm/bcs/index.js +51 -94
  420. package/dist/esm/bcs/index.js.map +1 -0
  421. package/dist/esm/bcs/pure.js +35 -38
  422. package/dist/esm/bcs/pure.js.map +1 -0
  423. package/dist/esm/bcs/type-tag-serializer.js +98 -95
  424. package/dist/esm/bcs/type-tag-serializer.js.map +1 -0
  425. package/dist/esm/bcs/types.js +5 -5
  426. package/dist/esm/bcs/types.js.map +1 -0
  427. package/dist/esm/client/index.js +7 -23
  428. package/dist/esm/client/index.js.map +1 -0
  429. package/dist/esm/client/network.js +23 -22
  430. package/dist/esm/client/network.js.map +1 -0
  431. package/dist/esm/cryptography/index.js +9 -46
  432. package/dist/esm/cryptography/index.js.map +1 -0
  433. package/dist/esm/cryptography/intent.d.ts +1 -1
  434. package/dist/esm/cryptography/intent.js +18 -12
  435. package/dist/esm/cryptography/intent.js.map +1 -0
  436. package/dist/esm/cryptography/keypair.js +95 -99
  437. package/dist/esm/cryptography/keypair.js.map +1 -0
  438. package/dist/esm/cryptography/mnemonics.js +40 -24
  439. package/dist/esm/cryptography/mnemonics.js.map +1 -0
  440. package/dist/esm/cryptography/publickey.js +104 -115
  441. package/dist/esm/cryptography/publickey.js.map +1 -0
  442. package/dist/esm/cryptography/signature-scheme.js +22 -24
  443. package/dist/esm/cryptography/signature-scheme.js.map +1 -0
  444. package/dist/esm/cryptography/signature.d.ts +2 -24
  445. package/dist/esm/cryptography/signature.js +44 -48
  446. package/dist/esm/cryptography/signature.js.map +1 -0
  447. package/dist/esm/experimental/cache.js +61 -0
  448. package/dist/esm/experimental/cache.js.map +1 -0
  449. package/dist/esm/experimental/client.js +23 -0
  450. package/dist/esm/experimental/client.js.map +1 -0
  451. package/dist/esm/experimental/core.js +85 -0
  452. package/dist/esm/experimental/core.js.map +1 -0
  453. package/dist/esm/experimental/errors.js +27 -0
  454. package/dist/esm/experimental/errors.js.map +1 -0
  455. package/dist/esm/experimental/index.js +8 -0
  456. package/dist/esm/experimental/index.js.map +1 -0
  457. package/dist/esm/experimental/persistent-storage.js +337 -0
  458. package/dist/esm/experimental/persistent-storage.js.map +1 -0
  459. package/dist/esm/experimental/persistent-storage.test.js +198 -0
  460. package/dist/esm/experimental/persistent-storage.test.js.map +1 -0
  461. package/dist/esm/experimental/transports/utils.js +100 -0
  462. package/dist/esm/experimental/transports/utils.js.map +1 -0
  463. package/dist/esm/experimental/types.js +5 -0
  464. package/dist/esm/experimental/types.js.map +1 -0
  465. package/dist/esm/faucet/faucet.js +104 -111
  466. package/dist/esm/faucet/faucet.js.map +1 -0
  467. package/dist/esm/faucet/index.js +4 -16
  468. package/dist/esm/faucet/index.js.map +1 -0
  469. package/dist/esm/grpc/client.js +34 -34
  470. package/dist/esm/grpc/client.js.map +1 -0
  471. package/dist/esm/grpc/core.js +570 -601
  472. package/dist/esm/grpc/core.js.map +1 -0
  473. package/dist/esm/grpc/index.js +5 -6
  474. package/dist/esm/grpc/index.js.map +1 -0
  475. package/dist/esm/grpc/proto/google/protobuf/any.js +161 -111
  476. package/dist/esm/grpc/proto/google/protobuf/any.js.map +1 -0
  477. package/dist/esm/grpc/proto/google/protobuf/duration.js +99 -67
  478. package/dist/esm/grpc/proto/google/protobuf/duration.js.map +1 -0
  479. package/dist/esm/grpc/proto/google/protobuf/empty.js +46 -7
  480. package/dist/esm/grpc/proto/google/protobuf/empty.js.map +1 -0
  481. package/dist/esm/grpc/proto/google/protobuf/field_mask.js +90 -52
  482. package/dist/esm/grpc/proto/google/protobuf/field_mask.js.map +1 -0
  483. package/dist/esm/grpc/proto/google/protobuf/struct.js +258 -190
  484. package/dist/esm/grpc/proto/google/protobuf/struct.js.map +1 -0
  485. package/dist/esm/grpc/proto/google/protobuf/timestamp.js +144 -108
  486. package/dist/esm/grpc/proto/google/protobuf/timestamp.js.map +1 -0
  487. package/dist/esm/grpc/proto/google/rpc/error_details.js +313 -267
  488. package/dist/esm/grpc/proto/google/rpc/error_details.js.map +1 -0
  489. package/dist/esm/grpc/proto/google/rpc/status.js +45 -28
  490. package/dist/esm/grpc/proto/google/rpc/status.js.map +1 -0
  491. package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +80 -47
  492. package/dist/esm/grpc/proto/sui/rpc/v2/argument.js.map +1 -0
  493. package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +41 -29
  494. package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js.map +1 -0
  495. package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +34 -22
  496. package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js.map +1 -0
  497. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +61 -49
  498. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js.map +1 -0
  499. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +72 -57
  500. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js.map +1 -0
  501. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +173 -139
  502. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js.map +1 -0
  503. package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +358 -268
  504. package/dist/esm/grpc/proto/sui/rpc/v2/effects.js.map +1 -0
  505. package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +72 -60
  506. package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js.map +1 -0
  507. package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +29 -9
  508. package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js.map +1 -0
  509. package/dist/esm/grpc/proto/sui/rpc/v2/event.js +74 -59
  510. package/dist/esm/grpc/proto/sui/rpc/v2/event.js.map +1 -0
  511. package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +69 -57
  512. package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js.map +1 -0
  513. package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +861 -474
  514. package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js.map +1 -0
  515. package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +52 -40
  516. package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js.map +1 -0
  517. package/dist/esm/grpc/proto/sui/rpc/v2/input.js +98 -61
  518. package/dist/esm/grpc/proto/sui/rpc/v2/input.js.map +1 -0
  519. package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +71 -56
  520. package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js.map +1 -0
  521. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +65 -100
  522. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js.map +1 -0
  523. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +365 -306
  524. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js.map +1 -0
  525. package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +585 -442
  526. package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js.map +1 -0
  527. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +42 -59
  528. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js.map +1 -0
  529. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +226 -191
  530. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js.map +1 -0
  531. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +28 -33
  532. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js.map +1 -0
  533. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +129 -107
  534. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js.map +1 -0
  535. package/dist/esm/grpc/proto/sui/rpc/v2/object.js +100 -85
  536. package/dist/esm/grpc/proto/sui/rpc/v2/object.js.map +1 -0
  537. package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +42 -30
  538. package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js.map +1 -0
  539. package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +72 -40
  540. package/dist/esm/grpc/proto/sui/rpc/v2/owner.js.map +1 -0
  541. package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +42 -38
  542. package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js.map +1 -0
  543. package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +544 -481
  544. package/dist/esm/grpc/proto/sui/rpc/v2/signature.js.map +1 -0
  545. package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +52 -13
  546. package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js.map +1 -0
  547. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +23 -28
  548. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js.map +1 -0
  549. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +74 -60
  550. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js.map +1 -0
  551. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +49 -66
  552. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js.map +1 -0
  553. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +623 -490
  554. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js.map +1 -0
  555. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +33 -32
  556. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js.map +1 -0
  557. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +50 -36
  558. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js.map +1 -0
  559. package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +737 -701
  560. package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js.map +1 -0
  561. package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +1177 -917
  562. package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js.map +1 -0
  563. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +28 -27
  564. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js.map +1 -0
  565. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +169 -133
  566. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js.map +1 -0
  567. package/dist/esm/index.js +21 -107
  568. package/dist/esm/index.js.map +1 -0
  569. package/dist/esm/jsonRpc/client.js +646 -727
  570. package/dist/esm/jsonRpc/client.js.map +1 -0
  571. package/dist/esm/jsonRpc/core.d.ts +7 -7
  572. package/dist/esm/jsonRpc/core.js +550 -581
  573. package/dist/esm/jsonRpc/core.js.map +1 -0
  574. package/dist/esm/jsonRpc/errors.js +36 -41
  575. package/dist/esm/jsonRpc/errors.js.map +1 -0
  576. package/dist/esm/jsonRpc/http-transport.js +65 -93
  577. package/dist/esm/jsonRpc/http-transport.js.map +1 -0
  578. package/dist/esm/jsonRpc/index.js +6 -20
  579. package/dist/esm/jsonRpc/index.js.map +1 -0
  580. package/dist/esm/jsonRpc/json-rpc-resolver.js +281 -276
  581. package/dist/esm/jsonRpc/json-rpc-resolver.js.map +1 -0
  582. package/dist/esm/jsonRpc/rpc-websocket-client.js +147 -189
  583. package/dist/esm/jsonRpc/rpc-websocket-client.js.map +1 -0
  584. package/dist/esm/jsonRpc/types/chain.js +4 -0
  585. package/dist/esm/jsonRpc/types/chain.js.map +1 -0
  586. package/dist/esm/jsonRpc/types/changes.js +4 -0
  587. package/dist/esm/jsonRpc/types/changes.js.map +1 -0
  588. package/dist/esm/jsonRpc/types/coins.js +4 -0
  589. package/dist/esm/jsonRpc/types/coins.js.map +1 -0
  590. package/dist/esm/jsonRpc/types/common.js +4 -0
  591. package/dist/esm/jsonRpc/types/common.js.map +1 -0
  592. package/dist/esm/jsonRpc/types/generated.d.ts +1 -1
  593. package/dist/esm/jsonRpc/types/generated.js +4 -0
  594. package/dist/esm/jsonRpc/types/generated.js.map +1 -0
  595. package/dist/esm/jsonRpc/types/index.js +4 -0
  596. package/dist/esm/jsonRpc/types/index.js.map +1 -0
  597. package/dist/esm/jsonRpc/types/params.js +4 -0
  598. package/dist/esm/jsonRpc/types/params.js.map +1 -0
  599. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +49 -48
  600. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js.map +1 -0
  601. package/dist/esm/keypairs/ed25519/index.js +5 -10
  602. package/dist/esm/keypairs/ed25519/index.js.map +1 -0
  603. package/dist/esm/keypairs/ed25519/keypair.js +128 -146
  604. package/dist/esm/keypairs/ed25519/keypair.js.map +1 -0
  605. package/dist/esm/keypairs/ed25519/publickey.js +64 -67
  606. package/dist/esm/keypairs/ed25519/publickey.js.map +1 -0
  607. package/dist/esm/keypairs/index.js +3 -0
  608. package/dist/esm/keypairs/index.js.map +1 -0
  609. package/dist/esm/keypairs/passkey/index.js +5 -12
  610. package/dist/esm/keypairs/passkey/index.js.map +1 -0
  611. package/dist/esm/keypairs/passkey/keypair.js +236 -243
  612. package/dist/esm/keypairs/passkey/keypair.js.map +1 -0
  613. package/dist/esm/keypairs/passkey/publickey.js +154 -140
  614. package/dist/esm/keypairs/passkey/publickey.js.map +1 -0
  615. package/dist/esm/keypairs/passkey/types.js +4 -0
  616. package/dist/esm/keypairs/passkey/types.js.map +1 -0
  617. package/dist/esm/keypairs/secp256k1/index.js +5 -10
  618. package/dist/esm/keypairs/secp256k1/index.js.map +1 -0
  619. package/dist/esm/keypairs/secp256k1/keypair.js +120 -134
  620. package/dist/esm/keypairs/secp256k1/keypair.js.map +1 -0
  621. package/dist/esm/keypairs/secp256k1/publickey.js +64 -71
  622. package/dist/esm/keypairs/secp256k1/publickey.js.map +1 -0
  623. package/dist/esm/keypairs/secp256r1/index.js +5 -10
  624. package/dist/esm/keypairs/secp256r1/index.js.map +1 -0
  625. package/dist/esm/keypairs/secp256r1/keypair.js +118 -131
  626. package/dist/esm/keypairs/secp256r1/keypair.js.map +1 -0
  627. package/dist/esm/keypairs/secp256r1/publickey.js +63 -66
  628. package/dist/esm/keypairs/secp256r1/publickey.js.map +1 -0
  629. package/dist/esm/multisig/index.js +5 -10
  630. package/dist/esm/multisig/index.js.map +1 -0
  631. package/dist/esm/multisig/publickey.d.ts +1 -1
  632. package/dist/esm/multisig/publickey.js +216 -253
  633. package/dist/esm/multisig/publickey.js.map +1 -0
  634. package/dist/esm/multisig/signer.js +57 -89
  635. package/dist/esm/multisig/signer.js.map +1 -0
  636. package/dist/esm/transactions/Arguments.d.ts +4 -4
  637. package/dist/esm/transactions/Arguments.js +9 -13
  638. package/dist/esm/transactions/Arguments.js.map +1 -0
  639. package/dist/esm/transactions/Commands.js +105 -118
  640. package/dist/esm/transactions/Commands.js.map +1 -0
  641. package/dist/esm/transactions/Inputs.js +49 -61
  642. package/dist/esm/transactions/Inputs.js.map +1 -0
  643. package/dist/esm/transactions/ObjectCache.d.ts +8 -8
  644. package/dist/esm/transactions/ObjectCache.js +200 -223
  645. package/dist/esm/transactions/ObjectCache.js.map +1 -0
  646. package/dist/esm/transactions/Transaction.d.ts +32 -32
  647. package/dist/esm/transactions/Transaction.js +611 -696
  648. package/dist/esm/transactions/Transaction.js.map +1 -0
  649. package/dist/esm/transactions/TransactionData.d.ts +9 -9
  650. package/dist/esm/transactions/TransactionData.js +386 -415
  651. package/dist/esm/transactions/TransactionData.js.map +1 -0
  652. package/dist/esm/transactions/__tests__/Transaction.test.js +167 -0
  653. package/dist/esm/transactions/__tests__/Transaction.test.js.map +1 -0
  654. package/dist/esm/transactions/__tests__/bcs.test.js +200 -0
  655. package/dist/esm/transactions/__tests__/bcs.test.js.map +1 -0
  656. package/dist/esm/transactions/data/internal.js +158 -205
  657. package/dist/esm/transactions/data/internal.js.map +1 -0
  658. package/dist/esm/transactions/data/v1.js +419 -487
  659. package/dist/esm/transactions/data/v1.js.map +1 -0
  660. package/dist/esm/transactions/data/v2.d.ts +5 -5
  661. package/dist/esm/transactions/data/v2.js +89 -107
  662. package/dist/esm/transactions/data/v2.js.map +1 -0
  663. package/dist/esm/transactions/executor/caching.d.ts +2 -2
  664. package/dist/esm/transactions/executor/caching.js +66 -93
  665. package/dist/esm/transactions/executor/caching.js.map +1 -0
  666. package/dist/esm/transactions/executor/parallel.js +329 -352
  667. package/dist/esm/transactions/executor/parallel.js.map +1 -0
  668. package/dist/esm/transactions/executor/queue.js +58 -64
  669. package/dist/esm/transactions/executor/queue.js.map +1 -0
  670. package/dist/esm/transactions/executor/serial.d.ts +5 -5
  671. package/dist/esm/transactions/executor/serial.js +96 -110
  672. package/dist/esm/transactions/executor/serial.js.map +1 -0
  673. package/dist/esm/transactions/hash.js +15 -9
  674. package/dist/esm/transactions/hash.js.map +1 -0
  675. package/dist/esm/transactions/index.js +15 -41
  676. package/dist/esm/transactions/index.js.map +1 -0
  677. package/dist/esm/transactions/intents/CoinWithBalance.js +127 -165
  678. package/dist/esm/transactions/intents/CoinWithBalance.js.map +1 -0
  679. package/dist/esm/transactions/object.js +86 -92
  680. package/dist/esm/transactions/object.js.map +1 -0
  681. package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +18 -15
  682. package/dist/esm/transactions/plugins/NamedPackagesPlugin.js.map +1 -0
  683. package/dist/esm/transactions/pure.js +34 -39
  684. package/dist/esm/transactions/pure.js.map +1 -0
  685. package/dist/esm/transactions/resolve.js +58 -69
  686. package/dist/esm/transactions/resolve.js.map +1 -0
  687. package/dist/esm/transactions/serializer.js +145 -144
  688. package/dist/esm/transactions/serializer.js.map +1 -0
  689. package/dist/esm/transactions/utils.d.ts +1 -1
  690. package/dist/esm/transactions/utils.js +110 -109
  691. package/dist/esm/transactions/utils.js.map +1 -0
  692. package/dist/esm/utils/constants.js +26 -36
  693. package/dist/esm/utils/constants.js.map +1 -0
  694. package/dist/esm/utils/derived-objects.js +11 -10
  695. package/dist/esm/utils/derived-objects.js.map +1 -0
  696. package/dist/esm/utils/dynamic-fields.js +16 -16
  697. package/dist/esm/utils/dynamic-fields.js.map +1 -0
  698. package/dist/esm/utils/format.js +13 -13
  699. package/dist/esm/utils/format.js.map +1 -0
  700. package/dist/esm/utils/index.js +15 -76
  701. package/dist/esm/utils/index.js.map +1 -0
  702. package/dist/esm/utils/move-registry.js +34 -17
  703. package/dist/esm/utils/move-registry.js.map +1 -0
  704. package/dist/esm/utils/sui-types.js +70 -54
  705. package/dist/esm/utils/sui-types.js.map +1 -0
  706. package/dist/esm/utils/suins.js +29 -29
  707. package/dist/esm/utils/suins.js.map +1 -0
  708. package/dist/esm/verify/index.js +5 -14
  709. package/dist/esm/verify/index.js.map +1 -0
  710. package/dist/esm/verify/verify.js +76 -93
  711. package/dist/esm/verify/verify.js.map +1 -0
  712. package/dist/esm/version.js +6 -6
  713. package/dist/esm/version.js.map +1 -0
  714. package/dist/esm/w/call/allocation.js +307 -402
  715. package/dist/esm/w/call/allocation.js.map +1 -0
  716. package/dist/esm/w/call/arb.js +100 -129
  717. package/dist/esm/w/call/arb.js.map +1 -0
  718. package/dist/esm/w/call/arbitration.js +1170 -1568
  719. package/dist/esm/w/call/arbitration.js.map +1 -0
  720. package/dist/esm/w/call/base.js +288 -315
  721. package/dist/esm/w/call/base.js.map +1 -0
  722. package/dist/esm/w/call/contact.js +318 -442
  723. package/dist/esm/w/call/contact.js.map +1 -0
  724. package/dist/esm/w/call/demand.js +673 -841
  725. package/dist/esm/w/call/demand.js.map +1 -0
  726. package/dist/esm/w/call/entity.js +162 -203
  727. package/dist/esm/w/call/entity.js.map +1 -0
  728. package/dist/esm/w/call/guard-ins.js +4373 -4371
  729. package/dist/esm/w/call/guard-ins.js.map +1 -0
  730. package/dist/esm/w/call/guard.js +1061 -1108
  731. package/dist/esm/w/call/guard.js.map +1 -0
  732. package/dist/esm/w/call/index.js +24 -56
  733. package/dist/esm/w/call/index.js.map +1 -0
  734. package/dist/esm/w/call/machine.js +1086 -1433
  735. package/dist/esm/w/call/machine.js.map +1 -0
  736. package/dist/esm/w/call/order.js +301 -448
  737. package/dist/esm/w/call/order.js.map +1 -0
  738. package/dist/esm/w/call/passport.js +204 -240
  739. package/dist/esm/w/call/passport.js.map +1 -0
  740. package/dist/esm/w/call/payment.js +177 -215
  741. package/dist/esm/w/call/payment.js.map +1 -0
  742. package/dist/esm/w/call/permission.js +1172 -1320
  743. package/dist/esm/w/call/permission.js.map +1 -0
  744. package/dist/esm/w/call/personal.js +121 -156
  745. package/dist/esm/w/call/personal.js.map +1 -0
  746. package/dist/esm/w/call/progress.js +625 -797
  747. package/dist/esm/w/call/progress.js.map +1 -0
  748. package/dist/esm/w/call/proof.js +61 -103
  749. package/dist/esm/w/call/proof.js.map +1 -0
  750. package/dist/esm/w/call/repository.js +1017 -1251
  751. package/dist/esm/w/call/repository.js.map +1 -0
  752. package/dist/esm/w/call/resource.js +108 -124
  753. package/dist/esm/w/call/resource.js.map +1 -0
  754. package/dist/esm/w/call/reward.js +660 -847
  755. package/dist/esm/w/call/reward.js.map +1 -0
  756. package/dist/esm/w/call/service.js +1849 -2400
  757. package/dist/esm/w/call/service.js.map +1 -0
  758. package/dist/esm/w/call/treasury.js +815 -1125
  759. package/dist/esm/w/call/treasury.js.map +1 -0
  760. package/dist/esm/w/call/util.js +553 -576
  761. package/dist/esm/w/call/util.js.map +1 -0
  762. package/dist/esm/w/common.d.ts +1 -1
  763. package/dist/esm/w/common.js +579 -580
  764. package/dist/esm/w/common.js.map +1 -0
  765. package/dist/esm/w/exception.js +570 -573
  766. package/dist/esm/w/exception.js.map +1 -0
  767. package/dist/esm/w/index.js +4 -0
  768. package/dist/esm/w/index.js.map +1 -0
  769. package/dist/esm/w/local/account.js +652 -709
  770. package/dist/esm/w/local/account.js.map +1 -0
  771. package/dist/esm/w/local/cache.js +176 -147
  772. package/dist/esm/w/local/cache.js.map +1 -0
  773. package/dist/esm/w/local/config.js +46 -60
  774. package/dist/esm/w/local/config.js.map +1 -0
  775. package/dist/esm/w/local/index.js +196 -273
  776. package/dist/esm/w/local/index.js.map +1 -0
  777. package/dist/esm/w/local/local.d.ts +2 -2
  778. package/dist/esm/w/local/local.js +631 -626
  779. package/dist/esm/w/local/local.js.map +1 -0
  780. package/dist/esm/w/local/storage.js +168 -136
  781. package/dist/esm/w/local/storage.js.map +1 -0
  782. package/dist/esm/w/local/token.js +149 -151
  783. package/dist/esm/w/local/token.js.map +1 -0
  784. package/dist/esm/w/local/util.js +45 -22
  785. package/dist/esm/w/local/util.js.map +1 -0
  786. package/dist/esm/w/local/wip.js +1038 -781
  787. package/dist/esm/w/local/wip.js.map +1 -0
  788. package/dist/esm/w/messenger/crypto.js +491 -387
  789. package/dist/esm/w/messenger/crypto.js.map +1 -0
  790. package/dist/esm/w/messenger/index.js +27 -24
  791. package/dist/esm/w/messenger/index.js.map +1 -0
  792. package/dist/esm/w/messenger/messenger-api.js +1111 -1017
  793. package/dist/esm/w/messenger/messenger-api.js.map +1 -0
  794. package/dist/esm/w/messenger/messenger-manager.js +944 -1052
  795. package/dist/esm/w/messenger/messenger-manager.js.map +1 -0
  796. package/dist/esm/w/messenger/messenger.d.ts +1 -1
  797. package/dist/esm/w/messenger/messenger.js +1258 -1421
  798. package/dist/esm/w/messenger/messenger.js.map +1 -0
  799. package/dist/esm/w/messenger/server.js +388 -499
  800. package/dist/esm/w/messenger/server.js.map +1 -0
  801. package/dist/esm/w/messenger/session.js +394 -399
  802. package/dist/esm/w/messenger/session.js.map +1 -0
  803. package/dist/esm/w/messenger/storage.js +840 -751
  804. package/dist/esm/w/messenger/storage.js.map +1 -0
  805. package/dist/esm/w/messenger/types.d.ts +2 -2
  806. package/dist/esm/w/messenger/types.js +80 -85
  807. package/dist/esm/w/messenger/types.js.map +1 -0
  808. package/dist/esm/w/messenger/utils.js +28 -16
  809. package/dist/esm/w/messenger/utils.js.map +1 -0
  810. package/dist/esm/w/query/bult-in.js +95 -100
  811. package/dist/esm/w/query/bult-in.js.map +1 -0
  812. package/dist/esm/w/query/event.js +128 -125
  813. package/dist/esm/w/query/event.js.map +1 -0
  814. package/dist/esm/w/query/index.js +3 -0
  815. package/dist/esm/w/query/index.js.map +1 -0
  816. package/dist/esm/w/query/object.js +1560 -1574
  817. package/dist/esm/w/query/object.js.map +1 -0
  818. package/dist/esm/w/query/received.js +57 -63
  819. package/dist/esm/w/query/received.js.map +1 -0
  820. package/dist/esm/w/query/util.js +48 -56
  821. package/dist/esm/w/query/util.js.map +1 -0
  822. package/dist/esm/w/util.js +578 -673
  823. package/dist/esm/w/util.js.map +1 -0
  824. package/package.json +13 -7
  825. package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-arm64.node +0 -0
  826. package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-x64.node +0 -0
  827. package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm.node +0 -0
  828. package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm64.node +0 -0
  829. package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-x64.node +0 -0
  830. package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-arm64.node +0 -0
  831. package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-x64.node +0 -0
  832. package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-arm64.node +0 -0
  833. package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-x64.node +0 -0
  834. package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm.node +0 -0
  835. package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm64.node +0 -0
  836. package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-x64.node +0 -0
  837. package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-arm64.node +0 -0
  838. package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-x64.node +0 -0
  839. package/scripts/download-prebuilds.js +234 -0
  840. package/scripts/install-better-sqlite3.js +377 -0
  841. package/dist/cjs/graphql/client.js +0 -98
  842. package/dist/cjs/graphql/core.js +0 -506
  843. package/dist/cjs/graphql/generated/2024.1/tada-env.js +0 -13141
  844. package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +0 -11
  845. package/dist/cjs/graphql/generated/2024.4/tada-env.js +0 -13287
  846. package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +0 -11
  847. package/dist/cjs/graphql/generated/latest/tada-env.js +0 -12925
  848. package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +0 -11
  849. package/dist/cjs/graphql/generated/queries.js +0 -807
  850. package/dist/cjs/graphql/index.js +0 -25
  851. package/dist/cjs/graphql/schemas/2024.1/index.js +0 -28
  852. package/dist/cjs/graphql/schemas/2024.4/index.js +0 -28
  853. package/dist/cjs/graphql/schemas/latest/index.js +0 -28
  854. package/dist/cjs/graphql/types.js +0 -16
  855. package/dist/cjs/package.json +0 -5
  856. package/dist/cjs/w/local/.eslintrc.js +0 -15
  857. package/dist/cjs/w/messenger/.eslintrc.js +0 -15
  858. package/dist/cjs/zklogin/address.js +0 -93
  859. package/dist/cjs/zklogin/bcs.js +0 -41
  860. package/dist/cjs/zklogin/index.js +0 -45
  861. package/dist/cjs/zklogin/jwt-decode.js +0 -88
  862. package/dist/cjs/zklogin/jwt-utils.js +0 -128
  863. package/dist/cjs/zklogin/nonce.js +0 -60
  864. package/dist/cjs/zklogin/poseidon.js +0 -64
  865. package/dist/cjs/zklogin/publickey.js +0 -281
  866. package/dist/cjs/zklogin/signature.js +0 -57
  867. package/dist/cjs/zklogin/utils.js +0 -98
  868. package/dist/esm/graphql/client.js +0 -79
  869. package/dist/esm/graphql/core.js +0 -505
  870. package/dist/esm/graphql/generated/2024.1/tada-env.js +0 -13121
  871. package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +0 -16
  872. package/dist/esm/graphql/generated/2024.4/tada-env.js +0 -13267
  873. package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +0 -16
  874. package/dist/esm/graphql/generated/latest/tada-env.js +0 -12905
  875. package/dist/esm/graphql/generated/latest/tsconfig.tada.js +0 -16
  876. package/dist/esm/graphql/generated/queries.js +0 -788
  877. package/dist/esm/graphql/index.js +0 -8
  878. package/dist/esm/graphql/schemas/2024.1/index.js +0 -8
  879. package/dist/esm/graphql/schemas/2024.4/index.js +0 -8
  880. package/dist/esm/graphql/schemas/latest/index.js +0 -8
  881. package/dist/esm/graphql/types.js +0 -0
  882. package/dist/esm/package.json +0 -5
  883. package/dist/esm/w/local/.eslintrc.js +0 -23
  884. package/dist/esm/w/messenger/.eslintrc.js +0 -23
  885. package/dist/esm/zklogin/address.js +0 -78
  886. package/dist/esm/zklogin/bcs.js +0 -21
  887. package/dist/esm/zklogin/index.js +0 -38
  888. package/dist/esm/zklogin/jwt-decode.js +0 -68
  889. package/dist/esm/zklogin/jwt-utils.js +0 -108
  890. package/dist/esm/zklogin/nonce.js +0 -40
  891. package/dist/esm/zklogin/poseidon.js +0 -61
  892. package/dist/esm/zklogin/publickey.js +0 -265
  893. package/dist/esm/zklogin/signature.js +0 -37
  894. package/dist/esm/zklogin/utils.js +0 -78
  895. package/dist/tsconfig.esm.tsbuildinfo +0 -1
  896. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,731 +1,646 @@
1
- var __defProp = Object.defineProperty;
2
- var __typeError = (msg) => {
3
- throw TypeError(msg);
4
- };
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _serializationPlugins, _buildPlugins, _intentResolvers, _inputSection, _commandSection, _availableResults, _pendingPromises, _added, _data, _Transaction_instances, fork_fn, addCommand_fn, addInput_fn, normalizeTransactionArgument_fn, resolveArgument_fn, prepareBuild_fn, runPlugins_fn, waitForPendingTasks_fn, sortCommandsAndInputs_fn;
1
+ // Copyright (c) Mysten Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ var _a;
13
4
  import { fromBase64, isSerializedBcs } from "@mysten/bcs";
14
5
  import { is, parse } from "valibot";
15
6
  import { normalizeWowAddress } from "../utils/sui-types.js";
16
7
  import { Commands } from "./Commands.js";
17
- import {
18
- ArgumentSchema,
19
- NormalizedCallArg,
20
- ObjectRefSchema,
21
- TransactionExpiration
22
- } from "./data/internal.js";
8
+ import { ArgumentSchema, NormalizedCallArg, ObjectRefSchema, TransactionExpiration, } from "./data/internal.js";
23
9
  import { serializeV1TransactionData } from "./data/v1.js";
24
10
  import { SerializedTransactionDataV2Schema } from "./data/v2.js";
25
11
  import { Inputs } from "./Inputs.js";
26
- import {
27
- needsTransactionResolution,
28
- resolveTransactionPlugin
29
- } from "./resolve.js";
12
+ import { needsTransactionResolution, resolveTransactionPlugin, } from "./resolve.js";
30
13
  import { createObjectMethods } from "./object.js";
31
14
  import { createPure } from "./pure.js";
32
15
  import { TransactionDataBuilder } from "./TransactionData.js";
33
16
  import { getIdFromCallArg } from "./utils.js";
34
17
  import { namedPackagesPlugin } from "./plugins/NamedPackagesPlugin.js";
35
18
  function createTransactionResult(index, length = Infinity) {
36
- const baseResult = {
37
- $kind: "Result",
38
- get Result() {
39
- return typeof index === "function" ? index() : index;
40
- }
41
- };
42
- const nestedResults = [];
43
- const nestedResultFor = (resultIndex) => nestedResults[resultIndex] ?? (nestedResults[resultIndex] = {
44
- $kind: "NestedResult",
45
- get NestedResult() {
46
- return [
47
- typeof index === "function" ? index() : index,
48
- resultIndex
49
- ];
50
- }
51
- });
52
- return new Proxy(baseResult, {
53
- set() {
54
- throw new Error(
55
- "The transaction result is a proxy, and does not support setting properties directly"
56
- );
57
- },
58
- // TODO: Instead of making this return a concrete argument, we should ideally
59
- // make it reference-based (so that this gets resolved at build-time), which
60
- // allows re-ordering transactions.
61
- get(target, property) {
62
- if (property in target) {
63
- return Reflect.get(target, property);
64
- }
65
- if (property === Symbol.iterator) {
66
- return function* () {
67
- let i = 0;
68
- while (i < length) {
69
- yield nestedResultFor(i);
70
- i++;
71
- }
72
- };
73
- }
74
- if (typeof property === "symbol") return;
75
- const resultIndex = parseInt(property, 10);
76
- if (Number.isNaN(resultIndex) || resultIndex < 0) return;
77
- return nestedResultFor(resultIndex);
78
- }
79
- });
19
+ const baseResult = {
20
+ $kind: "Result",
21
+ get Result() {
22
+ return typeof index === "function" ? index() : index;
23
+ },
24
+ };
25
+ const nestedResults = [];
26
+ const nestedResultFor = (resultIndex) => (nestedResults[resultIndex] ??= {
27
+ $kind: "NestedResult",
28
+ get NestedResult() {
29
+ return [
30
+ typeof index === "function" ? index() : index,
31
+ resultIndex,
32
+ ];
33
+ },
34
+ });
35
+ return new Proxy(baseResult, {
36
+ set() {
37
+ throw new Error("The transaction result is a proxy, and does not support setting properties directly");
38
+ },
39
+ // TODO: Instead of making this return a concrete argument, we should ideally
40
+ // make it reference-based (so that this gets resolved at build-time), which
41
+ // allows re-ordering transactions.
42
+ get(target, property) {
43
+ // This allows this transaction argument to be used in the singular form:
44
+ if (property in target) {
45
+ return Reflect.get(target, property);
46
+ }
47
+ // Support destructuring:
48
+ if (property === Symbol.iterator) {
49
+ return function* () {
50
+ let i = 0;
51
+ while (i < length) {
52
+ yield nestedResultFor(i);
53
+ i++;
54
+ }
55
+ };
56
+ }
57
+ if (typeof property === "symbol")
58
+ return;
59
+ const resultIndex = parseInt(property, 10);
60
+ if (Number.isNaN(resultIndex) || resultIndex < 0)
61
+ return;
62
+ return nestedResultFor(resultIndex);
63
+ },
64
+ });
80
65
  }
81
- const TRANSACTION_BRAND = /* @__PURE__ */ Symbol.for("@mysten/transaction");
82
- function isTransaction(obj) {
83
- return !!obj && typeof obj === "object" && obj[TRANSACTION_BRAND] === true;
66
+ const TRANSACTION_BRAND = Symbol.for("@mysten/transaction");
67
+ export function isTransaction(obj) {
68
+ return (!!obj &&
69
+ typeof obj === "object" &&
70
+ obj[TRANSACTION_BRAND] === true);
84
71
  }
85
72
  const modulePluginRegistry = {
86
- buildPlugins: /* @__PURE__ */ new Map(),
87
- serializationPlugins: /* @__PURE__ */ new Map()
73
+ buildPlugins: new Map(),
74
+ serializationPlugins: new Map(),
88
75
  };
89
- const TRANSACTION_REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@mysten/transaction/registry");
76
+ const TRANSACTION_REGISTRY_KEY = Symbol.for("@mysten/transaction/registry");
90
77
  function getGlobalPluginRegistry() {
91
- try {
92
- const target = globalThis;
93
- if (!target[TRANSACTION_REGISTRY_KEY]) {
94
- target[TRANSACTION_REGISTRY_KEY] = modulePluginRegistry;
95
- }
96
- return target[TRANSACTION_REGISTRY_KEY];
97
- } catch {
98
- return modulePluginRegistry;
99
- }
78
+ try {
79
+ const target = globalThis;
80
+ if (!target[TRANSACTION_REGISTRY_KEY]) {
81
+ target[TRANSACTION_REGISTRY_KEY] = modulePluginRegistry;
82
+ }
83
+ return target[TRANSACTION_REGISTRY_KEY];
84
+ }
85
+ catch {
86
+ return modulePluginRegistry;
87
+ }
100
88
  }
101
- const _Transaction = class _Transaction {
102
- constructor() {
103
- __privateAdd(this, _Transaction_instances);
104
- __privateAdd(this, _serializationPlugins);
105
- __privateAdd(this, _buildPlugins);
106
- __privateAdd(this, _intentResolvers, /* @__PURE__ */ new Map());
107
- __privateAdd(this, _inputSection, []);
108
- __privateAdd(this, _commandSection, []);
109
- __privateAdd(this, _availableResults, /* @__PURE__ */ new Set());
110
- __privateAdd(this, _pendingPromises, /* @__PURE__ */ new Set());
111
- __privateAdd(this, _added, /* @__PURE__ */ new Map());
112
- __privateAdd(this, _data);
89
+ /**
90
+ * Transaction Builder
91
+ */
92
+ export class Transaction {
93
+ #serializationPlugins;
94
+ #buildPlugins;
95
+ #intentResolvers = new Map();
96
+ #inputSection = [];
97
+ #commandSection = [];
98
+ #availableResults = new Set();
99
+ #pendingPromises = new Set();
100
+ #added = new Map();
101
+ /**
102
+ * Converts from a serialize transaction kind (built with `build({ onlyTransactionKind: true })`) to a `Transaction` class.
103
+ * Supports either a byte array, or base64-encoded bytes.
104
+ */
105
+ static fromKind(serialized) {
106
+ const tx = new _a();
107
+ tx.#data = TransactionDataBuilder.fromKindBytes(typeof serialized === "string"
108
+ ? fromBase64(serialized)
109
+ : serialized);
110
+ tx.#inputSection = tx.#data.inputs.slice();
111
+ tx.#commandSection = tx.#data.commands.slice();
112
+ tx.#availableResults = new Set(tx.#commandSection.map((_, i) => i));
113
+ return tx;
114
+ }
115
+ /**
116
+ * Converts from a serialized transaction format to a `Transaction` class.
117
+ * There are two supported serialized formats:
118
+ * - A string returned from `Transaction#serialize`. The serialized format must be compatible, or it will throw an error.
119
+ * - A byte array (or base64-encoded bytes) containing BCS transaction data.
120
+ */
121
+ static from(transaction) {
122
+ const newTransaction = new _a();
123
+ if (isTransaction(transaction)) {
124
+ newTransaction.#data = TransactionDataBuilder.restore(transaction.getData());
125
+ }
126
+ else if (typeof transaction !== "string" ||
127
+ !transaction.startsWith("{")) {
128
+ newTransaction.#data = TransactionDataBuilder.fromBytes(typeof transaction === "string"
129
+ ? fromBase64(transaction)
130
+ : transaction);
131
+ }
132
+ else {
133
+ newTransaction.#data = TransactionDataBuilder.restore(JSON.parse(transaction));
134
+ }
135
+ newTransaction.#inputSection = newTransaction.#data.inputs.slice();
136
+ newTransaction.#commandSection = newTransaction.#data.commands.slice();
137
+ newTransaction.#availableResults = new Set(newTransaction.#commandSection.map((_, i) => i));
138
+ return newTransaction;
139
+ }
140
+ static registerGlobalSerializationPlugin(stepOrStep, step) {
141
+ getGlobalPluginRegistry().serializationPlugins.set(stepOrStep, step ?? stepOrStep);
142
+ }
143
+ static unregisterGlobalSerializationPlugin(name) {
144
+ getGlobalPluginRegistry().serializationPlugins.delete(name);
145
+ }
146
+ static registerGlobalBuildPlugin(stepOrStep, step) {
147
+ getGlobalPluginRegistry().buildPlugins.set(stepOrStep, step ?? stepOrStep);
148
+ }
149
+ static unregisterGlobalBuildPlugin(name) {
150
+ getGlobalPluginRegistry().buildPlugins.delete(name);
151
+ }
152
+ addSerializationPlugin(step) {
153
+ this.#serializationPlugins.push(step);
154
+ }
155
+ addBuildPlugin(step) {
156
+ this.#buildPlugins.push(step);
157
+ }
158
+ addIntentResolver(intent, resolver) {
159
+ if (this.#intentResolvers.has(intent) &&
160
+ this.#intentResolvers.get(intent) !== resolver) {
161
+ throw new Error(`Intent resolver for ${intent} already exists`);
162
+ }
163
+ this.#intentResolvers.set(intent, resolver);
164
+ }
165
+ setSender(sender) {
166
+ this.#data.sender = sender;
167
+ }
168
+ /**
169
+ * Sets the sender only if it has not already been set.
170
+ * This is useful for sponsored transaction flows where the sender may not be the same as the signer address.
171
+ */
172
+ setSenderIfNotSet(sender) {
173
+ if (!this.#data.sender) {
174
+ this.#data.sender = sender;
175
+ }
176
+ }
177
+ setExpiration(expiration) {
178
+ this.#data.expiration = expiration
179
+ ? parse(TransactionExpiration, expiration)
180
+ : null;
181
+ }
182
+ setGasPrice(price) {
183
+ this.#data.gasConfig.price = String(price);
184
+ }
185
+ setGasBudget(budget) {
186
+ this.#data.gasConfig.budget = String(budget);
187
+ }
188
+ setGasBudgetIfNotSet(budget) {
189
+ if (this.#data.gasData.budget == null) {
190
+ this.#data.gasConfig.budget = String(budget);
191
+ }
192
+ }
193
+ setGasOwner(owner) {
194
+ this.#data.gasConfig.owner = owner;
195
+ }
196
+ setGasPayment(payments) {
197
+ this.#data.gasConfig.payment = payments.map((payment) => parse(ObjectRefSchema, payment));
198
+ }
199
+ #data;
200
+ /** @deprecated Use `getData()` instead. */
201
+ get blockData() {
202
+ return serializeV1TransactionData(this.#data.snapshot());
203
+ }
204
+ /** Get a snapshot of the transaction data, in JSON form: */
205
+ getData() {
206
+ return this.#data.snapshot();
207
+ }
208
+ // Used to brand transaction classes so that they can be identified, even between multiple copies
209
+ // of the builder.
210
+ get [TRANSACTION_BRAND]() {
211
+ return true;
212
+ }
213
+ // Temporary workaround for the wallet interface accidentally serializing transactions via postMessage
214
+ get pure() {
215
+ Object.defineProperty(this, "pure", {
216
+ enumerable: false,
217
+ value: createPure((value) => {
218
+ if (isSerializedBcs(value)) {
219
+ return this.#addInput("pure", {
220
+ $kind: "Pure",
221
+ Pure: {
222
+ bytes: value.toBase64(),
223
+ },
224
+ });
225
+ }
226
+ // TODO: we can also do some deduplication here
227
+ return this.#addInput("pure", is(NormalizedCallArg, value)
228
+ ? parse(NormalizedCallArg, value)
229
+ : value instanceof Uint8Array
230
+ ? Inputs.Pure(value)
231
+ : {
232
+ $kind: "UnresolvedPure",
233
+ UnresolvedPure: { value },
234
+ });
235
+ }),
236
+ });
237
+ return this.pure;
238
+ }
239
+ constructor() {
240
+ const globalPlugins = getGlobalPluginRegistry();
241
+ this.#data = new TransactionDataBuilder();
242
+ this.#buildPlugins = [...globalPlugins.buildPlugins.values()];
243
+ this.#serializationPlugins = [
244
+ ...globalPlugins.serializationPlugins.values(),
245
+ ];
246
+ }
247
+ /** Returns an argument for the gas coin, to be used in a transaction. */
248
+ get gas() {
249
+ return { $kind: "GasCoin", GasCoin: true };
250
+ }
113
251
  /**
114
252
  * Add a new object input to the transaction.
115
253
  */
116
- __publicField(this, "object", createObjectMethods(
117
- (value) => {
254
+ object = createObjectMethods((value) => {
118
255
  if (typeof value === "function") {
119
- return this.object(
120
- this.add(
121
- value
122
- )
123
- );
256
+ return this.object(this.add(value));
124
257
  }
125
258
  if (typeof value === "object" && is(ArgumentSchema, value)) {
126
- return value;
259
+ return value;
127
260
  }
128
261
  const id = getIdFromCallArg(value);
129
- const inserted = __privateGet(this, _data).inputs.find(
130
- (i) => id === getIdFromCallArg(i)
131
- );
132
- if (inserted?.Object?.SharedObject && typeof value === "object" && value.Object?.SharedObject) {
133
- inserted.Object.SharedObject.mutable = inserted.Object.SharedObject.mutable || value.Object.SharedObject.mutable;
262
+ const inserted = this.#data.inputs.find((i) => id === getIdFromCallArg(i));
263
+ // Upgrade shared object inputs to mutable if needed:
264
+ if (inserted?.Object?.SharedObject &&
265
+ typeof value === "object" &&
266
+ value.Object?.SharedObject) {
267
+ inserted.Object.SharedObject.mutable =
268
+ inserted.Object.SharedObject.mutable ||
269
+ value.Object.SharedObject.mutable;
134
270
  }
135
- return inserted ? {
136
- $kind: "Input",
137
- Input: __privateGet(this, _data).inputs.indexOf(inserted),
138
- type: "object"
139
- } : __privateMethod(this, _Transaction_instances, addInput_fn).call(this, "object", typeof value === "string" ? {
140
- $kind: "UnresolvedObject",
141
- UnresolvedObject: {
142
- objectId: normalizeWowAddress(value)
143
- }
144
- } : value);
145
- }
146
- ));
147
- const globalPlugins = getGlobalPluginRegistry();
148
- __privateSet(this, _data, new TransactionDataBuilder());
149
- __privateSet(this, _buildPlugins, [...globalPlugins.buildPlugins.values()]);
150
- __privateSet(this, _serializationPlugins, [
151
- ...globalPlugins.serializationPlugins.values()
152
- ]);
153
- }
154
- /**
155
- * Converts from a serialize transaction kind (built with `build({ onlyTransactionKind: true })`) to a `Transaction` class.
156
- * Supports either a byte array, or base64-encoded bytes.
157
- */
158
- static fromKind(serialized) {
159
- const tx = new _Transaction();
160
- __privateSet(tx, _data, TransactionDataBuilder.fromKindBytes(
161
- typeof serialized === "string" ? fromBase64(serialized) : serialized
162
- ));
163
- __privateSet(tx, _inputSection, __privateGet(tx, _data).inputs.slice());
164
- __privateSet(tx, _commandSection, __privateGet(tx, _data).commands.slice());
165
- __privateSet(tx, _availableResults, new Set(__privateGet(tx, _commandSection).map((_, i) => i)));
166
- return tx;
167
- }
168
- /**
169
- * Converts from a serialized transaction format to a `Transaction` class.
170
- * There are two supported serialized formats:
171
- * - A string returned from `Transaction#serialize`. The serialized format must be compatible, or it will throw an error.
172
- * - A byte array (or base64-encoded bytes) containing BCS transaction data.
173
- */
174
- static from(transaction) {
175
- const newTransaction = new _Transaction();
176
- if (isTransaction(transaction)) {
177
- __privateSet(newTransaction, _data, TransactionDataBuilder.restore(
178
- transaction.getData()
179
- ));
180
- } else if (typeof transaction !== "string" || !transaction.startsWith("{")) {
181
- __privateSet(newTransaction, _data, TransactionDataBuilder.fromBytes(
182
- typeof transaction === "string" ? fromBase64(transaction) : transaction
183
- ));
184
- } else {
185
- __privateSet(newTransaction, _data, TransactionDataBuilder.restore(
186
- JSON.parse(transaction)
187
- ));
188
- }
189
- __privateSet(newTransaction, _inputSection, __privateGet(newTransaction, _data).inputs.slice());
190
- __privateSet(newTransaction, _commandSection, __privateGet(newTransaction, _data).commands.slice());
191
- __privateSet(newTransaction, _availableResults, new Set(
192
- __privateGet(newTransaction, _commandSection).map((_, i) => i)
193
- ));
194
- return newTransaction;
195
- }
196
- static registerGlobalSerializationPlugin(stepOrStep, step) {
197
- getGlobalPluginRegistry().serializationPlugins.set(
198
- stepOrStep,
199
- step ?? stepOrStep
200
- );
201
- }
202
- static unregisterGlobalSerializationPlugin(name) {
203
- getGlobalPluginRegistry().serializationPlugins.delete(name);
204
- }
205
- static registerGlobalBuildPlugin(stepOrStep, step) {
206
- getGlobalPluginRegistry().buildPlugins.set(
207
- stepOrStep,
208
- step ?? stepOrStep
209
- );
210
- }
211
- static unregisterGlobalBuildPlugin(name) {
212
- getGlobalPluginRegistry().buildPlugins.delete(name);
213
- }
214
- addSerializationPlugin(step) {
215
- __privateGet(this, _serializationPlugins).push(step);
216
- }
217
- addBuildPlugin(step) {
218
- __privateGet(this, _buildPlugins).push(step);
219
- }
220
- addIntentResolver(intent, resolver) {
221
- if (__privateGet(this, _intentResolvers).has(intent) && __privateGet(this, _intentResolvers).get(intent) !== resolver) {
222
- throw new Error(`Intent resolver for ${intent} already exists`);
223
- }
224
- __privateGet(this, _intentResolvers).set(intent, resolver);
225
- }
226
- setSender(sender) {
227
- __privateGet(this, _data).sender = sender;
228
- }
229
- /**
230
- * Sets the sender only if it has not already been set.
231
- * This is useful for sponsored transaction flows where the sender may not be the same as the signer address.
232
- */
233
- setSenderIfNotSet(sender) {
234
- if (!__privateGet(this, _data).sender) {
235
- __privateGet(this, _data).sender = sender;
236
- }
237
- }
238
- setExpiration(expiration) {
239
- __privateGet(this, _data).expiration = expiration ? parse(TransactionExpiration, expiration) : null;
240
- }
241
- setGasPrice(price) {
242
- __privateGet(this, _data).gasConfig.price = String(price);
243
- }
244
- setGasBudget(budget) {
245
- __privateGet(this, _data).gasConfig.budget = String(budget);
246
- }
247
- setGasBudgetIfNotSet(budget) {
248
- if (__privateGet(this, _data).gasData.budget == null) {
249
- __privateGet(this, _data).gasConfig.budget = String(budget);
250
- }
251
- }
252
- setGasOwner(owner) {
253
- __privateGet(this, _data).gasConfig.owner = owner;
254
- }
255
- setGasPayment(payments) {
256
- __privateGet(this, _data).gasConfig.payment = payments.map(
257
- (payment) => parse(ObjectRefSchema, payment)
258
- );
259
- }
260
- /** @deprecated Use `getData()` instead. */
261
- get blockData() {
262
- return serializeV1TransactionData(__privateGet(this, _data).snapshot());
263
- }
264
- /** Get a snapshot of the transaction data, in JSON form: */
265
- getData() {
266
- return __privateGet(this, _data).snapshot();
267
- }
268
- // Used to brand transaction classes so that they can be identified, even between multiple copies
269
- // of the builder.
270
- get [TRANSACTION_BRAND]() {
271
- return true;
272
- }
273
- // Temporary workaround for the wallet interface accidentally serializing transactions via postMessage
274
- get pure() {
275
- Object.defineProperty(this, "pure", {
276
- enumerable: false,
277
- value: createPure((value) => {
278
- if (isSerializedBcs(value)) {
279
- return __privateMethod(this, _Transaction_instances, addInput_fn).call(this, "pure", {
280
- $kind: "Pure",
281
- Pure: {
282
- bytes: value.toBase64()
271
+ return inserted
272
+ ? {
273
+ $kind: "Input",
274
+ Input: this.#data.inputs.indexOf(inserted),
275
+ type: "object",
276
+ }
277
+ : this.#addInput("object", typeof value === "string"
278
+ ? {
279
+ $kind: "UnresolvedObject",
280
+ UnresolvedObject: {
281
+ objectId: normalizeWowAddress(value),
282
+ },
283
+ }
284
+ : value);
285
+ });
286
+ /**
287
+ * Add a new object input to the transaction using the fully-resolved object reference.
288
+ * If you only have an object ID, use `builder.object(id)` instead.
289
+ */
290
+ objectRef(...args) {
291
+ return this.object(Inputs.ObjectRef(...args));
292
+ }
293
+ /**
294
+ * Add a new receiving input to the transaction using the fully-resolved object reference.
295
+ * If you only have an object ID, use `builder.object(id)` instead.
296
+ */
297
+ receivingRef(...args) {
298
+ return this.object(Inputs.ReceivingRef(...args));
299
+ }
300
+ /**
301
+ * Add a new shared object input to the transaction using the fully-resolved shared object reference.
302
+ * If you only have an object ID, use `builder.object(id)` instead.
303
+ */
304
+ sharedObjectRef(...args) {
305
+ return this.object(Inputs.SharedObjectRef(...args));
306
+ }
307
+ #fork() {
308
+ const fork = new _a();
309
+ fork.#data = this.#data;
310
+ fork.#serializationPlugins = this.#serializationPlugins;
311
+ fork.#buildPlugins = this.#buildPlugins;
312
+ fork.#intentResolvers = this.#intentResolvers;
313
+ fork.#pendingPromises = this.#pendingPromises;
314
+ fork.#availableResults = new Set(this.#availableResults);
315
+ fork.#added = this.#added;
316
+ this.#inputSection.push(fork.#inputSection);
317
+ this.#commandSection.push(fork.#commandSection);
318
+ return fork;
319
+ }
320
+ add(command) {
321
+ if (typeof command === "function") {
322
+ if (this.#added.has(command)) {
323
+ return this.#added.get(command);
283
324
  }
284
- });
325
+ const fork = this.#fork();
326
+ const result = command(fork);
327
+ if (!(result && typeof result === "object" && "then" in result)) {
328
+ this.#availableResults = fork.#availableResults;
329
+ this.#added.set(command, result);
330
+ return result;
331
+ }
332
+ const placeholder = this.#addCommand({
333
+ $kind: "$Intent",
334
+ $Intent: {
335
+ name: "AsyncTransactionThunk",
336
+ inputs: {},
337
+ data: {
338
+ resultIndex: this.#data.commands.length,
339
+ result: null,
340
+ },
341
+ },
342
+ });
343
+ this.#pendingPromises.add(Promise.resolve(result).then((result) => {
344
+ placeholder.$Intent.data.result = result;
345
+ }));
346
+ const txResult = createTransactionResult(() => placeholder.$Intent.data.resultIndex);
347
+ this.#added.set(command, txResult);
348
+ return txResult;
349
+ }
350
+ else {
351
+ this.#addCommand(command);
285
352
  }
286
- return __privateMethod(this, _Transaction_instances, addInput_fn).call(this, "pure", is(NormalizedCallArg, value) ? parse(NormalizedCallArg, value) : value instanceof Uint8Array ? Inputs.Pure(value) : {
287
- $kind: "UnresolvedPure",
288
- UnresolvedPure: { value }
353
+ return createTransactionResult(this.#data.commands.length - 1);
354
+ }
355
+ #addCommand(command) {
356
+ const resultIndex = this.#data.commands.length;
357
+ this.#commandSection.push(command);
358
+ this.#availableResults.add(resultIndex);
359
+ this.#data.commands.push(command);
360
+ this.#data.mapCommandArguments(resultIndex, (arg) => {
361
+ if (arg.$kind === "Result" &&
362
+ !this.#availableResults.has(arg.Result)) {
363
+ throw new Error(`Result { Result: ${arg.Result} } is not available to use in the current transaction`);
364
+ }
365
+ if (arg.$kind === "NestedResult" &&
366
+ !this.#availableResults.has(arg.NestedResult[0])) {
367
+ throw new Error(`Result { NestedResult: [${arg.NestedResult[0]}, ${arg.NestedResult[1]}] } is not available to use in the current transaction`);
368
+ }
369
+ if (arg.$kind === "Input" &&
370
+ arg.Input >= this.#data.inputs.length) {
371
+ throw new Error(`Input { Input: ${arg.Input} } references an input that does not exist in the current transaction`);
372
+ }
373
+ return arg;
289
374
  });
290
- })
291
- });
292
- return this.pure;
293
- }
294
- /** Returns an argument for the gas coin, to be used in a transaction. */
295
- get gas() {
296
- return { $kind: "GasCoin", GasCoin: true };
297
- }
298
- /**
299
- * Add a new object input to the transaction using the fully-resolved object reference.
300
- * If you only have an object ID, use `builder.object(id)` instead.
301
- */
302
- objectRef(...args) {
303
- return this.object(Inputs.ObjectRef(...args));
304
- }
305
- /**
306
- * Add a new receiving input to the transaction using the fully-resolved object reference.
307
- * If you only have an object ID, use `builder.object(id)` instead.
308
- */
309
- receivingRef(...args) {
310
- return this.object(Inputs.ReceivingRef(...args));
311
- }
312
- /**
313
- * Add a new shared object input to the transaction using the fully-resolved shared object reference.
314
- * If you only have an object ID, use `builder.object(id)` instead.
315
- */
316
- sharedObjectRef(...args) {
317
- return this.object(Inputs.SharedObjectRef(...args));
318
- }
319
- add(command) {
320
- if (typeof command === "function") {
321
- if (__privateGet(this, _added).has(command)) {
322
- return __privateGet(this, _added).get(command);
323
- }
324
- const fork = __privateMethod(this, _Transaction_instances, fork_fn).call(this);
325
- const result = command(fork);
326
- if (!(result && typeof result === "object" && "then" in result)) {
327
- __privateSet(this, _availableResults, __privateGet(fork, _availableResults));
328
- __privateGet(this, _added).set(command, result);
329
- return result;
330
- }
331
- const placeholder = __privateMethod(this, _Transaction_instances, addCommand_fn).call(this, {
332
- $kind: "$Intent",
333
- $Intent: {
334
- name: "AsyncTransactionThunk",
335
- inputs: {},
336
- data: {
337
- resultIndex: __privateGet(this, _data).commands.length,
338
- result: null
339
- }
375
+ return command;
376
+ }
377
+ #addInput(type, input) {
378
+ this.#inputSection.push(input);
379
+ return this.#data.addInput(type, input);
380
+ }
381
+ #normalizeTransactionArgument(arg) {
382
+ if (isSerializedBcs(arg)) {
383
+ return this.pure(arg);
340
384
  }
341
- });
342
- __privateGet(this, _pendingPromises).add(
343
- Promise.resolve(result).then(
344
- (result2) => {
345
- placeholder.$Intent.data.result = result2;
346
- }
347
- )
348
- );
349
- const txResult = createTransactionResult(
350
- () => placeholder.$Intent.data.resultIndex
351
- );
352
- __privateGet(this, _added).set(command, txResult);
353
- return txResult;
354
- } else {
355
- __privateMethod(this, _Transaction_instances, addCommand_fn).call(this, command);
356
- }
357
- return createTransactionResult(__privateGet(this, _data).commands.length - 1);
358
- }
359
- // Method shorthands:
360
- splitCoins(coin, amounts) {
361
- const command = Commands.SplitCoins(
362
- typeof coin === "string" ? this.object(coin) : __privateMethod(this, _Transaction_instances, resolveArgument_fn).call(this, coin),
363
- amounts.map(
364
- (amount) => typeof amount === "number" || typeof amount === "bigint" || typeof amount === "string" ? this.pure.u64(amount) : __privateMethod(this, _Transaction_instances, normalizeTransactionArgument_fn).call(this, amount)
365
- )
366
- );
367
- __privateMethod(this, _Transaction_instances, addCommand_fn).call(this, command);
368
- return createTransactionResult(
369
- __privateGet(this, _data).commands.length - 1,
370
- amounts.length
371
- );
372
- }
373
- mergeCoins(destination, sources) {
374
- return this.add(
375
- Commands.MergeCoins(
376
- this.object(destination),
377
- sources.map((src) => this.object(src))
378
- )
379
- );
380
- }
381
- publish({
382
- modules,
383
- dependencies
384
- }) {
385
- return this.add(
386
- Commands.Publish({
387
- modules,
388
- dependencies
389
- })
390
- );
391
- }
392
- upgrade({
393
- modules,
394
- dependencies,
395
- package: packageId,
396
- ticket
397
- }) {
398
- return this.add(
399
- Commands.Upgrade({
400
- modules,
401
- dependencies,
402
- package: packageId,
403
- ticket: this.object(ticket)
404
- })
405
- );
406
- }
407
- moveCall({
408
- arguments: args,
409
- ...input
410
- }) {
411
- return this.add(
412
- Commands.MoveCall({
413
- ...input,
414
- arguments: args?.map(
415
- (arg) => __privateMethod(this, _Transaction_instances, normalizeTransactionArgument_fn).call(this, arg)
416
- )
417
- })
418
- );
419
- }
420
- transferObjects(objects, address) {
421
- return this.add(
422
- Commands.TransferObjects(
423
- objects.map((obj) => this.object(obj)),
424
- typeof address === "string" ? this.pure.address(address) : __privateMethod(this, _Transaction_instances, normalizeTransactionArgument_fn).call(this, address)
425
- )
426
- );
427
- }
428
- makeMoveVec({
429
- type,
430
- elements
431
- }) {
432
- return this.add(
433
- Commands.MakeMoveVec({
434
- type,
435
- elements: elements.map((obj) => this.object(obj))
436
- })
437
- );
438
- }
439
- /**
440
- * @deprecated Use toJSON instead.
441
- * For synchronous serialization, you can use `getData()`
442
- * */
443
- serialize() {
444
- return JSON.stringify(
445
- serializeV1TransactionData(__privateGet(this, _data).snapshot())
446
- );
447
- }
448
- async toJSON(options = {}) {
449
- await this.prepareForSerialization(options);
450
- const fullyResolved = this.isFullyResolved();
451
- return JSON.stringify(
452
- parse(
453
- SerializedTransactionDataV2Schema,
454
- fullyResolved ? {
455
- ...__privateGet(this, _data).snapshot(),
456
- digest: __privateGet(this, _data).getDigest()
457
- } : __privateGet(this, _data).snapshot()
458
- ),
459
- (_key, value) => typeof value === "bigint" ? value.toString() : value,
460
- 2
461
- );
462
- }
463
- /** Build the transaction to BCS bytes, and sign it with the provided keypair. */
464
- async sign(options) {
465
- const { signer, ...buildOptions } = options;
466
- const bytes = await this.build(buildOptions);
467
- return signer.signTransaction(bytes);
468
- }
469
- /**
470
- * Ensures that:
471
- * - All objects have been fully resolved to a specific version
472
- * - All pure inputs have been serialized to bytes
473
- * - All async thunks have been fully resolved
474
- * - All transaction intents have been resolved
475
- * - The gas payment, budget, and price have been set
476
- * - The transaction sender has been set
477
- *
478
- * When true, the transaction will always be built to the same bytes and digest (unless the transaction is mutated)
479
- */
480
- isFullyResolved() {
481
- if (!__privateGet(this, _data).sender) {
482
- return false;
483
- }
484
- if (__privateGet(this, _pendingPromises).size > 0) {
485
- return false;
486
- }
487
- if (__privateGet(this, _data).commands.some((cmd) => cmd.$Intent)) {
488
- return false;
489
- }
490
- if (needsTransactionResolution(__privateGet(this, _data), {})) {
491
- return false;
492
- }
493
- return true;
494
- }
495
- /** Build the transaction to BCS bytes. */
496
- async build(options = {}) {
497
- await this.prepareForSerialization(options);
498
- await __privateMethod(this, _Transaction_instances, prepareBuild_fn).call(this, options);
499
- return __privateGet(this, _data).build({
500
- onlyTransactionKind: options.onlyTransactionKind
501
- });
502
- }
503
- /** Derive transaction digest */
504
- async getDigest(options = {}) {
505
- await this.prepareForSerialization(options);
506
- await __privateMethod(this, _Transaction_instances, prepareBuild_fn).call(this, options);
507
- return __privateGet(this, _data).getDigest();
508
- }
509
- async prepareForSerialization(options) {
510
- await __privateMethod(this, _Transaction_instances, waitForPendingTasks_fn).call(this);
511
- __privateMethod(this, _Transaction_instances, sortCommandsAndInputs_fn).call(this);
512
- const intents = /* @__PURE__ */ new Set();
513
- for (const command of __privateGet(this, _data).commands) {
514
- if (command.$Intent) {
515
- intents.add(command.$Intent.name);
516
- }
517
- }
518
- const steps = [...__privateGet(this, _serializationPlugins)];
519
- for (const intent of intents) {
520
- if (options.supportedIntents?.includes(intent)) {
521
- continue;
522
- }
523
- if (!__privateGet(this, _intentResolvers).has(intent)) {
524
- throw new Error(`Missing intent resolver for ${intent}`);
525
- }
526
- steps.push(__privateGet(this, _intentResolvers).get(intent));
527
- }
528
- steps.push(namedPackagesPlugin());
529
- await __privateMethod(this, _Transaction_instances, runPlugins_fn).call(this, steps, options);
530
- }
531
- };
532
- _serializationPlugins = new WeakMap();
533
- _buildPlugins = new WeakMap();
534
- _intentResolvers = new WeakMap();
535
- _inputSection = new WeakMap();
536
- _commandSection = new WeakMap();
537
- _availableResults = new WeakMap();
538
- _pendingPromises = new WeakMap();
539
- _added = new WeakMap();
540
- _data = new WeakMap();
541
- _Transaction_instances = new WeakSet();
542
- fork_fn = function() {
543
- const fork = new _Transaction();
544
- __privateSet(fork, _data, __privateGet(this, _data));
545
- __privateSet(fork, _serializationPlugins, __privateGet(this, _serializationPlugins));
546
- __privateSet(fork, _buildPlugins, __privateGet(this, _buildPlugins));
547
- __privateSet(fork, _intentResolvers, __privateGet(this, _intentResolvers));
548
- __privateSet(fork, _pendingPromises, __privateGet(this, _pendingPromises));
549
- __privateSet(fork, _availableResults, new Set(__privateGet(this, _availableResults)));
550
- __privateSet(fork, _added, __privateGet(this, _added));
551
- __privateGet(this, _inputSection).push(__privateGet(fork, _inputSection));
552
- __privateGet(this, _commandSection).push(__privateGet(fork, _commandSection));
553
- return fork;
554
- };
555
- addCommand_fn = function(command) {
556
- const resultIndex = __privateGet(this, _data).commands.length;
557
- __privateGet(this, _commandSection).push(command);
558
- __privateGet(this, _availableResults).add(resultIndex);
559
- __privateGet(this, _data).commands.push(command);
560
- __privateGet(this, _data).mapCommandArguments(resultIndex, (arg) => {
561
- if (arg.$kind === "Result" && !__privateGet(this, _availableResults).has(arg.Result)) {
562
- throw new Error(
563
- `Result { Result: ${arg.Result} } is not available to use in the current transaction`
564
- );
565
- }
566
- if (arg.$kind === "NestedResult" && !__privateGet(this, _availableResults).has(arg.NestedResult[0])) {
567
- throw new Error(
568
- `Result { NestedResult: [${arg.NestedResult[0]}, ${arg.NestedResult[1]}] } is not available to use in the current transaction`
569
- );
570
- }
571
- if (arg.$kind === "Input" && arg.Input >= __privateGet(this, _data).inputs.length) {
572
- throw new Error(
573
- `Input { Input: ${arg.Input} } references an input that does not exist in the current transaction`
574
- );
575
- }
576
- return arg;
577
- });
578
- return command;
579
- };
580
- addInput_fn = function(type, input) {
581
- __privateGet(this, _inputSection).push(input);
582
- return __privateGet(this, _data).addInput(type, input);
583
- };
584
- normalizeTransactionArgument_fn = function(arg) {
585
- if (isSerializedBcs(arg)) {
586
- return this.pure(arg);
587
- }
588
- return __privateMethod(this, _Transaction_instances, resolveArgument_fn).call(this, arg);
589
- };
590
- resolveArgument_fn = function(arg) {
591
- if (typeof arg === "function") {
592
- const resolved = this.add(arg);
593
- if (typeof resolved === "function") {
594
- return __privateMethod(this, _Transaction_instances, resolveArgument_fn).call(this, resolved);
595
- }
596
- return parse(ArgumentSchema, resolved);
597
- }
598
- return parse(ArgumentSchema, arg);
599
- };
600
- prepareBuild_fn = async function(options) {
601
- if (!options.onlyTransactionKind && !__privateGet(this, _data).sender) {
602
- throw new Error("Missing transaction sender");
603
- }
604
- await __privateMethod(this, _Transaction_instances, runPlugins_fn).call(this, [...__privateGet(this, _buildPlugins), resolveTransactionPlugin], options);
605
- };
606
- runPlugins_fn = async function(plugins, options) {
607
- try {
608
- const createNext = (i) => {
609
- if (i >= plugins.length) {
610
- return () => {
611
- };
612
- }
613
- const plugin = plugins[i];
614
- return async () => {
615
- const next = createNext(i + 1);
616
- let calledNext = false;
617
- let nextResolved = false;
618
- await plugin(__privateGet(this, _data), options, async () => {
619
- if (calledNext) {
620
- throw new Error(
621
- `next() was call multiple times in TransactionPlugin ${i}`
622
- );
623
- }
624
- calledNext = true;
625
- await next();
626
- nextResolved = true;
385
+ return this.#resolveArgument(arg);
386
+ }
387
+ #resolveArgument(arg) {
388
+ if (typeof arg === "function") {
389
+ const resolved = this.add(arg);
390
+ if (typeof resolved === "function") {
391
+ return this.#resolveArgument(resolved);
392
+ }
393
+ return parse(ArgumentSchema, resolved);
394
+ }
395
+ return parse(ArgumentSchema, arg);
396
+ }
397
+ // Method shorthands:
398
+ splitCoins(coin, amounts) {
399
+ const command = Commands.SplitCoins(typeof coin === "string"
400
+ ? this.object(coin)
401
+ : this.#resolveArgument(coin), amounts.map((amount) => typeof amount === "number" ||
402
+ typeof amount === "bigint" ||
403
+ typeof amount === "string"
404
+ ? this.pure.u64(amount)
405
+ : this.#normalizeTransactionArgument(amount)));
406
+ this.#addCommand(command);
407
+ return createTransactionResult(this.#data.commands.length - 1, amounts.length);
408
+ }
409
+ mergeCoins(destination, sources) {
410
+ return this.add(Commands.MergeCoins(this.object(destination), sources.map((src) => this.object(src))));
411
+ }
412
+ publish({ modules, dependencies, }) {
413
+ return this.add(Commands.Publish({
414
+ modules,
415
+ dependencies,
416
+ }));
417
+ }
418
+ upgrade({ modules, dependencies, package: packageId, ticket, }) {
419
+ return this.add(Commands.Upgrade({
420
+ modules,
421
+ dependencies,
422
+ package: packageId,
423
+ ticket: this.object(ticket),
424
+ }));
425
+ }
426
+ moveCall({ arguments: args, ...input }) {
427
+ return this.add(Commands.MoveCall({
428
+ ...input,
429
+ arguments: args?.map((arg) => this.#normalizeTransactionArgument(arg)),
430
+ }));
431
+ }
432
+ transferObjects(objects, address) {
433
+ return this.add(Commands.TransferObjects(objects.map((obj) => this.object(obj)), typeof address === "string"
434
+ ? this.pure.address(address)
435
+ : this.#normalizeTransactionArgument(address)));
436
+ }
437
+ makeMoveVec({ type, elements, }) {
438
+ return this.add(Commands.MakeMoveVec({
439
+ type,
440
+ elements: elements.map((obj) => this.object(obj)),
441
+ }));
442
+ }
443
+ /**
444
+ * @deprecated Use toJSON instead.
445
+ * For synchronous serialization, you can use `getData()`
446
+ * */
447
+ serialize() {
448
+ return JSON.stringify(serializeV1TransactionData(this.#data.snapshot()));
449
+ }
450
+ async toJSON(options = {}) {
451
+ await this.prepareForSerialization(options);
452
+ const fullyResolved = this.isFullyResolved();
453
+ return JSON.stringify(parse(SerializedTransactionDataV2Schema, fullyResolved
454
+ ? {
455
+ ...this.#data.snapshot(),
456
+ digest: this.#data.getDigest(),
457
+ }
458
+ : this.#data.snapshot()), (_key, value) => typeof value === "bigint" ? value.toString() : value, 2);
459
+ }
460
+ /** Build the transaction to BCS bytes, and sign it with the provided keypair. */
461
+ async sign(options) {
462
+ const { signer, ...buildOptions } = options;
463
+ const bytes = await this.build(buildOptions);
464
+ return signer.signTransaction(bytes);
465
+ }
466
+ /**
467
+ * Ensures that:
468
+ * - All objects have been fully resolved to a specific version
469
+ * - All pure inputs have been serialized to bytes
470
+ * - All async thunks have been fully resolved
471
+ * - All transaction intents have been resolved
472
+ * - The gas payment, budget, and price have been set
473
+ * - The transaction sender has been set
474
+ *
475
+ * When true, the transaction will always be built to the same bytes and digest (unless the transaction is mutated)
476
+ */
477
+ isFullyResolved() {
478
+ if (!this.#data.sender) {
479
+ return false;
480
+ }
481
+ if (this.#pendingPromises.size > 0) {
482
+ return false;
483
+ }
484
+ if (this.#data.commands.some((cmd) => cmd.$Intent)) {
485
+ return false;
486
+ }
487
+ if (needsTransactionResolution(this.#data, {})) {
488
+ return false;
489
+ }
490
+ return true;
491
+ }
492
+ /** Build the transaction to BCS bytes. */
493
+ async build(options = {}) {
494
+ await this.prepareForSerialization(options);
495
+ await this.#prepareBuild(options);
496
+ return this.#data.build({
497
+ onlyTransactionKind: options.onlyTransactionKind,
627
498
  });
628
- if (!calledNext) {
629
- throw new Error(
630
- `next() was not called in TransactionPlugin ${i}`
631
- );
499
+ }
500
+ /** Derive transaction digest */
501
+ async getDigest(options = {}) {
502
+ await this.prepareForSerialization(options);
503
+ await this.#prepareBuild(options);
504
+ return this.#data.getDigest();
505
+ }
506
+ /**
507
+ * Prepare the transaction by validating the transaction data and resolving all inputs
508
+ * so that it can be built into bytes.
509
+ */
510
+ async #prepareBuild(options) {
511
+ if (!options.onlyTransactionKind && !this.#data.sender) {
512
+ throw new Error("Missing transaction sender");
632
513
  }
633
- if (!nextResolved) {
634
- throw new Error(
635
- `next() was not awaited in TransactionPlugin ${i}`
636
- );
514
+ await this.#runPlugins([...this.#buildPlugins, resolveTransactionPlugin], options);
515
+ }
516
+ async #runPlugins(plugins, options) {
517
+ try {
518
+ const createNext = (i) => {
519
+ if (i >= plugins.length) {
520
+ return () => { };
521
+ }
522
+ const plugin = plugins[i];
523
+ return async () => {
524
+ const next = createNext(i + 1);
525
+ let calledNext = false;
526
+ let nextResolved = false;
527
+ await plugin(this.#data, options, async () => {
528
+ if (calledNext) {
529
+ throw new Error(`next() was call multiple times in TransactionPlugin ${i}`);
530
+ }
531
+ calledNext = true;
532
+ await next();
533
+ nextResolved = true;
534
+ });
535
+ if (!calledNext) {
536
+ throw new Error(`next() was not called in TransactionPlugin ${i}`);
537
+ }
538
+ if (!nextResolved) {
539
+ throw new Error(`next() was not awaited in TransactionPlugin ${i}`);
540
+ }
541
+ };
542
+ };
543
+ await createNext(0)();
637
544
  }
638
- };
639
- };
640
- await createNext(0)();
641
- } finally {
642
- __privateSet(this, _inputSection, __privateGet(this, _data).inputs.slice());
643
- __privateSet(this, _commandSection, __privateGet(this, _data).commands.slice());
644
- __privateSet(this, _availableResults, new Set(
645
- __privateGet(this, _commandSection).map((_, i) => i)
646
- ));
647
- }
648
- };
649
- waitForPendingTasks_fn = async function() {
650
- while (__privateGet(this, _pendingPromises).size > 0) {
651
- const newPromise = Promise.all(__privateGet(this, _pendingPromises));
652
- __privateGet(this, _pendingPromises).clear();
653
- __privateGet(this, _pendingPromises).add(newPromise);
654
- await newPromise;
655
- __privateGet(this, _pendingPromises).delete(newPromise);
656
- }
657
- };
658
- sortCommandsAndInputs_fn = function() {
659
- const unorderedCommands = __privateGet(this, _data).commands;
660
- const unorderedInputs = __privateGet(this, _data).inputs;
661
- const orderedCommands = __privateGet(this, _commandSection).flat(
662
- Infinity
663
- );
664
- const orderedInputs = __privateGet(this, _inputSection).flat(Infinity);
665
- if (orderedCommands.length !== unorderedCommands.length) {
666
- throw new Error(
667
- "Unexpected number of commands found in transaction data"
668
- );
669
- }
670
- if (orderedInputs.length !== unorderedInputs.length) {
671
- throw new Error(
672
- "Unexpected number of inputs found in transaction data"
673
- );
674
- }
675
- const filteredCommands = orderedCommands.filter(
676
- (cmd) => cmd.$Intent?.name !== "AsyncTransactionThunk"
677
- );
678
- __privateGet(this, _data).commands = filteredCommands;
679
- __privateGet(this, _data).inputs = orderedInputs;
680
- __privateSet(this, _commandSection, filteredCommands);
681
- __privateSet(this, _inputSection, orderedInputs);
682
- __privateSet(this, _availableResults, new Set(filteredCommands.map((_, i) => i)));
683
- function getOriginalIndex(index) {
684
- const command = unorderedCommands[index];
685
- if (command.$Intent?.name === "AsyncTransactionThunk") {
686
- const result = command.$Intent.data.result;
687
- if (result == null) {
688
- throw new Error(
689
- "AsyncTransactionThunk has not been resolved"
690
- );
691
- }
692
- return getOriginalIndex(result.Result);
693
- }
694
- const updated = filteredCommands.indexOf(command);
695
- if (updated === -1) {
696
- throw new Error("Unable to find original index for command");
697
- }
698
- return updated;
699
- }
700
- __privateGet(this, _data).mapArguments((arg) => {
701
- if (arg.$kind === "Input") {
702
- const updated = orderedInputs.indexOf(
703
- unorderedInputs[arg.Input]
704
- );
705
- if (updated === -1) {
706
- throw new Error("Input has not been resolved");
707
- }
708
- return { ...arg, Input: updated };
709
- } else if (arg.$kind === "Result") {
710
- const updated = getOriginalIndex(arg.Result);
711
- return { ...arg, Result: updated };
712
- } else if (arg.$kind === "NestedResult") {
713
- const updated = getOriginalIndex(arg.NestedResult[0]);
714
- return { ...arg, NestedResult: [updated, arg.NestedResult[1]] };
715
- }
716
- return arg;
717
- });
718
- for (const [i, cmd] of unorderedCommands.entries()) {
719
- if (cmd.$Intent?.name === "AsyncTransactionThunk") {
720
- try {
721
- cmd.$Intent.data.resultIndex = getOriginalIndex(i);
722
- } catch {
723
- }
724
- }
725
- }
726
- };
727
- let Transaction = _Transaction;
728
- export {
729
- Transaction,
730
- isTransaction
731
- };
545
+ finally {
546
+ this.#inputSection = this.#data.inputs.slice();
547
+ this.#commandSection = this.#data.commands.slice();
548
+ this.#availableResults = new Set(this.#commandSection.map((_, i) => i));
549
+ }
550
+ }
551
+ async #waitForPendingTasks() {
552
+ while (this.#pendingPromises.size > 0) {
553
+ const newPromise = Promise.all(this.#pendingPromises);
554
+ this.#pendingPromises.clear();
555
+ this.#pendingPromises.add(newPromise);
556
+ await newPromise;
557
+ this.#pendingPromises.delete(newPromise);
558
+ }
559
+ }
560
+ #sortCommandsAndInputs() {
561
+ const unorderedCommands = this.#data.commands;
562
+ const unorderedInputs = this.#data.inputs;
563
+ const orderedCommands = this.#commandSection.flat(Infinity);
564
+ const orderedInputs = this.#inputSection.flat(Infinity);
565
+ if (orderedCommands.length !== unorderedCommands.length) {
566
+ throw new Error("Unexpected number of commands found in transaction data");
567
+ }
568
+ if (orderedInputs.length !== unorderedInputs.length) {
569
+ throw new Error("Unexpected number of inputs found in transaction data");
570
+ }
571
+ const filteredCommands = orderedCommands.filter((cmd) => cmd.$Intent?.name !== "AsyncTransactionThunk");
572
+ this.#data.commands = filteredCommands;
573
+ this.#data.inputs = orderedInputs;
574
+ this.#commandSection = filteredCommands;
575
+ this.#inputSection = orderedInputs;
576
+ this.#availableResults = new Set(filteredCommands.map((_, i) => i));
577
+ function getOriginalIndex(index) {
578
+ const command = unorderedCommands[index];
579
+ if (command.$Intent?.name === "AsyncTransactionThunk") {
580
+ const result = command.$Intent.data
581
+ .result;
582
+ if (result == null) {
583
+ throw new Error("AsyncTransactionThunk has not been resolved");
584
+ }
585
+ return getOriginalIndex(result.Result);
586
+ }
587
+ const updated = filteredCommands.indexOf(command);
588
+ if (updated === -1) {
589
+ throw new Error("Unable to find original index for command");
590
+ }
591
+ return updated;
592
+ }
593
+ this.#data.mapArguments((arg) => {
594
+ if (arg.$kind === "Input") {
595
+ const updated = orderedInputs.indexOf(unorderedInputs[arg.Input]);
596
+ if (updated === -1) {
597
+ throw new Error("Input has not been resolved");
598
+ }
599
+ return { ...arg, Input: updated };
600
+ }
601
+ else if (arg.$kind === "Result") {
602
+ const updated = getOriginalIndex(arg.Result);
603
+ return { ...arg, Result: updated };
604
+ }
605
+ else if (arg.$kind === "NestedResult") {
606
+ const updated = getOriginalIndex(arg.NestedResult[0]);
607
+ return { ...arg, NestedResult: [updated, arg.NestedResult[1]] };
608
+ }
609
+ return arg;
610
+ });
611
+ for (const [i, cmd] of unorderedCommands.entries()) {
612
+ if (cmd.$Intent?.name === "AsyncTransactionThunk") {
613
+ try {
614
+ cmd.$Intent.data.resultIndex = getOriginalIndex(i);
615
+ }
616
+ catch {
617
+ // If async thunk did not return a result, this will error, but is safe to ignore
618
+ }
619
+ }
620
+ }
621
+ }
622
+ async prepareForSerialization(options) {
623
+ await this.#waitForPendingTasks();
624
+ this.#sortCommandsAndInputs();
625
+ const intents = new Set();
626
+ for (const command of this.#data.commands) {
627
+ if (command.$Intent) {
628
+ intents.add(command.$Intent.name);
629
+ }
630
+ }
631
+ const steps = [...this.#serializationPlugins];
632
+ for (const intent of intents) {
633
+ if (options.supportedIntents?.includes(intent)) {
634
+ continue;
635
+ }
636
+ if (!this.#intentResolvers.has(intent)) {
637
+ throw new Error(`Missing intent resolver for ${intent}`);
638
+ }
639
+ steps.push(this.#intentResolvers.get(intent));
640
+ }
641
+ steps.push(namedPackagesPlugin());
642
+ await this.#runPlugins(steps, options);
643
+ }
644
+ }
645
+ _a = Transaction;
646
+ //# sourceMappingURL=Transaction.js.map