wowok 1.8.3 → 2.1.10

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 (893) hide show
  1. package/NOTICE +46 -0
  2. package/README.md +4 -33
  3. package/dist/cjs/bcs/bcs.d.ts +1973 -0
  4. package/dist/cjs/bcs/bcs.js +327 -0
  5. package/dist/cjs/bcs/effects.d.ts +579 -0
  6. package/dist/cjs/bcs/effects.js +231 -0
  7. package/dist/cjs/bcs/index.d.ts +2589 -0
  8. package/dist/cjs/bcs/index.js +79 -0
  9. package/dist/cjs/bcs/pure.d.ts +22 -0
  10. package/dist/cjs/bcs/pure.js +62 -0
  11. package/dist/cjs/bcs/type-tag-serializer.d.ts +7 -0
  12. package/dist/cjs/bcs/type-tag-serializer.js +124 -0
  13. package/dist/cjs/bcs/types.d.ts +114 -0
  14. package/dist/cjs/bcs/types.js +26 -0
  15. package/dist/cjs/client/index.d.ts +5 -0
  16. package/dist/cjs/client/index.js +34 -0
  17. package/dist/cjs/client/network.d.ts +5 -0
  18. package/dist/cjs/client/network.js +43 -0
  19. package/dist/cjs/cryptography/index.d.ts +7 -0
  20. package/dist/cjs/cryptography/index.js +46 -0
  21. package/dist/cjs/cryptography/intent.d.ts +6 -0
  22. package/dist/cjs/cryptography/intent.js +34 -0
  23. package/dist/cjs/cryptography/keypair.d.ts +73 -0
  24. package/dist/cjs/cryptography/keypair.js +125 -0
  25. package/dist/cjs/cryptography/mnemonics.d.ts +27 -0
  26. package/dist/cjs/cryptography/mnemonics.js +50 -0
  27. package/dist/cjs/cryptography/publickey.d.ts +67 -0
  28. package/dist/cjs/cryptography/publickey.js +142 -0
  29. package/dist/cjs/cryptography/signature-scheme.d.ts +24 -0
  30. package/dist/cjs/cryptography/signature-scheme.js +47 -0
  31. package/dist/cjs/cryptography/signature.d.ts +62 -0
  32. package/dist/cjs/cryptography/signature.js +71 -0
  33. package/dist/cjs/experimental/cache.d.ts +12 -0
  34. package/dist/cjs/experimental/client.d.ts +12 -0
  35. package/dist/cjs/experimental/core.d.ts +33 -0
  36. package/dist/cjs/experimental/errors.d.ts +8 -0
  37. package/dist/cjs/experimental/index.d.ts +7 -0
  38. package/dist/cjs/experimental/persistent-storage.d.ts +134 -0
  39. package/dist/cjs/experimental/persistent-storage.test.d.ts +5 -0
  40. package/dist/cjs/experimental/transports/utils.d.ts +3 -0
  41. package/dist/cjs/experimental/types.d.ts +367 -0
  42. package/dist/cjs/faucet/faucet.d.ts +66 -0
  43. package/dist/cjs/faucet/faucet.js +138 -0
  44. package/dist/cjs/faucet/index.d.ts +1 -0
  45. package/dist/cjs/faucet/index.js +29 -0
  46. package/dist/cjs/graphql/client.js +98 -0
  47. package/dist/cjs/graphql/core.js +506 -0
  48. package/dist/cjs/graphql/generated/2024.1/tada-env.js +13141 -0
  49. package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +11 -0
  50. package/dist/cjs/graphql/generated/2024.4/tada-env.js +13287 -0
  51. package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +11 -0
  52. package/dist/cjs/graphql/generated/latest/tada-env.js +12925 -0
  53. package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +11 -0
  54. package/dist/cjs/graphql/generated/queries.js +807 -0
  55. package/dist/cjs/graphql/index.js +25 -0
  56. package/dist/cjs/graphql/schemas/2024.1/index.js +28 -0
  57. package/dist/cjs/graphql/schemas/2024.4/index.js +28 -0
  58. package/dist/cjs/graphql/schemas/latest/index.js +28 -0
  59. package/dist/cjs/graphql/types.js +16 -0
  60. package/dist/cjs/grpc/client.d.ts +32 -0
  61. package/dist/cjs/grpc/client.js +64 -0
  62. package/dist/cjs/grpc/core.d.ts +28 -0
  63. package/dist/cjs/grpc/core.js +645 -0
  64. package/dist/cjs/grpc/index.d.ts +4 -0
  65. package/dist/cjs/grpc/index.js +26 -0
  66. package/dist/cjs/grpc/proto/google/protobuf/any.d.ts +173 -0
  67. package/dist/cjs/grpc/proto/google/protobuf/any.js +138 -0
  68. package/dist/cjs/grpc/proto/google/protobuf/duration.d.ts +104 -0
  69. package/dist/cjs/grpc/proto/google/protobuf/duration.js +94 -0
  70. package/dist/cjs/grpc/proto/google/protobuf/empty.d.ts +25 -0
  71. package/dist/cjs/grpc/proto/google/protobuf/empty.js +30 -0
  72. package/dist/cjs/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
  73. package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +77 -0
  74. package/dist/cjs/grpc/proto/google/protobuf/struct.d.ts +169 -0
  75. package/dist/cjs/grpc/proto/google/protobuf/struct.js +224 -0
  76. package/dist/cjs/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
  77. package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +134 -0
  78. package/dist/cjs/grpc/proto/google/rpc/error_details.d.ts +525 -0
  79. package/dist/cjs/grpc/proto/google/rpc/error_details.js +317 -0
  80. package/dist/cjs/grpc/proto/google/rpc/status.d.ts +46 -0
  81. package/dist/cjs/grpc/proto/google/rpc/status.js +52 -0
  82. package/dist/cjs/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
  83. package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +70 -0
  84. package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
  85. package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +52 -0
  86. package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
  87. package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +45 -0
  88. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
  89. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +77 -0
  90. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
  91. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +84 -0
  92. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
  93. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +170 -0
  94. package/dist/cjs/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
  95. package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +300 -0
  96. package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
  97. package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +87 -0
  98. package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
  99. package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +29 -0
  100. package/dist/cjs/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
  101. package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +86 -0
  102. package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
  103. package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +87 -0
  104. package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
  105. package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +519 -0
  106. package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
  107. package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +63 -0
  108. package/dist/cjs/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
  109. package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +85 -0
  110. package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
  111. package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +81 -0
  112. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
  113. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +122 -0
  114. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
  115. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +368 -0
  116. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
  117. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +485 -0
  118. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
  119. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +81 -0
  120. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
  121. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +241 -0
  122. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
  123. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +55 -0
  124. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
  125. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +141 -0
  126. package/dist/cjs/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
  127. package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +114 -0
  128. package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
  129. package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +53 -0
  130. package/dist/cjs/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
  131. package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +63 -0
  132. package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
  133. package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +61 -0
  134. package/dist/cjs/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
  135. package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +541 -0
  136. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
  137. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +33 -0
  138. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
  139. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +50 -0
  140. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
  141. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +90 -0
  142. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
  143. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +88 -0
  144. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
  145. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +546 -0
  146. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
  147. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +54 -0
  148. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
  149. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +65 -0
  150. package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
  151. package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +740 -0
  152. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
  153. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1005 -0
  154. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
  155. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +49 -0
  156. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
  157. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +177 -0
  158. package/dist/cjs/index.d.ts +25 -0
  159. package/dist/cjs/index.js +93 -0
  160. package/dist/cjs/jsonRpc/client.d.ts +261 -0
  161. package/dist/cjs/jsonRpc/client.js +747 -0
  162. package/dist/cjs/jsonRpc/core.d.ts +87 -0
  163. package/dist/cjs/jsonRpc/core.js +638 -0
  164. package/dist/cjs/jsonRpc/errors.d.ts +12 -0
  165. package/dist/cjs/jsonRpc/errors.js +65 -0
  166. package/dist/cjs/jsonRpc/http-transport.d.ts +42 -0
  167. package/dist/cjs/jsonRpc/http-transport.js +121 -0
  168. package/dist/cjs/jsonRpc/index.d.ts +4 -0
  169. package/dist/cjs/jsonRpc/index.js +31 -0
  170. package/dist/cjs/jsonRpc/json-rpc-resolver.d.ts +4 -0
  171. package/dist/cjs/jsonRpc/json-rpc-resolver.js +321 -0
  172. package/dist/cjs/jsonRpc/rpc-websocket-client.d.ts +43 -0
  173. package/dist/cjs/jsonRpc/rpc-websocket-client.js +220 -0
  174. package/dist/cjs/jsonRpc/types/chain.d.ts +99 -0
  175. package/dist/cjs/jsonRpc/types/chain.js +16 -0
  176. package/dist/cjs/jsonRpc/types/changes.d.ts +19 -0
  177. package/dist/cjs/jsonRpc/types/changes.js +16 -0
  178. package/dist/cjs/jsonRpc/types/coins.d.ts +6 -0
  179. package/dist/cjs/jsonRpc/types/coins.js +16 -0
  180. package/dist/cjs/jsonRpc/types/common.d.ts +2 -0
  181. package/dist/cjs/jsonRpc/types/common.js +16 -0
  182. package/dist/cjs/jsonRpc/types/generated.d.ts +1492 -0
  183. package/dist/cjs/jsonRpc/types/generated.js +16 -0
  184. package/dist/cjs/jsonRpc/types/index.d.ts +6 -0
  185. package/dist/cjs/jsonRpc/types/index.js +16 -0
  186. package/dist/cjs/jsonRpc/types/params.d.ts +656 -0
  187. package/dist/cjs/jsonRpc/types/params.js +16 -0
  188. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
  189. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +82 -0
  190. package/dist/cjs/keypairs/ed25519/index.d.ts +2 -0
  191. package/dist/cjs/keypairs/ed25519/index.js +27 -0
  192. package/dist/cjs/keypairs/ed25519/keypair.d.ts +74 -0
  193. package/dist/cjs/keypairs/ed25519/keypair.js +169 -0
  194. package/dist/cjs/keypairs/ed25519/publickey.d.ts +30 -0
  195. package/dist/cjs/keypairs/ed25519/publickey.js +90 -0
  196. package/dist/cjs/keypairs/index.d.ts +4 -0
  197. package/dist/cjs/keypairs/index.js +21 -0
  198. package/dist/cjs/keypairs/passkey/index.d.ts +3 -0
  199. package/dist/cjs/keypairs/passkey/index.js +28 -0
  200. package/dist/cjs/keypairs/passkey/keypair.d.ts +113 -0
  201. package/dist/cjs/keypairs/passkey/keypair.js +268 -0
  202. package/dist/cjs/keypairs/passkey/publickey.d.ts +72 -0
  203. package/dist/cjs/keypairs/passkey/publickey.js +175 -0
  204. package/dist/cjs/keypairs/passkey/types.d.ts +12 -0
  205. package/dist/cjs/keypairs/passkey/types.js +16 -0
  206. package/dist/cjs/keypairs/secp256k1/index.d.ts +2 -0
  207. package/dist/cjs/keypairs/secp256k1/index.js +27 -0
  208. package/dist/cjs/keypairs/secp256k1/keypair.d.ts +73 -0
  209. package/dist/cjs/keypairs/secp256k1/keypair.js +159 -0
  210. package/dist/cjs/keypairs/secp256k1/publickey.d.ts +30 -0
  211. package/dist/cjs/keypairs/secp256k1/publickey.js +95 -0
  212. package/dist/cjs/keypairs/secp256r1/index.d.ts +2 -0
  213. package/dist/cjs/keypairs/secp256r1/index.js +27 -0
  214. package/dist/cjs/keypairs/secp256r1/keypair.d.ts +73 -0
  215. package/dist/cjs/keypairs/secp256r1/keypair.js +155 -0
  216. package/dist/cjs/keypairs/secp256r1/publickey.d.ts +30 -0
  217. package/dist/cjs/keypairs/secp256r1/publickey.js +96 -0
  218. package/dist/cjs/multisig/index.d.ts +2 -0
  219. package/dist/cjs/multisig/index.js +27 -0
  220. package/dist/cjs/multisig/publickey.d.ts +79 -0
  221. package/dist/cjs/multisig/publickey.js +296 -0
  222. package/dist/cjs/multisig/signer.d.ts +20 -0
  223. package/dist/cjs/multisig/signer.js +114 -0
  224. package/dist/cjs/package.json +5 -0
  225. package/dist/cjs/transactions/Arguments.d.ts +57 -0
  226. package/dist/cjs/transactions/Arguments.js +36 -0
  227. package/dist/cjs/transactions/Commands.d.ts +57 -0
  228. package/dist/cjs/transactions/Commands.js +143 -0
  229. package/dist/cjs/transactions/Inputs.d.ts +22 -0
  230. package/dist/cjs/transactions/Inputs.js +87 -0
  231. package/dist/cjs/transactions/ObjectCache.d.ts +83 -0
  232. package/dist/cjs/transactions/ObjectCache.js +251 -0
  233. package/dist/cjs/transactions/Transaction.d.ts +710 -0
  234. package/dist/cjs/transactions/Transaction.js +742 -0
  235. package/dist/cjs/transactions/TransactionData.d.ts +73 -0
  236. package/dist/cjs/transactions/TransactionData.js +472 -0
  237. package/dist/cjs/transactions/__tests__/Transaction.test.d.ts +1 -0
  238. package/dist/cjs/transactions/__tests__/bcs.test.d.ts +1 -0
  239. package/dist/cjs/transactions/data/internal.d.ts +1010 -0
  240. package/dist/cjs/transactions/data/internal.js +230 -0
  241. package/dist/cjs/transactions/data/v1.d.ts +312 -0
  242. package/dist/cjs/transactions/data/v1.js +538 -0
  243. package/dist/cjs/transactions/data/v2.d.ts +153 -0
  244. package/dist/cjs/transactions/data/v2.js +124 -0
  245. package/dist/cjs/transactions/executor/caching.d.ts +31 -0
  246. package/dist/cjs/transactions/executor/caching.js +118 -0
  247. package/dist/cjs/transactions/executor/parallel.d.ts +37 -0
  248. package/dist/cjs/transactions/executor/parallel.js +395 -0
  249. package/dist/cjs/transactions/executor/queue.d.ts +11 -0
  250. package/dist/cjs/transactions/executor/queue.js +87 -0
  251. package/dist/cjs/transactions/executor/serial.d.ts +31 -0
  252. package/dist/cjs/transactions/executor/serial.js +136 -0
  253. package/dist/cjs/transactions/hash.d.ts +7 -0
  254. package/dist/cjs/transactions/hash.js +31 -0
  255. package/dist/cjs/transactions/index.d.ts +21 -0
  256. package/dist/cjs/transactions/index.js +50 -0
  257. package/dist/cjs/transactions/intents/CoinWithBalance.d.ts +9 -0
  258. package/dist/cjs/transactions/intents/CoinWithBalance.js +206 -0
  259. package/dist/cjs/transactions/object.d.ts +24 -0
  260. package/dist/cjs/transactions/object.js +116 -0
  261. package/dist/cjs/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
  262. package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +37 -0
  263. package/dist/cjs/transactions/pure.d.ts +20 -0
  264. package/dist/cjs/transactions/pure.js +64 -0
  265. package/dist/cjs/transactions/resolve.d.ts +13 -0
  266. package/dist/cjs/transactions/resolve.js +103 -0
  267. package/dist/cjs/transactions/serializer.d.ts +7 -0
  268. package/dist/cjs/transactions/serializer.js +189 -0
  269. package/dist/cjs/transactions/utils.d.ts +10 -0
  270. package/dist/cjs/transactions/utils.js +143 -0
  271. package/dist/cjs/utils/constants.d.ts +17 -0
  272. package/dist/cjs/utils/constants.js +57 -0
  273. package/dist/cjs/utils/derived-objects.d.ts +5 -0
  274. package/dist/cjs/utils/derived-objects.js +33 -0
  275. package/dist/cjs/utils/dynamic-fields.d.ts +2 -0
  276. package/dist/cjs/utils/dynamic-fields.js +40 -0
  277. package/dist/cjs/utils/format.d.ts +2 -0
  278. package/dist/cjs/utils/format.js +35 -0
  279. package/dist/cjs/utils/index.d.ts +8 -0
  280. package/dist/cjs/utils/index.js +65 -0
  281. package/dist/cjs/utils/move-registry.d.ts +6 -0
  282. package/dist/cjs/utils/move-registry.js +44 -0
  283. package/dist/cjs/utils/sui-types.d.ts +26 -0
  284. package/dist/cjs/utils/sui-types.js +90 -0
  285. package/dist/cjs/utils/suins.d.ts +2 -0
  286. package/dist/cjs/utils/suins.js +56 -0
  287. package/dist/cjs/verify/index.d.ts +1 -0
  288. package/dist/cjs/verify/index.js +28 -0
  289. package/dist/cjs/verify/verify.d.ts +16 -0
  290. package/dist/cjs/verify/verify.js +125 -0
  291. package/dist/cjs/version.d.ts +2 -0
  292. package/dist/cjs/version.js +26 -0
  293. package/dist/cjs/w/call/allocation.d.ts +35 -0
  294. package/dist/cjs/w/call/allocation.js +439 -0
  295. package/dist/cjs/w/call/arb.d.ts +17 -0
  296. package/dist/cjs/w/call/arb.js +149 -0
  297. package/dist/cjs/w/call/arbitration.d.ts +106 -0
  298. package/dist/cjs/w/call/arbitration.js +1623 -0
  299. package/dist/cjs/w/call/base.d.ts +42 -0
  300. package/dist/cjs/w/call/base.js +363 -0
  301. package/dist/cjs/w/call/contact.d.ts +45 -0
  302. package/dist/cjs/w/call/contact.js +479 -0
  303. package/dist/cjs/w/call/demand.d.ts +79 -0
  304. package/dist/cjs/w/call/demand.js +872 -0
  305. package/dist/cjs/w/call/entity.d.ts +33 -0
  306. package/dist/cjs/w/call/entity.js +230 -0
  307. package/dist/cjs/w/call/guard-ins.d.ts +32 -0
  308. package/dist/cjs/w/call/guard-ins.js +4396 -0
  309. package/dist/cjs/w/call/guard.d.ts +264 -0
  310. package/dist/cjs/w/call/guard.js +1203 -0
  311. package/dist/cjs/w/call/index.d.ts +37 -0
  312. package/dist/cjs/w/call/index.js +72 -0
  313. package/dist/cjs/w/call/machine.d.ts +124 -0
  314. package/dist/cjs/w/call/machine.js +1486 -0
  315. package/dist/cjs/w/call/order.d.ts +73 -0
  316. package/dist/cjs/w/call/order.js +485 -0
  317. package/dist/cjs/w/call/passport.d.ts +24 -0
  318. package/dist/cjs/w/call/passport.js +281 -0
  319. package/dist/cjs/w/call/payment.d.ts +27 -0
  320. package/dist/cjs/w/call/payment.js +241 -0
  321. package/dist/cjs/w/call/permission.d.ts +222 -0
  322. package/dist/cjs/w/call/permission.js +1368 -0
  323. package/dist/cjs/w/call/personal.d.ts +51 -0
  324. package/dist/cjs/w/call/personal.js +184 -0
  325. package/dist/cjs/w/call/progress.d.ts +94 -0
  326. package/dist/cjs/w/call/progress.js +833 -0
  327. package/dist/cjs/w/call/proof.d.ts +27 -0
  328. package/dist/cjs/w/call/proof.js +124 -0
  329. package/dist/cjs/w/call/repository.d.ts +97 -0
  330. package/dist/cjs/w/call/repository.js +1324 -0
  331. package/dist/cjs/w/call/resource.d.ts +27 -0
  332. package/dist/cjs/w/call/resource.js +149 -0
  333. package/dist/cjs/w/call/reward.d.ts +52 -0
  334. package/dist/cjs/w/call/reward.js +879 -0
  335. package/dist/cjs/w/call/service.d.ts +184 -0
  336. package/dist/cjs/w/call/service.js +2468 -0
  337. package/dist/cjs/w/call/treasury.d.ts +77 -0
  338. package/dist/cjs/w/call/treasury.js +1192 -0
  339. package/dist/cjs/w/call/util.d.ts +12 -0
  340. package/dist/cjs/w/call/util.js +661 -0
  341. package/dist/cjs/w/common.d.ts +359 -0
  342. package/dist/cjs/w/common.js +625 -0
  343. package/dist/cjs/w/exception.d.ts +82 -0
  344. package/dist/cjs/w/exception.js +604 -0
  345. package/dist/cjs/w/index.d.ts +8 -0
  346. package/dist/cjs/w/index.js +25 -0
  347. package/dist/cjs/w/local/.eslintrc.js +15 -0
  348. package/dist/cjs/w/local/account.d.ts +134 -0
  349. package/dist/cjs/w/local/account.js +770 -0
  350. package/dist/cjs/w/local/cache.d.ts +35 -0
  351. package/dist/cjs/w/local/cache.js +181 -0
  352. package/dist/cjs/w/local/config.d.ts +15 -0
  353. package/dist/cjs/w/local/config.js +83 -0
  354. package/dist/cjs/w/local/index.d.ts +193 -0
  355. package/dist/cjs/w/local/index.js +322 -0
  356. package/dist/cjs/w/local/local.d.ts +93 -0
  357. package/dist/cjs/w/local/local.js +673 -0
  358. package/dist/cjs/w/local/storage.d.ts +61 -0
  359. package/dist/cjs/w/local/storage.js +219 -0
  360. package/dist/cjs/w/local/token.d.ts +22 -0
  361. package/dist/cjs/w/local/token.js +182 -0
  362. package/dist/cjs/w/local/util.d.ts +5 -0
  363. package/dist/cjs/w/local/util.js +57 -0
  364. package/dist/cjs/w/local/wip.d.ts +218 -0
  365. package/dist/cjs/w/local/wip.js +911 -0
  366. package/dist/cjs/w/messenger/.eslintrc.js +15 -0
  367. package/dist/cjs/w/messenger/crypto.d.ts +269 -0
  368. package/dist/cjs/w/messenger/crypto.js +448 -0
  369. package/dist/cjs/w/messenger/index.d.ts +23 -0
  370. package/dist/cjs/w/messenger/index.js +37 -0
  371. package/dist/cjs/w/messenger/messenger-api.d.ts +225 -0
  372. package/dist/cjs/w/messenger/messenger-api.js +1247 -0
  373. package/dist/cjs/w/messenger/messenger-manager.d.ts +80 -0
  374. package/dist/cjs/w/messenger/messenger-manager.js +1143 -0
  375. package/dist/cjs/w/messenger/messenger.d.ts +231 -0
  376. package/dist/cjs/w/messenger/messenger.js +1512 -0
  377. package/dist/cjs/w/messenger/server.d.ts +134 -0
  378. package/dist/cjs/w/messenger/server.js +535 -0
  379. package/dist/cjs/w/messenger/session.d.ts +78 -0
  380. package/dist/cjs/w/messenger/session.js +418 -0
  381. package/dist/cjs/w/messenger/storage.d.ts +192 -0
  382. package/dist/cjs/w/messenger/storage.js +964 -0
  383. package/dist/cjs/w/messenger/types.d.ts +705 -0
  384. package/dist/cjs/w/messenger/types.js +107 -0
  385. package/dist/cjs/w/messenger/utils.d.ts +15 -0
  386. package/dist/cjs/w/messenger/utils.js +37 -0
  387. package/dist/cjs/w/query/bult-in.d.ts +73 -0
  388. package/dist/cjs/w/query/bult-in.js +121 -0
  389. package/dist/cjs/w/query/event.d.ts +82 -0
  390. package/dist/cjs/w/query/event.js +157 -0
  391. package/dist/cjs/w/query/index.d.ts +5 -0
  392. package/dist/cjs/w/query/index.js +22 -0
  393. package/dist/cjs/w/query/object.d.ts +658 -0
  394. package/dist/cjs/w/query/object.js +1671 -0
  395. package/dist/cjs/w/query/received.d.ts +34 -0
  396. package/dist/cjs/w/query/received.js +93 -0
  397. package/dist/cjs/w/query/util.d.ts +5 -0
  398. package/dist/cjs/w/query/util.js +82 -0
  399. package/dist/cjs/w/util.d.ts +19 -0
  400. package/dist/cjs/w/util.js +715 -0
  401. package/dist/cjs/zklogin/address.js +93 -0
  402. package/dist/cjs/zklogin/bcs.js +41 -0
  403. package/dist/cjs/zklogin/index.js +45 -0
  404. package/dist/cjs/zklogin/jwt-decode.js +88 -0
  405. package/dist/cjs/zklogin/jwt-utils.js +128 -0
  406. package/dist/cjs/zklogin/nonce.js +60 -0
  407. package/dist/cjs/zklogin/poseidon.js +64 -0
  408. package/dist/cjs/zklogin/publickey.js +281 -0
  409. package/dist/cjs/zklogin/signature.js +57 -0
  410. package/dist/cjs/zklogin/utils.js +98 -0
  411. package/dist/esm/bcs/bcs.d.ts +1973 -0
  412. package/dist/esm/bcs/bcs.js +319 -0
  413. package/dist/esm/bcs/effects.d.ts +579 -0
  414. package/dist/esm/bcs/effects.js +211 -0
  415. package/dist/esm/bcs/index.d.ts +2589 -0
  416. package/dist/esm/bcs/index.js +98 -0
  417. package/dist/esm/bcs/pure.d.ts +22 -0
  418. package/dist/esm/bcs/pure.js +42 -0
  419. package/dist/esm/bcs/type-tag-serializer.d.ts +7 -0
  420. package/dist/esm/bcs/type-tag-serializer.js +104 -0
  421. package/dist/esm/bcs/types.d.ts +114 -0
  422. package/dist/esm/bcs/types.js +6 -0
  423. package/dist/esm/client/index.d.ts +5 -0
  424. package/dist/esm/client/index.js +23 -0
  425. package/dist/esm/client/network.d.ts +5 -0
  426. package/dist/esm/client/network.js +23 -0
  427. package/dist/esm/cryptography/index.d.ts +7 -0
  428. package/dist/esm/cryptography/index.js +46 -0
  429. package/dist/esm/cryptography/intent.d.ts +6 -0
  430. package/dist/esm/cryptography/intent.js +14 -0
  431. package/dist/esm/cryptography/keypair.d.ts +73 -0
  432. package/dist/esm/cryptography/keypair.js +108 -0
  433. package/dist/esm/cryptography/mnemonics.d.ts +27 -0
  434. package/dist/esm/cryptography/mnemonics.js +30 -0
  435. package/dist/esm/cryptography/publickey.d.ts +67 -0
  436. package/dist/esm/cryptography/publickey.js +125 -0
  437. package/dist/esm/cryptography/signature-scheme.d.ts +24 -0
  438. package/dist/esm/cryptography/signature-scheme.js +27 -0
  439. package/dist/esm/cryptography/signature.d.ts +62 -0
  440. package/dist/esm/cryptography/signature.js +54 -0
  441. package/dist/esm/experimental/cache.d.ts +12 -0
  442. package/dist/esm/experimental/client.d.ts +12 -0
  443. package/dist/esm/experimental/core.d.ts +33 -0
  444. package/dist/esm/experimental/errors.d.ts +8 -0
  445. package/dist/esm/experimental/index.d.ts +7 -0
  446. package/dist/esm/experimental/persistent-storage.d.ts +134 -0
  447. package/dist/esm/experimental/persistent-storage.test.d.ts +5 -0
  448. package/dist/esm/experimental/transports/utils.d.ts +3 -0
  449. package/dist/esm/experimental/types.d.ts +367 -0
  450. package/dist/esm/faucet/faucet.d.ts +66 -0
  451. package/dist/esm/faucet/faucet.js +118 -0
  452. package/dist/esm/faucet/index.d.ts +1 -0
  453. package/dist/esm/faucet/index.js +16 -0
  454. package/dist/esm/graphql/client.js +79 -0
  455. package/dist/esm/graphql/core.js +505 -0
  456. package/dist/esm/graphql/generated/2024.1/tada-env.js +13121 -0
  457. package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +16 -0
  458. package/dist/esm/graphql/generated/2024.4/tada-env.js +13267 -0
  459. package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +16 -0
  460. package/dist/esm/graphql/generated/latest/tada-env.js +12905 -0
  461. package/dist/esm/graphql/generated/latest/tsconfig.tada.js +16 -0
  462. package/dist/esm/graphql/generated/queries.js +788 -0
  463. package/dist/esm/graphql/index.js +8 -0
  464. package/dist/esm/graphql/schemas/2024.1/index.js +8 -0
  465. package/dist/esm/graphql/schemas/2024.4/index.js +8 -0
  466. package/dist/esm/graphql/schemas/latest/index.js +8 -0
  467. package/dist/esm/graphql/types.js +0 -0
  468. package/dist/esm/grpc/client.d.ts +32 -0
  469. package/dist/esm/grpc/client.js +45 -0
  470. package/dist/esm/grpc/core.d.ts +28 -0
  471. package/dist/esm/grpc/core.js +634 -0
  472. package/dist/esm/grpc/index.d.ts +4 -0
  473. package/dist/esm/grpc/index.js +6 -0
  474. package/dist/esm/grpc/proto/google/protobuf/any.d.ts +173 -0
  475. package/dist/esm/grpc/proto/google/protobuf/any.js +118 -0
  476. package/dist/esm/grpc/proto/google/protobuf/duration.d.ts +104 -0
  477. package/dist/esm/grpc/proto/google/protobuf/duration.js +74 -0
  478. package/dist/esm/grpc/proto/google/protobuf/empty.d.ts +25 -0
  479. package/dist/esm/grpc/proto/google/protobuf/empty.js +10 -0
  480. package/dist/esm/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
  481. package/dist/esm/grpc/proto/google/protobuf/field_mask.js +57 -0
  482. package/dist/esm/grpc/proto/google/protobuf/struct.d.ts +169 -0
  483. package/dist/esm/grpc/proto/google/protobuf/struct.js +204 -0
  484. package/dist/esm/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
  485. package/dist/esm/grpc/proto/google/protobuf/timestamp.js +114 -0
  486. package/dist/esm/grpc/proto/google/rpc/error_details.d.ts +525 -0
  487. package/dist/esm/grpc/proto/google/rpc/error_details.js +297 -0
  488. package/dist/esm/grpc/proto/google/rpc/status.d.ts +46 -0
  489. package/dist/esm/grpc/proto/google/rpc/status.js +32 -0
  490. package/dist/esm/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
  491. package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +50 -0
  492. package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
  493. package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +32 -0
  494. package/dist/esm/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
  495. package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +25 -0
  496. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
  497. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +57 -0
  498. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
  499. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +64 -0
  500. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
  501. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +150 -0
  502. package/dist/esm/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
  503. package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +280 -0
  504. package/dist/esm/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
  505. package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +67 -0
  506. package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
  507. package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +9 -0
  508. package/dist/esm/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
  509. package/dist/esm/grpc/proto/sui/rpc/v2/event.js +66 -0
  510. package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
  511. package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +67 -0
  512. package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
  513. package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +499 -0
  514. package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
  515. package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +43 -0
  516. package/dist/esm/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
  517. package/dist/esm/grpc/proto/sui/rpc/v2/input.js +65 -0
  518. package/dist/esm/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
  519. package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +61 -0
  520. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
  521. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +103 -0
  522. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
  523. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +348 -0
  524. package/dist/esm/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
  525. package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +465 -0
  526. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
  527. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +62 -0
  528. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
  529. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +221 -0
  530. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
  531. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +36 -0
  532. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
  533. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +121 -0
  534. package/dist/esm/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
  535. package/dist/esm/grpc/proto/sui/rpc/v2/object.js +94 -0
  536. package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
  537. package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +33 -0
  538. package/dist/esm/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
  539. package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +43 -0
  540. package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
  541. package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +41 -0
  542. package/dist/esm/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
  543. package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +521 -0
  544. package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
  545. package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +13 -0
  546. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
  547. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +31 -0
  548. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
  549. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +70 -0
  550. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
  551. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +69 -0
  552. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
  553. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +526 -0
  554. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
  555. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +35 -0
  556. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
  557. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +45 -0
  558. package/dist/esm/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
  559. package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +720 -0
  560. package/dist/esm/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
  561. package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +985 -0
  562. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
  563. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +30 -0
  564. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
  565. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +157 -0
  566. package/dist/esm/index.d.ts +25 -0
  567. package/dist/esm/index.js +119 -0
  568. package/dist/esm/jsonRpc/client.d.ts +261 -0
  569. package/dist/esm/jsonRpc/client.js +734 -0
  570. package/dist/esm/jsonRpc/core.d.ts +87 -0
  571. package/dist/esm/jsonRpc/core.js +621 -0
  572. package/dist/esm/jsonRpc/errors.d.ts +12 -0
  573. package/dist/esm/jsonRpc/errors.js +46 -0
  574. package/dist/esm/jsonRpc/http-transport.d.ts +42 -0
  575. package/dist/esm/jsonRpc/http-transport.js +101 -0
  576. package/dist/esm/jsonRpc/index.d.ts +4 -0
  577. package/dist/esm/jsonRpc/index.js +20 -0
  578. package/dist/esm/jsonRpc/json-rpc-resolver.d.ts +4 -0
  579. package/dist/esm/jsonRpc/json-rpc-resolver.js +309 -0
  580. package/dist/esm/jsonRpc/rpc-websocket-client.d.ts +43 -0
  581. package/dist/esm/jsonRpc/rpc-websocket-client.js +201 -0
  582. package/dist/esm/jsonRpc/types/chain.d.ts +99 -0
  583. package/dist/esm/jsonRpc/types/chain.js +0 -0
  584. package/dist/esm/jsonRpc/types/changes.d.ts +19 -0
  585. package/dist/esm/jsonRpc/types/changes.js +0 -0
  586. package/dist/esm/jsonRpc/types/coins.d.ts +6 -0
  587. package/dist/esm/jsonRpc/types/coins.js +0 -0
  588. package/dist/esm/jsonRpc/types/common.d.ts +2 -0
  589. package/dist/esm/jsonRpc/types/common.js +0 -0
  590. package/dist/esm/jsonRpc/types/generated.d.ts +1492 -0
  591. package/dist/esm/jsonRpc/types/generated.js +0 -0
  592. package/dist/esm/jsonRpc/types/index.d.ts +6 -0
  593. package/dist/esm/jsonRpc/types/index.js +0 -0
  594. package/dist/esm/jsonRpc/types/params.d.ts +656 -0
  595. package/dist/esm/jsonRpc/types/params.js +0 -0
  596. package/dist/esm/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
  597. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +62 -0
  598. package/dist/esm/keypairs/ed25519/index.d.ts +2 -0
  599. package/dist/esm/keypairs/ed25519/index.js +10 -0
  600. package/dist/esm/keypairs/ed25519/keypair.d.ts +74 -0
  601. package/dist/esm/keypairs/ed25519/keypair.js +158 -0
  602. package/dist/esm/keypairs/ed25519/publickey.d.ts +30 -0
  603. package/dist/esm/keypairs/ed25519/publickey.js +75 -0
  604. package/dist/esm/keypairs/index.d.ts +4 -0
  605. package/dist/esm/keypairs/index.js +4 -0
  606. package/dist/esm/keypairs/passkey/index.d.ts +3 -0
  607. package/dist/esm/keypairs/passkey/index.js +12 -0
  608. package/dist/esm/keypairs/passkey/keypair.d.ts +113 -0
  609. package/dist/esm/keypairs/passkey/keypair.js +258 -0
  610. package/dist/esm/keypairs/passkey/publickey.d.ts +72 -0
  611. package/dist/esm/keypairs/passkey/publickey.js +156 -0
  612. package/dist/esm/keypairs/passkey/types.d.ts +12 -0
  613. package/dist/esm/keypairs/passkey/types.js +0 -0
  614. package/dist/esm/keypairs/secp256k1/index.d.ts +2 -0
  615. package/dist/esm/keypairs/secp256k1/index.js +10 -0
  616. package/dist/esm/keypairs/secp256k1/keypair.d.ts +73 -0
  617. package/dist/esm/keypairs/secp256k1/keypair.js +147 -0
  618. package/dist/esm/keypairs/secp256k1/publickey.d.ts +30 -0
  619. package/dist/esm/keypairs/secp256k1/publickey.js +80 -0
  620. package/dist/esm/keypairs/secp256r1/index.d.ts +2 -0
  621. package/dist/esm/keypairs/secp256r1/index.js +10 -0
  622. package/dist/esm/keypairs/secp256r1/keypair.d.ts +73 -0
  623. package/dist/esm/keypairs/secp256r1/keypair.js +143 -0
  624. package/dist/esm/keypairs/secp256r1/publickey.d.ts +30 -0
  625. package/dist/esm/keypairs/secp256r1/publickey.js +77 -0
  626. package/dist/esm/multisig/index.d.ts +2 -0
  627. package/dist/esm/multisig/index.js +10 -0
  628. package/dist/esm/multisig/publickey.d.ts +79 -0
  629. package/dist/esm/multisig/publickey.js +280 -0
  630. package/dist/esm/multisig/signer.d.ts +20 -0
  631. package/dist/esm/multisig/signer.js +94 -0
  632. package/dist/esm/package.json +5 -0
  633. package/dist/esm/transactions/Arguments.d.ts +57 -0
  634. package/dist/esm/transactions/Arguments.js +16 -0
  635. package/dist/esm/transactions/Commands.d.ts +57 -0
  636. package/dist/esm/transactions/Commands.js +123 -0
  637. package/dist/esm/transactions/Inputs.d.ts +22 -0
  638. package/dist/esm/transactions/Inputs.js +67 -0
  639. package/dist/esm/transactions/ObjectCache.d.ts +83 -0
  640. package/dist/esm/transactions/ObjectCache.js +231 -0
  641. package/dist/esm/transactions/Transaction.d.ts +710 -0
  642. package/dist/esm/transactions/Transaction.js +731 -0
  643. package/dist/esm/transactions/TransactionData.d.ts +73 -0
  644. package/dist/esm/transactions/TransactionData.js +453 -0
  645. package/dist/esm/transactions/__tests__/Transaction.test.d.ts +1 -0
  646. package/dist/esm/transactions/__tests__/bcs.test.d.ts +1 -0
  647. package/dist/esm/transactions/data/internal.d.ts +1010 -0
  648. package/dist/esm/transactions/data/internal.js +232 -0
  649. package/dist/esm/transactions/data/v1.d.ts +312 -0
  650. package/dist/esm/transactions/data/v1.js +542 -0
  651. package/dist/esm/transactions/data/v2.d.ts +153 -0
  652. package/dist/esm/transactions/data/v2.js +126 -0
  653. package/dist/esm/transactions/executor/caching.d.ts +31 -0
  654. package/dist/esm/transactions/executor/caching.js +99 -0
  655. package/dist/esm/transactions/executor/parallel.d.ts +37 -0
  656. package/dist/esm/transactions/executor/parallel.js +375 -0
  657. package/dist/esm/transactions/executor/queue.d.ts +11 -0
  658. package/dist/esm/transactions/executor/queue.js +68 -0
  659. package/dist/esm/transactions/executor/serial.d.ts +31 -0
  660. package/dist/esm/transactions/executor/serial.js +116 -0
  661. package/dist/esm/transactions/hash.d.ts +7 -0
  662. package/dist/esm/transactions/hash.js +11 -0
  663. package/dist/esm/transactions/index.d.ts +21 -0
  664. package/dist/esm/transactions/index.js +41 -0
  665. package/dist/esm/transactions/intents/CoinWithBalance.d.ts +9 -0
  666. package/dist/esm/transactions/intents/CoinWithBalance.js +186 -0
  667. package/dist/esm/transactions/object.d.ts +24 -0
  668. package/dist/esm/transactions/object.js +96 -0
  669. package/dist/esm/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
  670. package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +17 -0
  671. package/dist/esm/transactions/pure.d.ts +20 -0
  672. package/dist/esm/transactions/pure.js +44 -0
  673. package/dist/esm/transactions/resolve.d.ts +13 -0
  674. package/dist/esm/transactions/resolve.js +83 -0
  675. package/dist/esm/transactions/serializer.d.ts +7 -0
  676. package/dist/esm/transactions/serializer.js +169 -0
  677. package/dist/esm/transactions/utils.d.ts +10 -0
  678. package/dist/esm/transactions/utils.js +123 -0
  679. package/dist/esm/utils/constants.d.ts +17 -0
  680. package/dist/esm/utils/constants.js +37 -0
  681. package/dist/esm/utils/derived-objects.d.ts +5 -0
  682. package/dist/esm/utils/derived-objects.js +13 -0
  683. package/dist/esm/utils/dynamic-fields.d.ts +2 -0
  684. package/dist/esm/utils/dynamic-fields.js +20 -0
  685. package/dist/esm/utils/format.d.ts +2 -0
  686. package/dist/esm/utils/format.js +15 -0
  687. package/dist/esm/utils/index.d.ts +8 -0
  688. package/dist/esm/utils/index.js +76 -0
  689. package/dist/esm/utils/move-registry.d.ts +6 -0
  690. package/dist/esm/utils/move-registry.js +24 -0
  691. package/dist/esm/utils/sui-types.d.ts +26 -0
  692. package/dist/esm/utils/sui-types.js +70 -0
  693. package/dist/esm/utils/suins.d.ts +2 -0
  694. package/dist/esm/utils/suins.js +36 -0
  695. package/dist/esm/verify/index.d.ts +1 -0
  696. package/dist/esm/verify/index.js +14 -0
  697. package/dist/esm/verify/verify.d.ts +16 -0
  698. package/dist/esm/verify/verify.js +108 -0
  699. package/dist/esm/version.d.ts +2 -0
  700. package/dist/esm/version.js +6 -0
  701. package/dist/esm/w/call/allocation.d.ts +35 -0
  702. package/dist/esm/w/call/allocation.js +433 -0
  703. package/dist/esm/w/call/arb.d.ts +17 -0
  704. package/dist/esm/w/call/arb.js +138 -0
  705. package/dist/esm/w/call/arbitration.d.ts +106 -0
  706. package/dist/esm/w/call/arbitration.js +1620 -0
  707. package/dist/esm/w/call/base.d.ts +42 -0
  708. package/dist/esm/w/call/base.js +350 -0
  709. package/dist/esm/w/call/contact.d.ts +45 -0
  710. package/dist/esm/w/call/contact.js +474 -0
  711. package/dist/esm/w/call/demand.d.ts +79 -0
  712. package/dist/esm/w/call/demand.js +869 -0
  713. package/dist/esm/w/call/entity.d.ts +33 -0
  714. package/dist/esm/w/call/entity.js +220 -0
  715. package/dist/esm/w/call/guard-ins.d.ts +32 -0
  716. package/dist/esm/w/call/guard-ins.js +4376 -0
  717. package/dist/esm/w/call/guard.d.ts +264 -0
  718. package/dist/esm/w/call/guard.js +1195 -0
  719. package/dist/esm/w/call/index.d.ts +37 -0
  720. package/dist/esm/w/call/index.js +59 -0
  721. package/dist/esm/w/call/machine.d.ts +124 -0
  722. package/dist/esm/w/call/machine.js +1492 -0
  723. package/dist/esm/w/call/order.d.ts +73 -0
  724. package/dist/esm/w/call/order.js +481 -0
  725. package/dist/esm/w/call/passport.d.ts +24 -0
  726. package/dist/esm/w/call/passport.js +266 -0
  727. package/dist/esm/w/call/payment.d.ts +27 -0
  728. package/dist/esm/w/call/payment.js +233 -0
  729. package/dist/esm/w/call/permission.d.ts +222 -0
  730. package/dist/esm/w/call/permission.js +1375 -0
  731. package/dist/esm/w/call/personal.d.ts +51 -0
  732. package/dist/esm/w/call/personal.js +177 -0
  733. package/dist/esm/w/call/progress.d.ts +94 -0
  734. package/dist/esm/w/call/progress.js +827 -0
  735. package/dist/esm/w/call/proof.d.ts +27 -0
  736. package/dist/esm/w/call/proof.js +110 -0
  737. package/dist/esm/w/call/repository.d.ts +97 -0
  738. package/dist/esm/w/call/repository.js +1325 -0
  739. package/dist/esm/w/call/resource.d.ts +27 -0
  740. package/dist/esm/w/call/resource.js +135 -0
  741. package/dist/esm/w/call/reward.d.ts +52 -0
  742. package/dist/esm/w/call/reward.js +874 -0
  743. package/dist/esm/w/call/service.d.ts +184 -0
  744. package/dist/esm/w/call/service.js +2472 -0
  745. package/dist/esm/w/call/treasury.d.ts +77 -0
  746. package/dist/esm/w/call/treasury.js +1186 -0
  747. package/dist/esm/w/call/util.d.ts +12 -0
  748. package/dist/esm/w/call/util.js +646 -0
  749. package/dist/esm/w/common.d.ts +359 -0
  750. package/dist/esm/w/common.js +605 -0
  751. package/dist/esm/w/exception.d.ts +82 -0
  752. package/dist/esm/w/exception.js +585 -0
  753. package/dist/esm/w/index.d.ts +8 -0
  754. package/dist/esm/w/index.js +8 -0
  755. package/dist/esm/w/local/.eslintrc.js +23 -0
  756. package/dist/esm/w/local/account.d.ts +134 -0
  757. package/dist/esm/w/local/account.js +746 -0
  758. package/dist/esm/w/local/cache.d.ts +35 -0
  759. package/dist/esm/w/local/cache.js +162 -0
  760. package/dist/esm/w/local/config.d.ts +15 -0
  761. package/dist/esm/w/local/config.js +64 -0
  762. package/dist/esm/w/local/index.d.ts +193 -0
  763. package/dist/esm/w/local/index.js +301 -0
  764. package/dist/esm/w/local/local.d.ts +93 -0
  765. package/dist/esm/w/local/local.js +654 -0
  766. package/dist/esm/w/local/storage.d.ts +61 -0
  767. package/dist/esm/w/local/storage.js +190 -0
  768. package/dist/esm/w/local/token.d.ts +22 -0
  769. package/dist/esm/w/local/token.js +163 -0
  770. package/dist/esm/w/local/util.d.ts +5 -0
  771. package/dist/esm/w/local/util.js +27 -0
  772. package/dist/esm/w/local/wip.d.ts +218 -0
  773. package/dist/esm/w/local/wip.js +882 -0
  774. package/dist/esm/w/messenger/.eslintrc.js +23 -0
  775. package/dist/esm/w/messenger/crypto.d.ts +269 -0
  776. package/dist/esm/w/messenger/crypto.js +428 -0
  777. package/dist/esm/w/messenger/index.d.ts +23 -0
  778. package/dist/esm/w/messenger/index.js +25 -0
  779. package/dist/esm/w/messenger/messenger-api.d.ts +225 -0
  780. package/dist/esm/w/messenger/messenger-api.js +1228 -0
  781. package/dist/esm/w/messenger/messenger-manager.d.ts +80 -0
  782. package/dist/esm/w/messenger/messenger-manager.js +1118 -0
  783. package/dist/esm/w/messenger/messenger.d.ts +231 -0
  784. package/dist/esm/w/messenger/messenger.js +1492 -0
  785. package/dist/esm/w/messenger/server.d.ts +134 -0
  786. package/dist/esm/w/messenger/server.js +520 -0
  787. package/dist/esm/w/messenger/session.d.ts +78 -0
  788. package/dist/esm/w/messenger/session.js +415 -0
  789. package/dist/esm/w/messenger/storage.d.ts +192 -0
  790. package/dist/esm/w/messenger/storage.js +935 -0
  791. package/dist/esm/w/messenger/types.d.ts +705 -0
  792. package/dist/esm/w/messenger/types.js +88 -0
  793. package/dist/esm/w/messenger/utils.d.ts +15 -0
  794. package/dist/esm/w/messenger/utils.js +17 -0
  795. package/dist/esm/w/query/bult-in.d.ts +73 -0
  796. package/dist/esm/w/query/bult-in.js +112 -0
  797. package/dist/esm/w/query/event.d.ts +82 -0
  798. package/dist/esm/w/query/event.js +137 -0
  799. package/dist/esm/w/query/index.d.ts +5 -0
  800. package/dist/esm/w/query/index.js +5 -0
  801. package/dist/esm/w/query/object.d.ts +658 -0
  802. package/dist/esm/w/query/object.js +1648 -0
  803. package/dist/esm/w/query/received.d.ts +34 -0
  804. package/dist/esm/w/query/received.js +73 -0
  805. package/dist/esm/w/query/util.d.ts +5 -0
  806. package/dist/esm/w/query/util.js +62 -0
  807. package/dist/esm/w/util.d.ts +19 -0
  808. package/dist/esm/w/util.js +710 -0
  809. package/dist/esm/zklogin/address.js +78 -0
  810. package/dist/esm/zklogin/bcs.js +21 -0
  811. package/dist/esm/zklogin/index.js +38 -0
  812. package/dist/esm/zklogin/jwt-decode.js +68 -0
  813. package/dist/esm/zklogin/jwt-utils.js +108 -0
  814. package/dist/esm/zklogin/nonce.js +40 -0
  815. package/dist/esm/zklogin/poseidon.js +61 -0
  816. package/dist/esm/zklogin/publickey.js +265 -0
  817. package/dist/esm/zklogin/signature.js +37 -0
  818. package/dist/esm/zklogin/utils.js +78 -0
  819. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  820. package/dist/tsconfig.tsbuildinfo +1 -0
  821. package/package.json +297 -61
  822. package/dist/arbitration.d.ts +0 -65
  823. package/dist/arbitration.d.ts.map +0 -1
  824. package/dist/arbitration.js +0 -517
  825. package/dist/arbitration.js.map +0 -1
  826. package/dist/demand.d.ts +0 -27
  827. package/dist/demand.d.ts.map +0 -1
  828. package/dist/demand.js +0 -266
  829. package/dist/demand.js.map +0 -1
  830. package/dist/entity.d.ts +0 -46
  831. package/dist/entity.d.ts.map +0 -1
  832. package/dist/entity.js +0 -146
  833. package/dist/entity.js.map +0 -1
  834. package/dist/exception.d.ts +0 -37
  835. package/dist/exception.d.ts.map +0 -1
  836. package/dist/exception.js +0 -41
  837. package/dist/exception.js.map +0 -1
  838. package/dist/guard.d.ts +0 -110
  839. package/dist/guard.d.ts.map +0 -1
  840. package/dist/guard.js +0 -936
  841. package/dist/guard.js.map +0 -1
  842. package/dist/index.d.ts +0 -40
  843. package/dist/index.d.ts.map +0 -1
  844. package/dist/index.js +0 -28
  845. package/dist/index.js.map +0 -1
  846. package/dist/machine.d.ts +0 -68
  847. package/dist/machine.d.ts.map +0 -1
  848. package/dist/machine.js +0 -520
  849. package/dist/machine.js.map +0 -1
  850. package/dist/passport.d.ts +0 -129
  851. package/dist/passport.d.ts.map +0 -1
  852. package/dist/passport.js +0 -1233
  853. package/dist/passport.js.map +0 -1
  854. package/dist/payment.d.ts +0 -28
  855. package/dist/payment.d.ts.map +0 -1
  856. package/dist/payment.js +0 -60
  857. package/dist/payment.js.map +0 -1
  858. package/dist/permission.d.ts +0 -155
  859. package/dist/permission.d.ts.map +0 -1
  860. package/dist/permission.js +0 -462
  861. package/dist/permission.js.map +0 -1
  862. package/dist/progress.d.ts +0 -66
  863. package/dist/progress.d.ts.map +0 -1
  864. package/dist/progress.js +0 -311
  865. package/dist/progress.js.map +0 -1
  866. package/dist/protocol.d.ts +0 -247
  867. package/dist/protocol.d.ts.map +0 -1
  868. package/dist/protocol.js +0 -726
  869. package/dist/protocol.js.map +0 -1
  870. package/dist/repository.d.ts +0 -95
  871. package/dist/repository.d.ts.map +0 -1
  872. package/dist/repository.js +0 -793
  873. package/dist/repository.js.map +0 -1
  874. package/dist/resource.d.ts +0 -36
  875. package/dist/resource.d.ts.map +0 -1
  876. package/dist/resource.js +0 -129
  877. package/dist/resource.js.map +0 -1
  878. package/dist/service.d.ts +0 -144
  879. package/dist/service.d.ts.map +0 -1
  880. package/dist/service.js +0 -1303
  881. package/dist/service.js.map +0 -1
  882. package/dist/treasury.d.ts +0 -55
  883. package/dist/treasury.d.ts.map +0 -1
  884. package/dist/treasury.js +0 -393
  885. package/dist/treasury.js.map +0 -1
  886. package/dist/utils.d.ts +0 -94
  887. package/dist/utils.d.ts.map +0 -1
  888. package/dist/utils.js +0 -582
  889. package/dist/utils.js.map +0 -1
  890. package/dist/wowok.d.ts +0 -15
  891. package/dist/wowok.d.ts.map +0 -1
  892. package/dist/wowok.js +0 -66
  893. package/dist/wowok.js.map +0 -1
@@ -0,0 +1,1203 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
31
+ var guard_exports = {};
32
+ __export(guard_exports, {
33
+ CallGuard: () => CallGuard,
34
+ create: () => create,
35
+ formatGuardParseErrors: () => formatGuardParseErrors,
36
+ gen_passport: () => gen_passport,
37
+ generateNodeComments: () => generateNodeComments,
38
+ guard2file: () => guard2file,
39
+ guardFn: () => guardFn,
40
+ newGuard: () => newGuard,
41
+ parseGuardFile: () => parseGuardFile,
42
+ parseGuardFromMarkdown: () => parseGuardFromMarkdown,
43
+ reliesAdd: () => reliesAdd,
44
+ reliesClear: () => reliesClear,
45
+ reliesLogic: () => reliesLogic,
46
+ reliesRemove: () => reliesRemove,
47
+ validateGuardNode: () => validateGuardNode
48
+ });
49
+ module.exports = __toCommonJS(guard_exports);
50
+ var import_common = require("../common.js");
51
+ var import_lodash = __toESM(require("lodash"));
52
+ var import_exception = require("../exception.js");
53
+ var import_base = require("./base.js");
54
+ var import_local = require("../local/local.js");
55
+ var import_object = require("../query/object.js");
56
+ var import_bcs = require("../../bcs/index.js");
57
+ var import_util = require("../util.js");
58
+ var import_guard_ins = require("./guard-ins.js");
59
+ var import_util2 = require("./util.js");
60
+ var import_sui_types = require("../../utils/sui-types.js");
61
+ var import_passport = require("./passport.js");
62
+ var import_fs = require("fs");
63
+ var import_path = require("path");
64
+ function guardFn(name) {
65
+ return `${import_common.PackageAddress}::guard::${name}`;
66
+ }
67
+ class CallGuard extends import_base.CallBase {
68
+ constructor(data) {
69
+ super();
70
+ __publicField(this, "data");
71
+ this.data = data;
72
+ }
73
+ async call(env) {
74
+ await this.prepare(env);
75
+ return await this.exec(env);
76
+ }
77
+ async operate(env, tx, _passport, _submission) {
78
+ if (!this.data.table || this.data.table.length === 0) {
79
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "table is empty");
80
+ }
81
+ if (!this.data.root) {
82
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "root is empty");
83
+ }
84
+ const guard = await newGuard(
85
+ tx,
86
+ this.data?.description || "",
87
+ this.data?.table,
88
+ this.data?.root
89
+ );
90
+ if (this.data?.rely != null) {
91
+ const relyGuards = await import_local.LocalMark.Instance().get_many_address(
92
+ this.data.rely.guards
93
+ );
94
+ const undefinedIndex = relyGuards.findIndex((v) => v === void 0);
95
+ if (undefinedIndex !== -1) {
96
+ (0, import_exception.W_ERROR)(
97
+ import_exception.WErrors.InvalidParam,
98
+ `rely.guards invalid: guard at index ${undefinedIndex} not found`
99
+ );
100
+ }
101
+ reliesAdd(
102
+ tx,
103
+ guard,
104
+ relyGuards.filter((v) => v !== void 0)
105
+ );
106
+ }
107
+ await this.new_with_mark(
108
+ env,
109
+ tx,
110
+ import_common.ObjectType.Guard,
111
+ create(tx, guard),
112
+ this.data?.namedNew
113
+ );
114
+ }
115
+ }
116
+ const newGuard = async (tx, description, table, root) => {
117
+ if (!(0, import_common.isValidDescription)(description)) {
118
+ (0, import_exception.W_ERROR)(
119
+ import_exception.WErrors.IsValidDescription,
120
+ `Description exceeds maximum length ${import_common.MAX_DESCRIPTION_LENGTH}`
121
+ );
122
+ }
123
+ for (let i = 0; i < table.length; i++) {
124
+ const v = table[i];
125
+ if (!(0, import_common.isValidU8)(v.identifier))
126
+ (0, import_exception.W_ERROR)(
127
+ import_exception.WErrors.InvalidParam,
128
+ `table.identifier ${v.identifier} invalid`
129
+ );
130
+ if (!v.b_submission && (v.value === void 0 || v.value === null))
131
+ (0, import_exception.W_ERROR)(
132
+ import_exception.WErrors.InvalidParam,
133
+ `table.value ${v.value} with identifier ${v.identifier} invalid`
134
+ );
135
+ if (!(0, import_common.isValidName)(v.name)) (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "table.name");
136
+ }
137
+ const grouped = import_lodash.default.groupBy(table, "identifier");
138
+ const duplicates = Object.keys(grouped).filter(
139
+ (key) => grouped[key].length > 1
140
+ );
141
+ if (duplicates.length > 0) {
142
+ (0, import_exception.W_ERROR)(
143
+ import_exception.WErrors.InvalidParam,
144
+ `table.identifier duplicates: ${duplicates.join(", ")}`
145
+ );
146
+ }
147
+ var output = [];
148
+ await buildNode(root, import_common.ValueType.Bool, table, output);
149
+ const totalLength = output.reduce((acc, arr) => acc + arr.length, 0);
150
+ const input = new Uint8Array(totalLength);
151
+ let offset = 0;
152
+ for (const arr of output) {
153
+ input.set(arr, offset);
154
+ offset += arr.length;
155
+ }
156
+ if (input.length > import_common.MAX_INPUT_SIZE) {
157
+ (0, import_exception.W_ERROR)(
158
+ import_exception.WErrors.NewGuardCheckFailed,
159
+ `Input size exceeds maximum limit ${import_common.MAX_INPUT_SIZE}`
160
+ );
161
+ }
162
+ if (input.length === 0) {
163
+ (0, import_exception.W_ERROR)(import_exception.WErrors.NewGuardCheckFailed, `Input cannot be empty`);
164
+ }
165
+ const tableItems = [];
166
+ for (let i = 0; i < table.length; i++) {
167
+ const item = table[i];
168
+ const valueType = (0, import_common.parseValueType)(item.value_type);
169
+ let bcsValue;
170
+ if (item.b_submission) {
171
+ bcsValue = new Uint8Array(1);
172
+ bcsValue[0] = valueType;
173
+ } else {
174
+ if (item.value === void 0 || item.value === null) {
175
+ (0, import_exception.W_ERROR)(
176
+ import_exception.WErrors.NewGuardCheckFailed,
177
+ `Table item value is required when b_submission is false`
178
+ );
179
+ }
180
+ bcsValue = await (0, import_util.valueToBcsBytes)(valueType, item.value);
181
+ }
182
+ tableItems.push(
183
+ tx.moveCall({
184
+ target: guardFn("table_item"),
185
+ arguments: [
186
+ tx.pure.u8(item.identifier),
187
+ tx.pure.bool(item.b_submission),
188
+ tx.pure.vector("u8", Array.from(bcsValue)),
189
+ (0, import_common.toTxString)(tx, item.name)
190
+ ]
191
+ })
192
+ );
193
+ }
194
+ return tx.moveCall({
195
+ target: guardFn("new"),
196
+ arguments: [
197
+ (0, import_common.toTxString)(tx, description),
198
+ tx.makeMoveVec({
199
+ elements: tableItems,
200
+ type: `${import_common.PackageAddress}::guard::TableItem`
201
+ }),
202
+ tx.pure.vector("u8", Array.from(input))
203
+ ]
204
+ });
205
+ };
206
+ function create(tx, guard) {
207
+ return tx.moveCall({
208
+ target: guardFn("create"),
209
+ arguments: [
210
+ (0, import_common.toTxObject)(tx, guard),
211
+ tx.object.mutRegistrar(),
212
+ tx.object.clock()
213
+ ]
214
+ });
215
+ }
216
+ function reliesAdd(tx, guard, rely_guards) {
217
+ const guards = import_lodash.default.uniq(rely_guards);
218
+ if (guards.length > import_common.MAX_DEPENDED_COUNT) {
219
+ (0, import_exception.W_ERROR)(
220
+ import_exception.WErrors.NewGuardCheckFailed,
221
+ `Relies count exceeds maximum limit ${import_common.MAX_DEPENDED_COUNT}`
222
+ );
223
+ }
224
+ guards.forEach((g) => {
225
+ if (g === guard) {
226
+ (0, import_exception.W_ERROR)(import_exception.WErrors.NewGuardCheckFailed, `Guard cannot rely on itself`);
227
+ }
228
+ tx.moveCall({
229
+ target: guardFn("relies_add"),
230
+ arguments: [
231
+ (0, import_common.toTxObject)(tx, guard),
232
+ (0, import_common.toTxObject)(tx, g),
233
+ tx.object.mutRegistrar(),
234
+ tx.object.clock()
235
+ ]
236
+ });
237
+ });
238
+ }
239
+ function reliesRemove(tx, guard, rely_guards) {
240
+ const guards = import_lodash.default.uniq(rely_guards);
241
+ if (guards.length > import_common.MAX_DEPENDED_COUNT) {
242
+ (0, import_exception.W_ERROR)(
243
+ import_exception.WErrors.NewGuardCheckFailed,
244
+ `Relies count exceeds maximum limit ${import_common.MAX_DEPENDED_COUNT}`
245
+ );
246
+ }
247
+ guards.forEach((g) => {
248
+ tx.moveCall({
249
+ target: guardFn("relies_remove"),
250
+ arguments: [
251
+ (0, import_common.toTxObject)(tx, guard),
252
+ (0, import_common.toTxObject)(tx, g),
253
+ tx.object.mutRegistrar()
254
+ ]
255
+ });
256
+ });
257
+ }
258
+ function reliesClear(tx, guard) {
259
+ tx.moveCall({
260
+ target: guardFn("relies_clear"),
261
+ arguments: [(0, import_common.toTxObject)(tx, guard), tx.object.mutRegistrar()]
262
+ });
263
+ }
264
+ function reliesLogic(tx, guard, logic_and) {
265
+ tx.moveCall({
266
+ target: guardFn("relies_logic_and"),
267
+ arguments: [(0, import_common.toTxObject)(tx, guard), tx.pure.bool(logic_and)]
268
+ });
269
+ }
270
+ const buildNode = async (guard_node, type_required, table, output) => {
271
+ const node = guard_node;
272
+ switch (node.type) {
273
+ case "identifier": {
274
+ const f = table.find((v) => v.identifier === node.identifier);
275
+ if (f) {
276
+ const fValueType = (0, import_common.parseValueType)(f.value_type);
277
+ (0, import_util2.checkType)(fValueType, type_required, node);
278
+ output.push(
279
+ import_bcs.bcs.U8.serialize(import_common.ContextType.TypeConstant).toBytes()
280
+ );
281
+ output.push(import_bcs.bcs.U8.serialize(node.identifier).toBytes());
282
+ } else {
283
+ (0, import_exception.W_ERROR)(
284
+ import_exception.WErrors.InvalidParam,
285
+ "node identifier - " + JSON.stringify(node)
286
+ );
287
+ }
288
+ break;
289
+ }
290
+ case "query": {
291
+ const q = (0, import_guard_ins.getGuardQueryInfo)(node.query);
292
+ if (!q) {
293
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, `query not found: ${node.query}`);
294
+ }
295
+ (0, import_util2.checkType)(q.return, type_required, node);
296
+ if (q.parameters.length === node.parameters.length) {
297
+ for (let i = node.parameters.length - 1; i >= 0; --i) {
298
+ await buildNode(
299
+ node.parameters[i],
300
+ q.parameters[i],
301
+ table,
302
+ output
303
+ );
304
+ }
305
+ } else {
306
+ (0, import_exception.W_ERROR)(
307
+ import_exception.WErrors.InvalidParam,
308
+ "node query parameters length not match - " + JSON.stringify(node)
309
+ );
310
+ }
311
+ const tableItem = table.find(
312
+ (v) => v.identifier === node.object.identifier
313
+ );
314
+ if (!tableItem) {
315
+ (0, import_exception.W_ERROR)(
316
+ import_exception.WErrors.InvalidParam,
317
+ "node object from identifier - " + JSON.stringify(node)
318
+ );
319
+ }
320
+ const tableItemValueType = (0, import_common.parseValueType)(tableItem.value_type);
321
+ if (tableItemValueType !== import_common.ValueType.Address) {
322
+ (0, import_exception.W_ERROR)(
323
+ import_exception.WErrors.InvalidParam,
324
+ `object to query must be address in table ${tableItem}. ${node.object}`
325
+ );
326
+ }
327
+ output.push(import_bcs.bcs.U8.serialize(import_common.OperatorType.TypeQuery).toBytes());
328
+ if ((0, import_common.isWitnessType)(node.object.convert_witness)) {
329
+ const target = (0, import_object.WitnessTargetType)(node.object.convert_witness);
330
+ if (target !== q.objectType) {
331
+ (0, import_exception.W_ERROR)(
332
+ import_exception.WErrors.InvalidParam,
333
+ `witness object type(${target}) not consistent with query object type(${q.objectType})`
334
+ );
335
+ }
336
+ const source = (0, import_object.WitnessSourceType)(node.object.convert_witness);
337
+ if (tableItem.object_type) {
338
+ if (tableItem.object_type !== source) {
339
+ (0, import_exception.W_ERROR)(
340
+ import_exception.WErrors.InvalidParam,
341
+ `witness object type(${source}) not consistent with query object type(${tableItem.object_type})`
342
+ );
343
+ }
344
+ } else {
345
+ tableItem.object_type = source;
346
+ }
347
+ output.push(
348
+ import_bcs.bcs.U8.serialize(node.object.convert_witness).toBytes()
349
+ );
350
+ } else {
351
+ if (tableItem?.object_type) {
352
+ if (tableItem.object_type !== q.objectType) {
353
+ (0, import_exception.W_ERROR)(
354
+ import_exception.WErrors.InvalidParam,
355
+ `witness object type(${q.objectType}) not consistent with query object type(${tableItem.object_type})`
356
+ );
357
+ }
358
+ } else {
359
+ tableItem.object_type = q.objectType;
360
+ }
361
+ output.push(
362
+ import_bcs.bcs.U8.serialize(import_common.ContextType.TypeConstant).toBytes()
363
+ );
364
+ }
365
+ output.push(import_bcs.bcs.U8.serialize(node.object.identifier).toBytes());
366
+ output.push(import_bcs.bcs.U16.serialize(q.id).toBytes());
367
+ break;
368
+ }
369
+ case "logic_as_u256_greater_or_equal":
370
+ case "logic_as_u256_lesser_or_equal":
371
+ case "logic_as_u256_equal":
372
+ case "logic_as_u256_greater":
373
+ case "logic_as_u256_lesser":
374
+ case "logic_equal":
375
+ case "logic_and":
376
+ case "logic_or":
377
+ case "logic_string_contains":
378
+ case "logic_string_nocase_contains":
379
+ case "logic_string_nocase_equal":
380
+ case "calc_number_add":
381
+ case "calc_number_subtract":
382
+ case "calc_number_multiply":
383
+ case "calc_number_divide":
384
+ case "calc_number_mod":
385
+ case "calc_string_nocase_contains":
386
+ case "calc_string_nocase_equal":
387
+ case "calc_string_contains": {
388
+ const opCodeMap = {
389
+ logic_as_u256_greater_or_equal: import_common.OperatorType.TypeLogicAsU256GreaterEqual,
390
+ logic_as_u256_lesser_or_equal: import_common.OperatorType.TypeLogicAsU256LesserEqual,
391
+ logic_as_u256_equal: import_common.OperatorType.TypeLogicAsU256Equal,
392
+ logic_as_u256_greater: import_common.OperatorType.TypeLogicAsU256Greater,
393
+ logic_as_u256_lesser: import_common.OperatorType.TypeLogicAsU256Lesser,
394
+ logic_equal: import_common.OperatorType.TypeLogicEqual,
395
+ logic_and: import_common.OperatorType.TypeLogicAnd,
396
+ logic_or: import_common.OperatorType.TypeLogicOr,
397
+ logic_string_contains: import_common.OperatorType.TypeStringContains,
398
+ logic_string_nocase_contains: import_common.OperatorType.TypeStringNocaseContains,
399
+ logic_string_nocase_equal: import_common.OperatorType.TypeStringNocaseEqual,
400
+ calc_number_add: import_common.OperatorType.TypeNumberAdd,
401
+ calc_number_subtract: import_common.OperatorType.TypeNumberSubtract,
402
+ calc_number_multiply: import_common.OperatorType.TypeNumberMultiply,
403
+ calc_number_divide: import_common.OperatorType.TypeNumberDivide,
404
+ calc_number_mod: import_common.OperatorType.TypeNumberMod,
405
+ calc_string_nocase_contains: import_common.OperatorType.TypeStringNocaseContains,
406
+ calc_string_nocase_equal: import_common.OperatorType.TypeStringNocaseEqual,
407
+ calc_string_contains: import_common.OperatorType.TypeStringContains
408
+ };
409
+ const requiredTypeMap = {
410
+ logic_as_u256_greater_or_equal: "number",
411
+ logic_as_u256_lesser_or_equal: "number",
412
+ logic_as_u256_equal: "number",
413
+ logic_as_u256_greater: "number",
414
+ logic_as_u256_lesser: "number",
415
+ logic_equal: "variable",
416
+ logic_and: import_common.ValueType.Bool,
417
+ logic_or: import_common.ValueType.Bool,
418
+ logic_string_contains: import_common.ValueType.String,
419
+ logic_string_nocase_contains: import_common.ValueType.String,
420
+ logic_string_nocase_equal: import_common.ValueType.String,
421
+ calc_number_add: "number",
422
+ calc_number_subtract: "number",
423
+ calc_number_multiply: "number",
424
+ calc_number_divide: "number",
425
+ calc_number_mod: "number",
426
+ calc_string_nocase_contains: import_common.ValueType.String,
427
+ calc_string_nocase_equal: import_common.ValueType.String,
428
+ calc_string_contains: import_common.ValueType.String
429
+ };
430
+ const returnTypeMap = {
431
+ logic_as_u256_greater_or_equal: import_common.ValueType.Bool,
432
+ logic_as_u256_lesser_or_equal: import_common.ValueType.Bool,
433
+ logic_as_u256_equal: import_common.ValueType.Bool,
434
+ logic_as_u256_greater: import_common.ValueType.Bool,
435
+ logic_as_u256_lesser: import_common.ValueType.Bool,
436
+ logic_equal: import_common.ValueType.Bool,
437
+ logic_and: import_common.ValueType.Bool,
438
+ logic_or: import_common.ValueType.Bool,
439
+ logic_string_contains: import_common.ValueType.Bool,
440
+ logic_string_nocase_contains: import_common.ValueType.Bool,
441
+ logic_string_nocase_equal: import_common.ValueType.Bool,
442
+ calc_number_add: import_common.ValueType.U256,
443
+ calc_number_subtract: import_common.ValueType.U256,
444
+ calc_number_multiply: import_common.ValueType.U256,
445
+ calc_number_divide: import_common.ValueType.U256,
446
+ calc_number_mod: import_common.ValueType.U256,
447
+ calc_string_nocase_contains: import_common.ValueType.Bool,
448
+ calc_string_nocase_equal: import_common.ValueType.Bool,
449
+ calc_string_contains: import_common.ValueType.Bool
450
+ };
451
+ (0, import_util2.checkType)(returnTypeMap[node.type], type_required, node);
452
+ await multi_operand_op(
453
+ opCodeMap[node.type],
454
+ node.nodes,
455
+ requiredTypeMap[node.type],
456
+ table,
457
+ output
458
+ );
459
+ break;
460
+ }
461
+ case "vec_contains_bool":
462
+ case "vec_contains_address":
463
+ case "vec_contains_string":
464
+ case "vec_contains_string_nocase":
465
+ case "vec_contains_number": {
466
+ const opCodeMap = {
467
+ vec_contains_bool: import_common.OperatorType.TypedValueVecContains_Bool,
468
+ vec_contains_address: import_common.OperatorType.TypedValueVecContains_Address,
469
+ vec_contains_string: import_common.OperatorType.TypedValueVecContains_String,
470
+ vec_contains_string_nocase: import_common.OperatorType.TypedValueVecContains_StringNoCase,
471
+ vec_contains_number: import_common.OperatorType.TypedValueVecContains_Number
472
+ };
473
+ const vecTypeMap = {
474
+ vec_contains_bool: import_common.ValueType.VecBool,
475
+ vec_contains_address: import_common.ValueType.VecAddress,
476
+ vec_contains_string: import_common.ValueType.VecString,
477
+ vec_contains_string_nocase: import_common.ValueType.VecString,
478
+ vec_contains_number: "vec_number"
479
+ };
480
+ const elemTypeMap = {
481
+ vec_contains_bool: import_common.ValueType.Bool,
482
+ vec_contains_address: import_common.ValueType.Address,
483
+ vec_contains_string: import_common.ValueType.String,
484
+ vec_contains_string_nocase: import_common.ValueType.String,
485
+ vec_contains_number: "number"
486
+ };
487
+ (0, import_util2.checkType)(import_common.ValueType.Bool, type_required, node);
488
+ for (let i = node.nodes.length - 1; i >= 0; --i) {
489
+ const nodeType = i === 0 ? vecTypeMap[node.type] : elemTypeMap[node.type];
490
+ await buildNode(node.nodes[i], nodeType, table, output);
491
+ }
492
+ output.push(import_bcs.bcs.U8.serialize(opCodeMap[node.type]).toBytes());
493
+ output.push(import_bcs.bcs.U8.serialize(node.nodes.length).toBytes());
494
+ break;
495
+ }
496
+ case "logic_not":
497
+ case "calc_string_length":
498
+ case "convert_number_address":
499
+ case "convert_address_number":
500
+ case "convert_number_string":
501
+ case "convert_string_number":
502
+ case "convert_safe_u8":
503
+ case "convert_safe_u16":
504
+ case "convert_safe_u32":
505
+ case "convert_safe_u64":
506
+ case "convert_safe_u128":
507
+ case "convert_safe_u256":
508
+ case "value_type":
509
+ case "vec_length": {
510
+ const opCodeMap = {
511
+ logic_not: import_common.OperatorType.TypeLogicNot,
512
+ calc_string_length: import_common.OperatorType.TypeStringLength,
513
+ convert_number_address: import_common.OperatorType.TypeNumberAddress,
514
+ convert_address_number: import_common.OperatorType.TypeAddressNumber,
515
+ convert_number_string: import_common.OperatorType.TypeNumberString,
516
+ convert_string_number: import_common.OperatorType.TypeStringNumber,
517
+ //convert_string_lowercase: OperatorType.TypeStringLowercase,
518
+ convert_safe_u8: import_common.OperatorType.TypeSafeU8,
519
+ convert_safe_u16: import_common.OperatorType.TypeSafeU16,
520
+ convert_safe_u32: import_common.OperatorType.TypeSafeU32,
521
+ convert_safe_u64: import_common.OperatorType.TypeSafeU64,
522
+ convert_safe_u128: import_common.OperatorType.TypeSafeU128,
523
+ convert_safe_u256: import_common.OperatorType.TypeSafeU256,
524
+ value_type: import_common.OperatorType.TypedValueType,
525
+ vec_length: import_common.OperatorType.TypedValueVecLength
526
+ };
527
+ const requiredTypeMap = {
528
+ logic_not: import_common.ValueType.Bool,
529
+ calc_string_length: import_common.ValueType.String,
530
+ convert_number_address: "number",
531
+ convert_address_number: import_common.ValueType.Address,
532
+ convert_number_string: "number",
533
+ convert_string_number: import_common.ValueType.String,
534
+ convert_safe_u8: "number",
535
+ convert_safe_u16: "number",
536
+ convert_safe_u32: "number",
537
+ convert_safe_u64: "number",
538
+ convert_safe_u128: "number",
539
+ convert_safe_u256: "number",
540
+ value_type: "variable",
541
+ vec_length: "vec"
542
+ };
543
+ const returnTypeMap = {
544
+ logic_not: import_common.ValueType.Bool,
545
+ calc_string_length: import_common.ValueType.U64,
546
+ convert_number_address: import_common.ValueType.Address,
547
+ convert_address_number: import_common.ValueType.U256,
548
+ convert_number_string: import_common.ValueType.String,
549
+ convert_string_number: import_common.ValueType.U256,
550
+ convert_safe_u8: import_common.ValueType.U8,
551
+ convert_safe_u16: import_common.ValueType.U16,
552
+ convert_safe_u32: import_common.ValueType.U32,
553
+ convert_safe_u64: import_common.ValueType.U64,
554
+ convert_safe_u128: import_common.ValueType.U128,
555
+ convert_safe_u256: import_common.ValueType.U256,
556
+ value_type: import_common.ValueType.U8,
557
+ vec_length: import_common.ValueType.U64
558
+ };
559
+ (0, import_util2.checkType)(returnTypeMap[node.type], type_required, node);
560
+ await single_operand_op(
561
+ opCodeMap[node.type],
562
+ node.node,
563
+ requiredTypeMap[node.type],
564
+ table,
565
+ output
566
+ );
567
+ break;
568
+ }
569
+ case "calc_string_indexof":
570
+ case "calc_string_nocase_indexof": {
571
+ const opCodeMap = {
572
+ calc_string_indexof: import_common.OperatorType.TypeStringIndexof,
573
+ calc_string_nocase_indexof: import_common.OperatorType.TypeStringNocaseIndexof
574
+ };
575
+ (0, import_util2.checkType)(import_common.ValueType.U64, type_required, node);
576
+ await buildNode(node.nodeRight, import_common.ValueType.String, table, output);
577
+ await buildNode(node.nodeLeft, import_common.ValueType.String, table, output);
578
+ output.push(import_bcs.bcs.U8.serialize(opCodeMap[node.type]).toBytes());
579
+ output.push(
580
+ import_bcs.bcs.U8.serialize(node.order === "forward" ? 0 : 1).toBytes()
581
+ );
582
+ break;
583
+ }
584
+ case "vec_indexof_bool":
585
+ case "vec_indexof_address":
586
+ case "vec_indexof_string":
587
+ case "vec_indexof_string_nocase":
588
+ case "vec_indexof_number": {
589
+ const opCodeMap = {
590
+ vec_indexof_bool: import_common.OperatorType.TypedValueVecIndexOf_Bool,
591
+ vec_indexof_address: import_common.OperatorType.TypedValueVecIndexOf_Address,
592
+ vec_indexof_string: import_common.OperatorType.TypedValueVecIndexOf_String,
593
+ vec_indexof_string_nocase: import_common.OperatorType.TypedValueVecIndexOf_StringNoCase,
594
+ vec_indexof_number: import_common.OperatorType.TypedValueVecIndexOf_Number
595
+ };
596
+ const rightTypeMap = {
597
+ vec_indexof_bool: import_common.ValueType.Bool,
598
+ vec_indexof_address: import_common.ValueType.Address,
599
+ vec_indexof_string: import_common.ValueType.String,
600
+ vec_indexof_string_nocase: import_common.ValueType.String,
601
+ vec_indexof_number: "number"
602
+ };
603
+ const leftTypeMap = {
604
+ vec_indexof_bool: import_common.ValueType.VecBool,
605
+ vec_indexof_address: import_common.ValueType.VecAddress,
606
+ vec_indexof_string: import_common.ValueType.VecString,
607
+ vec_indexof_string_nocase: import_common.ValueType.VecString,
608
+ vec_indexof_number: "vec_number"
609
+ };
610
+ (0, import_util2.checkType)(import_common.ValueType.U64, type_required, node);
611
+ await buildNode(
612
+ node.nodeRight,
613
+ rightTypeMap[node.type],
614
+ table,
615
+ output
616
+ );
617
+ await buildNode(
618
+ node.nodeLeft,
619
+ leftTypeMap[node.type],
620
+ table,
621
+ output
622
+ );
623
+ output.push(import_bcs.bcs.U8.serialize(opCodeMap[node.type]).toBytes());
624
+ output.push(
625
+ import_bcs.bcs.U8.serialize(node.order === "forward" ? 0 : 1).toBytes()
626
+ );
627
+ break;
628
+ }
629
+ case "context": {
630
+ let contextValue;
631
+ switch (node.context) {
632
+ case "Signer":
633
+ contextValue = import_common.ContextType.TypeSigner;
634
+ break;
635
+ case "Clock":
636
+ contextValue = import_common.ContextType.TypeClock;
637
+ break;
638
+ case "Guard":
639
+ contextValue = import_common.ContextType.TypeGuard;
640
+ break;
641
+ default:
642
+ (0, import_exception.W_ERROR)(
643
+ import_exception.WErrors.InvalidParam,
644
+ "Invalid context type: " + node.context
645
+ );
646
+ }
647
+ output.push(import_bcs.bcs.U8.serialize(contextValue).toBytes());
648
+ (0, import_util2.checkType)(import_common.ValueType.Address, type_required, node);
649
+ break;
650
+ }
651
+ default:
652
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "node:" + JSON.stringify(node));
653
+ }
654
+ };
655
+ const multi_operand_op = async (op_code, parameters, required_type, table, output) => {
656
+ if (parameters.length < 2 || parameters.length > import_common.MAX_MULTI_OPERANDS) {
657
+ (0, import_exception.W_ERROR)(
658
+ import_exception.WErrors.InvalidParam,
659
+ `op ${op_code} parameters length must >= 2 and <=
660
+ ${import_common.MAX_MULTI_OPERANDS}. parameters:
661
+ ${JSON.stringify(parameters)}`
662
+ );
663
+ }
664
+ for (let i = parameters.length - 1; i >= 0; --i) {
665
+ await buildNode(parameters[i], required_type, table, output);
666
+ }
667
+ output.push(import_bcs.bcs.U8.serialize(op_code).toBytes());
668
+ output.push(import_bcs.bcs.U8.serialize(parameters.length).toBytes());
669
+ };
670
+ const single_operand_op = async (op_code, parameter, required_type, table, output) => {
671
+ await buildNode(parameter, required_type, table, output);
672
+ output.push(import_bcs.bcs.U8.serialize(op_code).toBytes());
673
+ };
674
+ const guard2file = async (guard, file_path, format = "json", network) => {
675
+ const queryResult = await (0, import_object.query_objects)({
676
+ objects: [guard],
677
+ network
678
+ });
679
+ const objects = queryResult.objects;
680
+ if (!objects || objects.length === 0 || objects[0].type !== "Guard") {
681
+ (0, import_exception.W_ERROR)(
682
+ import_exception.WErrors.InvalidParam,
683
+ `guard2file: Guard object not found: ${guard}`
684
+ );
685
+ return;
686
+ }
687
+ const guardObj = objects[0];
688
+ if (!guardObj) {
689
+ (0, import_exception.W_ERROR)(
690
+ import_exception.WErrors.InvalidParam,
691
+ `guard2file: Failed to get Guard object data: ${guard}`
692
+ );
693
+ return;
694
+ }
695
+ let content;
696
+ if (format === "json") {
697
+ content = generateGuardJson(guardObj);
698
+ } else {
699
+ content = generateGuardMarkdown(guardObj);
700
+ }
701
+ try {
702
+ const resolvedPath = (0, import_path.resolve)(file_path);
703
+ (0, import_fs.writeFileSync)(resolvedPath, content, "utf-8");
704
+ } catch (e) {
705
+ (0, import_exception.W_ERROR)(
706
+ import_exception.WErrors.InvalidParam,
707
+ `guard2file: Failed to write file '${file_path}': ${e.message}`
708
+ );
709
+ }
710
+ };
711
+ const generateGuardJson = (guardObj) => {
712
+ const output = {};
713
+ if (guardObj.description) {
714
+ output.description = guardObj.description;
715
+ }
716
+ if (guardObj.table && guardObj.table.length > 0) {
717
+ output.table = guardObj.table.map((item) => ({
718
+ identifier: item.identifier,
719
+ b_submission: item.b_submission,
720
+ value_type: item.value_type,
721
+ value: item.value,
722
+ name: item.name
723
+ }));
724
+ }
725
+ if (guardObj.root) {
726
+ output.root = guardObj.root;
727
+ }
728
+ if (guardObj.relies && guardObj.relies.length > 0) {
729
+ output.rely = {
730
+ guards: guardObj.relies,
731
+ logic_or: !guardObj.relies_logic_and
732
+ };
733
+ }
734
+ return JSON.stringify(output, null, 2);
735
+ };
736
+ const generateGuardMarkdown = (guardObj) => {
737
+ const lines = [];
738
+ lines.push(`# Guard Definition`);
739
+ lines.push("");
740
+ lines.push(`**Object ID:** ${guardObj.object}`);
741
+ lines.push("");
742
+ lines.push("## Summary");
743
+ lines.push("");
744
+ const description = guardObj.description || "";
745
+ const tableCount = guardObj.table ? guardObj.table.length : 0;
746
+ let summary = `${description.length > 100 ? description.substring(0, 97) + "..." : description}`;
747
+ summary += ` [${tableCount} tables]`;
748
+ lines.push(summary);
749
+ lines.push("");
750
+ lines.push("## Description");
751
+ lines.push("");
752
+ lines.push(guardObj.description || "");
753
+ lines.push("");
754
+ lines.push("## Table (Data Definitions)");
755
+ lines.push("");
756
+ lines.push("| Identifier | b_submission | value_type | value | name |");
757
+ lines.push("|------------|--------------|------------|-------|------|");
758
+ if (guardObj.table && guardObj.table.length > 0) {
759
+ for (const item of guardObj.table) {
760
+ const itemValueType = (0, import_common.parseValueType)(item.value_type);
761
+ const valueTypeStr = valueTypeToString(itemValueType);
762
+ const valueStr = formatValueForMarkdown(item.value);
763
+ lines.push(
764
+ `| ${item.identifier} | ${item.b_submission} | ${valueTypeStr} (${item.value_type}) | ${valueStr} | ${item.name} |`
765
+ );
766
+ }
767
+ } else {
768
+ lines.push("| - | - | - | - | - |");
769
+ }
770
+ lines.push("");
771
+ lines.push("## Root (Computational Tree)");
772
+ lines.push("");
773
+ lines.push("The root node MUST return a Bool value (pass/fail).");
774
+ lines.push("");
775
+ if (guardObj.root) {
776
+ lines.push("```json");
777
+ lines.push(JSON.stringify(guardObj.root, null, 2));
778
+ lines.push("```");
779
+ lines.push("");
780
+ const nodeComments = generateNodeComments(guardObj.root);
781
+ if (nodeComments.length > 0) {
782
+ lines.push("### Node Comments");
783
+ lines.push("");
784
+ for (const comment of nodeComments) {
785
+ lines.push(`- **${comment.type}**: ${comment.description}`);
786
+ }
787
+ lines.push("");
788
+ }
789
+ } else {
790
+ lines.push("*No root node data available*");
791
+ lines.push("");
792
+ }
793
+ if (guardObj.relies && guardObj.relies.length > 0) {
794
+ lines.push("## Rely (Dependencies)");
795
+ lines.push("");
796
+ lines.push(`**Logic:** ${guardObj.relies_logic_and ? "AND" : "OR"}`);
797
+ lines.push("");
798
+ lines.push("**Dependent Guards:**");
799
+ for (const rely of guardObj.relies) {
800
+ lines.push(`- ${rely}`);
801
+ }
802
+ lines.push("");
803
+ }
804
+ return lines.join("\n");
805
+ };
806
+ const formatValueForMarkdown = (value) => {
807
+ if (value === void 0 || value === null) {
808
+ return "-";
809
+ }
810
+ if (typeof value === "boolean") {
811
+ return value ? "true" : "false";
812
+ }
813
+ if (typeof value === "string") {
814
+ if (value.length > 30) {
815
+ return value.substring(0, 27) + "...";
816
+ }
817
+ return value;
818
+ }
819
+ if (typeof value === "number") {
820
+ return value.toString();
821
+ }
822
+ if (Array.isArray(value)) {
823
+ if (value.length === 0) return "[]";
824
+ if (value.length > 3) {
825
+ return `[${value.slice(0, 3).join(", ")}, ... (${value.length} items)]`;
826
+ }
827
+ return `[${value.join(", ")}]`;
828
+ }
829
+ if (typeof value === "object") {
830
+ return "{...}";
831
+ }
832
+ return String(value);
833
+ };
834
+ const generateNodeComments = (node, comments = []) => {
835
+ if (!node) return comments;
836
+ if (node.type === "query") {
837
+ const queryId = typeof node.query === "number" ? node.query : void 0;
838
+ if (queryId !== void 0) {
839
+ const queryInfo = import_guard_ins.GUARDQUERY.find((q) => q.id === queryId);
840
+ if (queryInfo) {
841
+ comments.push({
842
+ type: `query(${node.query})`,
843
+ description: `${queryInfo.name}: ${queryInfo.description}`
844
+ });
845
+ }
846
+ }
847
+ } else if (node.type.startsWith("logic_")) {
848
+ comments.push({
849
+ type: node.type,
850
+ description: `Logic operation: ${node.type.replace(/_/g, " ")}`
851
+ });
852
+ } else if (node.type.startsWith("calc_")) {
853
+ comments.push({
854
+ type: node.type,
855
+ description: `Calculation: ${node.type.replace(/_/g, " ")}`
856
+ });
857
+ } else if (node.type.startsWith("convert_")) {
858
+ comments.push({
859
+ type: node.type,
860
+ description: `Type conversion: ${node.type.replace(/_/g, " ")}`
861
+ });
862
+ }
863
+ if ("nodes" in node && Array.isArray(node.nodes)) {
864
+ for (const childNode of node.nodes) {
865
+ generateNodeComments(childNode, comments);
866
+ }
867
+ }
868
+ if ("node" in node && node.node) {
869
+ generateNodeComments(node.node, comments);
870
+ }
871
+ if ("parameters" in node && Array.isArray(node.parameters)) {
872
+ for (const param of node.parameters) {
873
+ generateNodeComments(param, comments);
874
+ }
875
+ }
876
+ if ("nodeLeft" in node && node.nodeLeft) {
877
+ generateNodeComments(node.nodeLeft, comments);
878
+ }
879
+ if ("nodeRight" in node && node.nodeRight) {
880
+ generateNodeComments(node.nodeRight, comments);
881
+ }
882
+ return comments;
883
+ };
884
+ const valueTypeToString = (valueType) => {
885
+ const typeMap = {
886
+ [import_common.ValueType.Bool]: "Bool",
887
+ [import_common.ValueType.Address]: "Address",
888
+ [import_common.ValueType.String]: "String",
889
+ [import_common.ValueType.U8]: "U8",
890
+ [import_common.ValueType.U16]: "U16",
891
+ [import_common.ValueType.U32]: "U32",
892
+ [import_common.ValueType.U64]: "U64",
893
+ [import_common.ValueType.U128]: "U128",
894
+ [import_common.ValueType.U256]: "U256",
895
+ [import_common.ValueType.VecBool]: "VecBool",
896
+ [import_common.ValueType.VecAddress]: "VecAddress",
897
+ [import_common.ValueType.VecString]: "VecString",
898
+ [import_common.ValueType.VecU8]: "VecU8",
899
+ [import_common.ValueType.VecU16]: "VecU16",
900
+ [import_common.ValueType.VecU32]: "VecU32",
901
+ [import_common.ValueType.VecU64]: "VecU64",
902
+ [import_common.ValueType.VecU128]: "VecU128",
903
+ [import_common.ValueType.VecU256]: "VecU256",
904
+ [import_common.ValueType.VecVecU8]: "VecVecU8",
905
+ [import_common.ValueType.Value]: "Value"
906
+ };
907
+ return typeMap[valueType] || `Unknown(${valueType})`;
908
+ };
909
+ const gen_passport = async (env, guard, info) => {
910
+ if (!(0, import_sui_types.isValidWowAddress)(guard)) {
911
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "guard invalid: guard empty");
912
+ }
913
+ await (0, import_util2.resolveCallEnv)(env);
914
+ const s = await (0, import_passport.get_guardSubmissions)(env, [guard]);
915
+ if (s.submission.length > 0) {
916
+ if (!info) {
917
+ return {
918
+ type: "submission",
919
+ guard: s.guard,
920
+ submission: s.submission
921
+ };
922
+ } else {
923
+ return await (0, import_passport.verify_guard)(env, info);
924
+ }
925
+ } else {
926
+ return await (0, import_passport.verify_guard)(env, {
927
+ type: "submission",
928
+ guard: [{ object: guard, impack: true }],
929
+ submission: []
930
+ });
931
+ }
932
+ };
933
+ function detectFileFormatFromContent(text) {
934
+ const trimmed = text.trim();
935
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
936
+ return "json";
937
+ }
938
+ return "markdown";
939
+ }
940
+ function extractJsonFromMarkdown(markdown) {
941
+ const codeBlockRegex = /```(?:json)?\s*\n([\s\S]*?)```/g;
942
+ let match;
943
+ let lastMatch = null;
944
+ while ((match = codeBlockRegex.exec(markdown)) !== null) {
945
+ const jsonContent = match[1].trim();
946
+ if (jsonContent.startsWith("{") || jsonContent.startsWith("[")) {
947
+ const beforeMatch = markdown.substring(0, match.index);
948
+ const lineOffset = (beforeMatch.match(/\n/g) || []).length + 1;
949
+ lastMatch = { json: jsonContent, lineOffset };
950
+ }
951
+ }
952
+ return lastMatch;
953
+ }
954
+ function parseTableFromMarkdown(section) {
955
+ const jsonMatch = section.match(/```(?:json)?\s*\n([\s\S]*?)```/);
956
+ if (jsonMatch) {
957
+ try {
958
+ const parsed = JSON.parse(jsonMatch[1]);
959
+ if (Array.isArray(parsed)) {
960
+ return parsed;
961
+ }
962
+ } catch {
963
+ }
964
+ }
965
+ const tableRows = section.match(/\|[^\n]+\|/g);
966
+ if (tableRows && tableRows.length > 2) {
967
+ return tableRows.slice(2).map((row) => {
968
+ const cells = row.split("|").filter((c) => c.trim()).map((c) => c.trim());
969
+ const valueTypeCell = cells[2];
970
+ let value_type;
971
+ const numericMatch = valueTypeCell.match(/\d+/);
972
+ if (numericMatch) {
973
+ value_type = parseInt(numericMatch[0], 10);
974
+ } else {
975
+ const typeNameMatch = valueTypeCell.match(/^([A-Za-z]+)/);
976
+ if (typeNameMatch) {
977
+ value_type = typeNameMatch[1];
978
+ } else {
979
+ throw new Error(
980
+ `Invalid value_type in table row: "${valueTypeCell}". Expected a number (0-19) or type name (e.g., "U64", "Address")`
981
+ );
982
+ }
983
+ }
984
+ return {
985
+ identifier: parseInt(cells[0], 10),
986
+ b_submission: cells[1].toLowerCase() === "true",
987
+ value_type,
988
+ value: cells[3] === "-" ? void 0 : cells[3],
989
+ name: cells[4] === "-" ? void 0 : cells[4]
990
+ };
991
+ });
992
+ }
993
+ return void 0;
994
+ }
995
+ function parseRelyFromMarkdown(section) {
996
+ const logicMatch = section.match(/\*\*Logic:\*\*\s*(AND|OR)/i);
997
+ const guardListMatches = section.match(/^\s*[-*]\s*(\S+)$/gm);
998
+ if (logicMatch || guardListMatches) {
999
+ return {
1000
+ logic_or: logicMatch ? logicMatch[1].toUpperCase() === "OR" : false,
1001
+ guards: guardListMatches ? guardListMatches.map(
1002
+ (g) => g.replace(/^\s*[-*]\s*/, "").trim()
1003
+ ) : []
1004
+ };
1005
+ }
1006
+ return void 0;
1007
+ }
1008
+ function parseGuardFromMarkdown(content) {
1009
+ const errors = [];
1010
+ const result = {};
1011
+ const jsonMatch = extractJsonFromMarkdown(content);
1012
+ if (jsonMatch) {
1013
+ try {
1014
+ const parsed = JSON.parse(
1015
+ jsonMatch.json
1016
+ );
1017
+ Object.assign(result, parsed);
1018
+ } catch (e) {
1019
+ errors.push({
1020
+ message: `Failed to parse JSON from code block: ${e.message}`,
1021
+ path: "/",
1022
+ line: jsonMatch.lineOffset
1023
+ });
1024
+ }
1025
+ }
1026
+ if (!result.description) {
1027
+ const descMatch = content.match(
1028
+ /(?:^|\n)#+\s*(?:Description|Description|Description)[^\n]*\n+([^\n#]+)/i
1029
+ );
1030
+ if (descMatch) {
1031
+ result.description = descMatch[1].trim();
1032
+ }
1033
+ }
1034
+ if (!result.table) {
1035
+ const tableMatch = content.match(
1036
+ /(?:^|\n)#+\s*(?:Table|Data Table|数据表)[^\n]*\n+([\s\S]*?)(?=(?:\n#+|$))/i
1037
+ );
1038
+ if (tableMatch) {
1039
+ const table = parseTableFromMarkdown(tableMatch[1]);
1040
+ if (table) {
1041
+ result.table = table;
1042
+ }
1043
+ }
1044
+ }
1045
+ if (!result.root) {
1046
+ const rootMatch = content.match(
1047
+ /(?:^|\n)#+\s*(?:Root|根节点)[^\n]*\n+([\s\S]*?)(?=(?:\n#+|$))/i
1048
+ );
1049
+ if (rootMatch) {
1050
+ const rootSection = rootMatch[1];
1051
+ const rootJsonMatch = rootSection.match(
1052
+ /```(?:json)?\s*\n([\s\S]*?)```/
1053
+ );
1054
+ if (rootJsonMatch) {
1055
+ try {
1056
+ result.root = JSON.parse(rootJsonMatch[1]);
1057
+ } catch (e) {
1058
+ errors.push({
1059
+ message: `Failed to parse root JSON: ${e.message}`,
1060
+ path: "/root"
1061
+ });
1062
+ }
1063
+ }
1064
+ }
1065
+ }
1066
+ if (!result.rely) {
1067
+ const relyMatch = content.match(
1068
+ /(?:^|\n)#+\s*(?:Rely|Dependencies|依赖)[^\n]*\n+([\s\S]*?)(?=(?:\n#+|$))/i
1069
+ );
1070
+ if (relyMatch) {
1071
+ const rely = parseRelyFromMarkdown(relyMatch[1]);
1072
+ if (rely) {
1073
+ result.rely = rely;
1074
+ }
1075
+ }
1076
+ }
1077
+ if (!result.root) {
1078
+ errors.push({
1079
+ message: "Guard root node not found in markdown file",
1080
+ path: "/root"
1081
+ });
1082
+ return { success: false, errors };
1083
+ }
1084
+ return {
1085
+ success: true,
1086
+ data: result,
1087
+ errors
1088
+ };
1089
+ }
1090
+ function parseGuardFile(content, format) {
1091
+ const detectedFormat = format ?? detectFileFormatFromContent(content);
1092
+ if (detectedFormat === "json") {
1093
+ try {
1094
+ const parsed = JSON.parse(content);
1095
+ if (!parsed.root) {
1096
+ return {
1097
+ success: false,
1098
+ errors: [
1099
+ {
1100
+ message: "Missing required field: root",
1101
+ path: "/root"
1102
+ }
1103
+ ]
1104
+ };
1105
+ }
1106
+ return { success: true, data: parsed, errors: [] };
1107
+ } catch (e) {
1108
+ return {
1109
+ success: false,
1110
+ errors: [
1111
+ {
1112
+ message: `JSON parse error: ${e.message}`,
1113
+ path: "/"
1114
+ }
1115
+ ]
1116
+ };
1117
+ }
1118
+ }
1119
+ return parseGuardFromMarkdown(content);
1120
+ }
1121
+ function validateGuardNode(node) {
1122
+ const errors = [];
1123
+ if (!node || typeof node !== "object") {
1124
+ errors.push({ message: "GuardNode must be an object", path: "/" });
1125
+ return { success: false, errors };
1126
+ }
1127
+ const n = node;
1128
+ if (!n.type || typeof n.type !== "string") {
1129
+ errors.push({
1130
+ message: "GuardNode must have a 'type' property",
1131
+ path: "/type"
1132
+ });
1133
+ return { success: false, errors };
1134
+ }
1135
+ const validTypes = [
1136
+ "identifier",
1137
+ "query",
1138
+ "context",
1139
+ "logic_not",
1140
+ "logic_and",
1141
+ "logic_or",
1142
+ "logic_equal",
1143
+ "logic_as_u256_greater_or_equal",
1144
+ "logic_as_u256_lesser_or_equal",
1145
+ "logic_as_u256_greater",
1146
+ "logic_as_u256_lesser",
1147
+ "logic_as_u256_equal",
1148
+ "logic_string_contains",
1149
+ "logic_string_nocase_contains",
1150
+ "logic_string_nocase_equal",
1151
+ "calc_number_add",
1152
+ "calc_number_subtract",
1153
+ "calc_number_multiply",
1154
+ "calc_number_divide",
1155
+ "calc_number_mod",
1156
+ "calc_string_length",
1157
+ "calc_string_nocase_contains",
1158
+ "calc_string_nocase_equal",
1159
+ "calc_string_contains",
1160
+ "calc_string_indexof",
1161
+ "calc_string_nocase_indexof",
1162
+ "convert_number_address",
1163
+ "convert_address_number",
1164
+ "convert_number_string",
1165
+ "convert_string_number",
1166
+ "convert_safe_u8",
1167
+ "convert_safe_u16",
1168
+ "convert_safe_u32",
1169
+ "convert_safe_u64",
1170
+ "convert_safe_u128",
1171
+ "convert_safe_u256",
1172
+ "value_type",
1173
+ "vec_length",
1174
+ "vec_contains_bool",
1175
+ "vec_contains_address",
1176
+ "vec_contains_string",
1177
+ "vec_contains_string_nocase",
1178
+ "vec_contains_number",
1179
+ "vec_indexof_bool",
1180
+ "vec_indexof_address",
1181
+ "vec_indexof_string",
1182
+ "vec_indexof_string_nocase",
1183
+ "vec_indexof_number"
1184
+ ];
1185
+ if (!validTypes.includes(n.type)) {
1186
+ errors.push({
1187
+ message: `Invalid GuardNode type: ${n.type}`,
1188
+ path: "/type"
1189
+ });
1190
+ }
1191
+ return { success: errors.length === 0, errors };
1192
+ }
1193
+ function formatGuardParseErrors(errors) {
1194
+ return errors.map((e) => {
1195
+ let msg = `Path: ${e.path}`;
1196
+ if (e.line !== void 0 && e.column !== void 0) {
1197
+ msg += ` (line ${e.line}, column ${e.column})`;
1198
+ }
1199
+ msg += `
1200
+ Error: ${e.message}`;
1201
+ return msg;
1202
+ }).join("\n\n");
1203
+ }