wowok 2.1.40 → 2.1.41

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 (399) hide show
  1. package/dist/cjs/bcs/bcs.js +1 -253
  2. package/dist/cjs/bcs/effects.js +1 -199
  3. package/dist/cjs/bcs/index.js +1 -51
  4. package/dist/cjs/bcs/pure.js +1 -36
  5. package/dist/cjs/bcs/type-tag-serializer.js +1 -104
  6. package/dist/cjs/bcs/types.js +1 -3
  7. package/dist/cjs/client/index.js +1 -4
  8. package/dist/cjs/client/network.js +1 -15
  9. package/dist/cjs/cryptography/index.js +1 -6
  10. package/dist/cjs/cryptography/intent.js +1 -14
  11. package/dist/cjs/cryptography/keypair.js +1 -74
  12. package/dist/cjs/cryptography/mnemonics.js +1 -20
  13. package/dist/cjs/cryptography/publickey.js +1 -80
  14. package/dist/cjs/cryptography/signature-scheme.js +1 -22
  15. package/dist/cjs/cryptography/signature.js +1 -41
  16. package/dist/cjs/experimental/cache.js +1 -58
  17. package/dist/cjs/experimental/client.js +1 -19
  18. package/dist/cjs/experimental/core.js +1 -80
  19. package/dist/cjs/experimental/errors.js +1 -24
  20. package/dist/cjs/experimental/index.js +1 -5
  21. package/dist/cjs/experimental/persistent-storage.js +1 -220
  22. package/dist/cjs/experimental/persistent-storage.test.js +1 -144
  23. package/dist/cjs/experimental/transports/utils.js +1 -96
  24. package/dist/cjs/experimental/types.js +1 -1
  25. package/dist/cjs/faucet/faucet.js +1 -99
  26. package/dist/cjs/faucet/index.js +1 -1
  27. package/dist/cjs/grpc/client.js +1 -42
  28. package/dist/cjs/grpc/core.js +1 -587
  29. package/dist/cjs/grpc/index.js +1 -2
  30. package/dist/cjs/grpc/proto/google/protobuf/any.js +1 -106
  31. package/dist/cjs/grpc/proto/google/protobuf/duration.js +1 -58
  32. package/dist/cjs/grpc/proto/google/protobuf/empty.js +1 -7
  33. package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +1 -47
  34. package/dist/cjs/grpc/proto/google/protobuf/struct.js +1 -191
  35. package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +1 -91
  36. package/dist/cjs/grpc/proto/google/rpc/error_details.js +1 -265
  37. package/dist/cjs/grpc/proto/google/rpc/status.js +1 -23
  38. package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +1 -46
  39. package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +1 -29
  40. package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +1 -22
  41. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +1 -54
  42. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +1 -60
  43. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +1 -144
  44. package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +1 -271
  45. package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +1 -64
  46. package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +1 -6
  47. package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +1 -62
  48. package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +1 -64
  49. package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +1 -481
  50. package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +1 -40
  51. package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +1 -61
  52. package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +1 -57
  53. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +1 -39
  54. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +1 -329
  55. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +1 -447
  56. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +1 -27
  57. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +1 -206
  58. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +1 -19
  59. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +1 -109
  60. package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +1 -90
  61. package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +1 -30
  62. package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +1 -39
  63. package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +1 -30
  64. package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +1 -501
  65. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +1 -10
  66. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +1 -15
  67. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +1 -62
  68. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +1 -31
  69. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +1 -504
  70. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +1 -15
  71. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +1 -37
  72. package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +1 -709
  73. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1 -950
  74. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +1 -19
  75. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +1 -144
  76. package/dist/cjs/index.js +1 -22
  77. package/dist/cjs/jsonRpc/client.js +1 -516
  78. package/dist/cjs/jsonRpc/core.js +1 -587
  79. package/dist/cjs/jsonRpc/errors.js +1 -38
  80. package/dist/cjs/jsonRpc/http-transport.js +1 -70
  81. package/dist/cjs/jsonRpc/index.js +1 -3
  82. package/dist/cjs/jsonRpc/json-rpc-resolver.js +1 -296
  83. package/dist/cjs/jsonRpc/rpc-websocket-client.js +1 -155
  84. package/dist/cjs/jsonRpc/types/chain.js +1 -1
  85. package/dist/cjs/jsonRpc/types/changes.js +1 -1
  86. package/dist/cjs/jsonRpc/types/coins.js +1 -1
  87. package/dist/cjs/jsonRpc/types/common.js +1 -1
  88. package/dist/cjs/jsonRpc/types/generated.js +1 -1
  89. package/dist/cjs/jsonRpc/types/index.js +1 -1
  90. package/dist/cjs/jsonRpc/types/params.js +1 -1
  91. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +1 -58
  92. package/dist/cjs/keypairs/ed25519/index.js +1 -2
  93. package/dist/cjs/keypairs/ed25519/keypair.js +1 -90
  94. package/dist/cjs/keypairs/ed25519/publickey.js +1 -50
  95. package/dist/cjs/keypairs/index.js +1 -4
  96. package/dist/cjs/keypairs/passkey/index.js +1 -2
  97. package/dist/cjs/keypairs/passkey/keypair.js +1 -155
  98. package/dist/cjs/keypairs/passkey/publickey.js +1 -117
  99. package/dist/cjs/keypairs/passkey/types.js +1 -1
  100. package/dist/cjs/keypairs/secp256k1/index.js +1 -2
  101. package/dist/cjs/keypairs/secp256k1/keypair.js +1 -82
  102. package/dist/cjs/keypairs/secp256k1/publickey.js +1 -51
  103. package/dist/cjs/keypairs/secp256r1/index.js +1 -2
  104. package/dist/cjs/keypairs/secp256r1/keypair.js +1 -78
  105. package/dist/cjs/keypairs/secp256r1/publickey.js +1 -52
  106. package/dist/cjs/multisig/index.js +1 -2
  107. package/dist/cjs/multisig/publickey.js +1 -201
  108. package/dist/cjs/multisig/signer.js +1 -58
  109. package/dist/cjs/transactions/Arguments.js +1 -9
  110. package/dist/cjs/transactions/Commands.js +1 -102
  111. package/dist/cjs/transactions/Inputs.js +1 -52
  112. package/dist/cjs/transactions/ObjectCache.js +1 -205
  113. package/dist/cjs/transactions/Transaction.js +1 -574
  114. package/dist/cjs/transactions/TransactionData.js +1 -409
  115. package/dist/cjs/transactions/__tests__/Transaction.test.js +1 -160
  116. package/dist/cjs/transactions/__tests__/bcs.test.js +1 -182
  117. package/dist/cjs/transactions/data/internal.js +1 -169
  118. package/dist/cjs/transactions/data/v1.js +1 -469
  119. package/dist/cjs/transactions/data/v2.js +1 -97
  120. package/dist/cjs/transactions/executor/caching.js +1 -65
  121. package/dist/cjs/transactions/executor/parallel.js +1 -347
  122. package/dist/cjs/transactions/executor/queue.js +1 -59
  123. package/dist/cjs/transactions/executor/serial.js +1 -99
  124. package/dist/cjs/transactions/hash.js +1 -8
  125. package/dist/cjs/transactions/index.js +1 -12
  126. package/dist/cjs/transactions/intents/CoinWithBalance.js +1 -145
  127. package/dist/cjs/transactions/object.js +1 -87
  128. package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +1 -11
  129. package/dist/cjs/transactions/pure.js +1 -36
  130. package/dist/cjs/transactions/resolve.js +1 -69
  131. package/dist/cjs/transactions/serializer.js +1 -167
  132. package/dist/cjs/transactions/utils.js +1 -121
  133. package/dist/cjs/utils/constants.js +1 -18
  134. package/dist/cjs/utils/derived-objects.js +1 -8
  135. package/dist/cjs/utils/dynamic-fields.js +1 -17
  136. package/dist/cjs/utils/format.js +1 -11
  137. package/dist/cjs/utils/index.js +1 -8
  138. package/dist/cjs/utils/move-registry.js +1 -24
  139. package/dist/cjs/utils/sui-types.js +1 -66
  140. package/dist/cjs/utils/suins.js +1 -33
  141. package/dist/cjs/verify/index.js +1 -1
  142. package/dist/cjs/verify/verify.js +1 -87
  143. package/dist/cjs/version.js +1 -2
  144. package/dist/cjs/w/call/allocation.js +1 -345
  145. package/dist/cjs/w/call/arb.js +1 -103
  146. package/dist/cjs/w/call/arbitration.js +1 -1192
  147. package/dist/cjs/w/call/base.js +1 -293
  148. package/dist/cjs/w/call/contact.js +1 -345
  149. package/dist/cjs/w/call/demand.js +1 -681
  150. package/dist/cjs/w/call/entity.js +1 -173
  151. package/dist/cjs/w/call/guard-ins.js +1 -4449
  152. package/dist/cjs/w/call/guard.d.ts +111 -0
  153. package/dist/cjs/w/call/guard.js +1 -1048
  154. package/dist/cjs/w/call/index.js +1 -22
  155. package/dist/cjs/w/call/machine.js +1 -1127
  156. package/dist/cjs/w/call/order.js +1 -337
  157. package/dist/cjs/w/call/passport.js +1 -220
  158. package/dist/cjs/w/call/payment.js +1 -178
  159. package/dist/cjs/w/call/permission.js +1 -1162
  160. package/dist/cjs/w/call/personal.js +1 -139
  161. package/dist/cjs/w/call/progress.js +1 -678
  162. package/dist/cjs/w/call/proof.js +1 -66
  163. package/dist/cjs/w/call/repository.js +1 -1024
  164. package/dist/cjs/w/call/resource.js +1 -108
  165. package/dist/cjs/w/call/reward.js +1 -675
  166. package/dist/cjs/w/call/service.js +1 -1960
  167. package/dist/cjs/w/call/treasury.js +1 -873
  168. package/dist/cjs/w/call/util.d.ts +1 -0
  169. package/dist/cjs/w/call/util.js +1 -566
  170. package/dist/cjs/w/common.js +1 -571
  171. package/dist/cjs/w/exception.js +1 -618
  172. package/dist/cjs/w/index.js +1 -8
  173. package/dist/cjs/w/local/account.js +1 -656
  174. package/dist/cjs/w/local/cache.js +1 -161
  175. package/dist/cjs/w/local/config.js +1 -43
  176. package/dist/cjs/w/local/index.js +1 -228
  177. package/dist/cjs/w/local/local.js +1 -574
  178. package/dist/cjs/w/local/storage.js +1 -185
  179. package/dist/cjs/w/local/token.js +1 -131
  180. package/dist/cjs/w/local/util.js +1 -26
  181. package/dist/cjs/w/local/wip.js +1 -864
  182. package/dist/cjs/w/messenger/crypto.js +1 -380
  183. package/dist/cjs/w/messenger/index.js +1 -4
  184. package/dist/cjs/w/messenger/messenger-api.js +1 -1154
  185. package/dist/cjs/w/messenger/messenger-manager.js +1 -1003
  186. package/dist/cjs/w/messenger/messenger.js +1 -1093
  187. package/dist/cjs/w/messenger/server.js +1 -343
  188. package/dist/cjs/w/messenger/session.js +1 -628
  189. package/dist/cjs/w/messenger/storage.js +1 -1023
  190. package/dist/cjs/w/messenger/templates/wts-html-template.js +1 -371
  191. package/dist/cjs/w/messenger/types.js +1 -76
  192. package/dist/cjs/w/messenger/utils.js +1 -12
  193. package/dist/cjs/w/query/bult-in.js +1 -95
  194. package/dist/cjs/w/query/event.js +1 -137
  195. package/dist/cjs/w/query/index.js +1 -5
  196. package/dist/cjs/w/query/object.js +1 -1550
  197. package/dist/cjs/w/query/received.js +1 -62
  198. package/dist/cjs/w/query/util.js +1 -49
  199. package/dist/cjs/w/util.js +1 -587
  200. package/dist/esm/bcs/bcs.js +1 -253
  201. package/dist/esm/bcs/effects.js +1 -199
  202. package/dist/esm/bcs/index.js +1 -51
  203. package/dist/esm/bcs/pure.js +1 -36
  204. package/dist/esm/bcs/type-tag-serializer.js +1 -104
  205. package/dist/esm/bcs/types.js +1 -3
  206. package/dist/esm/client/index.js +1 -4
  207. package/dist/esm/client/network.js +1 -15
  208. package/dist/esm/cryptography/index.js +1 -6
  209. package/dist/esm/cryptography/intent.js +1 -14
  210. package/dist/esm/cryptography/keypair.js +1 -74
  211. package/dist/esm/cryptography/mnemonics.js +1 -20
  212. package/dist/esm/cryptography/publickey.js +1 -80
  213. package/dist/esm/cryptography/signature-scheme.js +1 -22
  214. package/dist/esm/cryptography/signature.js +1 -41
  215. package/dist/esm/experimental/cache.js +1 -58
  216. package/dist/esm/experimental/client.js +1 -19
  217. package/dist/esm/experimental/core.js +1 -80
  218. package/dist/esm/experimental/errors.js +1 -24
  219. package/dist/esm/experimental/index.js +1 -5
  220. package/dist/esm/experimental/persistent-storage.js +1 -220
  221. package/dist/esm/experimental/persistent-storage.test.js +1 -144
  222. package/dist/esm/experimental/transports/utils.js +1 -96
  223. package/dist/esm/experimental/types.js +1 -1
  224. package/dist/esm/faucet/faucet.js +1 -99
  225. package/dist/esm/faucet/index.js +1 -1
  226. package/dist/esm/grpc/client.js +1 -42
  227. package/dist/esm/grpc/core.js +1 -587
  228. package/dist/esm/grpc/index.js +1 -2
  229. package/dist/esm/grpc/proto/google/protobuf/any.js +1 -106
  230. package/dist/esm/grpc/proto/google/protobuf/duration.js +1 -58
  231. package/dist/esm/grpc/proto/google/protobuf/empty.js +1 -7
  232. package/dist/esm/grpc/proto/google/protobuf/field_mask.js +1 -47
  233. package/dist/esm/grpc/proto/google/protobuf/struct.js +1 -191
  234. package/dist/esm/grpc/proto/google/protobuf/timestamp.js +1 -91
  235. package/dist/esm/grpc/proto/google/rpc/error_details.js +1 -265
  236. package/dist/esm/grpc/proto/google/rpc/status.js +1 -23
  237. package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +1 -46
  238. package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +1 -29
  239. package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +1 -22
  240. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +1 -54
  241. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +1 -60
  242. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +1 -144
  243. package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +1 -271
  244. package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +1 -64
  245. package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +1 -6
  246. package/dist/esm/grpc/proto/sui/rpc/v2/event.js +1 -62
  247. package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +1 -64
  248. package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +1 -481
  249. package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +1 -40
  250. package/dist/esm/grpc/proto/sui/rpc/v2/input.js +1 -61
  251. package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +1 -57
  252. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +1 -39
  253. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +1 -329
  254. package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +1 -447
  255. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +1 -27
  256. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +1 -206
  257. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +1 -19
  258. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +1 -109
  259. package/dist/esm/grpc/proto/sui/rpc/v2/object.js +1 -90
  260. package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +1 -30
  261. package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +1 -39
  262. package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +1 -30
  263. package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +1 -501
  264. package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +1 -10
  265. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +1 -15
  266. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +1 -62
  267. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +1 -31
  268. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +1 -504
  269. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +1 -15
  270. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +1 -37
  271. package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +1 -709
  272. package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +1 -950
  273. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +1 -19
  274. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +1 -144
  275. package/dist/esm/index.js +1 -22
  276. package/dist/esm/jsonRpc/client.js +1 -516
  277. package/dist/esm/jsonRpc/core.js +1 -587
  278. package/dist/esm/jsonRpc/errors.js +1 -38
  279. package/dist/esm/jsonRpc/http-transport.js +1 -70
  280. package/dist/esm/jsonRpc/index.js +1 -3
  281. package/dist/esm/jsonRpc/json-rpc-resolver.js +1 -296
  282. package/dist/esm/jsonRpc/rpc-websocket-client.js +1 -155
  283. package/dist/esm/jsonRpc/types/chain.js +1 -1
  284. package/dist/esm/jsonRpc/types/changes.js +1 -1
  285. package/dist/esm/jsonRpc/types/coins.js +1 -1
  286. package/dist/esm/jsonRpc/types/common.js +1 -1
  287. package/dist/esm/jsonRpc/types/generated.js +1 -1
  288. package/dist/esm/jsonRpc/types/index.js +1 -1
  289. package/dist/esm/jsonRpc/types/params.js +1 -1
  290. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +1 -58
  291. package/dist/esm/keypairs/ed25519/index.js +1 -2
  292. package/dist/esm/keypairs/ed25519/keypair.js +1 -90
  293. package/dist/esm/keypairs/ed25519/publickey.js +1 -50
  294. package/dist/esm/keypairs/index.js +1 -4
  295. package/dist/esm/keypairs/passkey/index.js +1 -2
  296. package/dist/esm/keypairs/passkey/keypair.js +1 -155
  297. package/dist/esm/keypairs/passkey/publickey.js +1 -117
  298. package/dist/esm/keypairs/passkey/types.js +1 -1
  299. package/dist/esm/keypairs/secp256k1/index.js +1 -2
  300. package/dist/esm/keypairs/secp256k1/keypair.js +1 -82
  301. package/dist/esm/keypairs/secp256k1/publickey.js +1 -51
  302. package/dist/esm/keypairs/secp256r1/index.js +1 -2
  303. package/dist/esm/keypairs/secp256r1/keypair.js +1 -78
  304. package/dist/esm/keypairs/secp256r1/publickey.js +1 -52
  305. package/dist/esm/multisig/index.js +1 -2
  306. package/dist/esm/multisig/publickey.js +1 -201
  307. package/dist/esm/multisig/signer.js +1 -58
  308. package/dist/esm/transactions/Arguments.js +1 -9
  309. package/dist/esm/transactions/Commands.js +1 -102
  310. package/dist/esm/transactions/Inputs.js +1 -52
  311. package/dist/esm/transactions/ObjectCache.js +1 -205
  312. package/dist/esm/transactions/Transaction.js +1 -574
  313. package/dist/esm/transactions/TransactionData.js +1 -409
  314. package/dist/esm/transactions/__tests__/Transaction.test.js +1 -160
  315. package/dist/esm/transactions/__tests__/bcs.test.js +1 -182
  316. package/dist/esm/transactions/data/internal.js +1 -169
  317. package/dist/esm/transactions/data/v1.js +1 -469
  318. package/dist/esm/transactions/data/v2.js +1 -97
  319. package/dist/esm/transactions/executor/caching.js +1 -65
  320. package/dist/esm/transactions/executor/parallel.js +1 -347
  321. package/dist/esm/transactions/executor/queue.js +1 -59
  322. package/dist/esm/transactions/executor/serial.js +1 -99
  323. package/dist/esm/transactions/hash.js +1 -8
  324. package/dist/esm/transactions/index.js +1 -12
  325. package/dist/esm/transactions/intents/CoinWithBalance.js +1 -145
  326. package/dist/esm/transactions/object.js +1 -87
  327. package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +1 -11
  328. package/dist/esm/transactions/pure.js +1 -36
  329. package/dist/esm/transactions/resolve.js +1 -69
  330. package/dist/esm/transactions/serializer.js +1 -167
  331. package/dist/esm/transactions/utils.js +1 -121
  332. package/dist/esm/utils/constants.js +1 -18
  333. package/dist/esm/utils/derived-objects.js +1 -8
  334. package/dist/esm/utils/dynamic-fields.js +1 -17
  335. package/dist/esm/utils/format.js +1 -11
  336. package/dist/esm/utils/index.js +1 -8
  337. package/dist/esm/utils/move-registry.js +1 -24
  338. package/dist/esm/utils/sui-types.js +1 -66
  339. package/dist/esm/utils/suins.js +1 -33
  340. package/dist/esm/verify/index.js +1 -1
  341. package/dist/esm/verify/verify.js +1 -87
  342. package/dist/esm/version.js +1 -2
  343. package/dist/esm/w/call/allocation.js +1 -345
  344. package/dist/esm/w/call/arb.js +1 -103
  345. package/dist/esm/w/call/arbitration.js +1 -1192
  346. package/dist/esm/w/call/base.js +1 -293
  347. package/dist/esm/w/call/contact.js +1 -345
  348. package/dist/esm/w/call/demand.js +1 -681
  349. package/dist/esm/w/call/entity.js +1 -173
  350. package/dist/esm/w/call/guard-ins.js +1 -4449
  351. package/dist/esm/w/call/guard.d.ts +111 -0
  352. package/dist/esm/w/call/guard.js +1 -1048
  353. package/dist/esm/w/call/index.js +1 -22
  354. package/dist/esm/w/call/machine.js +1 -1127
  355. package/dist/esm/w/call/order.js +1 -337
  356. package/dist/esm/w/call/passport.js +1 -220
  357. package/dist/esm/w/call/payment.js +1 -178
  358. package/dist/esm/w/call/permission.js +1 -1162
  359. package/dist/esm/w/call/personal.js +1 -139
  360. package/dist/esm/w/call/progress.js +1 -678
  361. package/dist/esm/w/call/proof.js +1 -66
  362. package/dist/esm/w/call/repository.js +1 -1024
  363. package/dist/esm/w/call/resource.js +1 -108
  364. package/dist/esm/w/call/reward.js +1 -675
  365. package/dist/esm/w/call/service.js +1 -1960
  366. package/dist/esm/w/call/treasury.js +1 -873
  367. package/dist/esm/w/call/util.d.ts +1 -0
  368. package/dist/esm/w/call/util.js +1 -566
  369. package/dist/esm/w/common.js +1 -571
  370. package/dist/esm/w/exception.js +1 -618
  371. package/dist/esm/w/index.js +1 -8
  372. package/dist/esm/w/local/account.js +1 -656
  373. package/dist/esm/w/local/cache.js +1 -161
  374. package/dist/esm/w/local/config.js +1 -43
  375. package/dist/esm/w/local/index.js +1 -228
  376. package/dist/esm/w/local/local.js +1 -574
  377. package/dist/esm/w/local/storage.js +1 -185
  378. package/dist/esm/w/local/token.js +1 -131
  379. package/dist/esm/w/local/util.js +1 -26
  380. package/dist/esm/w/local/wip.js +1 -864
  381. package/dist/esm/w/messenger/crypto.js +1 -380
  382. package/dist/esm/w/messenger/index.js +1 -4
  383. package/dist/esm/w/messenger/messenger-api.js +1 -1154
  384. package/dist/esm/w/messenger/messenger-manager.js +1 -1003
  385. package/dist/esm/w/messenger/messenger.js +1 -1093
  386. package/dist/esm/w/messenger/server.js +1 -343
  387. package/dist/esm/w/messenger/session.js +1 -628
  388. package/dist/esm/w/messenger/storage.js +1 -1023
  389. package/dist/esm/w/messenger/templates/wts-html-template.js +1 -371
  390. package/dist/esm/w/messenger/types.js +1 -76
  391. package/dist/esm/w/messenger/utils.js +1 -12
  392. package/dist/esm/w/query/bult-in.js +1 -95
  393. package/dist/esm/w/query/event.js +1 -137
  394. package/dist/esm/w/query/index.js +1 -5
  395. package/dist/esm/w/query/object.js +1 -1550
  396. package/dist/esm/w/query/received.js +1 -62
  397. package/dist/esm/w/query/util.js +1 -49
  398. package/dist/esm/w/util.js +1 -587
  399. package/package.json +5 -2
@@ -1,347 +1 @@
1
- import { toBase64 } from "@mysten/bcs";
2
- import { promiseWithResolvers } from "@mysten/utils";
3
- import { bcs } from "../../bcs/index.js";
4
- import { Transaction } from "../Transaction.js";
5
- import { TransactionDataBuilder } from "../TransactionData.js";
6
- import { CachingTransactionExecutor } from "./caching.js";
7
- import { ParallelQueue, SerialQueue } from "./queue.js";
8
- import { getGasCoinFromEffects } from "./serial.js";
9
- const PARALLEL_EXECUTOR_DEFAULTS = {
10
- coinBatchSize: 20,
11
- initialCoinBalance: 200000000n,
12
- minimumCoinBalance: 50000000n,
13
- maxPoolSize: 50,
14
- epochBoundaryWindow: 1_000,
15
- };
16
- export class ParallelTransactionExecutor {
17
- #signer;
18
- #client;
19
- #coinBatchSize;
20
- #initialCoinBalance;
21
- #minimumCoinBalance;
22
- #epochBoundaryWindow;
23
- #defaultGasBudget;
24
- #maxPoolSize;
25
- #sourceCoins;
26
- #coinPool = [];
27
- #cache;
28
- #objectIdQueues = new Map();
29
- #buildQueue = new SerialQueue();
30
- #executeQueue;
31
- #lastDigest = null;
32
- #cacheLock = null;
33
- #pendingTransactions = 0;
34
- #gasPrice = null;
35
- constructor(options) {
36
- this.#signer = options.signer;
37
- this.#client = options.client;
38
- this.#coinBatchSize =
39
- options.coinBatchSize ?? PARALLEL_EXECUTOR_DEFAULTS.coinBatchSize;
40
- this.#initialCoinBalance =
41
- options.initialCoinBalance ??
42
- PARALLEL_EXECUTOR_DEFAULTS.initialCoinBalance;
43
- this.#minimumCoinBalance =
44
- options.minimumCoinBalance ??
45
- PARALLEL_EXECUTOR_DEFAULTS.minimumCoinBalance;
46
- this.#defaultGasBudget =
47
- options.defaultGasBudget ?? this.#minimumCoinBalance;
48
- this.#epochBoundaryWindow =
49
- options.epochBoundaryWindow ??
50
- PARALLEL_EXECUTOR_DEFAULTS.epochBoundaryWindow;
51
- this.#maxPoolSize =
52
- options.maxPoolSize ?? PARALLEL_EXECUTOR_DEFAULTS.maxPoolSize;
53
- this.#cache = new CachingTransactionExecutor({
54
- client: options.client,
55
- cache: options.cache,
56
- });
57
- this.#executeQueue = new ParallelQueue(this.#maxPoolSize);
58
- this.#sourceCoins = options.sourceCoins
59
- ? new Map(options.sourceCoins.map((id) => [id, null]))
60
- : null;
61
- }
62
- resetCache() {
63
- this.#gasPrice = null;
64
- return this.#updateCache(() => this.#cache.reset());
65
- }
66
- async waitForLastTransaction() {
67
- await this.#updateCache(() => this.#waitForLastDigest());
68
- }
69
- async executeTransaction(transaction, options, additionalSignatures = []) {
70
- const { promise, resolve, reject } = promiseWithResolvers();
71
- const usedObjects = await this.#getUsedObjects(transaction);
72
- const execute = () => {
73
- this.#executeQueue.runTask(() => {
74
- const promise = this.#execute(transaction, usedObjects, options, additionalSignatures);
75
- return promise.then(resolve, reject);
76
- });
77
- };
78
- const conflicts = new Set();
79
- usedObjects.forEach((objectId) => {
80
- const queue = this.#objectIdQueues.get(objectId);
81
- if (queue) {
82
- conflicts.add(objectId);
83
- this.#objectIdQueues.get(objectId).push(() => {
84
- conflicts.delete(objectId);
85
- if (conflicts.size === 0) {
86
- execute();
87
- }
88
- });
89
- }
90
- else {
91
- this.#objectIdQueues.set(objectId, []);
92
- }
93
- });
94
- if (conflicts.size === 0) {
95
- execute();
96
- }
97
- return promise;
98
- }
99
- async #getUsedObjects(transaction) {
100
- const usedObjects = new Set();
101
- let serialized = false;
102
- transaction.addSerializationPlugin(async (blockData, _options, next) => {
103
- await next();
104
- if (serialized) {
105
- return;
106
- }
107
- serialized = true;
108
- blockData.inputs.forEach((input) => {
109
- if (input.Object?.ImmOrOwnedObject?.objectId) {
110
- usedObjects.add(input.Object.ImmOrOwnedObject.objectId);
111
- }
112
- else if (input.Object?.Receiving?.objectId) {
113
- usedObjects.add(input.Object.Receiving.objectId);
114
- }
115
- else if (input.UnresolvedObject?.objectId &&
116
- !input.UnresolvedObject.initialSharedVersion) {
117
- usedObjects.add(input.UnresolvedObject.objectId);
118
- }
119
- });
120
- });
121
- await transaction.prepareForSerialization({ client: this.#client });
122
- return usedObjects;
123
- }
124
- async #execute(transaction, usedObjects, options, additionalSignatures = []) {
125
- let gasCoin;
126
- try {
127
- transaction.setSenderIfNotSet(this.#signer.toWAddress());
128
- await this.#buildQueue.runTask(async () => {
129
- const data = transaction.getData();
130
- if (!data.gasData.price) {
131
- transaction.setGasPrice(await this.#getGasPrice());
132
- }
133
- transaction.setGasBudgetIfNotSet(this.#defaultGasBudget);
134
- await this.#updateCache();
135
- gasCoin = await this.#getGasCoin();
136
- this.#pendingTransactions++;
137
- transaction.setGasPayment([
138
- {
139
- objectId: gasCoin.id,
140
- version: gasCoin.version,
141
- digest: gasCoin.digest,
142
- },
143
- ]);
144
- await this.#cache.buildTransaction({
145
- transaction,
146
- onlyTransactionKind: true,
147
- });
148
- });
149
- const bytes = await transaction.build({ client: this.#client });
150
- const { signature } = await this.#signer.signTransaction(bytes);
151
- const results = await this.#cache.executeTransaction({
152
- transaction: bytes,
153
- signature: [signature, ...additionalSignatures],
154
- options: {
155
- ...options,
156
- showEffects: true,
157
- },
158
- });
159
- const effectsBytes = Uint8Array.from(results.rawEffects);
160
- const effects = bcs.TransactionEffects.parse(effectsBytes);
161
- const gasResult = getGasCoinFromEffects(effects);
162
- const gasUsed = effects.V2?.gasUsed;
163
- if (gasCoin &&
164
- gasUsed &&
165
- gasResult.owner === this.#signer.toWAddress()) {
166
- const totalUsed = BigInt(gasUsed.computationCost) +
167
- BigInt(gasUsed.storageCost) +
168
- BigInt(gasUsed.storageCost) -
169
- BigInt(gasUsed.storageRebate);
170
- const remainingBalance = gasCoin.balance - totalUsed;
171
- let usesGasCoin = false;
172
- new TransactionDataBuilder(transaction.getData()).mapArguments((arg) => {
173
- if (arg.$kind === "GasCoin") {
174
- usesGasCoin = true;
175
- }
176
- return arg;
177
- });
178
- if (!usesGasCoin &&
179
- remainingBalance >= this.#minimumCoinBalance) {
180
- this.#coinPool.push({
181
- id: gasResult.ref.objectId,
182
- version: gasResult.ref.version,
183
- digest: gasResult.ref.digest,
184
- balance: remainingBalance,
185
- });
186
- }
187
- else {
188
- if (!this.#sourceCoins) {
189
- this.#sourceCoins = new Map();
190
- }
191
- this.#sourceCoins.set(gasResult.ref.objectId, gasResult.ref);
192
- }
193
- }
194
- this.#lastDigest = results.digest;
195
- return {
196
- digest: results.digest,
197
- effects: toBase64(effectsBytes),
198
- data: results,
199
- };
200
- }
201
- catch (error) {
202
- if (gasCoin) {
203
- if (!this.#sourceCoins) {
204
- this.#sourceCoins = new Map();
205
- }
206
- this.#sourceCoins.set(gasCoin.id, null);
207
- }
208
- await this.#updateCache(async () => {
209
- await Promise.all([
210
- this.#cache.cache.deleteObjects([...usedObjects]),
211
- this.#waitForLastDigest(),
212
- ]);
213
- });
214
- throw error;
215
- }
216
- finally {
217
- usedObjects.forEach((objectId) => {
218
- const queue = this.#objectIdQueues.get(objectId);
219
- if (queue && queue.length > 0) {
220
- queue.shift()();
221
- }
222
- else if (queue) {
223
- this.#objectIdQueues.delete(objectId);
224
- }
225
- });
226
- this.#pendingTransactions--;
227
- }
228
- }
229
- async #updateCache(fn) {
230
- if (this.#cacheLock) {
231
- await this.#cacheLock;
232
- }
233
- this.#cacheLock =
234
- fn?.().then(() => {
235
- this.#cacheLock = null;
236
- }, () => { }) ?? null;
237
- }
238
- async #waitForLastDigest() {
239
- const digest = this.#lastDigest;
240
- if (digest) {
241
- this.#lastDigest = null;
242
- await this.#client.waitForTransaction({ digest });
243
- }
244
- }
245
- async #getGasCoin() {
246
- if (this.#coinPool.length === 0 &&
247
- this.#pendingTransactions <= this.#maxPoolSize) {
248
- await this.#refillCoinPool();
249
- }
250
- if (this.#coinPool.length === 0) {
251
- throw new Error("No coins available");
252
- }
253
- const coin = this.#coinPool.shift();
254
- return coin;
255
- }
256
- async #getGasPrice() {
257
- const remaining = this.#gasPrice
258
- ? this.#gasPrice.expiration - this.#epochBoundaryWindow - Date.now()
259
- : 0;
260
- if (remaining > 0) {
261
- return this.#gasPrice.price;
262
- }
263
- if (this.#gasPrice) {
264
- const timeToNextEpoch = Math.max(this.#gasPrice.expiration +
265
- this.#epochBoundaryWindow -
266
- Date.now(), 1_000);
267
- await new Promise((resolve) => setTimeout(resolve, timeToNextEpoch));
268
- }
269
- const state = await this.#client.getLatestSuiSystemState();
270
- this.#gasPrice = {
271
- price: BigInt(state.referenceGasPrice),
272
- expiration: Number.parseInt(state.epochStartTimestampMs, 10) +
273
- Number.parseInt(state.epochDurationMs, 10),
274
- };
275
- return this.#getGasPrice();
276
- }
277
- async #refillCoinPool() {
278
- const batchSize = Math.min(this.#coinBatchSize, this.#maxPoolSize -
279
- (this.#coinPool.length + this.#pendingTransactions) +
280
- 1);
281
- if (batchSize === 0) {
282
- return;
283
- }
284
- const txb = new Transaction();
285
- const address = this.#signer.toWAddress();
286
- txb.setSender(address);
287
- if (this.#sourceCoins) {
288
- const refs = [];
289
- const ids = [];
290
- for (const [id, ref] of this.#sourceCoins) {
291
- if (ref) {
292
- refs.push(ref);
293
- }
294
- else {
295
- ids.push(id);
296
- }
297
- }
298
- if (ids.length > 0) {
299
- const coins = await this.#client.multiGetObjects({
300
- ids,
301
- });
302
- refs.push(...coins
303
- .filter((coin) => coin.data !== null)
304
- .map(({ data }) => ({
305
- objectId: data.objectId,
306
- version: data.version,
307
- digest: data.digest,
308
- })));
309
- }
310
- txb.setGasPayment(refs);
311
- this.#sourceCoins = new Map();
312
- }
313
- const amounts = new Array(batchSize).fill(this.#initialCoinBalance);
314
- const results = txb.splitCoins(txb.gas, amounts);
315
- const coinResults = [];
316
- for (let i = 0; i < amounts.length; i++) {
317
- coinResults.push(results[i]);
318
- }
319
- txb.transferObjects(coinResults, address);
320
- await this.waitForLastTransaction();
321
- const result = await this.#client.signAndExecuteTransaction({
322
- transaction: txb,
323
- signer: this.#signer,
324
- options: {
325
- showRawEffects: true,
326
- },
327
- });
328
- const effects = bcs.TransactionEffects.parse(Uint8Array.from(result.rawEffects));
329
- effects.V2?.changedObjects.forEach(([id, { outputState }], i) => {
330
- if (i === effects.V2?.gasObjectIndex || !outputState.ObjectWrite) {
331
- return;
332
- }
333
- this.#coinPool.push({
334
- id,
335
- version: effects.V2.lamportVersion,
336
- digest: outputState.ObjectWrite[0],
337
- balance: BigInt(this.#initialCoinBalance),
338
- });
339
- });
340
- if (!this.#sourceCoins) {
341
- this.#sourceCoins = new Map();
342
- }
343
- const gasObject = getGasCoinFromEffects(effects).ref;
344
- this.#sourceCoins.set(gasObject.objectId, gasObject);
345
- await this.#client.waitForTransaction({ digest: result.digest });
346
- }
347
- }
1
+ import{toBase64}from'@mysten/bcs';import{promiseWithResolvers}from'@mysten/utils';import{bcs}from'../../bcs/index.js';import{Transaction}from'../Transaction.js';import{TransactionDataBuilder}from'../TransactionData.js';import{CachingTransactionExecutor}from'./caching.js';import{ParallelQueue,SerialQueue}from'./queue.js';import{getGasCoinFromEffects}from'./serial.js';const PARALLEL_EXECUTOR_DEFAULTS={'coinBatchSize':0x14,'initialCoinBalance':0xbebc200n,'minimumCoinBalance':0x2faf080n,'maxPoolSize':0x32,'epochBoundaryWindow':0x3e8};export class ParallelTransactionExecutor{#signer;#client;#coinBatchSize;#initialCoinBalance;#minimumCoinBalance;#epochBoundaryWindow;#defaultGasBudget;#maxPoolSize;#sourceCoins;#coinPool=[];#cache;#objectIdQueues=new Map();#buildQueue=new SerialQueue();#executeQueue;#lastDigest=null;#cacheLock=null;#pendingTransactions=0x0;#gasPrice=null;constructor(a){this.#signer=a['signer'],this.#client=a['client'],this.#coinBatchSize=a['coinBatchSize']??PARALLEL_EXECUTOR_DEFAULTS['coinBatchSize'],this.#initialCoinBalance=a['initialCoinBalance']??PARALLEL_EXECUTOR_DEFAULTS['initialCoinBalance'],this.#minimumCoinBalance=a['minimumCoinBalance']??PARALLEL_EXECUTOR_DEFAULTS['minimumCoinBalance'],this.#defaultGasBudget=a['defaultGasBudget']??this.#minimumCoinBalance,this.#epochBoundaryWindow=a['epochBoundaryWindow']??PARALLEL_EXECUTOR_DEFAULTS['epochBoundaryWindow'],this.#maxPoolSize=a['maxPoolSize']??PARALLEL_EXECUTOR_DEFAULTS['maxPoolSize'],this.#cache=new CachingTransactionExecutor({'client':a['client'],'cache':a['cache']}),this.#executeQueue=new ParallelQueue(this.#maxPoolSize),this.#sourceCoins=a['sourceCoins']?new Map(a['sourceCoins']['map'](b=>[b,null])):null;}['resetCache'](){return this.#gasPrice=null,this.#updateCache(()=>this.#cache['reset']());}async['waitForLastTransaction'](){await this.#updateCache(()=>this.#waitForLastDigest());}async['executeTransaction'](a,b,c=[]){const {promise:d,resolve:e,reject:f}=promiseWithResolvers(),g=await this.#getUsedObjects(a),h=()=>{this.#executeQueue['runTask'](()=>{const j=this.#execute(a,g,b,c);return j['then'](e,f);});},i=new Set();return g['forEach'](j=>{const k=this.#objectIdQueues['get'](j);k?(i['add'](j),this.#objectIdQueues['get'](j)['push'](()=>{i['delete'](j),i['size']===0x0&&h();})):this.#objectIdQueues['set'](j,[]);}),i['size']===0x0&&h(),d;}async #getUsedObjects(a){const b=new Set();let c=![];return a['addSerializationPlugin'](async(d,e,f)=>{await f();if(c)return;c=!![],d['inputs']['forEach'](g=>{if(g['Object']?.['ImmOrOwnedObject']?.['objectId'])b['add'](g['Object']['ImmOrOwnedObject']['objectId']);else{if(g['Object']?.['Receiving']?.['objectId'])b['add'](g['Object']['Receiving']['objectId']);else g['UnresolvedObject']?.['objectId']&&!g['UnresolvedObject']['initialSharedVersion']&&b['add'](g['UnresolvedObject']['objectId']);}});}),await a['prepareForSerialization']({'client':this.#client}),b;}async #execute(a,b,c,d=[]){let e;try{a['setSenderIfNotSet'](this.#signer['toWAddress']()),await this.#buildQueue['runTask'](async()=>{const m=a['getData']();!m['gasData']['price']&&a['setGasPrice'](await this.#getGasPrice()),a['setGasBudgetIfNotSet'](this.#defaultGasBudget),await this.#updateCache(),e=await this.#getGasCoin(),this.#pendingTransactions++,a['setGasPayment']([{'objectId':e['id'],'version':e['version'],'digest':e['digest']}]),await this.#cache['buildTransaction']({'transaction':a,'onlyTransactionKind':!![]});});const f=await a['build']({'client':this.#client}),{signature:g}=await this.#signer['signTransaction'](f),h=await this.#cache['executeTransaction']({'transaction':f,'signature':[g,...d],'options':{...c,'showEffects':!![]}}),i=Uint8Array['from'](h['rawEffects']),j=bcs['TransactionEffects']['parse'](i),k=getGasCoinFromEffects(j),l=j['V2']?.['gasUsed'];if(e&&l&&k['owner']===this.#signer['toWAddress']()){const m=BigInt(l['computationCost'])+BigInt(l['storageCost'])+BigInt(l['storageCost'])-BigInt(l['storageRebate']),n=e['balance']-m;let o=![];new TransactionDataBuilder(a['getData']())['mapArguments'](p=>{return p['$kind']==='GasCoin'&&(o=!![]),p;}),!o&&n>=this.#minimumCoinBalance?this.#coinPool['push']({'id':k['ref']['objectId'],'version':k['ref']['version'],'digest':k['ref']['digest'],'balance':n}):(!this.#sourceCoins&&(this.#sourceCoins=new Map()),this.#sourceCoins['set'](k['ref']['objectId'],k['ref']));}return this.#lastDigest=h['digest'],{'digest':h['digest'],'effects':toBase64(i),'data':h};}catch(p){e&&(!this.#sourceCoins&&(this.#sourceCoins=new Map()),this.#sourceCoins['set'](e['id'],null));await this.#updateCache(async()=>{await Promise['all']([this.#cache['cache']['deleteObjects']([...b]),this.#waitForLastDigest()]);});throw p;}finally{b['forEach'](q=>{const r=this.#objectIdQueues['get'](q);if(r&&r['length']>0x0)r['shift']()();else r&&this.#objectIdQueues['delete'](q);}),this.#pendingTransactions--;}}async #updateCache(a){this.#cacheLock&&await this.#cacheLock,this.#cacheLock=a?.()['then'](()=>{this.#cacheLock=null;},()=>{})??null;}async #waitForLastDigest(){const a=this.#lastDigest;a&&(this.#lastDigest=null,await this.#client['waitForTransaction']({'digest':a}));}async #getGasCoin(){this.#coinPool['length']===0x0&&this.#pendingTransactions<=this.#maxPoolSize&&await this.#refillCoinPool();if(this.#coinPool['length']===0x0)throw new Error('No\x20coins\x20available');const a=this.#coinPool['shift']();return a;}async #getGasPrice(){const a=this.#gasPrice?this.#gasPrice['expiration']-this.#epochBoundaryWindow-Date['now']():0x0;if(a>0x0)return this.#gasPrice['price'];if(this.#gasPrice){const c=Math['max'](this.#gasPrice['expiration']+this.#epochBoundaryWindow-Date['now'](),0x3e8);await new Promise(d=>setTimeout(d,c));}const b=await this.#client['getLatestSuiSystemState']();return this.#gasPrice={'price':BigInt(b['referenceGasPrice']),'expiration':Number['parseInt'](b['epochStartTimestampMs'],0xa)+Number['parseInt'](b['epochDurationMs'],0xa)},this.#getGasPrice();}async #refillCoinPool(){const a=Math['min'](this.#coinBatchSize,this.#maxPoolSize-(this.#coinPool['length']+this.#pendingTransactions)+0x1);if(a===0x0)return;const b=new Transaction(),c=this.#signer['toWAddress']();b['setSender'](c);if(this.#sourceCoins){const k=[],l=[];for(const [m,n]of this.#sourceCoins){n?k['push'](n):l['push'](m);}if(l['length']>0x0){const o=await this.#client['multiGetObjects']({'ids':l});k['push'](...o['filter'](p=>p['data']!==null)['map'](({data:p})=>({'objectId':p['objectId'],'version':p['version'],'digest':p['digest']})));}b['setGasPayment'](k),this.#sourceCoins=new Map();}const d=new Array(a)['fill'](this.#initialCoinBalance),e=b['splitCoins'](b['gas'],d),f=[];for(let p=0x0;p<d['length'];p++){f['push'](e[p]);}b['transferObjects'](f,c),await this['waitForLastTransaction']();const g=await this.#client['signAndExecuteTransaction']({'transaction':b,'signer':this.#signer,'options':{'showRawEffects':!![]}}),h=bcs['TransactionEffects']['parse'](Uint8Array['from'](g['rawEffects']));h['V2']?.['changedObjects']['forEach'](([q,{outputState:r}],s)=>{if(s===h['V2']?.['gasObjectIndex']||!r['ObjectWrite'])return;this.#coinPool['push']({'id':q,'version':h['V2']['lamportVersion'],'digest':r['ObjectWrite'][0x0],'balance':BigInt(this.#initialCoinBalance)});});!this.#sourceCoins&&(this.#sourceCoins=new Map());const j=getGasCoinFromEffects(h)['ref'];this.#sourceCoins['set'](j['objectId'],j),await this.#client['waitForTransaction']({'digest':g['digest']});}}
@@ -1,59 +1 @@
1
- export class SerialQueue {
2
- #queue = [];
3
- async runTask(task) {
4
- return new Promise((resolve, reject) => {
5
- this.#queue.push(() => {
6
- task()
7
- .finally(() => {
8
- this.#queue.shift();
9
- if (this.#queue.length > 0) {
10
- this.#queue[0]();
11
- }
12
- })
13
- .then(resolve, reject);
14
- });
15
- if (this.#queue.length === 1) {
16
- this.#queue[0]();
17
- }
18
- });
19
- }
20
- }
21
- export class ParallelQueue {
22
- #queue = [];
23
- activeTasks = 0;
24
- maxTasks;
25
- constructor(maxTasks) {
26
- this.maxTasks = maxTasks;
27
- }
28
- runTask(task) {
29
- return new Promise((resolve, reject) => {
30
- if (this.activeTasks < this.maxTasks) {
31
- this.activeTasks++;
32
- task()
33
- .finally(() => {
34
- if (this.#queue.length > 0) {
35
- this.#queue.shift()();
36
- }
37
- else {
38
- this.activeTasks--;
39
- }
40
- })
41
- .then(resolve, reject);
42
- }
43
- else {
44
- this.#queue.push(() => {
45
- task()
46
- .finally(() => {
47
- if (this.#queue.length > 0) {
48
- this.#queue.shift()();
49
- }
50
- else {
51
- this.activeTasks--;
52
- }
53
- })
54
- .then(resolve, reject);
55
- });
56
- }
57
- });
58
- }
59
- }
1
+ export class SerialQueue{#queue=[];async['runTask'](a){return new Promise((b,c)=>{this.#queue['push'](()=>{a()['finally'](()=>{this.#queue['shift'](),this.#queue['length']>0x0&&this.#queue[0x0]();})['then'](b,c);}),this.#queue['length']===0x1&&this.#queue[0x0]();});}}export class ParallelQueue{#queue=[];['activeTasks']=0x0;['maxTasks'];constructor(a){this['maxTasks']=a;}['runTask'](a){return new Promise((b,c)=>{this['activeTasks']<this['maxTasks']?(this['activeTasks']++,a()['finally'](()=>{this.#queue['length']>0x0?this.#queue['shift']()():this['activeTasks']--;})['then'](b,c)):this.#queue['push'](()=>{a()['finally'](()=>{this.#queue['length']>0x0?this.#queue['shift']()():this['activeTasks']--;})['then'](b,c);});});}}
@@ -1,99 +1 @@
1
- import { toBase64 } from "@mysten/bcs";
2
- import { isTransaction, Transaction } from "../Transaction.js";
3
- import { CachingTransactionExecutor } from "./caching.js";
4
- import { SerialQueue } from "./queue.js";
5
- export class SerialTransactionExecutor {
6
- #queue = new SerialQueue();
7
- #signer;
8
- #cache;
9
- #defaultGasBudget;
10
- constructor({ signer, defaultGasBudget = 50000000n, ...options }) {
11
- this.#signer = signer;
12
- this.#defaultGasBudget = defaultGasBudget;
13
- this.#cache = new CachingTransactionExecutor({
14
- client: options.client,
15
- cache: options.cache,
16
- onEffects: (effects) => this.#cacheGasCoin(effects),
17
- });
18
- }
19
- async applyEffects(effects) {
20
- return this.#cache.applyEffects(effects);
21
- }
22
- #cacheGasCoin = async (effects) => {
23
- if (!effects.V2) {
24
- return;
25
- }
26
- const gasCoin = getGasCoinFromEffects(effects).ref;
27
- if (gasCoin) {
28
- this.#cache.cache.setCustom("gasCoin", gasCoin);
29
- }
30
- else {
31
- this.#cache.cache.deleteCustom("gasCoin");
32
- }
33
- };
34
- async buildTransaction(transaction) {
35
- return this.#queue.runTask(() => this.#buildTransaction(transaction));
36
- }
37
- #buildTransaction = async (transaction) => {
38
- const gasCoin = await this.#cache.cache.getCustom("gasCoin");
39
- const copy = Transaction.from(transaction);
40
- if (gasCoin) {
41
- copy.setGasPayment([gasCoin]);
42
- }
43
- copy.setGasBudgetIfNotSet(this.#defaultGasBudget);
44
- copy.setSenderIfNotSet(this.#signer.toWAddress());
45
- return this.#cache.buildTransaction({ transaction: copy });
46
- };
47
- resetCache() {
48
- return this.#cache.reset();
49
- }
50
- waitForLastTransaction() {
51
- return this.#cache.waitForLastTransaction();
52
- }
53
- executeTransaction(transaction, options, additionalSignatures = []) {
54
- return this.#queue.runTask(async () => {
55
- const bytes = isTransaction(transaction)
56
- ? await this.#buildTransaction(transaction)
57
- : transaction;
58
- const { signature } = await this.#signer.signTransaction(bytes);
59
- const results = await this.#cache
60
- .executeTransaction({
61
- signature: [signature, ...additionalSignatures],
62
- transaction: bytes,
63
- options,
64
- })
65
- .catch(async (error) => {
66
- await this.resetCache();
67
- throw error;
68
- });
69
- const effectsBytes = Uint8Array.from(results.rawEffects);
70
- return {
71
- digest: results.digest,
72
- effects: toBase64(effectsBytes),
73
- data: results,
74
- };
75
- });
76
- }
77
- }
78
- export function getGasCoinFromEffects(effects) {
79
- if (!effects.V2) {
80
- throw new Error("Unexpected effects version");
81
- }
82
- const gasObjectChange = effects.V2.changedObjects[effects.V2.gasObjectIndex];
83
- if (!gasObjectChange) {
84
- throw new Error("Gas object not found in effects");
85
- }
86
- const [objectId, { outputState }] = gasObjectChange;
87
- if (!outputState.ObjectWrite) {
88
- throw new Error("Unexpected gas object state");
89
- }
90
- const [digest, owner] = outputState.ObjectWrite;
91
- return {
92
- ref: {
93
- objectId,
94
- digest,
95
- version: effects.V2.lamportVersion,
96
- },
97
- owner: owner.AddressOwner || owner.ObjectOwner,
98
- };
99
- }
1
+ import{toBase64}from'@mysten/bcs';import{isTransaction,Transaction}from'../Transaction.js';import{CachingTransactionExecutor}from'./caching.js';import{SerialQueue}from'./queue.js';export class SerialTransactionExecutor{#queue=new SerialQueue();#signer;#cache;#defaultGasBudget;constructor({signer:a,defaultGasBudget:defaultGasBudget=0x2faf080n,...b}){this.#signer=a,this.#defaultGasBudget=defaultGasBudget,this.#cache=new CachingTransactionExecutor({'client':b['client'],'cache':b['cache'],'onEffects':c=>this.#cacheGasCoin(c)});}async['applyEffects'](a){return this.#cache['applyEffects'](a);}#cacheGasCoin=async a=>{if(!a['V2'])return;const b=getGasCoinFromEffects(a)['ref'];b?this.#cache['cache']['setCustom']('gasCoin',b):this.#cache['cache']['deleteCustom']('gasCoin');};async['buildTransaction'](a){return this.#queue['runTask'](()=>this.#buildTransaction(a));}#buildTransaction=async a=>{const b=await this.#cache['cache']['getCustom']('gasCoin'),c=Transaction['from'](a);return b&&c['setGasPayment']([b]),c['setGasBudgetIfNotSet'](this.#defaultGasBudget),c['setSenderIfNotSet'](this.#signer['toWAddress']()),this.#cache['buildTransaction']({'transaction':c});};['resetCache'](){return this.#cache['reset']();}['waitForLastTransaction'](){return this.#cache['waitForLastTransaction']();}['executeTransaction'](a,b,c=[]){return this.#queue['runTask'](async()=>{const d=isTransaction(a)?await this.#buildTransaction(a):a,{signature:e}=await this.#signer['signTransaction'](d),f=await this.#cache['executeTransaction']({'signature':[e,...c],'transaction':d,'options':b})['catch'](async h=>{await this['resetCache']();throw h;}),g=Uint8Array['from'](f['rawEffects']);return{'digest':f['digest'],'effects':toBase64(g),'data':f};});}}export function getGasCoinFromEffects(a){if(!a['V2'])throw new Error('Unexpected\x20effects\x20version');const b=a['V2']['changedObjects'][a['V2']['gasObjectIndex']];if(!b)throw new Error('Gas\x20object\x20not\x20found\x20in\x20effects');const [c,{outputState:d}]=b;if(!d['ObjectWrite'])throw new Error('Unexpected\x20gas\x20object\x20state');const [e,f]=d['ObjectWrite'];return{'ref':{'objectId':c,'digest':e,'version':a['V2']['lamportVersion']},'owner':f['AddressOwner']||f['ObjectOwner']};}
@@ -1,8 +1 @@
1
- import { blake2b } from "@noble/hashes/blake2b";
2
- export function hashTypedData(typeTag, data) {
3
- const typeTagBytes = Array.from(`${typeTag}::`).map((e) => e.charCodeAt(0));
4
- const dataWithTag = new Uint8Array(typeTagBytes.length + data.length);
5
- dataWithTag.set(typeTagBytes);
6
- dataWithTag.set(data, typeTagBytes.length);
7
- return blake2b(dataWithTag, { dkLen: 32 });
8
- }
1
+ import{blake2b}from'@noble/hashes/blake2b';export function hashTypedData(a,b){const c=Array['from'](a+'::')['map'](f=>f['charCodeAt'](0x0)),d=new Uint8Array(c['length']+b['length']);return d['set'](c),d['set'](b,c['length']),blake2b(d,{'dkLen':0x20});}
@@ -1,12 +1 @@
1
- export { normalizedTypeToMoveTypeSignature, getPureBcsSchema, } from "./serializer.js";
2
- export { Inputs } from "./Inputs.js";
3
- export { Commands, UpgradePolicy, } from "./Commands.js";
4
- export { Transaction, isTransaction, } from "./Transaction.js";
5
- export { TransactionDataBuilder } from "./TransactionData.js";
6
- export { ObjectCache, AsyncCache } from "./ObjectCache.js";
7
- export { SerialTransactionExecutor } from "./executor/serial.js";
8
- export { ParallelTransactionExecutor } from "./executor/parallel.js";
9
- export { coinWithBalance } from "./intents/CoinWithBalance.js";
10
- export { Arguments } from "./Arguments.js";
11
- export { namedPackagesPlugin, } from "./plugins/NamedPackagesPlugin.js";
12
- export { isArgument } from "./utils.js";
1
+ export{normalizedTypeToMoveTypeSignature,getPureBcsSchema}from'./serializer.js';export{Inputs}from'./Inputs.js';export{Commands,UpgradePolicy}from'./Commands.js';export{Transaction,isTransaction}from'./Transaction.js';export{TransactionDataBuilder}from'./TransactionData.js';export{ObjectCache,AsyncCache}from'./ObjectCache.js';export{SerialTransactionExecutor}from'./executor/serial.js';export{ParallelTransactionExecutor}from'./executor/parallel.js';export{coinWithBalance}from'./intents/CoinWithBalance.js';export{Arguments}from'./Arguments.js';export{namedPackagesPlugin}from'./plugins/NamedPackagesPlugin.js';export{isArgument}from'./utils.js';