wowok 1.8.2 → 2.1.9

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 (892) hide show
  1. package/README.md +4 -33
  2. package/dist/cjs/bcs/bcs.d.ts +1973 -0
  3. package/dist/cjs/bcs/bcs.js +327 -0
  4. package/dist/cjs/bcs/effects.d.ts +579 -0
  5. package/dist/cjs/bcs/effects.js +231 -0
  6. package/dist/cjs/bcs/index.d.ts +2589 -0
  7. package/dist/cjs/bcs/index.js +79 -0
  8. package/dist/cjs/bcs/pure.d.ts +22 -0
  9. package/dist/cjs/bcs/pure.js +62 -0
  10. package/dist/cjs/bcs/type-tag-serializer.d.ts +7 -0
  11. package/dist/cjs/bcs/type-tag-serializer.js +124 -0
  12. package/dist/cjs/bcs/types.d.ts +114 -0
  13. package/dist/cjs/bcs/types.js +26 -0
  14. package/dist/cjs/client/index.d.ts +5 -0
  15. package/dist/cjs/client/index.js +34 -0
  16. package/dist/cjs/client/network.d.ts +5 -0
  17. package/dist/cjs/client/network.js +43 -0
  18. package/dist/cjs/cryptography/index.d.ts +7 -0
  19. package/dist/cjs/cryptography/index.js +46 -0
  20. package/dist/cjs/cryptography/intent.d.ts +6 -0
  21. package/dist/cjs/cryptography/intent.js +34 -0
  22. package/dist/cjs/cryptography/keypair.d.ts +73 -0
  23. package/dist/cjs/cryptography/keypair.js +125 -0
  24. package/dist/cjs/cryptography/mnemonics.d.ts +27 -0
  25. package/dist/cjs/cryptography/mnemonics.js +50 -0
  26. package/dist/cjs/cryptography/publickey.d.ts +67 -0
  27. package/dist/cjs/cryptography/publickey.js +142 -0
  28. package/dist/cjs/cryptography/signature-scheme.d.ts +24 -0
  29. package/dist/cjs/cryptography/signature-scheme.js +47 -0
  30. package/dist/cjs/cryptography/signature.d.ts +62 -0
  31. package/dist/cjs/cryptography/signature.js +71 -0
  32. package/dist/cjs/experimental/cache.d.ts +12 -0
  33. package/dist/cjs/experimental/client.d.ts +12 -0
  34. package/dist/cjs/experimental/core.d.ts +33 -0
  35. package/dist/cjs/experimental/errors.d.ts +8 -0
  36. package/dist/cjs/experimental/index.d.ts +7 -0
  37. package/dist/cjs/experimental/persistent-storage.d.ts +134 -0
  38. package/dist/cjs/experimental/persistent-storage.test.d.ts +5 -0
  39. package/dist/cjs/experimental/transports/utils.d.ts +3 -0
  40. package/dist/cjs/experimental/types.d.ts +367 -0
  41. package/dist/cjs/faucet/faucet.d.ts +66 -0
  42. package/dist/cjs/faucet/faucet.js +138 -0
  43. package/dist/cjs/faucet/index.d.ts +1 -0
  44. package/dist/cjs/faucet/index.js +29 -0
  45. package/dist/cjs/graphql/client.js +98 -0
  46. package/dist/cjs/graphql/core.js +506 -0
  47. package/dist/cjs/graphql/generated/2024.1/tada-env.js +13141 -0
  48. package/dist/cjs/graphql/generated/2024.1/tsconfig.tada.js +11 -0
  49. package/dist/cjs/graphql/generated/2024.4/tada-env.js +13287 -0
  50. package/dist/cjs/graphql/generated/2024.4/tsconfig.tada.js +11 -0
  51. package/dist/cjs/graphql/generated/latest/tada-env.js +12925 -0
  52. package/dist/cjs/graphql/generated/latest/tsconfig.tada.js +11 -0
  53. package/dist/cjs/graphql/generated/queries.js +807 -0
  54. package/dist/cjs/graphql/index.js +25 -0
  55. package/dist/cjs/graphql/schemas/2024.1/index.js +28 -0
  56. package/dist/cjs/graphql/schemas/2024.4/index.js +28 -0
  57. package/dist/cjs/graphql/schemas/latest/index.js +28 -0
  58. package/dist/cjs/graphql/types.js +16 -0
  59. package/dist/cjs/grpc/client.d.ts +32 -0
  60. package/dist/cjs/grpc/client.js +64 -0
  61. package/dist/cjs/grpc/core.d.ts +28 -0
  62. package/dist/cjs/grpc/core.js +645 -0
  63. package/dist/cjs/grpc/index.d.ts +4 -0
  64. package/dist/cjs/grpc/index.js +26 -0
  65. package/dist/cjs/grpc/proto/google/protobuf/any.d.ts +173 -0
  66. package/dist/cjs/grpc/proto/google/protobuf/any.js +138 -0
  67. package/dist/cjs/grpc/proto/google/protobuf/duration.d.ts +104 -0
  68. package/dist/cjs/grpc/proto/google/protobuf/duration.js +94 -0
  69. package/dist/cjs/grpc/proto/google/protobuf/empty.d.ts +25 -0
  70. package/dist/cjs/grpc/proto/google/protobuf/empty.js +30 -0
  71. package/dist/cjs/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
  72. package/dist/cjs/grpc/proto/google/protobuf/field_mask.js +77 -0
  73. package/dist/cjs/grpc/proto/google/protobuf/struct.d.ts +169 -0
  74. package/dist/cjs/grpc/proto/google/protobuf/struct.js +224 -0
  75. package/dist/cjs/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
  76. package/dist/cjs/grpc/proto/google/protobuf/timestamp.js +134 -0
  77. package/dist/cjs/grpc/proto/google/rpc/error_details.d.ts +525 -0
  78. package/dist/cjs/grpc/proto/google/rpc/error_details.js +317 -0
  79. package/dist/cjs/grpc/proto/google/rpc/status.d.ts +46 -0
  80. package/dist/cjs/grpc/proto/google/rpc/status.js +52 -0
  81. package/dist/cjs/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
  82. package/dist/cjs/grpc/proto/sui/rpc/v2/argument.js +70 -0
  83. package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
  84. package/dist/cjs/grpc/proto/sui/rpc/v2/balance_change.js +52 -0
  85. package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
  86. package/dist/cjs/grpc/proto/sui/rpc/v2/bcs.js +45 -0
  87. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
  88. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint.js +77 -0
  89. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
  90. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_contents.js +84 -0
  91. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
  92. package/dist/cjs/grpc/proto/sui/rpc/v2/checkpoint_summary.js +170 -0
  93. package/dist/cjs/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
  94. package/dist/cjs/grpc/proto/sui/rpc/v2/effects.js +300 -0
  95. package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
  96. package/dist/cjs/grpc/proto/sui/rpc/v2/epoch.js +87 -0
  97. package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
  98. package/dist/cjs/grpc/proto/sui/rpc/v2/error_reason.js +29 -0
  99. package/dist/cjs/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
  100. package/dist/cjs/grpc/proto/sui/rpc/v2/event.js +86 -0
  101. package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
  102. package/dist/cjs/grpc/proto/sui/rpc/v2/executed_transaction.js +87 -0
  103. package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
  104. package/dist/cjs/grpc/proto/sui/rpc/v2/execution_status.js +519 -0
  105. package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
  106. package/dist/cjs/grpc/proto/sui/rpc/v2/gas_cost_summary.js +63 -0
  107. package/dist/cjs/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
  108. package/dist/cjs/grpc/proto/sui/rpc/v2/input.js +85 -0
  109. package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
  110. package/dist/cjs/grpc/proto/sui/rpc/v2/jwk.js +81 -0
  111. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
  112. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.client.js +122 -0
  113. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
  114. package/dist/cjs/grpc/proto/sui/rpc/v2/ledger_service.js +368 -0
  115. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
  116. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package.js +485 -0
  117. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
  118. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.client.js +81 -0
  119. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
  120. package/dist/cjs/grpc/proto/sui/rpc/v2/move_package_service.js +241 -0
  121. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
  122. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.client.js +55 -0
  123. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
  124. package/dist/cjs/grpc/proto/sui/rpc/v2/name_service.js +141 -0
  125. package/dist/cjs/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
  126. package/dist/cjs/grpc/proto/sui/rpc/v2/object.js +114 -0
  127. package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
  128. package/dist/cjs/grpc/proto/sui/rpc/v2/object_reference.js +53 -0
  129. package/dist/cjs/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
  130. package/dist/cjs/grpc/proto/sui/rpc/v2/owner.js +63 -0
  131. package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
  132. package/dist/cjs/grpc/proto/sui/rpc/v2/protocol_config.js +61 -0
  133. package/dist/cjs/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
  134. package/dist/cjs/grpc/proto/sui/rpc/v2/signature.js +541 -0
  135. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
  136. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_scheme.js +33 -0
  137. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
  138. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +50 -0
  139. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
  140. package/dist/cjs/grpc/proto/sui/rpc/v2/signature_verification_service.js +90 -0
  141. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
  142. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.client.js +88 -0
  143. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
  144. package/dist/cjs/grpc/proto/sui/rpc/v2/state_service.js +546 -0
  145. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
  146. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.client.js +54 -0
  147. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
  148. package/dist/cjs/grpc/proto/sui/rpc/v2/subscription_service.js +65 -0
  149. package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
  150. package/dist/cjs/grpc/proto/sui/rpc/v2/system_state.js +740 -0
  151. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
  152. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction.js +1005 -0
  153. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
  154. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +49 -0
  155. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
  156. package/dist/cjs/grpc/proto/sui/rpc/v2/transaction_execution_service.js +177 -0
  157. package/dist/cjs/index.d.ts +25 -0
  158. package/dist/cjs/index.js +93 -0
  159. package/dist/cjs/jsonRpc/client.d.ts +261 -0
  160. package/dist/cjs/jsonRpc/client.js +747 -0
  161. package/dist/cjs/jsonRpc/core.d.ts +87 -0
  162. package/dist/cjs/jsonRpc/core.js +638 -0
  163. package/dist/cjs/jsonRpc/errors.d.ts +12 -0
  164. package/dist/cjs/jsonRpc/errors.js +65 -0
  165. package/dist/cjs/jsonRpc/http-transport.d.ts +42 -0
  166. package/dist/cjs/jsonRpc/http-transport.js +121 -0
  167. package/dist/cjs/jsonRpc/index.d.ts +4 -0
  168. package/dist/cjs/jsonRpc/index.js +31 -0
  169. package/dist/cjs/jsonRpc/json-rpc-resolver.d.ts +4 -0
  170. package/dist/cjs/jsonRpc/json-rpc-resolver.js +321 -0
  171. package/dist/cjs/jsonRpc/rpc-websocket-client.d.ts +43 -0
  172. package/dist/cjs/jsonRpc/rpc-websocket-client.js +220 -0
  173. package/dist/cjs/jsonRpc/types/chain.d.ts +99 -0
  174. package/dist/cjs/jsonRpc/types/chain.js +16 -0
  175. package/dist/cjs/jsonRpc/types/changes.d.ts +19 -0
  176. package/dist/cjs/jsonRpc/types/changes.js +16 -0
  177. package/dist/cjs/jsonRpc/types/coins.d.ts +6 -0
  178. package/dist/cjs/jsonRpc/types/coins.js +16 -0
  179. package/dist/cjs/jsonRpc/types/common.d.ts +2 -0
  180. package/dist/cjs/jsonRpc/types/common.js +16 -0
  181. package/dist/cjs/jsonRpc/types/generated.d.ts +1492 -0
  182. package/dist/cjs/jsonRpc/types/generated.js +16 -0
  183. package/dist/cjs/jsonRpc/types/index.d.ts +6 -0
  184. package/dist/cjs/jsonRpc/types/index.js +16 -0
  185. package/dist/cjs/jsonRpc/types/params.d.ts +656 -0
  186. package/dist/cjs/jsonRpc/types/params.js +16 -0
  187. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
  188. package/dist/cjs/keypairs/ed25519/ed25519-hd-key.js +82 -0
  189. package/dist/cjs/keypairs/ed25519/index.d.ts +2 -0
  190. package/dist/cjs/keypairs/ed25519/index.js +27 -0
  191. package/dist/cjs/keypairs/ed25519/keypair.d.ts +74 -0
  192. package/dist/cjs/keypairs/ed25519/keypair.js +169 -0
  193. package/dist/cjs/keypairs/ed25519/publickey.d.ts +30 -0
  194. package/dist/cjs/keypairs/ed25519/publickey.js +90 -0
  195. package/dist/cjs/keypairs/index.d.ts +4 -0
  196. package/dist/cjs/keypairs/index.js +21 -0
  197. package/dist/cjs/keypairs/passkey/index.d.ts +3 -0
  198. package/dist/cjs/keypairs/passkey/index.js +28 -0
  199. package/dist/cjs/keypairs/passkey/keypair.d.ts +113 -0
  200. package/dist/cjs/keypairs/passkey/keypair.js +268 -0
  201. package/dist/cjs/keypairs/passkey/publickey.d.ts +72 -0
  202. package/dist/cjs/keypairs/passkey/publickey.js +175 -0
  203. package/dist/cjs/keypairs/passkey/types.d.ts +12 -0
  204. package/dist/cjs/keypairs/passkey/types.js +16 -0
  205. package/dist/cjs/keypairs/secp256k1/index.d.ts +2 -0
  206. package/dist/cjs/keypairs/secp256k1/index.js +27 -0
  207. package/dist/cjs/keypairs/secp256k1/keypair.d.ts +73 -0
  208. package/dist/cjs/keypairs/secp256k1/keypair.js +159 -0
  209. package/dist/cjs/keypairs/secp256k1/publickey.d.ts +30 -0
  210. package/dist/cjs/keypairs/secp256k1/publickey.js +95 -0
  211. package/dist/cjs/keypairs/secp256r1/index.d.ts +2 -0
  212. package/dist/cjs/keypairs/secp256r1/index.js +27 -0
  213. package/dist/cjs/keypairs/secp256r1/keypair.d.ts +73 -0
  214. package/dist/cjs/keypairs/secp256r1/keypair.js +155 -0
  215. package/dist/cjs/keypairs/secp256r1/publickey.d.ts +30 -0
  216. package/dist/cjs/keypairs/secp256r1/publickey.js +96 -0
  217. package/dist/cjs/multisig/index.d.ts +2 -0
  218. package/dist/cjs/multisig/index.js +27 -0
  219. package/dist/cjs/multisig/publickey.d.ts +79 -0
  220. package/dist/cjs/multisig/publickey.js +296 -0
  221. package/dist/cjs/multisig/signer.d.ts +20 -0
  222. package/dist/cjs/multisig/signer.js +114 -0
  223. package/dist/cjs/package.json +5 -0
  224. package/dist/cjs/transactions/Arguments.d.ts +57 -0
  225. package/dist/cjs/transactions/Arguments.js +36 -0
  226. package/dist/cjs/transactions/Commands.d.ts +57 -0
  227. package/dist/cjs/transactions/Commands.js +143 -0
  228. package/dist/cjs/transactions/Inputs.d.ts +22 -0
  229. package/dist/cjs/transactions/Inputs.js +87 -0
  230. package/dist/cjs/transactions/ObjectCache.d.ts +83 -0
  231. package/dist/cjs/transactions/ObjectCache.js +251 -0
  232. package/dist/cjs/transactions/Transaction.d.ts +710 -0
  233. package/dist/cjs/transactions/Transaction.js +742 -0
  234. package/dist/cjs/transactions/TransactionData.d.ts +73 -0
  235. package/dist/cjs/transactions/TransactionData.js +472 -0
  236. package/dist/cjs/transactions/__tests__/Transaction.test.d.ts +1 -0
  237. package/dist/cjs/transactions/__tests__/bcs.test.d.ts +1 -0
  238. package/dist/cjs/transactions/data/internal.d.ts +1010 -0
  239. package/dist/cjs/transactions/data/internal.js +230 -0
  240. package/dist/cjs/transactions/data/v1.d.ts +312 -0
  241. package/dist/cjs/transactions/data/v1.js +538 -0
  242. package/dist/cjs/transactions/data/v2.d.ts +153 -0
  243. package/dist/cjs/transactions/data/v2.js +124 -0
  244. package/dist/cjs/transactions/executor/caching.d.ts +31 -0
  245. package/dist/cjs/transactions/executor/caching.js +118 -0
  246. package/dist/cjs/transactions/executor/parallel.d.ts +37 -0
  247. package/dist/cjs/transactions/executor/parallel.js +395 -0
  248. package/dist/cjs/transactions/executor/queue.d.ts +11 -0
  249. package/dist/cjs/transactions/executor/queue.js +87 -0
  250. package/dist/cjs/transactions/executor/serial.d.ts +31 -0
  251. package/dist/cjs/transactions/executor/serial.js +136 -0
  252. package/dist/cjs/transactions/hash.d.ts +7 -0
  253. package/dist/cjs/transactions/hash.js +31 -0
  254. package/dist/cjs/transactions/index.d.ts +21 -0
  255. package/dist/cjs/transactions/index.js +50 -0
  256. package/dist/cjs/transactions/intents/CoinWithBalance.d.ts +9 -0
  257. package/dist/cjs/transactions/intents/CoinWithBalance.js +206 -0
  258. package/dist/cjs/transactions/object.d.ts +24 -0
  259. package/dist/cjs/transactions/object.js +116 -0
  260. package/dist/cjs/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
  261. package/dist/cjs/transactions/plugins/NamedPackagesPlugin.js +37 -0
  262. package/dist/cjs/transactions/pure.d.ts +20 -0
  263. package/dist/cjs/transactions/pure.js +64 -0
  264. package/dist/cjs/transactions/resolve.d.ts +13 -0
  265. package/dist/cjs/transactions/resolve.js +103 -0
  266. package/dist/cjs/transactions/serializer.d.ts +7 -0
  267. package/dist/cjs/transactions/serializer.js +189 -0
  268. package/dist/cjs/transactions/utils.d.ts +10 -0
  269. package/dist/cjs/transactions/utils.js +143 -0
  270. package/dist/cjs/utils/constants.d.ts +17 -0
  271. package/dist/cjs/utils/constants.js +57 -0
  272. package/dist/cjs/utils/derived-objects.d.ts +5 -0
  273. package/dist/cjs/utils/derived-objects.js +33 -0
  274. package/dist/cjs/utils/dynamic-fields.d.ts +2 -0
  275. package/dist/cjs/utils/dynamic-fields.js +40 -0
  276. package/dist/cjs/utils/format.d.ts +2 -0
  277. package/dist/cjs/utils/format.js +35 -0
  278. package/dist/cjs/utils/index.d.ts +8 -0
  279. package/dist/cjs/utils/index.js +65 -0
  280. package/dist/cjs/utils/move-registry.d.ts +6 -0
  281. package/dist/cjs/utils/move-registry.js +44 -0
  282. package/dist/cjs/utils/sui-types.d.ts +26 -0
  283. package/dist/cjs/utils/sui-types.js +90 -0
  284. package/dist/cjs/utils/suins.d.ts +2 -0
  285. package/dist/cjs/utils/suins.js +56 -0
  286. package/dist/cjs/verify/index.d.ts +1 -0
  287. package/dist/cjs/verify/index.js +28 -0
  288. package/dist/cjs/verify/verify.d.ts +16 -0
  289. package/dist/cjs/verify/verify.js +125 -0
  290. package/dist/cjs/version.d.ts +2 -0
  291. package/dist/cjs/version.js +26 -0
  292. package/dist/cjs/w/call/allocation.d.ts +35 -0
  293. package/dist/cjs/w/call/allocation.js +439 -0
  294. package/dist/cjs/w/call/arb.d.ts +17 -0
  295. package/dist/cjs/w/call/arb.js +149 -0
  296. package/dist/cjs/w/call/arbitration.d.ts +106 -0
  297. package/dist/cjs/w/call/arbitration.js +1623 -0
  298. package/dist/cjs/w/call/base.d.ts +42 -0
  299. package/dist/cjs/w/call/base.js +363 -0
  300. package/dist/cjs/w/call/contact.d.ts +45 -0
  301. package/dist/cjs/w/call/contact.js +479 -0
  302. package/dist/cjs/w/call/demand.d.ts +79 -0
  303. package/dist/cjs/w/call/demand.js +872 -0
  304. package/dist/cjs/w/call/entity.d.ts +33 -0
  305. package/dist/cjs/w/call/entity.js +230 -0
  306. package/dist/cjs/w/call/guard-ins.d.ts +31 -0
  307. package/dist/cjs/w/call/guard-ins.js +4391 -0
  308. package/dist/cjs/w/call/guard.d.ts +254 -0
  309. package/dist/cjs/w/call/guard.js +1210 -0
  310. package/dist/cjs/w/call/index.d.ts +37 -0
  311. package/dist/cjs/w/call/index.js +71 -0
  312. package/dist/cjs/w/call/machine.d.ts +124 -0
  313. package/dist/cjs/w/call/machine.js +1486 -0
  314. package/dist/cjs/w/call/order.d.ts +73 -0
  315. package/dist/cjs/w/call/order.js +485 -0
  316. package/dist/cjs/w/call/passport.d.ts +24 -0
  317. package/dist/cjs/w/call/passport.js +281 -0
  318. package/dist/cjs/w/call/payment.d.ts +27 -0
  319. package/dist/cjs/w/call/payment.js +241 -0
  320. package/dist/cjs/w/call/permission.d.ts +222 -0
  321. package/dist/cjs/w/call/permission.js +1368 -0
  322. package/dist/cjs/w/call/personal.d.ts +51 -0
  323. package/dist/cjs/w/call/personal.js +184 -0
  324. package/dist/cjs/w/call/progress.d.ts +94 -0
  325. package/dist/cjs/w/call/progress.js +833 -0
  326. package/dist/cjs/w/call/proof.d.ts +27 -0
  327. package/dist/cjs/w/call/proof.js +124 -0
  328. package/dist/cjs/w/call/repository.d.ts +97 -0
  329. package/dist/cjs/w/call/repository.js +1324 -0
  330. package/dist/cjs/w/call/resource.d.ts +27 -0
  331. package/dist/cjs/w/call/resource.js +149 -0
  332. package/dist/cjs/w/call/reward.d.ts +52 -0
  333. package/dist/cjs/w/call/reward.js +879 -0
  334. package/dist/cjs/w/call/service.d.ts +184 -0
  335. package/dist/cjs/w/call/service.js +2468 -0
  336. package/dist/cjs/w/call/treasury.d.ts +77 -0
  337. package/dist/cjs/w/call/treasury.js +1192 -0
  338. package/dist/cjs/w/call/util.d.ts +12 -0
  339. package/dist/cjs/w/call/util.js +661 -0
  340. package/dist/cjs/w/common.d.ts +359 -0
  341. package/dist/cjs/w/common.js +625 -0
  342. package/dist/cjs/w/exception.d.ts +82 -0
  343. package/dist/cjs/w/exception.js +604 -0
  344. package/dist/cjs/w/index.d.ts +8 -0
  345. package/dist/cjs/w/index.js +25 -0
  346. package/dist/cjs/w/local/.eslintrc.js +15 -0
  347. package/dist/cjs/w/local/account.d.ts +134 -0
  348. package/dist/cjs/w/local/account.js +770 -0
  349. package/dist/cjs/w/local/cache.d.ts +35 -0
  350. package/dist/cjs/w/local/cache.js +181 -0
  351. package/dist/cjs/w/local/config.d.ts +15 -0
  352. package/dist/cjs/w/local/config.js +83 -0
  353. package/dist/cjs/w/local/index.d.ts +193 -0
  354. package/dist/cjs/w/local/index.js +322 -0
  355. package/dist/cjs/w/local/local.d.ts +93 -0
  356. package/dist/cjs/w/local/local.js +673 -0
  357. package/dist/cjs/w/local/storage.d.ts +61 -0
  358. package/dist/cjs/w/local/storage.js +219 -0
  359. package/dist/cjs/w/local/token.d.ts +22 -0
  360. package/dist/cjs/w/local/token.js +182 -0
  361. package/dist/cjs/w/local/util.d.ts +5 -0
  362. package/dist/cjs/w/local/util.js +57 -0
  363. package/dist/cjs/w/local/wip.d.ts +218 -0
  364. package/dist/cjs/w/local/wip.js +911 -0
  365. package/dist/cjs/w/messenger/.eslintrc.js +15 -0
  366. package/dist/cjs/w/messenger/crypto.d.ts +269 -0
  367. package/dist/cjs/w/messenger/crypto.js +448 -0
  368. package/dist/cjs/w/messenger/index.d.ts +23 -0
  369. package/dist/cjs/w/messenger/index.js +37 -0
  370. package/dist/cjs/w/messenger/messenger-api.d.ts +225 -0
  371. package/dist/cjs/w/messenger/messenger-api.js +1247 -0
  372. package/dist/cjs/w/messenger/messenger-manager.d.ts +80 -0
  373. package/dist/cjs/w/messenger/messenger-manager.js +1143 -0
  374. package/dist/cjs/w/messenger/messenger.d.ts +231 -0
  375. package/dist/cjs/w/messenger/messenger.js +1512 -0
  376. package/dist/cjs/w/messenger/server.d.ts +134 -0
  377. package/dist/cjs/w/messenger/server.js +535 -0
  378. package/dist/cjs/w/messenger/session.d.ts +78 -0
  379. package/dist/cjs/w/messenger/session.js +418 -0
  380. package/dist/cjs/w/messenger/storage.d.ts +192 -0
  381. package/dist/cjs/w/messenger/storage.js +964 -0
  382. package/dist/cjs/w/messenger/types.d.ts +705 -0
  383. package/dist/cjs/w/messenger/types.js +107 -0
  384. package/dist/cjs/w/messenger/utils.d.ts +15 -0
  385. package/dist/cjs/w/messenger/utils.js +37 -0
  386. package/dist/cjs/w/query/bult-in.d.ts +73 -0
  387. package/dist/cjs/w/query/bult-in.js +121 -0
  388. package/dist/cjs/w/query/event.d.ts +82 -0
  389. package/dist/cjs/w/query/event.js +157 -0
  390. package/dist/cjs/w/query/index.d.ts +5 -0
  391. package/dist/cjs/w/query/index.js +22 -0
  392. package/dist/cjs/w/query/object.d.ts +658 -0
  393. package/dist/cjs/w/query/object.js +1671 -0
  394. package/dist/cjs/w/query/received.d.ts +34 -0
  395. package/dist/cjs/w/query/received.js +93 -0
  396. package/dist/cjs/w/query/util.d.ts +5 -0
  397. package/dist/cjs/w/query/util.js +82 -0
  398. package/dist/cjs/w/util.d.ts +19 -0
  399. package/dist/cjs/w/util.js +715 -0
  400. package/dist/cjs/zklogin/address.js +93 -0
  401. package/dist/cjs/zklogin/bcs.js +41 -0
  402. package/dist/cjs/zklogin/index.js +45 -0
  403. package/dist/cjs/zklogin/jwt-decode.js +88 -0
  404. package/dist/cjs/zklogin/jwt-utils.js +128 -0
  405. package/dist/cjs/zklogin/nonce.js +60 -0
  406. package/dist/cjs/zklogin/poseidon.js +64 -0
  407. package/dist/cjs/zklogin/publickey.js +281 -0
  408. package/dist/cjs/zklogin/signature.js +57 -0
  409. package/dist/cjs/zklogin/utils.js +98 -0
  410. package/dist/esm/bcs/bcs.d.ts +1973 -0
  411. package/dist/esm/bcs/bcs.js +319 -0
  412. package/dist/esm/bcs/effects.d.ts +579 -0
  413. package/dist/esm/bcs/effects.js +211 -0
  414. package/dist/esm/bcs/index.d.ts +2589 -0
  415. package/dist/esm/bcs/index.js +98 -0
  416. package/dist/esm/bcs/pure.d.ts +22 -0
  417. package/dist/esm/bcs/pure.js +42 -0
  418. package/dist/esm/bcs/type-tag-serializer.d.ts +7 -0
  419. package/dist/esm/bcs/type-tag-serializer.js +104 -0
  420. package/dist/esm/bcs/types.d.ts +114 -0
  421. package/dist/esm/bcs/types.js +6 -0
  422. package/dist/esm/client/index.d.ts +5 -0
  423. package/dist/esm/client/index.js +23 -0
  424. package/dist/esm/client/network.d.ts +5 -0
  425. package/dist/esm/client/network.js +23 -0
  426. package/dist/esm/cryptography/index.d.ts +7 -0
  427. package/dist/esm/cryptography/index.js +46 -0
  428. package/dist/esm/cryptography/intent.d.ts +6 -0
  429. package/dist/esm/cryptography/intent.js +14 -0
  430. package/dist/esm/cryptography/keypair.d.ts +73 -0
  431. package/dist/esm/cryptography/keypair.js +108 -0
  432. package/dist/esm/cryptography/mnemonics.d.ts +27 -0
  433. package/dist/esm/cryptography/mnemonics.js +30 -0
  434. package/dist/esm/cryptography/publickey.d.ts +67 -0
  435. package/dist/esm/cryptography/publickey.js +125 -0
  436. package/dist/esm/cryptography/signature-scheme.d.ts +24 -0
  437. package/dist/esm/cryptography/signature-scheme.js +27 -0
  438. package/dist/esm/cryptography/signature.d.ts +62 -0
  439. package/dist/esm/cryptography/signature.js +54 -0
  440. package/dist/esm/experimental/cache.d.ts +12 -0
  441. package/dist/esm/experimental/client.d.ts +12 -0
  442. package/dist/esm/experimental/core.d.ts +33 -0
  443. package/dist/esm/experimental/errors.d.ts +8 -0
  444. package/dist/esm/experimental/index.d.ts +7 -0
  445. package/dist/esm/experimental/persistent-storage.d.ts +134 -0
  446. package/dist/esm/experimental/persistent-storage.test.d.ts +5 -0
  447. package/dist/esm/experimental/transports/utils.d.ts +3 -0
  448. package/dist/esm/experimental/types.d.ts +367 -0
  449. package/dist/esm/faucet/faucet.d.ts +66 -0
  450. package/dist/esm/faucet/faucet.js +118 -0
  451. package/dist/esm/faucet/index.d.ts +1 -0
  452. package/dist/esm/faucet/index.js +16 -0
  453. package/dist/esm/graphql/client.js +79 -0
  454. package/dist/esm/graphql/core.js +505 -0
  455. package/dist/esm/graphql/generated/2024.1/tada-env.js +13121 -0
  456. package/dist/esm/graphql/generated/2024.1/tsconfig.tada.js +16 -0
  457. package/dist/esm/graphql/generated/2024.4/tada-env.js +13267 -0
  458. package/dist/esm/graphql/generated/2024.4/tsconfig.tada.js +16 -0
  459. package/dist/esm/graphql/generated/latest/tada-env.js +12905 -0
  460. package/dist/esm/graphql/generated/latest/tsconfig.tada.js +16 -0
  461. package/dist/esm/graphql/generated/queries.js +788 -0
  462. package/dist/esm/graphql/index.js +8 -0
  463. package/dist/esm/graphql/schemas/2024.1/index.js +8 -0
  464. package/dist/esm/graphql/schemas/2024.4/index.js +8 -0
  465. package/dist/esm/graphql/schemas/latest/index.js +8 -0
  466. package/dist/esm/graphql/types.js +0 -0
  467. package/dist/esm/grpc/client.d.ts +32 -0
  468. package/dist/esm/grpc/client.js +45 -0
  469. package/dist/esm/grpc/core.d.ts +28 -0
  470. package/dist/esm/grpc/core.js +634 -0
  471. package/dist/esm/grpc/index.d.ts +4 -0
  472. package/dist/esm/grpc/index.js +6 -0
  473. package/dist/esm/grpc/proto/google/protobuf/any.d.ts +173 -0
  474. package/dist/esm/grpc/proto/google/protobuf/any.js +118 -0
  475. package/dist/esm/grpc/proto/google/protobuf/duration.d.ts +104 -0
  476. package/dist/esm/grpc/proto/google/protobuf/duration.js +74 -0
  477. package/dist/esm/grpc/proto/google/protobuf/empty.d.ts +25 -0
  478. package/dist/esm/grpc/proto/google/protobuf/empty.js +10 -0
  479. package/dist/esm/grpc/proto/google/protobuf/field_mask.d.ts +231 -0
  480. package/dist/esm/grpc/proto/google/protobuf/field_mask.js +57 -0
  481. package/dist/esm/grpc/proto/google/protobuf/struct.d.ts +169 -0
  482. package/dist/esm/grpc/proto/google/protobuf/struct.js +204 -0
  483. package/dist/esm/grpc/proto/google/protobuf/timestamp.d.ts +145 -0
  484. package/dist/esm/grpc/proto/google/protobuf/timestamp.js +114 -0
  485. package/dist/esm/grpc/proto/google/rpc/error_details.d.ts +525 -0
  486. package/dist/esm/grpc/proto/google/rpc/error_details.js +297 -0
  487. package/dist/esm/grpc/proto/google/rpc/status.d.ts +46 -0
  488. package/dist/esm/grpc/proto/google/rpc/status.js +32 -0
  489. package/dist/esm/grpc/proto/sui/rpc/v2/argument.d.ts +66 -0
  490. package/dist/esm/grpc/proto/sui/rpc/v2/argument.js +50 -0
  491. package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.d.ts +34 -0
  492. package/dist/esm/grpc/proto/sui/rpc/v2/balance_change.js +32 -0
  493. package/dist/esm/grpc/proto/sui/rpc/v2/bcs.d.ts +30 -0
  494. package/dist/esm/grpc/proto/sui/rpc/v2/bcs.js +25 -0
  495. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.d.ts +68 -0
  496. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint.js +57 -0
  497. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.d.ts +74 -0
  498. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_contents.js +64 -0
  499. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.d.ts +195 -0
  500. package/dist/esm/grpc/proto/sui/rpc/v2/checkpoint_summary.js +150 -0
  501. package/dist/esm/grpc/proto/sui/rpc/v2/effects.d.ts +338 -0
  502. package/dist/esm/grpc/proto/sui/rpc/v2/effects.js +280 -0
  503. package/dist/esm/grpc/proto/sui/rpc/v2/epoch.d.ts +62 -0
  504. package/dist/esm/grpc/proto/sui/rpc/v2/epoch.js +67 -0
  505. package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.d.ts +17 -0
  506. package/dist/esm/grpc/proto/sui/rpc/v2/error_reason.js +9 -0
  507. package/dist/esm/grpc/proto/sui/rpc/v2/event.d.ts +88 -0
  508. package/dist/esm/grpc/proto/sui/rpc/v2/event.js +66 -0
  509. package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.d.ts +80 -0
  510. package/dist/esm/grpc/proto/sui/rpc/v2/executed_transaction.js +67 -0
  511. package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.d.ts +843 -0
  512. package/dist/esm/grpc/proto/sui/rpc/v2/execution_status.js +499 -0
  513. package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.d.ts +41 -0
  514. package/dist/esm/grpc/proto/sui/rpc/v2/gas_cost_summary.js +43 -0
  515. package/dist/esm/grpc/proto/sui/rpc/v2/input.d.ts +98 -0
  516. package/dist/esm/grpc/proto/sui/rpc/v2/input.js +65 -0
  517. package/dist/esm/grpc/proto/sui/rpc/v2/jwk.d.ts +70 -0
  518. package/dist/esm/grpc/proto/sui/rpc/v2/jwk.js +61 -0
  519. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.d.ts +95 -0
  520. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.client.js +103 -0
  521. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.d.ts +420 -0
  522. package/dist/esm/grpc/proto/sui/rpc/v2/ledger_service.js +348 -0
  523. package/dist/esm/grpc/proto/sui/rpc/v2/move_package.d.ts +579 -0
  524. package/dist/esm/grpc/proto/sui/rpc/v2/move_package.js +465 -0
  525. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.d.ts +61 -0
  526. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.client.js +62 -0
  527. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.d.ts +229 -0
  528. package/dist/esm/grpc/proto/sui/rpc/v2/move_package_service.js +221 -0
  529. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.d.ts +41 -0
  530. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.client.js +36 -0
  531. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.d.ts +144 -0
  532. package/dist/esm/grpc/proto/sui/rpc/v2/name_service.js +121 -0
  533. package/dist/esm/grpc/proto/sui/rpc/v2/object.d.ts +127 -0
  534. package/dist/esm/grpc/proto/sui/rpc/v2/object.js +94 -0
  535. package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.d.ts +34 -0
  536. package/dist/esm/grpc/proto/sui/rpc/v2/object_reference.js +33 -0
  537. package/dist/esm/grpc/proto/sui/rpc/v2/owner.d.ts +61 -0
  538. package/dist/esm/grpc/proto/sui/rpc/v2/owner.js +43 -0
  539. package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.d.ts +30 -0
  540. package/dist/esm/grpc/proto/sui/rpc/v2/protocol_config.js +41 -0
  541. package/dist/esm/grpc/proto/sui/rpc/v2/signature.d.ts +630 -0
  542. package/dist/esm/grpc/proto/sui/rpc/v2/signature.js +521 -0
  543. package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.d.ts +40 -0
  544. package/dist/esm/grpc/proto/sui/rpc/v2/signature_scheme.js +13 -0
  545. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.ts +35 -0
  546. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.client.js +31 -0
  547. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.d.ts +79 -0
  548. package/dist/esm/grpc/proto/sui/rpc/v2/signature_verification_service.js +70 -0
  549. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.d.ts +71 -0
  550. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.client.js +69 -0
  551. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.d.ts +690 -0
  552. package/dist/esm/grpc/proto/sui/rpc/v2/state_service.js +526 -0
  553. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.d.ts +55 -0
  554. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.client.js +35 -0
  555. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.d.ts +57 -0
  556. package/dist/esm/grpc/proto/sui/rpc/v2/subscription_service.js +45 -0
  557. package/dist/esm/grpc/proto/sui/rpc/v2/system_state.d.ts +684 -0
  558. package/dist/esm/grpc/proto/sui/rpc/v2/system_state.js +720 -0
  559. package/dist/esm/grpc/proto/sui/rpc/v2/transaction.d.ts +1321 -0
  560. package/dist/esm/grpc/proto/sui/rpc/v2/transaction.js +985 -0
  561. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.ts +41 -0
  562. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.client.js +30 -0
  563. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.d.ts +184 -0
  564. package/dist/esm/grpc/proto/sui/rpc/v2/transaction_execution_service.js +157 -0
  565. package/dist/esm/index.d.ts +25 -0
  566. package/dist/esm/index.js +119 -0
  567. package/dist/esm/jsonRpc/client.d.ts +261 -0
  568. package/dist/esm/jsonRpc/client.js +734 -0
  569. package/dist/esm/jsonRpc/core.d.ts +87 -0
  570. package/dist/esm/jsonRpc/core.js +621 -0
  571. package/dist/esm/jsonRpc/errors.d.ts +12 -0
  572. package/dist/esm/jsonRpc/errors.js +46 -0
  573. package/dist/esm/jsonRpc/http-transport.d.ts +42 -0
  574. package/dist/esm/jsonRpc/http-transport.js +101 -0
  575. package/dist/esm/jsonRpc/index.d.ts +4 -0
  576. package/dist/esm/jsonRpc/index.js +20 -0
  577. package/dist/esm/jsonRpc/json-rpc-resolver.d.ts +4 -0
  578. package/dist/esm/jsonRpc/json-rpc-resolver.js +309 -0
  579. package/dist/esm/jsonRpc/rpc-websocket-client.d.ts +43 -0
  580. package/dist/esm/jsonRpc/rpc-websocket-client.js +201 -0
  581. package/dist/esm/jsonRpc/types/chain.d.ts +99 -0
  582. package/dist/esm/jsonRpc/types/chain.js +0 -0
  583. package/dist/esm/jsonRpc/types/changes.d.ts +19 -0
  584. package/dist/esm/jsonRpc/types/changes.js +0 -0
  585. package/dist/esm/jsonRpc/types/coins.d.ts +6 -0
  586. package/dist/esm/jsonRpc/types/coins.js +0 -0
  587. package/dist/esm/jsonRpc/types/common.d.ts +2 -0
  588. package/dist/esm/jsonRpc/types/common.js +0 -0
  589. package/dist/esm/jsonRpc/types/generated.d.ts +1492 -0
  590. package/dist/esm/jsonRpc/types/generated.js +0 -0
  591. package/dist/esm/jsonRpc/types/index.d.ts +6 -0
  592. package/dist/esm/jsonRpc/types/index.js +0 -0
  593. package/dist/esm/jsonRpc/types/params.d.ts +656 -0
  594. package/dist/esm/jsonRpc/types/params.js +0 -0
  595. package/dist/esm/keypairs/ed25519/ed25519-hd-key.d.ts +8 -0
  596. package/dist/esm/keypairs/ed25519/ed25519-hd-key.js +62 -0
  597. package/dist/esm/keypairs/ed25519/index.d.ts +2 -0
  598. package/dist/esm/keypairs/ed25519/index.js +10 -0
  599. package/dist/esm/keypairs/ed25519/keypair.d.ts +74 -0
  600. package/dist/esm/keypairs/ed25519/keypair.js +158 -0
  601. package/dist/esm/keypairs/ed25519/publickey.d.ts +30 -0
  602. package/dist/esm/keypairs/ed25519/publickey.js +75 -0
  603. package/dist/esm/keypairs/index.d.ts +4 -0
  604. package/dist/esm/keypairs/index.js +4 -0
  605. package/dist/esm/keypairs/passkey/index.d.ts +3 -0
  606. package/dist/esm/keypairs/passkey/index.js +12 -0
  607. package/dist/esm/keypairs/passkey/keypair.d.ts +113 -0
  608. package/dist/esm/keypairs/passkey/keypair.js +258 -0
  609. package/dist/esm/keypairs/passkey/publickey.d.ts +72 -0
  610. package/dist/esm/keypairs/passkey/publickey.js +156 -0
  611. package/dist/esm/keypairs/passkey/types.d.ts +12 -0
  612. package/dist/esm/keypairs/passkey/types.js +0 -0
  613. package/dist/esm/keypairs/secp256k1/index.d.ts +2 -0
  614. package/dist/esm/keypairs/secp256k1/index.js +10 -0
  615. package/dist/esm/keypairs/secp256k1/keypair.d.ts +73 -0
  616. package/dist/esm/keypairs/secp256k1/keypair.js +147 -0
  617. package/dist/esm/keypairs/secp256k1/publickey.d.ts +30 -0
  618. package/dist/esm/keypairs/secp256k1/publickey.js +80 -0
  619. package/dist/esm/keypairs/secp256r1/index.d.ts +2 -0
  620. package/dist/esm/keypairs/secp256r1/index.js +10 -0
  621. package/dist/esm/keypairs/secp256r1/keypair.d.ts +73 -0
  622. package/dist/esm/keypairs/secp256r1/keypair.js +143 -0
  623. package/dist/esm/keypairs/secp256r1/publickey.d.ts +30 -0
  624. package/dist/esm/keypairs/secp256r1/publickey.js +77 -0
  625. package/dist/esm/multisig/index.d.ts +2 -0
  626. package/dist/esm/multisig/index.js +10 -0
  627. package/dist/esm/multisig/publickey.d.ts +79 -0
  628. package/dist/esm/multisig/publickey.js +280 -0
  629. package/dist/esm/multisig/signer.d.ts +20 -0
  630. package/dist/esm/multisig/signer.js +94 -0
  631. package/dist/esm/package.json +5 -0
  632. package/dist/esm/transactions/Arguments.d.ts +57 -0
  633. package/dist/esm/transactions/Arguments.js +16 -0
  634. package/dist/esm/transactions/Commands.d.ts +57 -0
  635. package/dist/esm/transactions/Commands.js +123 -0
  636. package/dist/esm/transactions/Inputs.d.ts +22 -0
  637. package/dist/esm/transactions/Inputs.js +67 -0
  638. package/dist/esm/transactions/ObjectCache.d.ts +83 -0
  639. package/dist/esm/transactions/ObjectCache.js +231 -0
  640. package/dist/esm/transactions/Transaction.d.ts +710 -0
  641. package/dist/esm/transactions/Transaction.js +731 -0
  642. package/dist/esm/transactions/TransactionData.d.ts +73 -0
  643. package/dist/esm/transactions/TransactionData.js +453 -0
  644. package/dist/esm/transactions/__tests__/Transaction.test.d.ts +1 -0
  645. package/dist/esm/transactions/__tests__/bcs.test.d.ts +1 -0
  646. package/dist/esm/transactions/data/internal.d.ts +1010 -0
  647. package/dist/esm/transactions/data/internal.js +232 -0
  648. package/dist/esm/transactions/data/v1.d.ts +312 -0
  649. package/dist/esm/transactions/data/v1.js +542 -0
  650. package/dist/esm/transactions/data/v2.d.ts +153 -0
  651. package/dist/esm/transactions/data/v2.js +126 -0
  652. package/dist/esm/transactions/executor/caching.d.ts +31 -0
  653. package/dist/esm/transactions/executor/caching.js +99 -0
  654. package/dist/esm/transactions/executor/parallel.d.ts +37 -0
  655. package/dist/esm/transactions/executor/parallel.js +375 -0
  656. package/dist/esm/transactions/executor/queue.d.ts +11 -0
  657. package/dist/esm/transactions/executor/queue.js +68 -0
  658. package/dist/esm/transactions/executor/serial.d.ts +31 -0
  659. package/dist/esm/transactions/executor/serial.js +116 -0
  660. package/dist/esm/transactions/hash.d.ts +7 -0
  661. package/dist/esm/transactions/hash.js +11 -0
  662. package/dist/esm/transactions/index.d.ts +21 -0
  663. package/dist/esm/transactions/index.js +41 -0
  664. package/dist/esm/transactions/intents/CoinWithBalance.d.ts +9 -0
  665. package/dist/esm/transactions/intents/CoinWithBalance.js +186 -0
  666. package/dist/esm/transactions/object.d.ts +24 -0
  667. package/dist/esm/transactions/object.js +96 -0
  668. package/dist/esm/transactions/plugins/NamedPackagesPlugin.d.ts +31 -0
  669. package/dist/esm/transactions/plugins/NamedPackagesPlugin.js +17 -0
  670. package/dist/esm/transactions/pure.d.ts +20 -0
  671. package/dist/esm/transactions/pure.js +44 -0
  672. package/dist/esm/transactions/resolve.d.ts +13 -0
  673. package/dist/esm/transactions/resolve.js +83 -0
  674. package/dist/esm/transactions/serializer.d.ts +7 -0
  675. package/dist/esm/transactions/serializer.js +169 -0
  676. package/dist/esm/transactions/utils.d.ts +10 -0
  677. package/dist/esm/transactions/utils.js +123 -0
  678. package/dist/esm/utils/constants.d.ts +17 -0
  679. package/dist/esm/utils/constants.js +37 -0
  680. package/dist/esm/utils/derived-objects.d.ts +5 -0
  681. package/dist/esm/utils/derived-objects.js +13 -0
  682. package/dist/esm/utils/dynamic-fields.d.ts +2 -0
  683. package/dist/esm/utils/dynamic-fields.js +20 -0
  684. package/dist/esm/utils/format.d.ts +2 -0
  685. package/dist/esm/utils/format.js +15 -0
  686. package/dist/esm/utils/index.d.ts +8 -0
  687. package/dist/esm/utils/index.js +76 -0
  688. package/dist/esm/utils/move-registry.d.ts +6 -0
  689. package/dist/esm/utils/move-registry.js +24 -0
  690. package/dist/esm/utils/sui-types.d.ts +26 -0
  691. package/dist/esm/utils/sui-types.js +70 -0
  692. package/dist/esm/utils/suins.d.ts +2 -0
  693. package/dist/esm/utils/suins.js +36 -0
  694. package/dist/esm/verify/index.d.ts +1 -0
  695. package/dist/esm/verify/index.js +14 -0
  696. package/dist/esm/verify/verify.d.ts +16 -0
  697. package/dist/esm/verify/verify.js +108 -0
  698. package/dist/esm/version.d.ts +2 -0
  699. package/dist/esm/version.js +6 -0
  700. package/dist/esm/w/call/allocation.d.ts +35 -0
  701. package/dist/esm/w/call/allocation.js +433 -0
  702. package/dist/esm/w/call/arb.d.ts +17 -0
  703. package/dist/esm/w/call/arb.js +138 -0
  704. package/dist/esm/w/call/arbitration.d.ts +106 -0
  705. package/dist/esm/w/call/arbitration.js +1620 -0
  706. package/dist/esm/w/call/base.d.ts +42 -0
  707. package/dist/esm/w/call/base.js +350 -0
  708. package/dist/esm/w/call/contact.d.ts +45 -0
  709. package/dist/esm/w/call/contact.js +474 -0
  710. package/dist/esm/w/call/demand.d.ts +79 -0
  711. package/dist/esm/w/call/demand.js +869 -0
  712. package/dist/esm/w/call/entity.d.ts +33 -0
  713. package/dist/esm/w/call/entity.js +220 -0
  714. package/dist/esm/w/call/guard-ins.d.ts +31 -0
  715. package/dist/esm/w/call/guard-ins.js +4371 -0
  716. package/dist/esm/w/call/guard.d.ts +254 -0
  717. package/dist/esm/w/call/guard.js +1202 -0
  718. package/dist/esm/w/call/index.d.ts +37 -0
  719. package/dist/esm/w/call/index.js +57 -0
  720. package/dist/esm/w/call/machine.d.ts +124 -0
  721. package/dist/esm/w/call/machine.js +1492 -0
  722. package/dist/esm/w/call/order.d.ts +73 -0
  723. package/dist/esm/w/call/order.js +481 -0
  724. package/dist/esm/w/call/passport.d.ts +24 -0
  725. package/dist/esm/w/call/passport.js +266 -0
  726. package/dist/esm/w/call/payment.d.ts +27 -0
  727. package/dist/esm/w/call/payment.js +233 -0
  728. package/dist/esm/w/call/permission.d.ts +222 -0
  729. package/dist/esm/w/call/permission.js +1375 -0
  730. package/dist/esm/w/call/personal.d.ts +51 -0
  731. package/dist/esm/w/call/personal.js +177 -0
  732. package/dist/esm/w/call/progress.d.ts +94 -0
  733. package/dist/esm/w/call/progress.js +827 -0
  734. package/dist/esm/w/call/proof.d.ts +27 -0
  735. package/dist/esm/w/call/proof.js +110 -0
  736. package/dist/esm/w/call/repository.d.ts +97 -0
  737. package/dist/esm/w/call/repository.js +1325 -0
  738. package/dist/esm/w/call/resource.d.ts +27 -0
  739. package/dist/esm/w/call/resource.js +135 -0
  740. package/dist/esm/w/call/reward.d.ts +52 -0
  741. package/dist/esm/w/call/reward.js +874 -0
  742. package/dist/esm/w/call/service.d.ts +184 -0
  743. package/dist/esm/w/call/service.js +2472 -0
  744. package/dist/esm/w/call/treasury.d.ts +77 -0
  745. package/dist/esm/w/call/treasury.js +1186 -0
  746. package/dist/esm/w/call/util.d.ts +12 -0
  747. package/dist/esm/w/call/util.js +646 -0
  748. package/dist/esm/w/common.d.ts +359 -0
  749. package/dist/esm/w/common.js +605 -0
  750. package/dist/esm/w/exception.d.ts +82 -0
  751. package/dist/esm/w/exception.js +585 -0
  752. package/dist/esm/w/index.d.ts +8 -0
  753. package/dist/esm/w/index.js +8 -0
  754. package/dist/esm/w/local/.eslintrc.js +23 -0
  755. package/dist/esm/w/local/account.d.ts +134 -0
  756. package/dist/esm/w/local/account.js +746 -0
  757. package/dist/esm/w/local/cache.d.ts +35 -0
  758. package/dist/esm/w/local/cache.js +162 -0
  759. package/dist/esm/w/local/config.d.ts +15 -0
  760. package/dist/esm/w/local/config.js +64 -0
  761. package/dist/esm/w/local/index.d.ts +193 -0
  762. package/dist/esm/w/local/index.js +301 -0
  763. package/dist/esm/w/local/local.d.ts +93 -0
  764. package/dist/esm/w/local/local.js +654 -0
  765. package/dist/esm/w/local/storage.d.ts +61 -0
  766. package/dist/esm/w/local/storage.js +190 -0
  767. package/dist/esm/w/local/token.d.ts +22 -0
  768. package/dist/esm/w/local/token.js +163 -0
  769. package/dist/esm/w/local/util.d.ts +5 -0
  770. package/dist/esm/w/local/util.js +27 -0
  771. package/dist/esm/w/local/wip.d.ts +218 -0
  772. package/dist/esm/w/local/wip.js +882 -0
  773. package/dist/esm/w/messenger/.eslintrc.js +23 -0
  774. package/dist/esm/w/messenger/crypto.d.ts +269 -0
  775. package/dist/esm/w/messenger/crypto.js +428 -0
  776. package/dist/esm/w/messenger/index.d.ts +23 -0
  777. package/dist/esm/w/messenger/index.js +25 -0
  778. package/dist/esm/w/messenger/messenger-api.d.ts +225 -0
  779. package/dist/esm/w/messenger/messenger-api.js +1228 -0
  780. package/dist/esm/w/messenger/messenger-manager.d.ts +80 -0
  781. package/dist/esm/w/messenger/messenger-manager.js +1118 -0
  782. package/dist/esm/w/messenger/messenger.d.ts +231 -0
  783. package/dist/esm/w/messenger/messenger.js +1492 -0
  784. package/dist/esm/w/messenger/server.d.ts +134 -0
  785. package/dist/esm/w/messenger/server.js +520 -0
  786. package/dist/esm/w/messenger/session.d.ts +78 -0
  787. package/dist/esm/w/messenger/session.js +415 -0
  788. package/dist/esm/w/messenger/storage.d.ts +192 -0
  789. package/dist/esm/w/messenger/storage.js +935 -0
  790. package/dist/esm/w/messenger/types.d.ts +705 -0
  791. package/dist/esm/w/messenger/types.js +88 -0
  792. package/dist/esm/w/messenger/utils.d.ts +15 -0
  793. package/dist/esm/w/messenger/utils.js +17 -0
  794. package/dist/esm/w/query/bult-in.d.ts +73 -0
  795. package/dist/esm/w/query/bult-in.js +112 -0
  796. package/dist/esm/w/query/event.d.ts +82 -0
  797. package/dist/esm/w/query/event.js +137 -0
  798. package/dist/esm/w/query/index.d.ts +5 -0
  799. package/dist/esm/w/query/index.js +5 -0
  800. package/dist/esm/w/query/object.d.ts +658 -0
  801. package/dist/esm/w/query/object.js +1648 -0
  802. package/dist/esm/w/query/received.d.ts +34 -0
  803. package/dist/esm/w/query/received.js +73 -0
  804. package/dist/esm/w/query/util.d.ts +5 -0
  805. package/dist/esm/w/query/util.js +62 -0
  806. package/dist/esm/w/util.d.ts +19 -0
  807. package/dist/esm/w/util.js +710 -0
  808. package/dist/esm/zklogin/address.js +78 -0
  809. package/dist/esm/zklogin/bcs.js +21 -0
  810. package/dist/esm/zklogin/index.js +38 -0
  811. package/dist/esm/zklogin/jwt-decode.js +68 -0
  812. package/dist/esm/zklogin/jwt-utils.js +108 -0
  813. package/dist/esm/zklogin/nonce.js +40 -0
  814. package/dist/esm/zklogin/poseidon.js +61 -0
  815. package/dist/esm/zklogin/publickey.js +265 -0
  816. package/dist/esm/zklogin/signature.js +37 -0
  817. package/dist/esm/zklogin/utils.js +78 -0
  818. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  819. package/dist/tsconfig.tsbuildinfo +1 -0
  820. package/package.json +295 -61
  821. package/dist/arbitration.d.ts +0 -65
  822. package/dist/arbitration.d.ts.map +0 -1
  823. package/dist/arbitration.js +0 -517
  824. package/dist/arbitration.js.map +0 -1
  825. package/dist/demand.d.ts +0 -27
  826. package/dist/demand.d.ts.map +0 -1
  827. package/dist/demand.js +0 -266
  828. package/dist/demand.js.map +0 -1
  829. package/dist/entity.d.ts +0 -46
  830. package/dist/entity.d.ts.map +0 -1
  831. package/dist/entity.js +0 -146
  832. package/dist/entity.js.map +0 -1
  833. package/dist/exception.d.ts +0 -37
  834. package/dist/exception.d.ts.map +0 -1
  835. package/dist/exception.js +0 -41
  836. package/dist/exception.js.map +0 -1
  837. package/dist/guard.d.ts +0 -110
  838. package/dist/guard.d.ts.map +0 -1
  839. package/dist/guard.js +0 -936
  840. package/dist/guard.js.map +0 -1
  841. package/dist/index.d.ts +0 -40
  842. package/dist/index.d.ts.map +0 -1
  843. package/dist/index.js +0 -28
  844. package/dist/index.js.map +0 -1
  845. package/dist/machine.d.ts +0 -68
  846. package/dist/machine.d.ts.map +0 -1
  847. package/dist/machine.js +0 -520
  848. package/dist/machine.js.map +0 -1
  849. package/dist/passport.d.ts +0 -129
  850. package/dist/passport.d.ts.map +0 -1
  851. package/dist/passport.js +0 -1233
  852. package/dist/passport.js.map +0 -1
  853. package/dist/payment.d.ts +0 -28
  854. package/dist/payment.d.ts.map +0 -1
  855. package/dist/payment.js +0 -60
  856. package/dist/payment.js.map +0 -1
  857. package/dist/permission.d.ts +0 -155
  858. package/dist/permission.d.ts.map +0 -1
  859. package/dist/permission.js +0 -462
  860. package/dist/permission.js.map +0 -1
  861. package/dist/progress.d.ts +0 -66
  862. package/dist/progress.d.ts.map +0 -1
  863. package/dist/progress.js +0 -311
  864. package/dist/progress.js.map +0 -1
  865. package/dist/protocol.d.ts +0 -247
  866. package/dist/protocol.d.ts.map +0 -1
  867. package/dist/protocol.js +0 -726
  868. package/dist/protocol.js.map +0 -1
  869. package/dist/repository.d.ts +0 -94
  870. package/dist/repository.d.ts.map +0 -1
  871. package/dist/repository.js +0 -783
  872. package/dist/repository.js.map +0 -1
  873. package/dist/resource.d.ts +0 -36
  874. package/dist/resource.d.ts.map +0 -1
  875. package/dist/resource.js +0 -129
  876. package/dist/resource.js.map +0 -1
  877. package/dist/service.d.ts +0 -144
  878. package/dist/service.d.ts.map +0 -1
  879. package/dist/service.js +0 -1303
  880. package/dist/service.js.map +0 -1
  881. package/dist/treasury.d.ts +0 -55
  882. package/dist/treasury.d.ts.map +0 -1
  883. package/dist/treasury.js +0 -393
  884. package/dist/treasury.js.map +0 -1
  885. package/dist/utils.d.ts +0 -94
  886. package/dist/utils.d.ts.map +0 -1
  887. package/dist/utils.js +0 -582
  888. package/dist/utils.js.map +0 -1
  889. package/dist/wowok.d.ts +0 -15
  890. package/dist/wowok.d.ts.map +0 -1
  891. package/dist/wowok.js +0 -66
  892. package/dist/wowok.js.map +0 -1
@@ -0,0 +1,2468 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+ var service_exports = {};
22
+ __export(service_exports, {
23
+ CallService: () => CallService,
24
+ DEFAULT_COMPENSATION_LOCK_DURATION: () => DEFAULT_COMPENSATION_LOCK_DURATION,
25
+ DISCOUNT_TYPE_MINUS: () => DISCOUNT_TYPE_MINUS,
26
+ DISCOUNT_TYPE_RATES: () => DISCOUNT_TYPE_RATES,
27
+ MAX_ARBITRATION_COUNT: () => MAX_ARBITRATION_COUNT,
28
+ MAX_CUSTOMER_REQUIRED_INFO_COUNT: () => MAX_CUSTOMER_REQUIRED_INFO_COUNT,
29
+ MAX_DISCOUNT_COUNT_ONCE: () => MAX_DISCOUNT_COUNT_ONCE,
30
+ MAX_DISCOUNT_RECEIVER_ONCE: () => MAX_DISCOUNT_RECEIVER_ONCE,
31
+ MAX_DISCOUNT_TOTAL_COUNT: () => MAX_DISCOUNT_TOTAL_COUNT,
32
+ MAX_PUBKEY_LENGTH: () => MAX_PUBKEY_LENGTH,
33
+ MAX_REPOSITORY_COUNT: () => MAX_REPOSITORY_COUNT,
34
+ MAX_REQUIRED_INFO_SIZE: () => MAX_REQUIRED_INFO_SIZE,
35
+ MAX_REWARD_COUNT: () => MAX_REWARD_COUNT,
36
+ MAX_SALE_COUNT: () => MAX_SALE_COUNT,
37
+ arbitration_clear: () => arbitration_clear,
38
+ arbitrations_add: () => arbitrations_add,
39
+ arbitrations_remove: () => arbitrations_remove,
40
+ buy: () => buy,
41
+ buy_guard_set: () => buy_guard_set,
42
+ compensation_fund_add: () => compensation_fund_add,
43
+ compensation_fund_receive: () => compensation_fund_receive,
44
+ compensation_fund_withdraw: () => compensation_fund_withdraw,
45
+ compensation_lock_duration_set: () => compensation_lock_duration_set,
46
+ create: () => create,
47
+ customer_required_set: () => customer_required_set,
48
+ description_set: () => description_set,
49
+ discount: () => discount,
50
+ discount_destroy: () => discount_destroy,
51
+ discount_send: () => discount_send,
52
+ location_set: () => location_set,
53
+ machine_set: () => machine_set,
54
+ newService: () => newService,
55
+ order_allocators_set: () => order_allocators_set,
56
+ pause: () => pause,
57
+ price_add: () => price_add,
58
+ price_reduce: () => price_reduce,
59
+ publish: () => publish,
60
+ repository_add: () => repository_add,
61
+ repository_clear: () => repository_clear,
62
+ repository_remove: () => repository_remove,
63
+ reward_add: () => reward_add,
64
+ reward_clear: () => reward_clear,
65
+ reward_remove: () => reward_remove,
66
+ sale_suspension: () => sale_suspension,
67
+ sales_add: () => sales_add,
68
+ sales_clear: () => sales_clear,
69
+ sales_remove: () => sales_remove,
70
+ sales_set: () => sales_set,
71
+ stock_add: () => stock_add,
72
+ stock_reduce: () => stock_reduce,
73
+ um_set: () => um_set
74
+ });
75
+ module.exports = __toCommonJS(service_exports);
76
+ var import_common = require("../common.js");
77
+ var import_exception = require("../exception.js");
78
+ var import_object = require("../query/object.js");
79
+ var import_util = require("../util.js");
80
+ var import_allocation = require("./allocation.js");
81
+ var import_base = require("./base.js");
82
+ var import_permission = require("./permission.js");
83
+ var import_local = require("../local/index.js");
84
+ var import_local2 = require("../local/local.js");
85
+ var import_order = require("./order.js");
86
+ var import_progress = require("./progress.js");
87
+ var import_order2 = require("./order.js");
88
+ var import_permission2 = require("./permission.js");
89
+ var import_util2 = require("../query/util.js");
90
+ var import_received = require("../query/received.js");
91
+ class CallService extends import_base.CallBase {
92
+ constructor(data) {
93
+ super();
94
+ __publicField(this, "data");
95
+ __publicField(this, "object_address");
96
+ __publicField(this, "permission_address");
97
+ __publicField(this, "new_permission_description");
98
+ __publicField(this, "parameter_type");
99
+ __publicField(this, "checkPublished", (op) => {
100
+ if (this.content && !this.content.bPublished) {
101
+ (0, import_exception.W_ERROR)(
102
+ import_exception.WErrors.Fail,
103
+ `Service object has not been published yet, so the operation (${op}) cannot proceed.`
104
+ );
105
+ }
106
+ });
107
+ __publicField(this, "checkNotPublished", (op) => {
108
+ if (this.content && this.content.bPublished) {
109
+ (0, import_exception.W_ERROR)(
110
+ import_exception.WErrors.Fail,
111
+ `Service object has been published and operation (${op}) cannot proceed.
112
+ If further modifications are needed, you can 'clone' a new Service and then proceed with the operation.`
113
+ );
114
+ }
115
+ });
116
+ __publicField(this, "checkNotPaused", (op) => {
117
+ if (this.content && this.content.bPaused) {
118
+ (0, import_exception.W_ERROR)(
119
+ import_exception.WErrors.Fail,
120
+ `Service object has been paused and operation (${op}) cannot proceed.`
121
+ );
122
+ }
123
+ });
124
+ this.data = data;
125
+ }
126
+ async prepare(env) {
127
+ await super.prepare(env);
128
+ if (!this.object_address) {
129
+ this.object_address = await (0, import_common.GetObjectExisted)(this.data?.object);
130
+ }
131
+ if (this.object_address) {
132
+ await this.update_content(
133
+ env,
134
+ import_object.ObjectType.Service,
135
+ this.object_address
136
+ );
137
+ if (!this.content)
138
+ (0, import_exception.W_ERROR)(
139
+ import_exception.WErrors.InvalidParam,
140
+ "CallService_Data.data.object:" + this.object_address
141
+ );
142
+ this.permission_address = this.content.permission;
143
+ this.parameter_type = (0, import_util.parseObjectType)(
144
+ this.content.type_raw,
145
+ "service::Service"
146
+ );
147
+ if (!this.permission_address) {
148
+ (0, import_exception.W_ERROR)(
149
+ import_exception.WErrors.InvalidParam,
150
+ "CallService_Data.data.object.permission is empty"
151
+ );
152
+ }
153
+ if (!(0, import_common.IsValidArgType)(this.parameter_type)) {
154
+ (0, import_exception.W_ERROR)(
155
+ import_exception.WErrors.IsValidArgType,
156
+ "CallService_Data.data.object.type_parameter is empty"
157
+ );
158
+ }
159
+ } else {
160
+ const n = (0, import_common.GetObject)(
161
+ this.data.object
162
+ );
163
+ this.permission_address = await (0, import_common.GetObjectExisted)(n?.permission);
164
+ this.new_permission_description = (0, import_common.GetObjectDescription)(
165
+ n?.permission
166
+ );
167
+ this.parameter_type = n?.type_parameter;
168
+ if (!(0, import_common.IsValidArgType)(this.parameter_type)) {
169
+ (0, import_exception.W_ERROR)(
170
+ import_exception.WErrors.IsValidArgType,
171
+ "CallService_Data.data.object.type_parameter invalid"
172
+ );
173
+ }
174
+ }
175
+ }
176
+ async call(env) {
177
+ await this.prepare(env);
178
+ const guards = [];
179
+ const perms = [];
180
+ const add_guard = (guard) => {
181
+ if (!guards.includes(guard)) {
182
+ guards.push(guard);
183
+ }
184
+ };
185
+ const add_perm = (index) => {
186
+ if (this.permission_address && !perms.includes(index)) {
187
+ perms.push(index);
188
+ }
189
+ };
190
+ if (this.permission_address && !this.object_address) {
191
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_NEW);
192
+ }
193
+ if (this.data?.order_new) {
194
+ if (!this.content) {
195
+ (0, import_exception.W_ERROR)(
196
+ import_exception.WErrors.InvalidParam,
197
+ `CallService_Data.data.order_new fail because the Service ${JSON.stringify(this.data.object)} content not ready`
198
+ );
199
+ }
200
+ this.order_allowed();
201
+ if (this.content.buy_guard != null) {
202
+ add_guard(this.content.buy_guard);
203
+ }
204
+ }
205
+ if (this.permission_address && this.data?.description != null && this.object_address) {
206
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_DESCRIPTION);
207
+ }
208
+ if (this.permission_address && this.data?.location != null) {
209
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_LOCATION);
210
+ }
211
+ if (this.permission_address && this.data?.repositories != null) {
212
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_REPOSITORY);
213
+ }
214
+ if (this.permission_address && this.data?.sales != null) {
215
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_SALES);
216
+ }
217
+ if (this.permission_address && this.data?.machine !== void 0) {
218
+ this.checkNotPublished("machine");
219
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_MACHINE);
220
+ }
221
+ if (this.permission_address && this.data?.discount != null) {
222
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_DISCOUNT);
223
+ }
224
+ if (this.permission_address && this.data?.arbitrations != null) {
225
+ this.checkNotPublished("arbitrations");
226
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_ARBITRATION);
227
+ }
228
+ if (this.permission_address && this.data?.customer_required != null) {
229
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_CUSTOMER_INFO_REQUIRED);
230
+ }
231
+ if (this.permission_address && this.data?.pause !== void 0) {
232
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_PAUSE);
233
+ }
234
+ if (this.permission_address && this.data?.publish) {
235
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_PUBLISH);
236
+ }
237
+ if (this.permission_address && this.data?.order_allocators !== void 0) {
238
+ this.checkNotPublished("order_allocators");
239
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_ORDER_ALLOCATOR);
240
+ }
241
+ if (this.permission_address && this.data?.compensation_fund_add != null) {
242
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_COMPENSATION_FUND_DEPOSIT);
243
+ }
244
+ if (this.permission_address && this.data?.compensation_locked_time_add !== void 0) {
245
+ add_perm(
246
+ import_permission.BuiltinPermissionIndex.SERVICE_COMPENSATION_LOCKED_TIME_ADD
247
+ );
248
+ }
249
+ if (this.permission_address && this.data?.rewards != null) {
250
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_REWARD);
251
+ }
252
+ if (this.permission_address && this.data?.compensation_fund_receive != null) {
253
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_COMPENSATION_FUND_RECEIVE);
254
+ }
255
+ if (this.permission_address && this.data?.owner_receive != null) {
256
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_OWNER_RECEIVE);
257
+ }
258
+ if (this.permission_address && this.data?.um !== void 0) {
259
+ add_perm(import_permission.BuiltinPermissionIndex.SERVICE_UM);
260
+ }
261
+ if (this.permission_address || guards.length > 0) {
262
+ return await this.check_permission_and_call(
263
+ env,
264
+ this.permission_address,
265
+ perms,
266
+ guards
267
+ );
268
+ }
269
+ return await this.exec(env);
270
+ }
271
+ async operate(env, tx, passport, submission) {
272
+ let permission = this.permission_address;
273
+ let object = this.object_address;
274
+ if (!this.object_address) {
275
+ if (!permission) {
276
+ permission = (0, import_permission.newPermission)(
277
+ tx,
278
+ this.new_permission_description ?? ""
279
+ );
280
+ }
281
+ if (permission && this.parameter_type) {
282
+ object = newService(
283
+ tx,
284
+ this.parameter_type,
285
+ permission,
286
+ this.data?.description ?? "",
287
+ passport
288
+ );
289
+ }
290
+ }
291
+ if (!object || !permission) {
292
+ (0, import_exception.W_ERROR)(
293
+ import_exception.WErrors.InvalidParam,
294
+ "CallService_Data.data.object:" + this.object_address
295
+ );
296
+ }
297
+ let buyResult;
298
+ if (this.data?.order_new != null && this.content) {
299
+ this.order_allowed();
300
+ const n = this.data?.order_new;
301
+ n.buy.discount = await import_local2.LocalMark.Instance().get_address(
302
+ this.data.order_new.buy.discount
303
+ );
304
+ buyResult = await buy(
305
+ env,
306
+ tx,
307
+ object,
308
+ this.parameter_type,
309
+ this.content.machine,
310
+ n.buy,
311
+ passport
312
+ );
313
+ if (!buyResult) {
314
+ (0, import_exception.W_ERROR)(import_exception.WErrors.Fail, "Buy failed, no order created");
315
+ }
316
+ if (n?.agents != null) {
317
+ (0, import_order.agent_set)(tx, {
318
+ order: buyResult.order,
319
+ agents: await (0, import_local.GetManyAccountOrMark_Address)(n.agents)
320
+ });
321
+ }
322
+ if (n?.order_required_info !== void 0) {
323
+ await (0, import_order.order_required_info_update)(
324
+ tx,
325
+ buyResult.order,
326
+ n.order_required_info
327
+ );
328
+ }
329
+ if (n?.transfer != null) {
330
+ await (0, import_order.owner_change)(tx, {
331
+ order: buyResult.order,
332
+ new_owner: n.transfer
333
+ });
334
+ }
335
+ if (n?.namedNewAllocation != null && buyResult?.allocation) {
336
+ await this.new_with_mark(
337
+ env,
338
+ tx,
339
+ import_object.ObjectType.Allocation,
340
+ buyResult?.allocation,
341
+ (0, import_common.GetObject)(n.namedNewAllocation)
342
+ );
343
+ }
344
+ if (buyResult?.progress) {
345
+ if (n?.namedNewProgress != null) {
346
+ await this.new_with_mark(
347
+ env,
348
+ tx,
349
+ import_object.ObjectType.Progress,
350
+ (0, import_progress.create)(tx, buyResult?.progress),
351
+ (0, import_common.GetObject)(n.namedNewProgress)
352
+ );
353
+ } else {
354
+ (0, import_progress.create)(tx, buyResult?.progress);
355
+ }
356
+ }
357
+ if (buyResult?.order) {
358
+ const addr = (0, import_order2.create)(tx, buyResult?.order);
359
+ if (n?.namedNewOrder != null) {
360
+ await this.new_with_mark(
361
+ env,
362
+ tx,
363
+ import_object.ObjectType.Order,
364
+ addr,
365
+ (0, import_common.GetObject)(n.namedNewOrder)
366
+ );
367
+ }
368
+ }
369
+ }
370
+ if (this.data.description != null && !this.object_address) {
371
+ description_set(
372
+ tx,
373
+ object,
374
+ this.parameter_type,
375
+ permission,
376
+ this.data.description,
377
+ passport
378
+ );
379
+ }
380
+ if (this.data.location != null) {
381
+ location_set(
382
+ tx,
383
+ object,
384
+ this.parameter_type,
385
+ permission,
386
+ this.data.location,
387
+ passport
388
+ );
389
+ }
390
+ if (this.data.sales != null) {
391
+ switch (this.data.sales.op) {
392
+ case "add": {
393
+ sales_add(
394
+ tx,
395
+ object,
396
+ this.parameter_type,
397
+ permission,
398
+ this.data.sales.sales,
399
+ passport
400
+ );
401
+ break;
402
+ }
403
+ case "set": {
404
+ sales_set(
405
+ tx,
406
+ object,
407
+ this.parameter_type,
408
+ permission,
409
+ this.data.sales.sales,
410
+ passport
411
+ );
412
+ break;
413
+ }
414
+ case "remove": {
415
+ sales_remove(
416
+ tx,
417
+ object,
418
+ this.parameter_type,
419
+ permission,
420
+ this.data.sales.sales_name,
421
+ passport
422
+ );
423
+ break;
424
+ }
425
+ case "clear": {
426
+ sales_clear(
427
+ tx,
428
+ object,
429
+ this.parameter_type,
430
+ permission,
431
+ passport
432
+ );
433
+ break;
434
+ }
435
+ }
436
+ }
437
+ if (this.data.repositories != null) {
438
+ switch (this.data.repositories.op) {
439
+ case "add":
440
+ case "set": {
441
+ if (this.data.repositories.objects.length > MAX_REPOSITORY_COUNT) {
442
+ (0, import_exception.W_ERROR)(
443
+ import_exception.WErrors.InvalidParam,
444
+ "CallService_Data.data.repositories.objects:" + this.data.repositories.objects
445
+ );
446
+ }
447
+ if (this.data.repositories.op === "set") {
448
+ repository_clear(
449
+ tx,
450
+ object,
451
+ this.parameter_type,
452
+ permission,
453
+ passport
454
+ );
455
+ }
456
+ const r = await import_local2.LocalMark.Instance().get_many_address_availables(
457
+ this.data.repositories.objects
458
+ );
459
+ r.forEach((repo) => {
460
+ repository_add(
461
+ tx,
462
+ object,
463
+ this.parameter_type,
464
+ permission,
465
+ repo,
466
+ passport
467
+ );
468
+ });
469
+ break;
470
+ }
471
+ case "remove": {
472
+ if (this.data.repositories.objects.length > MAX_REPOSITORY_COUNT) {
473
+ (0, import_exception.W_ERROR)(
474
+ import_exception.WErrors.InvalidParam,
475
+ "CallService_Data.data.repositories.objects:" + this.data.repositories.objects
476
+ );
477
+ }
478
+ const addrs = await import_local2.LocalMark.Instance().get_many_address_availables(
479
+ this.data.repositories.objects
480
+ );
481
+ repository_remove(
482
+ tx,
483
+ object,
484
+ this.parameter_type,
485
+ permission,
486
+ addrs,
487
+ passport
488
+ );
489
+ break;
490
+ }
491
+ case "clear": {
492
+ repository_clear(
493
+ tx,
494
+ object,
495
+ this.parameter_type,
496
+ permission,
497
+ passport
498
+ );
499
+ break;
500
+ }
501
+ }
502
+ }
503
+ if (this.data.rewards != null) {
504
+ switch (this.data.rewards.op) {
505
+ case "add":
506
+ case "set": {
507
+ if (this.data.rewards.objects.length > MAX_REWARD_COUNT) {
508
+ (0, import_exception.W_ERROR)(
509
+ import_exception.WErrors.InvalidParam,
510
+ `rewards count exceeds maximum limit ${MAX_REWARD_COUNT}`
511
+ );
512
+ }
513
+ if (this.data.rewards.op === "set") {
514
+ reward_clear(
515
+ tx,
516
+ object,
517
+ this.parameter_type,
518
+ permission,
519
+ passport
520
+ );
521
+ }
522
+ const rewards = await (0, import_util2.queryObjectsWithType)(
523
+ env,
524
+ this.data.rewards.objects,
525
+ import_object.ObjectType.Reward,
526
+ "reward::Reward",
527
+ false
528
+ );
529
+ rewards.forEach((reward) => {
530
+ reward_add(
531
+ tx,
532
+ object,
533
+ this.parameter_type,
534
+ permission,
535
+ reward.object,
536
+ reward.type,
537
+ passport
538
+ );
539
+ });
540
+ break;
541
+ }
542
+ case "remove": {
543
+ if (this.data.rewards.objects.length > MAX_REWARD_COUNT) {
544
+ (0, import_exception.W_ERROR)(
545
+ import_exception.WErrors.InvalidParam,
546
+ `rewards count exceeds maximum limit ${MAX_REWARD_COUNT}`
547
+ );
548
+ }
549
+ const addrs = await import_local2.LocalMark.Instance().get_many_address_availables(
550
+ this.data.rewards.objects
551
+ );
552
+ reward_remove(
553
+ tx,
554
+ object,
555
+ this.parameter_type,
556
+ permission,
557
+ addrs,
558
+ passport
559
+ );
560
+ break;
561
+ }
562
+ case "clear": {
563
+ reward_clear(
564
+ tx,
565
+ object,
566
+ this.parameter_type,
567
+ permission,
568
+ passport
569
+ );
570
+ break;
571
+ }
572
+ }
573
+ }
574
+ if (this.data.arbitrations != null) {
575
+ switch (this.data.arbitrations.op) {
576
+ case "add":
577
+ case "set": {
578
+ if (this.data.arbitrations.objects.length > MAX_ARBITRATION_COUNT) {
579
+ (0, import_exception.W_ERROR)(
580
+ import_exception.WErrors.InvalidParam,
581
+ `arbitrations count exceeds maximum limit ${MAX_ARBITRATION_COUNT}`
582
+ );
583
+ }
584
+ if (this.data.arbitrations.op === "set") {
585
+ arbitration_clear(
586
+ tx,
587
+ object,
588
+ this.parameter_type,
589
+ permission,
590
+ passport
591
+ );
592
+ }
593
+ const arbitrations = await (0, import_util2.queryObjectsWithType)(
594
+ env,
595
+ this.data.arbitrations.objects,
596
+ import_object.ObjectType.Arbitration,
597
+ "arbitration::Arbitration",
598
+ false
599
+ );
600
+ arbitrations.forEach((arbitration) => {
601
+ arbitrations_add(
602
+ tx,
603
+ object,
604
+ this.parameter_type,
605
+ permission,
606
+ arbitration.object,
607
+ arbitration.type,
608
+ passport
609
+ );
610
+ });
611
+ break;
612
+ }
613
+ case "remove": {
614
+ if (this.data.arbitrations.objects.length > MAX_ARBITRATION_COUNT) {
615
+ (0, import_exception.W_ERROR)(
616
+ import_exception.WErrors.InvalidParam,
617
+ `arbitrations count exceeds maximum limit ${MAX_ARBITRATION_COUNT}`
618
+ );
619
+ }
620
+ const addrs = await import_local2.LocalMark.Instance().get_many_address_availables(
621
+ this.data.arbitrations.objects
622
+ );
623
+ arbitrations_remove(
624
+ tx,
625
+ object,
626
+ this.parameter_type,
627
+ permission,
628
+ addrs,
629
+ passport
630
+ );
631
+ break;
632
+ }
633
+ case "clear": {
634
+ arbitration_clear(
635
+ tx,
636
+ object,
637
+ this.parameter_type,
638
+ permission,
639
+ passport
640
+ );
641
+ break;
642
+ }
643
+ }
644
+ }
645
+ if (this.data.discount != null) {
646
+ await discount(
647
+ tx,
648
+ object,
649
+ this.parameter_type,
650
+ permission,
651
+ this.data.discount,
652
+ passport
653
+ );
654
+ }
655
+ if (this.data.discount_destroy != null) {
656
+ const r = await import_local2.LocalMark.Instance().get_many_address_availables(
657
+ this.data.discount_destroy
658
+ );
659
+ discount_destroy(tx, r);
660
+ }
661
+ if (this.data.machine !== void 0) {
662
+ if (this.data.machine) {
663
+ const m = await import_local2.LocalMark.Instance().get_address(
664
+ this.data.machine
665
+ );
666
+ if (m) {
667
+ this.data.machine = m;
668
+ } else {
669
+ (0, import_exception.W_ERROR)(
670
+ import_exception.WErrors.IsValidArgType,
671
+ `Machine not found ${this.data.machine}`
672
+ );
673
+ }
674
+ }
675
+ machine_set(
676
+ tx,
677
+ object,
678
+ this.parameter_type,
679
+ permission,
680
+ this.data.machine,
681
+ passport
682
+ );
683
+ }
684
+ if (this.data.customer_required != null) {
685
+ customer_required_set(
686
+ tx,
687
+ object,
688
+ this.parameter_type,
689
+ permission,
690
+ this.data.customer_required,
691
+ passport
692
+ );
693
+ }
694
+ if (this.data.order_allocators !== void 0) {
695
+ order_allocators_set(
696
+ tx,
697
+ object,
698
+ this.parameter_type,
699
+ permission,
700
+ this.data.order_allocators ? await (0, import_allocation.allocators)(tx, this.data.order_allocators) : null,
701
+ passport
702
+ );
703
+ }
704
+ if (this.data.compensation_fund_add != null) {
705
+ compensation_fund_add(
706
+ env,
707
+ tx,
708
+ object,
709
+ this.parameter_type,
710
+ permission,
711
+ this.data.compensation_fund_add,
712
+ passport
713
+ );
714
+ }
715
+ if (this.data.compensation_locked_time_add !== void 0) {
716
+ compensation_lock_duration_set(
717
+ tx,
718
+ object,
719
+ this.parameter_type,
720
+ permission,
721
+ this.data.compensation_locked_time_add,
722
+ passport
723
+ );
724
+ }
725
+ if (this.data.compensation_fund_receive != null && this.object_address) {
726
+ if (this.data.compensation_fund_receive === "recently") {
727
+ const received = await (0, import_received.query_received)({
728
+ object: this.object_address,
729
+ network: env.network,
730
+ no_cache: env.no_cache
731
+ });
732
+ if (Array.isArray(received)) {
733
+ (0, import_exception.W_ERROR)(
734
+ import_exception.WErrors.InvalidParam,
735
+ "CallAllocation_Data.data.received_coins: received is ReceivedNormal[]"
736
+ );
737
+ } else {
738
+ this.data.compensation_fund_receive = received;
739
+ }
740
+ }
741
+ if (typeof this.data.compensation_fund_receive === "object" && "received" in this.data.compensation_fund_receive && this.data.compensation_fund_receive.received?.length > 0) {
742
+ if (this.data.compensation_fund_receive.token_type !== this.parameter_type) {
743
+ (0, import_exception.W_ERROR)(
744
+ import_exception.WErrors.InvalidParam,
745
+ `token_type ${this.data.compensation_fund_receive.token_type} is not equal to parameter_type ${this.parameter_type}`
746
+ );
747
+ }
748
+ for (const item of this.data.compensation_fund_receive.received) {
749
+ const [received_object, payment_object] = await Promise.all(
750
+ [
751
+ import_local2.LocalMark.Instance().get_address(item.id),
752
+ import_local2.LocalMark.Instance().get_address(item.payment)
753
+ ]
754
+ );
755
+ if (!received_object || !payment_object) {
756
+ (0, import_exception.W_ERROR)(
757
+ import_exception.WErrors.IsValidArgType,
758
+ `Compensation fund receive object ${item.id} or payment object ${item.payment} not found`
759
+ );
760
+ }
761
+ compensation_fund_receive(
762
+ tx,
763
+ object,
764
+ this.parameter_type,
765
+ permission,
766
+ item.id,
767
+ item.payment,
768
+ passport
769
+ );
770
+ }
771
+ }
772
+ }
773
+ if (this.data.owner_receive != null && this.object_address) {
774
+ if (this.data.owner_receive === "recently") {
775
+ this.data.owner_receive = await (0, import_received.query_received)({
776
+ object: this.object_address,
777
+ all_type: true,
778
+ network: env.network,
779
+ no_cache: env.no_cache
780
+ });
781
+ }
782
+ await (0, import_util.owner_receive)(
783
+ tx,
784
+ object,
785
+ permission,
786
+ this.data.owner_receive,
787
+ this.parameter_type,
788
+ (name) => `${import_common.PackageAddress}::service::${name}`,
789
+ passport
790
+ );
791
+ }
792
+ if (this.data.um !== void 0) {
793
+ let um_address = null;
794
+ if (this.data.um) {
795
+ um_address = await import_local2.LocalMark.Instance().get_address(this.data.um) || null;
796
+ if (!um_address) {
797
+ (0, import_exception.W_ERROR)(
798
+ import_exception.WErrors.InvalidParam,
799
+ "CallService_Data.data.um:" + this.data.um
800
+ );
801
+ }
802
+ }
803
+ um_set(
804
+ tx,
805
+ object,
806
+ this.parameter_type,
807
+ permission,
808
+ um_address,
809
+ passport
810
+ );
811
+ }
812
+ if (this.data.pause != null) {
813
+ pause(
814
+ tx,
815
+ object,
816
+ this.parameter_type,
817
+ permission,
818
+ this.data.pause,
819
+ passport
820
+ );
821
+ }
822
+ if (this.data.publish) {
823
+ publish(tx, object, this.parameter_type, permission, passport);
824
+ }
825
+ if (!this.permission_address) {
826
+ const p = (0, import_common.GetObject)(
827
+ this.data?.object
828
+ );
829
+ await this.new_with_mark(
830
+ env,
831
+ tx,
832
+ import_object.ObjectType.Permission,
833
+ (0, import_permission2.create)(tx, permission),
834
+ (0, import_common.GetObject)(p.permission)
835
+ );
836
+ }
837
+ if (!this.object_address) {
838
+ await this.new_with_mark(
839
+ env,
840
+ tx,
841
+ import_object.ObjectType.Service,
842
+ create(tx, object, this.parameter_type),
843
+ (0, import_common.GetObject)(this.data?.object)
844
+ );
845
+ }
846
+ }
847
+ order_allowed() {
848
+ if (this.content?.bPaused) {
849
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "Service is paused");
850
+ return false;
851
+ }
852
+ if (this.content?.bPublished !== true) {
853
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "Service is not published");
854
+ return false;
855
+ }
856
+ return true;
857
+ }
858
+ }
859
+ const MAX_SALE_COUNT = 50;
860
+ const MAX_REPOSITORY_COUNT = 100;
861
+ const MAX_ARBITRATION_COUNT = 20;
862
+ const MAX_REWARD_COUNT = 20;
863
+ const MAX_CUSTOMER_REQUIRED_INFO_COUNT = 10;
864
+ const MAX_PUBKEY_LENGTH = 1024;
865
+ const MAX_DISCOUNT_COUNT_ONCE = 1e3;
866
+ const MAX_DISCOUNT_RECEIVER_ONCE = 1e3;
867
+ const MAX_DISCOUNT_TOTAL_COUNT = 2e4;
868
+ const MAX_REQUIRED_INFO_SIZE = 20;
869
+ const DEFAULT_COMPENSATION_LOCK_DURATION = 2592e6;
870
+ const DISCOUNT_TYPE_RATES = 0;
871
+ const DISCOUNT_TYPE_MINUS = 1;
872
+ const MAX_WIP_LENGTH = 1024;
873
+ const MAX_WIP_HASH_LENGTH = 64;
874
+ function sale(tx, sale2) {
875
+ if (typeof sale2.name === "string" && !(0, import_common.isValidLongName)(sale2.name)) {
876
+ (0, import_exception.W_ERROR)(
877
+ import_exception.WErrors.InvalidParam,
878
+ `Name ${sale2.name} exceeds maximum length ${import_common.MAX_LONG_NAME_LENGTH}`
879
+ );
880
+ }
881
+ if (sale2.wip.length > MAX_WIP_LENGTH) {
882
+ (0, import_exception.W_ERROR)(
883
+ import_exception.WErrors.InvalidParam,
884
+ `WIP ${sale2.wip} exceeds maximum length ${MAX_WIP_LENGTH}`
885
+ );
886
+ }
887
+ if (!(0, import_common.isValidHttpUrl)(sale2.wip)) {
888
+ (0, import_exception.W_ERROR)(
889
+ import_exception.WErrors.IsValidHttpUrl,
890
+ `WIP ${sale2.wip} is not a valid HTTP/HTTPS URL`
891
+ );
892
+ }
893
+ if (sale2.wip_hash.length > MAX_WIP_HASH_LENGTH) {
894
+ (0, import_exception.W_ERROR)(
895
+ import_exception.WErrors.InvalidParam,
896
+ `WIP hash ${sale2.wip_hash} exceeds maximum length ${MAX_WIP_HASH_LENGTH}`
897
+ );
898
+ }
899
+ return tx.moveCall({
900
+ target: (0, import_common.serviceFn)("sale"),
901
+ arguments: [
902
+ (0, import_common.toTxString)(tx, sale2.name),
903
+ tx.pure.u64(sale2.price),
904
+ tx.pure.u64(sale2.stock),
905
+ tx.pure.bool(sale2.suspension),
906
+ (0, import_common.toTxString)(tx, sale2.wip),
907
+ (0, import_common.toTxString)(tx, sale2.wip_hash)
908
+ ]
909
+ });
910
+ }
911
+ function quote_item(tx, item) {
912
+ if (!(0, import_common.isValidLongName)(item.name)) {
913
+ (0, import_exception.W_ERROR)(
914
+ import_exception.WErrors.InvalidParam,
915
+ `Quote item name ${item.name} is not valid`
916
+ );
917
+ }
918
+ if (!(0, import_common.isValidU64)(item.stock)) {
919
+ (0, import_exception.W_ERROR)(
920
+ import_exception.WErrors.IsValidU64,
921
+ `Quote item stock ${item.stock} is not valid`
922
+ );
923
+ }
924
+ if (item.wip_hash.length > MAX_WIP_HASH_LENGTH) {
925
+ (0, import_exception.W_ERROR)(
926
+ import_exception.WErrors.InvalidParam,
927
+ `Quote item wip_hash ${item.wip_hash} exceeds maximum length ${MAX_WIP_HASH_LENGTH}`
928
+ );
929
+ }
930
+ return tx.moveCall({
931
+ target: (0, import_common.serviceFn)("quote_item"),
932
+ arguments: [
933
+ (0, import_common.toTxString)(tx, item.name),
934
+ tx.pure.u64(item.stock),
935
+ (0, import_common.toTxString)(tx, item.wip_hash)
936
+ ]
937
+ });
938
+ }
939
+ function discount_send(tx, discount2, recipient) {
940
+ if (discount2.length === 0) {
941
+ return;
942
+ }
943
+ (0, import_util.validObjects)([...discount2, recipient]);
944
+ if (discount2.length > MAX_DISCOUNT_COUNT_ONCE) {
945
+ (0, import_exception.W_ERROR)(
946
+ import_exception.WErrors.InvalidParam,
947
+ `Discount count ${discount2.length} exceeds maximum limit ${MAX_DISCOUNT_COUNT_ONCE}`
948
+ );
949
+ }
950
+ if (discount2.length === 1) {
951
+ tx.moveCall({
952
+ target: (0, import_common.serviceFn)("discount_send_singleton"),
953
+ arguments: [
954
+ (0, import_common.toTxObject)(tx, discount2[0]),
955
+ tx.pure.address(recipient)
956
+ ]
957
+ });
958
+ return;
959
+ } else {
960
+ tx.moveCall({
961
+ target: (0, import_common.serviceFn)("discount_send"),
962
+ arguments: [
963
+ tx.makeMoveVec({
964
+ elements: discount2,
965
+ type: `${import_common.PackageAddress}::service::Discount`
966
+ }),
967
+ tx.pure.address(recipient)
968
+ ]
969
+ });
970
+ }
971
+ }
972
+ function discount_destroy(tx, discount2) {
973
+ (0, import_util.validObjects)([...discount2]);
974
+ discount2.forEach((item) => {
975
+ tx.moveCall({
976
+ target: (0, import_common.serviceFn)("discount_destroy"),
977
+ arguments: [(0, import_common.toTxObject)(tx, item)]
978
+ });
979
+ });
980
+ }
981
+ const buy = async (env, tx, service, service_type, machine, buy2, passport) => {
982
+ if (buy2.items.length === 0) {
983
+ return void 0;
984
+ }
985
+ (0, import_util.validObjects)([service, buy2.discount, machine, passport]);
986
+ if (!(0, import_common.IsValidArgType)(service_type)) {
987
+ (0, import_exception.W_ERROR)(
988
+ import_exception.WErrors.InvalidParam,
989
+ `Buy service type ${service_type} is not valid`
990
+ );
991
+ }
992
+ if (!(0, import_common.isValidArray)(buy2.items, (item) => {
993
+ if (!(0, import_common.isValidLongName)(item.name)) {
994
+ (0, import_exception.W_ERROR)(
995
+ import_exception.WErrors.InvalidParam,
996
+ `Buy item name ${item.name} is not valid`
997
+ );
998
+ }
999
+ if (!(0, import_common.isValidU64)(item.stock)) {
1000
+ (0, import_exception.W_ERROR)(
1001
+ import_exception.WErrors.IsValidU64,
1002
+ `Buy item stock ${item.stock} is not valid`
1003
+ );
1004
+ }
1005
+ return true;
1006
+ })) {
1007
+ (0, import_exception.W_ERROR)(import_exception.WErrors.InvalidParam, "Buy items is not valid");
1008
+ }
1009
+ if (typeof buy2.payment_remark === "string" && !(0, import_common.isValidName)(buy2.payment_remark)) {
1010
+ (0, import_exception.W_ERROR)(
1011
+ import_exception.WErrors.InvalidParam,
1012
+ `Buy payment remark ${buy2.payment_remark} is not valid`
1013
+ );
1014
+ }
1015
+ buy2.payment_remark = buy2.payment_remark || "";
1016
+ if (buy2.payment_index != null && !(0, import_common.isValidU64)(buy2.payment_index)) {
1017
+ (0, import_exception.W_ERROR)(
1018
+ import_exception.WErrors.IsValidU64,
1019
+ `Buy payment index ${buy2.payment_index} is not valid`
1020
+ );
1021
+ }
1022
+ const coinParam = await (0, import_base.getCoinParam)(env, tx, buy2.total_pay, service_type);
1023
+ buy2.discount = await import_local2.LocalMark.Instance().get_address(buy2.discount);
1024
+ let quote = void 0;
1025
+ if (buy2.discount) {
1026
+ quote = tx.moveCall({
1027
+ target: (0, import_common.serviceFn)("quote_with_discount"),
1028
+ arguments: [
1029
+ (0, import_common.toTxObject)(tx, service),
1030
+ tx.makeMoveVec({
1031
+ elements: buy2.items.map((item) => quote_item(tx, item)),
1032
+ type: `${import_common.PackageAddress}::service::QuoteItem`
1033
+ }),
1034
+ (0, import_common.toTxObject)(tx, buy2.discount)
1035
+ ],
1036
+ typeArguments: [service_type]
1037
+ });
1038
+ } else {
1039
+ quote = tx.moveCall({
1040
+ target: (0, import_common.serviceFn)("quote"),
1041
+ arguments: [
1042
+ (0, import_common.toTxObject)(tx, service),
1043
+ tx.makeMoveVec({
1044
+ elements: buy2.items.map((item) => quote_item(tx, item)),
1045
+ type: `${import_common.PackageAddress}::service::QuoteItem`
1046
+ })
1047
+ ],
1048
+ typeArguments: [service_type]
1049
+ });
1050
+ }
1051
+ let order;
1052
+ if (passport) {
1053
+ order = tx.moveCall({
1054
+ target: (0, import_common.serviceFn)("buy_with_passport"),
1055
+ arguments: [
1056
+ (0, import_common.toTxObject)(tx, service),
1057
+ (0, import_common.toTxObject)(tx, passport),
1058
+ quote,
1059
+ tx.object.mutRegistrar(),
1060
+ tx.object.clock()
1061
+ ],
1062
+ typeArguments: [service_type]
1063
+ });
1064
+ } else {
1065
+ order = tx.moveCall({
1066
+ target: (0, import_common.serviceFn)("buy"),
1067
+ arguments: [
1068
+ (0, import_common.toTxObject)(tx, service),
1069
+ quote,
1070
+ tx.object.mutRegistrar(),
1071
+ tx.object.clock()
1072
+ ],
1073
+ typeArguments: [service_type]
1074
+ });
1075
+ }
1076
+ const result = {
1077
+ order
1078
+ };
1079
+ result.allocation = tx.moveCall({
1080
+ target: (0, import_common.serviceFn)("order_allocation"),
1081
+ arguments: [
1082
+ (0, import_common.toTxObject)(tx, service),
1083
+ (0, import_common.toTxObject)(tx, order),
1084
+ coinParam,
1085
+ tx.pure.string(buy2.payment_remark ?? ""),
1086
+ tx.pure.u64(buy2.payment_index || 0),
1087
+ tx.object.mutRegistrar(),
1088
+ tx.object.clock()
1089
+ ],
1090
+ typeArguments: [service_type]
1091
+ });
1092
+ if (machine) {
1093
+ result.progress = tx.moveCall({
1094
+ target: (0, import_common.serviceFn)("order_progress"),
1095
+ arguments: [
1096
+ (0, import_common.toTxObject)(tx, service),
1097
+ (0, import_common.toTxObject)(tx, order),
1098
+ (0, import_common.toTxObject)(tx, machine),
1099
+ tx.object.mutRegistrar(),
1100
+ tx.object.clock()
1101
+ ],
1102
+ typeArguments: [service_type]
1103
+ });
1104
+ }
1105
+ return result;
1106
+ };
1107
+ function newService(tx, service_type, permission, description, passport) {
1108
+ (0, import_util.validObjects)([permission, passport]);
1109
+ if (typeof description === "string" && !(0, import_common.isValidDescription)(description)) {
1110
+ (0, import_exception.W_ERROR)(
1111
+ import_exception.WErrors.IsValidDescription,
1112
+ `Description exceeds maximum length ${import_common.MAX_DESCRIPTION_LENGTH}`
1113
+ );
1114
+ }
1115
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1116
+ (0, import_exception.W_ERROR)(
1117
+ import_exception.WErrors.InvalidParam,
1118
+ `New service type ${service_type} is not valid`
1119
+ );
1120
+ }
1121
+ if (passport) {
1122
+ return tx.moveCall({
1123
+ target: (0, import_common.serviceFn)("new_with_passport"),
1124
+ arguments: [
1125
+ (0, import_common.toTxObject)(tx, permission),
1126
+ (0, import_common.toTxObject)(tx, passport),
1127
+ (0, import_common.toTxString)(tx, description),
1128
+ tx.object.mutRegistrar(),
1129
+ tx.object.clock()
1130
+ ],
1131
+ typeArguments: [service_type]
1132
+ });
1133
+ } else {
1134
+ return tx.moveCall({
1135
+ target: (0, import_common.serviceFn)("new"),
1136
+ arguments: [
1137
+ (0, import_common.toTxObject)(tx, permission),
1138
+ (0, import_common.toTxString)(tx, description),
1139
+ tx.object.mutRegistrar(),
1140
+ tx.object.clock()
1141
+ ],
1142
+ typeArguments: [service_type]
1143
+ });
1144
+ }
1145
+ }
1146
+ function description_set(tx, service, service_type, permission, description, passport) {
1147
+ (0, import_util.validObjects)([service, permission, passport]);
1148
+ if (typeof description === "string" && !(0, import_common.isValidDescription)(description)) {
1149
+ (0, import_exception.W_ERROR)(
1150
+ import_exception.WErrors.IsValidDescription,
1151
+ `Description exceeds maximum length ${import_common.MAX_DESCRIPTION_LENGTH}`
1152
+ );
1153
+ }
1154
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1155
+ (0, import_exception.W_ERROR)(
1156
+ import_exception.WErrors.InvalidParam,
1157
+ `Description set service type ${service_type} is not valid`
1158
+ );
1159
+ }
1160
+ if (passport) {
1161
+ tx.moveCall({
1162
+ target: (0, import_common.serviceFn)("description_set_with_passport"),
1163
+ arguments: [
1164
+ (0, import_common.toTxObject)(tx, service),
1165
+ (0, import_common.toTxObject)(tx, permission),
1166
+ (0, import_common.toTxObject)(tx, passport),
1167
+ (0, import_common.toTxString)(tx, description)
1168
+ ],
1169
+ typeArguments: [service_type]
1170
+ });
1171
+ } else {
1172
+ tx.moveCall({
1173
+ target: (0, import_common.serviceFn)("description_set"),
1174
+ arguments: [
1175
+ (0, import_common.toTxObject)(tx, service),
1176
+ (0, import_common.toTxObject)(tx, permission),
1177
+ (0, import_common.toTxString)(tx, description)
1178
+ ],
1179
+ typeArguments: [service_type]
1180
+ });
1181
+ }
1182
+ }
1183
+ function um_set(tx, service, service_type, permission, um, passport) {
1184
+ (0, import_util.validObjects)([service, permission]);
1185
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1186
+ (0, import_exception.W_ERROR)(
1187
+ import_exception.WErrors.InvalidParam,
1188
+ `Service type ${service_type} is not valid`
1189
+ );
1190
+ }
1191
+ if (um) {
1192
+ if (passport) {
1193
+ tx.moveCall({
1194
+ target: (0, import_common.serviceFn)(`um_set_with_passport`),
1195
+ arguments: [
1196
+ (0, import_common.toTxObject)(tx, service),
1197
+ (0, import_common.toTxObject)(tx, permission),
1198
+ passport,
1199
+ (0, import_common.toTxObject)(tx, um),
1200
+ tx.object.mutRegistrar(),
1201
+ tx.object.clock()
1202
+ ],
1203
+ typeArguments: [service_type]
1204
+ });
1205
+ } else {
1206
+ tx.moveCall({
1207
+ target: (0, import_common.serviceFn)(`um_set`),
1208
+ arguments: [
1209
+ (0, import_common.toTxObject)(tx, service),
1210
+ (0, import_common.toTxObject)(tx, permission),
1211
+ (0, import_common.toTxObject)(tx, um),
1212
+ tx.object.mutRegistrar(),
1213
+ tx.object.clock()
1214
+ ],
1215
+ typeArguments: [service_type]
1216
+ });
1217
+ }
1218
+ } else {
1219
+ if (passport) {
1220
+ tx.moveCall({
1221
+ target: (0, import_common.serviceFn)(`um_none_with_passport`),
1222
+ arguments: [
1223
+ (0, import_common.toTxObject)(tx, service),
1224
+ (0, import_common.toTxObject)(tx, permission),
1225
+ passport,
1226
+ tx.object.mutRegistrar()
1227
+ ],
1228
+ typeArguments: [service_type]
1229
+ });
1230
+ } else {
1231
+ tx.moveCall({
1232
+ target: (0, import_common.serviceFn)(`um_none`),
1233
+ arguments: [
1234
+ (0, import_common.toTxObject)(tx, service),
1235
+ (0, import_common.toTxObject)(tx, permission),
1236
+ tx.object.mutRegistrar()
1237
+ ],
1238
+ typeArguments: [service_type]
1239
+ });
1240
+ }
1241
+ }
1242
+ }
1243
+ function location_set(tx, service, service_type, permission, location, passport) {
1244
+ (0, import_util.validObjects)([service, permission, passport]);
1245
+ if (typeof location === "string" && !(0, import_common.isValidLongName)(location)) {
1246
+ (0, import_exception.W_ERROR)(
1247
+ import_exception.WErrors.InvalidParam,
1248
+ `Location ${location} exceeds maximum length ${import_common.MAX_LONG_NAME_LENGTH}`
1249
+ );
1250
+ }
1251
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1252
+ (0, import_exception.W_ERROR)(
1253
+ import_exception.WErrors.InvalidParam,
1254
+ `Location set service type ${service_type} is not valid`
1255
+ );
1256
+ }
1257
+ if (passport) {
1258
+ tx.moveCall({
1259
+ target: (0, import_common.serviceFn)("location_set_with_passport"),
1260
+ arguments: [
1261
+ (0, import_common.toTxObject)(tx, service),
1262
+ (0, import_common.toTxObject)(tx, permission),
1263
+ (0, import_common.toTxObject)(tx, passport),
1264
+ (0, import_common.toTxString)(tx, location)
1265
+ ],
1266
+ typeArguments: [service_type]
1267
+ });
1268
+ } else {
1269
+ tx.moveCall({
1270
+ target: (0, import_common.serviceFn)("location_set"),
1271
+ arguments: [
1272
+ (0, import_common.toTxObject)(tx, service),
1273
+ (0, import_common.toTxObject)(tx, permission),
1274
+ (0, import_common.toTxString)(tx, location)
1275
+ ],
1276
+ typeArguments: [service_type]
1277
+ });
1278
+ }
1279
+ }
1280
+ function create(tx, service, service_type) {
1281
+ (0, import_util.validObjects)([service]);
1282
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1283
+ (0, import_exception.W_ERROR)(
1284
+ import_exception.WErrors.InvalidParam,
1285
+ `Create service type ${service_type} is not valid`
1286
+ );
1287
+ }
1288
+ return tx.moveCall({
1289
+ target: (0, import_common.serviceFn)("create"),
1290
+ arguments: [(0, import_common.toTxObject)(tx, service)],
1291
+ typeArguments: [service_type]
1292
+ });
1293
+ }
1294
+ function sales_add(tx, service, service_type, permission, sales, passport) {
1295
+ if (sales.length === 0) {
1296
+ return;
1297
+ }
1298
+ (0, import_util.validObjects)([service, permission, passport]);
1299
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1300
+ (0, import_exception.W_ERROR)(
1301
+ import_exception.WErrors.InvalidParam,
1302
+ `Sales add service type ${service_type} is not valid`
1303
+ );
1304
+ }
1305
+ if (passport) {
1306
+ tx.moveCall({
1307
+ target: (0, import_common.serviceFn)("sales_add_with_passport"),
1308
+ arguments: [
1309
+ (0, import_common.toTxObject)(tx, service),
1310
+ (0, import_common.toTxObject)(tx, permission),
1311
+ (0, import_common.toTxObject)(tx, passport),
1312
+ tx.makeMoveVec({
1313
+ elements: sales.map((s) => sale(tx, s)),
1314
+ type: `${import_common.PackageAddress}::service::Sale`
1315
+ })
1316
+ ],
1317
+ typeArguments: [service_type]
1318
+ });
1319
+ } else {
1320
+ tx.moveCall({
1321
+ target: (0, import_common.serviceFn)("sales_add"),
1322
+ arguments: [
1323
+ (0, import_common.toTxObject)(tx, service),
1324
+ (0, import_common.toTxObject)(tx, permission),
1325
+ tx.makeMoveVec({
1326
+ elements: sales.map((s) => sale(tx, s)),
1327
+ type: `${import_common.PackageAddress}::service::Sale`
1328
+ })
1329
+ ],
1330
+ typeArguments: [service_type]
1331
+ });
1332
+ }
1333
+ }
1334
+ function sales_remove(tx, service, service_type, permission, sales_name, passport) {
1335
+ if (sales_name.length === 0) {
1336
+ return;
1337
+ }
1338
+ (0, import_util.validObjects)([service, permission, passport]);
1339
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1340
+ (0, import_exception.W_ERROR)(
1341
+ import_exception.WErrors.InvalidParam,
1342
+ `Sales remove service type ${service_type} is not valid`
1343
+ );
1344
+ }
1345
+ if (passport) {
1346
+ tx.moveCall({
1347
+ target: (0, import_common.serviceFn)("sales_remove_with_passport"),
1348
+ arguments: [
1349
+ (0, import_common.toTxObject)(tx, service),
1350
+ (0, import_common.toTxObject)(tx, permission),
1351
+ (0, import_common.toTxObject)(tx, passport),
1352
+ tx.pure.vector("string", sales_name)
1353
+ ],
1354
+ typeArguments: [service_type]
1355
+ });
1356
+ } else {
1357
+ tx.moveCall({
1358
+ target: (0, import_common.serviceFn)("sales_remove"),
1359
+ arguments: [
1360
+ (0, import_common.toTxObject)(tx, service),
1361
+ (0, import_common.toTxObject)(tx, permission),
1362
+ tx.pure.vector("string", sales_name)
1363
+ ],
1364
+ typeArguments: [service_type]
1365
+ });
1366
+ }
1367
+ }
1368
+ function sales_clear(tx, service, service_type, permission, passport) {
1369
+ (0, import_util.validObjects)([service, permission, passport]);
1370
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1371
+ (0, import_exception.W_ERROR)(
1372
+ import_exception.WErrors.InvalidParam,
1373
+ `Sales clear service type ${service_type} is not valid`
1374
+ );
1375
+ }
1376
+ if (passport) {
1377
+ tx.moveCall({
1378
+ target: (0, import_common.serviceFn)("sales_clear_with_passport"),
1379
+ arguments: [
1380
+ (0, import_common.toTxObject)(tx, service),
1381
+ (0, import_common.toTxObject)(tx, permission),
1382
+ (0, import_common.toTxObject)(tx, passport)
1383
+ ],
1384
+ typeArguments: [service_type]
1385
+ });
1386
+ } else {
1387
+ tx.moveCall({
1388
+ target: (0, import_common.serviceFn)("sales_clear"),
1389
+ arguments: [(0, import_common.toTxObject)(tx, service), (0, import_common.toTxObject)(tx, permission)],
1390
+ typeArguments: [service_type]
1391
+ });
1392
+ }
1393
+ }
1394
+ function sales_set(tx, service, service_type, permission, sales, passport) {
1395
+ if (sales.length === 0) {
1396
+ return;
1397
+ }
1398
+ (0, import_util.validObjects)([service, permission, passport]);
1399
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1400
+ (0, import_exception.W_ERROR)(
1401
+ import_exception.WErrors.InvalidParam,
1402
+ `Sales set service type ${service_type} is not valid`
1403
+ );
1404
+ }
1405
+ if (passport) {
1406
+ tx.moveCall({
1407
+ target: (0, import_common.serviceFn)("sales_set_with_passport"),
1408
+ arguments: [
1409
+ (0, import_common.toTxObject)(tx, service),
1410
+ (0, import_common.toTxObject)(tx, permission),
1411
+ (0, import_common.toTxObject)(tx, passport),
1412
+ tx.makeMoveVec({
1413
+ elements: sales.map((s) => sale(tx, s)),
1414
+ type: `${import_common.PackageAddress}::service::Sale`
1415
+ })
1416
+ ],
1417
+ typeArguments: [service_type]
1418
+ });
1419
+ } else {
1420
+ tx.moveCall({
1421
+ target: (0, import_common.serviceFn)("sales_set"),
1422
+ arguments: [
1423
+ (0, import_common.toTxObject)(tx, service),
1424
+ (0, import_common.toTxObject)(tx, permission),
1425
+ tx.makeMoveVec({
1426
+ elements: sales.map((s) => sale(tx, s)),
1427
+ type: `${import_common.PackageAddress}::service::Sale`
1428
+ })
1429
+ ],
1430
+ typeArguments: [service_type]
1431
+ });
1432
+ }
1433
+ }
1434
+ function price_add(tx, service, service_type, permission, sale_name, price_add2, passport) {
1435
+ (0, import_util.validObjects)([service, permission, passport]);
1436
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1437
+ (0, import_exception.W_ERROR)(
1438
+ import_exception.WErrors.InvalidParam,
1439
+ `Price add service type ${service_type} is not valid`
1440
+ );
1441
+ }
1442
+ if (typeof sale_name === "string" && !(0, import_common.isValidLongName)(sale_name)) {
1443
+ (0, import_exception.W_ERROR)(
1444
+ import_exception.WErrors.InvalidParam,
1445
+ `Sale name ${sale_name} exceeds maximum length ${import_common.MAX_LONG_NAME_LENGTH}`
1446
+ );
1447
+ }
1448
+ if (!(0, import_common.isValidU64)(price_add2)) {
1449
+ (0, import_exception.W_ERROR)(import_exception.WErrors.IsValidU64, `Price add ${price_add2} is not valid`);
1450
+ }
1451
+ if (passport) {
1452
+ tx.moveCall({
1453
+ target: (0, import_common.serviceFn)("price_add_with_passport"),
1454
+ arguments: [
1455
+ (0, import_common.toTxObject)(tx, service),
1456
+ (0, import_common.toTxObject)(tx, permission),
1457
+ (0, import_common.toTxObject)(tx, passport),
1458
+ (0, import_common.toTxString)(tx, sale_name),
1459
+ tx.pure.u64(price_add2)
1460
+ ],
1461
+ typeArguments: [service_type]
1462
+ });
1463
+ } else {
1464
+ tx.moveCall({
1465
+ target: (0, import_common.serviceFn)("price_add"),
1466
+ arguments: [
1467
+ (0, import_common.toTxObject)(tx, service),
1468
+ (0, import_common.toTxObject)(tx, permission),
1469
+ (0, import_common.toTxString)(tx, sale_name),
1470
+ tx.pure.u64(price_add2)
1471
+ ],
1472
+ typeArguments: [service_type]
1473
+ });
1474
+ }
1475
+ }
1476
+ function price_reduce(tx, service, service_type, permission, sale_name, price_reduce2, passport) {
1477
+ (0, import_util.validObjects)([service, permission, passport]);
1478
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1479
+ (0, import_exception.W_ERROR)(
1480
+ import_exception.WErrors.InvalidParam,
1481
+ `Price reduce service type ${service_type} is not valid`
1482
+ );
1483
+ }
1484
+ if (typeof sale_name === "string" && !(0, import_common.isValidLongName)(sale_name)) {
1485
+ (0, import_exception.W_ERROR)(
1486
+ import_exception.WErrors.InvalidParam,
1487
+ `Sale name ${sale_name} exceeds maximum length ${import_common.MAX_LONG_NAME_LENGTH}`
1488
+ );
1489
+ }
1490
+ if (!(0, import_common.isValidU64)(price_reduce2)) {
1491
+ (0, import_exception.W_ERROR)(
1492
+ import_exception.WErrors.IsValidU64,
1493
+ `Price reduce ${price_reduce2} is not valid`
1494
+ );
1495
+ }
1496
+ if (passport) {
1497
+ tx.moveCall({
1498
+ target: (0, import_common.serviceFn)("price_reduce_with_passport"),
1499
+ arguments: [
1500
+ (0, import_common.toTxObject)(tx, service),
1501
+ (0, import_common.toTxObject)(tx, permission),
1502
+ (0, import_common.toTxObject)(tx, passport),
1503
+ (0, import_common.toTxString)(tx, sale_name),
1504
+ tx.pure.u64(price_reduce2)
1505
+ ],
1506
+ typeArguments: [service_type]
1507
+ });
1508
+ } else {
1509
+ tx.moveCall({
1510
+ target: (0, import_common.serviceFn)("price_reduce"),
1511
+ arguments: [
1512
+ (0, import_common.toTxObject)(tx, service),
1513
+ (0, import_common.toTxObject)(tx, permission),
1514
+ (0, import_common.toTxString)(tx, sale_name),
1515
+ tx.pure.u64(price_reduce2)
1516
+ ],
1517
+ typeArguments: [service_type]
1518
+ });
1519
+ }
1520
+ }
1521
+ function stock_add(tx, service, service_type, permission, sale_name, stock_add2, passport) {
1522
+ (0, import_util.validObjects)([service, permission, passport]);
1523
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1524
+ (0, import_exception.W_ERROR)(
1525
+ import_exception.WErrors.InvalidParam,
1526
+ `Stock add service type ${service_type} is not valid`
1527
+ );
1528
+ }
1529
+ if (typeof sale_name === "string" && !(0, import_common.isValidLongName)(sale_name)) {
1530
+ (0, import_exception.W_ERROR)(
1531
+ import_exception.WErrors.InvalidParam,
1532
+ `Sale name ${sale_name} exceeds maximum length ${import_common.MAX_LONG_NAME_LENGTH}`
1533
+ );
1534
+ }
1535
+ if (!(0, import_common.isValidU64)(stock_add2)) {
1536
+ (0, import_exception.W_ERROR)(import_exception.WErrors.IsValidU64, `Stock add ${stock_add2} is not valid`);
1537
+ }
1538
+ if (passport) {
1539
+ tx.moveCall({
1540
+ target: (0, import_common.serviceFn)("stock_add_with_passport"),
1541
+ arguments: [
1542
+ (0, import_common.toTxObject)(tx, service),
1543
+ (0, import_common.toTxObject)(tx, permission),
1544
+ (0, import_common.toTxObject)(tx, passport),
1545
+ (0, import_common.toTxString)(tx, sale_name),
1546
+ tx.pure.u64(stock_add2)
1547
+ ],
1548
+ typeArguments: [service_type]
1549
+ });
1550
+ } else {
1551
+ tx.moveCall({
1552
+ target: (0, import_common.serviceFn)("stock_add"),
1553
+ arguments: [
1554
+ (0, import_common.toTxObject)(tx, service),
1555
+ (0, import_common.toTxObject)(tx, permission),
1556
+ (0, import_common.toTxString)(tx, sale_name),
1557
+ tx.pure.u64(stock_add2)
1558
+ ],
1559
+ typeArguments: [service_type]
1560
+ });
1561
+ }
1562
+ }
1563
+ function stock_reduce(tx, service, service_type, permission, sale_name, stock_reduce2, passport) {
1564
+ (0, import_util.validObjects)([service, permission, passport]);
1565
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1566
+ (0, import_exception.W_ERROR)(
1567
+ import_exception.WErrors.InvalidParam,
1568
+ `Stock reduce service type ${service_type} is not valid`
1569
+ );
1570
+ }
1571
+ if (typeof sale_name === "string" && !(0, import_common.isValidLongName)(sale_name)) {
1572
+ (0, import_exception.W_ERROR)(
1573
+ import_exception.WErrors.InvalidParam,
1574
+ `Sale name ${sale_name} exceeds maximum length ${import_common.MAX_LONG_NAME_LENGTH}`
1575
+ );
1576
+ }
1577
+ if (!(0, import_common.isValidU64)(stock_reduce2)) {
1578
+ (0, import_exception.W_ERROR)(
1579
+ import_exception.WErrors.IsValidU64,
1580
+ `Stock reduce ${stock_reduce2} is not valid`
1581
+ );
1582
+ }
1583
+ if (passport) {
1584
+ tx.moveCall({
1585
+ target: (0, import_common.serviceFn)("stock_reduce_with_passport"),
1586
+ arguments: [
1587
+ (0, import_common.toTxObject)(tx, service),
1588
+ (0, import_common.toTxObject)(tx, permission),
1589
+ (0, import_common.toTxObject)(tx, passport),
1590
+ (0, import_common.toTxString)(tx, sale_name),
1591
+ tx.pure.u64(stock_reduce2)
1592
+ ],
1593
+ typeArguments: [service_type]
1594
+ });
1595
+ } else {
1596
+ tx.moveCall({
1597
+ target: (0, import_common.serviceFn)("stock_reduce"),
1598
+ arguments: [
1599
+ (0, import_common.toTxObject)(tx, service),
1600
+ (0, import_common.toTxObject)(tx, permission),
1601
+ (0, import_common.toTxString)(tx, sale_name),
1602
+ tx.pure.u64(stock_reduce2)
1603
+ ],
1604
+ typeArguments: [service_type]
1605
+ });
1606
+ }
1607
+ }
1608
+ function sale_suspension(tx, service, service_type, permission, sale_name, suspension, passport) {
1609
+ (0, import_util.validObjects)([service, permission, passport]);
1610
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1611
+ (0, import_exception.W_ERROR)(
1612
+ import_exception.WErrors.InvalidParam,
1613
+ `Sale suspension service type ${service_type} is not valid`
1614
+ );
1615
+ }
1616
+ if (typeof sale_name === "string" && !(0, import_common.isValidLongName)(sale_name)) {
1617
+ (0, import_exception.W_ERROR)(
1618
+ import_exception.WErrors.InvalidParam,
1619
+ `Sale name ${sale_name} exceeds maximum length ${import_common.MAX_LONG_NAME_LENGTH}`
1620
+ );
1621
+ }
1622
+ if (passport) {
1623
+ tx.moveCall({
1624
+ target: (0, import_common.serviceFn)("sale_suspension_with_passport"),
1625
+ arguments: [
1626
+ (0, import_common.toTxObject)(tx, service),
1627
+ (0, import_common.toTxObject)(tx, permission),
1628
+ (0, import_common.toTxObject)(tx, passport),
1629
+ (0, import_common.toTxString)(tx, sale_name),
1630
+ tx.pure.bool(suspension)
1631
+ ],
1632
+ typeArguments: [service_type]
1633
+ });
1634
+ } else {
1635
+ tx.moveCall({
1636
+ target: (0, import_common.serviceFn)("sale_suspension"),
1637
+ arguments: [
1638
+ (0, import_common.toTxObject)(tx, service),
1639
+ (0, import_common.toTxObject)(tx, permission),
1640
+ (0, import_common.toTxString)(tx, sale_name),
1641
+ tx.pure.bool(suspension)
1642
+ ],
1643
+ typeArguments: [service_type]
1644
+ });
1645
+ }
1646
+ }
1647
+ function repository_add(tx, service, service_type, permission, repository, passport) {
1648
+ (0, import_util.validObjects)([service, permission, repository, passport]);
1649
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1650
+ (0, import_exception.W_ERROR)(
1651
+ import_exception.WErrors.InvalidParam,
1652
+ `Repository add service type ${service_type} is not valid`
1653
+ );
1654
+ }
1655
+ if (passport) {
1656
+ tx.moveCall({
1657
+ target: (0, import_common.serviceFn)("repository_add_with_passport"),
1658
+ arguments: [
1659
+ (0, import_common.toTxObject)(tx, service),
1660
+ (0, import_common.toTxObject)(tx, permission),
1661
+ (0, import_common.toTxObject)(tx, passport),
1662
+ (0, import_common.toTxObject)(tx, repository),
1663
+ tx.object.mutRegistrar(),
1664
+ tx.object.clock()
1665
+ ],
1666
+ typeArguments: [service_type]
1667
+ });
1668
+ } else {
1669
+ tx.moveCall({
1670
+ target: (0, import_common.serviceFn)("repository_add"),
1671
+ arguments: [
1672
+ (0, import_common.toTxObject)(tx, service),
1673
+ (0, import_common.toTxObject)(tx, permission),
1674
+ (0, import_common.toTxObject)(tx, repository),
1675
+ tx.object.mutRegistrar(),
1676
+ tx.object.clock()
1677
+ ],
1678
+ typeArguments: [service_type]
1679
+ });
1680
+ }
1681
+ }
1682
+ function repository_remove(tx, service, service_type, permission, repositories, passport) {
1683
+ if (repositories.length === 0) {
1684
+ return;
1685
+ }
1686
+ (0, import_util.validObjects)([service, permission, passport, ...repositories]);
1687
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1688
+ (0, import_exception.W_ERROR)(
1689
+ import_exception.WErrors.InvalidParam,
1690
+ `Repository remove service type ${service_type} is not valid`
1691
+ );
1692
+ }
1693
+ if (passport) {
1694
+ tx.moveCall({
1695
+ target: (0, import_common.serviceFn)("repository_remove_with_passport"),
1696
+ arguments: [
1697
+ (0, import_common.toTxObject)(tx, service),
1698
+ (0, import_common.toTxObject)(tx, permission),
1699
+ (0, import_common.toTxObject)(tx, passport),
1700
+ tx.pure.vector("address", repositories),
1701
+ tx.object.mutRegistrar()
1702
+ ],
1703
+ typeArguments: [service_type]
1704
+ });
1705
+ } else {
1706
+ tx.moveCall({
1707
+ target: (0, import_common.serviceFn)("repository_remove"),
1708
+ arguments: [
1709
+ (0, import_common.toTxObject)(tx, service),
1710
+ (0, import_common.toTxObject)(tx, permission),
1711
+ tx.pure.vector("address", repositories),
1712
+ tx.object.mutRegistrar()
1713
+ ],
1714
+ typeArguments: [service_type]
1715
+ });
1716
+ }
1717
+ }
1718
+ function repository_clear(tx, service, service_type, permission, passport) {
1719
+ (0, import_util.validObjects)([service, permission, passport]);
1720
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1721
+ (0, import_exception.W_ERROR)(
1722
+ import_exception.WErrors.InvalidParam,
1723
+ `Repository clear service type ${service_type} is not valid`
1724
+ );
1725
+ }
1726
+ if (passport) {
1727
+ tx.moveCall({
1728
+ target: (0, import_common.serviceFn)("repository_clear_with_passport"),
1729
+ arguments: [
1730
+ (0, import_common.toTxObject)(tx, service),
1731
+ (0, import_common.toTxObject)(tx, permission),
1732
+ (0, import_common.toTxObject)(tx, passport),
1733
+ tx.object.mutRegistrar()
1734
+ ],
1735
+ typeArguments: [service_type]
1736
+ });
1737
+ } else {
1738
+ tx.moveCall({
1739
+ target: (0, import_common.serviceFn)("repository_clear"),
1740
+ arguments: [
1741
+ (0, import_common.toTxObject)(tx, service),
1742
+ (0, import_common.toTxObject)(tx, permission),
1743
+ tx.object.mutRegistrar()
1744
+ ],
1745
+ typeArguments: [service_type]
1746
+ });
1747
+ }
1748
+ }
1749
+ function buy_guard_set(tx, service, service_type, permission, guard, passport) {
1750
+ (0, import_util.validObjects)([service, permission, guard, passport]);
1751
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1752
+ (0, import_exception.W_ERROR)(
1753
+ import_exception.WErrors.InvalidParam,
1754
+ `Buy guard set service type ${service_type} is not valid`
1755
+ );
1756
+ }
1757
+ if (passport) {
1758
+ if (guard) {
1759
+ tx.moveCall({
1760
+ target: (0, import_common.serviceFn)("buy_guard_set_with_passport"),
1761
+ arguments: [
1762
+ (0, import_common.toTxObject)(tx, service),
1763
+ (0, import_common.toTxObject)(tx, permission),
1764
+ (0, import_common.toTxObject)(tx, passport),
1765
+ (0, import_common.toTxObject)(tx, guard),
1766
+ tx.object.mutRegistrar(),
1767
+ tx.object.clock()
1768
+ ],
1769
+ typeArguments: [service_type]
1770
+ });
1771
+ } else {
1772
+ tx.moveCall({
1773
+ target: (0, import_common.serviceFn)("buy_guard_none_with_passport"),
1774
+ arguments: [
1775
+ (0, import_common.toTxObject)(tx, service),
1776
+ (0, import_common.toTxObject)(tx, permission),
1777
+ (0, import_common.toTxObject)(tx, passport),
1778
+ tx.object.mutRegistrar()
1779
+ ],
1780
+ typeArguments: [service_type]
1781
+ });
1782
+ }
1783
+ } else {
1784
+ if (guard) {
1785
+ tx.moveCall({
1786
+ target: (0, import_common.serviceFn)("buy_guard_set"),
1787
+ arguments: [
1788
+ (0, import_common.toTxObject)(tx, service),
1789
+ (0, import_common.toTxObject)(tx, permission),
1790
+ (0, import_common.toTxObject)(tx, guard),
1791
+ tx.object.mutRegistrar(),
1792
+ tx.object.clock()
1793
+ ],
1794
+ typeArguments: [service_type]
1795
+ });
1796
+ } else {
1797
+ tx.moveCall({
1798
+ target: (0, import_common.serviceFn)("buy_guard_none"),
1799
+ arguments: [
1800
+ (0, import_common.toTxObject)(tx, service),
1801
+ (0, import_common.toTxObject)(tx, permission),
1802
+ tx.object.mutRegistrar()
1803
+ ],
1804
+ typeArguments: [service_type]
1805
+ });
1806
+ }
1807
+ }
1808
+ }
1809
+ function machine_set(tx, service, service_type, permission, machine, passport) {
1810
+ (0, import_util.validObjects)([service, permission, machine, passport]);
1811
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1812
+ (0, import_exception.W_ERROR)(
1813
+ import_exception.WErrors.InvalidParam,
1814
+ `Machine set service type ${service_type} is not valid`
1815
+ );
1816
+ }
1817
+ if (passport) {
1818
+ if (machine) {
1819
+ tx.moveCall({
1820
+ target: (0, import_common.serviceFn)("machine_set_with_passport"),
1821
+ arguments: [
1822
+ (0, import_common.toTxObject)(tx, service),
1823
+ (0, import_common.toTxObject)(tx, permission),
1824
+ (0, import_common.toTxObject)(tx, passport),
1825
+ (0, import_common.toTxObject)(tx, machine),
1826
+ tx.object.mutRegistrar(),
1827
+ tx.object.clock()
1828
+ ],
1829
+ typeArguments: [service_type]
1830
+ });
1831
+ } else {
1832
+ tx.moveCall({
1833
+ target: (0, import_common.serviceFn)("machine_none_with_passport"),
1834
+ arguments: [
1835
+ (0, import_common.toTxObject)(tx, service),
1836
+ (0, import_common.toTxObject)(tx, permission),
1837
+ (0, import_common.toTxObject)(tx, passport),
1838
+ tx.object.mutRegistrar()
1839
+ ],
1840
+ typeArguments: [service_type]
1841
+ });
1842
+ }
1843
+ } else {
1844
+ if (machine) {
1845
+ tx.moveCall({
1846
+ target: (0, import_common.serviceFn)("machine_set"),
1847
+ arguments: [
1848
+ (0, import_common.toTxObject)(tx, service),
1849
+ (0, import_common.toTxObject)(tx, permission),
1850
+ (0, import_common.toTxObject)(tx, machine),
1851
+ tx.object.mutRegistrar(),
1852
+ tx.object.clock()
1853
+ ],
1854
+ typeArguments: [service_type]
1855
+ });
1856
+ } else {
1857
+ tx.moveCall({
1858
+ target: (0, import_common.serviceFn)("machine_set_none"),
1859
+ arguments: [
1860
+ (0, import_common.toTxObject)(tx, service),
1861
+ (0, import_common.toTxObject)(tx, permission),
1862
+ tx.object.mutRegistrar()
1863
+ ],
1864
+ typeArguments: [service_type]
1865
+ });
1866
+ }
1867
+ }
1868
+ }
1869
+ function publish(tx, service, service_type, permission, passport) {
1870
+ (0, import_util.validObjects)([service, permission, passport]);
1871
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1872
+ (0, import_exception.W_ERROR)(
1873
+ import_exception.WErrors.InvalidParam,
1874
+ `Publish service type ${service_type} is not valid`
1875
+ );
1876
+ }
1877
+ if (passport) {
1878
+ tx.moveCall({
1879
+ target: (0, import_common.serviceFn)("publish_with_passport"),
1880
+ arguments: [
1881
+ (0, import_common.toTxObject)(tx, service),
1882
+ (0, import_common.toTxObject)(tx, permission),
1883
+ (0, import_common.toTxObject)(tx, passport)
1884
+ ],
1885
+ typeArguments: [service_type]
1886
+ });
1887
+ } else {
1888
+ tx.moveCall({
1889
+ target: (0, import_common.serviceFn)("publish"),
1890
+ arguments: [(0, import_common.toTxObject)(tx, service), (0, import_common.toTxObject)(tx, permission)],
1891
+ typeArguments: [service_type]
1892
+ });
1893
+ }
1894
+ }
1895
+ function pause(tx, service, service_type, permission, bPaused, passport) {
1896
+ (0, import_util.validObjects)([service, permission, passport]);
1897
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1898
+ (0, import_exception.W_ERROR)(
1899
+ import_exception.WErrors.InvalidParam,
1900
+ `Pause service type ${service_type} is not valid`
1901
+ );
1902
+ }
1903
+ if (passport) {
1904
+ tx.moveCall({
1905
+ target: (0, import_common.serviceFn)("pause_with_passport"),
1906
+ arguments: [
1907
+ (0, import_common.toTxObject)(tx, service),
1908
+ (0, import_common.toTxObject)(tx, permission),
1909
+ (0, import_common.toTxObject)(tx, passport),
1910
+ tx.pure.bool(bPaused),
1911
+ tx.object.clock()
1912
+ ],
1913
+ typeArguments: [service_type]
1914
+ });
1915
+ } else {
1916
+ tx.moveCall({
1917
+ target: (0, import_common.serviceFn)("pause"),
1918
+ arguments: [
1919
+ (0, import_common.toTxObject)(tx, service),
1920
+ (0, import_common.toTxObject)(tx, permission),
1921
+ tx.pure.bool(bPaused),
1922
+ tx.object.clock()
1923
+ ],
1924
+ typeArguments: [service_type]
1925
+ });
1926
+ }
1927
+ }
1928
+ function customer_required_set(tx, service, service_type, permission, required_info, passport) {
1929
+ if (required_info.length > MAX_REQUIRED_INFO_SIZE) {
1930
+ (0, import_exception.W_ERROR)(
1931
+ import_exception.WErrors.InvalidParam,
1932
+ `Customer required set size ${required_info.length} is exceed maximum size ${MAX_REQUIRED_INFO_SIZE}`
1933
+ );
1934
+ }
1935
+ (0, import_util.validObjects)([service, permission, passport]);
1936
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1937
+ (0, import_exception.W_ERROR)(
1938
+ import_exception.WErrors.InvalidParam,
1939
+ `Customer required set service type ${service_type} is not valid`
1940
+ );
1941
+ }
1942
+ required_info.forEach((item) => {
1943
+ if (!(0, import_common.isValidName)(item)) {
1944
+ (0, import_exception.W_ERROR)(
1945
+ import_exception.WErrors.InvalidParam,
1946
+ `Customer required info ${item} is exceed maximum length ${import_common.MAX_NAME_LENGTH} or start with "0x"`
1947
+ );
1948
+ }
1949
+ });
1950
+ if (passport) {
1951
+ tx.moveCall({
1952
+ target: (0, import_common.serviceFn)("custom_required_info_set_with_passport"),
1953
+ arguments: [
1954
+ (0, import_common.toTxObject)(tx, service),
1955
+ (0, import_common.toTxObject)(tx, permission),
1956
+ (0, import_common.toTxObject)(tx, passport),
1957
+ tx.pure.vector("string", required_info)
1958
+ ],
1959
+ typeArguments: [service_type]
1960
+ });
1961
+ } else {
1962
+ tx.moveCall({
1963
+ target: (0, import_common.serviceFn)("custom_required_info_set"),
1964
+ arguments: [
1965
+ (0, import_common.toTxObject)(tx, service),
1966
+ (0, import_common.toTxObject)(tx, permission),
1967
+ tx.pure.vector("string", required_info)
1968
+ ],
1969
+ typeArguments: [service_type]
1970
+ });
1971
+ }
1972
+ }
1973
+ function arbitrations_add(tx, service, service_type, permission, arbitration, arbitration_type, passport) {
1974
+ (0, import_util.validObjects)([service, permission, arbitration, passport]);
1975
+ if (!(0, import_common.IsValidArgType)(service_type)) {
1976
+ (0, import_exception.W_ERROR)(
1977
+ import_exception.WErrors.InvalidParam,
1978
+ `Arbitrations add service type ${service_type} is not valid`
1979
+ );
1980
+ }
1981
+ if (!(0, import_common.IsValidArgType)(arbitration_type)) {
1982
+ (0, import_exception.W_ERROR)(
1983
+ import_exception.WErrors.InvalidParam,
1984
+ `Arbitrations add arbitration type ${arbitration_type} is not valid`
1985
+ );
1986
+ }
1987
+ if (passport) {
1988
+ tx.moveCall({
1989
+ target: (0, import_common.serviceFn)("arbitration_add_with_passport"),
1990
+ arguments: [
1991
+ (0, import_common.toTxObject)(tx, service),
1992
+ (0, import_common.toTxObject)(tx, permission),
1993
+ (0, import_common.toTxObject)(tx, passport),
1994
+ (0, import_common.toTxObject)(tx, arbitration),
1995
+ tx.object.mutRegistrar(),
1996
+ tx.object.clock()
1997
+ ],
1998
+ typeArguments: [service_type]
1999
+ });
2000
+ } else {
2001
+ tx.moveCall({
2002
+ target: (0, import_common.serviceFn)("arbitrations_add"),
2003
+ arguments: [
2004
+ (0, import_common.toTxObject)(tx, service),
2005
+ (0, import_common.toTxObject)(tx, permission),
2006
+ (0, import_common.toTxObject)(tx, arbitration),
2007
+ tx.object.mutRegistrar(),
2008
+ tx.object.clock()
2009
+ ],
2010
+ typeArguments: [service_type, arbitration_type]
2011
+ });
2012
+ }
2013
+ }
2014
+ function arbitrations_remove(tx, service, service_type, permission, arbitrations, passport) {
2015
+ if (arbitrations.length === 0) {
2016
+ return;
2017
+ }
2018
+ (0, import_util.validObjects)([service, permission, passport]);
2019
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2020
+ (0, import_exception.W_ERROR)(
2021
+ import_exception.WErrors.InvalidParam,
2022
+ `Arbitrations remove service type ${service_type} is not valid`
2023
+ );
2024
+ }
2025
+ if (passport) {
2026
+ tx.moveCall({
2027
+ target: (0, import_common.serviceFn)("arbitration_remove_with_passport"),
2028
+ arguments: [
2029
+ (0, import_common.toTxObject)(tx, service),
2030
+ (0, import_common.toTxObject)(tx, permission),
2031
+ (0, import_common.toTxObject)(tx, passport),
2032
+ tx.pure.vector("address", arbitrations),
2033
+ tx.object.mutRegistrar()
2034
+ ],
2035
+ typeArguments: [service_type]
2036
+ });
2037
+ } else {
2038
+ tx.moveCall({
2039
+ target: (0, import_common.serviceFn)("arbitration_remove"),
2040
+ arguments: [
2041
+ (0, import_common.toTxObject)(tx, service),
2042
+ (0, import_common.toTxObject)(tx, permission),
2043
+ tx.pure.vector("address", arbitrations),
2044
+ tx.object.mutRegistrar()
2045
+ ],
2046
+ typeArguments: [service_type]
2047
+ });
2048
+ }
2049
+ }
2050
+ function arbitration_clear(tx, service, service_type, permission, passport) {
2051
+ (0, import_util.validObjects)([service, permission, passport]);
2052
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2053
+ (0, import_exception.W_ERROR)(
2054
+ import_exception.WErrors.InvalidParam,
2055
+ `Arbitrations clear service type ${service_type} is not valid`
2056
+ );
2057
+ }
2058
+ if (passport) {
2059
+ tx.moveCall({
2060
+ target: (0, import_common.serviceFn)("arbitration_clear_with_passport"),
2061
+ arguments: [
2062
+ (0, import_common.toTxObject)(tx, service),
2063
+ (0, import_common.toTxObject)(tx, permission),
2064
+ (0, import_common.toTxObject)(tx, passport),
2065
+ tx.object.mutRegistrar()
2066
+ ],
2067
+ typeArguments: [service_type]
2068
+ });
2069
+ } else {
2070
+ tx.moveCall({
2071
+ target: (0, import_common.serviceFn)("arbitration_clear"),
2072
+ arguments: [
2073
+ (0, import_common.toTxObject)(tx, service),
2074
+ (0, import_common.toTxObject)(tx, permission),
2075
+ tx.object.mutRegistrar()
2076
+ ],
2077
+ typeArguments: [service_type]
2078
+ });
2079
+ }
2080
+ }
2081
+ async function compensation_fund_add(env, tx, service, service_type, permission, coin, passport) {
2082
+ (0, import_util.validObjects)([service, permission, passport]);
2083
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2084
+ (0, import_exception.W_ERROR)(
2085
+ import_exception.WErrors.InvalidParam,
2086
+ `Compensation fund add service type ${service_type} is not valid`
2087
+ );
2088
+ }
2089
+ const coinParam = await (0, import_base.getCoinParam)(env, tx, coin, service_type);
2090
+ if (passport) {
2091
+ tx.moveCall({
2092
+ target: (0, import_common.serviceFn)("compensation_fund_add_with_passport"),
2093
+ arguments: [
2094
+ (0, import_common.toTxObject)(tx, service),
2095
+ (0, import_common.toTxObject)(tx, permission),
2096
+ (0, import_common.toTxObject)(tx, passport),
2097
+ coinParam
2098
+ ],
2099
+ typeArguments: [service_type]
2100
+ });
2101
+ } else {
2102
+ tx.moveCall({
2103
+ target: (0, import_common.serviceFn)("compensation_fund_add"),
2104
+ arguments: [
2105
+ (0, import_common.toTxObject)(tx, service),
2106
+ (0, import_common.toTxObject)(tx, permission),
2107
+ coinParam
2108
+ ],
2109
+ typeArguments: [service_type]
2110
+ });
2111
+ }
2112
+ }
2113
+ function compensation_lock_duration_set(tx, service, service_type, permission, duration_ms, passport) {
2114
+ if (!(0, import_common.isValidU64)(duration_ms) || duration_ms === 0) {
2115
+ return;
2116
+ }
2117
+ (0, import_util.validObjects)([service, permission, passport]);
2118
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2119
+ (0, import_exception.W_ERROR)(
2120
+ import_exception.WErrors.InvalidParam,
2121
+ `Compensation lock duration set service type ${service_type} is not valid`
2122
+ );
2123
+ }
2124
+ if (passport) {
2125
+ tx.moveCall({
2126
+ target: (0, import_common.serviceFn)("compensation_lock_duration_add_with_passport"),
2127
+ arguments: [
2128
+ (0, import_common.toTxObject)(tx, service),
2129
+ (0, import_common.toTxObject)(tx, permission),
2130
+ (0, import_common.toTxObject)(tx, passport),
2131
+ tx.pure.u64(duration_ms)
2132
+ ],
2133
+ typeArguments: [service_type]
2134
+ });
2135
+ } else {
2136
+ tx.moveCall({
2137
+ target: (0, import_common.serviceFn)("compensation_lock_duration_add"),
2138
+ arguments: [
2139
+ (0, import_common.toTxObject)(tx, service),
2140
+ (0, import_common.toTxObject)(tx, permission),
2141
+ tx.pure.u64(duration_ms)
2142
+ ],
2143
+ typeArguments: [service_type]
2144
+ });
2145
+ }
2146
+ }
2147
+ function order_allocators_set(tx, service, service_type, permission, allocators2, passport) {
2148
+ (0, import_util.validObjects)([service, permission, allocators2, passport]);
2149
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2150
+ (0, import_exception.W_ERROR)(
2151
+ import_exception.WErrors.InvalidParam,
2152
+ `Order allocators set service type ${service_type} is not valid`
2153
+ );
2154
+ }
2155
+ if (passport) {
2156
+ tx.moveCall({
2157
+ target: (0, import_common.serviceFn)("order_allocators_set_with_passport"),
2158
+ arguments: [
2159
+ (0, import_common.toTxObject)(tx, service),
2160
+ (0, import_common.toTxObject)(tx, permission),
2161
+ (0, import_common.toTxObject)(tx, passport),
2162
+ tx.object.option({
2163
+ type: `${import_common.PackageAddress}::allocation::Allocators`,
2164
+ value: allocators2 ?? null
2165
+ })
2166
+ ],
2167
+ typeArguments: [service_type]
2168
+ });
2169
+ } else {
2170
+ tx.moveCall({
2171
+ target: (0, import_common.serviceFn)("order_allocators_set"),
2172
+ arguments: [
2173
+ (0, import_common.toTxObject)(tx, service),
2174
+ (0, import_common.toTxObject)(tx, permission),
2175
+ tx.object.option({
2176
+ type: `${import_common.PackageAddress}::allocation::Allocators`,
2177
+ value: allocators2 ?? null
2178
+ })
2179
+ ],
2180
+ typeArguments: [service_type]
2181
+ });
2182
+ }
2183
+ }
2184
+ function reward_add(tx, service, service_type, permission, reward, reward_type, passport) {
2185
+ (0, import_util.validObjects)([service, permission, reward, passport]);
2186
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2187
+ (0, import_exception.W_ERROR)(
2188
+ import_exception.WErrors.InvalidParam,
2189
+ `Rewards add service type ${service_type} is not valid`
2190
+ );
2191
+ }
2192
+ if (!(0, import_common.IsValidArgType)(reward_type)) {
2193
+ (0, import_exception.W_ERROR)(
2194
+ import_exception.WErrors.InvalidParam,
2195
+ `Rewards add reward type ${reward_type} is not valid`
2196
+ );
2197
+ }
2198
+ if (passport) {
2199
+ tx.moveCall({
2200
+ target: (0, import_common.serviceFn)("reward_add_with_passport"),
2201
+ arguments: [
2202
+ (0, import_common.toTxObject)(tx, service),
2203
+ (0, import_common.toTxObject)(tx, permission),
2204
+ (0, import_common.toTxObject)(tx, passport),
2205
+ (0, import_common.toTxObject)(tx, reward),
2206
+ tx.object.mutRegistrar(),
2207
+ tx.object.clock()
2208
+ ],
2209
+ typeArguments: [service_type, reward_type]
2210
+ });
2211
+ } else {
2212
+ tx.moveCall({
2213
+ target: (0, import_common.serviceFn)("reward_add"),
2214
+ arguments: [
2215
+ (0, import_common.toTxObject)(tx, service),
2216
+ (0, import_common.toTxObject)(tx, permission),
2217
+ (0, import_common.toTxObject)(tx, reward),
2218
+ tx.object.mutRegistrar(),
2219
+ tx.object.clock()
2220
+ ],
2221
+ typeArguments: [service_type, reward_type]
2222
+ });
2223
+ }
2224
+ }
2225
+ function reward_remove(tx, service, service_type, permission, rewards, passport) {
2226
+ if (rewards.length === 0) {
2227
+ return;
2228
+ }
2229
+ (0, import_util.validObjects)([service, permission, passport]);
2230
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2231
+ (0, import_exception.W_ERROR)(
2232
+ import_exception.WErrors.InvalidParam,
2233
+ `Rewards remove service type ${service_type} is not valid`
2234
+ );
2235
+ }
2236
+ if (passport) {
2237
+ tx.moveCall({
2238
+ target: (0, import_common.serviceFn)("reward_remove_with_passport"),
2239
+ arguments: [
2240
+ (0, import_common.toTxObject)(tx, service),
2241
+ (0, import_common.toTxObject)(tx, permission),
2242
+ (0, import_common.toTxObject)(tx, passport),
2243
+ tx.pure.vector("address", rewards),
2244
+ tx.object.mutRegistrar()
2245
+ ],
2246
+ typeArguments: [service_type]
2247
+ });
2248
+ } else {
2249
+ tx.moveCall({
2250
+ target: (0, import_common.serviceFn)("reward_remove"),
2251
+ arguments: [
2252
+ (0, import_common.toTxObject)(tx, service),
2253
+ (0, import_common.toTxObject)(tx, permission),
2254
+ tx.pure.vector("address", rewards),
2255
+ tx.object.mutRegistrar()
2256
+ ],
2257
+ typeArguments: [service_type]
2258
+ });
2259
+ }
2260
+ }
2261
+ function reward_clear(tx, service, service_type, permission, passport) {
2262
+ (0, import_util.validObjects)([service, permission, passport]);
2263
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2264
+ (0, import_exception.W_ERROR)(
2265
+ import_exception.WErrors.InvalidParam,
2266
+ `Rewards clear service type ${service_type} is not valid`
2267
+ );
2268
+ }
2269
+ if (passport) {
2270
+ tx.moveCall({
2271
+ target: (0, import_common.serviceFn)("reward_clear_with_passport"),
2272
+ arguments: [
2273
+ (0, import_common.toTxObject)(tx, service),
2274
+ (0, import_common.toTxObject)(tx, permission),
2275
+ (0, import_common.toTxObject)(tx, passport),
2276
+ tx.object.mutRegistrar()
2277
+ ],
2278
+ typeArguments: [service_type]
2279
+ });
2280
+ } else {
2281
+ tx.moveCall({
2282
+ target: (0, import_common.serviceFn)("reward_clear"),
2283
+ arguments: [
2284
+ (0, import_common.toTxObject)(tx, service),
2285
+ (0, import_common.toTxObject)(tx, permission),
2286
+ tx.object.mutRegistrar()
2287
+ ],
2288
+ typeArguments: [service_type]
2289
+ });
2290
+ }
2291
+ }
2292
+ function compensation_fund_receive(tx, service, service_type, permission, received_object, payment, passport) {
2293
+ if (!payment) {
2294
+ (0, import_exception.W_ERROR)(
2295
+ import_exception.WErrors.InvalidParam,
2296
+ `Compensation fund receive payment is required`
2297
+ );
2298
+ }
2299
+ (0, import_util.validObjects)([service, permission, received_object, payment, passport]);
2300
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2301
+ (0, import_exception.W_ERROR)(
2302
+ import_exception.WErrors.InvalidParam,
2303
+ `Compensation fund receive service type ${service_type} is not valid`
2304
+ );
2305
+ }
2306
+ if (passport) {
2307
+ tx.moveCall({
2308
+ target: (0, import_common.serviceFn)("compensation_fund_receive_with_passport"),
2309
+ arguments: [
2310
+ (0, import_common.toTxObject)(tx, service),
2311
+ (0, import_common.toTxObject)(tx, permission),
2312
+ (0, import_common.toTxObject)(tx, passport),
2313
+ (0, import_common.toTxObject)(tx, received_object),
2314
+ (0, import_common.toTxObject)(tx, payment)
2315
+ ],
2316
+ typeArguments: [service_type]
2317
+ });
2318
+ } else {
2319
+ tx.moveCall({
2320
+ target: (0, import_common.serviceFn)("compensation_fund_receive"),
2321
+ arguments: [
2322
+ (0, import_common.toTxObject)(tx, service),
2323
+ (0, import_common.toTxObject)(tx, permission),
2324
+ (0, import_common.toTxObject)(tx, received_object),
2325
+ (0, import_common.toTxObject)(tx, payment)
2326
+ ],
2327
+ typeArguments: [service_type]
2328
+ });
2329
+ }
2330
+ }
2331
+ function compensation_fund_withdraw(tx, service, service_type, payment_info, receipt, permission, passport) {
2332
+ (0, import_util.validObjects)([service, permission, receipt, payment_info, passport]);
2333
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2334
+ (0, import_exception.W_ERROR)(
2335
+ import_exception.WErrors.InvalidParam,
2336
+ `Compensation fund withdraw service type ${service_type} is not valid`
2337
+ );
2338
+ }
2339
+ if (passport) {
2340
+ tx.moveCall({
2341
+ target: (0, import_common.serviceFn)("compensation_fund_withdraw_with_passport"),
2342
+ arguments: [
2343
+ (0, import_common.toTxObject)(tx, service),
2344
+ (0, import_common.toTxObject)(tx, permission),
2345
+ (0, import_common.toTxObject)(tx, passport),
2346
+ tx.pure.address(receipt),
2347
+ (0, import_common.toTxObject)(tx, payment_info),
2348
+ tx.object.mutRegistrar(),
2349
+ tx.object.clock()
2350
+ ],
2351
+ typeArguments: [service_type]
2352
+ });
2353
+ } else {
2354
+ tx.moveCall({
2355
+ target: (0, import_common.serviceFn)("compensation_fund_withdraw"),
2356
+ arguments: [
2357
+ (0, import_common.toTxObject)(tx, service),
2358
+ (0, import_common.toTxObject)(tx, permission),
2359
+ tx.pure.address(receipt),
2360
+ (0, import_common.toTxObject)(tx, payment_info),
2361
+ tx.object.mutRegistrar(),
2362
+ tx.object.clock()
2363
+ ],
2364
+ typeArguments: [service_type]
2365
+ });
2366
+ }
2367
+ }
2368
+ async function discount(tx, service, service_type, permission, discount2, passport) {
2369
+ let recipient = [];
2370
+ if (Array.isArray(discount2.recipient)) {
2371
+ recipient = discount2.recipient;
2372
+ } else {
2373
+ recipient = await (0, import_local.GetManyAccountOrMark_Address)(discount2.recipient);
2374
+ }
2375
+ if (recipient.length === 0 || discount2.count === 0) {
2376
+ return;
2377
+ }
2378
+ if (recipient.length > MAX_DISCOUNT_RECEIVER_ONCE) {
2379
+ (0, import_exception.W_ERROR)(
2380
+ import_exception.WErrors.InvalidParam,
2381
+ `Discount recipient length ${recipient.length} is exceed max ${MAX_DISCOUNT_RECEIVER_ONCE}`
2382
+ );
2383
+ }
2384
+ if (!(0, import_common.isValidName)(discount2.name)) {
2385
+ (0, import_exception.W_ERROR)(
2386
+ import_exception.WErrors.InvalidParam,
2387
+ `Discount name ${discount2.name} is not valid`
2388
+ );
2389
+ }
2390
+ if (!(0, import_common.isValidU16)(discount2.count) || discount2.count > MAX_DISCOUNT_COUNT_ONCE) {
2391
+ (0, import_exception.W_ERROR)(
2392
+ import_exception.WErrors.InvalidParam,
2393
+ `Discount count ${discount2.count} is exceed max ${MAX_DISCOUNT_COUNT_ONCE}`
2394
+ );
2395
+ }
2396
+ if (recipient.length * discount2.count > MAX_DISCOUNT_TOTAL_COUNT) {
2397
+ (0, import_exception.W_ERROR)(
2398
+ import_exception.WErrors.InvalidParam,
2399
+ `Discount total count ${recipient.length * discount2.count} is exceed max ${MAX_DISCOUNT_TOTAL_COUNT}`
2400
+ );
2401
+ }
2402
+ if (discount2.benchmark != null && !(0, import_common.isValidU64)(discount2.benchmark)) {
2403
+ (0, import_exception.W_ERROR)(
2404
+ import_exception.WErrors.InvalidParam,
2405
+ `Discount benchmark ${discount2.benchmark} is not valid`
2406
+ );
2407
+ }
2408
+ const start = discount2.time_ms_start ?? Date.now();
2409
+ if (discount2.time_ms_end < start) {
2410
+ (0, import_exception.W_ERROR)(
2411
+ import_exception.WErrors.InvalidParam,
2412
+ `Discount time_ms_end ${discount2.time_ms_end} is not valid`
2413
+ );
2414
+ }
2415
+ if (discount2.discount_value != null && !(0, import_common.isValidU64)(discount2.discount_value)) {
2416
+ (0, import_exception.W_ERROR)(
2417
+ import_exception.WErrors.InvalidParam,
2418
+ `Discount discount_value ${discount2.discount_value} is not valid`
2419
+ );
2420
+ }
2421
+ (0, import_util.validObjects)([service, permission, passport, ...recipient]);
2422
+ if (!(0, import_common.IsValidArgType)(service_type)) {
2423
+ (0, import_exception.W_ERROR)(
2424
+ import_exception.WErrors.InvalidParam,
2425
+ `Discount service type ${service_type} is not valid`
2426
+ );
2427
+ }
2428
+ if (passport) {
2429
+ tx.moveCall({
2430
+ target: (0, import_common.serviceFn)("discount_with_passport"),
2431
+ arguments: [
2432
+ (0, import_common.toTxObject)(tx, service),
2433
+ (0, import_common.toTxObject)(tx, permission),
2434
+ (0, import_common.toTxObject)(tx, passport),
2435
+ tx.pure.string(discount2.name),
2436
+ tx.pure.u8(discount2.discount_type),
2437
+ tx.pure.u64(discount2.discount_value),
2438
+ tx.pure.option("u64", discount2.benchmark ?? null),
2439
+ tx.pure.bool(discount2.transferable),
2440
+ tx.pure.option("u64", discount2.time_ms_start ?? null),
2441
+ tx.pure.u64(discount2.time_ms_end),
2442
+ tx.pure.u16(discount2.count),
2443
+ tx.pure.vector("address", recipient),
2444
+ tx.object.clock()
2445
+ ],
2446
+ typeArguments: [service_type]
2447
+ });
2448
+ } else {
2449
+ tx.moveCall({
2450
+ target: (0, import_common.serviceFn)("discount"),
2451
+ arguments: [
2452
+ (0, import_common.toTxObject)(tx, service),
2453
+ (0, import_common.toTxObject)(tx, permission),
2454
+ tx.pure.string(discount2.name),
2455
+ tx.pure.u8(discount2.discount_type),
2456
+ tx.pure.u64(discount2.discount_value),
2457
+ tx.pure.option("u64", discount2.benchmark ?? null),
2458
+ tx.pure.bool(discount2.transferable),
2459
+ tx.pure.option("u64", discount2.time_ms_start ?? null),
2460
+ tx.pure.u64(discount2.time_ms_end),
2461
+ tx.pure.u16(discount2.count),
2462
+ tx.pure.vector("address", recipient),
2463
+ tx.object.clock()
2464
+ ],
2465
+ typeArguments: [service_type]
2466
+ });
2467
+ }
2468
+ }