@typus/typus-perp-sdk 1.1.31-testnet → 1.1.32-codegen

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/api/sentio.js +604 -538
  2. package/dist/src/client.d.ts +27 -0
  3. package/dist/src/client.js +108 -0
  4. package/dist/src/fetch.d.ts +161 -34
  5. package/dist/src/fetch.js +365 -665
  6. package/dist/src/generated/typus_perp/admin.d.ts +117 -0
  7. package/dist/src/generated/typus_perp/admin.js +110 -0
  8. package/dist/src/generated/typus_perp/competition.d.ts +22 -0
  9. package/dist/src/generated/typus_perp/competition.js +58 -0
  10. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +17 -0
  11. package/dist/src/generated/typus_perp/deps/std/type_name.js +25 -0
  12. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +12 -0
  13. package/dist/src/generated/typus_perp/deps/sui/balance.js +20 -0
  14. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +8 -0
  15. package/dist/src/generated/typus_perp/deps/sui/object.js +16 -0
  16. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +19 -0
  17. package/dist/src/generated/typus_perp/deps/sui/object_table.js +59 -0
  18. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +18 -0
  19. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +25 -0
  20. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +30 -0
  21. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +67 -0
  22. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +32 -0
  23. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +71 -0
  24. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +23 -0
  25. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +61 -0
  26. package/dist/src/generated/typus_perp/escrow.d.ts +59 -0
  27. package/dist/src/generated/typus_perp/escrow.js +76 -0
  28. package/dist/src/generated/typus_perp/lending.d.ts +47 -0
  29. package/dist/src/generated/typus_perp/lending.js +50 -0
  30. package/dist/src/generated/typus_perp/lp_pool.d.ts +2327 -0
  31. package/dist/src/generated/typus_perp/lp_pool.js +1956 -0
  32. package/dist/src/generated/typus_perp/math.d.ts +95 -0
  33. package/dist/src/generated/typus_perp/math.js +97 -0
  34. package/dist/src/generated/typus_perp/position.d.ts +234 -0
  35. package/dist/src/generated/typus_perp/position.js +204 -0
  36. package/dist/src/generated/typus_perp/symbol.d.ts +18 -0
  37. package/dist/src/generated/typus_perp/symbol.js +55 -0
  38. package/dist/src/generated/typus_perp/tlp.d.ts +13 -0
  39. package/dist/src/generated/typus_perp/tlp.js +56 -0
  40. package/dist/src/generated/typus_perp/trading.d.ts +2486 -0
  41. package/dist/src/generated/typus_perp/trading.js +2476 -0
  42. package/dist/src/generated/typus_perp/treasury_caps.d.ts +13 -0
  43. package/dist/src/{_framework/init-loader.js → generated/typus_perp/treasury_caps.js} +17 -10
  44. package/dist/src/generated/typus_perp/user_account.d.ts +40 -0
  45. package/dist/src/generated/typus_perp/user_account.js +72 -0
  46. package/dist/src/generated/typus_stake_pool/admin.d.ts +100 -0
  47. package/dist/src/generated/typus_stake_pool/admin.js +91 -0
  48. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +17 -0
  49. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +25 -0
  50. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +8 -0
  51. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +16 -0
  52. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +30 -0
  53. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +37 -0
  54. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +18 -0
  55. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +25 -0
  56. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +1023 -0
  57. package/dist/src/generated/typus_stake_pool/stake_pool.js +918 -0
  58. package/dist/src/generated/utils/index.d.ts +12 -0
  59. package/dist/src/generated/utils/index.js +135 -0
  60. package/dist/src/grpc/graphql.d.ts +26 -0
  61. package/dist/src/grpc/graphql.js +126 -0
  62. package/dist/src/grpc/grpc.d.ts +1 -0
  63. package/dist/src/grpc/grpc.js +38 -0
  64. package/dist/src/grpc/ledgerService.js +64 -0
  65. package/dist/src/grpc/liveDataService.d.ts +0 -0
  66. package/dist/src/grpc/liveDataService.js +49 -0
  67. package/dist/src/index.d.ts +0 -4
  68. package/dist/src/index.js +20 -39
  69. package/dist/src/user/history.js +611 -680
  70. package/dist/src/user/order.d.ts +11 -11
  71. package/dist/src/user/order.js +171 -302
  72. package/dist/src/user/orderWithBidReceipt.d.ts +8 -6
  73. package/dist/src/user/orderWithBidReceipt.js +127 -226
  74. package/dist/src/user/tlp.d.ts +32 -23
  75. package/dist/src/user/tlp.js +316 -468
  76. package/package.json +44 -36
  77. package/dist/src/_dependencies/source/0x1/ascii/structs.d.ts +0 -88
  78. package/dist/src/_dependencies/source/0x1/ascii/structs.js +0 -398
  79. package/dist/src/_dependencies/source/0x1/index.d.ts +0 -3
  80. package/dist/src/_dependencies/source/0x1/index.js +0 -6
  81. package/dist/src/_dependencies/source/0x1/option/structs.d.ts +0 -50
  82. package/dist/src/_dependencies/source/0x1/option/structs.js +0 -271
  83. package/dist/src/_dependencies/source/0x1/string/structs.d.ts +0 -48
  84. package/dist/src/_dependencies/source/0x1/string/structs.js +0 -256
  85. package/dist/src/_dependencies/source/0x1/type-name/structs.d.ts +0 -49
  86. package/dist/src/_dependencies/source/0x1/type-name/structs.js +0 -223
  87. package/dist/src/_dependencies/source/0x2/bag/structs.d.ts +0 -54
  88. package/dist/src/_dependencies/source/0x2/bag/structs.js +0 -229
  89. package/dist/src/_dependencies/source/0x2/balance/structs.d.ts +0 -84
  90. package/dist/src/_dependencies/source/0x2/balance/structs.js +0 -386
  91. package/dist/src/_dependencies/source/0x2/coin/structs.d.ts +0 -406
  92. package/dist/src/_dependencies/source/0x2/coin/structs.js +0 -1247
  93. package/dist/src/_dependencies/source/0x2/index.d.ts +0 -3
  94. package/dist/src/_dependencies/source/0x2/index.js +0 -6
  95. package/dist/src/_dependencies/source/0x2/linked-table/structs.d.ts +0 -132
  96. package/dist/src/_dependencies/source/0x2/linked-table/structs.js +0 -438
  97. package/dist/src/_dependencies/source/0x2/object/structs.d.ts +0 -86
  98. package/dist/src/_dependencies/source/0x2/object/structs.js +0 -364
  99. package/dist/src/_dependencies/source/0x2/object-table/structs.d.ts +0 -54
  100. package/dist/src/_dependencies/source/0x2/object-table/structs.js +0 -248
  101. package/dist/src/_dependencies/source/0x2/sui/structs.d.ts +0 -44
  102. package/dist/src/_dependencies/source/0x2/sui/structs.js +0 -222
  103. package/dist/src/_dependencies/source/0x2/table/structs.d.ts +0 -54
  104. package/dist/src/_dependencies/source/0x2/table/structs.js +0 -248
  105. package/dist/src/_dependencies/source/0x2/table-vec/structs.d.ts +0 -59
  106. package/dist/src/_dependencies/source/0x2/table-vec/structs.js +0 -274
  107. package/dist/src/_dependencies/source/0x2/token/structs.d.ts +0 -421
  108. package/dist/src/_dependencies/source/0x2/token/structs.js +0 -1095
  109. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.d.ts +0 -348
  110. package/dist/src/_dependencies/source/0x2/transfer-policy/structs.js +0 -1091
  111. package/dist/src/_dependencies/source/0x2/url/structs.d.ts +0 -49
  112. package/dist/src/_dependencies/source/0x2/url/structs.js +0 -223
  113. package/dist/src/_dependencies/source/0x2/vec-map/structs.d.ts +0 -106
  114. package/dist/src/_dependencies/source/0x2/vec-map/structs.js +0 -446
  115. package/dist/src/_dependencies/source/0x2/vec-set/structs.d.ts +0 -49
  116. package/dist/src/_dependencies/source/0x2/vec-set/structs.js +0 -270
  117. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.d.ts +0 -422
  118. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/airdrop/structs.js +0 -1084
  119. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.d.ts +0 -130
  120. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/big-vector/structs.js +0 -456
  121. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.d.ts +0 -208
  122. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/critbit/structs.js +0 -653
  123. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.d.ts +0 -362
  124. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/ecosystem/structs.js +0 -899
  125. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.d.ts +0 -8
  126. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/index.js +0 -11
  127. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.d.ts +0 -2
  128. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/init.js +0 -102
  129. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.d.ts +0 -202
  130. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/keyed-big-vector/structs.js +0 -632
  131. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.d.ts +0 -600
  132. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/leaderboard/structs.js +0 -1459
  133. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.d.ts +0 -136
  134. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-object-table/structs.js +0 -438
  135. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.d.ts +0 -127
  136. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/linked-set/structs.js +0 -430
  137. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.d.ts +0 -957
  138. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tails-staking/structs.js +0 -2261
  139. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.d.ts +0 -244
  140. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/tgld/structs.js +0 -733
  141. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.d.ts +0 -294
  142. package/dist/src/_dependencies/source/0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a/user/structs.js +0 -892
  143. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.d.ts +0 -73
  144. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/authority/structs.js +0 -263
  145. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.d.ts +0 -294
  146. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/balance-pool/structs.js +0 -591
  147. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.d.ts +0 -64
  148. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/big-vector/structs.js +0 -258
  149. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.d.ts +0 -756
  150. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/dutch/structs.js +0 -1721
  151. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.d.ts +0 -44
  152. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/i64/structs.js +0 -222
  153. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.d.ts +0 -3
  154. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/index.js +0 -6
  155. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.d.ts +0 -2
  156. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/init.js +0 -89
  157. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.d.ts +0 -135
  158. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/linked-list/structs.js +0 -444
  159. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.d.ts +0 -2106
  160. package/dist/src/_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs.js +0 -4952
  161. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.d.ts +0 -390
  162. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/discount-mint/structs.js +0 -844
  163. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.d.ts +0 -6
  164. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/index.js +0 -9
  165. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.d.ts +0 -2
  166. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/init.js +0 -69
  167. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.d.ts +0 -89
  168. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/royalty-rule/structs.js +0 -376
  169. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.d.ts +0 -386
  170. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/staking/structs.js +0 -881
  171. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.d.ts +0 -59
  172. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/table-vec/structs.js +0 -274
  173. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.d.ts +0 -974
  174. package/dist/src/_dependencies/source/0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196/typus-nft/structs.js +0 -2387
  175. package/dist/src/_framework/init-loader.d.ts +0 -2
  176. package/dist/src/_framework/loader.d.ts +0 -17
  177. package/dist/src/_framework/loader.js +0 -108
  178. package/dist/src/_framework/reified.d.ts +0 -108
  179. package/dist/src/_framework/reified.js +0 -237
  180. package/dist/src/_framework/util.d.ts +0 -35
  181. package/dist/src/_framework/util.js +0 -396
  182. package/dist/src/_framework/vector.d.ts +0 -42
  183. package/dist/src/_framework/vector.js +0 -112
  184. package/dist/src/pyth.js +0 -1
  185. package/dist/src/typus_perp/admin/functions.d.ts +0 -59
  186. package/dist/src/typus_perp/admin/functions.js +0 -122
  187. package/dist/src/typus_perp/admin/structs.d.ts +0 -467
  188. package/dist/src/typus_perp/admin/structs.js +0 -1065
  189. package/dist/src/typus_perp/competition/functions.d.ts +0 -24
  190. package/dist/src/typus_perp/competition/functions.js +0 -38
  191. package/dist/src/typus_perp/competition/structs.d.ts +0 -80
  192. package/dist/src/typus_perp/competition/structs.js +0 -288
  193. package/dist/src/typus_perp/error/functions.d.ts +0 -73
  194. package/dist/src/typus_perp/error/functions.js +0 -363
  195. package/dist/src/typus_perp/escrow/functions.d.ts +0 -17
  196. package/dist/src/typus_perp/escrow/functions.js +0 -36
  197. package/dist/src/typus_perp/escrow/structs.d.ts +0 -160
  198. package/dist/src/typus_perp/escrow/structs.js +0 -324
  199. package/dist/src/typus_perp/index.d.ts +0 -1
  200. package/dist/src/typus_perp/index.js +0 -7
  201. package/dist/src/typus_perp/init.d.ts +0 -2
  202. package/dist/src/typus_perp/init.js +0 -118
  203. package/dist/src/typus_perp/lending/functions.d.ts +0 -15
  204. package/dist/src/typus_perp/lending/functions.js +0 -22
  205. package/dist/src/typus_perp/lp-pool/functions.d.ts +0 -460
  206. package/dist/src/typus_perp/lp-pool/functions.js +0 -732
  207. package/dist/src/typus_perp/lp-pool/structs.d.ts +0 -3705
  208. package/dist/src/typus_perp/lp-pool/structs.js +0 -6789
  209. package/dist/src/typus_perp/math/functions.d.ts +0 -29
  210. package/dist/src/typus_perp/math/functions.js +0 -61
  211. package/dist/src/typus_perp/position/functions.d.ts +0 -379
  212. package/dist/src/typus_perp/position/functions.js +0 -713
  213. package/dist/src/typus_perp/position/structs.d.ts +0 -905
  214. package/dist/src/typus_perp/position/structs.js +0 -1450
  215. package/dist/src/typus_perp/symbol/functions.d.ts +0 -9
  216. package/dist/src/typus_perp/symbol/functions.js +0 -24
  217. package/dist/src/typus_perp/symbol/structs.d.ts +0 -70
  218. package/dist/src/typus_perp/symbol/structs.js +0 -235
  219. package/dist/src/typus_perp/tlp/functions.d.ts +0 -19
  220. package/dist/src/typus_perp/tlp/functions.js +0 -40
  221. package/dist/src/typus_perp/tlp/structs.d.ts +0 -89
  222. package/dist/src/typus_perp/tlp/structs.js +0 -365
  223. package/dist/src/typus_perp/token-interface/functions.d.ts +0 -11
  224. package/dist/src/typus_perp/token-interface/functions.js +0 -22
  225. package/dist/src/typus_perp/trading/functions.d.ts +0 -812
  226. package/dist/src/typus_perp/trading/functions.js +0 -1218
  227. package/dist/src/typus_perp/trading/structs.d.ts +0 -3060
  228. package/dist/src/typus_perp/trading/structs.js +0 -5813
  229. package/dist/src/typus_perp/treasury-caps/functions.d.ts +0 -9
  230. package/dist/src/typus_perp/treasury-caps/functions.js +0 -36
  231. package/dist/src/typus_perp/treasury-caps/structs.d.ts +0 -49
  232. package/dist/src/typus_perp/treasury-caps/structs.js +0 -223
  233. package/dist/src/typus_perp/user-account/functions.d.ts +0 -36
  234. package/dist/src/typus_perp/user-account/functions.js +0 -70
  235. package/dist/src/typus_perp/user-account/structs.d.ts +0 -148
  236. package/dist/src/typus_perp/user-account/structs.js +0 -448
  237. package/dist/src/typus_stake_pool/admin/functions.d.ts +0 -49
  238. package/dist/src/typus_stake_pool/admin/functions.js +0 -105
  239. package/dist/src/typus_stake_pool/admin/structs.d.ts +0 -365
  240. package/dist/src/typus_stake_pool/admin/structs.js +0 -789
  241. package/dist/src/typus_stake_pool/index.d.ts +0 -1
  242. package/dist/src/typus_stake_pool/index.js +0 -7
  243. package/dist/src/typus_stake_pool/init.d.ts +0 -2
  244. package/dist/src/typus_stake_pool/init.js +0 -69
  245. package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +0 -229
  246. package/dist/src/typus_stake_pool/stake-pool/functions.js +0 -380
  247. package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +0 -2199
  248. package/dist/src/typus_stake_pool/stake-pool/structs.js +0 -4653
  249. /package/dist/src/{pyth.d.ts → grpc/ledgerService.d.ts} +0 -0
@@ -1,653 +0,0 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || (function () {
30
- var ownKeys = function(o) {
31
- ownKeys = Object.getOwnPropertyNames || function (o) {
32
- var ar = [];
33
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
- return ar;
35
- };
36
- return ownKeys(o);
37
- };
38
- return function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
45
- })();
46
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
47
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
48
- return new (P || (P = Promise))(function (resolve, reject) {
49
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
50
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
51
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
52
- step((generator = generator.apply(thisArg, _arguments || [])).next());
53
- });
54
- };
55
- var __generator = (this && this.__generator) || function (thisArg, body) {
56
- 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);
57
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
58
- function verb(n) { return function (v) { return step([n, v]); }; }
59
- function step(op) {
60
- if (f) throw new TypeError("Generator is already executing.");
61
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
62
- 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;
63
- if (y = 0, t) op = [op[0] & 2, t.value];
64
- switch (op[0]) {
65
- case 0: case 1: t = op; break;
66
- case 4: _.label++; return { value: op[1], done: false };
67
- case 5: _.label++; y = op[1]; op = [0]; continue;
68
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
69
- default:
70
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
71
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
72
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
73
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
74
- if (t[2]) _.ops.pop();
75
- _.trys.pop(); continue;
76
- }
77
- op = body.call(thisArg, _);
78
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
79
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
80
- }
81
- };
82
- var __read = (this && this.__read) || function (o, n) {
83
- var m = typeof Symbol === "function" && o[Symbol.iterator];
84
- if (!m) return o;
85
- var i = m.call(o), r, ar = [], e;
86
- try {
87
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
88
- }
89
- catch (error) { e = { error: error }; }
90
- finally {
91
- try {
92
- if (r && !r.done && (m = i["return"])) m.call(i);
93
- }
94
- finally { if (e) throw e.error; }
95
- }
96
- return ar;
97
- };
98
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
99
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
100
- if (ar || !(i in from)) {
101
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
102
- ar[i] = from[i];
103
- }
104
- }
105
- return to.concat(ar || Array.prototype.slice.call(from));
106
- };
107
- Object.defineProperty(exports, "__esModule", { value: true });
108
- exports.Leaf = exports.InternalNode = exports.CritbitTree = void 0;
109
- exports.isCritbitTree = isCritbitTree;
110
- exports.isInternalNode = isInternalNode;
111
- exports.isLeaf = isLeaf;
112
- var reified = __importStar(require("../../../../_framework/reified"));
113
- var reified_1 = require("../../../../_framework/reified");
114
- var util_1 = require("../../../../_framework/util");
115
- var structs_1 = require("../../0x2/table/structs");
116
- var index_1 = require("../index");
117
- var bcs_1 = require("@mysten/sui/bcs");
118
- var utils_1 = require("@mysten/sui/utils");
119
- /* ============================== CritbitTree =============================== */
120
- function isCritbitTree(type) {
121
- type = (0, util_1.compressSuiType)(type);
122
- return type.startsWith("".concat(index_1.PKG_V1, "::critbit::CritbitTree") + "<");
123
- }
124
- var CritbitTree = /** @class */ (function () {
125
- function CritbitTree(typeArgs, fields) {
126
- this.__StructClass = true;
127
- this.$typeName = CritbitTree.$typeName;
128
- this.$isPhantom = CritbitTree.$isPhantom;
129
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([CritbitTree.$typeName], __read(typeArgs), false));
130
- this.$typeArgs = typeArgs;
131
- this.root = fields.root;
132
- this.internalNodes = fields.internalNodes;
133
- this.leaves = fields.leaves;
134
- this.minLeafIndex = fields.minLeafIndex;
135
- this.maxLeafIndex = fields.maxLeafIndex;
136
- this.nextInternalNodeIndex = fields.nextInternalNodeIndex;
137
- this.nextLeafIndex = fields.nextLeafIndex;
138
- }
139
- CritbitTree.reified = function (V) {
140
- var _this = this;
141
- return {
142
- typeName: CritbitTree.$typeName,
143
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([CritbitTree.$typeName], [(0, reified_1.extractType)(V)], false)),
144
- typeArgs: [(0, reified_1.extractType)(V)],
145
- isPhantom: CritbitTree.$isPhantom,
146
- reifiedTypeArgs: [V],
147
- fromFields: function (fields) { return CritbitTree.fromFields(V, fields); },
148
- fromFieldsWithTypes: function (item) { return CritbitTree.fromFieldsWithTypes(V, item); },
149
- fromBcs: function (data) { return CritbitTree.fromBcs(V, data); },
150
- bcs: CritbitTree.bcs((0, reified_1.toBcs)(V)),
151
- fromJSONField: function (field) { return CritbitTree.fromJSONField(V, field); },
152
- fromJSON: function (json) { return CritbitTree.fromJSON(V, json); },
153
- fromSuiParsedData: function (content) { return CritbitTree.fromSuiParsedData(V, content); },
154
- fromSuiObjectData: function (content) { return CritbitTree.fromSuiObjectData(V, content); },
155
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
156
- return [2 /*return*/, CritbitTree.fetch(client, V, id)];
157
- }); }); },
158
- new: function (fields) {
159
- return new CritbitTree([(0, reified_1.extractType)(V)], fields);
160
- },
161
- kind: "StructClassReified",
162
- };
163
- };
164
- Object.defineProperty(CritbitTree, "r", {
165
- get: function () {
166
- return CritbitTree.reified;
167
- },
168
- enumerable: false,
169
- configurable: true
170
- });
171
- CritbitTree.phantom = function (V) {
172
- return (0, reified_1.phantom)(CritbitTree.reified(V));
173
- };
174
- Object.defineProperty(CritbitTree, "p", {
175
- get: function () {
176
- return CritbitTree.phantom;
177
- },
178
- enumerable: false,
179
- configurable: true
180
- });
181
- Object.defineProperty(CritbitTree, "bcs", {
182
- get: function () {
183
- return function (V) {
184
- return bcs_1.bcs.struct("CritbitTree<".concat(V.name, ">"), {
185
- root: bcs_1.bcs.u64(),
186
- internal_nodes: structs_1.Table.bcs,
187
- leaves: structs_1.Table.bcs,
188
- min_leaf_index: bcs_1.bcs.u64(),
189
- max_leaf_index: bcs_1.bcs.u64(),
190
- next_internal_node_index: bcs_1.bcs.u64(),
191
- next_leaf_index: bcs_1.bcs.u64(),
192
- });
193
- };
194
- },
195
- enumerable: false,
196
- configurable: true
197
- });
198
- CritbitTree.fromFields = function (typeArg, fields) {
199
- return CritbitTree.reified(typeArg).new({
200
- root: (0, reified_1.decodeFromFields)("u64", fields.root),
201
- internalNodes: (0, reified_1.decodeFromFields)(structs_1.Table.reified(reified.phantom("u64"), reified.phantom(InternalNode.reified())), fields.internal_nodes),
202
- leaves: (0, reified_1.decodeFromFields)(structs_1.Table.reified(reified.phantom("u64"), reified.phantom(Leaf.reified(typeArg))), fields.leaves),
203
- minLeafIndex: (0, reified_1.decodeFromFields)("u64", fields.min_leaf_index),
204
- maxLeafIndex: (0, reified_1.decodeFromFields)("u64", fields.max_leaf_index),
205
- nextInternalNodeIndex: (0, reified_1.decodeFromFields)("u64", fields.next_internal_node_index),
206
- nextLeafIndex: (0, reified_1.decodeFromFields)("u64", fields.next_leaf_index),
207
- });
208
- };
209
- CritbitTree.fromFieldsWithTypes = function (typeArg, item) {
210
- if (!isCritbitTree(item.type)) {
211
- throw new Error("not a CritbitTree type");
212
- }
213
- (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
214
- return CritbitTree.reified(typeArg).new({
215
- root: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.root),
216
- internalNodes: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Table.reified(reified.phantom("u64"), reified.phantom(InternalNode.reified())), item.fields.internal_nodes),
217
- leaves: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.Table.reified(reified.phantom("u64"), reified.phantom(Leaf.reified(typeArg))), item.fields.leaves),
218
- minLeafIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.min_leaf_index),
219
- maxLeafIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.max_leaf_index),
220
- nextInternalNodeIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.next_internal_node_index),
221
- nextLeafIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.next_leaf_index),
222
- });
223
- };
224
- CritbitTree.fromBcs = function (typeArg, data) {
225
- var typeArgs = [typeArg];
226
- return CritbitTree.fromFields(typeArg, CritbitTree.bcs((0, reified_1.toBcs)(typeArgs[0])).parse(data));
227
- };
228
- CritbitTree.prototype.toJSONField = function () {
229
- return {
230
- root: this.root.toString(),
231
- internalNodes: this.internalNodes.toJSONField(),
232
- leaves: this.leaves.toJSONField(),
233
- minLeafIndex: this.minLeafIndex.toString(),
234
- maxLeafIndex: this.maxLeafIndex.toString(),
235
- nextInternalNodeIndex: this.nextInternalNodeIndex.toString(),
236
- nextLeafIndex: this.nextLeafIndex.toString(),
237
- };
238
- };
239
- CritbitTree.prototype.toJSON = function () {
240
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
241
- };
242
- CritbitTree.fromJSONField = function (typeArg, field) {
243
- return CritbitTree.reified(typeArg).new({
244
- root: (0, reified_1.decodeFromJSONField)("u64", field.root),
245
- internalNodes: (0, reified_1.decodeFromJSONField)(structs_1.Table.reified(reified.phantom("u64"), reified.phantom(InternalNode.reified())), field.internalNodes),
246
- leaves: (0, reified_1.decodeFromJSONField)(structs_1.Table.reified(reified.phantom("u64"), reified.phantom(Leaf.reified(typeArg))), field.leaves),
247
- minLeafIndex: (0, reified_1.decodeFromJSONField)("u64", field.minLeafIndex),
248
- maxLeafIndex: (0, reified_1.decodeFromJSONField)("u64", field.maxLeafIndex),
249
- nextInternalNodeIndex: (0, reified_1.decodeFromJSONField)("u64", field.nextInternalNodeIndex),
250
- nextLeafIndex: (0, reified_1.decodeFromJSONField)("u64", field.nextLeafIndex),
251
- });
252
- };
253
- CritbitTree.fromJSON = function (typeArg, json) {
254
- if (json.$typeName !== CritbitTree.$typeName) {
255
- throw new Error("not a WithTwoGenerics json object");
256
- }
257
- (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(CritbitTree.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
258
- return CritbitTree.fromJSONField(typeArg, json);
259
- };
260
- CritbitTree.fromSuiParsedData = function (typeArg, content) {
261
- if (content.dataType !== "moveObject") {
262
- throw new Error("not an object");
263
- }
264
- if (!isCritbitTree(content.type)) {
265
- throw new Error("object at ".concat(content.fields.id, " is not a CritbitTree object"));
266
- }
267
- return CritbitTree.fromFieldsWithTypes(typeArg, content);
268
- };
269
- CritbitTree.fromSuiObjectData = function (typeArg, data) {
270
- if (data.bcs) {
271
- if (data.bcs.dataType !== "moveObject" || !isCritbitTree(data.bcs.type)) {
272
- throw new Error("object at is not a CritbitTree object");
273
- }
274
- var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
275
- if (gotTypeArgs.length !== 1) {
276
- throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
277
- }
278
- var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
279
- var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
280
- if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
281
- throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
282
- }
283
- return CritbitTree.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
284
- }
285
- if (data.content) {
286
- return CritbitTree.fromSuiParsedData(typeArg, data.content);
287
- }
288
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
289
- };
290
- CritbitTree.fetch = function (client, typeArg, id) {
291
- return __awaiter(this, void 0, void 0, function () {
292
- var res;
293
- var _a, _b;
294
- return __generator(this, function (_c) {
295
- switch (_c.label) {
296
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
297
- case 1:
298
- res = _c.sent();
299
- if (res.error) {
300
- throw new Error("error fetching CritbitTree object at id ".concat(id, ": ").concat(res.error.code));
301
- }
302
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isCritbitTree(res.data.bcs.type)) {
303
- throw new Error("object at id ".concat(id, " is not a CritbitTree object"));
304
- }
305
- return [2 /*return*/, CritbitTree.fromSuiObjectData(typeArg, res.data)];
306
- }
307
- });
308
- });
309
- };
310
- CritbitTree.$typeName = "".concat(index_1.PKG_V1, "::critbit::CritbitTree");
311
- CritbitTree.$numTypeParams = 1;
312
- CritbitTree.$isPhantom = [false];
313
- return CritbitTree;
314
- }());
315
- exports.CritbitTree = CritbitTree;
316
- /* ============================== InternalNode =============================== */
317
- function isInternalNode(type) {
318
- type = (0, util_1.compressSuiType)(type);
319
- return type === "".concat(index_1.PKG_V1, "::critbit::InternalNode");
320
- }
321
- var InternalNode = /** @class */ (function () {
322
- function InternalNode(typeArgs, fields) {
323
- this.__StructClass = true;
324
- this.$typeName = InternalNode.$typeName;
325
- this.$isPhantom = InternalNode.$isPhantom;
326
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([InternalNode.$typeName], __read(typeArgs), false));
327
- this.$typeArgs = typeArgs;
328
- this.mask = fields.mask;
329
- this.leftChild = fields.leftChild;
330
- this.rightChild = fields.rightChild;
331
- this.parent = fields.parent;
332
- }
333
- InternalNode.reified = function () {
334
- var _this = this;
335
- return {
336
- typeName: InternalNode.$typeName,
337
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([InternalNode.$typeName], [], false)),
338
- typeArgs: [],
339
- isPhantom: InternalNode.$isPhantom,
340
- reifiedTypeArgs: [],
341
- fromFields: function (fields) { return InternalNode.fromFields(fields); },
342
- fromFieldsWithTypes: function (item) { return InternalNode.fromFieldsWithTypes(item); },
343
- fromBcs: function (data) { return InternalNode.fromBcs(data); },
344
- bcs: InternalNode.bcs,
345
- fromJSONField: function (field) { return InternalNode.fromJSONField(field); },
346
- fromJSON: function (json) { return InternalNode.fromJSON(json); },
347
- fromSuiParsedData: function (content) { return InternalNode.fromSuiParsedData(content); },
348
- fromSuiObjectData: function (content) { return InternalNode.fromSuiObjectData(content); },
349
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
350
- return [2 /*return*/, InternalNode.fetch(client, id)];
351
- }); }); },
352
- new: function (fields) {
353
- return new InternalNode([], fields);
354
- },
355
- kind: "StructClassReified",
356
- };
357
- };
358
- Object.defineProperty(InternalNode, "r", {
359
- get: function () {
360
- return InternalNode.reified();
361
- },
362
- enumerable: false,
363
- configurable: true
364
- });
365
- InternalNode.phantom = function () {
366
- return (0, reified_1.phantom)(InternalNode.reified());
367
- };
368
- Object.defineProperty(InternalNode, "p", {
369
- get: function () {
370
- return InternalNode.phantom();
371
- },
372
- enumerable: false,
373
- configurable: true
374
- });
375
- Object.defineProperty(InternalNode, "bcs", {
376
- get: function () {
377
- return bcs_1.bcs.struct("InternalNode", {
378
- mask: bcs_1.bcs.u64(),
379
- left_child: bcs_1.bcs.u64(),
380
- right_child: bcs_1.bcs.u64(),
381
- parent: bcs_1.bcs.u64(),
382
- });
383
- },
384
- enumerable: false,
385
- configurable: true
386
- });
387
- InternalNode.fromFields = function (fields) {
388
- return InternalNode.reified().new({
389
- mask: (0, reified_1.decodeFromFields)("u64", fields.mask),
390
- leftChild: (0, reified_1.decodeFromFields)("u64", fields.left_child),
391
- rightChild: (0, reified_1.decodeFromFields)("u64", fields.right_child),
392
- parent: (0, reified_1.decodeFromFields)("u64", fields.parent),
393
- });
394
- };
395
- InternalNode.fromFieldsWithTypes = function (item) {
396
- if (!isInternalNode(item.type)) {
397
- throw new Error("not a InternalNode type");
398
- }
399
- return InternalNode.reified().new({
400
- mask: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.mask),
401
- leftChild: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.left_child),
402
- rightChild: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.right_child),
403
- parent: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.parent),
404
- });
405
- };
406
- InternalNode.fromBcs = function (data) {
407
- return InternalNode.fromFields(InternalNode.bcs.parse(data));
408
- };
409
- InternalNode.prototype.toJSONField = function () {
410
- return {
411
- mask: this.mask.toString(),
412
- leftChild: this.leftChild.toString(),
413
- rightChild: this.rightChild.toString(),
414
- parent: this.parent.toString(),
415
- };
416
- };
417
- InternalNode.prototype.toJSON = function () {
418
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
419
- };
420
- InternalNode.fromJSONField = function (field) {
421
- return InternalNode.reified().new({
422
- mask: (0, reified_1.decodeFromJSONField)("u64", field.mask),
423
- leftChild: (0, reified_1.decodeFromJSONField)("u64", field.leftChild),
424
- rightChild: (0, reified_1.decodeFromJSONField)("u64", field.rightChild),
425
- parent: (0, reified_1.decodeFromJSONField)("u64", field.parent),
426
- });
427
- };
428
- InternalNode.fromJSON = function (json) {
429
- if (json.$typeName !== InternalNode.$typeName) {
430
- throw new Error("not a WithTwoGenerics json object");
431
- }
432
- return InternalNode.fromJSONField(json);
433
- };
434
- InternalNode.fromSuiParsedData = function (content) {
435
- if (content.dataType !== "moveObject") {
436
- throw new Error("not an object");
437
- }
438
- if (!isInternalNode(content.type)) {
439
- throw new Error("object at ".concat(content.fields.id, " is not a InternalNode object"));
440
- }
441
- return InternalNode.fromFieldsWithTypes(content);
442
- };
443
- InternalNode.fromSuiObjectData = function (data) {
444
- if (data.bcs) {
445
- if (data.bcs.dataType !== "moveObject" || !isInternalNode(data.bcs.type)) {
446
- throw new Error("object at is not a InternalNode object");
447
- }
448
- return InternalNode.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
449
- }
450
- if (data.content) {
451
- return InternalNode.fromSuiParsedData(data.content);
452
- }
453
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
454
- };
455
- InternalNode.fetch = function (client, id) {
456
- return __awaiter(this, void 0, void 0, function () {
457
- var res;
458
- var _a, _b;
459
- return __generator(this, function (_c) {
460
- switch (_c.label) {
461
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
462
- case 1:
463
- res = _c.sent();
464
- if (res.error) {
465
- throw new Error("error fetching InternalNode object at id ".concat(id, ": ").concat(res.error.code));
466
- }
467
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isInternalNode(res.data.bcs.type)) {
468
- throw new Error("object at id ".concat(id, " is not a InternalNode object"));
469
- }
470
- return [2 /*return*/, InternalNode.fromSuiObjectData(res.data)];
471
- }
472
- });
473
- });
474
- };
475
- InternalNode.$typeName = "".concat(index_1.PKG_V1, "::critbit::InternalNode");
476
- InternalNode.$numTypeParams = 0;
477
- InternalNode.$isPhantom = [];
478
- return InternalNode;
479
- }());
480
- exports.InternalNode = InternalNode;
481
- /* ============================== Leaf =============================== */
482
- function isLeaf(type) {
483
- type = (0, util_1.compressSuiType)(type);
484
- return type.startsWith("".concat(index_1.PKG_V1, "::critbit::Leaf") + "<");
485
- }
486
- var Leaf = /** @class */ (function () {
487
- function Leaf(typeArgs, fields) {
488
- this.__StructClass = true;
489
- this.$typeName = Leaf.$typeName;
490
- this.$isPhantom = Leaf.$isPhantom;
491
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Leaf.$typeName], __read(typeArgs), false));
492
- this.$typeArgs = typeArgs;
493
- this.key = fields.key;
494
- this.value = fields.value;
495
- this.parent = fields.parent;
496
- }
497
- Leaf.reified = function (V) {
498
- var _this = this;
499
- return {
500
- typeName: Leaf.$typeName,
501
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Leaf.$typeName], [(0, reified_1.extractType)(V)], false)),
502
- typeArgs: [(0, reified_1.extractType)(V)],
503
- isPhantom: Leaf.$isPhantom,
504
- reifiedTypeArgs: [V],
505
- fromFields: function (fields) { return Leaf.fromFields(V, fields); },
506
- fromFieldsWithTypes: function (item) { return Leaf.fromFieldsWithTypes(V, item); },
507
- fromBcs: function (data) { return Leaf.fromBcs(V, data); },
508
- bcs: Leaf.bcs((0, reified_1.toBcs)(V)),
509
- fromJSONField: function (field) { return Leaf.fromJSONField(V, field); },
510
- fromJSON: function (json) { return Leaf.fromJSON(V, json); },
511
- fromSuiParsedData: function (content) { return Leaf.fromSuiParsedData(V, content); },
512
- fromSuiObjectData: function (content) { return Leaf.fromSuiObjectData(V, content); },
513
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
514
- return [2 /*return*/, Leaf.fetch(client, V, id)];
515
- }); }); },
516
- new: function (fields) {
517
- return new Leaf([(0, reified_1.extractType)(V)], fields);
518
- },
519
- kind: "StructClassReified",
520
- };
521
- };
522
- Object.defineProperty(Leaf, "r", {
523
- get: function () {
524
- return Leaf.reified;
525
- },
526
- enumerable: false,
527
- configurable: true
528
- });
529
- Leaf.phantom = function (V) {
530
- return (0, reified_1.phantom)(Leaf.reified(V));
531
- };
532
- Object.defineProperty(Leaf, "p", {
533
- get: function () {
534
- return Leaf.phantom;
535
- },
536
- enumerable: false,
537
- configurable: true
538
- });
539
- Object.defineProperty(Leaf, "bcs", {
540
- get: function () {
541
- return function (V) {
542
- return bcs_1.bcs.struct("Leaf<".concat(V.name, ">"), {
543
- key: bcs_1.bcs.u64(),
544
- value: V,
545
- parent: bcs_1.bcs.u64(),
546
- });
547
- };
548
- },
549
- enumerable: false,
550
- configurable: true
551
- });
552
- Leaf.fromFields = function (typeArg, fields) {
553
- return Leaf.reified(typeArg).new({
554
- key: (0, reified_1.decodeFromFields)("u64", fields.key),
555
- value: (0, reified_1.decodeFromFields)(typeArg, fields.value),
556
- parent: (0, reified_1.decodeFromFields)("u64", fields.parent),
557
- });
558
- };
559
- Leaf.fromFieldsWithTypes = function (typeArg, item) {
560
- if (!isLeaf(item.type)) {
561
- throw new Error("not a Leaf type");
562
- }
563
- (0, reified_1.assertFieldsWithTypesArgsMatch)(item, [typeArg]);
564
- return Leaf.reified(typeArg).new({
565
- key: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.key),
566
- value: (0, reified_1.decodeFromFieldsWithTypes)(typeArg, item.fields.value),
567
- parent: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.parent),
568
- });
569
- };
570
- Leaf.fromBcs = function (typeArg, data) {
571
- var typeArgs = [typeArg];
572
- return Leaf.fromFields(typeArg, Leaf.bcs((0, reified_1.toBcs)(typeArgs[0])).parse(data));
573
- };
574
- Leaf.prototype.toJSONField = function () {
575
- return {
576
- key: this.key.toString(),
577
- value: (0, reified_1.fieldToJSON)(this.$typeArgs[0], this.value),
578
- parent: this.parent.toString(),
579
- };
580
- };
581
- Leaf.prototype.toJSON = function () {
582
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
583
- };
584
- Leaf.fromJSONField = function (typeArg, field) {
585
- return Leaf.reified(typeArg).new({
586
- key: (0, reified_1.decodeFromJSONField)("u64", field.key),
587
- value: (0, reified_1.decodeFromJSONField)(typeArg, field.value),
588
- parent: (0, reified_1.decodeFromJSONField)("u64", field.parent),
589
- });
590
- };
591
- Leaf.fromJSON = function (typeArg, json) {
592
- if (json.$typeName !== Leaf.$typeName) {
593
- throw new Error("not a WithTwoGenerics json object");
594
- }
595
- (0, reified_1.assertReifiedTypeArgsMatch)((0, util_1.composeSuiType)(Leaf.$typeName, (0, reified_1.extractType)(typeArg)), json.$typeArgs, [typeArg]);
596
- return Leaf.fromJSONField(typeArg, json);
597
- };
598
- Leaf.fromSuiParsedData = function (typeArg, content) {
599
- if (content.dataType !== "moveObject") {
600
- throw new Error("not an object");
601
- }
602
- if (!isLeaf(content.type)) {
603
- throw new Error("object at ".concat(content.fields.id, " is not a Leaf object"));
604
- }
605
- return Leaf.fromFieldsWithTypes(typeArg, content);
606
- };
607
- Leaf.fromSuiObjectData = function (typeArg, data) {
608
- if (data.bcs) {
609
- if (data.bcs.dataType !== "moveObject" || !isLeaf(data.bcs.type)) {
610
- throw new Error("object at is not a Leaf object");
611
- }
612
- var gotTypeArgs = (0, util_1.parseTypeName)(data.bcs.type).typeArgs;
613
- if (gotTypeArgs.length !== 1) {
614
- throw new Error("type argument mismatch: expected 1 type argument but got '".concat(gotTypeArgs.length, "'"));
615
- }
616
- var gotTypeArg = (0, util_1.compressSuiType)(gotTypeArgs[0]);
617
- var expectedTypeArg = (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg));
618
- if (gotTypeArg !== (0, util_1.compressSuiType)((0, reified_1.extractType)(typeArg))) {
619
- throw new Error("type argument mismatch: expected '".concat(expectedTypeArg, "' but got '").concat(gotTypeArg, "'"));
620
- }
621
- return Leaf.fromBcs(typeArg, (0, utils_1.fromB64)(data.bcs.bcsBytes));
622
- }
623
- if (data.content) {
624
- return Leaf.fromSuiParsedData(typeArg, data.content);
625
- }
626
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
627
- };
628
- Leaf.fetch = function (client, typeArg, id) {
629
- return __awaiter(this, void 0, void 0, function () {
630
- var res;
631
- var _a, _b;
632
- return __generator(this, function (_c) {
633
- switch (_c.label) {
634
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
635
- case 1:
636
- res = _c.sent();
637
- if (res.error) {
638
- throw new Error("error fetching Leaf object at id ".concat(id, ": ").concat(res.error.code));
639
- }
640
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isLeaf(res.data.bcs.type)) {
641
- throw new Error("object at id ".concat(id, " is not a Leaf object"));
642
- }
643
- return [2 /*return*/, Leaf.fromSuiObjectData(typeArg, res.data)];
644
- }
645
- });
646
- });
647
- };
648
- Leaf.$typeName = "".concat(index_1.PKG_V1, "::critbit::Leaf");
649
- Leaf.$numTypeParams = 1;
650
- Leaf.$isPhantom = [false];
651
- return Leaf;
652
- }());
653
- exports.Leaf = Leaf;