wowok 2.1.10 → 2.1.12

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