@typus/typus-perp-sdk 1.1.30 → 1.1.31-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 +160 -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 +11 -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,4653 +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.HarvestPerUserShareEvent = exports.UnstakeEvent = exports.UnsubscribeEvent = exports.SnapshotEvent = exports.UpdatePoolInfoU64PaddingEvent = exports.StakeEvent = exports.WithdrawIncentiveEvent = exports.DepositIncentiveEvent = exports.UpdateIncentiveConfigEvent = exports.UpdateUnlockCountdownTsMsEvent = exports.RemoveIncentiveTokenEvent = exports.ActivateIncentiveTokenEvent = exports.DeactivateIncentiveTokenEvent = exports.AddIncentiveTokenEvent = exports.AutoCompoundEvent = exports.NewStakePoolEvent = exports.DeactivatingShares = exports.LpUserShare = exports.IncentiveInfo = exports.IncentiveConfig = exports.StakePoolConfig = exports.StakePoolInfo = exports.Incentive = exports.StakePool = exports.StakePoolRegistry = void 0;
109
- exports.isStakePoolRegistry = isStakePoolRegistry;
110
- exports.isStakePool = isStakePool;
111
- exports.isIncentive = isIncentive;
112
- exports.isStakePoolInfo = isStakePoolInfo;
113
- exports.isStakePoolConfig = isStakePoolConfig;
114
- exports.isIncentiveConfig = isIncentiveConfig;
115
- exports.isIncentiveInfo = isIncentiveInfo;
116
- exports.isLpUserShare = isLpUserShare;
117
- exports.isDeactivatingShares = isDeactivatingShares;
118
- exports.isNewStakePoolEvent = isNewStakePoolEvent;
119
- exports.isAutoCompoundEvent = isAutoCompoundEvent;
120
- exports.isAddIncentiveTokenEvent = isAddIncentiveTokenEvent;
121
- exports.isDeactivateIncentiveTokenEvent = isDeactivateIncentiveTokenEvent;
122
- exports.isActivateIncentiveTokenEvent = isActivateIncentiveTokenEvent;
123
- exports.isRemoveIncentiveTokenEvent = isRemoveIncentiveTokenEvent;
124
- exports.isUpdateUnlockCountdownTsMsEvent = isUpdateUnlockCountdownTsMsEvent;
125
- exports.isUpdateIncentiveConfigEvent = isUpdateIncentiveConfigEvent;
126
- exports.isDepositIncentiveEvent = isDepositIncentiveEvent;
127
- exports.isWithdrawIncentiveEvent = isWithdrawIncentiveEvent;
128
- exports.isStakeEvent = isStakeEvent;
129
- exports.isUpdatePoolInfoU64PaddingEvent = isUpdatePoolInfoU64PaddingEvent;
130
- exports.isSnapshotEvent = isSnapshotEvent;
131
- exports.isUnsubscribeEvent = isUnsubscribeEvent;
132
- exports.isUnstakeEvent = isUnstakeEvent;
133
- exports.isHarvestPerUserShareEvent = isHarvestPerUserShareEvent;
134
- var reified = __importStar(require("../../_framework/reified"));
135
- var structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
136
- var structs_2 = require("../../_dependencies/source/0x2/object/structs");
137
- var structs_3 = require("../../_dependencies/source/0x2/vec-map/structs");
138
- var reified_1 = require("../../_framework/reified");
139
- var util_1 = require("../../_framework/util");
140
- var index_1 = require("../index");
141
- var bcs_1 = require("@mysten/sui/bcs");
142
- var utils_1 = require("@mysten/sui/utils");
143
- /* ============================== StakePoolRegistry =============================== */
144
- function isStakePoolRegistry(type) {
145
- type = (0, util_1.compressSuiType)(type);
146
- return type === "".concat(index_1.PKG_V1, "::stake_pool::StakePoolRegistry");
147
- }
148
- var StakePoolRegistry = /** @class */ (function () {
149
- function StakePoolRegistry(typeArgs, fields) {
150
- this.__StructClass = true;
151
- this.$typeName = StakePoolRegistry.$typeName;
152
- this.$isPhantom = StakePoolRegistry.$isPhantom;
153
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([StakePoolRegistry.$typeName], __read(typeArgs), false));
154
- this.$typeArgs = typeArgs;
155
- this.id = fields.id;
156
- this.numPool = fields.numPool;
157
- }
158
- StakePoolRegistry.reified = function () {
159
- var _this = this;
160
- var reifiedBcs = StakePoolRegistry.bcs;
161
- return {
162
- typeName: StakePoolRegistry.$typeName,
163
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([StakePoolRegistry.$typeName], [], false)),
164
- typeArgs: [],
165
- isPhantom: StakePoolRegistry.$isPhantom,
166
- reifiedTypeArgs: [],
167
- fromFields: function (fields) { return StakePoolRegistry.fromFields(fields); },
168
- fromFieldsWithTypes: function (item) { return StakePoolRegistry.fromFieldsWithTypes(item); },
169
- fromBcs: function (data) { return StakePoolRegistry.fromFields(reifiedBcs.parse(data)); },
170
- bcs: reifiedBcs,
171
- fromJSONField: function (field) { return StakePoolRegistry.fromJSONField(field); },
172
- fromJSON: function (json) { return StakePoolRegistry.fromJSON(json); },
173
- fromSuiParsedData: function (content) { return StakePoolRegistry.fromSuiParsedData(content); },
174
- fromSuiObjectData: function (content) { return StakePoolRegistry.fromSuiObjectData(content); },
175
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
176
- return [2 /*return*/, StakePoolRegistry.fetch(client, id)];
177
- }); }); },
178
- new: function (fields) {
179
- return new StakePoolRegistry([], fields);
180
- },
181
- kind: "StructClassReified",
182
- };
183
- };
184
- Object.defineProperty(StakePoolRegistry, "r", {
185
- get: function () {
186
- return StakePoolRegistry.reified();
187
- },
188
- enumerable: false,
189
- configurable: true
190
- });
191
- StakePoolRegistry.phantom = function () {
192
- return (0, reified_1.phantom)(StakePoolRegistry.reified());
193
- };
194
- Object.defineProperty(StakePoolRegistry, "p", {
195
- get: function () {
196
- return StakePoolRegistry.phantom();
197
- },
198
- enumerable: false,
199
- configurable: true
200
- });
201
- StakePoolRegistry.instantiateBcs = function () {
202
- return bcs_1.bcs.struct("StakePoolRegistry", {
203
- id: structs_2.UID.bcs,
204
- num_pool: bcs_1.bcs.u64(),
205
- });
206
- };
207
- Object.defineProperty(StakePoolRegistry, "bcs", {
208
- get: function () {
209
- if (!StakePoolRegistry.cachedBcs) {
210
- StakePoolRegistry.cachedBcs = StakePoolRegistry.instantiateBcs();
211
- }
212
- return StakePoolRegistry.cachedBcs;
213
- },
214
- enumerable: false,
215
- configurable: true
216
- });
217
- StakePoolRegistry.fromFields = function (fields) {
218
- return StakePoolRegistry.reified().new({
219
- id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
220
- numPool: (0, reified_1.decodeFromFields)("u64", fields.num_pool),
221
- });
222
- };
223
- StakePoolRegistry.fromFieldsWithTypes = function (item) {
224
- if (!isStakePoolRegistry(item.type)) {
225
- throw new Error("not a StakePoolRegistry type");
226
- }
227
- return StakePoolRegistry.reified().new({
228
- id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
229
- numPool: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.num_pool),
230
- });
231
- };
232
- StakePoolRegistry.fromBcs = function (data) {
233
- return StakePoolRegistry.fromFields(StakePoolRegistry.bcs.parse(data));
234
- };
235
- StakePoolRegistry.prototype.toJSONField = function () {
236
- return {
237
- id: this.id,
238
- numPool: this.numPool.toString(),
239
- };
240
- };
241
- StakePoolRegistry.prototype.toJSON = function () {
242
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
243
- };
244
- StakePoolRegistry.fromJSONField = function (field) {
245
- return StakePoolRegistry.reified().new({
246
- id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
247
- numPool: (0, reified_1.decodeFromJSONField)("u64", field.numPool),
248
- });
249
- };
250
- StakePoolRegistry.fromJSON = function (json) {
251
- if (json.$typeName !== StakePoolRegistry.$typeName) {
252
- throw new Error("not a WithTwoGenerics json object");
253
- }
254
- return StakePoolRegistry.fromJSONField(json);
255
- };
256
- StakePoolRegistry.fromSuiParsedData = function (content) {
257
- if (content.dataType !== "moveObject") {
258
- throw new Error("not an object");
259
- }
260
- if (!isStakePoolRegistry(content.type)) {
261
- throw new Error("object at ".concat(content.fields.id, " is not a StakePoolRegistry object"));
262
- }
263
- return StakePoolRegistry.fromFieldsWithTypes(content);
264
- };
265
- StakePoolRegistry.fromSuiObjectData = function (data) {
266
- if (data.bcs) {
267
- if (data.bcs.dataType !== "moveObject" || !isStakePoolRegistry(data.bcs.type)) {
268
- throw new Error("object at is not a StakePoolRegistry object");
269
- }
270
- return StakePoolRegistry.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
271
- }
272
- if (data.content) {
273
- return StakePoolRegistry.fromSuiParsedData(data.content);
274
- }
275
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
276
- };
277
- StakePoolRegistry.fetch = function (client, id) {
278
- return __awaiter(this, void 0, void 0, function () {
279
- var res;
280
- var _a, _b;
281
- return __generator(this, function (_c) {
282
- switch (_c.label) {
283
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
284
- case 1:
285
- res = _c.sent();
286
- if (res.error) {
287
- throw new Error("error fetching StakePoolRegistry object at id ".concat(id, ": ").concat(res.error.code));
288
- }
289
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isStakePoolRegistry(res.data.bcs.type)) {
290
- throw new Error("object at id ".concat(id, " is not a StakePoolRegistry object"));
291
- }
292
- return [2 /*return*/, StakePoolRegistry.fromSuiObjectData(res.data)];
293
- }
294
- });
295
- });
296
- };
297
- StakePoolRegistry.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::StakePoolRegistry");
298
- StakePoolRegistry.$numTypeParams = 0;
299
- StakePoolRegistry.$isPhantom = [];
300
- StakePoolRegistry.cachedBcs = null;
301
- return StakePoolRegistry;
302
- }());
303
- exports.StakePoolRegistry = StakePoolRegistry;
304
- /* ============================== StakePool =============================== */
305
- function isStakePool(type) {
306
- type = (0, util_1.compressSuiType)(type);
307
- return type === "".concat(index_1.PKG_V1, "::stake_pool::StakePool");
308
- }
309
- var StakePool = /** @class */ (function () {
310
- function StakePool(typeArgs, fields) {
311
- this.__StructClass = true;
312
- this.$typeName = StakePool.$typeName;
313
- this.$isPhantom = StakePool.$isPhantom;
314
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([StakePool.$typeName], __read(typeArgs), false));
315
- this.$typeArgs = typeArgs;
316
- this.id = fields.id;
317
- this.poolInfo = fields.poolInfo;
318
- this.config = fields.config;
319
- this.incentives = fields.incentives;
320
- this.u64Padding = fields.u64Padding;
321
- }
322
- StakePool.reified = function () {
323
- var _this = this;
324
- var reifiedBcs = StakePool.bcs;
325
- return {
326
- typeName: StakePool.$typeName,
327
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([StakePool.$typeName], [], false)),
328
- typeArgs: [],
329
- isPhantom: StakePool.$isPhantom,
330
- reifiedTypeArgs: [],
331
- fromFields: function (fields) { return StakePool.fromFields(fields); },
332
- fromFieldsWithTypes: function (item) { return StakePool.fromFieldsWithTypes(item); },
333
- fromBcs: function (data) { return StakePool.fromFields(reifiedBcs.parse(data)); },
334
- bcs: reifiedBcs,
335
- fromJSONField: function (field) { return StakePool.fromJSONField(field); },
336
- fromJSON: function (json) { return StakePool.fromJSON(json); },
337
- fromSuiParsedData: function (content) { return StakePool.fromSuiParsedData(content); },
338
- fromSuiObjectData: function (content) { return StakePool.fromSuiObjectData(content); },
339
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
340
- return [2 /*return*/, StakePool.fetch(client, id)];
341
- }); }); },
342
- new: function (fields) {
343
- return new StakePool([], fields);
344
- },
345
- kind: "StructClassReified",
346
- };
347
- };
348
- Object.defineProperty(StakePool, "r", {
349
- get: function () {
350
- return StakePool.reified();
351
- },
352
- enumerable: false,
353
- configurable: true
354
- });
355
- StakePool.phantom = function () {
356
- return (0, reified_1.phantom)(StakePool.reified());
357
- };
358
- Object.defineProperty(StakePool, "p", {
359
- get: function () {
360
- return StakePool.phantom();
361
- },
362
- enumerable: false,
363
- configurable: true
364
- });
365
- StakePool.instantiateBcs = function () {
366
- return bcs_1.bcs.struct("StakePool", {
367
- id: structs_2.UID.bcs,
368
- pool_info: StakePoolInfo.bcs,
369
- config: StakePoolConfig.bcs,
370
- incentives: bcs_1.bcs.vector(Incentive.bcs),
371
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
372
- });
373
- };
374
- Object.defineProperty(StakePool, "bcs", {
375
- get: function () {
376
- if (!StakePool.cachedBcs) {
377
- StakePool.cachedBcs = StakePool.instantiateBcs();
378
- }
379
- return StakePool.cachedBcs;
380
- },
381
- enumerable: false,
382
- configurable: true
383
- });
384
- StakePool.fromFields = function (fields) {
385
- return StakePool.reified().new({
386
- id: (0, reified_1.decodeFromFields)(structs_2.UID.reified(), fields.id),
387
- poolInfo: (0, reified_1.decodeFromFields)(StakePoolInfo.reified(), fields.pool_info),
388
- config: (0, reified_1.decodeFromFields)(StakePoolConfig.reified(), fields.config),
389
- incentives: (0, reified_1.decodeFromFields)(reified.vector(Incentive.reified()), fields.incentives),
390
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
391
- });
392
- };
393
- StakePool.fromFieldsWithTypes = function (item) {
394
- if (!isStakePool(item.type)) {
395
- throw new Error("not a StakePool type");
396
- }
397
- return StakePool.reified().new({
398
- id: (0, reified_1.decodeFromFieldsWithTypes)(structs_2.UID.reified(), item.fields.id),
399
- poolInfo: (0, reified_1.decodeFromFieldsWithTypes)(StakePoolInfo.reified(), item.fields.pool_info),
400
- config: (0, reified_1.decodeFromFieldsWithTypes)(StakePoolConfig.reified(), item.fields.config),
401
- incentives: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector(Incentive.reified()), item.fields.incentives),
402
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
403
- });
404
- };
405
- StakePool.fromBcs = function (data) {
406
- return StakePool.fromFields(StakePool.bcs.parse(data));
407
- };
408
- StakePool.prototype.toJSONField = function () {
409
- return {
410
- id: this.id,
411
- poolInfo: this.poolInfo.toJSONField(),
412
- config: this.config.toJSONField(),
413
- incentives: (0, reified_1.fieldToJSON)("vector<".concat(Incentive.$typeName, ">"), this.incentives),
414
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
415
- };
416
- };
417
- StakePool.prototype.toJSON = function () {
418
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
419
- };
420
- StakePool.fromJSONField = function (field) {
421
- return StakePool.reified().new({
422
- id: (0, reified_1.decodeFromJSONField)(structs_2.UID.reified(), field.id),
423
- poolInfo: (0, reified_1.decodeFromJSONField)(StakePoolInfo.reified(), field.poolInfo),
424
- config: (0, reified_1.decodeFromJSONField)(StakePoolConfig.reified(), field.config),
425
- incentives: (0, reified_1.decodeFromJSONField)(reified.vector(Incentive.reified()), field.incentives),
426
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
427
- });
428
- };
429
- StakePool.fromJSON = function (json) {
430
- if (json.$typeName !== StakePool.$typeName) {
431
- throw new Error("not a WithTwoGenerics json object");
432
- }
433
- return StakePool.fromJSONField(json);
434
- };
435
- StakePool.fromSuiParsedData = function (content) {
436
- if (content.dataType !== "moveObject") {
437
- throw new Error("not an object");
438
- }
439
- if (!isStakePool(content.type)) {
440
- throw new Error("object at ".concat(content.fields.id, " is not a StakePool object"));
441
- }
442
- return StakePool.fromFieldsWithTypes(content);
443
- };
444
- StakePool.fromSuiObjectData = function (data) {
445
- if (data.bcs) {
446
- if (data.bcs.dataType !== "moveObject" || !isStakePool(data.bcs.type)) {
447
- throw new Error("object at is not a StakePool object");
448
- }
449
- return StakePool.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
450
- }
451
- if (data.content) {
452
- return StakePool.fromSuiParsedData(data.content);
453
- }
454
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
455
- };
456
- StakePool.fetch = function (client, id) {
457
- return __awaiter(this, void 0, void 0, function () {
458
- var res;
459
- var _a, _b;
460
- return __generator(this, function (_c) {
461
- switch (_c.label) {
462
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
463
- case 1:
464
- res = _c.sent();
465
- if (res.error) {
466
- throw new Error("error fetching StakePool object at id ".concat(id, ": ").concat(res.error.code));
467
- }
468
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isStakePool(res.data.bcs.type)) {
469
- throw new Error("object at id ".concat(id, " is not a StakePool object"));
470
- }
471
- return [2 /*return*/, StakePool.fromSuiObjectData(res.data)];
472
- }
473
- });
474
- });
475
- };
476
- StakePool.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::StakePool");
477
- StakePool.$numTypeParams = 0;
478
- StakePool.$isPhantom = [];
479
- StakePool.cachedBcs = null;
480
- return StakePool;
481
- }());
482
- exports.StakePool = StakePool;
483
- /* ============================== Incentive =============================== */
484
- function isIncentive(type) {
485
- type = (0, util_1.compressSuiType)(type);
486
- return type === "".concat(index_1.PKG_V1, "::stake_pool::Incentive");
487
- }
488
- var Incentive = /** @class */ (function () {
489
- function Incentive(typeArgs, fields) {
490
- this.__StructClass = true;
491
- this.$typeName = Incentive.$typeName;
492
- this.$isPhantom = Incentive.$isPhantom;
493
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([Incentive.$typeName], __read(typeArgs), false));
494
- this.$typeArgs = typeArgs;
495
- this.tokenType = fields.tokenType;
496
- this.config = fields.config;
497
- this.info = fields.info;
498
- }
499
- Incentive.reified = function () {
500
- var _this = this;
501
- var reifiedBcs = Incentive.bcs;
502
- return {
503
- typeName: Incentive.$typeName,
504
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([Incentive.$typeName], [], false)),
505
- typeArgs: [],
506
- isPhantom: Incentive.$isPhantom,
507
- reifiedTypeArgs: [],
508
- fromFields: function (fields) { return Incentive.fromFields(fields); },
509
- fromFieldsWithTypes: function (item) { return Incentive.fromFieldsWithTypes(item); },
510
- fromBcs: function (data) { return Incentive.fromFields(reifiedBcs.parse(data)); },
511
- bcs: reifiedBcs,
512
- fromJSONField: function (field) { return Incentive.fromJSONField(field); },
513
- fromJSON: function (json) { return Incentive.fromJSON(json); },
514
- fromSuiParsedData: function (content) { return Incentive.fromSuiParsedData(content); },
515
- fromSuiObjectData: function (content) { return Incentive.fromSuiObjectData(content); },
516
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
517
- return [2 /*return*/, Incentive.fetch(client, id)];
518
- }); }); },
519
- new: function (fields) {
520
- return new Incentive([], fields);
521
- },
522
- kind: "StructClassReified",
523
- };
524
- };
525
- Object.defineProperty(Incentive, "r", {
526
- get: function () {
527
- return Incentive.reified();
528
- },
529
- enumerable: false,
530
- configurable: true
531
- });
532
- Incentive.phantom = function () {
533
- return (0, reified_1.phantom)(Incentive.reified());
534
- };
535
- Object.defineProperty(Incentive, "p", {
536
- get: function () {
537
- return Incentive.phantom();
538
- },
539
- enumerable: false,
540
- configurable: true
541
- });
542
- Incentive.instantiateBcs = function () {
543
- return bcs_1.bcs.struct("Incentive", {
544
- token_type: structs_1.TypeName.bcs,
545
- config: IncentiveConfig.bcs,
546
- info: IncentiveInfo.bcs,
547
- });
548
- };
549
- Object.defineProperty(Incentive, "bcs", {
550
- get: function () {
551
- if (!Incentive.cachedBcs) {
552
- Incentive.cachedBcs = Incentive.instantiateBcs();
553
- }
554
- return Incentive.cachedBcs;
555
- },
556
- enumerable: false,
557
- configurable: true
558
- });
559
- Incentive.fromFields = function (fields) {
560
- return Incentive.reified().new({
561
- tokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token_type),
562
- config: (0, reified_1.decodeFromFields)(IncentiveConfig.reified(), fields.config),
563
- info: (0, reified_1.decodeFromFields)(IncentiveInfo.reified(), fields.info),
564
- });
565
- };
566
- Incentive.fromFieldsWithTypes = function (item) {
567
- if (!isIncentive(item.type)) {
568
- throw new Error("not a Incentive type");
569
- }
570
- return Incentive.reified().new({
571
- tokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token_type),
572
- config: (0, reified_1.decodeFromFieldsWithTypes)(IncentiveConfig.reified(), item.fields.config),
573
- info: (0, reified_1.decodeFromFieldsWithTypes)(IncentiveInfo.reified(), item.fields.info),
574
- });
575
- };
576
- Incentive.fromBcs = function (data) {
577
- return Incentive.fromFields(Incentive.bcs.parse(data));
578
- };
579
- Incentive.prototype.toJSONField = function () {
580
- return {
581
- tokenType: this.tokenType.toJSONField(),
582
- config: this.config.toJSONField(),
583
- info: this.info.toJSONField(),
584
- };
585
- };
586
- Incentive.prototype.toJSON = function () {
587
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
588
- };
589
- Incentive.fromJSONField = function (field) {
590
- return Incentive.reified().new({
591
- tokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.tokenType),
592
- config: (0, reified_1.decodeFromJSONField)(IncentiveConfig.reified(), field.config),
593
- info: (0, reified_1.decodeFromJSONField)(IncentiveInfo.reified(), field.info),
594
- });
595
- };
596
- Incentive.fromJSON = function (json) {
597
- if (json.$typeName !== Incentive.$typeName) {
598
- throw new Error("not a WithTwoGenerics json object");
599
- }
600
- return Incentive.fromJSONField(json);
601
- };
602
- Incentive.fromSuiParsedData = function (content) {
603
- if (content.dataType !== "moveObject") {
604
- throw new Error("not an object");
605
- }
606
- if (!isIncentive(content.type)) {
607
- throw new Error("object at ".concat(content.fields.id, " is not a Incentive object"));
608
- }
609
- return Incentive.fromFieldsWithTypes(content);
610
- };
611
- Incentive.fromSuiObjectData = function (data) {
612
- if (data.bcs) {
613
- if (data.bcs.dataType !== "moveObject" || !isIncentive(data.bcs.type)) {
614
- throw new Error("object at is not a Incentive object");
615
- }
616
- return Incentive.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
617
- }
618
- if (data.content) {
619
- return Incentive.fromSuiParsedData(data.content);
620
- }
621
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
622
- };
623
- Incentive.fetch = function (client, id) {
624
- return __awaiter(this, void 0, void 0, function () {
625
- var res;
626
- var _a, _b;
627
- return __generator(this, function (_c) {
628
- switch (_c.label) {
629
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
630
- case 1:
631
- res = _c.sent();
632
- if (res.error) {
633
- throw new Error("error fetching Incentive object at id ".concat(id, ": ").concat(res.error.code));
634
- }
635
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isIncentive(res.data.bcs.type)) {
636
- throw new Error("object at id ".concat(id, " is not a Incentive object"));
637
- }
638
- return [2 /*return*/, Incentive.fromSuiObjectData(res.data)];
639
- }
640
- });
641
- });
642
- };
643
- Incentive.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::Incentive");
644
- Incentive.$numTypeParams = 0;
645
- Incentive.$isPhantom = [];
646
- Incentive.cachedBcs = null;
647
- return Incentive;
648
- }());
649
- exports.Incentive = Incentive;
650
- /* ============================== StakePoolInfo =============================== */
651
- function isStakePoolInfo(type) {
652
- type = (0, util_1.compressSuiType)(type);
653
- return type === "".concat(index_1.PKG_V1, "::stake_pool::StakePoolInfo");
654
- }
655
- var StakePoolInfo = /** @class */ (function () {
656
- function StakePoolInfo(typeArgs, fields) {
657
- this.__StructClass = true;
658
- this.$typeName = StakePoolInfo.$typeName;
659
- this.$isPhantom = StakePoolInfo.$isPhantom;
660
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([StakePoolInfo.$typeName], __read(typeArgs), false));
661
- this.$typeArgs = typeArgs;
662
- this.stakeToken = fields.stakeToken;
663
- this.index = fields.index;
664
- this.nextUserShareId = fields.nextUserShareId;
665
- this.totalShare = fields.totalShare;
666
- this.active = fields.active;
667
- this.u64Padding = fields.u64Padding;
668
- }
669
- StakePoolInfo.reified = function () {
670
- var _this = this;
671
- var reifiedBcs = StakePoolInfo.bcs;
672
- return {
673
- typeName: StakePoolInfo.$typeName,
674
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([StakePoolInfo.$typeName], [], false)),
675
- typeArgs: [],
676
- isPhantom: StakePoolInfo.$isPhantom,
677
- reifiedTypeArgs: [],
678
- fromFields: function (fields) { return StakePoolInfo.fromFields(fields); },
679
- fromFieldsWithTypes: function (item) { return StakePoolInfo.fromFieldsWithTypes(item); },
680
- fromBcs: function (data) { return StakePoolInfo.fromFields(reifiedBcs.parse(data)); },
681
- bcs: reifiedBcs,
682
- fromJSONField: function (field) { return StakePoolInfo.fromJSONField(field); },
683
- fromJSON: function (json) { return StakePoolInfo.fromJSON(json); },
684
- fromSuiParsedData: function (content) { return StakePoolInfo.fromSuiParsedData(content); },
685
- fromSuiObjectData: function (content) { return StakePoolInfo.fromSuiObjectData(content); },
686
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
687
- return [2 /*return*/, StakePoolInfo.fetch(client, id)];
688
- }); }); },
689
- new: function (fields) {
690
- return new StakePoolInfo([], fields);
691
- },
692
- kind: "StructClassReified",
693
- };
694
- };
695
- Object.defineProperty(StakePoolInfo, "r", {
696
- get: function () {
697
- return StakePoolInfo.reified();
698
- },
699
- enumerable: false,
700
- configurable: true
701
- });
702
- StakePoolInfo.phantom = function () {
703
- return (0, reified_1.phantom)(StakePoolInfo.reified());
704
- };
705
- Object.defineProperty(StakePoolInfo, "p", {
706
- get: function () {
707
- return StakePoolInfo.phantom();
708
- },
709
- enumerable: false,
710
- configurable: true
711
- });
712
- StakePoolInfo.instantiateBcs = function () {
713
- return bcs_1.bcs.struct("StakePoolInfo", {
714
- stake_token: structs_1.TypeName.bcs,
715
- index: bcs_1.bcs.u64(),
716
- next_user_share_id: bcs_1.bcs.u64(),
717
- total_share: bcs_1.bcs.u64(),
718
- active: bcs_1.bcs.bool(),
719
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
720
- });
721
- };
722
- Object.defineProperty(StakePoolInfo, "bcs", {
723
- get: function () {
724
- if (!StakePoolInfo.cachedBcs) {
725
- StakePoolInfo.cachedBcs = StakePoolInfo.instantiateBcs();
726
- }
727
- return StakePoolInfo.cachedBcs;
728
- },
729
- enumerable: false,
730
- configurable: true
731
- });
732
- StakePoolInfo.fromFields = function (fields) {
733
- return StakePoolInfo.reified().new({
734
- stakeToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.stake_token),
735
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
736
- nextUserShareId: (0, reified_1.decodeFromFields)("u64", fields.next_user_share_id),
737
- totalShare: (0, reified_1.decodeFromFields)("u64", fields.total_share),
738
- active: (0, reified_1.decodeFromFields)("bool", fields.active),
739
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
740
- });
741
- };
742
- StakePoolInfo.fromFieldsWithTypes = function (item) {
743
- if (!isStakePoolInfo(item.type)) {
744
- throw new Error("not a StakePoolInfo type");
745
- }
746
- return StakePoolInfo.reified().new({
747
- stakeToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.stake_token),
748
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
749
- nextUserShareId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.next_user_share_id),
750
- totalShare: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.total_share),
751
- active: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.active),
752
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
753
- });
754
- };
755
- StakePoolInfo.fromBcs = function (data) {
756
- return StakePoolInfo.fromFields(StakePoolInfo.bcs.parse(data));
757
- };
758
- StakePoolInfo.prototype.toJSONField = function () {
759
- return {
760
- stakeToken: this.stakeToken.toJSONField(),
761
- index: this.index.toString(),
762
- nextUserShareId: this.nextUserShareId.toString(),
763
- totalShare: this.totalShare.toString(),
764
- active: this.active,
765
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
766
- };
767
- };
768
- StakePoolInfo.prototype.toJSON = function () {
769
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
770
- };
771
- StakePoolInfo.fromJSONField = function (field) {
772
- return StakePoolInfo.reified().new({
773
- stakeToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.stakeToken),
774
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
775
- nextUserShareId: (0, reified_1.decodeFromJSONField)("u64", field.nextUserShareId),
776
- totalShare: (0, reified_1.decodeFromJSONField)("u64", field.totalShare),
777
- active: (0, reified_1.decodeFromJSONField)("bool", field.active),
778
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
779
- });
780
- };
781
- StakePoolInfo.fromJSON = function (json) {
782
- if (json.$typeName !== StakePoolInfo.$typeName) {
783
- throw new Error("not a WithTwoGenerics json object");
784
- }
785
- return StakePoolInfo.fromJSONField(json);
786
- };
787
- StakePoolInfo.fromSuiParsedData = function (content) {
788
- if (content.dataType !== "moveObject") {
789
- throw new Error("not an object");
790
- }
791
- if (!isStakePoolInfo(content.type)) {
792
- throw new Error("object at ".concat(content.fields.id, " is not a StakePoolInfo object"));
793
- }
794
- return StakePoolInfo.fromFieldsWithTypes(content);
795
- };
796
- StakePoolInfo.fromSuiObjectData = function (data) {
797
- if (data.bcs) {
798
- if (data.bcs.dataType !== "moveObject" || !isStakePoolInfo(data.bcs.type)) {
799
- throw new Error("object at is not a StakePoolInfo object");
800
- }
801
- return StakePoolInfo.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
802
- }
803
- if (data.content) {
804
- return StakePoolInfo.fromSuiParsedData(data.content);
805
- }
806
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
807
- };
808
- StakePoolInfo.fetch = function (client, id) {
809
- return __awaiter(this, void 0, void 0, function () {
810
- var res;
811
- var _a, _b;
812
- return __generator(this, function (_c) {
813
- switch (_c.label) {
814
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
815
- case 1:
816
- res = _c.sent();
817
- if (res.error) {
818
- throw new Error("error fetching StakePoolInfo object at id ".concat(id, ": ").concat(res.error.code));
819
- }
820
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isStakePoolInfo(res.data.bcs.type)) {
821
- throw new Error("object at id ".concat(id, " is not a StakePoolInfo object"));
822
- }
823
- return [2 /*return*/, StakePoolInfo.fromSuiObjectData(res.data)];
824
- }
825
- });
826
- });
827
- };
828
- StakePoolInfo.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::StakePoolInfo");
829
- StakePoolInfo.$numTypeParams = 0;
830
- StakePoolInfo.$isPhantom = [];
831
- StakePoolInfo.cachedBcs = null;
832
- return StakePoolInfo;
833
- }());
834
- exports.StakePoolInfo = StakePoolInfo;
835
- /* ============================== StakePoolConfig =============================== */
836
- function isStakePoolConfig(type) {
837
- type = (0, util_1.compressSuiType)(type);
838
- return type === "".concat(index_1.PKG_V1, "::stake_pool::StakePoolConfig");
839
- }
840
- var StakePoolConfig = /** @class */ (function () {
841
- function StakePoolConfig(typeArgs, fields) {
842
- this.__StructClass = true;
843
- this.$typeName = StakePoolConfig.$typeName;
844
- this.$isPhantom = StakePoolConfig.$isPhantom;
845
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([StakePoolConfig.$typeName], __read(typeArgs), false));
846
- this.$typeArgs = typeArgs;
847
- this.unlockCountdownTsMs = fields.unlockCountdownTsMs;
848
- this.u64Padding = fields.u64Padding;
849
- }
850
- StakePoolConfig.reified = function () {
851
- var _this = this;
852
- var reifiedBcs = StakePoolConfig.bcs;
853
- return {
854
- typeName: StakePoolConfig.$typeName,
855
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([StakePoolConfig.$typeName], [], false)),
856
- typeArgs: [],
857
- isPhantom: StakePoolConfig.$isPhantom,
858
- reifiedTypeArgs: [],
859
- fromFields: function (fields) { return StakePoolConfig.fromFields(fields); },
860
- fromFieldsWithTypes: function (item) { return StakePoolConfig.fromFieldsWithTypes(item); },
861
- fromBcs: function (data) { return StakePoolConfig.fromFields(reifiedBcs.parse(data)); },
862
- bcs: reifiedBcs,
863
- fromJSONField: function (field) { return StakePoolConfig.fromJSONField(field); },
864
- fromJSON: function (json) { return StakePoolConfig.fromJSON(json); },
865
- fromSuiParsedData: function (content) { return StakePoolConfig.fromSuiParsedData(content); },
866
- fromSuiObjectData: function (content) { return StakePoolConfig.fromSuiObjectData(content); },
867
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
868
- return [2 /*return*/, StakePoolConfig.fetch(client, id)];
869
- }); }); },
870
- new: function (fields) {
871
- return new StakePoolConfig([], fields);
872
- },
873
- kind: "StructClassReified",
874
- };
875
- };
876
- Object.defineProperty(StakePoolConfig, "r", {
877
- get: function () {
878
- return StakePoolConfig.reified();
879
- },
880
- enumerable: false,
881
- configurable: true
882
- });
883
- StakePoolConfig.phantom = function () {
884
- return (0, reified_1.phantom)(StakePoolConfig.reified());
885
- };
886
- Object.defineProperty(StakePoolConfig, "p", {
887
- get: function () {
888
- return StakePoolConfig.phantom();
889
- },
890
- enumerable: false,
891
- configurable: true
892
- });
893
- StakePoolConfig.instantiateBcs = function () {
894
- return bcs_1.bcs.struct("StakePoolConfig", {
895
- unlock_countdown_ts_ms: bcs_1.bcs.u64(),
896
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
897
- });
898
- };
899
- Object.defineProperty(StakePoolConfig, "bcs", {
900
- get: function () {
901
- if (!StakePoolConfig.cachedBcs) {
902
- StakePoolConfig.cachedBcs = StakePoolConfig.instantiateBcs();
903
- }
904
- return StakePoolConfig.cachedBcs;
905
- },
906
- enumerable: false,
907
- configurable: true
908
- });
909
- StakePoolConfig.fromFields = function (fields) {
910
- return StakePoolConfig.reified().new({
911
- unlockCountdownTsMs: (0, reified_1.decodeFromFields)("u64", fields.unlock_countdown_ts_ms),
912
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
913
- });
914
- };
915
- StakePoolConfig.fromFieldsWithTypes = function (item) {
916
- if (!isStakePoolConfig(item.type)) {
917
- throw new Error("not a StakePoolConfig type");
918
- }
919
- return StakePoolConfig.reified().new({
920
- unlockCountdownTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unlock_countdown_ts_ms),
921
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
922
- });
923
- };
924
- StakePoolConfig.fromBcs = function (data) {
925
- return StakePoolConfig.fromFields(StakePoolConfig.bcs.parse(data));
926
- };
927
- StakePoolConfig.prototype.toJSONField = function () {
928
- return {
929
- unlockCountdownTsMs: this.unlockCountdownTsMs.toString(),
930
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
931
- };
932
- };
933
- StakePoolConfig.prototype.toJSON = function () {
934
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
935
- };
936
- StakePoolConfig.fromJSONField = function (field) {
937
- return StakePoolConfig.reified().new({
938
- unlockCountdownTsMs: (0, reified_1.decodeFromJSONField)("u64", field.unlockCountdownTsMs),
939
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
940
- });
941
- };
942
- StakePoolConfig.fromJSON = function (json) {
943
- if (json.$typeName !== StakePoolConfig.$typeName) {
944
- throw new Error("not a WithTwoGenerics json object");
945
- }
946
- return StakePoolConfig.fromJSONField(json);
947
- };
948
- StakePoolConfig.fromSuiParsedData = function (content) {
949
- if (content.dataType !== "moveObject") {
950
- throw new Error("not an object");
951
- }
952
- if (!isStakePoolConfig(content.type)) {
953
- throw new Error("object at ".concat(content.fields.id, " is not a StakePoolConfig object"));
954
- }
955
- return StakePoolConfig.fromFieldsWithTypes(content);
956
- };
957
- StakePoolConfig.fromSuiObjectData = function (data) {
958
- if (data.bcs) {
959
- if (data.bcs.dataType !== "moveObject" || !isStakePoolConfig(data.bcs.type)) {
960
- throw new Error("object at is not a StakePoolConfig object");
961
- }
962
- return StakePoolConfig.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
963
- }
964
- if (data.content) {
965
- return StakePoolConfig.fromSuiParsedData(data.content);
966
- }
967
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
968
- };
969
- StakePoolConfig.fetch = function (client, id) {
970
- return __awaiter(this, void 0, void 0, function () {
971
- var res;
972
- var _a, _b;
973
- return __generator(this, function (_c) {
974
- switch (_c.label) {
975
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
976
- case 1:
977
- res = _c.sent();
978
- if (res.error) {
979
- throw new Error("error fetching StakePoolConfig object at id ".concat(id, ": ").concat(res.error.code));
980
- }
981
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isStakePoolConfig(res.data.bcs.type)) {
982
- throw new Error("object at id ".concat(id, " is not a StakePoolConfig object"));
983
- }
984
- return [2 /*return*/, StakePoolConfig.fromSuiObjectData(res.data)];
985
- }
986
- });
987
- });
988
- };
989
- StakePoolConfig.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::StakePoolConfig");
990
- StakePoolConfig.$numTypeParams = 0;
991
- StakePoolConfig.$isPhantom = [];
992
- StakePoolConfig.cachedBcs = null;
993
- return StakePoolConfig;
994
- }());
995
- exports.StakePoolConfig = StakePoolConfig;
996
- /* ============================== IncentiveConfig =============================== */
997
- function isIncentiveConfig(type) {
998
- type = (0, util_1.compressSuiType)(type);
999
- return type === "".concat(index_1.PKG_V1, "::stake_pool::IncentiveConfig");
1000
- }
1001
- var IncentiveConfig = /** @class */ (function () {
1002
- function IncentiveConfig(typeArgs, fields) {
1003
- this.__StructClass = true;
1004
- this.$typeName = IncentiveConfig.$typeName;
1005
- this.$isPhantom = IncentiveConfig.$isPhantom;
1006
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([IncentiveConfig.$typeName], __read(typeArgs), false));
1007
- this.$typeArgs = typeArgs;
1008
- this.periodIncentiveAmount = fields.periodIncentiveAmount;
1009
- this.incentiveIntervalTsMs = fields.incentiveIntervalTsMs;
1010
- this.u64Padding = fields.u64Padding;
1011
- }
1012
- IncentiveConfig.reified = function () {
1013
- var _this = this;
1014
- var reifiedBcs = IncentiveConfig.bcs;
1015
- return {
1016
- typeName: IncentiveConfig.$typeName,
1017
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([IncentiveConfig.$typeName], [], false)),
1018
- typeArgs: [],
1019
- isPhantom: IncentiveConfig.$isPhantom,
1020
- reifiedTypeArgs: [],
1021
- fromFields: function (fields) { return IncentiveConfig.fromFields(fields); },
1022
- fromFieldsWithTypes: function (item) { return IncentiveConfig.fromFieldsWithTypes(item); },
1023
- fromBcs: function (data) { return IncentiveConfig.fromFields(reifiedBcs.parse(data)); },
1024
- bcs: reifiedBcs,
1025
- fromJSONField: function (field) { return IncentiveConfig.fromJSONField(field); },
1026
- fromJSON: function (json) { return IncentiveConfig.fromJSON(json); },
1027
- fromSuiParsedData: function (content) { return IncentiveConfig.fromSuiParsedData(content); },
1028
- fromSuiObjectData: function (content) { return IncentiveConfig.fromSuiObjectData(content); },
1029
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1030
- return [2 /*return*/, IncentiveConfig.fetch(client, id)];
1031
- }); }); },
1032
- new: function (fields) {
1033
- return new IncentiveConfig([], fields);
1034
- },
1035
- kind: "StructClassReified",
1036
- };
1037
- };
1038
- Object.defineProperty(IncentiveConfig, "r", {
1039
- get: function () {
1040
- return IncentiveConfig.reified();
1041
- },
1042
- enumerable: false,
1043
- configurable: true
1044
- });
1045
- IncentiveConfig.phantom = function () {
1046
- return (0, reified_1.phantom)(IncentiveConfig.reified());
1047
- };
1048
- Object.defineProperty(IncentiveConfig, "p", {
1049
- get: function () {
1050
- return IncentiveConfig.phantom();
1051
- },
1052
- enumerable: false,
1053
- configurable: true
1054
- });
1055
- IncentiveConfig.instantiateBcs = function () {
1056
- return bcs_1.bcs.struct("IncentiveConfig", {
1057
- period_incentive_amount: bcs_1.bcs.u64(),
1058
- incentive_interval_ts_ms: bcs_1.bcs.u64(),
1059
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
1060
- });
1061
- };
1062
- Object.defineProperty(IncentiveConfig, "bcs", {
1063
- get: function () {
1064
- if (!IncentiveConfig.cachedBcs) {
1065
- IncentiveConfig.cachedBcs = IncentiveConfig.instantiateBcs();
1066
- }
1067
- return IncentiveConfig.cachedBcs;
1068
- },
1069
- enumerable: false,
1070
- configurable: true
1071
- });
1072
- IncentiveConfig.fromFields = function (fields) {
1073
- return IncentiveConfig.reified().new({
1074
- periodIncentiveAmount: (0, reified_1.decodeFromFields)("u64", fields.period_incentive_amount),
1075
- incentiveIntervalTsMs: (0, reified_1.decodeFromFields)("u64", fields.incentive_interval_ts_ms),
1076
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
1077
- });
1078
- };
1079
- IncentiveConfig.fromFieldsWithTypes = function (item) {
1080
- if (!isIncentiveConfig(item.type)) {
1081
- throw new Error("not a IncentiveConfig type");
1082
- }
1083
- return IncentiveConfig.reified().new({
1084
- periodIncentiveAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.period_incentive_amount),
1085
- incentiveIntervalTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.incentive_interval_ts_ms),
1086
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
1087
- });
1088
- };
1089
- IncentiveConfig.fromBcs = function (data) {
1090
- return IncentiveConfig.fromFields(IncentiveConfig.bcs.parse(data));
1091
- };
1092
- IncentiveConfig.prototype.toJSONField = function () {
1093
- return {
1094
- periodIncentiveAmount: this.periodIncentiveAmount.toString(),
1095
- incentiveIntervalTsMs: this.incentiveIntervalTsMs.toString(),
1096
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
1097
- };
1098
- };
1099
- IncentiveConfig.prototype.toJSON = function () {
1100
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1101
- };
1102
- IncentiveConfig.fromJSONField = function (field) {
1103
- return IncentiveConfig.reified().new({
1104
- periodIncentiveAmount: (0, reified_1.decodeFromJSONField)("u64", field.periodIncentiveAmount),
1105
- incentiveIntervalTsMs: (0, reified_1.decodeFromJSONField)("u64", field.incentiveIntervalTsMs),
1106
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
1107
- });
1108
- };
1109
- IncentiveConfig.fromJSON = function (json) {
1110
- if (json.$typeName !== IncentiveConfig.$typeName) {
1111
- throw new Error("not a WithTwoGenerics json object");
1112
- }
1113
- return IncentiveConfig.fromJSONField(json);
1114
- };
1115
- IncentiveConfig.fromSuiParsedData = function (content) {
1116
- if (content.dataType !== "moveObject") {
1117
- throw new Error("not an object");
1118
- }
1119
- if (!isIncentiveConfig(content.type)) {
1120
- throw new Error("object at ".concat(content.fields.id, " is not a IncentiveConfig object"));
1121
- }
1122
- return IncentiveConfig.fromFieldsWithTypes(content);
1123
- };
1124
- IncentiveConfig.fromSuiObjectData = function (data) {
1125
- if (data.bcs) {
1126
- if (data.bcs.dataType !== "moveObject" || !isIncentiveConfig(data.bcs.type)) {
1127
- throw new Error("object at is not a IncentiveConfig object");
1128
- }
1129
- return IncentiveConfig.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1130
- }
1131
- if (data.content) {
1132
- return IncentiveConfig.fromSuiParsedData(data.content);
1133
- }
1134
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
1135
- };
1136
- IncentiveConfig.fetch = function (client, id) {
1137
- return __awaiter(this, void 0, void 0, function () {
1138
- var res;
1139
- var _a, _b;
1140
- return __generator(this, function (_c) {
1141
- switch (_c.label) {
1142
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
1143
- case 1:
1144
- res = _c.sent();
1145
- if (res.error) {
1146
- throw new Error("error fetching IncentiveConfig object at id ".concat(id, ": ").concat(res.error.code));
1147
- }
1148
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isIncentiveConfig(res.data.bcs.type)) {
1149
- throw new Error("object at id ".concat(id, " is not a IncentiveConfig object"));
1150
- }
1151
- return [2 /*return*/, IncentiveConfig.fromSuiObjectData(res.data)];
1152
- }
1153
- });
1154
- });
1155
- };
1156
- IncentiveConfig.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::IncentiveConfig");
1157
- IncentiveConfig.$numTypeParams = 0;
1158
- IncentiveConfig.$isPhantom = [];
1159
- IncentiveConfig.cachedBcs = null;
1160
- return IncentiveConfig;
1161
- }());
1162
- exports.IncentiveConfig = IncentiveConfig;
1163
- /* ============================== IncentiveInfo =============================== */
1164
- function isIncentiveInfo(type) {
1165
- type = (0, util_1.compressSuiType)(type);
1166
- return type === "".concat(index_1.PKG_V1, "::stake_pool::IncentiveInfo");
1167
- }
1168
- var IncentiveInfo = /** @class */ (function () {
1169
- function IncentiveInfo(typeArgs, fields) {
1170
- this.__StructClass = true;
1171
- this.$typeName = IncentiveInfo.$typeName;
1172
- this.$isPhantom = IncentiveInfo.$isPhantom;
1173
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([IncentiveInfo.$typeName], __read(typeArgs), false));
1174
- this.$typeArgs = typeArgs;
1175
- this.active = fields.active;
1176
- this.lastAllocateTsMs = fields.lastAllocateTsMs;
1177
- this.incentivePriceIndex = fields.incentivePriceIndex;
1178
- this.unallocatedAmount = fields.unallocatedAmount;
1179
- this.u64Padding = fields.u64Padding;
1180
- }
1181
- IncentiveInfo.reified = function () {
1182
- var _this = this;
1183
- var reifiedBcs = IncentiveInfo.bcs;
1184
- return {
1185
- typeName: IncentiveInfo.$typeName,
1186
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([IncentiveInfo.$typeName], [], false)),
1187
- typeArgs: [],
1188
- isPhantom: IncentiveInfo.$isPhantom,
1189
- reifiedTypeArgs: [],
1190
- fromFields: function (fields) { return IncentiveInfo.fromFields(fields); },
1191
- fromFieldsWithTypes: function (item) { return IncentiveInfo.fromFieldsWithTypes(item); },
1192
- fromBcs: function (data) { return IncentiveInfo.fromFields(reifiedBcs.parse(data)); },
1193
- bcs: reifiedBcs,
1194
- fromJSONField: function (field) { return IncentiveInfo.fromJSONField(field); },
1195
- fromJSON: function (json) { return IncentiveInfo.fromJSON(json); },
1196
- fromSuiParsedData: function (content) { return IncentiveInfo.fromSuiParsedData(content); },
1197
- fromSuiObjectData: function (content) { return IncentiveInfo.fromSuiObjectData(content); },
1198
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1199
- return [2 /*return*/, IncentiveInfo.fetch(client, id)];
1200
- }); }); },
1201
- new: function (fields) {
1202
- return new IncentiveInfo([], fields);
1203
- },
1204
- kind: "StructClassReified",
1205
- };
1206
- };
1207
- Object.defineProperty(IncentiveInfo, "r", {
1208
- get: function () {
1209
- return IncentiveInfo.reified();
1210
- },
1211
- enumerable: false,
1212
- configurable: true
1213
- });
1214
- IncentiveInfo.phantom = function () {
1215
- return (0, reified_1.phantom)(IncentiveInfo.reified());
1216
- };
1217
- Object.defineProperty(IncentiveInfo, "p", {
1218
- get: function () {
1219
- return IncentiveInfo.phantom();
1220
- },
1221
- enumerable: false,
1222
- configurable: true
1223
- });
1224
- IncentiveInfo.instantiateBcs = function () {
1225
- return bcs_1.bcs.struct("IncentiveInfo", {
1226
- active: bcs_1.bcs.bool(),
1227
- last_allocate_ts_ms: bcs_1.bcs.u64(),
1228
- incentive_price_index: bcs_1.bcs.u64(),
1229
- unallocated_amount: bcs_1.bcs.u64(),
1230
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
1231
- });
1232
- };
1233
- Object.defineProperty(IncentiveInfo, "bcs", {
1234
- get: function () {
1235
- if (!IncentiveInfo.cachedBcs) {
1236
- IncentiveInfo.cachedBcs = IncentiveInfo.instantiateBcs();
1237
- }
1238
- return IncentiveInfo.cachedBcs;
1239
- },
1240
- enumerable: false,
1241
- configurable: true
1242
- });
1243
- IncentiveInfo.fromFields = function (fields) {
1244
- return IncentiveInfo.reified().new({
1245
- active: (0, reified_1.decodeFromFields)("bool", fields.active),
1246
- lastAllocateTsMs: (0, reified_1.decodeFromFields)("u64", fields.last_allocate_ts_ms),
1247
- incentivePriceIndex: (0, reified_1.decodeFromFields)("u64", fields.incentive_price_index),
1248
- unallocatedAmount: (0, reified_1.decodeFromFields)("u64", fields.unallocated_amount),
1249
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
1250
- });
1251
- };
1252
- IncentiveInfo.fromFieldsWithTypes = function (item) {
1253
- if (!isIncentiveInfo(item.type)) {
1254
- throw new Error("not a IncentiveInfo type");
1255
- }
1256
- return IncentiveInfo.reified().new({
1257
- active: (0, reified_1.decodeFromFieldsWithTypes)("bool", item.fields.active),
1258
- lastAllocateTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.last_allocate_ts_ms),
1259
- incentivePriceIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.incentive_price_index),
1260
- unallocatedAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unallocated_amount),
1261
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
1262
- });
1263
- };
1264
- IncentiveInfo.fromBcs = function (data) {
1265
- return IncentiveInfo.fromFields(IncentiveInfo.bcs.parse(data));
1266
- };
1267
- IncentiveInfo.prototype.toJSONField = function () {
1268
- return {
1269
- active: this.active,
1270
- lastAllocateTsMs: this.lastAllocateTsMs.toString(),
1271
- incentivePriceIndex: this.incentivePriceIndex.toString(),
1272
- unallocatedAmount: this.unallocatedAmount.toString(),
1273
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
1274
- };
1275
- };
1276
- IncentiveInfo.prototype.toJSON = function () {
1277
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1278
- };
1279
- IncentiveInfo.fromJSONField = function (field) {
1280
- return IncentiveInfo.reified().new({
1281
- active: (0, reified_1.decodeFromJSONField)("bool", field.active),
1282
- lastAllocateTsMs: (0, reified_1.decodeFromJSONField)("u64", field.lastAllocateTsMs),
1283
- incentivePriceIndex: (0, reified_1.decodeFromJSONField)("u64", field.incentivePriceIndex),
1284
- unallocatedAmount: (0, reified_1.decodeFromJSONField)("u64", field.unallocatedAmount),
1285
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
1286
- });
1287
- };
1288
- IncentiveInfo.fromJSON = function (json) {
1289
- if (json.$typeName !== IncentiveInfo.$typeName) {
1290
- throw new Error("not a WithTwoGenerics json object");
1291
- }
1292
- return IncentiveInfo.fromJSONField(json);
1293
- };
1294
- IncentiveInfo.fromSuiParsedData = function (content) {
1295
- if (content.dataType !== "moveObject") {
1296
- throw new Error("not an object");
1297
- }
1298
- if (!isIncentiveInfo(content.type)) {
1299
- throw new Error("object at ".concat(content.fields.id, " is not a IncentiveInfo object"));
1300
- }
1301
- return IncentiveInfo.fromFieldsWithTypes(content);
1302
- };
1303
- IncentiveInfo.fromSuiObjectData = function (data) {
1304
- if (data.bcs) {
1305
- if (data.bcs.dataType !== "moveObject" || !isIncentiveInfo(data.bcs.type)) {
1306
- throw new Error("object at is not a IncentiveInfo object");
1307
- }
1308
- return IncentiveInfo.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1309
- }
1310
- if (data.content) {
1311
- return IncentiveInfo.fromSuiParsedData(data.content);
1312
- }
1313
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
1314
- };
1315
- IncentiveInfo.fetch = function (client, id) {
1316
- return __awaiter(this, void 0, void 0, function () {
1317
- var res;
1318
- var _a, _b;
1319
- return __generator(this, function (_c) {
1320
- switch (_c.label) {
1321
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
1322
- case 1:
1323
- res = _c.sent();
1324
- if (res.error) {
1325
- throw new Error("error fetching IncentiveInfo object at id ".concat(id, ": ").concat(res.error.code));
1326
- }
1327
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isIncentiveInfo(res.data.bcs.type)) {
1328
- throw new Error("object at id ".concat(id, " is not a IncentiveInfo object"));
1329
- }
1330
- return [2 /*return*/, IncentiveInfo.fromSuiObjectData(res.data)];
1331
- }
1332
- });
1333
- });
1334
- };
1335
- IncentiveInfo.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::IncentiveInfo");
1336
- IncentiveInfo.$numTypeParams = 0;
1337
- IncentiveInfo.$isPhantom = [];
1338
- IncentiveInfo.cachedBcs = null;
1339
- return IncentiveInfo;
1340
- }());
1341
- exports.IncentiveInfo = IncentiveInfo;
1342
- /* ============================== LpUserShare =============================== */
1343
- function isLpUserShare(type) {
1344
- type = (0, util_1.compressSuiType)(type);
1345
- return type === "".concat(index_1.PKG_V1, "::stake_pool::LpUserShare");
1346
- }
1347
- var LpUserShare = /** @class */ (function () {
1348
- function LpUserShare(typeArgs, fields) {
1349
- this.__StructClass = true;
1350
- this.$typeName = LpUserShare.$typeName;
1351
- this.$isPhantom = LpUserShare.$isPhantom;
1352
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([LpUserShare.$typeName], __read(typeArgs), false));
1353
- this.$typeArgs = typeArgs;
1354
- this.user = fields.user;
1355
- this.userShareId = fields.userShareId;
1356
- this.stakeTsMs = fields.stakeTsMs;
1357
- this.totalShares = fields.totalShares;
1358
- this.activeShares = fields.activeShares;
1359
- this.deactivatingShares = fields.deactivatingShares;
1360
- this.lastIncentivePriceIndex = fields.lastIncentivePriceIndex;
1361
- this.u64Padding = fields.u64Padding;
1362
- }
1363
- LpUserShare.reified = function () {
1364
- var _this = this;
1365
- var reifiedBcs = LpUserShare.bcs;
1366
- return {
1367
- typeName: LpUserShare.$typeName,
1368
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([LpUserShare.$typeName], [], false)),
1369
- typeArgs: [],
1370
- isPhantom: LpUserShare.$isPhantom,
1371
- reifiedTypeArgs: [],
1372
- fromFields: function (fields) { return LpUserShare.fromFields(fields); },
1373
- fromFieldsWithTypes: function (item) { return LpUserShare.fromFieldsWithTypes(item); },
1374
- fromBcs: function (data) { return LpUserShare.fromFields(reifiedBcs.parse(data)); },
1375
- bcs: reifiedBcs,
1376
- fromJSONField: function (field) { return LpUserShare.fromJSONField(field); },
1377
- fromJSON: function (json) { return LpUserShare.fromJSON(json); },
1378
- fromSuiParsedData: function (content) { return LpUserShare.fromSuiParsedData(content); },
1379
- fromSuiObjectData: function (content) { return LpUserShare.fromSuiObjectData(content); },
1380
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1381
- return [2 /*return*/, LpUserShare.fetch(client, id)];
1382
- }); }); },
1383
- new: function (fields) {
1384
- return new LpUserShare([], fields);
1385
- },
1386
- kind: "StructClassReified",
1387
- };
1388
- };
1389
- Object.defineProperty(LpUserShare, "r", {
1390
- get: function () {
1391
- return LpUserShare.reified();
1392
- },
1393
- enumerable: false,
1394
- configurable: true
1395
- });
1396
- LpUserShare.phantom = function () {
1397
- return (0, reified_1.phantom)(LpUserShare.reified());
1398
- };
1399
- Object.defineProperty(LpUserShare, "p", {
1400
- get: function () {
1401
- return LpUserShare.phantom();
1402
- },
1403
- enumerable: false,
1404
- configurable: true
1405
- });
1406
- LpUserShare.instantiateBcs = function () {
1407
- return bcs_1.bcs.struct("LpUserShare", {
1408
- user: bcs_1.bcs.bytes(32).transform({ input: function (val) { return (0, utils_1.fromHEX)(val); }, output: function (val) { return (0, utils_1.toHEX)(val); } }),
1409
- user_share_id: bcs_1.bcs.u64(),
1410
- stake_ts_ms: bcs_1.bcs.u64(),
1411
- total_shares: bcs_1.bcs.u64(),
1412
- active_shares: bcs_1.bcs.u64(),
1413
- deactivating_shares: bcs_1.bcs.vector(DeactivatingShares.bcs),
1414
- last_incentive_price_index: structs_3.VecMap.bcs(structs_1.TypeName.bcs, bcs_1.bcs.u64()),
1415
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
1416
- });
1417
- };
1418
- Object.defineProperty(LpUserShare, "bcs", {
1419
- get: function () {
1420
- if (!LpUserShare.cachedBcs) {
1421
- LpUserShare.cachedBcs = LpUserShare.instantiateBcs();
1422
- }
1423
- return LpUserShare.cachedBcs;
1424
- },
1425
- enumerable: false,
1426
- configurable: true
1427
- });
1428
- LpUserShare.fromFields = function (fields) {
1429
- return LpUserShare.reified().new({
1430
- user: (0, reified_1.decodeFromFields)("address", fields.user),
1431
- userShareId: (0, reified_1.decodeFromFields)("u64", fields.user_share_id),
1432
- stakeTsMs: (0, reified_1.decodeFromFields)("u64", fields.stake_ts_ms),
1433
- totalShares: (0, reified_1.decodeFromFields)("u64", fields.total_shares),
1434
- activeShares: (0, reified_1.decodeFromFields)("u64", fields.active_shares),
1435
- deactivatingShares: (0, reified_1.decodeFromFields)(reified.vector(DeactivatingShares.reified()), fields.deactivating_shares),
1436
- lastIncentivePriceIndex: (0, reified_1.decodeFromFields)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), fields.last_incentive_price_index),
1437
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
1438
- });
1439
- };
1440
- LpUserShare.fromFieldsWithTypes = function (item) {
1441
- if (!isLpUserShare(item.type)) {
1442
- throw new Error("not a LpUserShare type");
1443
- }
1444
- return LpUserShare.reified().new({
1445
- user: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.user),
1446
- userShareId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.user_share_id),
1447
- stakeTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.stake_ts_ms),
1448
- totalShares: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.total_shares),
1449
- activeShares: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.active_shares),
1450
- deactivatingShares: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector(DeactivatingShares.reified()), item.fields.deactivating_shares),
1451
- lastIncentivePriceIndex: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), item.fields.last_incentive_price_index),
1452
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
1453
- });
1454
- };
1455
- LpUserShare.fromBcs = function (data) {
1456
- return LpUserShare.fromFields(LpUserShare.bcs.parse(data));
1457
- };
1458
- LpUserShare.prototype.toJSONField = function () {
1459
- return {
1460
- user: this.user,
1461
- userShareId: this.userShareId.toString(),
1462
- stakeTsMs: this.stakeTsMs.toString(),
1463
- totalShares: this.totalShares.toString(),
1464
- activeShares: this.activeShares.toString(),
1465
- deactivatingShares: (0, reified_1.fieldToJSON)("vector<".concat(DeactivatingShares.$typeName, ">"), this.deactivatingShares),
1466
- lastIncentivePriceIndex: this.lastIncentivePriceIndex.toJSONField(),
1467
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
1468
- };
1469
- };
1470
- LpUserShare.prototype.toJSON = function () {
1471
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1472
- };
1473
- LpUserShare.fromJSONField = function (field) {
1474
- return LpUserShare.reified().new({
1475
- user: (0, reified_1.decodeFromJSONField)("address", field.user),
1476
- userShareId: (0, reified_1.decodeFromJSONField)("u64", field.userShareId),
1477
- stakeTsMs: (0, reified_1.decodeFromJSONField)("u64", field.stakeTsMs),
1478
- totalShares: (0, reified_1.decodeFromJSONField)("u64", field.totalShares),
1479
- activeShares: (0, reified_1.decodeFromJSONField)("u64", field.activeShares),
1480
- deactivatingShares: (0, reified_1.decodeFromJSONField)(reified.vector(DeactivatingShares.reified()), field.deactivatingShares),
1481
- lastIncentivePriceIndex: (0, reified_1.decodeFromJSONField)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), field.lastIncentivePriceIndex),
1482
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
1483
- });
1484
- };
1485
- LpUserShare.fromJSON = function (json) {
1486
- if (json.$typeName !== LpUserShare.$typeName) {
1487
- throw new Error("not a WithTwoGenerics json object");
1488
- }
1489
- return LpUserShare.fromJSONField(json);
1490
- };
1491
- LpUserShare.fromSuiParsedData = function (content) {
1492
- if (content.dataType !== "moveObject") {
1493
- throw new Error("not an object");
1494
- }
1495
- if (!isLpUserShare(content.type)) {
1496
- throw new Error("object at ".concat(content.fields.id, " is not a LpUserShare object"));
1497
- }
1498
- return LpUserShare.fromFieldsWithTypes(content);
1499
- };
1500
- LpUserShare.fromSuiObjectData = function (data) {
1501
- if (data.bcs) {
1502
- if (data.bcs.dataType !== "moveObject" || !isLpUserShare(data.bcs.type)) {
1503
- throw new Error("object at is not a LpUserShare object");
1504
- }
1505
- return LpUserShare.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1506
- }
1507
- if (data.content) {
1508
- return LpUserShare.fromSuiParsedData(data.content);
1509
- }
1510
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
1511
- };
1512
- LpUserShare.fetch = function (client, id) {
1513
- return __awaiter(this, void 0, void 0, function () {
1514
- var res;
1515
- var _a, _b;
1516
- return __generator(this, function (_c) {
1517
- switch (_c.label) {
1518
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
1519
- case 1:
1520
- res = _c.sent();
1521
- if (res.error) {
1522
- throw new Error("error fetching LpUserShare object at id ".concat(id, ": ").concat(res.error.code));
1523
- }
1524
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isLpUserShare(res.data.bcs.type)) {
1525
- throw new Error("object at id ".concat(id, " is not a LpUserShare object"));
1526
- }
1527
- return [2 /*return*/, LpUserShare.fromSuiObjectData(res.data)];
1528
- }
1529
- });
1530
- });
1531
- };
1532
- LpUserShare.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::LpUserShare");
1533
- LpUserShare.$numTypeParams = 0;
1534
- LpUserShare.$isPhantom = [];
1535
- LpUserShare.cachedBcs = null;
1536
- return LpUserShare;
1537
- }());
1538
- exports.LpUserShare = LpUserShare;
1539
- /* ============================== DeactivatingShares =============================== */
1540
- function isDeactivatingShares(type) {
1541
- type = (0, util_1.compressSuiType)(type);
1542
- return type === "".concat(index_1.PKG_V1, "::stake_pool::DeactivatingShares");
1543
- }
1544
- var DeactivatingShares = /** @class */ (function () {
1545
- function DeactivatingShares(typeArgs, fields) {
1546
- this.__StructClass = true;
1547
- this.$typeName = DeactivatingShares.$typeName;
1548
- this.$isPhantom = DeactivatingShares.$isPhantom;
1549
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([DeactivatingShares.$typeName], __read(typeArgs), false));
1550
- this.$typeArgs = typeArgs;
1551
- this.shares = fields.shares;
1552
- this.unsubscribedTsMs = fields.unsubscribedTsMs;
1553
- this.unlockedTsMs = fields.unlockedTsMs;
1554
- this.unsubscribedIncentivePriceIndex = fields.unsubscribedIncentivePriceIndex;
1555
- this.u64Padding = fields.u64Padding;
1556
- }
1557
- DeactivatingShares.reified = function () {
1558
- var _this = this;
1559
- var reifiedBcs = DeactivatingShares.bcs;
1560
- return {
1561
- typeName: DeactivatingShares.$typeName,
1562
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([DeactivatingShares.$typeName], [], false)),
1563
- typeArgs: [],
1564
- isPhantom: DeactivatingShares.$isPhantom,
1565
- reifiedTypeArgs: [],
1566
- fromFields: function (fields) { return DeactivatingShares.fromFields(fields); },
1567
- fromFieldsWithTypes: function (item) { return DeactivatingShares.fromFieldsWithTypes(item); },
1568
- fromBcs: function (data) { return DeactivatingShares.fromFields(reifiedBcs.parse(data)); },
1569
- bcs: reifiedBcs,
1570
- fromJSONField: function (field) { return DeactivatingShares.fromJSONField(field); },
1571
- fromJSON: function (json) { return DeactivatingShares.fromJSON(json); },
1572
- fromSuiParsedData: function (content) { return DeactivatingShares.fromSuiParsedData(content); },
1573
- fromSuiObjectData: function (content) { return DeactivatingShares.fromSuiObjectData(content); },
1574
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1575
- return [2 /*return*/, DeactivatingShares.fetch(client, id)];
1576
- }); }); },
1577
- new: function (fields) {
1578
- return new DeactivatingShares([], fields);
1579
- },
1580
- kind: "StructClassReified",
1581
- };
1582
- };
1583
- Object.defineProperty(DeactivatingShares, "r", {
1584
- get: function () {
1585
- return DeactivatingShares.reified();
1586
- },
1587
- enumerable: false,
1588
- configurable: true
1589
- });
1590
- DeactivatingShares.phantom = function () {
1591
- return (0, reified_1.phantom)(DeactivatingShares.reified());
1592
- };
1593
- Object.defineProperty(DeactivatingShares, "p", {
1594
- get: function () {
1595
- return DeactivatingShares.phantom();
1596
- },
1597
- enumerable: false,
1598
- configurable: true
1599
- });
1600
- DeactivatingShares.instantiateBcs = function () {
1601
- return bcs_1.bcs.struct("DeactivatingShares", {
1602
- shares: bcs_1.bcs.u64(),
1603
- unsubscribed_ts_ms: bcs_1.bcs.u64(),
1604
- unlocked_ts_ms: bcs_1.bcs.u64(),
1605
- unsubscribed_incentive_price_index: structs_3.VecMap.bcs(structs_1.TypeName.bcs, bcs_1.bcs.u64()),
1606
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
1607
- });
1608
- };
1609
- Object.defineProperty(DeactivatingShares, "bcs", {
1610
- get: function () {
1611
- if (!DeactivatingShares.cachedBcs) {
1612
- DeactivatingShares.cachedBcs = DeactivatingShares.instantiateBcs();
1613
- }
1614
- return DeactivatingShares.cachedBcs;
1615
- },
1616
- enumerable: false,
1617
- configurable: true
1618
- });
1619
- DeactivatingShares.fromFields = function (fields) {
1620
- return DeactivatingShares.reified().new({
1621
- shares: (0, reified_1.decodeFromFields)("u64", fields.shares),
1622
- unsubscribedTsMs: (0, reified_1.decodeFromFields)("u64", fields.unsubscribed_ts_ms),
1623
- unlockedTsMs: (0, reified_1.decodeFromFields)("u64", fields.unlocked_ts_ms),
1624
- unsubscribedIncentivePriceIndex: (0, reified_1.decodeFromFields)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), fields.unsubscribed_incentive_price_index),
1625
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
1626
- });
1627
- };
1628
- DeactivatingShares.fromFieldsWithTypes = function (item) {
1629
- if (!isDeactivatingShares(item.type)) {
1630
- throw new Error("not a DeactivatingShares type");
1631
- }
1632
- return DeactivatingShares.reified().new({
1633
- shares: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.shares),
1634
- unsubscribedTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unsubscribed_ts_ms),
1635
- unlockedTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unlocked_ts_ms),
1636
- unsubscribedIncentivePriceIndex: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), item.fields.unsubscribed_incentive_price_index),
1637
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
1638
- });
1639
- };
1640
- DeactivatingShares.fromBcs = function (data) {
1641
- return DeactivatingShares.fromFields(DeactivatingShares.bcs.parse(data));
1642
- };
1643
- DeactivatingShares.prototype.toJSONField = function () {
1644
- return {
1645
- shares: this.shares.toString(),
1646
- unsubscribedTsMs: this.unsubscribedTsMs.toString(),
1647
- unlockedTsMs: this.unlockedTsMs.toString(),
1648
- unsubscribedIncentivePriceIndex: this.unsubscribedIncentivePriceIndex.toJSONField(),
1649
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
1650
- };
1651
- };
1652
- DeactivatingShares.prototype.toJSON = function () {
1653
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1654
- };
1655
- DeactivatingShares.fromJSONField = function (field) {
1656
- return DeactivatingShares.reified().new({
1657
- shares: (0, reified_1.decodeFromJSONField)("u64", field.shares),
1658
- unsubscribedTsMs: (0, reified_1.decodeFromJSONField)("u64", field.unsubscribedTsMs),
1659
- unlockedTsMs: (0, reified_1.decodeFromJSONField)("u64", field.unlockedTsMs),
1660
- unsubscribedIncentivePriceIndex: (0, reified_1.decodeFromJSONField)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), field.unsubscribedIncentivePriceIndex),
1661
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
1662
- });
1663
- };
1664
- DeactivatingShares.fromJSON = function (json) {
1665
- if (json.$typeName !== DeactivatingShares.$typeName) {
1666
- throw new Error("not a WithTwoGenerics json object");
1667
- }
1668
- return DeactivatingShares.fromJSONField(json);
1669
- };
1670
- DeactivatingShares.fromSuiParsedData = function (content) {
1671
- if (content.dataType !== "moveObject") {
1672
- throw new Error("not an object");
1673
- }
1674
- if (!isDeactivatingShares(content.type)) {
1675
- throw new Error("object at ".concat(content.fields.id, " is not a DeactivatingShares object"));
1676
- }
1677
- return DeactivatingShares.fromFieldsWithTypes(content);
1678
- };
1679
- DeactivatingShares.fromSuiObjectData = function (data) {
1680
- if (data.bcs) {
1681
- if (data.bcs.dataType !== "moveObject" || !isDeactivatingShares(data.bcs.type)) {
1682
- throw new Error("object at is not a DeactivatingShares object");
1683
- }
1684
- return DeactivatingShares.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1685
- }
1686
- if (data.content) {
1687
- return DeactivatingShares.fromSuiParsedData(data.content);
1688
- }
1689
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
1690
- };
1691
- DeactivatingShares.fetch = function (client, id) {
1692
- return __awaiter(this, void 0, void 0, function () {
1693
- var res;
1694
- var _a, _b;
1695
- return __generator(this, function (_c) {
1696
- switch (_c.label) {
1697
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
1698
- case 1:
1699
- res = _c.sent();
1700
- if (res.error) {
1701
- throw new Error("error fetching DeactivatingShares object at id ".concat(id, ": ").concat(res.error.code));
1702
- }
1703
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isDeactivatingShares(res.data.bcs.type)) {
1704
- throw new Error("object at id ".concat(id, " is not a DeactivatingShares object"));
1705
- }
1706
- return [2 /*return*/, DeactivatingShares.fromSuiObjectData(res.data)];
1707
- }
1708
- });
1709
- });
1710
- };
1711
- DeactivatingShares.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::DeactivatingShares");
1712
- DeactivatingShares.$numTypeParams = 0;
1713
- DeactivatingShares.$isPhantom = [];
1714
- DeactivatingShares.cachedBcs = null;
1715
- return DeactivatingShares;
1716
- }());
1717
- exports.DeactivatingShares = DeactivatingShares;
1718
- /* ============================== NewStakePoolEvent =============================== */
1719
- function isNewStakePoolEvent(type) {
1720
- type = (0, util_1.compressSuiType)(type);
1721
- return type === "".concat(index_1.PKG_V1, "::stake_pool::NewStakePoolEvent");
1722
- }
1723
- var NewStakePoolEvent = /** @class */ (function () {
1724
- function NewStakePoolEvent(typeArgs, fields) {
1725
- this.__StructClass = true;
1726
- this.$typeName = NewStakePoolEvent.$typeName;
1727
- this.$isPhantom = NewStakePoolEvent.$isPhantom;
1728
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([NewStakePoolEvent.$typeName], __read(typeArgs), false));
1729
- this.$typeArgs = typeArgs;
1730
- this.sender = fields.sender;
1731
- this.stakePoolInfo = fields.stakePoolInfo;
1732
- this.stakePoolConfig = fields.stakePoolConfig;
1733
- this.u64Padding = fields.u64Padding;
1734
- }
1735
- NewStakePoolEvent.reified = function () {
1736
- var _this = this;
1737
- var reifiedBcs = NewStakePoolEvent.bcs;
1738
- return {
1739
- typeName: NewStakePoolEvent.$typeName,
1740
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([NewStakePoolEvent.$typeName], [], false)),
1741
- typeArgs: [],
1742
- isPhantom: NewStakePoolEvent.$isPhantom,
1743
- reifiedTypeArgs: [],
1744
- fromFields: function (fields) { return NewStakePoolEvent.fromFields(fields); },
1745
- fromFieldsWithTypes: function (item) { return NewStakePoolEvent.fromFieldsWithTypes(item); },
1746
- fromBcs: function (data) { return NewStakePoolEvent.fromFields(reifiedBcs.parse(data)); },
1747
- bcs: reifiedBcs,
1748
- fromJSONField: function (field) { return NewStakePoolEvent.fromJSONField(field); },
1749
- fromJSON: function (json) { return NewStakePoolEvent.fromJSON(json); },
1750
- fromSuiParsedData: function (content) { return NewStakePoolEvent.fromSuiParsedData(content); },
1751
- fromSuiObjectData: function (content) { return NewStakePoolEvent.fromSuiObjectData(content); },
1752
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1753
- return [2 /*return*/, NewStakePoolEvent.fetch(client, id)];
1754
- }); }); },
1755
- new: function (fields) {
1756
- return new NewStakePoolEvent([], fields);
1757
- },
1758
- kind: "StructClassReified",
1759
- };
1760
- };
1761
- Object.defineProperty(NewStakePoolEvent, "r", {
1762
- get: function () {
1763
- return NewStakePoolEvent.reified();
1764
- },
1765
- enumerable: false,
1766
- configurable: true
1767
- });
1768
- NewStakePoolEvent.phantom = function () {
1769
- return (0, reified_1.phantom)(NewStakePoolEvent.reified());
1770
- };
1771
- Object.defineProperty(NewStakePoolEvent, "p", {
1772
- get: function () {
1773
- return NewStakePoolEvent.phantom();
1774
- },
1775
- enumerable: false,
1776
- configurable: true
1777
- });
1778
- NewStakePoolEvent.instantiateBcs = function () {
1779
- return bcs_1.bcs.struct("NewStakePoolEvent", {
1780
- 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); } }),
1781
- stake_pool_info: StakePoolInfo.bcs,
1782
- stake_pool_config: StakePoolConfig.bcs,
1783
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
1784
- });
1785
- };
1786
- Object.defineProperty(NewStakePoolEvent, "bcs", {
1787
- get: function () {
1788
- if (!NewStakePoolEvent.cachedBcs) {
1789
- NewStakePoolEvent.cachedBcs = NewStakePoolEvent.instantiateBcs();
1790
- }
1791
- return NewStakePoolEvent.cachedBcs;
1792
- },
1793
- enumerable: false,
1794
- configurable: true
1795
- });
1796
- NewStakePoolEvent.fromFields = function (fields) {
1797
- return NewStakePoolEvent.reified().new({
1798
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
1799
- stakePoolInfo: (0, reified_1.decodeFromFields)(StakePoolInfo.reified(), fields.stake_pool_info),
1800
- stakePoolConfig: (0, reified_1.decodeFromFields)(StakePoolConfig.reified(), fields.stake_pool_config),
1801
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
1802
- });
1803
- };
1804
- NewStakePoolEvent.fromFieldsWithTypes = function (item) {
1805
- if (!isNewStakePoolEvent(item.type)) {
1806
- throw new Error("not a NewStakePoolEvent type");
1807
- }
1808
- return NewStakePoolEvent.reified().new({
1809
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
1810
- stakePoolInfo: (0, reified_1.decodeFromFieldsWithTypes)(StakePoolInfo.reified(), item.fields.stake_pool_info),
1811
- stakePoolConfig: (0, reified_1.decodeFromFieldsWithTypes)(StakePoolConfig.reified(), item.fields.stake_pool_config),
1812
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
1813
- });
1814
- };
1815
- NewStakePoolEvent.fromBcs = function (data) {
1816
- return NewStakePoolEvent.fromFields(NewStakePoolEvent.bcs.parse(data));
1817
- };
1818
- NewStakePoolEvent.prototype.toJSONField = function () {
1819
- return {
1820
- sender: this.sender,
1821
- stakePoolInfo: this.stakePoolInfo.toJSONField(),
1822
- stakePoolConfig: this.stakePoolConfig.toJSONField(),
1823
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
1824
- };
1825
- };
1826
- NewStakePoolEvent.prototype.toJSON = function () {
1827
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
1828
- };
1829
- NewStakePoolEvent.fromJSONField = function (field) {
1830
- return NewStakePoolEvent.reified().new({
1831
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
1832
- stakePoolInfo: (0, reified_1.decodeFromJSONField)(StakePoolInfo.reified(), field.stakePoolInfo),
1833
- stakePoolConfig: (0, reified_1.decodeFromJSONField)(StakePoolConfig.reified(), field.stakePoolConfig),
1834
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
1835
- });
1836
- };
1837
- NewStakePoolEvent.fromJSON = function (json) {
1838
- if (json.$typeName !== NewStakePoolEvent.$typeName) {
1839
- throw new Error("not a WithTwoGenerics json object");
1840
- }
1841
- return NewStakePoolEvent.fromJSONField(json);
1842
- };
1843
- NewStakePoolEvent.fromSuiParsedData = function (content) {
1844
- if (content.dataType !== "moveObject") {
1845
- throw new Error("not an object");
1846
- }
1847
- if (!isNewStakePoolEvent(content.type)) {
1848
- throw new Error("object at ".concat(content.fields.id, " is not a NewStakePoolEvent object"));
1849
- }
1850
- return NewStakePoolEvent.fromFieldsWithTypes(content);
1851
- };
1852
- NewStakePoolEvent.fromSuiObjectData = function (data) {
1853
- if (data.bcs) {
1854
- if (data.bcs.dataType !== "moveObject" || !isNewStakePoolEvent(data.bcs.type)) {
1855
- throw new Error("object at is not a NewStakePoolEvent object");
1856
- }
1857
- return NewStakePoolEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
1858
- }
1859
- if (data.content) {
1860
- return NewStakePoolEvent.fromSuiParsedData(data.content);
1861
- }
1862
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
1863
- };
1864
- NewStakePoolEvent.fetch = function (client, id) {
1865
- return __awaiter(this, void 0, void 0, function () {
1866
- var res;
1867
- var _a, _b;
1868
- return __generator(this, function (_c) {
1869
- switch (_c.label) {
1870
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
1871
- case 1:
1872
- res = _c.sent();
1873
- if (res.error) {
1874
- throw new Error("error fetching NewStakePoolEvent object at id ".concat(id, ": ").concat(res.error.code));
1875
- }
1876
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isNewStakePoolEvent(res.data.bcs.type)) {
1877
- throw new Error("object at id ".concat(id, " is not a NewStakePoolEvent object"));
1878
- }
1879
- return [2 /*return*/, NewStakePoolEvent.fromSuiObjectData(res.data)];
1880
- }
1881
- });
1882
- });
1883
- };
1884
- NewStakePoolEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::NewStakePoolEvent");
1885
- NewStakePoolEvent.$numTypeParams = 0;
1886
- NewStakePoolEvent.$isPhantom = [];
1887
- NewStakePoolEvent.cachedBcs = null;
1888
- return NewStakePoolEvent;
1889
- }());
1890
- exports.NewStakePoolEvent = NewStakePoolEvent;
1891
- /* ============================== AutoCompoundEvent =============================== */
1892
- function isAutoCompoundEvent(type) {
1893
- type = (0, util_1.compressSuiType)(type);
1894
- return type === "".concat(index_1.PKG_V1, "::stake_pool::AutoCompoundEvent");
1895
- }
1896
- var AutoCompoundEvent = /** @class */ (function () {
1897
- function AutoCompoundEvent(typeArgs, fields) {
1898
- this.__StructClass = true;
1899
- this.$typeName = AutoCompoundEvent.$typeName;
1900
- this.$isPhantom = AutoCompoundEvent.$isPhantom;
1901
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([AutoCompoundEvent.$typeName], __read(typeArgs), false));
1902
- this.$typeArgs = typeArgs;
1903
- this.sender = fields.sender;
1904
- this.index = fields.index;
1905
- this.incentiveToken = fields.incentiveToken;
1906
- this.incentivePriceIndex = fields.incentivePriceIndex;
1907
- this.totalAmount = fields.totalAmount;
1908
- this.compoundUsers = fields.compoundUsers;
1909
- this.totalUsers = fields.totalUsers;
1910
- this.u64Padding = fields.u64Padding;
1911
- }
1912
- AutoCompoundEvent.reified = function () {
1913
- var _this = this;
1914
- var reifiedBcs = AutoCompoundEvent.bcs;
1915
- return {
1916
- typeName: AutoCompoundEvent.$typeName,
1917
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([AutoCompoundEvent.$typeName], [], false)),
1918
- typeArgs: [],
1919
- isPhantom: AutoCompoundEvent.$isPhantom,
1920
- reifiedTypeArgs: [],
1921
- fromFields: function (fields) { return AutoCompoundEvent.fromFields(fields); },
1922
- fromFieldsWithTypes: function (item) { return AutoCompoundEvent.fromFieldsWithTypes(item); },
1923
- fromBcs: function (data) { return AutoCompoundEvent.fromFields(reifiedBcs.parse(data)); },
1924
- bcs: reifiedBcs,
1925
- fromJSONField: function (field) { return AutoCompoundEvent.fromJSONField(field); },
1926
- fromJSON: function (json) { return AutoCompoundEvent.fromJSON(json); },
1927
- fromSuiParsedData: function (content) { return AutoCompoundEvent.fromSuiParsedData(content); },
1928
- fromSuiObjectData: function (content) { return AutoCompoundEvent.fromSuiObjectData(content); },
1929
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1930
- return [2 /*return*/, AutoCompoundEvent.fetch(client, id)];
1931
- }); }); },
1932
- new: function (fields) {
1933
- return new AutoCompoundEvent([], fields);
1934
- },
1935
- kind: "StructClassReified",
1936
- };
1937
- };
1938
- Object.defineProperty(AutoCompoundEvent, "r", {
1939
- get: function () {
1940
- return AutoCompoundEvent.reified();
1941
- },
1942
- enumerable: false,
1943
- configurable: true
1944
- });
1945
- AutoCompoundEvent.phantom = function () {
1946
- return (0, reified_1.phantom)(AutoCompoundEvent.reified());
1947
- };
1948
- Object.defineProperty(AutoCompoundEvent, "p", {
1949
- get: function () {
1950
- return AutoCompoundEvent.phantom();
1951
- },
1952
- enumerable: false,
1953
- configurable: true
1954
- });
1955
- AutoCompoundEvent.instantiateBcs = function () {
1956
- return bcs_1.bcs.struct("AutoCompoundEvent", {
1957
- 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); } }),
1958
- index: bcs_1.bcs.u64(),
1959
- incentive_token: structs_1.TypeName.bcs,
1960
- incentive_price_index: bcs_1.bcs.u64(),
1961
- total_amount: bcs_1.bcs.u64(),
1962
- compound_users: bcs_1.bcs.u64(),
1963
- total_users: bcs_1.bcs.u64(),
1964
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
1965
- });
1966
- };
1967
- Object.defineProperty(AutoCompoundEvent, "bcs", {
1968
- get: function () {
1969
- if (!AutoCompoundEvent.cachedBcs) {
1970
- AutoCompoundEvent.cachedBcs = AutoCompoundEvent.instantiateBcs();
1971
- }
1972
- return AutoCompoundEvent.cachedBcs;
1973
- },
1974
- enumerable: false,
1975
- configurable: true
1976
- });
1977
- AutoCompoundEvent.fromFields = function (fields) {
1978
- return AutoCompoundEvent.reified().new({
1979
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
1980
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
1981
- incentiveToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token),
1982
- incentivePriceIndex: (0, reified_1.decodeFromFields)("u64", fields.incentive_price_index),
1983
- totalAmount: (0, reified_1.decodeFromFields)("u64", fields.total_amount),
1984
- compoundUsers: (0, reified_1.decodeFromFields)("u64", fields.compound_users),
1985
- totalUsers: (0, reified_1.decodeFromFields)("u64", fields.total_users),
1986
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
1987
- });
1988
- };
1989
- AutoCompoundEvent.fromFieldsWithTypes = function (item) {
1990
- if (!isAutoCompoundEvent(item.type)) {
1991
- throw new Error("not a AutoCompoundEvent type");
1992
- }
1993
- return AutoCompoundEvent.reified().new({
1994
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
1995
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
1996
- incentiveToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token),
1997
- incentivePriceIndex: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.incentive_price_index),
1998
- totalAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.total_amount),
1999
- compoundUsers: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.compound_users),
2000
- totalUsers: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.total_users),
2001
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
2002
- });
2003
- };
2004
- AutoCompoundEvent.fromBcs = function (data) {
2005
- return AutoCompoundEvent.fromFields(AutoCompoundEvent.bcs.parse(data));
2006
- };
2007
- AutoCompoundEvent.prototype.toJSONField = function () {
2008
- return {
2009
- sender: this.sender,
2010
- index: this.index.toString(),
2011
- incentiveToken: this.incentiveToken.toJSONField(),
2012
- incentivePriceIndex: this.incentivePriceIndex.toString(),
2013
- totalAmount: this.totalAmount.toString(),
2014
- compoundUsers: this.compoundUsers.toString(),
2015
- totalUsers: this.totalUsers.toString(),
2016
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
2017
- };
2018
- };
2019
- AutoCompoundEvent.prototype.toJSON = function () {
2020
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
2021
- };
2022
- AutoCompoundEvent.fromJSONField = function (field) {
2023
- return AutoCompoundEvent.reified().new({
2024
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
2025
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
2026
- incentiveToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveToken),
2027
- incentivePriceIndex: (0, reified_1.decodeFromJSONField)("u64", field.incentivePriceIndex),
2028
- totalAmount: (0, reified_1.decodeFromJSONField)("u64", field.totalAmount),
2029
- compoundUsers: (0, reified_1.decodeFromJSONField)("u64", field.compoundUsers),
2030
- totalUsers: (0, reified_1.decodeFromJSONField)("u64", field.totalUsers),
2031
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
2032
- });
2033
- };
2034
- AutoCompoundEvent.fromJSON = function (json) {
2035
- if (json.$typeName !== AutoCompoundEvent.$typeName) {
2036
- throw new Error("not a WithTwoGenerics json object");
2037
- }
2038
- return AutoCompoundEvent.fromJSONField(json);
2039
- };
2040
- AutoCompoundEvent.fromSuiParsedData = function (content) {
2041
- if (content.dataType !== "moveObject") {
2042
- throw new Error("not an object");
2043
- }
2044
- if (!isAutoCompoundEvent(content.type)) {
2045
- throw new Error("object at ".concat(content.fields.id, " is not a AutoCompoundEvent object"));
2046
- }
2047
- return AutoCompoundEvent.fromFieldsWithTypes(content);
2048
- };
2049
- AutoCompoundEvent.fromSuiObjectData = function (data) {
2050
- if (data.bcs) {
2051
- if (data.bcs.dataType !== "moveObject" || !isAutoCompoundEvent(data.bcs.type)) {
2052
- throw new Error("object at is not a AutoCompoundEvent object");
2053
- }
2054
- return AutoCompoundEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
2055
- }
2056
- if (data.content) {
2057
- return AutoCompoundEvent.fromSuiParsedData(data.content);
2058
- }
2059
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
2060
- };
2061
- AutoCompoundEvent.fetch = function (client, id) {
2062
- return __awaiter(this, void 0, void 0, function () {
2063
- var res;
2064
- var _a, _b;
2065
- return __generator(this, function (_c) {
2066
- switch (_c.label) {
2067
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
2068
- case 1:
2069
- res = _c.sent();
2070
- if (res.error) {
2071
- throw new Error("error fetching AutoCompoundEvent object at id ".concat(id, ": ").concat(res.error.code));
2072
- }
2073
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isAutoCompoundEvent(res.data.bcs.type)) {
2074
- throw new Error("object at id ".concat(id, " is not a AutoCompoundEvent object"));
2075
- }
2076
- return [2 /*return*/, AutoCompoundEvent.fromSuiObjectData(res.data)];
2077
- }
2078
- });
2079
- });
2080
- };
2081
- AutoCompoundEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::AutoCompoundEvent");
2082
- AutoCompoundEvent.$numTypeParams = 0;
2083
- AutoCompoundEvent.$isPhantom = [];
2084
- AutoCompoundEvent.cachedBcs = null;
2085
- return AutoCompoundEvent;
2086
- }());
2087
- exports.AutoCompoundEvent = AutoCompoundEvent;
2088
- /* ============================== AddIncentiveTokenEvent =============================== */
2089
- function isAddIncentiveTokenEvent(type) {
2090
- type = (0, util_1.compressSuiType)(type);
2091
- return type === "".concat(index_1.PKG_V1, "::stake_pool::AddIncentiveTokenEvent");
2092
- }
2093
- var AddIncentiveTokenEvent = /** @class */ (function () {
2094
- function AddIncentiveTokenEvent(typeArgs, fields) {
2095
- this.__StructClass = true;
2096
- this.$typeName = AddIncentiveTokenEvent.$typeName;
2097
- this.$isPhantom = AddIncentiveTokenEvent.$isPhantom;
2098
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([AddIncentiveTokenEvent.$typeName], __read(typeArgs), false));
2099
- this.$typeArgs = typeArgs;
2100
- this.sender = fields.sender;
2101
- this.index = fields.index;
2102
- this.incentiveToken = fields.incentiveToken;
2103
- this.incentiveInfo = fields.incentiveInfo;
2104
- this.incentiveConfig = fields.incentiveConfig;
2105
- this.u64Padding = fields.u64Padding;
2106
- }
2107
- AddIncentiveTokenEvent.reified = function () {
2108
- var _this = this;
2109
- var reifiedBcs = AddIncentiveTokenEvent.bcs;
2110
- return {
2111
- typeName: AddIncentiveTokenEvent.$typeName,
2112
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([AddIncentiveTokenEvent.$typeName], [], false)),
2113
- typeArgs: [],
2114
- isPhantom: AddIncentiveTokenEvent.$isPhantom,
2115
- reifiedTypeArgs: [],
2116
- fromFields: function (fields) { return AddIncentiveTokenEvent.fromFields(fields); },
2117
- fromFieldsWithTypes: function (item) { return AddIncentiveTokenEvent.fromFieldsWithTypes(item); },
2118
- fromBcs: function (data) { return AddIncentiveTokenEvent.fromFields(reifiedBcs.parse(data)); },
2119
- bcs: reifiedBcs,
2120
- fromJSONField: function (field) { return AddIncentiveTokenEvent.fromJSONField(field); },
2121
- fromJSON: function (json) { return AddIncentiveTokenEvent.fromJSON(json); },
2122
- fromSuiParsedData: function (content) { return AddIncentiveTokenEvent.fromSuiParsedData(content); },
2123
- fromSuiObjectData: function (content) { return AddIncentiveTokenEvent.fromSuiObjectData(content); },
2124
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
2125
- return [2 /*return*/, AddIncentiveTokenEvent.fetch(client, id)];
2126
- }); }); },
2127
- new: function (fields) {
2128
- return new AddIncentiveTokenEvent([], fields);
2129
- },
2130
- kind: "StructClassReified",
2131
- };
2132
- };
2133
- Object.defineProperty(AddIncentiveTokenEvent, "r", {
2134
- get: function () {
2135
- return AddIncentiveTokenEvent.reified();
2136
- },
2137
- enumerable: false,
2138
- configurable: true
2139
- });
2140
- AddIncentiveTokenEvent.phantom = function () {
2141
- return (0, reified_1.phantom)(AddIncentiveTokenEvent.reified());
2142
- };
2143
- Object.defineProperty(AddIncentiveTokenEvent, "p", {
2144
- get: function () {
2145
- return AddIncentiveTokenEvent.phantom();
2146
- },
2147
- enumerable: false,
2148
- configurable: true
2149
- });
2150
- AddIncentiveTokenEvent.instantiateBcs = function () {
2151
- return bcs_1.bcs.struct("AddIncentiveTokenEvent", {
2152
- 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); } }),
2153
- index: bcs_1.bcs.u64(),
2154
- incentive_token: structs_1.TypeName.bcs,
2155
- incentive_info: IncentiveInfo.bcs,
2156
- incentive_config: IncentiveConfig.bcs,
2157
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
2158
- });
2159
- };
2160
- Object.defineProperty(AddIncentiveTokenEvent, "bcs", {
2161
- get: function () {
2162
- if (!AddIncentiveTokenEvent.cachedBcs) {
2163
- AddIncentiveTokenEvent.cachedBcs = AddIncentiveTokenEvent.instantiateBcs();
2164
- }
2165
- return AddIncentiveTokenEvent.cachedBcs;
2166
- },
2167
- enumerable: false,
2168
- configurable: true
2169
- });
2170
- AddIncentiveTokenEvent.fromFields = function (fields) {
2171
- return AddIncentiveTokenEvent.reified().new({
2172
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
2173
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
2174
- incentiveToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token),
2175
- incentiveInfo: (0, reified_1.decodeFromFields)(IncentiveInfo.reified(), fields.incentive_info),
2176
- incentiveConfig: (0, reified_1.decodeFromFields)(IncentiveConfig.reified(), fields.incentive_config),
2177
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
2178
- });
2179
- };
2180
- AddIncentiveTokenEvent.fromFieldsWithTypes = function (item) {
2181
- if (!isAddIncentiveTokenEvent(item.type)) {
2182
- throw new Error("not a AddIncentiveTokenEvent type");
2183
- }
2184
- return AddIncentiveTokenEvent.reified().new({
2185
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
2186
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
2187
- incentiveToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token),
2188
- incentiveInfo: (0, reified_1.decodeFromFieldsWithTypes)(IncentiveInfo.reified(), item.fields.incentive_info),
2189
- incentiveConfig: (0, reified_1.decodeFromFieldsWithTypes)(IncentiveConfig.reified(), item.fields.incentive_config),
2190
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
2191
- });
2192
- };
2193
- AddIncentiveTokenEvent.fromBcs = function (data) {
2194
- return AddIncentiveTokenEvent.fromFields(AddIncentiveTokenEvent.bcs.parse(data));
2195
- };
2196
- AddIncentiveTokenEvent.prototype.toJSONField = function () {
2197
- return {
2198
- sender: this.sender,
2199
- index: this.index.toString(),
2200
- incentiveToken: this.incentiveToken.toJSONField(),
2201
- incentiveInfo: this.incentiveInfo.toJSONField(),
2202
- incentiveConfig: this.incentiveConfig.toJSONField(),
2203
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
2204
- };
2205
- };
2206
- AddIncentiveTokenEvent.prototype.toJSON = function () {
2207
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
2208
- };
2209
- AddIncentiveTokenEvent.fromJSONField = function (field) {
2210
- return AddIncentiveTokenEvent.reified().new({
2211
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
2212
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
2213
- incentiveToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveToken),
2214
- incentiveInfo: (0, reified_1.decodeFromJSONField)(IncentiveInfo.reified(), field.incentiveInfo),
2215
- incentiveConfig: (0, reified_1.decodeFromJSONField)(IncentiveConfig.reified(), field.incentiveConfig),
2216
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
2217
- });
2218
- };
2219
- AddIncentiveTokenEvent.fromJSON = function (json) {
2220
- if (json.$typeName !== AddIncentiveTokenEvent.$typeName) {
2221
- throw new Error("not a WithTwoGenerics json object");
2222
- }
2223
- return AddIncentiveTokenEvent.fromJSONField(json);
2224
- };
2225
- AddIncentiveTokenEvent.fromSuiParsedData = function (content) {
2226
- if (content.dataType !== "moveObject") {
2227
- throw new Error("not an object");
2228
- }
2229
- if (!isAddIncentiveTokenEvent(content.type)) {
2230
- throw new Error("object at ".concat(content.fields.id, " is not a AddIncentiveTokenEvent object"));
2231
- }
2232
- return AddIncentiveTokenEvent.fromFieldsWithTypes(content);
2233
- };
2234
- AddIncentiveTokenEvent.fromSuiObjectData = function (data) {
2235
- if (data.bcs) {
2236
- if (data.bcs.dataType !== "moveObject" || !isAddIncentiveTokenEvent(data.bcs.type)) {
2237
- throw new Error("object at is not a AddIncentiveTokenEvent object");
2238
- }
2239
- return AddIncentiveTokenEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
2240
- }
2241
- if (data.content) {
2242
- return AddIncentiveTokenEvent.fromSuiParsedData(data.content);
2243
- }
2244
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
2245
- };
2246
- AddIncentiveTokenEvent.fetch = function (client, id) {
2247
- return __awaiter(this, void 0, void 0, function () {
2248
- var res;
2249
- var _a, _b;
2250
- return __generator(this, function (_c) {
2251
- switch (_c.label) {
2252
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
2253
- case 1:
2254
- res = _c.sent();
2255
- if (res.error) {
2256
- throw new Error("error fetching AddIncentiveTokenEvent object at id ".concat(id, ": ").concat(res.error.code));
2257
- }
2258
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isAddIncentiveTokenEvent(res.data.bcs.type)) {
2259
- throw new Error("object at id ".concat(id, " is not a AddIncentiveTokenEvent object"));
2260
- }
2261
- return [2 /*return*/, AddIncentiveTokenEvent.fromSuiObjectData(res.data)];
2262
- }
2263
- });
2264
- });
2265
- };
2266
- AddIncentiveTokenEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::AddIncentiveTokenEvent");
2267
- AddIncentiveTokenEvent.$numTypeParams = 0;
2268
- AddIncentiveTokenEvent.$isPhantom = [];
2269
- AddIncentiveTokenEvent.cachedBcs = null;
2270
- return AddIncentiveTokenEvent;
2271
- }());
2272
- exports.AddIncentiveTokenEvent = AddIncentiveTokenEvent;
2273
- /* ============================== DeactivateIncentiveTokenEvent =============================== */
2274
- function isDeactivateIncentiveTokenEvent(type) {
2275
- type = (0, util_1.compressSuiType)(type);
2276
- return type === "".concat(index_1.PKG_V1, "::stake_pool::DeactivateIncentiveTokenEvent");
2277
- }
2278
- var DeactivateIncentiveTokenEvent = /** @class */ (function () {
2279
- function DeactivateIncentiveTokenEvent(typeArgs, fields) {
2280
- this.__StructClass = true;
2281
- this.$typeName = DeactivateIncentiveTokenEvent.$typeName;
2282
- this.$isPhantom = DeactivateIncentiveTokenEvent.$isPhantom;
2283
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([DeactivateIncentiveTokenEvent.$typeName], __read(typeArgs), false));
2284
- this.$typeArgs = typeArgs;
2285
- this.sender = fields.sender;
2286
- this.index = fields.index;
2287
- this.incentiveToken = fields.incentiveToken;
2288
- this.u64Padding = fields.u64Padding;
2289
- }
2290
- DeactivateIncentiveTokenEvent.reified = function () {
2291
- var _this = this;
2292
- var reifiedBcs = DeactivateIncentiveTokenEvent.bcs;
2293
- return {
2294
- typeName: DeactivateIncentiveTokenEvent.$typeName,
2295
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([DeactivateIncentiveTokenEvent.$typeName], [], false)),
2296
- typeArgs: [],
2297
- isPhantom: DeactivateIncentiveTokenEvent.$isPhantom,
2298
- reifiedTypeArgs: [],
2299
- fromFields: function (fields) { return DeactivateIncentiveTokenEvent.fromFields(fields); },
2300
- fromFieldsWithTypes: function (item) { return DeactivateIncentiveTokenEvent.fromFieldsWithTypes(item); },
2301
- fromBcs: function (data) { return DeactivateIncentiveTokenEvent.fromFields(reifiedBcs.parse(data)); },
2302
- bcs: reifiedBcs,
2303
- fromJSONField: function (field) { return DeactivateIncentiveTokenEvent.fromJSONField(field); },
2304
- fromJSON: function (json) { return DeactivateIncentiveTokenEvent.fromJSON(json); },
2305
- fromSuiParsedData: function (content) { return DeactivateIncentiveTokenEvent.fromSuiParsedData(content); },
2306
- fromSuiObjectData: function (content) { return DeactivateIncentiveTokenEvent.fromSuiObjectData(content); },
2307
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
2308
- return [2 /*return*/, DeactivateIncentiveTokenEvent.fetch(client, id)];
2309
- }); }); },
2310
- new: function (fields) {
2311
- return new DeactivateIncentiveTokenEvent([], fields);
2312
- },
2313
- kind: "StructClassReified",
2314
- };
2315
- };
2316
- Object.defineProperty(DeactivateIncentiveTokenEvent, "r", {
2317
- get: function () {
2318
- return DeactivateIncentiveTokenEvent.reified();
2319
- },
2320
- enumerable: false,
2321
- configurable: true
2322
- });
2323
- DeactivateIncentiveTokenEvent.phantom = function () {
2324
- return (0, reified_1.phantom)(DeactivateIncentiveTokenEvent.reified());
2325
- };
2326
- Object.defineProperty(DeactivateIncentiveTokenEvent, "p", {
2327
- get: function () {
2328
- return DeactivateIncentiveTokenEvent.phantom();
2329
- },
2330
- enumerable: false,
2331
- configurable: true
2332
- });
2333
- DeactivateIncentiveTokenEvent.instantiateBcs = function () {
2334
- return bcs_1.bcs.struct("DeactivateIncentiveTokenEvent", {
2335
- 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); } }),
2336
- index: bcs_1.bcs.u64(),
2337
- incentive_token: structs_1.TypeName.bcs,
2338
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
2339
- });
2340
- };
2341
- Object.defineProperty(DeactivateIncentiveTokenEvent, "bcs", {
2342
- get: function () {
2343
- if (!DeactivateIncentiveTokenEvent.cachedBcs) {
2344
- DeactivateIncentiveTokenEvent.cachedBcs = DeactivateIncentiveTokenEvent.instantiateBcs();
2345
- }
2346
- return DeactivateIncentiveTokenEvent.cachedBcs;
2347
- },
2348
- enumerable: false,
2349
- configurable: true
2350
- });
2351
- DeactivateIncentiveTokenEvent.fromFields = function (fields) {
2352
- return DeactivateIncentiveTokenEvent.reified().new({
2353
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
2354
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
2355
- incentiveToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token),
2356
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
2357
- });
2358
- };
2359
- DeactivateIncentiveTokenEvent.fromFieldsWithTypes = function (item) {
2360
- if (!isDeactivateIncentiveTokenEvent(item.type)) {
2361
- throw new Error("not a DeactivateIncentiveTokenEvent type");
2362
- }
2363
- return DeactivateIncentiveTokenEvent.reified().new({
2364
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
2365
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
2366
- incentiveToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token),
2367
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
2368
- });
2369
- };
2370
- DeactivateIncentiveTokenEvent.fromBcs = function (data) {
2371
- return DeactivateIncentiveTokenEvent.fromFields(DeactivateIncentiveTokenEvent.bcs.parse(data));
2372
- };
2373
- DeactivateIncentiveTokenEvent.prototype.toJSONField = function () {
2374
- return {
2375
- sender: this.sender,
2376
- index: this.index.toString(),
2377
- incentiveToken: this.incentiveToken.toJSONField(),
2378
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
2379
- };
2380
- };
2381
- DeactivateIncentiveTokenEvent.prototype.toJSON = function () {
2382
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
2383
- };
2384
- DeactivateIncentiveTokenEvent.fromJSONField = function (field) {
2385
- return DeactivateIncentiveTokenEvent.reified().new({
2386
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
2387
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
2388
- incentiveToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveToken),
2389
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
2390
- });
2391
- };
2392
- DeactivateIncentiveTokenEvent.fromJSON = function (json) {
2393
- if (json.$typeName !== DeactivateIncentiveTokenEvent.$typeName) {
2394
- throw new Error("not a WithTwoGenerics json object");
2395
- }
2396
- return DeactivateIncentiveTokenEvent.fromJSONField(json);
2397
- };
2398
- DeactivateIncentiveTokenEvent.fromSuiParsedData = function (content) {
2399
- if (content.dataType !== "moveObject") {
2400
- throw new Error("not an object");
2401
- }
2402
- if (!isDeactivateIncentiveTokenEvent(content.type)) {
2403
- throw new Error("object at ".concat(content.fields.id, " is not a DeactivateIncentiveTokenEvent object"));
2404
- }
2405
- return DeactivateIncentiveTokenEvent.fromFieldsWithTypes(content);
2406
- };
2407
- DeactivateIncentiveTokenEvent.fromSuiObjectData = function (data) {
2408
- if (data.bcs) {
2409
- if (data.bcs.dataType !== "moveObject" || !isDeactivateIncentiveTokenEvent(data.bcs.type)) {
2410
- throw new Error("object at is not a DeactivateIncentiveTokenEvent object");
2411
- }
2412
- return DeactivateIncentiveTokenEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
2413
- }
2414
- if (data.content) {
2415
- return DeactivateIncentiveTokenEvent.fromSuiParsedData(data.content);
2416
- }
2417
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
2418
- };
2419
- DeactivateIncentiveTokenEvent.fetch = function (client, id) {
2420
- return __awaiter(this, void 0, void 0, function () {
2421
- var res;
2422
- var _a, _b;
2423
- return __generator(this, function (_c) {
2424
- switch (_c.label) {
2425
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
2426
- case 1:
2427
- res = _c.sent();
2428
- if (res.error) {
2429
- throw new Error("error fetching DeactivateIncentiveTokenEvent object at id ".concat(id, ": ").concat(res.error.code));
2430
- }
2431
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isDeactivateIncentiveTokenEvent(res.data.bcs.type)) {
2432
- throw new Error("object at id ".concat(id, " is not a DeactivateIncentiveTokenEvent object"));
2433
- }
2434
- return [2 /*return*/, DeactivateIncentiveTokenEvent.fromSuiObjectData(res.data)];
2435
- }
2436
- });
2437
- });
2438
- };
2439
- DeactivateIncentiveTokenEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::DeactivateIncentiveTokenEvent");
2440
- DeactivateIncentiveTokenEvent.$numTypeParams = 0;
2441
- DeactivateIncentiveTokenEvent.$isPhantom = [];
2442
- DeactivateIncentiveTokenEvent.cachedBcs = null;
2443
- return DeactivateIncentiveTokenEvent;
2444
- }());
2445
- exports.DeactivateIncentiveTokenEvent = DeactivateIncentiveTokenEvent;
2446
- /* ============================== ActivateIncentiveTokenEvent =============================== */
2447
- function isActivateIncentiveTokenEvent(type) {
2448
- type = (0, util_1.compressSuiType)(type);
2449
- return type === "".concat(index_1.PKG_V1, "::stake_pool::ActivateIncentiveTokenEvent");
2450
- }
2451
- var ActivateIncentiveTokenEvent = /** @class */ (function () {
2452
- function ActivateIncentiveTokenEvent(typeArgs, fields) {
2453
- this.__StructClass = true;
2454
- this.$typeName = ActivateIncentiveTokenEvent.$typeName;
2455
- this.$isPhantom = ActivateIncentiveTokenEvent.$isPhantom;
2456
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([ActivateIncentiveTokenEvent.$typeName], __read(typeArgs), false));
2457
- this.$typeArgs = typeArgs;
2458
- this.sender = fields.sender;
2459
- this.index = fields.index;
2460
- this.incentiveToken = fields.incentiveToken;
2461
- this.u64Padding = fields.u64Padding;
2462
- }
2463
- ActivateIncentiveTokenEvent.reified = function () {
2464
- var _this = this;
2465
- var reifiedBcs = ActivateIncentiveTokenEvent.bcs;
2466
- return {
2467
- typeName: ActivateIncentiveTokenEvent.$typeName,
2468
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([ActivateIncentiveTokenEvent.$typeName], [], false)),
2469
- typeArgs: [],
2470
- isPhantom: ActivateIncentiveTokenEvent.$isPhantom,
2471
- reifiedTypeArgs: [],
2472
- fromFields: function (fields) { return ActivateIncentiveTokenEvent.fromFields(fields); },
2473
- fromFieldsWithTypes: function (item) { return ActivateIncentiveTokenEvent.fromFieldsWithTypes(item); },
2474
- fromBcs: function (data) { return ActivateIncentiveTokenEvent.fromFields(reifiedBcs.parse(data)); },
2475
- bcs: reifiedBcs,
2476
- fromJSONField: function (field) { return ActivateIncentiveTokenEvent.fromJSONField(field); },
2477
- fromJSON: function (json) { return ActivateIncentiveTokenEvent.fromJSON(json); },
2478
- fromSuiParsedData: function (content) { return ActivateIncentiveTokenEvent.fromSuiParsedData(content); },
2479
- fromSuiObjectData: function (content) { return ActivateIncentiveTokenEvent.fromSuiObjectData(content); },
2480
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
2481
- return [2 /*return*/, ActivateIncentiveTokenEvent.fetch(client, id)];
2482
- }); }); },
2483
- new: function (fields) {
2484
- return new ActivateIncentiveTokenEvent([], fields);
2485
- },
2486
- kind: "StructClassReified",
2487
- };
2488
- };
2489
- Object.defineProperty(ActivateIncentiveTokenEvent, "r", {
2490
- get: function () {
2491
- return ActivateIncentiveTokenEvent.reified();
2492
- },
2493
- enumerable: false,
2494
- configurable: true
2495
- });
2496
- ActivateIncentiveTokenEvent.phantom = function () {
2497
- return (0, reified_1.phantom)(ActivateIncentiveTokenEvent.reified());
2498
- };
2499
- Object.defineProperty(ActivateIncentiveTokenEvent, "p", {
2500
- get: function () {
2501
- return ActivateIncentiveTokenEvent.phantom();
2502
- },
2503
- enumerable: false,
2504
- configurable: true
2505
- });
2506
- ActivateIncentiveTokenEvent.instantiateBcs = function () {
2507
- return bcs_1.bcs.struct("ActivateIncentiveTokenEvent", {
2508
- 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); } }),
2509
- index: bcs_1.bcs.u64(),
2510
- incentive_token: structs_1.TypeName.bcs,
2511
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
2512
- });
2513
- };
2514
- Object.defineProperty(ActivateIncentiveTokenEvent, "bcs", {
2515
- get: function () {
2516
- if (!ActivateIncentiveTokenEvent.cachedBcs) {
2517
- ActivateIncentiveTokenEvent.cachedBcs = ActivateIncentiveTokenEvent.instantiateBcs();
2518
- }
2519
- return ActivateIncentiveTokenEvent.cachedBcs;
2520
- },
2521
- enumerable: false,
2522
- configurable: true
2523
- });
2524
- ActivateIncentiveTokenEvent.fromFields = function (fields) {
2525
- return ActivateIncentiveTokenEvent.reified().new({
2526
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
2527
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
2528
- incentiveToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token),
2529
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
2530
- });
2531
- };
2532
- ActivateIncentiveTokenEvent.fromFieldsWithTypes = function (item) {
2533
- if (!isActivateIncentiveTokenEvent(item.type)) {
2534
- throw new Error("not a ActivateIncentiveTokenEvent type");
2535
- }
2536
- return ActivateIncentiveTokenEvent.reified().new({
2537
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
2538
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
2539
- incentiveToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token),
2540
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
2541
- });
2542
- };
2543
- ActivateIncentiveTokenEvent.fromBcs = function (data) {
2544
- return ActivateIncentiveTokenEvent.fromFields(ActivateIncentiveTokenEvent.bcs.parse(data));
2545
- };
2546
- ActivateIncentiveTokenEvent.prototype.toJSONField = function () {
2547
- return {
2548
- sender: this.sender,
2549
- index: this.index.toString(),
2550
- incentiveToken: this.incentiveToken.toJSONField(),
2551
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
2552
- };
2553
- };
2554
- ActivateIncentiveTokenEvent.prototype.toJSON = function () {
2555
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
2556
- };
2557
- ActivateIncentiveTokenEvent.fromJSONField = function (field) {
2558
- return ActivateIncentiveTokenEvent.reified().new({
2559
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
2560
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
2561
- incentiveToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveToken),
2562
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
2563
- });
2564
- };
2565
- ActivateIncentiveTokenEvent.fromJSON = function (json) {
2566
- if (json.$typeName !== ActivateIncentiveTokenEvent.$typeName) {
2567
- throw new Error("not a WithTwoGenerics json object");
2568
- }
2569
- return ActivateIncentiveTokenEvent.fromJSONField(json);
2570
- };
2571
- ActivateIncentiveTokenEvent.fromSuiParsedData = function (content) {
2572
- if (content.dataType !== "moveObject") {
2573
- throw new Error("not an object");
2574
- }
2575
- if (!isActivateIncentiveTokenEvent(content.type)) {
2576
- throw new Error("object at ".concat(content.fields.id, " is not a ActivateIncentiveTokenEvent object"));
2577
- }
2578
- return ActivateIncentiveTokenEvent.fromFieldsWithTypes(content);
2579
- };
2580
- ActivateIncentiveTokenEvent.fromSuiObjectData = function (data) {
2581
- if (data.bcs) {
2582
- if (data.bcs.dataType !== "moveObject" || !isActivateIncentiveTokenEvent(data.bcs.type)) {
2583
- throw new Error("object at is not a ActivateIncentiveTokenEvent object");
2584
- }
2585
- return ActivateIncentiveTokenEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
2586
- }
2587
- if (data.content) {
2588
- return ActivateIncentiveTokenEvent.fromSuiParsedData(data.content);
2589
- }
2590
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
2591
- };
2592
- ActivateIncentiveTokenEvent.fetch = function (client, id) {
2593
- return __awaiter(this, void 0, void 0, function () {
2594
- var res;
2595
- var _a, _b;
2596
- return __generator(this, function (_c) {
2597
- switch (_c.label) {
2598
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
2599
- case 1:
2600
- res = _c.sent();
2601
- if (res.error) {
2602
- throw new Error("error fetching ActivateIncentiveTokenEvent object at id ".concat(id, ": ").concat(res.error.code));
2603
- }
2604
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isActivateIncentiveTokenEvent(res.data.bcs.type)) {
2605
- throw new Error("object at id ".concat(id, " is not a ActivateIncentiveTokenEvent object"));
2606
- }
2607
- return [2 /*return*/, ActivateIncentiveTokenEvent.fromSuiObjectData(res.data)];
2608
- }
2609
- });
2610
- });
2611
- };
2612
- ActivateIncentiveTokenEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::ActivateIncentiveTokenEvent");
2613
- ActivateIncentiveTokenEvent.$numTypeParams = 0;
2614
- ActivateIncentiveTokenEvent.$isPhantom = [];
2615
- ActivateIncentiveTokenEvent.cachedBcs = null;
2616
- return ActivateIncentiveTokenEvent;
2617
- }());
2618
- exports.ActivateIncentiveTokenEvent = ActivateIncentiveTokenEvent;
2619
- /* ============================== RemoveIncentiveTokenEvent =============================== */
2620
- function isRemoveIncentiveTokenEvent(type) {
2621
- type = (0, util_1.compressSuiType)(type);
2622
- return type === "".concat(index_1.PKG_V1, "::stake_pool::RemoveIncentiveTokenEvent");
2623
- }
2624
- var RemoveIncentiveTokenEvent = /** @class */ (function () {
2625
- function RemoveIncentiveTokenEvent(typeArgs, fields) {
2626
- this.__StructClass = true;
2627
- this.$typeName = RemoveIncentiveTokenEvent.$typeName;
2628
- this.$isPhantom = RemoveIncentiveTokenEvent.$isPhantom;
2629
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([RemoveIncentiveTokenEvent.$typeName], __read(typeArgs), false));
2630
- this.$typeArgs = typeArgs;
2631
- this.sender = fields.sender;
2632
- this.index = fields.index;
2633
- this.incentiveToken = fields.incentiveToken;
2634
- this.incentiveBalanceValue = fields.incentiveBalanceValue;
2635
- this.u64Padding = fields.u64Padding;
2636
- }
2637
- RemoveIncentiveTokenEvent.reified = function () {
2638
- var _this = this;
2639
- var reifiedBcs = RemoveIncentiveTokenEvent.bcs;
2640
- return {
2641
- typeName: RemoveIncentiveTokenEvent.$typeName,
2642
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([RemoveIncentiveTokenEvent.$typeName], [], false)),
2643
- typeArgs: [],
2644
- isPhantom: RemoveIncentiveTokenEvent.$isPhantom,
2645
- reifiedTypeArgs: [],
2646
- fromFields: function (fields) { return RemoveIncentiveTokenEvent.fromFields(fields); },
2647
- fromFieldsWithTypes: function (item) { return RemoveIncentiveTokenEvent.fromFieldsWithTypes(item); },
2648
- fromBcs: function (data) { return RemoveIncentiveTokenEvent.fromFields(reifiedBcs.parse(data)); },
2649
- bcs: reifiedBcs,
2650
- fromJSONField: function (field) { return RemoveIncentiveTokenEvent.fromJSONField(field); },
2651
- fromJSON: function (json) { return RemoveIncentiveTokenEvent.fromJSON(json); },
2652
- fromSuiParsedData: function (content) { return RemoveIncentiveTokenEvent.fromSuiParsedData(content); },
2653
- fromSuiObjectData: function (content) { return RemoveIncentiveTokenEvent.fromSuiObjectData(content); },
2654
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
2655
- return [2 /*return*/, RemoveIncentiveTokenEvent.fetch(client, id)];
2656
- }); }); },
2657
- new: function (fields) {
2658
- return new RemoveIncentiveTokenEvent([], fields);
2659
- },
2660
- kind: "StructClassReified",
2661
- };
2662
- };
2663
- Object.defineProperty(RemoveIncentiveTokenEvent, "r", {
2664
- get: function () {
2665
- return RemoveIncentiveTokenEvent.reified();
2666
- },
2667
- enumerable: false,
2668
- configurable: true
2669
- });
2670
- RemoveIncentiveTokenEvent.phantom = function () {
2671
- return (0, reified_1.phantom)(RemoveIncentiveTokenEvent.reified());
2672
- };
2673
- Object.defineProperty(RemoveIncentiveTokenEvent, "p", {
2674
- get: function () {
2675
- return RemoveIncentiveTokenEvent.phantom();
2676
- },
2677
- enumerable: false,
2678
- configurable: true
2679
- });
2680
- RemoveIncentiveTokenEvent.instantiateBcs = function () {
2681
- return bcs_1.bcs.struct("RemoveIncentiveTokenEvent", {
2682
- 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); } }),
2683
- index: bcs_1.bcs.u64(),
2684
- incentive_token: structs_1.TypeName.bcs,
2685
- incentive_balance_value: bcs_1.bcs.u64(),
2686
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
2687
- });
2688
- };
2689
- Object.defineProperty(RemoveIncentiveTokenEvent, "bcs", {
2690
- get: function () {
2691
- if (!RemoveIncentiveTokenEvent.cachedBcs) {
2692
- RemoveIncentiveTokenEvent.cachedBcs = RemoveIncentiveTokenEvent.instantiateBcs();
2693
- }
2694
- return RemoveIncentiveTokenEvent.cachedBcs;
2695
- },
2696
- enumerable: false,
2697
- configurable: true
2698
- });
2699
- RemoveIncentiveTokenEvent.fromFields = function (fields) {
2700
- return RemoveIncentiveTokenEvent.reified().new({
2701
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
2702
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
2703
- incentiveToken: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token),
2704
- incentiveBalanceValue: (0, reified_1.decodeFromFields)("u64", fields.incentive_balance_value),
2705
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
2706
- });
2707
- };
2708
- RemoveIncentiveTokenEvent.fromFieldsWithTypes = function (item) {
2709
- if (!isRemoveIncentiveTokenEvent(item.type)) {
2710
- throw new Error("not a RemoveIncentiveTokenEvent type");
2711
- }
2712
- return RemoveIncentiveTokenEvent.reified().new({
2713
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
2714
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
2715
- incentiveToken: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token),
2716
- incentiveBalanceValue: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.incentive_balance_value),
2717
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
2718
- });
2719
- };
2720
- RemoveIncentiveTokenEvent.fromBcs = function (data) {
2721
- return RemoveIncentiveTokenEvent.fromFields(RemoveIncentiveTokenEvent.bcs.parse(data));
2722
- };
2723
- RemoveIncentiveTokenEvent.prototype.toJSONField = function () {
2724
- return {
2725
- sender: this.sender,
2726
- index: this.index.toString(),
2727
- incentiveToken: this.incentiveToken.toJSONField(),
2728
- incentiveBalanceValue: this.incentiveBalanceValue.toString(),
2729
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
2730
- };
2731
- };
2732
- RemoveIncentiveTokenEvent.prototype.toJSON = function () {
2733
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
2734
- };
2735
- RemoveIncentiveTokenEvent.fromJSONField = function (field) {
2736
- return RemoveIncentiveTokenEvent.reified().new({
2737
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
2738
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
2739
- incentiveToken: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveToken),
2740
- incentiveBalanceValue: (0, reified_1.decodeFromJSONField)("u64", field.incentiveBalanceValue),
2741
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
2742
- });
2743
- };
2744
- RemoveIncentiveTokenEvent.fromJSON = function (json) {
2745
- if (json.$typeName !== RemoveIncentiveTokenEvent.$typeName) {
2746
- throw new Error("not a WithTwoGenerics json object");
2747
- }
2748
- return RemoveIncentiveTokenEvent.fromJSONField(json);
2749
- };
2750
- RemoveIncentiveTokenEvent.fromSuiParsedData = function (content) {
2751
- if (content.dataType !== "moveObject") {
2752
- throw new Error("not an object");
2753
- }
2754
- if (!isRemoveIncentiveTokenEvent(content.type)) {
2755
- throw new Error("object at ".concat(content.fields.id, " is not a RemoveIncentiveTokenEvent object"));
2756
- }
2757
- return RemoveIncentiveTokenEvent.fromFieldsWithTypes(content);
2758
- };
2759
- RemoveIncentiveTokenEvent.fromSuiObjectData = function (data) {
2760
- if (data.bcs) {
2761
- if (data.bcs.dataType !== "moveObject" || !isRemoveIncentiveTokenEvent(data.bcs.type)) {
2762
- throw new Error("object at is not a RemoveIncentiveTokenEvent object");
2763
- }
2764
- return RemoveIncentiveTokenEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
2765
- }
2766
- if (data.content) {
2767
- return RemoveIncentiveTokenEvent.fromSuiParsedData(data.content);
2768
- }
2769
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
2770
- };
2771
- RemoveIncentiveTokenEvent.fetch = function (client, id) {
2772
- return __awaiter(this, void 0, void 0, function () {
2773
- var res;
2774
- var _a, _b;
2775
- return __generator(this, function (_c) {
2776
- switch (_c.label) {
2777
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
2778
- case 1:
2779
- res = _c.sent();
2780
- if (res.error) {
2781
- throw new Error("error fetching RemoveIncentiveTokenEvent object at id ".concat(id, ": ").concat(res.error.code));
2782
- }
2783
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isRemoveIncentiveTokenEvent(res.data.bcs.type)) {
2784
- throw new Error("object at id ".concat(id, " is not a RemoveIncentiveTokenEvent object"));
2785
- }
2786
- return [2 /*return*/, RemoveIncentiveTokenEvent.fromSuiObjectData(res.data)];
2787
- }
2788
- });
2789
- });
2790
- };
2791
- RemoveIncentiveTokenEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::RemoveIncentiveTokenEvent");
2792
- RemoveIncentiveTokenEvent.$numTypeParams = 0;
2793
- RemoveIncentiveTokenEvent.$isPhantom = [];
2794
- RemoveIncentiveTokenEvent.cachedBcs = null;
2795
- return RemoveIncentiveTokenEvent;
2796
- }());
2797
- exports.RemoveIncentiveTokenEvent = RemoveIncentiveTokenEvent;
2798
- /* ============================== UpdateUnlockCountdownTsMsEvent =============================== */
2799
- function isUpdateUnlockCountdownTsMsEvent(type) {
2800
- type = (0, util_1.compressSuiType)(type);
2801
- return type === "".concat(index_1.PKG_V1, "::stake_pool::UpdateUnlockCountdownTsMsEvent");
2802
- }
2803
- var UpdateUnlockCountdownTsMsEvent = /** @class */ (function () {
2804
- function UpdateUnlockCountdownTsMsEvent(typeArgs, fields) {
2805
- this.__StructClass = true;
2806
- this.$typeName = UpdateUnlockCountdownTsMsEvent.$typeName;
2807
- this.$isPhantom = UpdateUnlockCountdownTsMsEvent.$isPhantom;
2808
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([UpdateUnlockCountdownTsMsEvent.$typeName], __read(typeArgs), false));
2809
- this.$typeArgs = typeArgs;
2810
- this.sender = fields.sender;
2811
- this.index = fields.index;
2812
- this.previousUnlockCountdownTsMs = fields.previousUnlockCountdownTsMs;
2813
- this.newUnlockCountdownTsMs = fields.newUnlockCountdownTsMs;
2814
- this.u64Padding = fields.u64Padding;
2815
- }
2816
- UpdateUnlockCountdownTsMsEvent.reified = function () {
2817
- var _this = this;
2818
- var reifiedBcs = UpdateUnlockCountdownTsMsEvent.bcs;
2819
- return {
2820
- typeName: UpdateUnlockCountdownTsMsEvent.$typeName,
2821
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([UpdateUnlockCountdownTsMsEvent.$typeName], [], false)),
2822
- typeArgs: [],
2823
- isPhantom: UpdateUnlockCountdownTsMsEvent.$isPhantom,
2824
- reifiedTypeArgs: [],
2825
- fromFields: function (fields) { return UpdateUnlockCountdownTsMsEvent.fromFields(fields); },
2826
- fromFieldsWithTypes: function (item) { return UpdateUnlockCountdownTsMsEvent.fromFieldsWithTypes(item); },
2827
- fromBcs: function (data) { return UpdateUnlockCountdownTsMsEvent.fromFields(reifiedBcs.parse(data)); },
2828
- bcs: reifiedBcs,
2829
- fromJSONField: function (field) { return UpdateUnlockCountdownTsMsEvent.fromJSONField(field); },
2830
- fromJSON: function (json) { return UpdateUnlockCountdownTsMsEvent.fromJSON(json); },
2831
- fromSuiParsedData: function (content) { return UpdateUnlockCountdownTsMsEvent.fromSuiParsedData(content); },
2832
- fromSuiObjectData: function (content) { return UpdateUnlockCountdownTsMsEvent.fromSuiObjectData(content); },
2833
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
2834
- return [2 /*return*/, UpdateUnlockCountdownTsMsEvent.fetch(client, id)];
2835
- }); }); },
2836
- new: function (fields) {
2837
- return new UpdateUnlockCountdownTsMsEvent([], fields);
2838
- },
2839
- kind: "StructClassReified",
2840
- };
2841
- };
2842
- Object.defineProperty(UpdateUnlockCountdownTsMsEvent, "r", {
2843
- get: function () {
2844
- return UpdateUnlockCountdownTsMsEvent.reified();
2845
- },
2846
- enumerable: false,
2847
- configurable: true
2848
- });
2849
- UpdateUnlockCountdownTsMsEvent.phantom = function () {
2850
- return (0, reified_1.phantom)(UpdateUnlockCountdownTsMsEvent.reified());
2851
- };
2852
- Object.defineProperty(UpdateUnlockCountdownTsMsEvent, "p", {
2853
- get: function () {
2854
- return UpdateUnlockCountdownTsMsEvent.phantom();
2855
- },
2856
- enumerable: false,
2857
- configurable: true
2858
- });
2859
- UpdateUnlockCountdownTsMsEvent.instantiateBcs = function () {
2860
- return bcs_1.bcs.struct("UpdateUnlockCountdownTsMsEvent", {
2861
- 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); } }),
2862
- index: bcs_1.bcs.u64(),
2863
- previous_unlock_countdown_ts_ms: bcs_1.bcs.u64(),
2864
- new_unlock_countdown_ts_ms: bcs_1.bcs.u64(),
2865
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
2866
- });
2867
- };
2868
- Object.defineProperty(UpdateUnlockCountdownTsMsEvent, "bcs", {
2869
- get: function () {
2870
- if (!UpdateUnlockCountdownTsMsEvent.cachedBcs) {
2871
- UpdateUnlockCountdownTsMsEvent.cachedBcs = UpdateUnlockCountdownTsMsEvent.instantiateBcs();
2872
- }
2873
- return UpdateUnlockCountdownTsMsEvent.cachedBcs;
2874
- },
2875
- enumerable: false,
2876
- configurable: true
2877
- });
2878
- UpdateUnlockCountdownTsMsEvent.fromFields = function (fields) {
2879
- return UpdateUnlockCountdownTsMsEvent.reified().new({
2880
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
2881
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
2882
- previousUnlockCountdownTsMs: (0, reified_1.decodeFromFields)("u64", fields.previous_unlock_countdown_ts_ms),
2883
- newUnlockCountdownTsMs: (0, reified_1.decodeFromFields)("u64", fields.new_unlock_countdown_ts_ms),
2884
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
2885
- });
2886
- };
2887
- UpdateUnlockCountdownTsMsEvent.fromFieldsWithTypes = function (item) {
2888
- if (!isUpdateUnlockCountdownTsMsEvent(item.type)) {
2889
- throw new Error("not a UpdateUnlockCountdownTsMsEvent type");
2890
- }
2891
- return UpdateUnlockCountdownTsMsEvent.reified().new({
2892
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
2893
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
2894
- previousUnlockCountdownTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.previous_unlock_countdown_ts_ms),
2895
- newUnlockCountdownTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.new_unlock_countdown_ts_ms),
2896
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
2897
- });
2898
- };
2899
- UpdateUnlockCountdownTsMsEvent.fromBcs = function (data) {
2900
- return UpdateUnlockCountdownTsMsEvent.fromFields(UpdateUnlockCountdownTsMsEvent.bcs.parse(data));
2901
- };
2902
- UpdateUnlockCountdownTsMsEvent.prototype.toJSONField = function () {
2903
- return {
2904
- sender: this.sender,
2905
- index: this.index.toString(),
2906
- previousUnlockCountdownTsMs: this.previousUnlockCountdownTsMs.toString(),
2907
- newUnlockCountdownTsMs: this.newUnlockCountdownTsMs.toString(),
2908
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
2909
- };
2910
- };
2911
- UpdateUnlockCountdownTsMsEvent.prototype.toJSON = function () {
2912
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
2913
- };
2914
- UpdateUnlockCountdownTsMsEvent.fromJSONField = function (field) {
2915
- return UpdateUnlockCountdownTsMsEvent.reified().new({
2916
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
2917
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
2918
- previousUnlockCountdownTsMs: (0, reified_1.decodeFromJSONField)("u64", field.previousUnlockCountdownTsMs),
2919
- newUnlockCountdownTsMs: (0, reified_1.decodeFromJSONField)("u64", field.newUnlockCountdownTsMs),
2920
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
2921
- });
2922
- };
2923
- UpdateUnlockCountdownTsMsEvent.fromJSON = function (json) {
2924
- if (json.$typeName !== UpdateUnlockCountdownTsMsEvent.$typeName) {
2925
- throw new Error("not a WithTwoGenerics json object");
2926
- }
2927
- return UpdateUnlockCountdownTsMsEvent.fromJSONField(json);
2928
- };
2929
- UpdateUnlockCountdownTsMsEvent.fromSuiParsedData = function (content) {
2930
- if (content.dataType !== "moveObject") {
2931
- throw new Error("not an object");
2932
- }
2933
- if (!isUpdateUnlockCountdownTsMsEvent(content.type)) {
2934
- throw new Error("object at ".concat(content.fields.id, " is not a UpdateUnlockCountdownTsMsEvent object"));
2935
- }
2936
- return UpdateUnlockCountdownTsMsEvent.fromFieldsWithTypes(content);
2937
- };
2938
- UpdateUnlockCountdownTsMsEvent.fromSuiObjectData = function (data) {
2939
- if (data.bcs) {
2940
- if (data.bcs.dataType !== "moveObject" || !isUpdateUnlockCountdownTsMsEvent(data.bcs.type)) {
2941
- throw new Error("object at is not a UpdateUnlockCountdownTsMsEvent object");
2942
- }
2943
- return UpdateUnlockCountdownTsMsEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
2944
- }
2945
- if (data.content) {
2946
- return UpdateUnlockCountdownTsMsEvent.fromSuiParsedData(data.content);
2947
- }
2948
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
2949
- };
2950
- UpdateUnlockCountdownTsMsEvent.fetch = function (client, id) {
2951
- return __awaiter(this, void 0, void 0, function () {
2952
- var res;
2953
- var _a, _b;
2954
- return __generator(this, function (_c) {
2955
- switch (_c.label) {
2956
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
2957
- case 1:
2958
- res = _c.sent();
2959
- if (res.error) {
2960
- throw new Error("error fetching UpdateUnlockCountdownTsMsEvent object at id ".concat(id, ": ").concat(res.error.code));
2961
- }
2962
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isUpdateUnlockCountdownTsMsEvent(res.data.bcs.type)) {
2963
- throw new Error("object at id ".concat(id, " is not a UpdateUnlockCountdownTsMsEvent object"));
2964
- }
2965
- return [2 /*return*/, UpdateUnlockCountdownTsMsEvent.fromSuiObjectData(res.data)];
2966
- }
2967
- });
2968
- });
2969
- };
2970
- UpdateUnlockCountdownTsMsEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::UpdateUnlockCountdownTsMsEvent");
2971
- UpdateUnlockCountdownTsMsEvent.$numTypeParams = 0;
2972
- UpdateUnlockCountdownTsMsEvent.$isPhantom = [];
2973
- UpdateUnlockCountdownTsMsEvent.cachedBcs = null;
2974
- return UpdateUnlockCountdownTsMsEvent;
2975
- }());
2976
- exports.UpdateUnlockCountdownTsMsEvent = UpdateUnlockCountdownTsMsEvent;
2977
- /* ============================== UpdateIncentiveConfigEvent =============================== */
2978
- function isUpdateIncentiveConfigEvent(type) {
2979
- type = (0, util_1.compressSuiType)(type);
2980
- return type === "".concat(index_1.PKG_V1, "::stake_pool::UpdateIncentiveConfigEvent");
2981
- }
2982
- var UpdateIncentiveConfigEvent = /** @class */ (function () {
2983
- function UpdateIncentiveConfigEvent(typeArgs, fields) {
2984
- this.__StructClass = true;
2985
- this.$typeName = UpdateIncentiveConfigEvent.$typeName;
2986
- this.$isPhantom = UpdateIncentiveConfigEvent.$isPhantom;
2987
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([UpdateIncentiveConfigEvent.$typeName], __read(typeArgs), false));
2988
- this.$typeArgs = typeArgs;
2989
- this.sender = fields.sender;
2990
- this.index = fields.index;
2991
- this.previousIncentiveConfig = fields.previousIncentiveConfig;
2992
- this.newIncentiveConfig = fields.newIncentiveConfig;
2993
- this.u64Padding = fields.u64Padding;
2994
- }
2995
- UpdateIncentiveConfigEvent.reified = function () {
2996
- var _this = this;
2997
- var reifiedBcs = UpdateIncentiveConfigEvent.bcs;
2998
- return {
2999
- typeName: UpdateIncentiveConfigEvent.$typeName,
3000
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([UpdateIncentiveConfigEvent.$typeName], [], false)),
3001
- typeArgs: [],
3002
- isPhantom: UpdateIncentiveConfigEvent.$isPhantom,
3003
- reifiedTypeArgs: [],
3004
- fromFields: function (fields) { return UpdateIncentiveConfigEvent.fromFields(fields); },
3005
- fromFieldsWithTypes: function (item) { return UpdateIncentiveConfigEvent.fromFieldsWithTypes(item); },
3006
- fromBcs: function (data) { return UpdateIncentiveConfigEvent.fromFields(reifiedBcs.parse(data)); },
3007
- bcs: reifiedBcs,
3008
- fromJSONField: function (field) { return UpdateIncentiveConfigEvent.fromJSONField(field); },
3009
- fromJSON: function (json) { return UpdateIncentiveConfigEvent.fromJSON(json); },
3010
- fromSuiParsedData: function (content) { return UpdateIncentiveConfigEvent.fromSuiParsedData(content); },
3011
- fromSuiObjectData: function (content) { return UpdateIncentiveConfigEvent.fromSuiObjectData(content); },
3012
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
3013
- return [2 /*return*/, UpdateIncentiveConfigEvent.fetch(client, id)];
3014
- }); }); },
3015
- new: function (fields) {
3016
- return new UpdateIncentiveConfigEvent([], fields);
3017
- },
3018
- kind: "StructClassReified",
3019
- };
3020
- };
3021
- Object.defineProperty(UpdateIncentiveConfigEvent, "r", {
3022
- get: function () {
3023
- return UpdateIncentiveConfigEvent.reified();
3024
- },
3025
- enumerable: false,
3026
- configurable: true
3027
- });
3028
- UpdateIncentiveConfigEvent.phantom = function () {
3029
- return (0, reified_1.phantom)(UpdateIncentiveConfigEvent.reified());
3030
- };
3031
- Object.defineProperty(UpdateIncentiveConfigEvent, "p", {
3032
- get: function () {
3033
- return UpdateIncentiveConfigEvent.phantom();
3034
- },
3035
- enumerable: false,
3036
- configurable: true
3037
- });
3038
- UpdateIncentiveConfigEvent.instantiateBcs = function () {
3039
- return bcs_1.bcs.struct("UpdateIncentiveConfigEvent", {
3040
- 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); } }),
3041
- index: bcs_1.bcs.u64(),
3042
- previous_incentive_config: IncentiveConfig.bcs,
3043
- new_incentive_config: IncentiveConfig.bcs,
3044
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
3045
- });
3046
- };
3047
- Object.defineProperty(UpdateIncentiveConfigEvent, "bcs", {
3048
- get: function () {
3049
- if (!UpdateIncentiveConfigEvent.cachedBcs) {
3050
- UpdateIncentiveConfigEvent.cachedBcs = UpdateIncentiveConfigEvent.instantiateBcs();
3051
- }
3052
- return UpdateIncentiveConfigEvent.cachedBcs;
3053
- },
3054
- enumerable: false,
3055
- configurable: true
3056
- });
3057
- UpdateIncentiveConfigEvent.fromFields = function (fields) {
3058
- return UpdateIncentiveConfigEvent.reified().new({
3059
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
3060
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
3061
- previousIncentiveConfig: (0, reified_1.decodeFromFields)(IncentiveConfig.reified(), fields.previous_incentive_config),
3062
- newIncentiveConfig: (0, reified_1.decodeFromFields)(IncentiveConfig.reified(), fields.new_incentive_config),
3063
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
3064
- });
3065
- };
3066
- UpdateIncentiveConfigEvent.fromFieldsWithTypes = function (item) {
3067
- if (!isUpdateIncentiveConfigEvent(item.type)) {
3068
- throw new Error("not a UpdateIncentiveConfigEvent type");
3069
- }
3070
- return UpdateIncentiveConfigEvent.reified().new({
3071
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
3072
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
3073
- previousIncentiveConfig: (0, reified_1.decodeFromFieldsWithTypes)(IncentiveConfig.reified(), item.fields.previous_incentive_config),
3074
- newIncentiveConfig: (0, reified_1.decodeFromFieldsWithTypes)(IncentiveConfig.reified(), item.fields.new_incentive_config),
3075
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
3076
- });
3077
- };
3078
- UpdateIncentiveConfigEvent.fromBcs = function (data) {
3079
- return UpdateIncentiveConfigEvent.fromFields(UpdateIncentiveConfigEvent.bcs.parse(data));
3080
- };
3081
- UpdateIncentiveConfigEvent.prototype.toJSONField = function () {
3082
- return {
3083
- sender: this.sender,
3084
- index: this.index.toString(),
3085
- previousIncentiveConfig: this.previousIncentiveConfig.toJSONField(),
3086
- newIncentiveConfig: this.newIncentiveConfig.toJSONField(),
3087
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
3088
- };
3089
- };
3090
- UpdateIncentiveConfigEvent.prototype.toJSON = function () {
3091
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
3092
- };
3093
- UpdateIncentiveConfigEvent.fromJSONField = function (field) {
3094
- return UpdateIncentiveConfigEvent.reified().new({
3095
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
3096
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
3097
- previousIncentiveConfig: (0, reified_1.decodeFromJSONField)(IncentiveConfig.reified(), field.previousIncentiveConfig),
3098
- newIncentiveConfig: (0, reified_1.decodeFromJSONField)(IncentiveConfig.reified(), field.newIncentiveConfig),
3099
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
3100
- });
3101
- };
3102
- UpdateIncentiveConfigEvent.fromJSON = function (json) {
3103
- if (json.$typeName !== UpdateIncentiveConfigEvent.$typeName) {
3104
- throw new Error("not a WithTwoGenerics json object");
3105
- }
3106
- return UpdateIncentiveConfigEvent.fromJSONField(json);
3107
- };
3108
- UpdateIncentiveConfigEvent.fromSuiParsedData = function (content) {
3109
- if (content.dataType !== "moveObject") {
3110
- throw new Error("not an object");
3111
- }
3112
- if (!isUpdateIncentiveConfigEvent(content.type)) {
3113
- throw new Error("object at ".concat(content.fields.id, " is not a UpdateIncentiveConfigEvent object"));
3114
- }
3115
- return UpdateIncentiveConfigEvent.fromFieldsWithTypes(content);
3116
- };
3117
- UpdateIncentiveConfigEvent.fromSuiObjectData = function (data) {
3118
- if (data.bcs) {
3119
- if (data.bcs.dataType !== "moveObject" || !isUpdateIncentiveConfigEvent(data.bcs.type)) {
3120
- throw new Error("object at is not a UpdateIncentiveConfigEvent object");
3121
- }
3122
- return UpdateIncentiveConfigEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
3123
- }
3124
- if (data.content) {
3125
- return UpdateIncentiveConfigEvent.fromSuiParsedData(data.content);
3126
- }
3127
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
3128
- };
3129
- UpdateIncentiveConfigEvent.fetch = function (client, id) {
3130
- return __awaiter(this, void 0, void 0, function () {
3131
- var res;
3132
- var _a, _b;
3133
- return __generator(this, function (_c) {
3134
- switch (_c.label) {
3135
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
3136
- case 1:
3137
- res = _c.sent();
3138
- if (res.error) {
3139
- throw new Error("error fetching UpdateIncentiveConfigEvent object at id ".concat(id, ": ").concat(res.error.code));
3140
- }
3141
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isUpdateIncentiveConfigEvent(res.data.bcs.type)) {
3142
- throw new Error("object at id ".concat(id, " is not a UpdateIncentiveConfigEvent object"));
3143
- }
3144
- return [2 /*return*/, UpdateIncentiveConfigEvent.fromSuiObjectData(res.data)];
3145
- }
3146
- });
3147
- });
3148
- };
3149
- UpdateIncentiveConfigEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::UpdateIncentiveConfigEvent");
3150
- UpdateIncentiveConfigEvent.$numTypeParams = 0;
3151
- UpdateIncentiveConfigEvent.$isPhantom = [];
3152
- UpdateIncentiveConfigEvent.cachedBcs = null;
3153
- return UpdateIncentiveConfigEvent;
3154
- }());
3155
- exports.UpdateIncentiveConfigEvent = UpdateIncentiveConfigEvent;
3156
- /* ============================== DepositIncentiveEvent =============================== */
3157
- function isDepositIncentiveEvent(type) {
3158
- type = (0, util_1.compressSuiType)(type);
3159
- return type === "".concat(index_1.PKG_V1, "::stake_pool::DepositIncentiveEvent");
3160
- }
3161
- var DepositIncentiveEvent = /** @class */ (function () {
3162
- function DepositIncentiveEvent(typeArgs, fields) {
3163
- this.__StructClass = true;
3164
- this.$typeName = DepositIncentiveEvent.$typeName;
3165
- this.$isPhantom = DepositIncentiveEvent.$isPhantom;
3166
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([DepositIncentiveEvent.$typeName], __read(typeArgs), false));
3167
- this.$typeArgs = typeArgs;
3168
- this.sender = fields.sender;
3169
- this.index = fields.index;
3170
- this.incentiveTokenType = fields.incentiveTokenType;
3171
- this.depositAmount = fields.depositAmount;
3172
- this.u64Padding = fields.u64Padding;
3173
- }
3174
- DepositIncentiveEvent.reified = function () {
3175
- var _this = this;
3176
- var reifiedBcs = DepositIncentiveEvent.bcs;
3177
- return {
3178
- typeName: DepositIncentiveEvent.$typeName,
3179
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([DepositIncentiveEvent.$typeName], [], false)),
3180
- typeArgs: [],
3181
- isPhantom: DepositIncentiveEvent.$isPhantom,
3182
- reifiedTypeArgs: [],
3183
- fromFields: function (fields) { return DepositIncentiveEvent.fromFields(fields); },
3184
- fromFieldsWithTypes: function (item) { return DepositIncentiveEvent.fromFieldsWithTypes(item); },
3185
- fromBcs: function (data) { return DepositIncentiveEvent.fromFields(reifiedBcs.parse(data)); },
3186
- bcs: reifiedBcs,
3187
- fromJSONField: function (field) { return DepositIncentiveEvent.fromJSONField(field); },
3188
- fromJSON: function (json) { return DepositIncentiveEvent.fromJSON(json); },
3189
- fromSuiParsedData: function (content) { return DepositIncentiveEvent.fromSuiParsedData(content); },
3190
- fromSuiObjectData: function (content) { return DepositIncentiveEvent.fromSuiObjectData(content); },
3191
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
3192
- return [2 /*return*/, DepositIncentiveEvent.fetch(client, id)];
3193
- }); }); },
3194
- new: function (fields) {
3195
- return new DepositIncentiveEvent([], fields);
3196
- },
3197
- kind: "StructClassReified",
3198
- };
3199
- };
3200
- Object.defineProperty(DepositIncentiveEvent, "r", {
3201
- get: function () {
3202
- return DepositIncentiveEvent.reified();
3203
- },
3204
- enumerable: false,
3205
- configurable: true
3206
- });
3207
- DepositIncentiveEvent.phantom = function () {
3208
- return (0, reified_1.phantom)(DepositIncentiveEvent.reified());
3209
- };
3210
- Object.defineProperty(DepositIncentiveEvent, "p", {
3211
- get: function () {
3212
- return DepositIncentiveEvent.phantom();
3213
- },
3214
- enumerable: false,
3215
- configurable: true
3216
- });
3217
- DepositIncentiveEvent.instantiateBcs = function () {
3218
- return bcs_1.bcs.struct("DepositIncentiveEvent", {
3219
- 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); } }),
3220
- index: bcs_1.bcs.u64(),
3221
- incentive_token_type: structs_1.TypeName.bcs,
3222
- deposit_amount: bcs_1.bcs.u64(),
3223
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
3224
- });
3225
- };
3226
- Object.defineProperty(DepositIncentiveEvent, "bcs", {
3227
- get: function () {
3228
- if (!DepositIncentiveEvent.cachedBcs) {
3229
- DepositIncentiveEvent.cachedBcs = DepositIncentiveEvent.instantiateBcs();
3230
- }
3231
- return DepositIncentiveEvent.cachedBcs;
3232
- },
3233
- enumerable: false,
3234
- configurable: true
3235
- });
3236
- DepositIncentiveEvent.fromFields = function (fields) {
3237
- return DepositIncentiveEvent.reified().new({
3238
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
3239
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
3240
- incentiveTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token_type),
3241
- depositAmount: (0, reified_1.decodeFromFields)("u64", fields.deposit_amount),
3242
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
3243
- });
3244
- };
3245
- DepositIncentiveEvent.fromFieldsWithTypes = function (item) {
3246
- if (!isDepositIncentiveEvent(item.type)) {
3247
- throw new Error("not a DepositIncentiveEvent type");
3248
- }
3249
- return DepositIncentiveEvent.reified().new({
3250
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
3251
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
3252
- incentiveTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token_type),
3253
- depositAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.deposit_amount),
3254
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
3255
- });
3256
- };
3257
- DepositIncentiveEvent.fromBcs = function (data) {
3258
- return DepositIncentiveEvent.fromFields(DepositIncentiveEvent.bcs.parse(data));
3259
- };
3260
- DepositIncentiveEvent.prototype.toJSONField = function () {
3261
- return {
3262
- sender: this.sender,
3263
- index: this.index.toString(),
3264
- incentiveTokenType: this.incentiveTokenType.toJSONField(),
3265
- depositAmount: this.depositAmount.toString(),
3266
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
3267
- };
3268
- };
3269
- DepositIncentiveEvent.prototype.toJSON = function () {
3270
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
3271
- };
3272
- DepositIncentiveEvent.fromJSONField = function (field) {
3273
- return DepositIncentiveEvent.reified().new({
3274
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
3275
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
3276
- incentiveTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveTokenType),
3277
- depositAmount: (0, reified_1.decodeFromJSONField)("u64", field.depositAmount),
3278
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
3279
- });
3280
- };
3281
- DepositIncentiveEvent.fromJSON = function (json) {
3282
- if (json.$typeName !== DepositIncentiveEvent.$typeName) {
3283
- throw new Error("not a WithTwoGenerics json object");
3284
- }
3285
- return DepositIncentiveEvent.fromJSONField(json);
3286
- };
3287
- DepositIncentiveEvent.fromSuiParsedData = function (content) {
3288
- if (content.dataType !== "moveObject") {
3289
- throw new Error("not an object");
3290
- }
3291
- if (!isDepositIncentiveEvent(content.type)) {
3292
- throw new Error("object at ".concat(content.fields.id, " is not a DepositIncentiveEvent object"));
3293
- }
3294
- return DepositIncentiveEvent.fromFieldsWithTypes(content);
3295
- };
3296
- DepositIncentiveEvent.fromSuiObjectData = function (data) {
3297
- if (data.bcs) {
3298
- if (data.bcs.dataType !== "moveObject" || !isDepositIncentiveEvent(data.bcs.type)) {
3299
- throw new Error("object at is not a DepositIncentiveEvent object");
3300
- }
3301
- return DepositIncentiveEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
3302
- }
3303
- if (data.content) {
3304
- return DepositIncentiveEvent.fromSuiParsedData(data.content);
3305
- }
3306
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
3307
- };
3308
- DepositIncentiveEvent.fetch = function (client, id) {
3309
- return __awaiter(this, void 0, void 0, function () {
3310
- var res;
3311
- var _a, _b;
3312
- return __generator(this, function (_c) {
3313
- switch (_c.label) {
3314
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
3315
- case 1:
3316
- res = _c.sent();
3317
- if (res.error) {
3318
- throw new Error("error fetching DepositIncentiveEvent object at id ".concat(id, ": ").concat(res.error.code));
3319
- }
3320
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isDepositIncentiveEvent(res.data.bcs.type)) {
3321
- throw new Error("object at id ".concat(id, " is not a DepositIncentiveEvent object"));
3322
- }
3323
- return [2 /*return*/, DepositIncentiveEvent.fromSuiObjectData(res.data)];
3324
- }
3325
- });
3326
- });
3327
- };
3328
- DepositIncentiveEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::DepositIncentiveEvent");
3329
- DepositIncentiveEvent.$numTypeParams = 0;
3330
- DepositIncentiveEvent.$isPhantom = [];
3331
- DepositIncentiveEvent.cachedBcs = null;
3332
- return DepositIncentiveEvent;
3333
- }());
3334
- exports.DepositIncentiveEvent = DepositIncentiveEvent;
3335
- /* ============================== WithdrawIncentiveEvent =============================== */
3336
- function isWithdrawIncentiveEvent(type) {
3337
- type = (0, util_1.compressSuiType)(type);
3338
- return type === "".concat(index_1.PKG_V1, "::stake_pool::WithdrawIncentiveEvent");
3339
- }
3340
- var WithdrawIncentiveEvent = /** @class */ (function () {
3341
- function WithdrawIncentiveEvent(typeArgs, fields) {
3342
- this.__StructClass = true;
3343
- this.$typeName = WithdrawIncentiveEvent.$typeName;
3344
- this.$isPhantom = WithdrawIncentiveEvent.$isPhantom;
3345
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([WithdrawIncentiveEvent.$typeName], __read(typeArgs), false));
3346
- this.$typeArgs = typeArgs;
3347
- this.sender = fields.sender;
3348
- this.index = fields.index;
3349
- this.incentiveTokenType = fields.incentiveTokenType;
3350
- this.withdrawalAmount = fields.withdrawalAmount;
3351
- this.u64Padding = fields.u64Padding;
3352
- }
3353
- WithdrawIncentiveEvent.reified = function () {
3354
- var _this = this;
3355
- var reifiedBcs = WithdrawIncentiveEvent.bcs;
3356
- return {
3357
- typeName: WithdrawIncentiveEvent.$typeName,
3358
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([WithdrawIncentiveEvent.$typeName], [], false)),
3359
- typeArgs: [],
3360
- isPhantom: WithdrawIncentiveEvent.$isPhantom,
3361
- reifiedTypeArgs: [],
3362
- fromFields: function (fields) { return WithdrawIncentiveEvent.fromFields(fields); },
3363
- fromFieldsWithTypes: function (item) { return WithdrawIncentiveEvent.fromFieldsWithTypes(item); },
3364
- fromBcs: function (data) { return WithdrawIncentiveEvent.fromFields(reifiedBcs.parse(data)); },
3365
- bcs: reifiedBcs,
3366
- fromJSONField: function (field) { return WithdrawIncentiveEvent.fromJSONField(field); },
3367
- fromJSON: function (json) { return WithdrawIncentiveEvent.fromJSON(json); },
3368
- fromSuiParsedData: function (content) { return WithdrawIncentiveEvent.fromSuiParsedData(content); },
3369
- fromSuiObjectData: function (content) { return WithdrawIncentiveEvent.fromSuiObjectData(content); },
3370
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
3371
- return [2 /*return*/, WithdrawIncentiveEvent.fetch(client, id)];
3372
- }); }); },
3373
- new: function (fields) {
3374
- return new WithdrawIncentiveEvent([], fields);
3375
- },
3376
- kind: "StructClassReified",
3377
- };
3378
- };
3379
- Object.defineProperty(WithdrawIncentiveEvent, "r", {
3380
- get: function () {
3381
- return WithdrawIncentiveEvent.reified();
3382
- },
3383
- enumerable: false,
3384
- configurable: true
3385
- });
3386
- WithdrawIncentiveEvent.phantom = function () {
3387
- return (0, reified_1.phantom)(WithdrawIncentiveEvent.reified());
3388
- };
3389
- Object.defineProperty(WithdrawIncentiveEvent, "p", {
3390
- get: function () {
3391
- return WithdrawIncentiveEvent.phantom();
3392
- },
3393
- enumerable: false,
3394
- configurable: true
3395
- });
3396
- WithdrawIncentiveEvent.instantiateBcs = function () {
3397
- return bcs_1.bcs.struct("WithdrawIncentiveEvent", {
3398
- 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); } }),
3399
- index: bcs_1.bcs.u64(),
3400
- incentive_token_type: structs_1.TypeName.bcs,
3401
- withdrawal_amount: bcs_1.bcs.u64(),
3402
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
3403
- });
3404
- };
3405
- Object.defineProperty(WithdrawIncentiveEvent, "bcs", {
3406
- get: function () {
3407
- if (!WithdrawIncentiveEvent.cachedBcs) {
3408
- WithdrawIncentiveEvent.cachedBcs = WithdrawIncentiveEvent.instantiateBcs();
3409
- }
3410
- return WithdrawIncentiveEvent.cachedBcs;
3411
- },
3412
- enumerable: false,
3413
- configurable: true
3414
- });
3415
- WithdrawIncentiveEvent.fromFields = function (fields) {
3416
- return WithdrawIncentiveEvent.reified().new({
3417
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
3418
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
3419
- incentiveTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token_type),
3420
- withdrawalAmount: (0, reified_1.decodeFromFields)("u64", fields.withdrawal_amount),
3421
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
3422
- });
3423
- };
3424
- WithdrawIncentiveEvent.fromFieldsWithTypes = function (item) {
3425
- if (!isWithdrawIncentiveEvent(item.type)) {
3426
- throw new Error("not a WithdrawIncentiveEvent type");
3427
- }
3428
- return WithdrawIncentiveEvent.reified().new({
3429
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
3430
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
3431
- incentiveTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token_type),
3432
- withdrawalAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.withdrawal_amount),
3433
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
3434
- });
3435
- };
3436
- WithdrawIncentiveEvent.fromBcs = function (data) {
3437
- return WithdrawIncentiveEvent.fromFields(WithdrawIncentiveEvent.bcs.parse(data));
3438
- };
3439
- WithdrawIncentiveEvent.prototype.toJSONField = function () {
3440
- return {
3441
- sender: this.sender,
3442
- index: this.index.toString(),
3443
- incentiveTokenType: this.incentiveTokenType.toJSONField(),
3444
- withdrawalAmount: this.withdrawalAmount.toString(),
3445
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
3446
- };
3447
- };
3448
- WithdrawIncentiveEvent.prototype.toJSON = function () {
3449
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
3450
- };
3451
- WithdrawIncentiveEvent.fromJSONField = function (field) {
3452
- return WithdrawIncentiveEvent.reified().new({
3453
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
3454
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
3455
- incentiveTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveTokenType),
3456
- withdrawalAmount: (0, reified_1.decodeFromJSONField)("u64", field.withdrawalAmount),
3457
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
3458
- });
3459
- };
3460
- WithdrawIncentiveEvent.fromJSON = function (json) {
3461
- if (json.$typeName !== WithdrawIncentiveEvent.$typeName) {
3462
- throw new Error("not a WithTwoGenerics json object");
3463
- }
3464
- return WithdrawIncentiveEvent.fromJSONField(json);
3465
- };
3466
- WithdrawIncentiveEvent.fromSuiParsedData = function (content) {
3467
- if (content.dataType !== "moveObject") {
3468
- throw new Error("not an object");
3469
- }
3470
- if (!isWithdrawIncentiveEvent(content.type)) {
3471
- throw new Error("object at ".concat(content.fields.id, " is not a WithdrawIncentiveEvent object"));
3472
- }
3473
- return WithdrawIncentiveEvent.fromFieldsWithTypes(content);
3474
- };
3475
- WithdrawIncentiveEvent.fromSuiObjectData = function (data) {
3476
- if (data.bcs) {
3477
- if (data.bcs.dataType !== "moveObject" || !isWithdrawIncentiveEvent(data.bcs.type)) {
3478
- throw new Error("object at is not a WithdrawIncentiveEvent object");
3479
- }
3480
- return WithdrawIncentiveEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
3481
- }
3482
- if (data.content) {
3483
- return WithdrawIncentiveEvent.fromSuiParsedData(data.content);
3484
- }
3485
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
3486
- };
3487
- WithdrawIncentiveEvent.fetch = function (client, id) {
3488
- return __awaiter(this, void 0, void 0, function () {
3489
- var res;
3490
- var _a, _b;
3491
- return __generator(this, function (_c) {
3492
- switch (_c.label) {
3493
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
3494
- case 1:
3495
- res = _c.sent();
3496
- if (res.error) {
3497
- throw new Error("error fetching WithdrawIncentiveEvent object at id ".concat(id, ": ").concat(res.error.code));
3498
- }
3499
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isWithdrawIncentiveEvent(res.data.bcs.type)) {
3500
- throw new Error("object at id ".concat(id, " is not a WithdrawIncentiveEvent object"));
3501
- }
3502
- return [2 /*return*/, WithdrawIncentiveEvent.fromSuiObjectData(res.data)];
3503
- }
3504
- });
3505
- });
3506
- };
3507
- WithdrawIncentiveEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::WithdrawIncentiveEvent");
3508
- WithdrawIncentiveEvent.$numTypeParams = 0;
3509
- WithdrawIncentiveEvent.$isPhantom = [];
3510
- WithdrawIncentiveEvent.cachedBcs = null;
3511
- return WithdrawIncentiveEvent;
3512
- }());
3513
- exports.WithdrawIncentiveEvent = WithdrawIncentiveEvent;
3514
- /* ============================== StakeEvent =============================== */
3515
- function isStakeEvent(type) {
3516
- type = (0, util_1.compressSuiType)(type);
3517
- return type === "".concat(index_1.PKG_V1, "::stake_pool::StakeEvent");
3518
- }
3519
- var StakeEvent = /** @class */ (function () {
3520
- function StakeEvent(typeArgs, fields) {
3521
- this.__StructClass = true;
3522
- this.$typeName = StakeEvent.$typeName;
3523
- this.$isPhantom = StakeEvent.$isPhantom;
3524
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([StakeEvent.$typeName], __read(typeArgs), false));
3525
- this.$typeArgs = typeArgs;
3526
- this.sender = fields.sender;
3527
- this.index = fields.index;
3528
- this.lpTokenType = fields.lpTokenType;
3529
- this.stakeAmount = fields.stakeAmount;
3530
- this.userShareId = fields.userShareId;
3531
- this.stakeTsMs = fields.stakeTsMs;
3532
- this.lastIncentivePriceIndex = fields.lastIncentivePriceIndex;
3533
- this.u64Padding = fields.u64Padding;
3534
- }
3535
- StakeEvent.reified = function () {
3536
- var _this = this;
3537
- var reifiedBcs = StakeEvent.bcs;
3538
- return {
3539
- typeName: StakeEvent.$typeName,
3540
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([StakeEvent.$typeName], [], false)),
3541
- typeArgs: [],
3542
- isPhantom: StakeEvent.$isPhantom,
3543
- reifiedTypeArgs: [],
3544
- fromFields: function (fields) { return StakeEvent.fromFields(fields); },
3545
- fromFieldsWithTypes: function (item) { return StakeEvent.fromFieldsWithTypes(item); },
3546
- fromBcs: function (data) { return StakeEvent.fromFields(reifiedBcs.parse(data)); },
3547
- bcs: reifiedBcs,
3548
- fromJSONField: function (field) { return StakeEvent.fromJSONField(field); },
3549
- fromJSON: function (json) { return StakeEvent.fromJSON(json); },
3550
- fromSuiParsedData: function (content) { return StakeEvent.fromSuiParsedData(content); },
3551
- fromSuiObjectData: function (content) { return StakeEvent.fromSuiObjectData(content); },
3552
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
3553
- return [2 /*return*/, StakeEvent.fetch(client, id)];
3554
- }); }); },
3555
- new: function (fields) {
3556
- return new StakeEvent([], fields);
3557
- },
3558
- kind: "StructClassReified",
3559
- };
3560
- };
3561
- Object.defineProperty(StakeEvent, "r", {
3562
- get: function () {
3563
- return StakeEvent.reified();
3564
- },
3565
- enumerable: false,
3566
- configurable: true
3567
- });
3568
- StakeEvent.phantom = function () {
3569
- return (0, reified_1.phantom)(StakeEvent.reified());
3570
- };
3571
- Object.defineProperty(StakeEvent, "p", {
3572
- get: function () {
3573
- return StakeEvent.phantom();
3574
- },
3575
- enumerable: false,
3576
- configurable: true
3577
- });
3578
- StakeEvent.instantiateBcs = function () {
3579
- return bcs_1.bcs.struct("StakeEvent", {
3580
- 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); } }),
3581
- index: bcs_1.bcs.u64(),
3582
- lp_token_type: structs_1.TypeName.bcs,
3583
- stake_amount: bcs_1.bcs.u64(),
3584
- user_share_id: bcs_1.bcs.u64(),
3585
- stake_ts_ms: bcs_1.bcs.u64(),
3586
- last_incentive_price_index: structs_3.VecMap.bcs(structs_1.TypeName.bcs, bcs_1.bcs.u64()),
3587
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
3588
- });
3589
- };
3590
- Object.defineProperty(StakeEvent, "bcs", {
3591
- get: function () {
3592
- if (!StakeEvent.cachedBcs) {
3593
- StakeEvent.cachedBcs = StakeEvent.instantiateBcs();
3594
- }
3595
- return StakeEvent.cachedBcs;
3596
- },
3597
- enumerable: false,
3598
- configurable: true
3599
- });
3600
- StakeEvent.fromFields = function (fields) {
3601
- return StakeEvent.reified().new({
3602
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
3603
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
3604
- lpTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.lp_token_type),
3605
- stakeAmount: (0, reified_1.decodeFromFields)("u64", fields.stake_amount),
3606
- userShareId: (0, reified_1.decodeFromFields)("u64", fields.user_share_id),
3607
- stakeTsMs: (0, reified_1.decodeFromFields)("u64", fields.stake_ts_ms),
3608
- lastIncentivePriceIndex: (0, reified_1.decodeFromFields)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), fields.last_incentive_price_index),
3609
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
3610
- });
3611
- };
3612
- StakeEvent.fromFieldsWithTypes = function (item) {
3613
- if (!isStakeEvent(item.type)) {
3614
- throw new Error("not a StakeEvent type");
3615
- }
3616
- return StakeEvent.reified().new({
3617
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
3618
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
3619
- lpTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.lp_token_type),
3620
- stakeAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.stake_amount),
3621
- userShareId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.user_share_id),
3622
- stakeTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.stake_ts_ms),
3623
- lastIncentivePriceIndex: (0, reified_1.decodeFromFieldsWithTypes)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), item.fields.last_incentive_price_index),
3624
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
3625
- });
3626
- };
3627
- StakeEvent.fromBcs = function (data) {
3628
- return StakeEvent.fromFields(StakeEvent.bcs.parse(data));
3629
- };
3630
- StakeEvent.prototype.toJSONField = function () {
3631
- return {
3632
- sender: this.sender,
3633
- index: this.index.toString(),
3634
- lpTokenType: this.lpTokenType.toJSONField(),
3635
- stakeAmount: this.stakeAmount.toString(),
3636
- userShareId: this.userShareId.toString(),
3637
- stakeTsMs: this.stakeTsMs.toString(),
3638
- lastIncentivePriceIndex: this.lastIncentivePriceIndex.toJSONField(),
3639
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
3640
- };
3641
- };
3642
- StakeEvent.prototype.toJSON = function () {
3643
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
3644
- };
3645
- StakeEvent.fromJSONField = function (field) {
3646
- return StakeEvent.reified().new({
3647
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
3648
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
3649
- lpTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.lpTokenType),
3650
- stakeAmount: (0, reified_1.decodeFromJSONField)("u64", field.stakeAmount),
3651
- userShareId: (0, reified_1.decodeFromJSONField)("u64", field.userShareId),
3652
- stakeTsMs: (0, reified_1.decodeFromJSONField)("u64", field.stakeTsMs),
3653
- lastIncentivePriceIndex: (0, reified_1.decodeFromJSONField)(structs_3.VecMap.reified(structs_1.TypeName.reified(), "u64"), field.lastIncentivePriceIndex),
3654
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
3655
- });
3656
- };
3657
- StakeEvent.fromJSON = function (json) {
3658
- if (json.$typeName !== StakeEvent.$typeName) {
3659
- throw new Error("not a WithTwoGenerics json object");
3660
- }
3661
- return StakeEvent.fromJSONField(json);
3662
- };
3663
- StakeEvent.fromSuiParsedData = function (content) {
3664
- if (content.dataType !== "moveObject") {
3665
- throw new Error("not an object");
3666
- }
3667
- if (!isStakeEvent(content.type)) {
3668
- throw new Error("object at ".concat(content.fields.id, " is not a StakeEvent object"));
3669
- }
3670
- return StakeEvent.fromFieldsWithTypes(content);
3671
- };
3672
- StakeEvent.fromSuiObjectData = function (data) {
3673
- if (data.bcs) {
3674
- if (data.bcs.dataType !== "moveObject" || !isStakeEvent(data.bcs.type)) {
3675
- throw new Error("object at is not a StakeEvent object");
3676
- }
3677
- return StakeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
3678
- }
3679
- if (data.content) {
3680
- return StakeEvent.fromSuiParsedData(data.content);
3681
- }
3682
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
3683
- };
3684
- StakeEvent.fetch = function (client, id) {
3685
- return __awaiter(this, void 0, void 0, function () {
3686
- var res;
3687
- var _a, _b;
3688
- return __generator(this, function (_c) {
3689
- switch (_c.label) {
3690
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
3691
- case 1:
3692
- res = _c.sent();
3693
- if (res.error) {
3694
- throw new Error("error fetching StakeEvent object at id ".concat(id, ": ").concat(res.error.code));
3695
- }
3696
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isStakeEvent(res.data.bcs.type)) {
3697
- throw new Error("object at id ".concat(id, " is not a StakeEvent object"));
3698
- }
3699
- return [2 /*return*/, StakeEvent.fromSuiObjectData(res.data)];
3700
- }
3701
- });
3702
- });
3703
- };
3704
- StakeEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::StakeEvent");
3705
- StakeEvent.$numTypeParams = 0;
3706
- StakeEvent.$isPhantom = [];
3707
- StakeEvent.cachedBcs = null;
3708
- return StakeEvent;
3709
- }());
3710
- exports.StakeEvent = StakeEvent;
3711
- /* ============================== UpdatePoolInfoU64PaddingEvent =============================== */
3712
- function isUpdatePoolInfoU64PaddingEvent(type) {
3713
- type = (0, util_1.compressSuiType)(type);
3714
- return type === "".concat(index_1.PKG_V1, "::stake_pool::UpdatePoolInfoU64PaddingEvent");
3715
- }
3716
- var UpdatePoolInfoU64PaddingEvent = /** @class */ (function () {
3717
- function UpdatePoolInfoU64PaddingEvent(typeArgs, fields) {
3718
- this.__StructClass = true;
3719
- this.$typeName = UpdatePoolInfoU64PaddingEvent.$typeName;
3720
- this.$isPhantom = UpdatePoolInfoU64PaddingEvent.$isPhantom;
3721
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([UpdatePoolInfoU64PaddingEvent.$typeName], __read(typeArgs), false));
3722
- this.$typeArgs = typeArgs;
3723
- this.sender = fields.sender;
3724
- this.index = fields.index;
3725
- this.u64Padding = fields.u64Padding;
3726
- }
3727
- UpdatePoolInfoU64PaddingEvent.reified = function () {
3728
- var _this = this;
3729
- var reifiedBcs = UpdatePoolInfoU64PaddingEvent.bcs;
3730
- return {
3731
- typeName: UpdatePoolInfoU64PaddingEvent.$typeName,
3732
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([UpdatePoolInfoU64PaddingEvent.$typeName], [], false)),
3733
- typeArgs: [],
3734
- isPhantom: UpdatePoolInfoU64PaddingEvent.$isPhantom,
3735
- reifiedTypeArgs: [],
3736
- fromFields: function (fields) { return UpdatePoolInfoU64PaddingEvent.fromFields(fields); },
3737
- fromFieldsWithTypes: function (item) { return UpdatePoolInfoU64PaddingEvent.fromFieldsWithTypes(item); },
3738
- fromBcs: function (data) { return UpdatePoolInfoU64PaddingEvent.fromFields(reifiedBcs.parse(data)); },
3739
- bcs: reifiedBcs,
3740
- fromJSONField: function (field) { return UpdatePoolInfoU64PaddingEvent.fromJSONField(field); },
3741
- fromJSON: function (json) { return UpdatePoolInfoU64PaddingEvent.fromJSON(json); },
3742
- fromSuiParsedData: function (content) { return UpdatePoolInfoU64PaddingEvent.fromSuiParsedData(content); },
3743
- fromSuiObjectData: function (content) { return UpdatePoolInfoU64PaddingEvent.fromSuiObjectData(content); },
3744
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
3745
- return [2 /*return*/, UpdatePoolInfoU64PaddingEvent.fetch(client, id)];
3746
- }); }); },
3747
- new: function (fields) {
3748
- return new UpdatePoolInfoU64PaddingEvent([], fields);
3749
- },
3750
- kind: "StructClassReified",
3751
- };
3752
- };
3753
- Object.defineProperty(UpdatePoolInfoU64PaddingEvent, "r", {
3754
- get: function () {
3755
- return UpdatePoolInfoU64PaddingEvent.reified();
3756
- },
3757
- enumerable: false,
3758
- configurable: true
3759
- });
3760
- UpdatePoolInfoU64PaddingEvent.phantom = function () {
3761
- return (0, reified_1.phantom)(UpdatePoolInfoU64PaddingEvent.reified());
3762
- };
3763
- Object.defineProperty(UpdatePoolInfoU64PaddingEvent, "p", {
3764
- get: function () {
3765
- return UpdatePoolInfoU64PaddingEvent.phantom();
3766
- },
3767
- enumerable: false,
3768
- configurable: true
3769
- });
3770
- UpdatePoolInfoU64PaddingEvent.instantiateBcs = function () {
3771
- return bcs_1.bcs.struct("UpdatePoolInfoU64PaddingEvent", {
3772
- 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); } }),
3773
- index: bcs_1.bcs.u64(),
3774
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
3775
- });
3776
- };
3777
- Object.defineProperty(UpdatePoolInfoU64PaddingEvent, "bcs", {
3778
- get: function () {
3779
- if (!UpdatePoolInfoU64PaddingEvent.cachedBcs) {
3780
- UpdatePoolInfoU64PaddingEvent.cachedBcs = UpdatePoolInfoU64PaddingEvent.instantiateBcs();
3781
- }
3782
- return UpdatePoolInfoU64PaddingEvent.cachedBcs;
3783
- },
3784
- enumerable: false,
3785
- configurable: true
3786
- });
3787
- UpdatePoolInfoU64PaddingEvent.fromFields = function (fields) {
3788
- return UpdatePoolInfoU64PaddingEvent.reified().new({
3789
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
3790
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
3791
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
3792
- });
3793
- };
3794
- UpdatePoolInfoU64PaddingEvent.fromFieldsWithTypes = function (item) {
3795
- if (!isUpdatePoolInfoU64PaddingEvent(item.type)) {
3796
- throw new Error("not a UpdatePoolInfoU64PaddingEvent type");
3797
- }
3798
- return UpdatePoolInfoU64PaddingEvent.reified().new({
3799
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
3800
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
3801
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
3802
- });
3803
- };
3804
- UpdatePoolInfoU64PaddingEvent.fromBcs = function (data) {
3805
- return UpdatePoolInfoU64PaddingEvent.fromFields(UpdatePoolInfoU64PaddingEvent.bcs.parse(data));
3806
- };
3807
- UpdatePoolInfoU64PaddingEvent.prototype.toJSONField = function () {
3808
- return {
3809
- sender: this.sender,
3810
- index: this.index.toString(),
3811
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
3812
- };
3813
- };
3814
- UpdatePoolInfoU64PaddingEvent.prototype.toJSON = function () {
3815
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
3816
- };
3817
- UpdatePoolInfoU64PaddingEvent.fromJSONField = function (field) {
3818
- return UpdatePoolInfoU64PaddingEvent.reified().new({
3819
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
3820
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
3821
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
3822
- });
3823
- };
3824
- UpdatePoolInfoU64PaddingEvent.fromJSON = function (json) {
3825
- if (json.$typeName !== UpdatePoolInfoU64PaddingEvent.$typeName) {
3826
- throw new Error("not a WithTwoGenerics json object");
3827
- }
3828
- return UpdatePoolInfoU64PaddingEvent.fromJSONField(json);
3829
- };
3830
- UpdatePoolInfoU64PaddingEvent.fromSuiParsedData = function (content) {
3831
- if (content.dataType !== "moveObject") {
3832
- throw new Error("not an object");
3833
- }
3834
- if (!isUpdatePoolInfoU64PaddingEvent(content.type)) {
3835
- throw new Error("object at ".concat(content.fields.id, " is not a UpdatePoolInfoU64PaddingEvent object"));
3836
- }
3837
- return UpdatePoolInfoU64PaddingEvent.fromFieldsWithTypes(content);
3838
- };
3839
- UpdatePoolInfoU64PaddingEvent.fromSuiObjectData = function (data) {
3840
- if (data.bcs) {
3841
- if (data.bcs.dataType !== "moveObject" || !isUpdatePoolInfoU64PaddingEvent(data.bcs.type)) {
3842
- throw new Error("object at is not a UpdatePoolInfoU64PaddingEvent object");
3843
- }
3844
- return UpdatePoolInfoU64PaddingEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
3845
- }
3846
- if (data.content) {
3847
- return UpdatePoolInfoU64PaddingEvent.fromSuiParsedData(data.content);
3848
- }
3849
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
3850
- };
3851
- UpdatePoolInfoU64PaddingEvent.fetch = function (client, id) {
3852
- return __awaiter(this, void 0, void 0, function () {
3853
- var res;
3854
- var _a, _b;
3855
- return __generator(this, function (_c) {
3856
- switch (_c.label) {
3857
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
3858
- case 1:
3859
- res = _c.sent();
3860
- if (res.error) {
3861
- throw new Error("error fetching UpdatePoolInfoU64PaddingEvent object at id ".concat(id, ": ").concat(res.error.code));
3862
- }
3863
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isUpdatePoolInfoU64PaddingEvent(res.data.bcs.type)) {
3864
- throw new Error("object at id ".concat(id, " is not a UpdatePoolInfoU64PaddingEvent object"));
3865
- }
3866
- return [2 /*return*/, UpdatePoolInfoU64PaddingEvent.fromSuiObjectData(res.data)];
3867
- }
3868
- });
3869
- });
3870
- };
3871
- UpdatePoolInfoU64PaddingEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::UpdatePoolInfoU64PaddingEvent");
3872
- UpdatePoolInfoU64PaddingEvent.$numTypeParams = 0;
3873
- UpdatePoolInfoU64PaddingEvent.$isPhantom = [];
3874
- UpdatePoolInfoU64PaddingEvent.cachedBcs = null;
3875
- return UpdatePoolInfoU64PaddingEvent;
3876
- }());
3877
- exports.UpdatePoolInfoU64PaddingEvent = UpdatePoolInfoU64PaddingEvent;
3878
- /* ============================== SnapshotEvent =============================== */
3879
- function isSnapshotEvent(type) {
3880
- type = (0, util_1.compressSuiType)(type);
3881
- return type === "".concat(index_1.PKG_V1, "::stake_pool::SnapshotEvent");
3882
- }
3883
- var SnapshotEvent = /** @class */ (function () {
3884
- function SnapshotEvent(typeArgs, fields) {
3885
- this.__StructClass = true;
3886
- this.$typeName = SnapshotEvent.$typeName;
3887
- this.$isPhantom = SnapshotEvent.$isPhantom;
3888
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([SnapshotEvent.$typeName], __read(typeArgs), false));
3889
- this.$typeArgs = typeArgs;
3890
- this.sender = fields.sender;
3891
- this.index = fields.index;
3892
- this.userShareId = fields.userShareId;
3893
- this.shares = fields.shares;
3894
- this.tlpPrice = fields.tlpPrice;
3895
- this.lastTsMs = fields.lastTsMs;
3896
- this.currentTsMs = fields.currentTsMs;
3897
- this.exp = fields.exp;
3898
- this.u64Padding = fields.u64Padding;
3899
- }
3900
- SnapshotEvent.reified = function () {
3901
- var _this = this;
3902
- var reifiedBcs = SnapshotEvent.bcs;
3903
- return {
3904
- typeName: SnapshotEvent.$typeName,
3905
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([SnapshotEvent.$typeName], [], false)),
3906
- typeArgs: [],
3907
- isPhantom: SnapshotEvent.$isPhantom,
3908
- reifiedTypeArgs: [],
3909
- fromFields: function (fields) { return SnapshotEvent.fromFields(fields); },
3910
- fromFieldsWithTypes: function (item) { return SnapshotEvent.fromFieldsWithTypes(item); },
3911
- fromBcs: function (data) { return SnapshotEvent.fromFields(reifiedBcs.parse(data)); },
3912
- bcs: reifiedBcs,
3913
- fromJSONField: function (field) { return SnapshotEvent.fromJSONField(field); },
3914
- fromJSON: function (json) { return SnapshotEvent.fromJSON(json); },
3915
- fromSuiParsedData: function (content) { return SnapshotEvent.fromSuiParsedData(content); },
3916
- fromSuiObjectData: function (content) { return SnapshotEvent.fromSuiObjectData(content); },
3917
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
3918
- return [2 /*return*/, SnapshotEvent.fetch(client, id)];
3919
- }); }); },
3920
- new: function (fields) {
3921
- return new SnapshotEvent([], fields);
3922
- },
3923
- kind: "StructClassReified",
3924
- };
3925
- };
3926
- Object.defineProperty(SnapshotEvent, "r", {
3927
- get: function () {
3928
- return SnapshotEvent.reified();
3929
- },
3930
- enumerable: false,
3931
- configurable: true
3932
- });
3933
- SnapshotEvent.phantom = function () {
3934
- return (0, reified_1.phantom)(SnapshotEvent.reified());
3935
- };
3936
- Object.defineProperty(SnapshotEvent, "p", {
3937
- get: function () {
3938
- return SnapshotEvent.phantom();
3939
- },
3940
- enumerable: false,
3941
- configurable: true
3942
- });
3943
- SnapshotEvent.instantiateBcs = function () {
3944
- return bcs_1.bcs.struct("SnapshotEvent", {
3945
- 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); } }),
3946
- index: bcs_1.bcs.u64(),
3947
- user_share_id: bcs_1.bcs.u64(),
3948
- shares: bcs_1.bcs.u64(),
3949
- tlp_price: bcs_1.bcs.u64(),
3950
- last_ts_ms: bcs_1.bcs.u64(),
3951
- current_ts_ms: bcs_1.bcs.u64(),
3952
- exp: bcs_1.bcs.u64(),
3953
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
3954
- });
3955
- };
3956
- Object.defineProperty(SnapshotEvent, "bcs", {
3957
- get: function () {
3958
- if (!SnapshotEvent.cachedBcs) {
3959
- SnapshotEvent.cachedBcs = SnapshotEvent.instantiateBcs();
3960
- }
3961
- return SnapshotEvent.cachedBcs;
3962
- },
3963
- enumerable: false,
3964
- configurable: true
3965
- });
3966
- SnapshotEvent.fromFields = function (fields) {
3967
- return SnapshotEvent.reified().new({
3968
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
3969
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
3970
- userShareId: (0, reified_1.decodeFromFields)("u64", fields.user_share_id),
3971
- shares: (0, reified_1.decodeFromFields)("u64", fields.shares),
3972
- tlpPrice: (0, reified_1.decodeFromFields)("u64", fields.tlp_price),
3973
- lastTsMs: (0, reified_1.decodeFromFields)("u64", fields.last_ts_ms),
3974
- currentTsMs: (0, reified_1.decodeFromFields)("u64", fields.current_ts_ms),
3975
- exp: (0, reified_1.decodeFromFields)("u64", fields.exp),
3976
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
3977
- });
3978
- };
3979
- SnapshotEvent.fromFieldsWithTypes = function (item) {
3980
- if (!isSnapshotEvent(item.type)) {
3981
- throw new Error("not a SnapshotEvent type");
3982
- }
3983
- return SnapshotEvent.reified().new({
3984
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
3985
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
3986
- userShareId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.user_share_id),
3987
- shares: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.shares),
3988
- tlpPrice: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.tlp_price),
3989
- lastTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.last_ts_ms),
3990
- currentTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.current_ts_ms),
3991
- exp: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.exp),
3992
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
3993
- });
3994
- };
3995
- SnapshotEvent.fromBcs = function (data) {
3996
- return SnapshotEvent.fromFields(SnapshotEvent.bcs.parse(data));
3997
- };
3998
- SnapshotEvent.prototype.toJSONField = function () {
3999
- return {
4000
- sender: this.sender,
4001
- index: this.index.toString(),
4002
- userShareId: this.userShareId.toString(),
4003
- shares: this.shares.toString(),
4004
- tlpPrice: this.tlpPrice.toString(),
4005
- lastTsMs: this.lastTsMs.toString(),
4006
- currentTsMs: this.currentTsMs.toString(),
4007
- exp: this.exp.toString(),
4008
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
4009
- };
4010
- };
4011
- SnapshotEvent.prototype.toJSON = function () {
4012
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
4013
- };
4014
- SnapshotEvent.fromJSONField = function (field) {
4015
- return SnapshotEvent.reified().new({
4016
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
4017
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
4018
- userShareId: (0, reified_1.decodeFromJSONField)("u64", field.userShareId),
4019
- shares: (0, reified_1.decodeFromJSONField)("u64", field.shares),
4020
- tlpPrice: (0, reified_1.decodeFromJSONField)("u64", field.tlpPrice),
4021
- lastTsMs: (0, reified_1.decodeFromJSONField)("u64", field.lastTsMs),
4022
- currentTsMs: (0, reified_1.decodeFromJSONField)("u64", field.currentTsMs),
4023
- exp: (0, reified_1.decodeFromJSONField)("u64", field.exp),
4024
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
4025
- });
4026
- };
4027
- SnapshotEvent.fromJSON = function (json) {
4028
- if (json.$typeName !== SnapshotEvent.$typeName) {
4029
- throw new Error("not a WithTwoGenerics json object");
4030
- }
4031
- return SnapshotEvent.fromJSONField(json);
4032
- };
4033
- SnapshotEvent.fromSuiParsedData = function (content) {
4034
- if (content.dataType !== "moveObject") {
4035
- throw new Error("not an object");
4036
- }
4037
- if (!isSnapshotEvent(content.type)) {
4038
- throw new Error("object at ".concat(content.fields.id, " is not a SnapshotEvent object"));
4039
- }
4040
- return SnapshotEvent.fromFieldsWithTypes(content);
4041
- };
4042
- SnapshotEvent.fromSuiObjectData = function (data) {
4043
- if (data.bcs) {
4044
- if (data.bcs.dataType !== "moveObject" || !isSnapshotEvent(data.bcs.type)) {
4045
- throw new Error("object at is not a SnapshotEvent object");
4046
- }
4047
- return SnapshotEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
4048
- }
4049
- if (data.content) {
4050
- return SnapshotEvent.fromSuiParsedData(data.content);
4051
- }
4052
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
4053
- };
4054
- SnapshotEvent.fetch = function (client, id) {
4055
- return __awaiter(this, void 0, void 0, function () {
4056
- var res;
4057
- var _a, _b;
4058
- return __generator(this, function (_c) {
4059
- switch (_c.label) {
4060
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
4061
- case 1:
4062
- res = _c.sent();
4063
- if (res.error) {
4064
- throw new Error("error fetching SnapshotEvent object at id ".concat(id, ": ").concat(res.error.code));
4065
- }
4066
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isSnapshotEvent(res.data.bcs.type)) {
4067
- throw new Error("object at id ".concat(id, " is not a SnapshotEvent object"));
4068
- }
4069
- return [2 /*return*/, SnapshotEvent.fromSuiObjectData(res.data)];
4070
- }
4071
- });
4072
- });
4073
- };
4074
- SnapshotEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::SnapshotEvent");
4075
- SnapshotEvent.$numTypeParams = 0;
4076
- SnapshotEvent.$isPhantom = [];
4077
- SnapshotEvent.cachedBcs = null;
4078
- return SnapshotEvent;
4079
- }());
4080
- exports.SnapshotEvent = SnapshotEvent;
4081
- /* ============================== UnsubscribeEvent =============================== */
4082
- function isUnsubscribeEvent(type) {
4083
- type = (0, util_1.compressSuiType)(type);
4084
- return type === "".concat(index_1.PKG_V1, "::stake_pool::UnsubscribeEvent");
4085
- }
4086
- var UnsubscribeEvent = /** @class */ (function () {
4087
- function UnsubscribeEvent(typeArgs, fields) {
4088
- this.__StructClass = true;
4089
- this.$typeName = UnsubscribeEvent.$typeName;
4090
- this.$isPhantom = UnsubscribeEvent.$isPhantom;
4091
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([UnsubscribeEvent.$typeName], __read(typeArgs), false));
4092
- this.$typeArgs = typeArgs;
4093
- this.sender = fields.sender;
4094
- this.index = fields.index;
4095
- this.lpTokenType = fields.lpTokenType;
4096
- this.userShareId = fields.userShareId;
4097
- this.unsubscribedShares = fields.unsubscribedShares;
4098
- this.unsubscribeTsMs = fields.unsubscribeTsMs;
4099
- this.unlockedTsMs = fields.unlockedTsMs;
4100
- this.u64Padding = fields.u64Padding;
4101
- }
4102
- UnsubscribeEvent.reified = function () {
4103
- var _this = this;
4104
- var reifiedBcs = UnsubscribeEvent.bcs;
4105
- return {
4106
- typeName: UnsubscribeEvent.$typeName,
4107
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([UnsubscribeEvent.$typeName], [], false)),
4108
- typeArgs: [],
4109
- isPhantom: UnsubscribeEvent.$isPhantom,
4110
- reifiedTypeArgs: [],
4111
- fromFields: function (fields) { return UnsubscribeEvent.fromFields(fields); },
4112
- fromFieldsWithTypes: function (item) { return UnsubscribeEvent.fromFieldsWithTypes(item); },
4113
- fromBcs: function (data) { return UnsubscribeEvent.fromFields(reifiedBcs.parse(data)); },
4114
- bcs: reifiedBcs,
4115
- fromJSONField: function (field) { return UnsubscribeEvent.fromJSONField(field); },
4116
- fromJSON: function (json) { return UnsubscribeEvent.fromJSON(json); },
4117
- fromSuiParsedData: function (content) { return UnsubscribeEvent.fromSuiParsedData(content); },
4118
- fromSuiObjectData: function (content) { return UnsubscribeEvent.fromSuiObjectData(content); },
4119
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
4120
- return [2 /*return*/, UnsubscribeEvent.fetch(client, id)];
4121
- }); }); },
4122
- new: function (fields) {
4123
- return new UnsubscribeEvent([], fields);
4124
- },
4125
- kind: "StructClassReified",
4126
- };
4127
- };
4128
- Object.defineProperty(UnsubscribeEvent, "r", {
4129
- get: function () {
4130
- return UnsubscribeEvent.reified();
4131
- },
4132
- enumerable: false,
4133
- configurable: true
4134
- });
4135
- UnsubscribeEvent.phantom = function () {
4136
- return (0, reified_1.phantom)(UnsubscribeEvent.reified());
4137
- };
4138
- Object.defineProperty(UnsubscribeEvent, "p", {
4139
- get: function () {
4140
- return UnsubscribeEvent.phantom();
4141
- },
4142
- enumerable: false,
4143
- configurable: true
4144
- });
4145
- UnsubscribeEvent.instantiateBcs = function () {
4146
- return bcs_1.bcs.struct("UnsubscribeEvent", {
4147
- 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); } }),
4148
- index: bcs_1.bcs.u64(),
4149
- lp_token_type: structs_1.TypeName.bcs,
4150
- user_share_id: bcs_1.bcs.u64(),
4151
- unsubscribed_shares: bcs_1.bcs.u64(),
4152
- unsubscribe_ts_ms: bcs_1.bcs.u64(),
4153
- unlocked_ts_ms: bcs_1.bcs.u64(),
4154
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
4155
- });
4156
- };
4157
- Object.defineProperty(UnsubscribeEvent, "bcs", {
4158
- get: function () {
4159
- if (!UnsubscribeEvent.cachedBcs) {
4160
- UnsubscribeEvent.cachedBcs = UnsubscribeEvent.instantiateBcs();
4161
- }
4162
- return UnsubscribeEvent.cachedBcs;
4163
- },
4164
- enumerable: false,
4165
- configurable: true
4166
- });
4167
- UnsubscribeEvent.fromFields = function (fields) {
4168
- return UnsubscribeEvent.reified().new({
4169
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
4170
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
4171
- lpTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.lp_token_type),
4172
- userShareId: (0, reified_1.decodeFromFields)("u64", fields.user_share_id),
4173
- unsubscribedShares: (0, reified_1.decodeFromFields)("u64", fields.unsubscribed_shares),
4174
- unsubscribeTsMs: (0, reified_1.decodeFromFields)("u64", fields.unsubscribe_ts_ms),
4175
- unlockedTsMs: (0, reified_1.decodeFromFields)("u64", fields.unlocked_ts_ms),
4176
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
4177
- });
4178
- };
4179
- UnsubscribeEvent.fromFieldsWithTypes = function (item) {
4180
- if (!isUnsubscribeEvent(item.type)) {
4181
- throw new Error("not a UnsubscribeEvent type");
4182
- }
4183
- return UnsubscribeEvent.reified().new({
4184
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
4185
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
4186
- lpTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.lp_token_type),
4187
- userShareId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.user_share_id),
4188
- unsubscribedShares: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unsubscribed_shares),
4189
- unsubscribeTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unsubscribe_ts_ms),
4190
- unlockedTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unlocked_ts_ms),
4191
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
4192
- });
4193
- };
4194
- UnsubscribeEvent.fromBcs = function (data) {
4195
- return UnsubscribeEvent.fromFields(UnsubscribeEvent.bcs.parse(data));
4196
- };
4197
- UnsubscribeEvent.prototype.toJSONField = function () {
4198
- return {
4199
- sender: this.sender,
4200
- index: this.index.toString(),
4201
- lpTokenType: this.lpTokenType.toJSONField(),
4202
- userShareId: this.userShareId.toString(),
4203
- unsubscribedShares: this.unsubscribedShares.toString(),
4204
- unsubscribeTsMs: this.unsubscribeTsMs.toString(),
4205
- unlockedTsMs: this.unlockedTsMs.toString(),
4206
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
4207
- };
4208
- };
4209
- UnsubscribeEvent.prototype.toJSON = function () {
4210
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
4211
- };
4212
- UnsubscribeEvent.fromJSONField = function (field) {
4213
- return UnsubscribeEvent.reified().new({
4214
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
4215
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
4216
- lpTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.lpTokenType),
4217
- userShareId: (0, reified_1.decodeFromJSONField)("u64", field.userShareId),
4218
- unsubscribedShares: (0, reified_1.decodeFromJSONField)("u64", field.unsubscribedShares),
4219
- unsubscribeTsMs: (0, reified_1.decodeFromJSONField)("u64", field.unsubscribeTsMs),
4220
- unlockedTsMs: (0, reified_1.decodeFromJSONField)("u64", field.unlockedTsMs),
4221
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
4222
- });
4223
- };
4224
- UnsubscribeEvent.fromJSON = function (json) {
4225
- if (json.$typeName !== UnsubscribeEvent.$typeName) {
4226
- throw new Error("not a WithTwoGenerics json object");
4227
- }
4228
- return UnsubscribeEvent.fromJSONField(json);
4229
- };
4230
- UnsubscribeEvent.fromSuiParsedData = function (content) {
4231
- if (content.dataType !== "moveObject") {
4232
- throw new Error("not an object");
4233
- }
4234
- if (!isUnsubscribeEvent(content.type)) {
4235
- throw new Error("object at ".concat(content.fields.id, " is not a UnsubscribeEvent object"));
4236
- }
4237
- return UnsubscribeEvent.fromFieldsWithTypes(content);
4238
- };
4239
- UnsubscribeEvent.fromSuiObjectData = function (data) {
4240
- if (data.bcs) {
4241
- if (data.bcs.dataType !== "moveObject" || !isUnsubscribeEvent(data.bcs.type)) {
4242
- throw new Error("object at is not a UnsubscribeEvent object");
4243
- }
4244
- return UnsubscribeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
4245
- }
4246
- if (data.content) {
4247
- return UnsubscribeEvent.fromSuiParsedData(data.content);
4248
- }
4249
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
4250
- };
4251
- UnsubscribeEvent.fetch = function (client, id) {
4252
- return __awaiter(this, void 0, void 0, function () {
4253
- var res;
4254
- var _a, _b;
4255
- return __generator(this, function (_c) {
4256
- switch (_c.label) {
4257
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
4258
- case 1:
4259
- res = _c.sent();
4260
- if (res.error) {
4261
- throw new Error("error fetching UnsubscribeEvent object at id ".concat(id, ": ").concat(res.error.code));
4262
- }
4263
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isUnsubscribeEvent(res.data.bcs.type)) {
4264
- throw new Error("object at id ".concat(id, " is not a UnsubscribeEvent object"));
4265
- }
4266
- return [2 /*return*/, UnsubscribeEvent.fromSuiObjectData(res.data)];
4267
- }
4268
- });
4269
- });
4270
- };
4271
- UnsubscribeEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::UnsubscribeEvent");
4272
- UnsubscribeEvent.$numTypeParams = 0;
4273
- UnsubscribeEvent.$isPhantom = [];
4274
- UnsubscribeEvent.cachedBcs = null;
4275
- return UnsubscribeEvent;
4276
- }());
4277
- exports.UnsubscribeEvent = UnsubscribeEvent;
4278
- /* ============================== UnstakeEvent =============================== */
4279
- function isUnstakeEvent(type) {
4280
- type = (0, util_1.compressSuiType)(type);
4281
- return type === "".concat(index_1.PKG_V1, "::stake_pool::UnstakeEvent");
4282
- }
4283
- var UnstakeEvent = /** @class */ (function () {
4284
- function UnstakeEvent(typeArgs, fields) {
4285
- this.__StructClass = true;
4286
- this.$typeName = UnstakeEvent.$typeName;
4287
- this.$isPhantom = UnstakeEvent.$isPhantom;
4288
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([UnstakeEvent.$typeName], __read(typeArgs), false));
4289
- this.$typeArgs = typeArgs;
4290
- this.sender = fields.sender;
4291
- this.index = fields.index;
4292
- this.lpTokenType = fields.lpTokenType;
4293
- this.userShareId = fields.userShareId;
4294
- this.unstakeAmount = fields.unstakeAmount;
4295
- this.unstakeTsMs = fields.unstakeTsMs;
4296
- this.u64Padding = fields.u64Padding;
4297
- }
4298
- UnstakeEvent.reified = function () {
4299
- var _this = this;
4300
- var reifiedBcs = UnstakeEvent.bcs;
4301
- return {
4302
- typeName: UnstakeEvent.$typeName,
4303
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([UnstakeEvent.$typeName], [], false)),
4304
- typeArgs: [],
4305
- isPhantom: UnstakeEvent.$isPhantom,
4306
- reifiedTypeArgs: [],
4307
- fromFields: function (fields) { return UnstakeEvent.fromFields(fields); },
4308
- fromFieldsWithTypes: function (item) { return UnstakeEvent.fromFieldsWithTypes(item); },
4309
- fromBcs: function (data) { return UnstakeEvent.fromFields(reifiedBcs.parse(data)); },
4310
- bcs: reifiedBcs,
4311
- fromJSONField: function (field) { return UnstakeEvent.fromJSONField(field); },
4312
- fromJSON: function (json) { return UnstakeEvent.fromJSON(json); },
4313
- fromSuiParsedData: function (content) { return UnstakeEvent.fromSuiParsedData(content); },
4314
- fromSuiObjectData: function (content) { return UnstakeEvent.fromSuiObjectData(content); },
4315
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
4316
- return [2 /*return*/, UnstakeEvent.fetch(client, id)];
4317
- }); }); },
4318
- new: function (fields) {
4319
- return new UnstakeEvent([], fields);
4320
- },
4321
- kind: "StructClassReified",
4322
- };
4323
- };
4324
- Object.defineProperty(UnstakeEvent, "r", {
4325
- get: function () {
4326
- return UnstakeEvent.reified();
4327
- },
4328
- enumerable: false,
4329
- configurable: true
4330
- });
4331
- UnstakeEvent.phantom = function () {
4332
- return (0, reified_1.phantom)(UnstakeEvent.reified());
4333
- };
4334
- Object.defineProperty(UnstakeEvent, "p", {
4335
- get: function () {
4336
- return UnstakeEvent.phantom();
4337
- },
4338
- enumerable: false,
4339
- configurable: true
4340
- });
4341
- UnstakeEvent.instantiateBcs = function () {
4342
- return bcs_1.bcs.struct("UnstakeEvent", {
4343
- 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); } }),
4344
- index: bcs_1.bcs.u64(),
4345
- lp_token_type: structs_1.TypeName.bcs,
4346
- user_share_id: bcs_1.bcs.u64(),
4347
- unstake_amount: bcs_1.bcs.u64(),
4348
- unstake_ts_ms: bcs_1.bcs.u64(),
4349
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
4350
- });
4351
- };
4352
- Object.defineProperty(UnstakeEvent, "bcs", {
4353
- get: function () {
4354
- if (!UnstakeEvent.cachedBcs) {
4355
- UnstakeEvent.cachedBcs = UnstakeEvent.instantiateBcs();
4356
- }
4357
- return UnstakeEvent.cachedBcs;
4358
- },
4359
- enumerable: false,
4360
- configurable: true
4361
- });
4362
- UnstakeEvent.fromFields = function (fields) {
4363
- return UnstakeEvent.reified().new({
4364
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
4365
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
4366
- lpTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.lp_token_type),
4367
- userShareId: (0, reified_1.decodeFromFields)("u64", fields.user_share_id),
4368
- unstakeAmount: (0, reified_1.decodeFromFields)("u64", fields.unstake_amount),
4369
- unstakeTsMs: (0, reified_1.decodeFromFields)("u64", fields.unstake_ts_ms),
4370
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
4371
- });
4372
- };
4373
- UnstakeEvent.fromFieldsWithTypes = function (item) {
4374
- if (!isUnstakeEvent(item.type)) {
4375
- throw new Error("not a UnstakeEvent type");
4376
- }
4377
- return UnstakeEvent.reified().new({
4378
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
4379
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
4380
- lpTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.lp_token_type),
4381
- userShareId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.user_share_id),
4382
- unstakeAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unstake_amount),
4383
- unstakeTsMs: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.unstake_ts_ms),
4384
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
4385
- });
4386
- };
4387
- UnstakeEvent.fromBcs = function (data) {
4388
- return UnstakeEvent.fromFields(UnstakeEvent.bcs.parse(data));
4389
- };
4390
- UnstakeEvent.prototype.toJSONField = function () {
4391
- return {
4392
- sender: this.sender,
4393
- index: this.index.toString(),
4394
- lpTokenType: this.lpTokenType.toJSONField(),
4395
- userShareId: this.userShareId.toString(),
4396
- unstakeAmount: this.unstakeAmount.toString(),
4397
- unstakeTsMs: this.unstakeTsMs.toString(),
4398
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
4399
- };
4400
- };
4401
- UnstakeEvent.prototype.toJSON = function () {
4402
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
4403
- };
4404
- UnstakeEvent.fromJSONField = function (field) {
4405
- return UnstakeEvent.reified().new({
4406
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
4407
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
4408
- lpTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.lpTokenType),
4409
- userShareId: (0, reified_1.decodeFromJSONField)("u64", field.userShareId),
4410
- unstakeAmount: (0, reified_1.decodeFromJSONField)("u64", field.unstakeAmount),
4411
- unstakeTsMs: (0, reified_1.decodeFromJSONField)("u64", field.unstakeTsMs),
4412
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
4413
- });
4414
- };
4415
- UnstakeEvent.fromJSON = function (json) {
4416
- if (json.$typeName !== UnstakeEvent.$typeName) {
4417
- throw new Error("not a WithTwoGenerics json object");
4418
- }
4419
- return UnstakeEvent.fromJSONField(json);
4420
- };
4421
- UnstakeEvent.fromSuiParsedData = function (content) {
4422
- if (content.dataType !== "moveObject") {
4423
- throw new Error("not an object");
4424
- }
4425
- if (!isUnstakeEvent(content.type)) {
4426
- throw new Error("object at ".concat(content.fields.id, " is not a UnstakeEvent object"));
4427
- }
4428
- return UnstakeEvent.fromFieldsWithTypes(content);
4429
- };
4430
- UnstakeEvent.fromSuiObjectData = function (data) {
4431
- if (data.bcs) {
4432
- if (data.bcs.dataType !== "moveObject" || !isUnstakeEvent(data.bcs.type)) {
4433
- throw new Error("object at is not a UnstakeEvent object");
4434
- }
4435
- return UnstakeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
4436
- }
4437
- if (data.content) {
4438
- return UnstakeEvent.fromSuiParsedData(data.content);
4439
- }
4440
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
4441
- };
4442
- UnstakeEvent.fetch = function (client, id) {
4443
- return __awaiter(this, void 0, void 0, function () {
4444
- var res;
4445
- var _a, _b;
4446
- return __generator(this, function (_c) {
4447
- switch (_c.label) {
4448
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
4449
- case 1:
4450
- res = _c.sent();
4451
- if (res.error) {
4452
- throw new Error("error fetching UnstakeEvent object at id ".concat(id, ": ").concat(res.error.code));
4453
- }
4454
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isUnstakeEvent(res.data.bcs.type)) {
4455
- throw new Error("object at id ".concat(id, " is not a UnstakeEvent object"));
4456
- }
4457
- return [2 /*return*/, UnstakeEvent.fromSuiObjectData(res.data)];
4458
- }
4459
- });
4460
- });
4461
- };
4462
- UnstakeEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::UnstakeEvent");
4463
- UnstakeEvent.$numTypeParams = 0;
4464
- UnstakeEvent.$isPhantom = [];
4465
- UnstakeEvent.cachedBcs = null;
4466
- return UnstakeEvent;
4467
- }());
4468
- exports.UnstakeEvent = UnstakeEvent;
4469
- /* ============================== HarvestPerUserShareEvent =============================== */
4470
- function isHarvestPerUserShareEvent(type) {
4471
- type = (0, util_1.compressSuiType)(type);
4472
- return type === "".concat(index_1.PKG_V1, "::stake_pool::HarvestPerUserShareEvent");
4473
- }
4474
- var HarvestPerUserShareEvent = /** @class */ (function () {
4475
- function HarvestPerUserShareEvent(typeArgs, fields) {
4476
- this.__StructClass = true;
4477
- this.$typeName = HarvestPerUserShareEvent.$typeName;
4478
- this.$isPhantom = HarvestPerUserShareEvent.$isPhantom;
4479
- this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([HarvestPerUserShareEvent.$typeName], __read(typeArgs), false));
4480
- this.$typeArgs = typeArgs;
4481
- this.sender = fields.sender;
4482
- this.index = fields.index;
4483
- this.incentiveTokenType = fields.incentiveTokenType;
4484
- this.harvestAmount = fields.harvestAmount;
4485
- this.userShareId = fields.userShareId;
4486
- this.u64Padding = fields.u64Padding;
4487
- }
4488
- HarvestPerUserShareEvent.reified = function () {
4489
- var _this = this;
4490
- var reifiedBcs = HarvestPerUserShareEvent.bcs;
4491
- return {
4492
- typeName: HarvestPerUserShareEvent.$typeName,
4493
- fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([HarvestPerUserShareEvent.$typeName], [], false)),
4494
- typeArgs: [],
4495
- isPhantom: HarvestPerUserShareEvent.$isPhantom,
4496
- reifiedTypeArgs: [],
4497
- fromFields: function (fields) { return HarvestPerUserShareEvent.fromFields(fields); },
4498
- fromFieldsWithTypes: function (item) { return HarvestPerUserShareEvent.fromFieldsWithTypes(item); },
4499
- fromBcs: function (data) { return HarvestPerUserShareEvent.fromFields(reifiedBcs.parse(data)); },
4500
- bcs: reifiedBcs,
4501
- fromJSONField: function (field) { return HarvestPerUserShareEvent.fromJSONField(field); },
4502
- fromJSON: function (json) { return HarvestPerUserShareEvent.fromJSON(json); },
4503
- fromSuiParsedData: function (content) { return HarvestPerUserShareEvent.fromSuiParsedData(content); },
4504
- fromSuiObjectData: function (content) { return HarvestPerUserShareEvent.fromSuiObjectData(content); },
4505
- fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
4506
- return [2 /*return*/, HarvestPerUserShareEvent.fetch(client, id)];
4507
- }); }); },
4508
- new: function (fields) {
4509
- return new HarvestPerUserShareEvent([], fields);
4510
- },
4511
- kind: "StructClassReified",
4512
- };
4513
- };
4514
- Object.defineProperty(HarvestPerUserShareEvent, "r", {
4515
- get: function () {
4516
- return HarvestPerUserShareEvent.reified();
4517
- },
4518
- enumerable: false,
4519
- configurable: true
4520
- });
4521
- HarvestPerUserShareEvent.phantom = function () {
4522
- return (0, reified_1.phantom)(HarvestPerUserShareEvent.reified());
4523
- };
4524
- Object.defineProperty(HarvestPerUserShareEvent, "p", {
4525
- get: function () {
4526
- return HarvestPerUserShareEvent.phantom();
4527
- },
4528
- enumerable: false,
4529
- configurable: true
4530
- });
4531
- HarvestPerUserShareEvent.instantiateBcs = function () {
4532
- return bcs_1.bcs.struct("HarvestPerUserShareEvent", {
4533
- 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); } }),
4534
- index: bcs_1.bcs.u64(),
4535
- incentive_token_type: structs_1.TypeName.bcs,
4536
- harvest_amount: bcs_1.bcs.u64(),
4537
- user_share_id: bcs_1.bcs.u64(),
4538
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
4539
- });
4540
- };
4541
- Object.defineProperty(HarvestPerUserShareEvent, "bcs", {
4542
- get: function () {
4543
- if (!HarvestPerUserShareEvent.cachedBcs) {
4544
- HarvestPerUserShareEvent.cachedBcs = HarvestPerUserShareEvent.instantiateBcs();
4545
- }
4546
- return HarvestPerUserShareEvent.cachedBcs;
4547
- },
4548
- enumerable: false,
4549
- configurable: true
4550
- });
4551
- HarvestPerUserShareEvent.fromFields = function (fields) {
4552
- return HarvestPerUserShareEvent.reified().new({
4553
- sender: (0, reified_1.decodeFromFields)("address", fields.sender),
4554
- index: (0, reified_1.decodeFromFields)("u64", fields.index),
4555
- incentiveTokenType: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.incentive_token_type),
4556
- harvestAmount: (0, reified_1.decodeFromFields)("u64", fields.harvest_amount),
4557
- userShareId: (0, reified_1.decodeFromFields)("u64", fields.user_share_id),
4558
- u64Padding: (0, reified_1.decodeFromFields)(reified.vector("u64"), fields.u64_padding),
4559
- });
4560
- };
4561
- HarvestPerUserShareEvent.fromFieldsWithTypes = function (item) {
4562
- if (!isHarvestPerUserShareEvent(item.type)) {
4563
- throw new Error("not a HarvestPerUserShareEvent type");
4564
- }
4565
- return HarvestPerUserShareEvent.reified().new({
4566
- sender: (0, reified_1.decodeFromFieldsWithTypes)("address", item.fields.sender),
4567
- index: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.index),
4568
- incentiveTokenType: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.incentive_token_type),
4569
- harvestAmount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.harvest_amount),
4570
- userShareId: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.user_share_id),
4571
- u64Padding: (0, reified_1.decodeFromFieldsWithTypes)(reified.vector("u64"), item.fields.u64_padding),
4572
- });
4573
- };
4574
- HarvestPerUserShareEvent.fromBcs = function (data) {
4575
- return HarvestPerUserShareEvent.fromFields(HarvestPerUserShareEvent.bcs.parse(data));
4576
- };
4577
- HarvestPerUserShareEvent.prototype.toJSONField = function () {
4578
- return {
4579
- sender: this.sender,
4580
- index: this.index.toString(),
4581
- incentiveTokenType: this.incentiveTokenType.toJSONField(),
4582
- harvestAmount: this.harvestAmount.toString(),
4583
- userShareId: this.userShareId.toString(),
4584
- u64Padding: (0, reified_1.fieldToJSON)("vector<u64>", this.u64Padding),
4585
- };
4586
- };
4587
- HarvestPerUserShareEvent.prototype.toJSON = function () {
4588
- return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
4589
- };
4590
- HarvestPerUserShareEvent.fromJSONField = function (field) {
4591
- return HarvestPerUserShareEvent.reified().new({
4592
- sender: (0, reified_1.decodeFromJSONField)("address", field.sender),
4593
- index: (0, reified_1.decodeFromJSONField)("u64", field.index),
4594
- incentiveTokenType: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.incentiveTokenType),
4595
- harvestAmount: (0, reified_1.decodeFromJSONField)("u64", field.harvestAmount),
4596
- userShareId: (0, reified_1.decodeFromJSONField)("u64", field.userShareId),
4597
- u64Padding: (0, reified_1.decodeFromJSONField)(reified.vector("u64"), field.u64Padding),
4598
- });
4599
- };
4600
- HarvestPerUserShareEvent.fromJSON = function (json) {
4601
- if (json.$typeName !== HarvestPerUserShareEvent.$typeName) {
4602
- throw new Error("not a WithTwoGenerics json object");
4603
- }
4604
- return HarvestPerUserShareEvent.fromJSONField(json);
4605
- };
4606
- HarvestPerUserShareEvent.fromSuiParsedData = function (content) {
4607
- if (content.dataType !== "moveObject") {
4608
- throw new Error("not an object");
4609
- }
4610
- if (!isHarvestPerUserShareEvent(content.type)) {
4611
- throw new Error("object at ".concat(content.fields.id, " is not a HarvestPerUserShareEvent object"));
4612
- }
4613
- return HarvestPerUserShareEvent.fromFieldsWithTypes(content);
4614
- };
4615
- HarvestPerUserShareEvent.fromSuiObjectData = function (data) {
4616
- if (data.bcs) {
4617
- if (data.bcs.dataType !== "moveObject" || !isHarvestPerUserShareEvent(data.bcs.type)) {
4618
- throw new Error("object at is not a HarvestPerUserShareEvent object");
4619
- }
4620
- return HarvestPerUserShareEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
4621
- }
4622
- if (data.content) {
4623
- return HarvestPerUserShareEvent.fromSuiParsedData(data.content);
4624
- }
4625
- throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
4626
- };
4627
- HarvestPerUserShareEvent.fetch = function (client, id) {
4628
- return __awaiter(this, void 0, void 0, function () {
4629
- var res;
4630
- var _a, _b;
4631
- return __generator(this, function (_c) {
4632
- switch (_c.label) {
4633
- case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
4634
- case 1:
4635
- res = _c.sent();
4636
- if (res.error) {
4637
- throw new Error("error fetching HarvestPerUserShareEvent object at id ".concat(id, ": ").concat(res.error.code));
4638
- }
4639
- if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isHarvestPerUserShareEvent(res.data.bcs.type)) {
4640
- throw new Error("object at id ".concat(id, " is not a HarvestPerUserShareEvent object"));
4641
- }
4642
- return [2 /*return*/, HarvestPerUserShareEvent.fromSuiObjectData(res.data)];
4643
- }
4644
- });
4645
- });
4646
- };
4647
- HarvestPerUserShareEvent.$typeName = "".concat(index_1.PKG_V1, "::stake_pool::HarvestPerUserShareEvent");
4648
- HarvestPerUserShareEvent.$numTypeParams = 0;
4649
- HarvestPerUserShareEvent.$isPhantom = [];
4650
- HarvestPerUserShareEvent.cachedBcs = null;
4651
- return HarvestPerUserShareEvent;
4652
- }());
4653
- exports.HarvestPerUserShareEvent = HarvestPerUserShareEvent;