@typus/typus-perp-sdk 1.1.32-codegen-exp3 → 1.1.32-testnet-exp1

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 (249) hide show
  1. package/dist/src/_dependencies/source/0x1/ascii/structs.d.ts +88 -0
  2. package/dist/src/_dependencies/source/0x1/ascii/structs.js +398 -0
  3. package/dist/src/_dependencies/source/0x1/index.d.ts +3 -0
  4. package/dist/src/_dependencies/source/0x1/index.js +6 -0
  5. package/dist/src/_dependencies/source/0x1/option/structs.d.ts +50 -0
  6. package/dist/src/_dependencies/source/0x1/option/structs.js +271 -0
  7. package/dist/src/_dependencies/source/0x1/string/structs.d.ts +48 -0
  8. package/dist/src/_dependencies/source/0x1/string/structs.js +256 -0
  9. package/dist/src/_dependencies/source/0x1/type-name/structs.d.ts +49 -0
  10. package/dist/src/_dependencies/source/0x1/type-name/structs.js +223 -0
  11. package/dist/src/_dependencies/source/0x2/bag/structs.d.ts +54 -0
  12. package/dist/src/_dependencies/source/0x2/bag/structs.js +229 -0
  13. package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +84 -0
  14. package/dist/src/_dependencies/source/0x2/balance/structs.js +386 -0
  15. package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +406 -0
  16. package/dist/src/_dependencies/source/0x2/coin/structs.js +1247 -0
  17. package/dist/src/_dependencies/source/0x2/index.d.ts +3 -0
  18. package/dist/src/_dependencies/source/0x2/index.js +6 -0
  19. package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +132 -0
  20. package/dist/src/_dependencies/source/0x2/linked-table/structs.js +438 -0
  21. package/dist/src/_dependencies/source/0x2/object/structs.d.ts +86 -0
  22. package/dist/src/_dependencies/source/0x2/object/structs.js +364 -0
  23. package/dist/src/_dependencies/source/0x2/object-table/structs.d.ts +54 -0
  24. package/dist/src/_dependencies/source/0x2/object-table/structs.js +248 -0
  25. package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +44 -0
  26. package/dist/src/_dependencies/source/0x2/sui/structs.js +222 -0
  27. package/dist/src/_dependencies/source/0x2/table/structs.d.ts +54 -0
  28. package/dist/src/_dependencies/source/0x2/table/structs.js +248 -0
  29. package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +59 -0
  30. package/dist/src/_dependencies/source/0x2/table-vec/structs.js +274 -0
  31. package/dist/src/_dependencies/source/0x2/token/structs.d.ts +421 -0
  32. package/dist/src/_dependencies/source/0x2/token/structs.js +1095 -0
  33. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +348 -0
  34. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +1091 -0
  35. package/dist/src/_dependencies/source/0x2/url/structs.d.ts +49 -0
  36. package/dist/src/_dependencies/source/0x2/url/structs.js +223 -0
  37. package/dist/src/_dependencies/source/0x2/vec-map/structs.d.ts +106 -0
  38. package/dist/src/_dependencies/source/0x2/vec-map/structs.js +446 -0
  39. package/dist/src/_dependencies/source/0x2/vec-set/structs.d.ts +49 -0
  40. package/dist/src/_dependencies/source/0x2/vec-set/structs.js +270 -0
  41. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +422 -0
  42. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +1084 -0
  43. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +130 -0
  44. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +456 -0
  45. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +208 -0
  46. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +653 -0
  47. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +362 -0
  48. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +899 -0
  49. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +8 -0
  50. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +11 -0
  51. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +2 -0
  52. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +102 -0
  53. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.d.ts +202 -0
  54. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.js +632 -0
  55. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +600 -0
  56. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +1459 -0
  57. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.d.ts +136 -0
  58. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.js +438 -0
  59. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +127 -0
  60. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +430 -0
  61. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +957 -0
  62. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +2261 -0
  63. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +244 -0
  64. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +733 -0
  65. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +294 -0
  66. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +892 -0
  67. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +73 -0
  68. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +263 -0
  69. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +294 -0
  70. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +591 -0
  71. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +64 -0
  72. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +258 -0
  73. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +756 -0
  74. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +1721 -0
  75. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +44 -0
  76. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +222 -0
  77. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +3 -0
  78. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +6 -0
  79. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +2 -0
  80. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +89 -0
  81. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +135 -0
  82. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +444 -0
  83. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.d.ts +2106 -0
  84. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.js +4952 -0
  85. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +390 -0
  86. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +844 -0
  87. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +6 -0
  88. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +9 -0
  89. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +2 -0
  90. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +69 -0
  91. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +89 -0
  92. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +376 -0
  93. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +386 -0
  94. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +881 -0
  95. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +59 -0
  96. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +274 -0
  97. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +974 -0
  98. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +2387 -0
  99. package/dist/src/_framework/init-loader.d.ts +2 -0
  100. package/dist/src/{generated/typus_perp/treasury_caps.js → _framework/init-loader.js} +10 -17
  101. package/dist/src/_framework/loader.d.ts +17 -0
  102. package/dist/src/_framework/loader.js +108 -0
  103. package/dist/src/_framework/reified.d.ts +108 -0
  104. package/dist/src/_framework/reified.js +237 -0
  105. package/dist/src/_framework/util.d.ts +35 -0
  106. package/dist/src/_framework/util.js +396 -0
  107. package/dist/src/_framework/vector.d.ts +42 -0
  108. package/dist/src/_framework/vector.js +112 -0
  109. package/dist/src/api/sentio.js +538 -604
  110. package/dist/src/fetch.d.ts +36 -577
  111. package/dist/src/fetch.js +665 -367
  112. package/dist/src/index.d.ts +4 -0
  113. package/dist/src/index.js +39 -20
  114. package/dist/src/pyth.js +1 -0
  115. package/dist/src/typus_perp/admin/functions.d.ts +59 -0
  116. package/dist/src/typus_perp/admin/functions.js +122 -0
  117. package/dist/src/typus_perp/admin/structs.d.ts +467 -0
  118. package/dist/src/typus_perp/admin/structs.js +1065 -0
  119. package/dist/src/typus_perp/competition/functions.d.ts +24 -0
  120. package/dist/src/typus_perp/competition/functions.js +38 -0
  121. package/dist/src/typus_perp/competition/structs.d.ts +80 -0
  122. package/dist/src/typus_perp/competition/structs.js +288 -0
  123. package/dist/src/typus_perp/error/functions.d.ts +73 -0
  124. package/dist/src/typus_perp/error/functions.js +363 -0
  125. package/dist/src/typus_perp/escrow/functions.d.ts +17 -0
  126. package/dist/src/typus_perp/escrow/functions.js +36 -0
  127. package/dist/src/typus_perp/escrow/structs.d.ts +160 -0
  128. package/dist/src/typus_perp/escrow/structs.js +324 -0
  129. package/dist/src/typus_perp/index.d.ts +1 -0
  130. package/dist/src/typus_perp/index.js +7 -0
  131. package/dist/src/typus_perp/init.d.ts +2 -0
  132. package/dist/src/typus_perp/init.js +118 -0
  133. package/dist/src/typus_perp/lending/functions.d.ts +15 -0
  134. package/dist/src/typus_perp/lending/functions.js +22 -0
  135. package/dist/src/typus_perp/lp-pool/functions.d.ts +460 -0
  136. package/dist/src/typus_perp/lp-pool/functions.js +732 -0
  137. package/dist/src/typus_perp/lp-pool/structs.d.ts +3705 -0
  138. package/dist/src/typus_perp/lp-pool/structs.js +6789 -0
  139. package/dist/src/typus_perp/math/functions.d.ts +29 -0
  140. package/dist/src/typus_perp/math/functions.js +61 -0
  141. package/dist/src/typus_perp/position/functions.d.ts +379 -0
  142. package/dist/src/typus_perp/position/functions.js +713 -0
  143. package/dist/src/typus_perp/position/structs.d.ts +905 -0
  144. package/dist/src/typus_perp/position/structs.js +1450 -0
  145. package/dist/src/typus_perp/symbol/functions.d.ts +9 -0
  146. package/dist/src/typus_perp/symbol/functions.js +24 -0
  147. package/dist/src/typus_perp/symbol/structs.d.ts +70 -0
  148. package/dist/src/typus_perp/symbol/structs.js +235 -0
  149. package/dist/src/typus_perp/tlp/functions.d.ts +19 -0
  150. package/dist/src/typus_perp/tlp/functions.js +40 -0
  151. package/dist/src/typus_perp/tlp/structs.d.ts +89 -0
  152. package/dist/src/typus_perp/tlp/structs.js +365 -0
  153. package/dist/src/typus_perp/token-interface/functions.d.ts +11 -0
  154. package/dist/src/typus_perp/token-interface/functions.js +22 -0
  155. package/dist/src/typus_perp/trading/functions.d.ts +812 -0
  156. package/dist/src/typus_perp/trading/functions.js +1218 -0
  157. package/dist/src/typus_perp/trading/structs.d.ts +3060 -0
  158. package/dist/src/typus_perp/trading/structs.js +5813 -0
  159. package/dist/src/typus_perp/treasury-caps/functions.d.ts +9 -0
  160. package/dist/src/typus_perp/treasury-caps/functions.js +36 -0
  161. package/dist/src/typus_perp/treasury-caps/structs.d.ts +49 -0
  162. package/dist/src/typus_perp/treasury-caps/structs.js +223 -0
  163. package/dist/src/typus_perp/user-account/functions.d.ts +36 -0
  164. package/dist/src/typus_perp/user-account/functions.js +70 -0
  165. package/dist/src/typus_perp/user-account/structs.d.ts +148 -0
  166. package/dist/src/typus_perp/user-account/structs.js +448 -0
  167. package/dist/src/typus_stake_pool/admin/functions.d.ts +49 -0
  168. package/dist/src/typus_stake_pool/admin/functions.js +105 -0
  169. package/dist/src/typus_stake_pool/admin/structs.d.ts +365 -0
  170. package/dist/src/typus_stake_pool/admin/structs.js +789 -0
  171. package/dist/src/typus_stake_pool/index.d.ts +1 -0
  172. package/dist/src/typus_stake_pool/index.js +7 -0
  173. package/dist/src/typus_stake_pool/init.d.ts +2 -0
  174. package/dist/src/typus_stake_pool/init.js +69 -0
  175. package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +229 -0
  176. package/dist/src/typus_stake_pool/stake-pool/functions.js +380 -0
  177. package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +2199 -0
  178. package/dist/src/typus_stake_pool/stake-pool/structs.js +4653 -0
  179. package/dist/src/user/history.js +685 -614
  180. package/dist/src/user/order.d.ts +11 -16
  181. package/dist/src/user/order.js +302 -171
  182. package/dist/src/user/orderWithBidReceipt.d.ts +6 -8
  183. package/dist/src/user/orderWithBidReceipt.js +225 -127
  184. package/dist/src/user/tlp.d.ts +24 -25
  185. package/dist/src/user/tlp.js +468 -317
  186. package/package.json +3 -11
  187. package/dist/src/client.d.ts +0 -27
  188. package/dist/src/client.js +0 -108
  189. package/dist/src/generated/typus_perp/admin.d.ts +0 -117
  190. package/dist/src/generated/typus_perp/admin.js +0 -110
  191. package/dist/src/generated/typus_perp/competition.d.ts +0 -22
  192. package/dist/src/generated/typus_perp/competition.js +0 -58
  193. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +0 -17
  194. package/dist/src/generated/typus_perp/deps/std/type_name.js +0 -25
  195. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +0 -12
  196. package/dist/src/generated/typus_perp/deps/sui/balance.js +0 -20
  197. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +0 -8
  198. package/dist/src/generated/typus_perp/deps/sui/object.js +0 -16
  199. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +0 -19
  200. package/dist/src/generated/typus_perp/deps/sui/object_table.js +0 -59
  201. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +0 -18
  202. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +0 -25
  203. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +0 -30
  204. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +0 -67
  205. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +0 -32
  206. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +0 -71
  207. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +0 -23
  208. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +0 -61
  209. package/dist/src/generated/typus_perp/escrow.d.ts +0 -59
  210. package/dist/src/generated/typus_perp/escrow.js +0 -76
  211. package/dist/src/generated/typus_perp/lending.d.ts +0 -47
  212. package/dist/src/generated/typus_perp/lending.js +0 -50
  213. package/dist/src/generated/typus_perp/lp_pool.d.ts +0 -2327
  214. package/dist/src/generated/typus_perp/lp_pool.js +0 -1956
  215. package/dist/src/generated/typus_perp/math.d.ts +0 -95
  216. package/dist/src/generated/typus_perp/math.js +0 -97
  217. package/dist/src/generated/typus_perp/position.d.ts +0 -234
  218. package/dist/src/generated/typus_perp/position.js +0 -204
  219. package/dist/src/generated/typus_perp/symbol.d.ts +0 -18
  220. package/dist/src/generated/typus_perp/symbol.js +0 -55
  221. package/dist/src/generated/typus_perp/tlp.d.ts +0 -13
  222. package/dist/src/generated/typus_perp/tlp.js +0 -56
  223. package/dist/src/generated/typus_perp/trading.d.ts +0 -2486
  224. package/dist/src/generated/typus_perp/trading.js +0 -2476
  225. package/dist/src/generated/typus_perp/treasury_caps.d.ts +0 -13
  226. package/dist/src/generated/typus_perp/user_account.d.ts +0 -40
  227. package/dist/src/generated/typus_perp/user_account.js +0 -72
  228. package/dist/src/generated/typus_stake_pool/admin.d.ts +0 -234
  229. package/dist/src/generated/typus_stake_pool/admin.js +0 -272
  230. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +0 -17
  231. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +0 -25
  232. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +0 -8
  233. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +0 -16
  234. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +0 -30
  235. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +0 -37
  236. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +0 -18
  237. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +0 -25
  238. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +0 -986
  239. package/dist/src/generated/typus_stake_pool/stake_pool.js +0 -874
  240. package/dist/src/generated/utils/index.d.ts +0 -11
  241. package/dist/src/generated/utils/index.js +0 -135
  242. package/dist/src/grpc/graphql.d.ts +0 -26
  243. package/dist/src/grpc/graphql.js +0 -126
  244. package/dist/src/grpc/grpc.d.ts +0 -1
  245. package/dist/src/grpc/grpc.js +0 -38
  246. package/dist/src/grpc/ledgerService.js +0 -64
  247. package/dist/src/grpc/liveDataService.d.ts +0 -0
  248. package/dist/src/grpc/liveDataService.js +0 -49
  249. /package/dist/src/{grpc/ledgerService.d.ts → pyth.d.ts} +0 -0
@@ -0,0 +1,1095 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __read = (this && this.__read) || function (o, n) {
50
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
51
+ if (!m) return o;
52
+ var i = m.call(o), r, ar = [], e;
53
+ try {
54
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
55
+ }
56
+ catch (error) { e = { error: error }; }
57
+ finally {
58
+ try {
59
+ if (r && !r.done && (m = i["return"])) m.call(i);
60
+ }
61
+ finally { if (e) throw e.error; }
62
+ }
63
+ return ar;
64
+ };
65
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
66
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
67
+ if (ar || !(i in from)) {
68
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
69
+ ar[i] = from[i];
70
+ }
71
+ }
72
+ return to.concat(ar || Array.prototype.slice.call(from));
73
+ };
74
+ Object.defineProperty(exports, "__esModule", { value: true });
75
+ exports.TokenPolicyCreated = exports.TokenPolicyCap = exports.TokenPolicy = exports.Token = exports.RuleKey = exports.ActionRequest = void 0;
76
+ exports.isActionRequest = isActionRequest;
77
+ exports.isRuleKey = isRuleKey;
78
+ exports.isToken = isToken;
79
+ exports.isTokenPolicy = isTokenPolicy;
80
+ exports.isTokenPolicyCap = isTokenPolicyCap;
81
+ exports.isTokenPolicyCreated = isTokenPolicyCreated;
82
+ var reified_1 = require("../../../../_framework/reified");
83
+ var util_1 = require("../../../../_framework/util");
84
+ var structs_1 = require("../../0x1/option/structs");
85
+ var structs_2 = require("../../0x1/string/structs");
86
+ var structs_3 = require("../../0x1/type-name/structs");
87
+ var structs_4 = require("../balance/structs");
88
+ var index_1 = require("../index");
89
+ var structs_5 = require("../object/structs");
90
+ var structs_6 = require("../vec-map/structs");
91
+ var structs_7 = require("../vec-set/structs");
92
+ var bcs_1 = require("@mysten/sui/bcs");
93
+ var utils_1 = require("@mysten/sui/utils");
94
+ /* ============================== ActionRequest =============================== */
95
+ function isActionRequest(type) {
96
+ type = (0, util_1.compressSuiType)(type);
97
+ return type.startsWith("".concat(index_1.PKG_V26, "::token::ActionRequest") + "<");
98
+ }
99
+ var ActionRequest = /** @class */ (function () {
100
+ function ActionRequest(typeArgs, fields) {
101
+ this.__StructClass = true;
102
+ this.$typeName = ActionRequest.$typeName;
103
+ this.$isPhantom = ActionRequest.$isPhantom;
104
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([ActionRequest.$typeName], __read(typeArgs), false));
105
+ this.$typeArgs = typeArgs;
106
+ this.name = fields.name;
107
+ this.amount = fields.amount;
108
+ this.sender = fields.sender;
109
+ this.recipient = fields.recipient;
110
+ this.spentBalance = fields.spentBalance;
111
+ this.approvals = fields.approvals;
112
+ }
113
+ ActionRequest.reified = function (T) {
114
+ var _this = this;
115
+ return {
116
+ typeName: ActionRequest.$typeName,
117
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([ActionRequest.$typeName], [(0, reified_1.extractType)(T)], false)),
118
+ typeArgs: [(0, reified_1.extractType)(T)],
119
+ isPhantom: ActionRequest.$isPhantom,
120
+ reifiedTypeArgs: [T],
121
+ fromFields: function (fields) { return ActionRequest.fromFields(T, fields); },
122
+ fromFieldsWithTypes: function (item) { return ActionRequest.fromFieldsWithTypes(T, item); },
123
+ fromBcs: function (data) { return ActionRequest.fromBcs(T, data); },
124
+ bcs: ActionRequest.bcs,
125
+ fromJSONField: function (field) { return ActionRequest.fromJSONField(T, field); },
126
+ fromJSON: function (json) { return ActionRequest.fromJSON(T, json); },
127
+ fromSuiParsedData: function (content) { return ActionRequest.fromSuiParsedData(T, content); },
128
+ fromSuiObjectData: function (content) { return ActionRequest.fromSuiObjectData(T, content); },
129
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
130
+ return [2 /*return*/, ActionRequest.fetch(client, T, id)];
131
+ }); }); },
132
+ new: function (fields) {
133
+ return new ActionRequest([(0, reified_1.extractType)(T)], fields);
134
+ },
135
+ kind: "StructClassReified",
136
+ };
137
+ };
138
+ Object.defineProperty(ActionRequest, "r", {
139
+ get: function () {
140
+ return ActionRequest.reified;
141
+ },
142
+ enumerable: false,
143
+ configurable: true
144
+ });
145
+ ActionRequest.phantom = function (T) {
146
+ return (0, reified_1.phantom)(ActionRequest.reified(T));
147
+ };
148
+ Object.defineProperty(ActionRequest, "p", {
149
+ get: function () {
150
+ return ActionRequest.phantom;
151
+ },
152
+ enumerable: false,
153
+ configurable: true
154
+ });
155
+ Object.defineProperty(ActionRequest, "bcs", {
156
+ get: function () {
157
+ return bcs_1.bcs.struct("ActionRequest", {
158
+ name: structs_2.String.bcs,
159
+ amount: bcs_1.bcs.u64(),
160
+ sender: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
161
+ recipient: structs_1.Option.bcs(bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } })),
162
+ spent_balance: structs_1.Option.bcs(structs_4.Balance.bcs),
163
+ approvals: structs_7.VecSet.bcs(structs_3.TypeName.bcs),
164
+ });
165
+ },
166
+ enumerable: false,
167
+ configurable: true
168
+ });
169
+ ActionRequest.fromFields = function (typeArg, fields) {
170
+ return ActionRequest.reified(typeArg).new({
171
+ name: (0, reified_1.decodeFromFields)(structs_2.String.reified(), fields.name),
172
+ amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
173
+ sender: (0, reified_1.decodeFromFields)("address", fields.sender),
174
+ recipient: (0, reified_1.decodeFromFields)(structs_1.Option.reified("address"), fields.recipient),
175
+ spentBalance: (0, reified_1.decodeFromFields)(structs_1.Option.reified(structs_4.Balance.reified(typeArg)), fields.spent_balance),
176
+ approvals: (0, reified_1.decodeFromFields)(structs_7.VecSet.reified(structs_3.TypeName.reified()), fields.approvals),
177
+ });
178
+ };
179
+ ActionRequest.fromFieldsWithTypes = function (typeArg, item) {
180
+ if (!isActionRequest(item.type)) {
181
+ throw new Error("not a ActionRequest type");
182
+ }
183
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
184
+ return ActionRequest.reified(typeArg).new({
185
+ name: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.String.reified(), item.fields.name),
186
+ amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
187
+ sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
188
+ recipient: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified("address"), item.fields.recipient),
189
+ spentBalance: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Option.reified(structs_4.Balance.reified(typeArg)), item.fields.spent_balance),
190
+ approvals: (0, reified_1.decodeFromFieldsWithTypes)(structs_7.VecSet.reified(structs_3.TypeName.reified()), item.fields.approvals),
191
+ });
192
+ };
193
+ ActionRequest.fromBcs = function (typeArg, data) {
194
+ return ActionRequest.fromFields(typeArg, ActionRequest.bcs.parse(data));
195
+ };
196
+ ActionRequest.prototype.toJSONField = function () {
197
+ return {
198
+ name: this.name,
199
+ amount: this.amount.toString(),
200
+ sender: this.sender,
201
+ recipient: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<address>"), this.recipient),
202
+ spentBalance: (0, reified_1.fieldToJSON)("".concat(structs_1.Option.$typeName, "<").concat(structs_4.Balance.$typeName, "<").concat(this.$typeArgs[0], ">>"), this.spentBalance),
203
+ approvals: this.approvals.toJSONField(),
204
+ };
205
+ };
206
+ ActionRequest.prototype.toJSON = function () {
207
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
208
+ };
209
+ ActionRequest.fromJSONField = function (typeArg, field) {
210
+ return ActionRequest.reified(typeArg).new({
211
+ name: (0, reified_1.decodeFromJSONField)(structs_2.String.reified(), field.name),
212
+ amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
213
+ sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
214
+ recipient: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified("address"), field.recipient),
215
+ spentBalance: (0, reified_1.decodeFromJSONField)(structs_1.Option.reified(structs_4.Balance.reified(typeArg)), field.spentBalance),
216
+ approvals: (0, reified_1.decodeFromJSONField)(structs_7.VecSet.reified(structs_3.TypeName.reified()), field.approvals),
217
+ });
218
+ };
219
+ ActionRequest.fromJSON = function (typeArg, json) {
220
+ if (json.$typeName !== ActionRequest.$typeName) {
221
+ throw new Error("not a WithTwoGenerics json object");
222
+ }
223
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(ActionRequest.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
224
+ return ActionRequest.fromJSONField(typeArg, json);
225
+ };
226
+ ActionRequest.fromSuiParsedData = function (typeArg, content) {
227
+ if (content.dataType !== "moveObject") {
228
+ throw new Error("not an object");
229
+ }
230
+ if (!isActionRequest(content.type)) {
231
+ throw new Error("object at ".concat(content.fields.id, " is not a ActionRequest object"));
232
+ }
233
+ return ActionRequest.fromFieldsWithTypes(typeArg, content);
234
+ };
235
+ ActionRequest.fromSuiObjectData = function (typeArg, data) {
236
+ if (data.bcs) {
237
+ if (data.bcs.dataType !== "moveObject" || !isActionRequest(data.bcs.type)) {
238
+ throw new Error("object at is not a ActionRequest object");
239
+ }
240
+ var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
241
+ if (gotTypeArgs.length !== 1) {
242
+ throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
243
+ }
244
+ var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
245
+ var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
246
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
247
+ throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
248
+ }
249
+ return ActionRequest.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
250
+ }
251
+ if (data.content) {
252
+ return ActionRequest.fromSuiParsedData(typeArg, data.content);
253
+ }
254
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
255
+ };
256
+ ActionRequest.fetch = function (client, typeArg, id) {
257
+ return __awaiter(this, void 0, void 0, function () {
258
+ var res;
259
+ var _a, _b;
260
+ return __generator(this, function (_c) {
261
+ switch (_c.label) {
262
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
263
+ case 1:
264
+ res = _c.sent();
265
+ if (res.error) {
266
+ throw new Error("error fetching ActionRequest object at id ".concat(id, ": ").concat(res.error.code));
267
+ }
268
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isActionRequest(res.data.bcs.type)) {
269
+ throw new Error("object at id ".concat(id, " is not a ActionRequest object"));
270
+ }
271
+ return [2 /*return*/, ActionRequest.fromSuiObjectData(typeArg, res.data)];
272
+ }
273
+ });
274
+ });
275
+ };
276
+ ActionRequest.$typeName = "".concat(index_1.PKG_V26, "::token::ActionRequest");
277
+ ActionRequest.$numTypeParams = 1;
278
+ ActionRequest.$isPhantom = [true];
279
+ return ActionRequest;
280
+ }());
281
+ exports.ActionRequest = ActionRequest;
282
+ /* ============================== RuleKey =============================== */
283
+ function isRuleKey(type) {
284
+ type = (0, util_1.compressSuiType)(type);
285
+ return type.startsWith("".concat(index_1.PKG_V26, "::token::RuleKey") + "<");
286
+ }
287
+ var RuleKey = /** @class */ (function () {
288
+ function RuleKey(typeArgs, fields) {
289
+ this.__StructClass = true;
290
+ this.$typeName = RuleKey.$typeName;
291
+ this.$isPhantom = RuleKey.$isPhantom;
292
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([RuleKey.$typeName], __read(typeArgs), false));
293
+ this.$typeArgs = typeArgs;
294
+ this.isProtected = fields.isProtected;
295
+ }
296
+ RuleKey.reified = function (T) {
297
+ var _this = this;
298
+ return {
299
+ typeName: RuleKey.$typeName,
300
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([RuleKey.$typeName], [(0, reified_1.extractType)(T)], false)),
301
+ typeArgs: [(0, reified_1.extractType)(T)],
302
+ isPhantom: RuleKey.$isPhantom,
303
+ reifiedTypeArgs: [T],
304
+ fromFields: function (fields) { return RuleKey.fromFields(T, fields); },
305
+ fromFieldsWithTypes: function (item) { return RuleKey.fromFieldsWithTypes(T, item); },
306
+ fromBcs: function (data) { return RuleKey.fromBcs(T, data); },
307
+ bcs: RuleKey.bcs,
308
+ fromJSONField: function (field) { return RuleKey.fromJSONField(T, field); },
309
+ fromJSON: function (json) { return RuleKey.fromJSON(T, json); },
310
+ fromSuiParsedData: function (content) { return RuleKey.fromSuiParsedData(T, content); },
311
+ fromSuiObjectData: function (content) { return RuleKey.fromSuiObjectData(T, content); },
312
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
313
+ return [2 /*return*/, RuleKey.fetch(client, T, id)];
314
+ }); }); },
315
+ new: function (fields) {
316
+ return new RuleKey([(0, reified_1.extractType)(T)], fields);
317
+ },
318
+ kind: "StructClassReified",
319
+ };
320
+ };
321
+ Object.defineProperty(RuleKey, "r", {
322
+ get: function () {
323
+ return RuleKey.reified;
324
+ },
325
+ enumerable: false,
326
+ configurable: true
327
+ });
328
+ RuleKey.phantom = function (T) {
329
+ return (0, reified_1.phantom)(RuleKey.reified(T));
330
+ };
331
+ Object.defineProperty(RuleKey, "p", {
332
+ get: function () {
333
+ return RuleKey.phantom;
334
+ },
335
+ enumerable: false,
336
+ configurable: true
337
+ });
338
+ Object.defineProperty(RuleKey, "bcs", {
339
+ get: function () {
340
+ return bcs_1.bcs.struct("RuleKey", {
341
+ is_protected: bcs_1.bcs.bool(),
342
+ });
343
+ },
344
+ enumerable: false,
345
+ configurable: true
346
+ });
347
+ RuleKey.fromFields = function (typeArg, fields) {
348
+ return RuleKey.reified(typeArg).new({ isProtected: (0, reified_1.decodeFromFields)("bool", fields.is_protected) });
349
+ };
350
+ RuleKey.fromFieldsWithTypes = function (typeArg, item) {
351
+ if (!isRuleKey(item.type)) {
352
+ throw new Error("not a RuleKey type");
353
+ }
354
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
355
+ return RuleKey.reified(typeArg).new({ isProtected: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.is_protected) });
356
+ };
357
+ RuleKey.fromBcs = function (typeArg, data) {
358
+ return RuleKey.fromFields(typeArg, RuleKey.bcs.parse(data));
359
+ };
360
+ RuleKey.prototype.toJSONField = function () {
361
+ return {
362
+ isProtected: this.isProtected,
363
+ };
364
+ };
365
+ RuleKey.prototype.toJSON = function () {
366
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
367
+ };
368
+ RuleKey.fromJSONField = function (typeArg, field) {
369
+ return RuleKey.reified(typeArg).new({ isProtected: (0, reified_1.decodeFromJSONField)("bool", field.isProtected) });
370
+ };
371
+ RuleKey.fromJSON = function (typeArg, json) {
372
+ if (json.$typeName !== RuleKey.$typeName) {
373
+ throw new Error("not a WithTwoGenerics json object");
374
+ }
375
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(RuleKey.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
376
+ return RuleKey.fromJSONField(typeArg, json);
377
+ };
378
+ RuleKey.fromSuiParsedData = function (typeArg, content) {
379
+ if (content.dataType !== "moveObject") {
380
+ throw new Error("not an object");
381
+ }
382
+ if (!isRuleKey(content.type)) {
383
+ throw new Error("object at ".concat(content.fields.id, " is not a RuleKey object"));
384
+ }
385
+ return RuleKey.fromFieldsWithTypes(typeArg, content);
386
+ };
387
+ RuleKey.fromSuiObjectData = function (typeArg, data) {
388
+ if (data.bcs) {
389
+ if (data.bcs.dataType !== "moveObject" || !isRuleKey(data.bcs.type)) {
390
+ throw new Error("object at is not a RuleKey object");
391
+ }
392
+ var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
393
+ if (gotTypeArgs.length !== 1) {
394
+ throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
395
+ }
396
+ var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
397
+ var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
398
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
399
+ throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
400
+ }
401
+ return RuleKey.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
402
+ }
403
+ if (data.content) {
404
+ return RuleKey.fromSuiParsedData(typeArg, data.content);
405
+ }
406
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
407
+ };
408
+ RuleKey.fetch = function (client, typeArg, id) {
409
+ return __awaiter(this, void 0, void 0, function () {
410
+ var res;
411
+ var _a, _b;
412
+ return __generator(this, function (_c) {
413
+ switch (_c.label) {
414
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
415
+ case 1:
416
+ res = _c.sent();
417
+ if (res.error) {
418
+ throw new Error("error fetching RuleKey object at id ".concat(id, ": ").concat(res.error.code));
419
+ }
420
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isRuleKey(res.data.bcs.type)) {
421
+ throw new Error("object at id ".concat(id, " is not a RuleKey object"));
422
+ }
423
+ return [2 /*return*/, RuleKey.fromSuiObjectData(typeArg, res.data)];
424
+ }
425
+ });
426
+ });
427
+ };
428
+ RuleKey.$typeName = "".concat(index_1.PKG_V26, "::token::RuleKey");
429
+ RuleKey.$numTypeParams = 1;
430
+ RuleKey.$isPhantom = [true];
431
+ return RuleKey;
432
+ }());
433
+ exports.RuleKey = RuleKey;
434
+ /* ============================== Token =============================== */
435
+ function isToken(type) {
436
+ type = (0, util_1.compressSuiType)(type);
437
+ return type.startsWith("".concat(index_1.PKG_V26, "::token::Token") + "<");
438
+ }
439
+ var Token = /** @class */ (function () {
440
+ function Token(typeArgs, fields) {
441
+ this.__StructClass = true;
442
+ this.$typeName = Token.$typeName;
443
+ this.$isPhantom = Token.$isPhantom;
444
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Token.$typeName], __read(typeArgs), false));
445
+ this.$typeArgs = typeArgs;
446
+ this.id = fields.id;
447
+ this.balance = fields.balance;
448
+ }
449
+ Token.reified = function (T) {
450
+ var _this = this;
451
+ return {
452
+ typeName: Token.$typeName,
453
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Token.$typeName], [(0, reified_1.extractType)(T)], false)),
454
+ typeArgs: [(0, reified_1.extractType)(T)],
455
+ isPhantom: Token.$isPhantom,
456
+ reifiedTypeArgs: [T],
457
+ fromFields: function (fields) { return Token.fromFields(T, fields); },
458
+ fromFieldsWithTypes: function (item) { return Token.fromFieldsWithTypes(T, item); },
459
+ fromBcs: function (data) { return Token.fromBcs(T, data); },
460
+ bcs: Token.bcs,
461
+ fromJSONField: function (field) { return Token.fromJSONField(T, field); },
462
+ fromJSON: function (json) { return Token.fromJSON(T, json); },
463
+ fromSuiParsedData: function (content) { return Token.fromSuiParsedData(T, content); },
464
+ fromSuiObjectData: function (content) { return Token.fromSuiObjectData(T, content); },
465
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
466
+ return [2 /*return*/, Token.fetch(client, T, id)];
467
+ }); }); },
468
+ new: function (fields) {
469
+ return new Token([(0, reified_1.extractType)(T)], fields);
470
+ },
471
+ kind: "StructClassReified",
472
+ };
473
+ };
474
+ Object.defineProperty(Token, "r", {
475
+ get: function () {
476
+ return Token.reified;
477
+ },
478
+ enumerable: false,
479
+ configurable: true
480
+ });
481
+ Token.phantom = function (T) {
482
+ return (0, reified_1.phantom)(Token.reified(T));
483
+ };
484
+ Object.defineProperty(Token, "p", {
485
+ get: function () {
486
+ return Token.phantom;
487
+ },
488
+ enumerable: false,
489
+ configurable: true
490
+ });
491
+ Object.defineProperty(Token, "bcs", {
492
+ get: function () {
493
+ return bcs_1.bcs.struct("Token", {
494
+ id: structs_5.UID.bcs,
495
+ balance: structs_4.Balance.bcs,
496
+ });
497
+ },
498
+ enumerable: false,
499
+ configurable: true
500
+ });
501
+ Token.fromFields = function (typeArg, fields) {
502
+ return Token.reified(typeArg).new({
503
+ id: (0, reified_1.decodeFromFields)(structs_5.UID.reified(), fields.id),
504
+ balance: (0, reified_1.decodeFromFields)(structs_4.Balance.reified(typeArg), fields.balance),
505
+ });
506
+ };
507
+ Token.fromFieldsWithTypes = function (typeArg, item) {
508
+ if (!isToken(item.type)) {
509
+ throw new Error("not a Token type");
510
+ }
511
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
512
+ return Token.reified(typeArg).new({
513
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_5.UID.reified(), item.fields.id),
514
+ balance: (0, reified_1.decodeFromFieldsWithTypes)(structs_4.Balance.reified(typeArg), item.fields.balance),
515
+ });
516
+ };
517
+ Token.fromBcs = function (typeArg, data) {
518
+ return Token.fromFields(typeArg, Token.bcs.parse(data));
519
+ };
520
+ Token.prototype.toJSONField = function () {
521
+ return {
522
+ id: this.id,
523
+ balance: this.balance.toJSONField(),
524
+ };
525
+ };
526
+ Token.prototype.toJSON = function () {
527
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
528
+ };
529
+ Token.fromJSONField = function (typeArg, field) {
530
+ return Token.reified(typeArg).new({
531
+ id: (0, reified_1.decodeFromJSONField)(structs_5.UID.reified(), field.id),
532
+ balance: (0, reified_1.decodeFromJSONField)(structs_4.Balance.reified(typeArg), field.balance),
533
+ });
534
+ };
535
+ Token.fromJSON = function (typeArg, json) {
536
+ if (json.$typeName !== Token.$typeName) {
537
+ throw new Error("not a WithTwoGenerics json object");
538
+ }
539
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(Token.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
540
+ return Token.fromJSONField(typeArg, json);
541
+ };
542
+ Token.fromSuiParsedData = function (typeArg, content) {
543
+ if (content.dataType !== "moveObject") {
544
+ throw new Error("not an object");
545
+ }
546
+ if (!isToken(content.type)) {
547
+ throw new Error("object at ".concat(content.fields.id, " is not a Token object"));
548
+ }
549
+ return Token.fromFieldsWithTypes(typeArg, content);
550
+ };
551
+ Token.fromSuiObjectData = function (typeArg, data) {
552
+ if (data.bcs) {
553
+ if (data.bcs.dataType !== "moveObject" || !isToken(data.bcs.type)) {
554
+ throw new Error("object at is not a Token object");
555
+ }
556
+ var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
557
+ if (gotTypeArgs.length !== 1) {
558
+ throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
559
+ }
560
+ var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
561
+ var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
562
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
563
+ throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
564
+ }
565
+ return Token.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
566
+ }
567
+ if (data.content) {
568
+ return Token.fromSuiParsedData(typeArg, data.content);
569
+ }
570
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
571
+ };
572
+ Token.fetch = function (client, typeArg, id) {
573
+ return __awaiter(this, void 0, void 0, function () {
574
+ var res;
575
+ var _a, _b;
576
+ return __generator(this, function (_c) {
577
+ switch (_c.label) {
578
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
579
+ case 1:
580
+ res = _c.sent();
581
+ if (res.error) {
582
+ throw new Error("error fetching Token object at id ".concat(id, ": ").concat(res.error.code));
583
+ }
584
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isToken(res.data.bcs.type)) {
585
+ throw new Error("object at id ".concat(id, " is not a Token object"));
586
+ }
587
+ return [2 /*return*/, Token.fromSuiObjectData(typeArg, res.data)];
588
+ }
589
+ });
590
+ });
591
+ };
592
+ Token.$typeName = "".concat(index_1.PKG_V26, "::token::Token");
593
+ Token.$numTypeParams = 1;
594
+ Token.$isPhantom = [true];
595
+ return Token;
596
+ }());
597
+ exports.Token = Token;
598
+ /* ============================== TokenPolicy =============================== */
599
+ function isTokenPolicy(type) {
600
+ type = (0, util_1.compressSuiType)(type);
601
+ return type.startsWith("".concat(index_1.PKG_V26, "::token::TokenPolicy") + "<");
602
+ }
603
+ var TokenPolicy = /** @class */ (function () {
604
+ function TokenPolicy(typeArgs, fields) {
605
+ this.__StructClass = true;
606
+ this.$typeName = TokenPolicy.$typeName;
607
+ this.$isPhantom = TokenPolicy.$isPhantom;
608
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([TokenPolicy.$typeName], __read(typeArgs), false));
609
+ this.$typeArgs = typeArgs;
610
+ this.id = fields.id;
611
+ this.spentBalance = fields.spentBalance;
612
+ this.rules = fields.rules;
613
+ }
614
+ TokenPolicy.reified = function (T) {
615
+ var _this = this;
616
+ return {
617
+ typeName: TokenPolicy.$typeName,
618
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([TokenPolicy.$typeName], [(0, reified_1.extractType)(T)], false)),
619
+ typeArgs: [(0, reified_1.extractType)(T)],
620
+ isPhantom: TokenPolicy.$isPhantom,
621
+ reifiedTypeArgs: [T],
622
+ fromFields: function (fields) { return TokenPolicy.fromFields(T, fields); },
623
+ fromFieldsWithTypes: function (item) { return TokenPolicy.fromFieldsWithTypes(T, item); },
624
+ fromBcs: function (data) { return TokenPolicy.fromBcs(T, data); },
625
+ bcs: TokenPolicy.bcs,
626
+ fromJSONField: function (field) { return TokenPolicy.fromJSONField(T, field); },
627
+ fromJSON: function (json) { return TokenPolicy.fromJSON(T, json); },
628
+ fromSuiParsedData: function (content) { return TokenPolicy.fromSuiParsedData(T, content); },
629
+ fromSuiObjectData: function (content) { return TokenPolicy.fromSuiObjectData(T, content); },
630
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
631
+ return [2 /*return*/, TokenPolicy.fetch(client, T, id)];
632
+ }); }); },
633
+ new: function (fields) {
634
+ return new TokenPolicy([(0, reified_1.extractType)(T)], fields);
635
+ },
636
+ kind: "StructClassReified",
637
+ };
638
+ };
639
+ Object.defineProperty(TokenPolicy, "r", {
640
+ get: function () {
641
+ return TokenPolicy.reified;
642
+ },
643
+ enumerable: false,
644
+ configurable: true
645
+ });
646
+ TokenPolicy.phantom = function (T) {
647
+ return (0, reified_1.phantom)(TokenPolicy.reified(T));
648
+ };
649
+ Object.defineProperty(TokenPolicy, "p", {
650
+ get: function () {
651
+ return TokenPolicy.phantom;
652
+ },
653
+ enumerable: false,
654
+ configurable: true
655
+ });
656
+ Object.defineProperty(TokenPolicy, "bcs", {
657
+ get: function () {
658
+ return bcs_1.bcs.struct("TokenPolicy", {
659
+ id: structs_5.UID.bcs,
660
+ spent_balance: structs_4.Balance.bcs,
661
+ rules: structs_6.VecMap.bcs(structs_2.String.bcs, structs_7.VecSet.bcs(structs_3.TypeName.bcs)),
662
+ });
663
+ },
664
+ enumerable: false,
665
+ configurable: true
666
+ });
667
+ TokenPolicy.fromFields = function (typeArg, fields) {
668
+ return TokenPolicy.reified(typeArg).new({
669
+ id: (0, reified_1.decodeFromFields)(structs_5.UID.reified(), fields.id),
670
+ spentBalance: (0, reified_1.decodeFromFields)(structs_4.Balance.reified(typeArg), fields.spent_balance),
671
+ rules: (0, reified_1.decodeFromFields)(structs_6.VecMap.reified(structs_2.String.reified(), structs_7.VecSet.reified(structs_3.TypeName.reified())), fields.rules),
672
+ });
673
+ };
674
+ TokenPolicy.fromFieldsWithTypes = function (typeArg, item) {
675
+ if (!isTokenPolicy(item.type)) {
676
+ throw new Error("not a TokenPolicy type");
677
+ }
678
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
679
+ return TokenPolicy.reified(typeArg).new({
680
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_5.UID.reified(), item.fields.id),
681
+ spentBalance: (0, reified_1.decodeFromFieldsWithTypes)(structs_4.Balance.reified(typeArg), item.fields.spent_balance),
682
+ rules: (0, reified_1.decodeFromFieldsWithTypes)(structs_6.VecMap.reified(structs_2.String.reified(), structs_7.VecSet.reified(structs_3.TypeName.reified())), item.fields.rules),
683
+ });
684
+ };
685
+ TokenPolicy.fromBcs = function (typeArg, data) {
686
+ return TokenPolicy.fromFields(typeArg, TokenPolicy.bcs.parse(data));
687
+ };
688
+ TokenPolicy.prototype.toJSONField = function () {
689
+ return {
690
+ id: this.id,
691
+ spentBalance: this.spentBalance.toJSONField(),
692
+ rules: this.rules.toJSONField(),
693
+ };
694
+ };
695
+ TokenPolicy.prototype.toJSON = function () {
696
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
697
+ };
698
+ TokenPolicy.fromJSONField = function (typeArg, field) {
699
+ return TokenPolicy.reified(typeArg).new({
700
+ id: (0, reified_1.decodeFromJSONField)(structs_5.UID.reified(), field.id),
701
+ spentBalance: (0, reified_1.decodeFromJSONField)(structs_4.Balance.reified(typeArg), field.spentBalance),
702
+ rules: (0, reified_1.decodeFromJSONField)(structs_6.VecMap.reified(structs_2.String.reified(), structs_7.VecSet.reified(structs_3.TypeName.reified())), field.rules),
703
+ });
704
+ };
705
+ TokenPolicy.fromJSON = function (typeArg, json) {
706
+ if (json.$typeName !== TokenPolicy.$typeName) {
707
+ throw new Error("not a WithTwoGenerics json object");
708
+ }
709
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(TokenPolicy.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
710
+ return TokenPolicy.fromJSONField(typeArg, json);
711
+ };
712
+ TokenPolicy.fromSuiParsedData = function (typeArg, content) {
713
+ if (content.dataType !== "moveObject") {
714
+ throw new Error("not an object");
715
+ }
716
+ if (!isTokenPolicy(content.type)) {
717
+ throw new Error("object at ".concat(content.fields.id, " is not a TokenPolicy object"));
718
+ }
719
+ return TokenPolicy.fromFieldsWithTypes(typeArg, content);
720
+ };
721
+ TokenPolicy.fromSuiObjectData = function (typeArg, data) {
722
+ if (data.bcs) {
723
+ if (data.bcs.dataType !== "moveObject" || !isTokenPolicy(data.bcs.type)) {
724
+ throw new Error("object at is not a TokenPolicy object");
725
+ }
726
+ var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
727
+ if (gotTypeArgs.length !== 1) {
728
+ throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
729
+ }
730
+ var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
731
+ var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
732
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
733
+ throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
734
+ }
735
+ return TokenPolicy.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
736
+ }
737
+ if (data.content) {
738
+ return TokenPolicy.fromSuiParsedData(typeArg, data.content);
739
+ }
740
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
741
+ };
742
+ TokenPolicy.fetch = function (client, typeArg, id) {
743
+ return __awaiter(this, void 0, void 0, function () {
744
+ var res;
745
+ var _a, _b;
746
+ return __generator(this, function (_c) {
747
+ switch (_c.label) {
748
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
749
+ case 1:
750
+ res = _c.sent();
751
+ if (res.error) {
752
+ throw new Error("error fetching TokenPolicy object at id ".concat(id, ": ").concat(res.error.code));
753
+ }
754
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isTokenPolicy(res.data.bcs.type)) {
755
+ throw new Error("object at id ".concat(id, " is not a TokenPolicy object"));
756
+ }
757
+ return [2 /*return*/, TokenPolicy.fromSuiObjectData(typeArg, res.data)];
758
+ }
759
+ });
760
+ });
761
+ };
762
+ TokenPolicy.$typeName = "".concat(index_1.PKG_V26, "::token::TokenPolicy");
763
+ TokenPolicy.$numTypeParams = 1;
764
+ TokenPolicy.$isPhantom = [true];
765
+ return TokenPolicy;
766
+ }());
767
+ exports.TokenPolicy = TokenPolicy;
768
+ /* ============================== TokenPolicyCap =============================== */
769
+ function isTokenPolicyCap(type) {
770
+ type = (0, util_1.compressSuiType)(type);
771
+ return type.startsWith("".concat(index_1.PKG_V26, "::token::TokenPolicyCap") + "<");
772
+ }
773
+ var TokenPolicyCap = /** @class */ (function () {
774
+ function TokenPolicyCap(typeArgs, fields) {
775
+ this.__StructClass = true;
776
+ this.$typeName = TokenPolicyCap.$typeName;
777
+ this.$isPhantom = TokenPolicyCap.$isPhantom;
778
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([TokenPolicyCap.$typeName], __read(typeArgs), false));
779
+ this.$typeArgs = typeArgs;
780
+ this.id = fields.id;
781
+ this.for = fields.for;
782
+ }
783
+ TokenPolicyCap.reified = function (T) {
784
+ var _this = this;
785
+ return {
786
+ typeName: TokenPolicyCap.$typeName,
787
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([TokenPolicyCap.$typeName], [(0, reified_1.extractType)(T)], false)),
788
+ typeArgs: [(0, reified_1.extractType)(T)],
789
+ isPhantom: TokenPolicyCap.$isPhantom,
790
+ reifiedTypeArgs: [T],
791
+ fromFields: function (fields) { return TokenPolicyCap.fromFields(T, fields); },
792
+ fromFieldsWithTypes: function (item) { return TokenPolicyCap.fromFieldsWithTypes(T, item); },
793
+ fromBcs: function (data) { return TokenPolicyCap.fromBcs(T, data); },
794
+ bcs: TokenPolicyCap.bcs,
795
+ fromJSONField: function (field) { return TokenPolicyCap.fromJSONField(T, field); },
796
+ fromJSON: function (json) { return TokenPolicyCap.fromJSON(T, json); },
797
+ fromSuiParsedData: function (content) { return TokenPolicyCap.fromSuiParsedData(T, content); },
798
+ fromSuiObjectData: function (content) { return TokenPolicyCap.fromSuiObjectData(T, content); },
799
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
800
+ return [2 /*return*/, TokenPolicyCap.fetch(client, T, id)];
801
+ }); }); },
802
+ new: function (fields) {
803
+ return new TokenPolicyCap([(0, reified_1.extractType)(T)], fields);
804
+ },
805
+ kind: "StructClassReified",
806
+ };
807
+ };
808
+ Object.defineProperty(TokenPolicyCap, "r", {
809
+ get: function () {
810
+ return TokenPolicyCap.reified;
811
+ },
812
+ enumerable: false,
813
+ configurable: true
814
+ });
815
+ TokenPolicyCap.phantom = function (T) {
816
+ return (0, reified_1.phantom)(TokenPolicyCap.reified(T));
817
+ };
818
+ Object.defineProperty(TokenPolicyCap, "p", {
819
+ get: function () {
820
+ return TokenPolicyCap.phantom;
821
+ },
822
+ enumerable: false,
823
+ configurable: true
824
+ });
825
+ Object.defineProperty(TokenPolicyCap, "bcs", {
826
+ get: function () {
827
+ return bcs_1.bcs.struct("TokenPolicyCap", {
828
+ id: structs_5.UID.bcs,
829
+ for: structs_5.ID.bcs,
830
+ });
831
+ },
832
+ enumerable: false,
833
+ configurable: true
834
+ });
835
+ TokenPolicyCap.fromFields = function (typeArg, fields) {
836
+ return TokenPolicyCap.reified(typeArg).new({
837
+ id: (0, reified_1.decodeFromFields)(structs_5.UID.reified(), fields.id),
838
+ for: (0, reified_1.decodeFromFields)(structs_5.ID.reified(), fields.for),
839
+ });
840
+ };
841
+ TokenPolicyCap.fromFieldsWithTypes = function (typeArg, item) {
842
+ if (!isTokenPolicyCap(item.type)) {
843
+ throw new Error("not a TokenPolicyCap type");
844
+ }
845
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
846
+ return TokenPolicyCap.reified(typeArg).new({
847
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_5.UID.reified(), item.fields.id),
848
+ for: (0, reified_1.decodeFromFieldsWithTypes)(structs_5.ID.reified(), item.fields.for),
849
+ });
850
+ };
851
+ TokenPolicyCap.fromBcs = function (typeArg, data) {
852
+ return TokenPolicyCap.fromFields(typeArg, TokenPolicyCap.bcs.parse(data));
853
+ };
854
+ TokenPolicyCap.prototype.toJSONField = function () {
855
+ return {
856
+ id: this.id,
857
+ for: this.for,
858
+ };
859
+ };
860
+ TokenPolicyCap.prototype.toJSON = function () {
861
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
862
+ };
863
+ TokenPolicyCap.fromJSONField = function (typeArg, field) {
864
+ return TokenPolicyCap.reified(typeArg).new({
865
+ id: (0, reified_1.decodeFromJSONField)(structs_5.UID.reified(), field.id),
866
+ for: (0, reified_1.decodeFromJSONField)(structs_5.ID.reified(), field.for),
867
+ });
868
+ };
869
+ TokenPolicyCap.fromJSON = function (typeArg, json) {
870
+ if (json.$typeName !== TokenPolicyCap.$typeName) {
871
+ throw new Error("not a WithTwoGenerics json object");
872
+ }
873
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(TokenPolicyCap.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
874
+ return TokenPolicyCap.fromJSONField(typeArg, json);
875
+ };
876
+ TokenPolicyCap.fromSuiParsedData = function (typeArg, content) {
877
+ if (content.dataType !== "moveObject") {
878
+ throw new Error("not an object");
879
+ }
880
+ if (!isTokenPolicyCap(content.type)) {
881
+ throw new Error("object at ".concat(content.fields.id, " is not a TokenPolicyCap object"));
882
+ }
883
+ return TokenPolicyCap.fromFieldsWithTypes(typeArg, content);
884
+ };
885
+ TokenPolicyCap.fromSuiObjectData = function (typeArg, data) {
886
+ if (data.bcs) {
887
+ if (data.bcs.dataType !== "moveObject" || !isTokenPolicyCap(data.bcs.type)) {
888
+ throw new Error("object at is not a TokenPolicyCap object");
889
+ }
890
+ var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
891
+ if (gotTypeArgs.length !== 1) {
892
+ throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
893
+ }
894
+ var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
895
+ var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
896
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
897
+ throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
898
+ }
899
+ return TokenPolicyCap.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
900
+ }
901
+ if (data.content) {
902
+ return TokenPolicyCap.fromSuiParsedData(typeArg, data.content);
903
+ }
904
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
905
+ };
906
+ TokenPolicyCap.fetch = function (client, typeArg, id) {
907
+ return __awaiter(this, void 0, void 0, function () {
908
+ var res;
909
+ var _a, _b;
910
+ return __generator(this, function (_c) {
911
+ switch (_c.label) {
912
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
913
+ case 1:
914
+ res = _c.sent();
915
+ if (res.error) {
916
+ throw new Error("error fetching TokenPolicyCap object at id ".concat(id, ": ").concat(res.error.code));
917
+ }
918
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isTokenPolicyCap(res.data.bcs.type)) {
919
+ throw new Error("object at id ".concat(id, " is not a TokenPolicyCap object"));
920
+ }
921
+ return [2 /*return*/, TokenPolicyCap.fromSuiObjectData(typeArg, res.data)];
922
+ }
923
+ });
924
+ });
925
+ };
926
+ TokenPolicyCap.$typeName = "".concat(index_1.PKG_V26, "::token::TokenPolicyCap");
927
+ TokenPolicyCap.$numTypeParams = 1;
928
+ TokenPolicyCap.$isPhantom = [true];
929
+ return TokenPolicyCap;
930
+ }());
931
+ exports.TokenPolicyCap = TokenPolicyCap;
932
+ /* ============================== TokenPolicyCreated =============================== */
933
+ function isTokenPolicyCreated(type) {
934
+ type = (0, util_1.compressSuiType)(type);
935
+ return type.startsWith("".concat(index_1.PKG_V26, "::token::TokenPolicyCreated") + "<");
936
+ }
937
+ var TokenPolicyCreated = /** @class */ (function () {
938
+ function TokenPolicyCreated(typeArgs, fields) {
939
+ this.__StructClass = true;
940
+ this.$typeName = TokenPolicyCreated.$typeName;
941
+ this.$isPhantom = TokenPolicyCreated.$isPhantom;
942
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([TokenPolicyCreated.$typeName], __read(typeArgs), false));
943
+ this.$typeArgs = typeArgs;
944
+ this.id = fields.id;
945
+ this.isMutable = fields.isMutable;
946
+ }
947
+ TokenPolicyCreated.reified = function (T) {
948
+ var _this = this;
949
+ return {
950
+ typeName: TokenPolicyCreated.$typeName,
951
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([TokenPolicyCreated.$typeName], [(0, reified_1.extractType)(T)], false)),
952
+ typeArgs: [(0, reified_1.extractType)(T)],
953
+ isPhantom: TokenPolicyCreated.$isPhantom,
954
+ reifiedTypeArgs: [T],
955
+ fromFields: function (fields) { return TokenPolicyCreated.fromFields(T, fields); },
956
+ fromFieldsWithTypes: function (item) { return TokenPolicyCreated.fromFieldsWithTypes(T, item); },
957
+ fromBcs: function (data) { return TokenPolicyCreated.fromBcs(T, data); },
958
+ bcs: TokenPolicyCreated.bcs,
959
+ fromJSONField: function (field) { return TokenPolicyCreated.fromJSONField(T, field); },
960
+ fromJSON: function (json) { return TokenPolicyCreated.fromJSON(T, json); },
961
+ fromSuiParsedData: function (content) { return TokenPolicyCreated.fromSuiParsedData(T, content); },
962
+ fromSuiObjectData: function (content) { return TokenPolicyCreated.fromSuiObjectData(T, content); },
963
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
964
+ return [2 /*return*/, TokenPolicyCreated.fetch(client, T, id)];
965
+ }); }); },
966
+ new: function (fields) {
967
+ return new TokenPolicyCreated([(0, reified_1.extractType)(T)], fields);
968
+ },
969
+ kind: "StructClassReified",
970
+ };
971
+ };
972
+ Object.defineProperty(TokenPolicyCreated, "r", {
973
+ get: function () {
974
+ return TokenPolicyCreated.reified;
975
+ },
976
+ enumerable: false,
977
+ configurable: true
978
+ });
979
+ TokenPolicyCreated.phantom = function (T) {
980
+ return (0, reified_1.phantom)(TokenPolicyCreated.reified(T));
981
+ };
982
+ Object.defineProperty(TokenPolicyCreated, "p", {
983
+ get: function () {
984
+ return TokenPolicyCreated.phantom;
985
+ },
986
+ enumerable: false,
987
+ configurable: true
988
+ });
989
+ Object.defineProperty(TokenPolicyCreated, "bcs", {
990
+ get: function () {
991
+ return bcs_1.bcs.struct("TokenPolicyCreated", {
992
+ id: structs_5.ID.bcs,
993
+ is_mutable: bcs_1.bcs.bool(),
994
+ });
995
+ },
996
+ enumerable: false,
997
+ configurable: true
998
+ });
999
+ TokenPolicyCreated.fromFields = function (typeArg, fields) {
1000
+ return TokenPolicyCreated.reified(typeArg).new({
1001
+ id: (0, reified_1.decodeFromFields)(structs_5.ID.reified(), fields.id),
1002
+ isMutable: (0, reified_1.decodeFromFields)("bool", fields.is_mutable),
1003
+ });
1004
+ };
1005
+ TokenPolicyCreated.fromFieldsWithTypes = function (typeArg, item) {
1006
+ if (!isTokenPolicyCreated(item.type)) {
1007
+ throw new Error("not a TokenPolicyCreated type");
1008
+ }
1009
+ (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
1010
+ return TokenPolicyCreated.reified(typeArg).new({
1011
+ id: (0, reified_1.decodeFromFieldsWithTypes)(structs_5.ID.reified(), item.fields.id),
1012
+ isMutable: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.is_mutable),
1013
+ });
1014
+ };
1015
+ TokenPolicyCreated.fromBcs = function (typeArg, data) {
1016
+ return TokenPolicyCreated.fromFields(typeArg, TokenPolicyCreated.bcs.parse(data));
1017
+ };
1018
+ TokenPolicyCreated.prototype.toJSONField = function () {
1019
+ return {
1020
+ id: this.id,
1021
+ isMutable: this.isMutable,
1022
+ };
1023
+ };
1024
+ TokenPolicyCreated.prototype.toJSON = function () {
1025
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1026
+ };
1027
+ TokenPolicyCreated.fromJSONField = function (typeArg, field) {
1028
+ return TokenPolicyCreated.reified(typeArg).new({
1029
+ id: (0, reified_1.decodeFromJSONField)(structs_5.ID.reified(), field.id),
1030
+ isMutable: (0, reified_1.decodeFromJSONField)("bool", field.isMutable),
1031
+ });
1032
+ };
1033
+ TokenPolicyCreated.fromJSON = function (typeArg, json) {
1034
+ if (json.$typeName !== TokenPolicyCreated.$typeName) {
1035
+ throw new Error("not a WithTwoGenerics json object");
1036
+ }
1037
+ (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(TokenPolicyCreated.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
1038
+ return TokenPolicyCreated.fromJSONField(typeArg, json);
1039
+ };
1040
+ TokenPolicyCreated.fromSuiParsedData = function (typeArg, content) {
1041
+ if (content.dataType !== "moveObject") {
1042
+ throw new Error("not an object");
1043
+ }
1044
+ if (!isTokenPolicyCreated(content.type)) {
1045
+ throw new Error("object at ".concat(content.fields.id, " is not a TokenPolicyCreated object"));
1046
+ }
1047
+ return TokenPolicyCreated.fromFieldsWithTypes(typeArg, content);
1048
+ };
1049
+ TokenPolicyCreated.fromSuiObjectData = function (typeArg, data) {
1050
+ if (data.bcs) {
1051
+ if (data.bcs.dataType !== "moveObject" || !isTokenPolicyCreated(data.bcs.type)) {
1052
+ throw new Error("object at is not a TokenPolicyCreated object");
1053
+ }
1054
+ var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
1055
+ if (gotTypeArgs.length !== 1) {
1056
+ throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
1057
+ }
1058
+ var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
1059
+ var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
1060
+ if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
1061
+ throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
1062
+ }
1063
+ return TokenPolicyCreated.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
1064
+ }
1065
+ if (data.content) {
1066
+ return TokenPolicyCreated.fromSuiParsedData(typeArg, data.content);
1067
+ }
1068
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
1069
+ };
1070
+ TokenPolicyCreated.fetch = function (client, typeArg, id) {
1071
+ return __awaiter(this, void 0, void 0, function () {
1072
+ var res;
1073
+ var _a, _b;
1074
+ return __generator(this, function (_c) {
1075
+ switch (_c.label) {
1076
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
1077
+ case 1:
1078
+ res = _c.sent();
1079
+ if (res.error) {
1080
+ throw new Error("error fetching TokenPolicyCreated object at id ".concat(id, ": ").concat(res.error.code));
1081
+ }
1082
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isTokenPolicyCreated(res.data.bcs.type)) {
1083
+ throw new Error("object at id ".concat(id, " is not a TokenPolicyCreated object"));
1084
+ }
1085
+ return [2 /*return*/, TokenPolicyCreated.fromSuiObjectData(typeArg, res.data)];
1086
+ }
1087
+ });
1088
+ });
1089
+ };
1090
+ TokenPolicyCreated.$typeName = "".concat(index_1.PKG_V26, "::token::TokenPolicyCreated");
1091
+ TokenPolicyCreated.$numTypeParams = 1;
1092
+ TokenPolicyCreated.$isPhantom = [true];
1093
+ return TokenPolicyCreated;
1094
+ }());
1095
+ exports.TokenPolicyCreated = TokenPolicyCreated;