@typus/typus-sdk 1.4.3-c → 1.4.3-e

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 (248) hide show
  1. package/package.json +10 -2
  2. package/src/_dependencies/source/0x1/ascii/structs.ts +135 -0
  3. package/src/_dependencies/source/0x1/bit-vector/structs.ts +70 -0
  4. package/src/_dependencies/source/0x1/fixed-point32/structs.ts +69 -0
  5. package/src/_dependencies/source/0x1/index.ts +1 -0
  6. package/src/_dependencies/source/0x1/init.ts +16 -0
  7. package/src/_dependencies/source/0x1/option/structs.ts +74 -0
  8. package/src/_dependencies/source/0x1/string/structs.ts +70 -0
  9. package/src/_dependencies/source/0x1/type-name/structs.ts +70 -0
  10. package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/index.ts +1 -0
  11. package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/init.ts +14 -0
  12. package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/oracle/structs.ts +203 -0
  13. package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/pyth-parser/structs.ts +317 -0
  14. package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/supra/structs.ts +69 -0
  15. package/src/_dependencies/source/0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73/switchboard-feed-parser/structs.ts +69 -0
  16. package/src/_dependencies/source/0x2/authenticator-state/structs.ts +332 -0
  17. package/src/_dependencies/source/0x2/bag/structs.ts +70 -0
  18. package/src/_dependencies/source/0x2/balance/structs.ts +134 -0
  19. package/src/_dependencies/source/0x2/bcs/structs.ts +70 -0
  20. package/src/_dependencies/source/0x2/bls12381/structs.ts +264 -0
  21. package/src/_dependencies/source/0x2/borrow/structs.ts +138 -0
  22. package/src/_dependencies/source/0x2/clock/structs.ts +70 -0
  23. package/src/_dependencies/source/0x2/coin/structs.ts +400 -0
  24. package/src/_dependencies/source/0x2/deny-list/structs.ts +139 -0
  25. package/src/_dependencies/source/0x2/display/structs.ts +202 -0
  26. package/src/_dependencies/source/0x2/dynamic-field/structs.ts +70 -0
  27. package/src/_dependencies/source/0x2/dynamic-object-field/structs.ts +71 -0
  28. package/src/_dependencies/source/0x2/groth16/structs.ts +265 -0
  29. package/src/_dependencies/source/0x2/group-ops/structs.ts +70 -0
  30. package/src/_dependencies/source/0x2/index.ts +1 -0
  31. package/src/_dependencies/source/0x2/init.ts +125 -0
  32. package/src/_dependencies/source/0x2/kiosk/structs.ts +658 -0
  33. package/src/_dependencies/source/0x2/kiosk-extension/structs.ts +135 -0
  34. package/src/_dependencies/source/0x2/linked-table/structs.ts +136 -0
  35. package/src/_dependencies/source/0x2/object/structs.ts +134 -0
  36. package/src/_dependencies/source/0x2/object-bag/structs.ts +70 -0
  37. package/src/_dependencies/source/0x2/object-table/structs.ts +70 -0
  38. package/src/_dependencies/source/0x2/package/structs.ts +267 -0
  39. package/src/_dependencies/source/0x2/priority-queue/structs.ts +139 -0
  40. package/src/_dependencies/source/0x2/random/structs.ts +202 -0
  41. package/src/_dependencies/source/0x2/sui/structs.ts +69 -0
  42. package/src/_dependencies/source/0x2/table/structs.ts +70 -0
  43. package/src/_dependencies/source/0x2/table-vec/structs.ts +71 -0
  44. package/src/_dependencies/source/0x2/token/structs.ts +401 -0
  45. package/src/_dependencies/source/0x2/transfer/structs.ts +70 -0
  46. package/src/_dependencies/source/0x2/transfer-policy/structs.ts +400 -0
  47. package/src/_dependencies/source/0x2/tx-context/structs.ts +70 -0
  48. package/src/_dependencies/source/0x2/url/structs.ts +70 -0
  49. package/src/_dependencies/source/0x2/vec-map/structs.ts +135 -0
  50. package/src/_dependencies/source/0x2/vec-set/structs.ts +72 -0
  51. package/src/_dependencies/source/0x2/versioned/structs.ts +135 -0
  52. package/src/_dependencies/source/0x2/zklogin-verified-id/structs.ts +71 -0
  53. package/src/_dependencies/source/0x2/zklogin-verified-issuer/structs.ts +71 -0
  54. package/src/_dependencies/source/0x277f90d256d1015a78cad646db091bec451c5bbab834b9fb70bace7885b5c698/index.ts +1 -0
  55. package/src/_dependencies/source/0x277f90d256d1015a78cad646db091bec451c5bbab834b9fb70bace7885b5c698/init.ts +5 -0
  56. package/src/_dependencies/source/0x277f90d256d1015a78cad646db091bec451c5bbab834b9fb70bace7885b5c698/validator/structs.ts +70 -0
  57. package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/index.ts +1 -0
  58. package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/init.ts +8 -0
  59. package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/price-data-pull/structs.ts +69 -0
  60. package/src/_dependencies/source/0x2fdff17b86e34ab722c8ba5e63f0da070d9a4163705b3fdc6a95802cab40a72a/suprasvaluefeed/structs.ts +135 -0
  61. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/airdrop/structs.ts +400 -0
  62. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/big-vector/structs.ts +372 -0
  63. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/critbit/structs.ts +205 -0
  64. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/ecosystem/structs.ts +333 -0
  65. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/index.ts +1 -0
  66. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/init.ts +48 -0
  67. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/leaderboard/structs.ts +465 -0
  68. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/linked-object-table/structs.ts +136 -0
  69. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/linked-set/structs.ts +140 -0
  70. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/tgld/structs.ts +268 -0
  71. package/src/_dependencies/source/0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277/user/structs.ts +332 -0
  72. package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/discount-mint/structs.ts +466 -0
  73. package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/index.ts +1 -0
  74. package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/init.ts +36 -0
  75. package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/royalty-rule/structs.ts +134 -0
  76. package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/staking/structs.ts +333 -0
  77. package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/table-vec/structs.ts +71 -0
  78. package/src/_dependencies/source/0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828/typus-nft/structs.ts +856 -0
  79. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/auto-bid/structs.ts +1049 -0
  80. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/index.ts +1 -0
  81. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/init.ts +104 -0
  82. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tails-staking/structs.ts +1054 -0
  83. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-authorized-entry/structs.ts +592 -0
  84. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-fee-pool-entry/structs.ts +461 -0
  85. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-registry-authorized-entry/structs.ts +592 -0
  86. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/tds-view-function/structs.ts +69 -0
  87. package/src/_dependencies/source/0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f/typus-dov-single/structs.ts +2351 -0
  88. package/src/_dependencies/source/0x7237ec8436ef7e927c45470db6db3a834dd84cf903aedee3844e847fe4805399/index.ts +1 -0
  89. package/src/_dependencies/source/0x7237ec8436ef7e927c45470db6db3a834dd84cf903aedee3844e847fe4805399/init.ts +3 -0
  90. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/authority/structs.ts +71 -0
  91. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/balance-pool/structs.ts +203 -0
  92. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/big-vector/structs.ts +70 -0
  93. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/dutch/structs.ts +528 -0
  94. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/i64/structs.ts +69 -0
  95. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/index.ts +1 -0
  96. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/init.ts +54 -0
  97. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/linked-list/structs.ts +136 -0
  98. package/src/_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/vault/structs.ts +1829 -0
  99. package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/aggregator/structs.ts +398 -0
  100. package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/index.ts +1 -0
  101. package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/init.ts +18 -0
  102. package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/job/structs.ts +71 -0
  103. package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/math/structs.ts +69 -0
  104. package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/quote/structs.ts +71 -0
  105. package/src/_dependencies/source/0x98670585b87e06628ef2d7f7cb1e7bee8ada65b43b82997935225a7e6e21d18e/switchboard/structs.ts +70 -0
  106. package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/index.ts +1 -0
  107. package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/init.ts +11 -0
  108. package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/kiosk-lock-rule/structs.ts +134 -0
  109. package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/royalty-rule/structs.ts +134 -0
  110. package/src/_dependencies/source/0xbd8fc1947cf119350184107a3087e2dc27efefa0dd82e25a1f699069fe81a585/witness-rule/structs.ts +69 -0
  111. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/bytes20/structs.ts +70 -0
  112. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/bytes32/structs.ts +70 -0
  113. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/consumed-vaas/structs.ts +72 -0
  114. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/cursor/structs.ts +72 -0
  115. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/emitter/structs.ts +200 -0
  116. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/external-address/structs.ts +70 -0
  117. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/fee-collector/structs.ts +72 -0
  118. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/governance-message/structs.ts +137 -0
  119. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/guardian/structs.ts +70 -0
  120. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/guardian-set/structs.ts +71 -0
  121. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/guardian-signature/structs.ts +70 -0
  122. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/index.ts +1 -0
  123. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/init.ts +65 -0
  124. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/migrate/structs.ts +70 -0
  125. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/package-utils/structs.ts +266 -0
  126. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/publish-message/structs.ts +136 -0
  127. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/set/structs.ts +136 -0
  128. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/set-fee/structs.ts +134 -0
  129. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/setup/structs.ts +70 -0
  130. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/state/structs.ts +142 -0
  131. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/transfer-fee/structs.ts +134 -0
  132. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/update-guardian-set/structs.ts +201 -0
  133. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/upgrade-contract/structs.ts +201 -0
  134. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/vaa/structs.ts +72 -0
  135. package/src/_dependencies/source/0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e/version-control/structs.ts +134 -0
  136. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/batch-price-attestation/structs.ts +136 -0
  137. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/contract-upgrade/structs.ts +136 -0
  138. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/data-source/structs.ts +70 -0
  139. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/event/structs.ts +135 -0
  140. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/governance/structs.ts +71 -0
  141. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/governance-action/structs.ts +69 -0
  142. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/governance-instruction/structs.ts +71 -0
  143. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/hot-potato-vector/structs.ts +72 -0
  144. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/i64/structs.ts +69 -0
  145. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/index.ts +1 -0
  146. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/init.ts +59 -0
  147. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/migrate/structs.ts +70 -0
  148. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price/structs.ts +70 -0
  149. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-feed/structs.ts +71 -0
  150. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-identifier/structs.ts +70 -0
  151. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-info/structs.ts +136 -0
  152. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/price-status/structs.ts +69 -0
  153. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set/structs.ts +138 -0
  154. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-data-sources/structs.ts +71 -0
  155. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-fee-recipient/structs.ts +69 -0
  156. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-governance-data-source/structs.ts +70 -0
  157. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-stale-price-threshold/structs.ts +69 -0
  158. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/set-update-fee/structs.ts +69 -0
  159. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/setup/structs.ts +70 -0
  160. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/state/structs.ts +203 -0
  161. package/src/_dependencies/source/0xe76d8a37d4132278a7a752183e90e04890b9e7d0f6657eadb68821609a2a56a3/version-control/structs.ts +134 -0
  162. package/src/_framework/init-source.ts +39 -0
  163. package/src/_framework/loader.ts +69 -0
  164. package/src/_framework/reified.ts +442 -0
  165. package/src/_framework/util.ts +265 -0
  166. package/src/airdrop/authority-entry.ts +101 -0
  167. package/src/airdrop/index.ts +3 -0
  168. package/src/airdrop/user-entry.ts +24 -0
  169. package/src/airdrop/view-function.ts +36 -0
  170. package/src/auto-bid/index.ts +2 -0
  171. package/src/auto-bid/user-entry.ts +256 -0
  172. package/src/auto-bid/view-function.ts +285 -0
  173. package/src/constants/constant.ts +32 -0
  174. package/src/constants/index.ts +2 -0
  175. package/src/constants/token.ts +194 -0
  176. package/src/index.ts +11 -0
  177. package/src/leaderboard/authority-entry.ts +63 -0
  178. package/src/leaderboard/index.ts +2 -0
  179. package/src/leaderboard/view-function.ts +66 -0
  180. package/src/tails-exp-dice/api.ts +46 -0
  181. package/src/tails-exp-dice/fetch.ts +347 -0
  182. package/src/tails-exp-dice/index.ts +4 -0
  183. package/src/tails-exp-dice/user-entry.ts +241 -0
  184. package/src/tails-exp-dice/view-function.ts +111 -0
  185. package/src/tails-staking/authority-entry.ts +333 -0
  186. package/src/tails-staking/index.ts +3 -0
  187. package/src/tails-staking/user-entry.ts +401 -0
  188. package/src/tails-staking/view-function.ts +86 -0
  189. package/src/typus-dov-single-v2/entry/authority-entry.ts +171 -0
  190. package/src/typus-dov-single-v2/entry/index.ts +3 -0
  191. package/src/typus-dov-single-v2/entry/mfud-user-entry.ts +591 -0
  192. package/src/typus-dov-single-v2/entry/user-entry.ts +573 -0
  193. package/src/typus-dov-single-v2/function/bidding.ts +823 -0
  194. package/src/typus-dov-single-v2/function/index.ts +3 -0
  195. package/src/typus-dov-single-v2/function/token.ts +38 -0
  196. package/src/typus-dov-single-v2/function/vault.ts +24 -0
  197. package/src/typus-dov-single-v2/history/index.ts +2 -0
  198. package/src/typus-dov-single-v2/history/user-history.ts +929 -0
  199. package/src/typus-dov-single-v2/history/vault-history.ts +452 -0
  200. package/src/typus-dov-single-v2/index.ts +4 -0
  201. package/src/typus-dov-single-v2/view-function.ts +705 -0
  202. package/src/typus-nft/fetch.ts +428 -0
  203. package/src/typus-nft/index.ts +2 -0
  204. package/src/typus-nft/user-entry.ts +113 -0
  205. package/src/typus-perp/admin/functions.ts +141 -0
  206. package/src/typus-perp/admin/structs.ts +793 -0
  207. package/src/typus-perp/fetch.ts +253 -0
  208. package/src/typus-perp/index.ts +9 -0
  209. package/src/typus-perp/init.ts +96 -0
  210. package/src/typus-perp/lp-pool/functions.ts +694 -0
  211. package/src/typus-perp/lp-pool/structs.ts +3884 -0
  212. package/src/typus-perp/math/functions.ts +53 -0
  213. package/src/typus-perp/oracle/functions.ts +32 -0
  214. package/src/typus-perp/oracle/structs.ts +317 -0
  215. package/src/typus-perp/position/functions.ts +887 -0
  216. package/src/typus-perp/position/structs.ts +1637 -0
  217. package/src/typus-perp/readVec.ts +118 -0
  218. package/src/typus-perp/stake-pool/functions.ts +421 -0
  219. package/src/typus-perp/stake-pool/structs.ts +3873 -0
  220. package/src/typus-perp/symbol/functions.ts +24 -0
  221. package/src/typus-perp/symbol/structs.ts +165 -0
  222. package/src/typus-perp/tlp/functions.ts +50 -0
  223. package/src/typus-perp/tlp/structs.ts +287 -0
  224. package/src/typus-perp/token-interface/functions.ts +29 -0
  225. package/src/typus-perp/trading/functions.ts +1046 -0
  226. package/src/typus-perp/trading/structs.ts +4541 -0
  227. package/src/typus-perp/treasury-caps/functions.ts +36 -0
  228. package/src/typus-perp/treasury-caps/structs.ts +151 -0
  229. package/src/typus-perp/user/order.ts +221 -0
  230. package/src/typus-perp/user/orderWithBidReceipt.ts +176 -0
  231. package/src/typus-perp/user/tlp.ts +234 -0
  232. package/src/user/index.ts +1 -0
  233. package/src/user/view-function.ts +33 -0
  234. package/src/utils/.DS_Store +0 -0
  235. package/src/utils/api/defillama/index.ts +1 -0
  236. package/src/utils/api/defillama/tvl.ts +11 -0
  237. package/src/utils/api/index.ts +3 -0
  238. package/src/utils/api/price.ts +101 -0
  239. package/src/utils/api/sentio/index.ts +2 -0
  240. package/src/utils/api/sentio/leader-board.ts +259 -0
  241. package/src/utils/api/sentio/reward-generated.ts +392 -0
  242. package/src/utils/index.ts +5 -0
  243. package/src/utils/load_env.ts +5 -0
  244. package/src/utils/mint.ts +16 -0
  245. package/src/utils/pyth/constant.ts +71 -0
  246. package/src/utils/pyth/index.ts +2 -0
  247. package/src/utils/pyth/pythClient.ts +52 -0
  248. package/src/utils/tools.ts +38 -0
@@ -0,0 +1,3884 @@
1
+ import * as reified from "../../_framework/reified";
2
+ import { TypeName } from "../../_dependencies/source/0x1/type-name/structs";
3
+ import { UID } from "../../_dependencies/source/0x2/object/structs";
4
+ import {
5
+ PhantomReified,
6
+ Reified,
7
+ StructClass,
8
+ ToField,
9
+ ToTypeStr,
10
+ Vector,
11
+ decodeFromFields,
12
+ decodeFromFieldsWithTypes,
13
+ decodeFromJSONField,
14
+ fieldToJSON,
15
+ phantom,
16
+ } from "../../_framework/reified";
17
+ import { FieldsWithTypes, composeSuiType, compressSuiType } from "../../_framework/util";
18
+ import { bcs, fromB64, fromHEX, toHEX } from "@mysten/bcs";
19
+ import { SuiClient, SuiParsedData } from "@mysten/sui.js/client";
20
+
21
+ /* ============================== Config =============================== */
22
+
23
+ export function isConfig(type: string): boolean {
24
+ type = compressSuiType(type);
25
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Config";
26
+ }
27
+
28
+ export interface ConfigFields {
29
+ oracleId: ToField<"address">;
30
+ liquidityTokenDecimal: ToField<"u64">;
31
+ spotConfig: ToField<SpotConfig>;
32
+ marginConfig: ToField<MarginConfig>;
33
+ u64Padding: ToField<Vector<"u64">>;
34
+ }
35
+
36
+ export type ConfigReified = Reified<Config, ConfigFields>;
37
+
38
+ export class Config implements StructClass {
39
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Config";
40
+ static readonly $numTypeParams = 0;
41
+
42
+ readonly $typeName = Config.$typeName;
43
+
44
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Config";
45
+
46
+ readonly $typeArgs: [];
47
+
48
+ readonly oracleId: ToField<"address">;
49
+ readonly liquidityTokenDecimal: ToField<"u64">;
50
+ readonly spotConfig: ToField<SpotConfig>;
51
+ readonly marginConfig: ToField<MarginConfig>;
52
+ readonly u64Padding: ToField<Vector<"u64">>;
53
+
54
+ private constructor(typeArgs: [], fields: ConfigFields) {
55
+ this.$fullTypeName = composeSuiType(
56
+ Config.$typeName,
57
+ ...typeArgs
58
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Config";
59
+ this.$typeArgs = typeArgs;
60
+
61
+ this.oracleId = fields.oracleId;
62
+ this.liquidityTokenDecimal = fields.liquidityTokenDecimal;
63
+ this.spotConfig = fields.spotConfig;
64
+ this.marginConfig = fields.marginConfig;
65
+ this.u64Padding = fields.u64Padding;
66
+ }
67
+
68
+ static reified(): ConfigReified {
69
+ return {
70
+ typeName: Config.$typeName,
71
+ fullTypeName: composeSuiType(
72
+ Config.$typeName,
73
+ ...[]
74
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Config",
75
+ typeArgs: [] as [],
76
+ reifiedTypeArgs: [],
77
+ fromFields: (fields: Record<string, any>) => Config.fromFields(fields),
78
+ fromFieldsWithTypes: (item: FieldsWithTypes) => Config.fromFieldsWithTypes(item),
79
+ fromBcs: (data: Uint8Array) => Config.fromBcs(data),
80
+ bcs: Config.bcs,
81
+ fromJSONField: (field: any) => Config.fromJSONField(field),
82
+ fromJSON: (json: Record<string, any>) => Config.fromJSON(json),
83
+ fromSuiParsedData: (content: SuiParsedData) => Config.fromSuiParsedData(content),
84
+ fetch: async (client: SuiClient, id: string) => Config.fetch(client, id),
85
+ new: (fields: ConfigFields) => {
86
+ return new Config([], fields);
87
+ },
88
+ kind: "StructClassReified",
89
+ };
90
+ }
91
+
92
+ static get r() {
93
+ return Config.reified();
94
+ }
95
+
96
+ static phantom(): PhantomReified<ToTypeStr<Config>> {
97
+ return phantom(Config.reified());
98
+ }
99
+ static get p() {
100
+ return Config.phantom();
101
+ }
102
+
103
+ static get bcs() {
104
+ return bcs.struct("Config", {
105
+ oracle_id: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
106
+ liquidity_token_decimal: bcs.u64(),
107
+ spot_config: SpotConfig.bcs,
108
+ margin_config: MarginConfig.bcs,
109
+ u64_padding: bcs.vector(bcs.u64()),
110
+ });
111
+ }
112
+
113
+ static fromFields(fields: Record<string, any>): Config {
114
+ return Config.reified().new({
115
+ oracleId: decodeFromFields("address", fields.oracle_id),
116
+ liquidityTokenDecimal: decodeFromFields("u64", fields.liquidity_token_decimal),
117
+ spotConfig: decodeFromFields(SpotConfig.reified(), fields.spot_config),
118
+ marginConfig: decodeFromFields(MarginConfig.reified(), fields.margin_config),
119
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
120
+ });
121
+ }
122
+
123
+ static fromFieldsWithTypes(item: FieldsWithTypes): Config {
124
+ if (!isConfig(item.type)) {
125
+ throw new Error("not a Config type");
126
+ }
127
+
128
+ return Config.reified().new({
129
+ oracleId: decodeFromFieldsWithTypes("address", item.fields.oracle_id),
130
+ liquidityTokenDecimal: decodeFromFieldsWithTypes("u64", item.fields.liquidity_token_decimal),
131
+ spotConfig: decodeFromFieldsWithTypes(SpotConfig.reified(), item.fields.spot_config),
132
+ marginConfig: decodeFromFieldsWithTypes(MarginConfig.reified(), item.fields.margin_config),
133
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
134
+ });
135
+ }
136
+
137
+ static fromBcs(data: Uint8Array): Config {
138
+ return Config.fromFields(Config.bcs.parse(data));
139
+ }
140
+
141
+ toJSONField() {
142
+ return {
143
+ oracleId: this.oracleId,
144
+ liquidityTokenDecimal: this.liquidityTokenDecimal.toString(),
145
+ spotConfig: this.spotConfig.toJSONField(),
146
+ marginConfig: this.marginConfig.toJSONField(),
147
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
148
+ };
149
+ }
150
+
151
+ toJSON() {
152
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
153
+ }
154
+
155
+ static fromJSONField(field: any): Config {
156
+ return Config.reified().new({
157
+ oracleId: decodeFromJSONField("address", field.oracleId),
158
+ liquidityTokenDecimal: decodeFromJSONField("u64", field.liquidityTokenDecimal),
159
+ spotConfig: decodeFromJSONField(SpotConfig.reified(), field.spotConfig),
160
+ marginConfig: decodeFromJSONField(MarginConfig.reified(), field.marginConfig),
161
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
162
+ });
163
+ }
164
+
165
+ static fromJSON(json: Record<string, any>): Config {
166
+ if (json.$typeName !== Config.$typeName) {
167
+ throw new Error("not a WithTwoGenerics json object");
168
+ }
169
+
170
+ return Config.fromJSONField(json);
171
+ }
172
+
173
+ static fromSuiParsedData(content: SuiParsedData): Config {
174
+ if (content.dataType !== "moveObject") {
175
+ throw new Error("not an object");
176
+ }
177
+ if (!isConfig(content.type)) {
178
+ throw new Error(`object at ${(content.fields as any).id} is not a Config object`);
179
+ }
180
+ return Config.fromFieldsWithTypes(content);
181
+ }
182
+
183
+ static async fetch(client: SuiClient, id: string): Promise<Config> {
184
+ const res = await client.getObject({ id, options: { showBcs: true } });
185
+ if (res.error) {
186
+ throw new Error(`error fetching Config object at id ${id}: ${res.error.code}`);
187
+ }
188
+ if (res.data?.bcs?.dataType !== "moveObject" || !isConfig(res.data.bcs.type)) {
189
+ throw new Error(`object at id ${id} is not a Config object`);
190
+ }
191
+ return Config.fromBcs(fromB64(res.data.bcs.bcsBytes));
192
+ }
193
+ }
194
+
195
+ /* ============================== State =============================== */
196
+
197
+ export function isState(type: string): boolean {
198
+ type = compressSuiType(type);
199
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::State";
200
+ }
201
+
202
+ export interface StateFields {
203
+ liquidityAmount: ToField<"u64">;
204
+ valueInUsd: ToField<"u64">;
205
+ reservedAmount: ToField<"u64">;
206
+ updateTsMs: ToField<"u64">;
207
+ isActive: ToField<"bool">;
208
+ lastBorrowRateTsMs: ToField<"u64">;
209
+ cumulativeBorrowRate: ToField<"u64">;
210
+ previousLastBorrowRateTsMs: ToField<"u64">;
211
+ previousCumulativeBorrowRate: ToField<"u64">;
212
+ u64Padding: ToField<Vector<"u64">>;
213
+ }
214
+
215
+ export type StateReified = Reified<State, StateFields>;
216
+
217
+ export class State implements StructClass {
218
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::State";
219
+ static readonly $numTypeParams = 0;
220
+
221
+ readonly $typeName = State.$typeName;
222
+
223
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::State";
224
+
225
+ readonly $typeArgs: [];
226
+
227
+ readonly liquidityAmount: ToField<"u64">;
228
+ readonly valueInUsd: ToField<"u64">;
229
+ readonly reservedAmount: ToField<"u64">;
230
+ readonly updateTsMs: ToField<"u64">;
231
+ readonly isActive: ToField<"bool">;
232
+ readonly lastBorrowRateTsMs: ToField<"u64">;
233
+ readonly cumulativeBorrowRate: ToField<"u64">;
234
+ readonly previousLastBorrowRateTsMs: ToField<"u64">;
235
+ readonly previousCumulativeBorrowRate: ToField<"u64">;
236
+ readonly u64Padding: ToField<Vector<"u64">>;
237
+
238
+ private constructor(typeArgs: [], fields: StateFields) {
239
+ this.$fullTypeName = composeSuiType(
240
+ State.$typeName,
241
+ ...typeArgs
242
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::State";
243
+ this.$typeArgs = typeArgs;
244
+
245
+ this.liquidityAmount = fields.liquidityAmount;
246
+ this.valueInUsd = fields.valueInUsd;
247
+ this.reservedAmount = fields.reservedAmount;
248
+ this.updateTsMs = fields.updateTsMs;
249
+ this.isActive = fields.isActive;
250
+ this.lastBorrowRateTsMs = fields.lastBorrowRateTsMs;
251
+ this.cumulativeBorrowRate = fields.cumulativeBorrowRate;
252
+ this.previousLastBorrowRateTsMs = fields.previousLastBorrowRateTsMs;
253
+ this.previousCumulativeBorrowRate = fields.previousCumulativeBorrowRate;
254
+ this.u64Padding = fields.u64Padding;
255
+ }
256
+
257
+ static reified(): StateReified {
258
+ return {
259
+ typeName: State.$typeName,
260
+ fullTypeName: composeSuiType(
261
+ State.$typeName,
262
+ ...[]
263
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::State",
264
+ typeArgs: [] as [],
265
+ reifiedTypeArgs: [],
266
+ fromFields: (fields: Record<string, any>) => State.fromFields(fields),
267
+ fromFieldsWithTypes: (item: FieldsWithTypes) => State.fromFieldsWithTypes(item),
268
+ fromBcs: (data: Uint8Array) => State.fromBcs(data),
269
+ bcs: State.bcs,
270
+ fromJSONField: (field: any) => State.fromJSONField(field),
271
+ fromJSON: (json: Record<string, any>) => State.fromJSON(json),
272
+ fromSuiParsedData: (content: SuiParsedData) => State.fromSuiParsedData(content),
273
+ fetch: async (client: SuiClient, id: string) => State.fetch(client, id),
274
+ new: (fields: StateFields) => {
275
+ return new State([], fields);
276
+ },
277
+ kind: "StructClassReified",
278
+ };
279
+ }
280
+
281
+ static get r() {
282
+ return State.reified();
283
+ }
284
+
285
+ static phantom(): PhantomReified<ToTypeStr<State>> {
286
+ return phantom(State.reified());
287
+ }
288
+ static get p() {
289
+ return State.phantom();
290
+ }
291
+
292
+ static get bcs() {
293
+ return bcs.struct("State", {
294
+ liquidity_amount: bcs.u64(),
295
+ value_in_usd: bcs.u64(),
296
+ reserved_amount: bcs.u64(),
297
+ update_ts_ms: bcs.u64(),
298
+ is_active: bcs.bool(),
299
+ last_borrow_rate_ts_ms: bcs.u64(),
300
+ cumulative_borrow_rate: bcs.u64(),
301
+ previous_last_borrow_rate_ts_ms: bcs.u64(),
302
+ previous_cumulative_borrow_rate: bcs.u64(),
303
+ u64_padding: bcs.vector(bcs.u64()),
304
+ });
305
+ }
306
+
307
+ static fromFields(fields: Record<string, any>): State {
308
+ return State.reified().new({
309
+ liquidityAmount: decodeFromFields("u64", fields.liquidity_amount),
310
+ valueInUsd: decodeFromFields("u64", fields.value_in_usd),
311
+ reservedAmount: decodeFromFields("u64", fields.reserved_amount),
312
+ updateTsMs: decodeFromFields("u64", fields.update_ts_ms),
313
+ isActive: decodeFromFields("bool", fields.is_active),
314
+ lastBorrowRateTsMs: decodeFromFields("u64", fields.last_borrow_rate_ts_ms),
315
+ cumulativeBorrowRate: decodeFromFields("u64", fields.cumulative_borrow_rate),
316
+ previousLastBorrowRateTsMs: decodeFromFields("u64", fields.previous_last_borrow_rate_ts_ms),
317
+ previousCumulativeBorrowRate: decodeFromFields("u64", fields.previous_cumulative_borrow_rate),
318
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
319
+ });
320
+ }
321
+
322
+ static fromFieldsWithTypes(item: FieldsWithTypes): State {
323
+ if (!isState(item.type)) {
324
+ throw new Error("not a State type");
325
+ }
326
+
327
+ return State.reified().new({
328
+ liquidityAmount: decodeFromFieldsWithTypes("u64", item.fields.liquidity_amount),
329
+ valueInUsd: decodeFromFieldsWithTypes("u64", item.fields.value_in_usd),
330
+ reservedAmount: decodeFromFieldsWithTypes("u64", item.fields.reserved_amount),
331
+ updateTsMs: decodeFromFieldsWithTypes("u64", item.fields.update_ts_ms),
332
+ isActive: decodeFromFieldsWithTypes("bool", item.fields.is_active),
333
+ lastBorrowRateTsMs: decodeFromFieldsWithTypes("u64", item.fields.last_borrow_rate_ts_ms),
334
+ cumulativeBorrowRate: decodeFromFieldsWithTypes("u64", item.fields.cumulative_borrow_rate),
335
+ previousLastBorrowRateTsMs: decodeFromFieldsWithTypes("u64", item.fields.previous_last_borrow_rate_ts_ms),
336
+ previousCumulativeBorrowRate: decodeFromFieldsWithTypes("u64", item.fields.previous_cumulative_borrow_rate),
337
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
338
+ });
339
+ }
340
+
341
+ static fromBcs(data: Uint8Array): State {
342
+ return State.fromFields(State.bcs.parse(data));
343
+ }
344
+
345
+ toJSONField() {
346
+ return {
347
+ liquidityAmount: this.liquidityAmount.toString(),
348
+ valueInUsd: this.valueInUsd.toString(),
349
+ reservedAmount: this.reservedAmount.toString(),
350
+ updateTsMs: this.updateTsMs.toString(),
351
+ isActive: this.isActive,
352
+ lastBorrowRateTsMs: this.lastBorrowRateTsMs.toString(),
353
+ cumulativeBorrowRate: this.cumulativeBorrowRate.toString(),
354
+ previousLastBorrowRateTsMs: this.previousLastBorrowRateTsMs.toString(),
355
+ previousCumulativeBorrowRate: this.previousCumulativeBorrowRate.toString(),
356
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
357
+ };
358
+ }
359
+
360
+ toJSON() {
361
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
362
+ }
363
+
364
+ static fromJSONField(field: any): State {
365
+ return State.reified().new({
366
+ liquidityAmount: decodeFromJSONField("u64", field.liquidityAmount),
367
+ valueInUsd: decodeFromJSONField("u64", field.valueInUsd),
368
+ reservedAmount: decodeFromJSONField("u64", field.reservedAmount),
369
+ updateTsMs: decodeFromJSONField("u64", field.updateTsMs),
370
+ isActive: decodeFromJSONField("bool", field.isActive),
371
+ lastBorrowRateTsMs: decodeFromJSONField("u64", field.lastBorrowRateTsMs),
372
+ cumulativeBorrowRate: decodeFromJSONField("u64", field.cumulativeBorrowRate),
373
+ previousLastBorrowRateTsMs: decodeFromJSONField("u64", field.previousLastBorrowRateTsMs),
374
+ previousCumulativeBorrowRate: decodeFromJSONField("u64", field.previousCumulativeBorrowRate),
375
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
376
+ });
377
+ }
378
+
379
+ static fromJSON(json: Record<string, any>): State {
380
+ if (json.$typeName !== State.$typeName) {
381
+ throw new Error("not a WithTwoGenerics json object");
382
+ }
383
+
384
+ return State.fromJSONField(json);
385
+ }
386
+
387
+ static fromSuiParsedData(content: SuiParsedData): State {
388
+ if (content.dataType !== "moveObject") {
389
+ throw new Error("not an object");
390
+ }
391
+ if (!isState(content.type)) {
392
+ throw new Error(`object at ${(content.fields as any).id} is not a State object`);
393
+ }
394
+ return State.fromFieldsWithTypes(content);
395
+ }
396
+
397
+ static async fetch(client: SuiClient, id: string): Promise<State> {
398
+ const res = await client.getObject({ id, options: { showBcs: true } });
399
+ if (res.error) {
400
+ throw new Error(`error fetching State object at id ${id}: ${res.error.code}`);
401
+ }
402
+ if (res.data?.bcs?.dataType !== "moveObject" || !isState(res.data.bcs.type)) {
403
+ throw new Error(`object at id ${id} is not a State object`);
404
+ }
405
+ return State.fromBcs(fromB64(res.data.bcs.bcsBytes));
406
+ }
407
+ }
408
+
409
+ /* ============================== AddLiquidityTokenEvent =============================== */
410
+
411
+ export function isAddLiquidityTokenEvent(type: string): boolean {
412
+ type = compressSuiType(type);
413
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::AddLiquidityTokenEvent";
414
+ }
415
+
416
+ export interface AddLiquidityTokenEventFields {
417
+ sender: ToField<"address">;
418
+ index: ToField<"u64">;
419
+ tokenType: ToField<TypeName>;
420
+ config: ToField<Config>;
421
+ state: ToField<State>;
422
+ u64Padding: ToField<Vector<"u64">>;
423
+ }
424
+
425
+ export type AddLiquidityTokenEventReified = Reified<AddLiquidityTokenEvent, AddLiquidityTokenEventFields>;
426
+
427
+ export class AddLiquidityTokenEvent implements StructClass {
428
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::AddLiquidityTokenEvent";
429
+ static readonly $numTypeParams = 0;
430
+
431
+ readonly $typeName = AddLiquidityTokenEvent.$typeName;
432
+
433
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::AddLiquidityTokenEvent";
434
+
435
+ readonly $typeArgs: [];
436
+
437
+ readonly sender: ToField<"address">;
438
+ readonly index: ToField<"u64">;
439
+ readonly tokenType: ToField<TypeName>;
440
+ readonly config: ToField<Config>;
441
+ readonly state: ToField<State>;
442
+ readonly u64Padding: ToField<Vector<"u64">>;
443
+
444
+ private constructor(typeArgs: [], fields: AddLiquidityTokenEventFields) {
445
+ this.$fullTypeName = composeSuiType(
446
+ AddLiquidityTokenEvent.$typeName,
447
+ ...typeArgs
448
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::AddLiquidityTokenEvent";
449
+ this.$typeArgs = typeArgs;
450
+
451
+ this.sender = fields.sender;
452
+ this.index = fields.index;
453
+ this.tokenType = fields.tokenType;
454
+ this.config = fields.config;
455
+ this.state = fields.state;
456
+ this.u64Padding = fields.u64Padding;
457
+ }
458
+
459
+ static reified(): AddLiquidityTokenEventReified {
460
+ return {
461
+ typeName: AddLiquidityTokenEvent.$typeName,
462
+ fullTypeName: composeSuiType(
463
+ AddLiquidityTokenEvent.$typeName,
464
+ ...[]
465
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::AddLiquidityTokenEvent",
466
+ typeArgs: [] as [],
467
+ reifiedTypeArgs: [],
468
+ fromFields: (fields: Record<string, any>) => AddLiquidityTokenEvent.fromFields(fields),
469
+ fromFieldsWithTypes: (item: FieldsWithTypes) => AddLiquidityTokenEvent.fromFieldsWithTypes(item),
470
+ fromBcs: (data: Uint8Array) => AddLiquidityTokenEvent.fromBcs(data),
471
+ bcs: AddLiquidityTokenEvent.bcs,
472
+ fromJSONField: (field: any) => AddLiquidityTokenEvent.fromJSONField(field),
473
+ fromJSON: (json: Record<string, any>) => AddLiquidityTokenEvent.fromJSON(json),
474
+ fromSuiParsedData: (content: SuiParsedData) => AddLiquidityTokenEvent.fromSuiParsedData(content),
475
+ fetch: async (client: SuiClient, id: string) => AddLiquidityTokenEvent.fetch(client, id),
476
+ new: (fields: AddLiquidityTokenEventFields) => {
477
+ return new AddLiquidityTokenEvent([], fields);
478
+ },
479
+ kind: "StructClassReified",
480
+ };
481
+ }
482
+
483
+ static get r() {
484
+ return AddLiquidityTokenEvent.reified();
485
+ }
486
+
487
+ static phantom(): PhantomReified<ToTypeStr<AddLiquidityTokenEvent>> {
488
+ return phantom(AddLiquidityTokenEvent.reified());
489
+ }
490
+ static get p() {
491
+ return AddLiquidityTokenEvent.phantom();
492
+ }
493
+
494
+ static get bcs() {
495
+ return bcs.struct("AddLiquidityTokenEvent", {
496
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
497
+ index: bcs.u64(),
498
+ token_type: TypeName.bcs,
499
+ config: Config.bcs,
500
+ state: State.bcs,
501
+ u64_padding: bcs.vector(bcs.u64()),
502
+ });
503
+ }
504
+
505
+ static fromFields(fields: Record<string, any>): AddLiquidityTokenEvent {
506
+ return AddLiquidityTokenEvent.reified().new({
507
+ sender: decodeFromFields("address", fields.sender),
508
+ index: decodeFromFields("u64", fields.index),
509
+ tokenType: decodeFromFields(TypeName.reified(), fields.token_type),
510
+ config: decodeFromFields(Config.reified(), fields.config),
511
+ state: decodeFromFields(State.reified(), fields.state),
512
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
513
+ });
514
+ }
515
+
516
+ static fromFieldsWithTypes(item: FieldsWithTypes): AddLiquidityTokenEvent {
517
+ if (!isAddLiquidityTokenEvent(item.type)) {
518
+ throw new Error("not a AddLiquidityTokenEvent type");
519
+ }
520
+
521
+ return AddLiquidityTokenEvent.reified().new({
522
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
523
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
524
+ tokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.token_type),
525
+ config: decodeFromFieldsWithTypes(Config.reified(), item.fields.config),
526
+ state: decodeFromFieldsWithTypes(State.reified(), item.fields.state),
527
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
528
+ });
529
+ }
530
+
531
+ static fromBcs(data: Uint8Array): AddLiquidityTokenEvent {
532
+ return AddLiquidityTokenEvent.fromFields(AddLiquidityTokenEvent.bcs.parse(data));
533
+ }
534
+
535
+ toJSONField() {
536
+ return {
537
+ sender: this.sender,
538
+ index: this.index.toString(),
539
+ tokenType: this.tokenType.toJSONField(),
540
+ config: this.config.toJSONField(),
541
+ state: this.state.toJSONField(),
542
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
543
+ };
544
+ }
545
+
546
+ toJSON() {
547
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
548
+ }
549
+
550
+ static fromJSONField(field: any): AddLiquidityTokenEvent {
551
+ return AddLiquidityTokenEvent.reified().new({
552
+ sender: decodeFromJSONField("address", field.sender),
553
+ index: decodeFromJSONField("u64", field.index),
554
+ tokenType: decodeFromJSONField(TypeName.reified(), field.tokenType),
555
+ config: decodeFromJSONField(Config.reified(), field.config),
556
+ state: decodeFromJSONField(State.reified(), field.state),
557
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
558
+ });
559
+ }
560
+
561
+ static fromJSON(json: Record<string, any>): AddLiquidityTokenEvent {
562
+ if (json.$typeName !== AddLiquidityTokenEvent.$typeName) {
563
+ throw new Error("not a WithTwoGenerics json object");
564
+ }
565
+
566
+ return AddLiquidityTokenEvent.fromJSONField(json);
567
+ }
568
+
569
+ static fromSuiParsedData(content: SuiParsedData): AddLiquidityTokenEvent {
570
+ if (content.dataType !== "moveObject") {
571
+ throw new Error("not an object");
572
+ }
573
+ if (!isAddLiquidityTokenEvent(content.type)) {
574
+ throw new Error(`object at ${(content.fields as any).id} is not a AddLiquidityTokenEvent object`);
575
+ }
576
+ return AddLiquidityTokenEvent.fromFieldsWithTypes(content);
577
+ }
578
+
579
+ static async fetch(client: SuiClient, id: string): Promise<AddLiquidityTokenEvent> {
580
+ const res = await client.getObject({ id, options: { showBcs: true } });
581
+ if (res.error) {
582
+ throw new Error(`error fetching AddLiquidityTokenEvent object at id ${id}: ${res.error.code}`);
583
+ }
584
+ if (res.data?.bcs?.dataType !== "moveObject" || !isAddLiquidityTokenEvent(res.data.bcs.type)) {
585
+ throw new Error(`object at id ${id} is not a AddLiquidityTokenEvent object`);
586
+ }
587
+ return AddLiquidityTokenEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
588
+ }
589
+ }
590
+
591
+ /* ============================== BurnLpEvent =============================== */
592
+
593
+ export function isBurnLpEvent(type: string): boolean {
594
+ type = compressSuiType(type);
595
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::BurnLpEvent";
596
+ }
597
+
598
+ export interface BurnLpEventFields {
599
+ sender: ToField<"address">;
600
+ index: ToField<"u64">;
601
+ lpTokenType: ToField<TypeName>;
602
+ burnLpAmount: ToField<"u64">;
603
+ burnAmountUsd: ToField<"u64">;
604
+ burnFeeUsd: ToField<"u64">;
605
+ liquidityTokenType: ToField<TypeName>;
606
+ withdrawTokenAmount: ToField<"u64">;
607
+ u64Padding: ToField<Vector<"u64">>;
608
+ }
609
+
610
+ export type BurnLpEventReified = Reified<BurnLpEvent, BurnLpEventFields>;
611
+
612
+ export class BurnLpEvent implements StructClass {
613
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::BurnLpEvent";
614
+ static readonly $numTypeParams = 0;
615
+
616
+ readonly $typeName = BurnLpEvent.$typeName;
617
+
618
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::BurnLpEvent";
619
+
620
+ readonly $typeArgs: [];
621
+
622
+ readonly sender: ToField<"address">;
623
+ readonly index: ToField<"u64">;
624
+ readonly lpTokenType: ToField<TypeName>;
625
+ readonly burnLpAmount: ToField<"u64">;
626
+ readonly burnAmountUsd: ToField<"u64">;
627
+ readonly burnFeeUsd: ToField<"u64">;
628
+ readonly liquidityTokenType: ToField<TypeName>;
629
+ readonly withdrawTokenAmount: ToField<"u64">;
630
+ readonly u64Padding: ToField<Vector<"u64">>;
631
+
632
+ private constructor(typeArgs: [], fields: BurnLpEventFields) {
633
+ this.$fullTypeName = composeSuiType(
634
+ BurnLpEvent.$typeName,
635
+ ...typeArgs
636
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::BurnLpEvent";
637
+ this.$typeArgs = typeArgs;
638
+
639
+ this.sender = fields.sender;
640
+ this.index = fields.index;
641
+ this.lpTokenType = fields.lpTokenType;
642
+ this.burnLpAmount = fields.burnLpAmount;
643
+ this.burnAmountUsd = fields.burnAmountUsd;
644
+ this.burnFeeUsd = fields.burnFeeUsd;
645
+ this.liquidityTokenType = fields.liquidityTokenType;
646
+ this.withdrawTokenAmount = fields.withdrawTokenAmount;
647
+ this.u64Padding = fields.u64Padding;
648
+ }
649
+
650
+ static reified(): BurnLpEventReified {
651
+ return {
652
+ typeName: BurnLpEvent.$typeName,
653
+ fullTypeName: composeSuiType(
654
+ BurnLpEvent.$typeName,
655
+ ...[]
656
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::BurnLpEvent",
657
+ typeArgs: [] as [],
658
+ reifiedTypeArgs: [],
659
+ fromFields: (fields: Record<string, any>) => BurnLpEvent.fromFields(fields),
660
+ fromFieldsWithTypes: (item: FieldsWithTypes) => BurnLpEvent.fromFieldsWithTypes(item),
661
+ fromBcs: (data: Uint8Array) => BurnLpEvent.fromBcs(data),
662
+ bcs: BurnLpEvent.bcs,
663
+ fromJSONField: (field: any) => BurnLpEvent.fromJSONField(field),
664
+ fromJSON: (json: Record<string, any>) => BurnLpEvent.fromJSON(json),
665
+ fromSuiParsedData: (content: SuiParsedData) => BurnLpEvent.fromSuiParsedData(content),
666
+ fetch: async (client: SuiClient, id: string) => BurnLpEvent.fetch(client, id),
667
+ new: (fields: BurnLpEventFields) => {
668
+ return new BurnLpEvent([], fields);
669
+ },
670
+ kind: "StructClassReified",
671
+ };
672
+ }
673
+
674
+ static get r() {
675
+ return BurnLpEvent.reified();
676
+ }
677
+
678
+ static phantom(): PhantomReified<ToTypeStr<BurnLpEvent>> {
679
+ return phantom(BurnLpEvent.reified());
680
+ }
681
+ static get p() {
682
+ return BurnLpEvent.phantom();
683
+ }
684
+
685
+ static get bcs() {
686
+ return bcs.struct("BurnLpEvent", {
687
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
688
+ index: bcs.u64(),
689
+ lp_token_type: TypeName.bcs,
690
+ burn_lp_amount: bcs.u64(),
691
+ burn_amount_usd: bcs.u64(),
692
+ burn_fee_usd: bcs.u64(),
693
+ liquidity_token_type: TypeName.bcs,
694
+ withdraw_token_amount: bcs.u64(),
695
+ u64_padding: bcs.vector(bcs.u64()),
696
+ });
697
+ }
698
+
699
+ static fromFields(fields: Record<string, any>): BurnLpEvent {
700
+ return BurnLpEvent.reified().new({
701
+ sender: decodeFromFields("address", fields.sender),
702
+ index: decodeFromFields("u64", fields.index),
703
+ lpTokenType: decodeFromFields(TypeName.reified(), fields.lp_token_type),
704
+ burnLpAmount: decodeFromFields("u64", fields.burn_lp_amount),
705
+ burnAmountUsd: decodeFromFields("u64", fields.burn_amount_usd),
706
+ burnFeeUsd: decodeFromFields("u64", fields.burn_fee_usd),
707
+ liquidityTokenType: decodeFromFields(TypeName.reified(), fields.liquidity_token_type),
708
+ withdrawTokenAmount: decodeFromFields("u64", fields.withdraw_token_amount),
709
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
710
+ });
711
+ }
712
+
713
+ static fromFieldsWithTypes(item: FieldsWithTypes): BurnLpEvent {
714
+ if (!isBurnLpEvent(item.type)) {
715
+ throw new Error("not a BurnLpEvent type");
716
+ }
717
+
718
+ return BurnLpEvent.reified().new({
719
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
720
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
721
+ lpTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.lp_token_type),
722
+ burnLpAmount: decodeFromFieldsWithTypes("u64", item.fields.burn_lp_amount),
723
+ burnAmountUsd: decodeFromFieldsWithTypes("u64", item.fields.burn_amount_usd),
724
+ burnFeeUsd: decodeFromFieldsWithTypes("u64", item.fields.burn_fee_usd),
725
+ liquidityTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token_type),
726
+ withdrawTokenAmount: decodeFromFieldsWithTypes("u64", item.fields.withdraw_token_amount),
727
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
728
+ });
729
+ }
730
+
731
+ static fromBcs(data: Uint8Array): BurnLpEvent {
732
+ return BurnLpEvent.fromFields(BurnLpEvent.bcs.parse(data));
733
+ }
734
+
735
+ toJSONField() {
736
+ return {
737
+ sender: this.sender,
738
+ index: this.index.toString(),
739
+ lpTokenType: this.lpTokenType.toJSONField(),
740
+ burnLpAmount: this.burnLpAmount.toString(),
741
+ burnAmountUsd: this.burnAmountUsd.toString(),
742
+ burnFeeUsd: this.burnFeeUsd.toString(),
743
+ liquidityTokenType: this.liquidityTokenType.toJSONField(),
744
+ withdrawTokenAmount: this.withdrawTokenAmount.toString(),
745
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
746
+ };
747
+ }
748
+
749
+ toJSON() {
750
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
751
+ }
752
+
753
+ static fromJSONField(field: any): BurnLpEvent {
754
+ return BurnLpEvent.reified().new({
755
+ sender: decodeFromJSONField("address", field.sender),
756
+ index: decodeFromJSONField("u64", field.index),
757
+ lpTokenType: decodeFromJSONField(TypeName.reified(), field.lpTokenType),
758
+ burnLpAmount: decodeFromJSONField("u64", field.burnLpAmount),
759
+ burnAmountUsd: decodeFromJSONField("u64", field.burnAmountUsd),
760
+ burnFeeUsd: decodeFromJSONField("u64", field.burnFeeUsd),
761
+ liquidityTokenType: decodeFromJSONField(TypeName.reified(), field.liquidityTokenType),
762
+ withdrawTokenAmount: decodeFromJSONField("u64", field.withdrawTokenAmount),
763
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
764
+ });
765
+ }
766
+
767
+ static fromJSON(json: Record<string, any>): BurnLpEvent {
768
+ if (json.$typeName !== BurnLpEvent.$typeName) {
769
+ throw new Error("not a WithTwoGenerics json object");
770
+ }
771
+
772
+ return BurnLpEvent.fromJSONField(json);
773
+ }
774
+
775
+ static fromSuiParsedData(content: SuiParsedData): BurnLpEvent {
776
+ if (content.dataType !== "moveObject") {
777
+ throw new Error("not an object");
778
+ }
779
+ if (!isBurnLpEvent(content.type)) {
780
+ throw new Error(`object at ${(content.fields as any).id} is not a BurnLpEvent object`);
781
+ }
782
+ return BurnLpEvent.fromFieldsWithTypes(content);
783
+ }
784
+
785
+ static async fetch(client: SuiClient, id: string): Promise<BurnLpEvent> {
786
+ const res = await client.getObject({ id, options: { showBcs: true } });
787
+ if (res.error) {
788
+ throw new Error(`error fetching BurnLpEvent object at id ${id}: ${res.error.code}`);
789
+ }
790
+ if (res.data?.bcs?.dataType !== "moveObject" || !isBurnLpEvent(res.data.bcs.type)) {
791
+ throw new Error(`object at id ${id} is not a BurnLpEvent object`);
792
+ }
793
+ return BurnLpEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
794
+ }
795
+ }
796
+
797
+ /* ============================== LiquidityPool =============================== */
798
+
799
+ export function isLiquidityPool(type: string): boolean {
800
+ type = compressSuiType(type);
801
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPool";
802
+ }
803
+
804
+ export interface LiquidityPoolFields {
805
+ id: ToField<UID>;
806
+ index: ToField<"u64">;
807
+ lpTokenType: ToField<TypeName>;
808
+ liquidityTokens: ToField<Vector<TypeName>>;
809
+ tokenPools: ToField<Vector<TokenPool>>;
810
+ poolInfo: ToField<LiquidityPoolInfo>;
811
+ u64Padding: ToField<Vector<"u64">>;
812
+ bcsPadding: ToField<Vector<"u8">>;
813
+ }
814
+
815
+ export type LiquidityPoolReified = Reified<LiquidityPool, LiquidityPoolFields>;
816
+
817
+ export class LiquidityPool implements StructClass {
818
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPool";
819
+ static readonly $numTypeParams = 0;
820
+
821
+ readonly $typeName = LiquidityPool.$typeName;
822
+
823
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPool";
824
+
825
+ readonly $typeArgs: [];
826
+
827
+ readonly id: ToField<UID>;
828
+ readonly index: ToField<"u64">;
829
+ readonly lpTokenType: ToField<TypeName>;
830
+ readonly liquidityTokens: ToField<Vector<TypeName>>;
831
+ readonly tokenPools: ToField<Vector<TokenPool>>;
832
+ readonly poolInfo: ToField<LiquidityPoolInfo>;
833
+ readonly u64Padding: ToField<Vector<"u64">>;
834
+ readonly bcsPadding: ToField<Vector<"u8">>;
835
+
836
+ private constructor(typeArgs: [], fields: LiquidityPoolFields) {
837
+ this.$fullTypeName = composeSuiType(
838
+ LiquidityPool.$typeName,
839
+ ...typeArgs
840
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPool";
841
+ this.$typeArgs = typeArgs;
842
+
843
+ this.id = fields.id;
844
+ this.index = fields.index;
845
+ this.lpTokenType = fields.lpTokenType;
846
+ this.liquidityTokens = fields.liquidityTokens;
847
+ this.tokenPools = fields.tokenPools;
848
+ this.poolInfo = fields.poolInfo;
849
+ this.u64Padding = fields.u64Padding;
850
+ this.bcsPadding = fields.bcsPadding;
851
+ }
852
+
853
+ static reified(): LiquidityPoolReified {
854
+ return {
855
+ typeName: LiquidityPool.$typeName,
856
+ fullTypeName: composeSuiType(
857
+ LiquidityPool.$typeName,
858
+ ...[]
859
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPool",
860
+ typeArgs: [] as [],
861
+ reifiedTypeArgs: [],
862
+ fromFields: (fields: Record<string, any>) => LiquidityPool.fromFields(fields),
863
+ fromFieldsWithTypes: (item: FieldsWithTypes) => LiquidityPool.fromFieldsWithTypes(item),
864
+ fromBcs: (data: Uint8Array) => LiquidityPool.fromBcs(data),
865
+ bcs: LiquidityPool.bcs,
866
+ fromJSONField: (field: any) => LiquidityPool.fromJSONField(field),
867
+ fromJSON: (json: Record<string, any>) => LiquidityPool.fromJSON(json),
868
+ fromSuiParsedData: (content: SuiParsedData) => LiquidityPool.fromSuiParsedData(content),
869
+ fetch: async (client: SuiClient, id: string) => LiquidityPool.fetch(client, id),
870
+ new: (fields: LiquidityPoolFields) => {
871
+ return new LiquidityPool([], fields);
872
+ },
873
+ kind: "StructClassReified",
874
+ };
875
+ }
876
+
877
+ static get r() {
878
+ return LiquidityPool.reified();
879
+ }
880
+
881
+ static phantom(): PhantomReified<ToTypeStr<LiquidityPool>> {
882
+ return phantom(LiquidityPool.reified());
883
+ }
884
+ static get p() {
885
+ return LiquidityPool.phantom();
886
+ }
887
+
888
+ static get bcs() {
889
+ return bcs.struct("LiquidityPool", {
890
+ id: UID.bcs,
891
+ index: bcs.u64(),
892
+ lp_token_type: TypeName.bcs,
893
+ liquidity_tokens: bcs.vector(TypeName.bcs),
894
+ token_pools: bcs.vector(TokenPool.bcs),
895
+ pool_info: LiquidityPoolInfo.bcs,
896
+ u64_padding: bcs.vector(bcs.u64()),
897
+ bcs_padding: bcs.vector(bcs.u8()),
898
+ });
899
+ }
900
+
901
+ static fromFields(fields: Record<string, any>): LiquidityPool {
902
+ return LiquidityPool.reified().new({
903
+ id: decodeFromFields(UID.reified(), fields.id),
904
+ index: decodeFromFields("u64", fields.index),
905
+ lpTokenType: decodeFromFields(TypeName.reified(), fields.lp_token_type),
906
+ liquidityTokens: decodeFromFields(reified.vector(TypeName.reified()), fields.liquidity_tokens),
907
+ tokenPools: decodeFromFields(reified.vector(TokenPool.reified()), fields.token_pools),
908
+ poolInfo: decodeFromFields(LiquidityPoolInfo.reified(), fields.pool_info),
909
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
910
+ bcsPadding: decodeFromFields(reified.vector("u8"), fields.bcs_padding),
911
+ });
912
+ }
913
+
914
+ static fromFieldsWithTypes(item: FieldsWithTypes): LiquidityPool {
915
+ if (!isLiquidityPool(item.type)) {
916
+ throw new Error("not a LiquidityPool type");
917
+ }
918
+
919
+ return LiquidityPool.reified().new({
920
+ id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
921
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
922
+ lpTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.lp_token_type),
923
+ liquidityTokens: decodeFromFieldsWithTypes(reified.vector(TypeName.reified()), item.fields.liquidity_tokens),
924
+ tokenPools: decodeFromFieldsWithTypes(reified.vector(TokenPool.reified()), item.fields.token_pools),
925
+ poolInfo: decodeFromFieldsWithTypes(LiquidityPoolInfo.reified(), item.fields.pool_info),
926
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
927
+ bcsPadding: decodeFromFieldsWithTypes(reified.vector("u8"), item.fields.bcs_padding),
928
+ });
929
+ }
930
+
931
+ static fromBcs(data: Uint8Array): LiquidityPool {
932
+ return LiquidityPool.fromFields(LiquidityPool.bcs.parse(data));
933
+ }
934
+
935
+ toJSONField() {
936
+ return {
937
+ id: this.id,
938
+ index: this.index.toString(),
939
+ lpTokenType: this.lpTokenType.toJSONField(),
940
+ liquidityTokens: fieldToJSON<Vector<TypeName>>(`vector<0x1::type_name::TypeName>`, this.liquidityTokens),
941
+ tokenPools: fieldToJSON<Vector<TokenPool>>(
942
+ `vector<0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::TokenPool>`,
943
+ this.tokenPools
944
+ ),
945
+ poolInfo: this.poolInfo.toJSONField(),
946
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
947
+ bcsPadding: fieldToJSON<Vector<"u8">>(`vector<u8>`, this.bcsPadding),
948
+ };
949
+ }
950
+
951
+ toJSON() {
952
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
953
+ }
954
+
955
+ static fromJSONField(field: any): LiquidityPool {
956
+ return LiquidityPool.reified().new({
957
+ id: decodeFromJSONField(UID.reified(), field.id),
958
+ index: decodeFromJSONField("u64", field.index),
959
+ lpTokenType: decodeFromJSONField(TypeName.reified(), field.lpTokenType),
960
+ liquidityTokens: decodeFromJSONField(reified.vector(TypeName.reified()), field.liquidityTokens),
961
+ tokenPools: decodeFromJSONField(reified.vector(TokenPool.reified()), field.tokenPools),
962
+ poolInfo: decodeFromJSONField(LiquidityPoolInfo.reified(), field.poolInfo),
963
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
964
+ bcsPadding: decodeFromJSONField(reified.vector("u8"), field.bcsPadding),
965
+ });
966
+ }
967
+
968
+ static fromJSON(json: Record<string, any>): LiquidityPool {
969
+ if (json.$typeName !== LiquidityPool.$typeName) {
970
+ throw new Error("not a WithTwoGenerics json object");
971
+ }
972
+
973
+ return LiquidityPool.fromJSONField(json);
974
+ }
975
+
976
+ static fromSuiParsedData(content: SuiParsedData): LiquidityPool {
977
+ if (content.dataType !== "moveObject") {
978
+ throw new Error("not an object");
979
+ }
980
+ if (!isLiquidityPool(content.type)) {
981
+ throw new Error(`object at ${(content.fields as any).id} is not a LiquidityPool object`);
982
+ }
983
+ return LiquidityPool.fromFieldsWithTypes(content);
984
+ }
985
+
986
+ static async fetch(client: SuiClient, id: string): Promise<LiquidityPool> {
987
+ const res = await client.getObject({ id, options: { showBcs: true } });
988
+ if (res.error) {
989
+ throw new Error(`error fetching LiquidityPool object at id ${id}: ${res.error.code}`);
990
+ }
991
+ if (res.data?.bcs?.dataType !== "moveObject" || !isLiquidityPool(res.data.bcs.type)) {
992
+ throw new Error(`object at id ${id} is not a LiquidityPool object`);
993
+ }
994
+ return LiquidityPool.fromBcs(fromB64(res.data.bcs.bcsBytes));
995
+ }
996
+ }
997
+
998
+ /* ============================== LiquidityPoolInfo =============================== */
999
+
1000
+ export function isLiquidityPoolInfo(type: string): boolean {
1001
+ type = compressSuiType(type);
1002
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPoolInfo";
1003
+ }
1004
+
1005
+ export interface LiquidityPoolInfoFields {
1006
+ lpTokenDecimal: ToField<"u64">;
1007
+ totalShareSupply: ToField<"u64">;
1008
+ tvlUsd: ToField<"u64">;
1009
+ isActive: ToField<"bool">;
1010
+ }
1011
+
1012
+ export type LiquidityPoolInfoReified = Reified<LiquidityPoolInfo, LiquidityPoolInfoFields>;
1013
+
1014
+ export class LiquidityPoolInfo implements StructClass {
1015
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPoolInfo";
1016
+ static readonly $numTypeParams = 0;
1017
+
1018
+ readonly $typeName = LiquidityPoolInfo.$typeName;
1019
+
1020
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPoolInfo";
1021
+
1022
+ readonly $typeArgs: [];
1023
+
1024
+ readonly lpTokenDecimal: ToField<"u64">;
1025
+ readonly totalShareSupply: ToField<"u64">;
1026
+ readonly tvlUsd: ToField<"u64">;
1027
+ readonly isActive: ToField<"bool">;
1028
+
1029
+ private constructor(typeArgs: [], fields: LiquidityPoolInfoFields) {
1030
+ this.$fullTypeName = composeSuiType(
1031
+ LiquidityPoolInfo.$typeName,
1032
+ ...typeArgs
1033
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPoolInfo";
1034
+ this.$typeArgs = typeArgs;
1035
+
1036
+ this.lpTokenDecimal = fields.lpTokenDecimal;
1037
+ this.totalShareSupply = fields.totalShareSupply;
1038
+ this.tvlUsd = fields.tvlUsd;
1039
+ this.isActive = fields.isActive;
1040
+ }
1041
+
1042
+ static reified(): LiquidityPoolInfoReified {
1043
+ return {
1044
+ typeName: LiquidityPoolInfo.$typeName,
1045
+ fullTypeName: composeSuiType(
1046
+ LiquidityPoolInfo.$typeName,
1047
+ ...[]
1048
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::LiquidityPoolInfo",
1049
+ typeArgs: [] as [],
1050
+ reifiedTypeArgs: [],
1051
+ fromFields: (fields: Record<string, any>) => LiquidityPoolInfo.fromFields(fields),
1052
+ fromFieldsWithTypes: (item: FieldsWithTypes) => LiquidityPoolInfo.fromFieldsWithTypes(item),
1053
+ fromBcs: (data: Uint8Array) => LiquidityPoolInfo.fromBcs(data),
1054
+ bcs: LiquidityPoolInfo.bcs,
1055
+ fromJSONField: (field: any) => LiquidityPoolInfo.fromJSONField(field),
1056
+ fromJSON: (json: Record<string, any>) => LiquidityPoolInfo.fromJSON(json),
1057
+ fromSuiParsedData: (content: SuiParsedData) => LiquidityPoolInfo.fromSuiParsedData(content),
1058
+ fetch: async (client: SuiClient, id: string) => LiquidityPoolInfo.fetch(client, id),
1059
+ new: (fields: LiquidityPoolInfoFields) => {
1060
+ return new LiquidityPoolInfo([], fields);
1061
+ },
1062
+ kind: "StructClassReified",
1063
+ };
1064
+ }
1065
+
1066
+ static get r() {
1067
+ return LiquidityPoolInfo.reified();
1068
+ }
1069
+
1070
+ static phantom(): PhantomReified<ToTypeStr<LiquidityPoolInfo>> {
1071
+ return phantom(LiquidityPoolInfo.reified());
1072
+ }
1073
+ static get p() {
1074
+ return LiquidityPoolInfo.phantom();
1075
+ }
1076
+
1077
+ static get bcs() {
1078
+ return bcs.struct("LiquidityPoolInfo", {
1079
+ lp_token_decimal: bcs.u64(),
1080
+ total_share_supply: bcs.u64(),
1081
+ tvl_usd: bcs.u64(),
1082
+ is_active: bcs.bool(),
1083
+ });
1084
+ }
1085
+
1086
+ static fromFields(fields: Record<string, any>): LiquidityPoolInfo {
1087
+ return LiquidityPoolInfo.reified().new({
1088
+ lpTokenDecimal: decodeFromFields("u64", fields.lp_token_decimal),
1089
+ totalShareSupply: decodeFromFields("u64", fields.total_share_supply),
1090
+ tvlUsd: decodeFromFields("u64", fields.tvl_usd),
1091
+ isActive: decodeFromFields("bool", fields.is_active),
1092
+ });
1093
+ }
1094
+
1095
+ static fromFieldsWithTypes(item: FieldsWithTypes): LiquidityPoolInfo {
1096
+ if (!isLiquidityPoolInfo(item.type)) {
1097
+ throw new Error("not a LiquidityPoolInfo type");
1098
+ }
1099
+
1100
+ return LiquidityPoolInfo.reified().new({
1101
+ lpTokenDecimal: decodeFromFieldsWithTypes("u64", item.fields.lp_token_decimal),
1102
+ totalShareSupply: decodeFromFieldsWithTypes("u64", item.fields.total_share_supply),
1103
+ tvlUsd: decodeFromFieldsWithTypes("u64", item.fields.tvl_usd),
1104
+ isActive: decodeFromFieldsWithTypes("bool", item.fields.is_active),
1105
+ });
1106
+ }
1107
+
1108
+ static fromBcs(data: Uint8Array): LiquidityPoolInfo {
1109
+ return LiquidityPoolInfo.fromFields(LiquidityPoolInfo.bcs.parse(data));
1110
+ }
1111
+
1112
+ toJSONField() {
1113
+ return {
1114
+ lpTokenDecimal: this.lpTokenDecimal.toString(),
1115
+ totalShareSupply: this.totalShareSupply.toString(),
1116
+ tvlUsd: this.tvlUsd.toString(),
1117
+ isActive: this.isActive,
1118
+ };
1119
+ }
1120
+
1121
+ toJSON() {
1122
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1123
+ }
1124
+
1125
+ static fromJSONField(field: any): LiquidityPoolInfo {
1126
+ return LiquidityPoolInfo.reified().new({
1127
+ lpTokenDecimal: decodeFromJSONField("u64", field.lpTokenDecimal),
1128
+ totalShareSupply: decodeFromJSONField("u64", field.totalShareSupply),
1129
+ tvlUsd: decodeFromJSONField("u64", field.tvlUsd),
1130
+ isActive: decodeFromJSONField("bool", field.isActive),
1131
+ });
1132
+ }
1133
+
1134
+ static fromJSON(json: Record<string, any>): LiquidityPoolInfo {
1135
+ if (json.$typeName !== LiquidityPoolInfo.$typeName) {
1136
+ throw new Error("not a WithTwoGenerics json object");
1137
+ }
1138
+
1139
+ return LiquidityPoolInfo.fromJSONField(json);
1140
+ }
1141
+
1142
+ static fromSuiParsedData(content: SuiParsedData): LiquidityPoolInfo {
1143
+ if (content.dataType !== "moveObject") {
1144
+ throw new Error("not an object");
1145
+ }
1146
+ if (!isLiquidityPoolInfo(content.type)) {
1147
+ throw new Error(`object at ${(content.fields as any).id} is not a LiquidityPoolInfo object`);
1148
+ }
1149
+ return LiquidityPoolInfo.fromFieldsWithTypes(content);
1150
+ }
1151
+
1152
+ static async fetch(client: SuiClient, id: string): Promise<LiquidityPoolInfo> {
1153
+ const res = await client.getObject({ id, options: { showBcs: true } });
1154
+ if (res.error) {
1155
+ throw new Error(`error fetching LiquidityPoolInfo object at id ${id}: ${res.error.code}`);
1156
+ }
1157
+ if (res.data?.bcs?.dataType !== "moveObject" || !isLiquidityPoolInfo(res.data.bcs.type)) {
1158
+ throw new Error(`object at id ${id} is not a LiquidityPoolInfo object`);
1159
+ }
1160
+ return LiquidityPoolInfo.fromBcs(fromB64(res.data.bcs.bcsBytes));
1161
+ }
1162
+ }
1163
+
1164
+ /* ============================== MarginConfig =============================== */
1165
+
1166
+ export function isMarginConfig(type: string): boolean {
1167
+ type = compressSuiType(type);
1168
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MarginConfig";
1169
+ }
1170
+
1171
+ export interface MarginConfigFields {
1172
+ basicBorrowRate0: ToField<"u64">;
1173
+ basicBorrowRate1: ToField<"u64">;
1174
+ basicBorrowRate2: ToField<"u64">;
1175
+ utilizationThresholdBp0: ToField<"u64">;
1176
+ utilizationThresholdBp1: ToField<"u64">;
1177
+ borrowIntervalTsMs: ToField<"u64">;
1178
+ maxOrderReserveRatioBp: ToField<"u64">;
1179
+ u64Padding: ToField<Vector<"u64">>;
1180
+ }
1181
+
1182
+ export type MarginConfigReified = Reified<MarginConfig, MarginConfigFields>;
1183
+
1184
+ export class MarginConfig implements StructClass {
1185
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MarginConfig";
1186
+ static readonly $numTypeParams = 0;
1187
+
1188
+ readonly $typeName = MarginConfig.$typeName;
1189
+
1190
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MarginConfig";
1191
+
1192
+ readonly $typeArgs: [];
1193
+
1194
+ readonly basicBorrowRate0: ToField<"u64">;
1195
+ readonly basicBorrowRate1: ToField<"u64">;
1196
+ readonly basicBorrowRate2: ToField<"u64">;
1197
+ readonly utilizationThresholdBp0: ToField<"u64">;
1198
+ readonly utilizationThresholdBp1: ToField<"u64">;
1199
+ readonly borrowIntervalTsMs: ToField<"u64">;
1200
+ readonly maxOrderReserveRatioBp: ToField<"u64">;
1201
+ readonly u64Padding: ToField<Vector<"u64">>;
1202
+
1203
+ private constructor(typeArgs: [], fields: MarginConfigFields) {
1204
+ this.$fullTypeName = composeSuiType(
1205
+ MarginConfig.$typeName,
1206
+ ...typeArgs
1207
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MarginConfig";
1208
+ this.$typeArgs = typeArgs;
1209
+
1210
+ this.basicBorrowRate0 = fields.basicBorrowRate0;
1211
+ this.basicBorrowRate1 = fields.basicBorrowRate1;
1212
+ this.basicBorrowRate2 = fields.basicBorrowRate2;
1213
+ this.utilizationThresholdBp0 = fields.utilizationThresholdBp0;
1214
+ this.utilizationThresholdBp1 = fields.utilizationThresholdBp1;
1215
+ this.borrowIntervalTsMs = fields.borrowIntervalTsMs;
1216
+ this.maxOrderReserveRatioBp = fields.maxOrderReserveRatioBp;
1217
+ this.u64Padding = fields.u64Padding;
1218
+ }
1219
+
1220
+ static reified(): MarginConfigReified {
1221
+ return {
1222
+ typeName: MarginConfig.$typeName,
1223
+ fullTypeName: composeSuiType(
1224
+ MarginConfig.$typeName,
1225
+ ...[]
1226
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MarginConfig",
1227
+ typeArgs: [] as [],
1228
+ reifiedTypeArgs: [],
1229
+ fromFields: (fields: Record<string, any>) => MarginConfig.fromFields(fields),
1230
+ fromFieldsWithTypes: (item: FieldsWithTypes) => MarginConfig.fromFieldsWithTypes(item),
1231
+ fromBcs: (data: Uint8Array) => MarginConfig.fromBcs(data),
1232
+ bcs: MarginConfig.bcs,
1233
+ fromJSONField: (field: any) => MarginConfig.fromJSONField(field),
1234
+ fromJSON: (json: Record<string, any>) => MarginConfig.fromJSON(json),
1235
+ fromSuiParsedData: (content: SuiParsedData) => MarginConfig.fromSuiParsedData(content),
1236
+ fetch: async (client: SuiClient, id: string) => MarginConfig.fetch(client, id),
1237
+ new: (fields: MarginConfigFields) => {
1238
+ return new MarginConfig([], fields);
1239
+ },
1240
+ kind: "StructClassReified",
1241
+ };
1242
+ }
1243
+
1244
+ static get r() {
1245
+ return MarginConfig.reified();
1246
+ }
1247
+
1248
+ static phantom(): PhantomReified<ToTypeStr<MarginConfig>> {
1249
+ return phantom(MarginConfig.reified());
1250
+ }
1251
+ static get p() {
1252
+ return MarginConfig.phantom();
1253
+ }
1254
+
1255
+ static get bcs() {
1256
+ return bcs.struct("MarginConfig", {
1257
+ basic_borrow_rate_0: bcs.u64(),
1258
+ basic_borrow_rate_1: bcs.u64(),
1259
+ basic_borrow_rate_2: bcs.u64(),
1260
+ utilization_threshold_bp_0: bcs.u64(),
1261
+ utilization_threshold_bp_1: bcs.u64(),
1262
+ borrow_interval_ts_ms: bcs.u64(),
1263
+ max_order_reserve_ratio_bp: bcs.u64(),
1264
+ u64_padding: bcs.vector(bcs.u64()),
1265
+ });
1266
+ }
1267
+
1268
+ static fromFields(fields: Record<string, any>): MarginConfig {
1269
+ return MarginConfig.reified().new({
1270
+ basicBorrowRate0: decodeFromFields("u64", fields.basic_borrow_rate_0),
1271
+ basicBorrowRate1: decodeFromFields("u64", fields.basic_borrow_rate_1),
1272
+ basicBorrowRate2: decodeFromFields("u64", fields.basic_borrow_rate_2),
1273
+ utilizationThresholdBp0: decodeFromFields("u64", fields.utilization_threshold_bp_0),
1274
+ utilizationThresholdBp1: decodeFromFields("u64", fields.utilization_threshold_bp_1),
1275
+ borrowIntervalTsMs: decodeFromFields("u64", fields.borrow_interval_ts_ms),
1276
+ maxOrderReserveRatioBp: decodeFromFields("u64", fields.max_order_reserve_ratio_bp),
1277
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
1278
+ });
1279
+ }
1280
+
1281
+ static fromFieldsWithTypes(item: FieldsWithTypes): MarginConfig {
1282
+ if (!isMarginConfig(item.type)) {
1283
+ throw new Error("not a MarginConfig type");
1284
+ }
1285
+
1286
+ return MarginConfig.reified().new({
1287
+ basicBorrowRate0: decodeFromFieldsWithTypes("u64", item.fields.basic_borrow_rate_0),
1288
+ basicBorrowRate1: decodeFromFieldsWithTypes("u64", item.fields.basic_borrow_rate_1),
1289
+ basicBorrowRate2: decodeFromFieldsWithTypes("u64", item.fields.basic_borrow_rate_2),
1290
+ utilizationThresholdBp0: decodeFromFieldsWithTypes("u64", item.fields.utilization_threshold_bp_0),
1291
+ utilizationThresholdBp1: decodeFromFieldsWithTypes("u64", item.fields.utilization_threshold_bp_1),
1292
+ borrowIntervalTsMs: decodeFromFieldsWithTypes("u64", item.fields.borrow_interval_ts_ms),
1293
+ maxOrderReserveRatioBp: decodeFromFieldsWithTypes("u64", item.fields.max_order_reserve_ratio_bp),
1294
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
1295
+ });
1296
+ }
1297
+
1298
+ static fromBcs(data: Uint8Array): MarginConfig {
1299
+ return MarginConfig.fromFields(MarginConfig.bcs.parse(data));
1300
+ }
1301
+
1302
+ toJSONField() {
1303
+ return {
1304
+ basicBorrowRate0: this.basicBorrowRate0.toString(),
1305
+ basicBorrowRate1: this.basicBorrowRate1.toString(),
1306
+ basicBorrowRate2: this.basicBorrowRate2.toString(),
1307
+ utilizationThresholdBp0: this.utilizationThresholdBp0.toString(),
1308
+ utilizationThresholdBp1: this.utilizationThresholdBp1.toString(),
1309
+ borrowIntervalTsMs: this.borrowIntervalTsMs.toString(),
1310
+ maxOrderReserveRatioBp: this.maxOrderReserveRatioBp.toString(),
1311
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
1312
+ };
1313
+ }
1314
+
1315
+ toJSON() {
1316
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1317
+ }
1318
+
1319
+ static fromJSONField(field: any): MarginConfig {
1320
+ return MarginConfig.reified().new({
1321
+ basicBorrowRate0: decodeFromJSONField("u64", field.basicBorrowRate0),
1322
+ basicBorrowRate1: decodeFromJSONField("u64", field.basicBorrowRate1),
1323
+ basicBorrowRate2: decodeFromJSONField("u64", field.basicBorrowRate2),
1324
+ utilizationThresholdBp0: decodeFromJSONField("u64", field.utilizationThresholdBp0),
1325
+ utilizationThresholdBp1: decodeFromJSONField("u64", field.utilizationThresholdBp1),
1326
+ borrowIntervalTsMs: decodeFromJSONField("u64", field.borrowIntervalTsMs),
1327
+ maxOrderReserveRatioBp: decodeFromJSONField("u64", field.maxOrderReserveRatioBp),
1328
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
1329
+ });
1330
+ }
1331
+
1332
+ static fromJSON(json: Record<string, any>): MarginConfig {
1333
+ if (json.$typeName !== MarginConfig.$typeName) {
1334
+ throw new Error("not a WithTwoGenerics json object");
1335
+ }
1336
+
1337
+ return MarginConfig.fromJSONField(json);
1338
+ }
1339
+
1340
+ static fromSuiParsedData(content: SuiParsedData): MarginConfig {
1341
+ if (content.dataType !== "moveObject") {
1342
+ throw new Error("not an object");
1343
+ }
1344
+ if (!isMarginConfig(content.type)) {
1345
+ throw new Error(`object at ${(content.fields as any).id} is not a MarginConfig object`);
1346
+ }
1347
+ return MarginConfig.fromFieldsWithTypes(content);
1348
+ }
1349
+
1350
+ static async fetch(client: SuiClient, id: string): Promise<MarginConfig> {
1351
+ const res = await client.getObject({ id, options: { showBcs: true } });
1352
+ if (res.error) {
1353
+ throw new Error(`error fetching MarginConfig object at id ${id}: ${res.error.code}`);
1354
+ }
1355
+ if (res.data?.bcs?.dataType !== "moveObject" || !isMarginConfig(res.data.bcs.type)) {
1356
+ throw new Error(`object at id ${id} is not a MarginConfig object`);
1357
+ }
1358
+ return MarginConfig.fromBcs(fromB64(res.data.bcs.bcsBytes));
1359
+ }
1360
+ }
1361
+
1362
+ /* ============================== MintLpEvent =============================== */
1363
+
1364
+ export function isMintLpEvent(type: string): boolean {
1365
+ type = compressSuiType(type);
1366
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MintLpEvent";
1367
+ }
1368
+
1369
+ export interface MintLpEventFields {
1370
+ sender: ToField<"address">;
1371
+ index: ToField<"u64">;
1372
+ liquidityTokenType: ToField<TypeName>;
1373
+ depositAmount: ToField<"u64">;
1374
+ depositAmountUsd: ToField<"u64">;
1375
+ mintFeeUsd: ToField<"u64">;
1376
+ lpTokenType: ToField<TypeName>;
1377
+ mintedLpAmount: ToField<"u64">;
1378
+ u64Padding: ToField<Vector<"u64">>;
1379
+ }
1380
+
1381
+ export type MintLpEventReified = Reified<MintLpEvent, MintLpEventFields>;
1382
+
1383
+ export class MintLpEvent implements StructClass {
1384
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MintLpEvent";
1385
+ static readonly $numTypeParams = 0;
1386
+
1387
+ readonly $typeName = MintLpEvent.$typeName;
1388
+
1389
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MintLpEvent";
1390
+
1391
+ readonly $typeArgs: [];
1392
+
1393
+ readonly sender: ToField<"address">;
1394
+ readonly index: ToField<"u64">;
1395
+ readonly liquidityTokenType: ToField<TypeName>;
1396
+ readonly depositAmount: ToField<"u64">;
1397
+ readonly depositAmountUsd: ToField<"u64">;
1398
+ readonly mintFeeUsd: ToField<"u64">;
1399
+ readonly lpTokenType: ToField<TypeName>;
1400
+ readonly mintedLpAmount: ToField<"u64">;
1401
+ readonly u64Padding: ToField<Vector<"u64">>;
1402
+
1403
+ private constructor(typeArgs: [], fields: MintLpEventFields) {
1404
+ this.$fullTypeName = composeSuiType(
1405
+ MintLpEvent.$typeName,
1406
+ ...typeArgs
1407
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MintLpEvent";
1408
+ this.$typeArgs = typeArgs;
1409
+
1410
+ this.sender = fields.sender;
1411
+ this.index = fields.index;
1412
+ this.liquidityTokenType = fields.liquidityTokenType;
1413
+ this.depositAmount = fields.depositAmount;
1414
+ this.depositAmountUsd = fields.depositAmountUsd;
1415
+ this.mintFeeUsd = fields.mintFeeUsd;
1416
+ this.lpTokenType = fields.lpTokenType;
1417
+ this.mintedLpAmount = fields.mintedLpAmount;
1418
+ this.u64Padding = fields.u64Padding;
1419
+ }
1420
+
1421
+ static reified(): MintLpEventReified {
1422
+ return {
1423
+ typeName: MintLpEvent.$typeName,
1424
+ fullTypeName: composeSuiType(
1425
+ MintLpEvent.$typeName,
1426
+ ...[]
1427
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::MintLpEvent",
1428
+ typeArgs: [] as [],
1429
+ reifiedTypeArgs: [],
1430
+ fromFields: (fields: Record<string, any>) => MintLpEvent.fromFields(fields),
1431
+ fromFieldsWithTypes: (item: FieldsWithTypes) => MintLpEvent.fromFieldsWithTypes(item),
1432
+ fromBcs: (data: Uint8Array) => MintLpEvent.fromBcs(data),
1433
+ bcs: MintLpEvent.bcs,
1434
+ fromJSONField: (field: any) => MintLpEvent.fromJSONField(field),
1435
+ fromJSON: (json: Record<string, any>) => MintLpEvent.fromJSON(json),
1436
+ fromSuiParsedData: (content: SuiParsedData) => MintLpEvent.fromSuiParsedData(content),
1437
+ fetch: async (client: SuiClient, id: string) => MintLpEvent.fetch(client, id),
1438
+ new: (fields: MintLpEventFields) => {
1439
+ return new MintLpEvent([], fields);
1440
+ },
1441
+ kind: "StructClassReified",
1442
+ };
1443
+ }
1444
+
1445
+ static get r() {
1446
+ return MintLpEvent.reified();
1447
+ }
1448
+
1449
+ static phantom(): PhantomReified<ToTypeStr<MintLpEvent>> {
1450
+ return phantom(MintLpEvent.reified());
1451
+ }
1452
+ static get p() {
1453
+ return MintLpEvent.phantom();
1454
+ }
1455
+
1456
+ static get bcs() {
1457
+ return bcs.struct("MintLpEvent", {
1458
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
1459
+ index: bcs.u64(),
1460
+ liquidity_token_type: TypeName.bcs,
1461
+ deposit_amount: bcs.u64(),
1462
+ deposit_amount_usd: bcs.u64(),
1463
+ mint_fee_usd: bcs.u64(),
1464
+ lp_token_type: TypeName.bcs,
1465
+ minted_lp_amount: bcs.u64(),
1466
+ u64_padding: bcs.vector(bcs.u64()),
1467
+ });
1468
+ }
1469
+
1470
+ static fromFields(fields: Record<string, any>): MintLpEvent {
1471
+ return MintLpEvent.reified().new({
1472
+ sender: decodeFromFields("address", fields.sender),
1473
+ index: decodeFromFields("u64", fields.index),
1474
+ liquidityTokenType: decodeFromFields(TypeName.reified(), fields.liquidity_token_type),
1475
+ depositAmount: decodeFromFields("u64", fields.deposit_amount),
1476
+ depositAmountUsd: decodeFromFields("u64", fields.deposit_amount_usd),
1477
+ mintFeeUsd: decodeFromFields("u64", fields.mint_fee_usd),
1478
+ lpTokenType: decodeFromFields(TypeName.reified(), fields.lp_token_type),
1479
+ mintedLpAmount: decodeFromFields("u64", fields.minted_lp_amount),
1480
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
1481
+ });
1482
+ }
1483
+
1484
+ static fromFieldsWithTypes(item: FieldsWithTypes): MintLpEvent {
1485
+ if (!isMintLpEvent(item.type)) {
1486
+ throw new Error("not a MintLpEvent type");
1487
+ }
1488
+
1489
+ return MintLpEvent.reified().new({
1490
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
1491
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
1492
+ liquidityTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token_type),
1493
+ depositAmount: decodeFromFieldsWithTypes("u64", item.fields.deposit_amount),
1494
+ depositAmountUsd: decodeFromFieldsWithTypes("u64", item.fields.deposit_amount_usd),
1495
+ mintFeeUsd: decodeFromFieldsWithTypes("u64", item.fields.mint_fee_usd),
1496
+ lpTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.lp_token_type),
1497
+ mintedLpAmount: decodeFromFieldsWithTypes("u64", item.fields.minted_lp_amount),
1498
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
1499
+ });
1500
+ }
1501
+
1502
+ static fromBcs(data: Uint8Array): MintLpEvent {
1503
+ return MintLpEvent.fromFields(MintLpEvent.bcs.parse(data));
1504
+ }
1505
+
1506
+ toJSONField() {
1507
+ return {
1508
+ sender: this.sender,
1509
+ index: this.index.toString(),
1510
+ liquidityTokenType: this.liquidityTokenType.toJSONField(),
1511
+ depositAmount: this.depositAmount.toString(),
1512
+ depositAmountUsd: this.depositAmountUsd.toString(),
1513
+ mintFeeUsd: this.mintFeeUsd.toString(),
1514
+ lpTokenType: this.lpTokenType.toJSONField(),
1515
+ mintedLpAmount: this.mintedLpAmount.toString(),
1516
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
1517
+ };
1518
+ }
1519
+
1520
+ toJSON() {
1521
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1522
+ }
1523
+
1524
+ static fromJSONField(field: any): MintLpEvent {
1525
+ return MintLpEvent.reified().new({
1526
+ sender: decodeFromJSONField("address", field.sender),
1527
+ index: decodeFromJSONField("u64", field.index),
1528
+ liquidityTokenType: decodeFromJSONField(TypeName.reified(), field.liquidityTokenType),
1529
+ depositAmount: decodeFromJSONField("u64", field.depositAmount),
1530
+ depositAmountUsd: decodeFromJSONField("u64", field.depositAmountUsd),
1531
+ mintFeeUsd: decodeFromJSONField("u64", field.mintFeeUsd),
1532
+ lpTokenType: decodeFromJSONField(TypeName.reified(), field.lpTokenType),
1533
+ mintedLpAmount: decodeFromJSONField("u64", field.mintedLpAmount),
1534
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
1535
+ });
1536
+ }
1537
+
1538
+ static fromJSON(json: Record<string, any>): MintLpEvent {
1539
+ if (json.$typeName !== MintLpEvent.$typeName) {
1540
+ throw new Error("not a WithTwoGenerics json object");
1541
+ }
1542
+
1543
+ return MintLpEvent.fromJSONField(json);
1544
+ }
1545
+
1546
+ static fromSuiParsedData(content: SuiParsedData): MintLpEvent {
1547
+ if (content.dataType !== "moveObject") {
1548
+ throw new Error("not an object");
1549
+ }
1550
+ if (!isMintLpEvent(content.type)) {
1551
+ throw new Error(`object at ${(content.fields as any).id} is not a MintLpEvent object`);
1552
+ }
1553
+ return MintLpEvent.fromFieldsWithTypes(content);
1554
+ }
1555
+
1556
+ static async fetch(client: SuiClient, id: string): Promise<MintLpEvent> {
1557
+ const res = await client.getObject({ id, options: { showBcs: true } });
1558
+ if (res.error) {
1559
+ throw new Error(`error fetching MintLpEvent object at id ${id}: ${res.error.code}`);
1560
+ }
1561
+ if (res.data?.bcs?.dataType !== "moveObject" || !isMintLpEvent(res.data.bcs.type)) {
1562
+ throw new Error(`object at id ${id} is not a MintLpEvent object`);
1563
+ }
1564
+ return MintLpEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
1565
+ }
1566
+ }
1567
+
1568
+ /* ============================== NewLiquidityPoolEvent =============================== */
1569
+
1570
+ export function isNewLiquidityPoolEvent(type: string): boolean {
1571
+ type = compressSuiType(type);
1572
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::NewLiquidityPoolEvent";
1573
+ }
1574
+
1575
+ export interface NewLiquidityPoolEventFields {
1576
+ sender: ToField<"address">;
1577
+ index: ToField<"u64">;
1578
+ lpTokenType: ToField<TypeName>;
1579
+ lpTokenDecimal: ToField<"u64">;
1580
+ u64Padding: ToField<Vector<"u64">>;
1581
+ }
1582
+
1583
+ export type NewLiquidityPoolEventReified = Reified<NewLiquidityPoolEvent, NewLiquidityPoolEventFields>;
1584
+
1585
+ export class NewLiquidityPoolEvent implements StructClass {
1586
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::NewLiquidityPoolEvent";
1587
+ static readonly $numTypeParams = 0;
1588
+
1589
+ readonly $typeName = NewLiquidityPoolEvent.$typeName;
1590
+
1591
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::NewLiquidityPoolEvent";
1592
+
1593
+ readonly $typeArgs: [];
1594
+
1595
+ readonly sender: ToField<"address">;
1596
+ readonly index: ToField<"u64">;
1597
+ readonly lpTokenType: ToField<TypeName>;
1598
+ readonly lpTokenDecimal: ToField<"u64">;
1599
+ readonly u64Padding: ToField<Vector<"u64">>;
1600
+
1601
+ private constructor(typeArgs: [], fields: NewLiquidityPoolEventFields) {
1602
+ this.$fullTypeName = composeSuiType(
1603
+ NewLiquidityPoolEvent.$typeName,
1604
+ ...typeArgs
1605
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::NewLiquidityPoolEvent";
1606
+ this.$typeArgs = typeArgs;
1607
+
1608
+ this.sender = fields.sender;
1609
+ this.index = fields.index;
1610
+ this.lpTokenType = fields.lpTokenType;
1611
+ this.lpTokenDecimal = fields.lpTokenDecimal;
1612
+ this.u64Padding = fields.u64Padding;
1613
+ }
1614
+
1615
+ static reified(): NewLiquidityPoolEventReified {
1616
+ return {
1617
+ typeName: NewLiquidityPoolEvent.$typeName,
1618
+ fullTypeName: composeSuiType(
1619
+ NewLiquidityPoolEvent.$typeName,
1620
+ ...[]
1621
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::NewLiquidityPoolEvent",
1622
+ typeArgs: [] as [],
1623
+ reifiedTypeArgs: [],
1624
+ fromFields: (fields: Record<string, any>) => NewLiquidityPoolEvent.fromFields(fields),
1625
+ fromFieldsWithTypes: (item: FieldsWithTypes) => NewLiquidityPoolEvent.fromFieldsWithTypes(item),
1626
+ fromBcs: (data: Uint8Array) => NewLiquidityPoolEvent.fromBcs(data),
1627
+ bcs: NewLiquidityPoolEvent.bcs,
1628
+ fromJSONField: (field: any) => NewLiquidityPoolEvent.fromJSONField(field),
1629
+ fromJSON: (json: Record<string, any>) => NewLiquidityPoolEvent.fromJSON(json),
1630
+ fromSuiParsedData: (content: SuiParsedData) => NewLiquidityPoolEvent.fromSuiParsedData(content),
1631
+ fetch: async (client: SuiClient, id: string) => NewLiquidityPoolEvent.fetch(client, id),
1632
+ new: (fields: NewLiquidityPoolEventFields) => {
1633
+ return new NewLiquidityPoolEvent([], fields);
1634
+ },
1635
+ kind: "StructClassReified",
1636
+ };
1637
+ }
1638
+
1639
+ static get r() {
1640
+ return NewLiquidityPoolEvent.reified();
1641
+ }
1642
+
1643
+ static phantom(): PhantomReified<ToTypeStr<NewLiquidityPoolEvent>> {
1644
+ return phantom(NewLiquidityPoolEvent.reified());
1645
+ }
1646
+ static get p() {
1647
+ return NewLiquidityPoolEvent.phantom();
1648
+ }
1649
+
1650
+ static get bcs() {
1651
+ return bcs.struct("NewLiquidityPoolEvent", {
1652
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
1653
+ index: bcs.u64(),
1654
+ lp_token_type: TypeName.bcs,
1655
+ lp_token_decimal: bcs.u64(),
1656
+ u64_padding: bcs.vector(bcs.u64()),
1657
+ });
1658
+ }
1659
+
1660
+ static fromFields(fields: Record<string, any>): NewLiquidityPoolEvent {
1661
+ return NewLiquidityPoolEvent.reified().new({
1662
+ sender: decodeFromFields("address", fields.sender),
1663
+ index: decodeFromFields("u64", fields.index),
1664
+ lpTokenType: decodeFromFields(TypeName.reified(), fields.lp_token_type),
1665
+ lpTokenDecimal: decodeFromFields("u64", fields.lp_token_decimal),
1666
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
1667
+ });
1668
+ }
1669
+
1670
+ static fromFieldsWithTypes(item: FieldsWithTypes): NewLiquidityPoolEvent {
1671
+ if (!isNewLiquidityPoolEvent(item.type)) {
1672
+ throw new Error("not a NewLiquidityPoolEvent type");
1673
+ }
1674
+
1675
+ return NewLiquidityPoolEvent.reified().new({
1676
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
1677
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
1678
+ lpTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.lp_token_type),
1679
+ lpTokenDecimal: decodeFromFieldsWithTypes("u64", item.fields.lp_token_decimal),
1680
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
1681
+ });
1682
+ }
1683
+
1684
+ static fromBcs(data: Uint8Array): NewLiquidityPoolEvent {
1685
+ return NewLiquidityPoolEvent.fromFields(NewLiquidityPoolEvent.bcs.parse(data));
1686
+ }
1687
+
1688
+ toJSONField() {
1689
+ return {
1690
+ sender: this.sender,
1691
+ index: this.index.toString(),
1692
+ lpTokenType: this.lpTokenType.toJSONField(),
1693
+ lpTokenDecimal: this.lpTokenDecimal.toString(),
1694
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
1695
+ };
1696
+ }
1697
+
1698
+ toJSON() {
1699
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1700
+ }
1701
+
1702
+ static fromJSONField(field: any): NewLiquidityPoolEvent {
1703
+ return NewLiquidityPoolEvent.reified().new({
1704
+ sender: decodeFromJSONField("address", field.sender),
1705
+ index: decodeFromJSONField("u64", field.index),
1706
+ lpTokenType: decodeFromJSONField(TypeName.reified(), field.lpTokenType),
1707
+ lpTokenDecimal: decodeFromJSONField("u64", field.lpTokenDecimal),
1708
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
1709
+ });
1710
+ }
1711
+
1712
+ static fromJSON(json: Record<string, any>): NewLiquidityPoolEvent {
1713
+ if (json.$typeName !== NewLiquidityPoolEvent.$typeName) {
1714
+ throw new Error("not a WithTwoGenerics json object");
1715
+ }
1716
+
1717
+ return NewLiquidityPoolEvent.fromJSONField(json);
1718
+ }
1719
+
1720
+ static fromSuiParsedData(content: SuiParsedData): NewLiquidityPoolEvent {
1721
+ if (content.dataType !== "moveObject") {
1722
+ throw new Error("not an object");
1723
+ }
1724
+ if (!isNewLiquidityPoolEvent(content.type)) {
1725
+ throw new Error(`object at ${(content.fields as any).id} is not a NewLiquidityPoolEvent object`);
1726
+ }
1727
+ return NewLiquidityPoolEvent.fromFieldsWithTypes(content);
1728
+ }
1729
+
1730
+ static async fetch(client: SuiClient, id: string): Promise<NewLiquidityPoolEvent> {
1731
+ const res = await client.getObject({ id, options: { showBcs: true } });
1732
+ if (res.error) {
1733
+ throw new Error(`error fetching NewLiquidityPoolEvent object at id ${id}: ${res.error.code}`);
1734
+ }
1735
+ if (res.data?.bcs?.dataType !== "moveObject" || !isNewLiquidityPoolEvent(res.data.bcs.type)) {
1736
+ throw new Error(`object at id ${id} is not a NewLiquidityPoolEvent object`);
1737
+ }
1738
+ return NewLiquidityPoolEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
1739
+ }
1740
+ }
1741
+
1742
+ /* ============================== Registry =============================== */
1743
+
1744
+ export function isRegistry(type: string): boolean {
1745
+ type = compressSuiType(type);
1746
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Registry";
1747
+ }
1748
+
1749
+ export interface RegistryFields {
1750
+ id: ToField<UID>;
1751
+ numPool: ToField<"u64">;
1752
+ liquidityPoolRegistry: ToField<UID>;
1753
+ }
1754
+
1755
+ export type RegistryReified = Reified<Registry, RegistryFields>;
1756
+
1757
+ export class Registry implements StructClass {
1758
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Registry";
1759
+ static readonly $numTypeParams = 0;
1760
+
1761
+ readonly $typeName = Registry.$typeName;
1762
+
1763
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Registry";
1764
+
1765
+ readonly $typeArgs: [];
1766
+
1767
+ readonly id: ToField<UID>;
1768
+ readonly numPool: ToField<"u64">;
1769
+ readonly liquidityPoolRegistry: ToField<UID>;
1770
+
1771
+ private constructor(typeArgs: [], fields: RegistryFields) {
1772
+ this.$fullTypeName = composeSuiType(
1773
+ Registry.$typeName,
1774
+ ...typeArgs
1775
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Registry";
1776
+ this.$typeArgs = typeArgs;
1777
+
1778
+ this.id = fields.id;
1779
+ this.numPool = fields.numPool;
1780
+ this.liquidityPoolRegistry = fields.liquidityPoolRegistry;
1781
+ }
1782
+
1783
+ static reified(): RegistryReified {
1784
+ return {
1785
+ typeName: Registry.$typeName,
1786
+ fullTypeName: composeSuiType(
1787
+ Registry.$typeName,
1788
+ ...[]
1789
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::Registry",
1790
+ typeArgs: [] as [],
1791
+ reifiedTypeArgs: [],
1792
+ fromFields: (fields: Record<string, any>) => Registry.fromFields(fields),
1793
+ fromFieldsWithTypes: (item: FieldsWithTypes) => Registry.fromFieldsWithTypes(item),
1794
+ fromBcs: (data: Uint8Array) => Registry.fromBcs(data),
1795
+ bcs: Registry.bcs,
1796
+ fromJSONField: (field: any) => Registry.fromJSONField(field),
1797
+ fromJSON: (json: Record<string, any>) => Registry.fromJSON(json),
1798
+ fromSuiParsedData: (content: SuiParsedData) => Registry.fromSuiParsedData(content),
1799
+ fetch: async (client: SuiClient, id: string) => Registry.fetch(client, id),
1800
+ new: (fields: RegistryFields) => {
1801
+ return new Registry([], fields);
1802
+ },
1803
+ kind: "StructClassReified",
1804
+ };
1805
+ }
1806
+
1807
+ static get r() {
1808
+ return Registry.reified();
1809
+ }
1810
+
1811
+ static phantom(): PhantomReified<ToTypeStr<Registry>> {
1812
+ return phantom(Registry.reified());
1813
+ }
1814
+ static get p() {
1815
+ return Registry.phantom();
1816
+ }
1817
+
1818
+ static get bcs() {
1819
+ return bcs.struct("Registry", {
1820
+ id: UID.bcs,
1821
+ num_pool: bcs.u64(),
1822
+ liquidity_pool_registry: UID.bcs,
1823
+ });
1824
+ }
1825
+
1826
+ static fromFields(fields: Record<string, any>): Registry {
1827
+ return Registry.reified().new({
1828
+ id: decodeFromFields(UID.reified(), fields.id),
1829
+ numPool: decodeFromFields("u64", fields.num_pool),
1830
+ liquidityPoolRegistry: decodeFromFields(UID.reified(), fields.liquidity_pool_registry),
1831
+ });
1832
+ }
1833
+
1834
+ static fromFieldsWithTypes(item: FieldsWithTypes): Registry {
1835
+ if (!isRegistry(item.type)) {
1836
+ throw new Error("not a Registry type");
1837
+ }
1838
+
1839
+ return Registry.reified().new({
1840
+ id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id),
1841
+ numPool: decodeFromFieldsWithTypes("u64", item.fields.num_pool),
1842
+ liquidityPoolRegistry: decodeFromFieldsWithTypes(UID.reified(), item.fields.liquidity_pool_registry),
1843
+ });
1844
+ }
1845
+
1846
+ static fromBcs(data: Uint8Array): Registry {
1847
+ return Registry.fromFields(Registry.bcs.parse(data));
1848
+ }
1849
+
1850
+ toJSONField() {
1851
+ return {
1852
+ id: this.id,
1853
+ numPool: this.numPool.toString(),
1854
+ liquidityPoolRegistry: this.liquidityPoolRegistry,
1855
+ };
1856
+ }
1857
+
1858
+ toJSON() {
1859
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
1860
+ }
1861
+
1862
+ static fromJSONField(field: any): Registry {
1863
+ return Registry.reified().new({
1864
+ id: decodeFromJSONField(UID.reified(), field.id),
1865
+ numPool: decodeFromJSONField("u64", field.numPool),
1866
+ liquidityPoolRegistry: decodeFromJSONField(UID.reified(), field.liquidityPoolRegistry),
1867
+ });
1868
+ }
1869
+
1870
+ static fromJSON(json: Record<string, any>): Registry {
1871
+ if (json.$typeName !== Registry.$typeName) {
1872
+ throw new Error("not a WithTwoGenerics json object");
1873
+ }
1874
+
1875
+ return Registry.fromJSONField(json);
1876
+ }
1877
+
1878
+ static fromSuiParsedData(content: SuiParsedData): Registry {
1879
+ if (content.dataType !== "moveObject") {
1880
+ throw new Error("not an object");
1881
+ }
1882
+ if (!isRegistry(content.type)) {
1883
+ throw new Error(`object at ${(content.fields as any).id} is not a Registry object`);
1884
+ }
1885
+ return Registry.fromFieldsWithTypes(content);
1886
+ }
1887
+
1888
+ static async fetch(client: SuiClient, id: string): Promise<Registry> {
1889
+ const res = await client.getObject({ id, options: { showBcs: true } });
1890
+ if (res.error) {
1891
+ throw new Error(`error fetching Registry object at id ${id}: ${res.error.code}`);
1892
+ }
1893
+ if (res.data?.bcs?.dataType !== "moveObject" || !isRegistry(res.data.bcs.type)) {
1894
+ throw new Error(`object at id ${id} is not a Registry object`);
1895
+ }
1896
+ return Registry.fromBcs(fromB64(res.data.bcs.bcsBytes));
1897
+ }
1898
+ }
1899
+
1900
+ /* ============================== ResumePoolEvent =============================== */
1901
+
1902
+ export function isResumePoolEvent(type: string): boolean {
1903
+ type = compressSuiType(type);
1904
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumePoolEvent";
1905
+ }
1906
+
1907
+ export interface ResumePoolEventFields {
1908
+ sender: ToField<"address">;
1909
+ index: ToField<"u64">;
1910
+ u64Padding: ToField<Vector<"u64">>;
1911
+ }
1912
+
1913
+ export type ResumePoolEventReified = Reified<ResumePoolEvent, ResumePoolEventFields>;
1914
+
1915
+ export class ResumePoolEvent implements StructClass {
1916
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumePoolEvent";
1917
+ static readonly $numTypeParams = 0;
1918
+
1919
+ readonly $typeName = ResumePoolEvent.$typeName;
1920
+
1921
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumePoolEvent";
1922
+
1923
+ readonly $typeArgs: [];
1924
+
1925
+ readonly sender: ToField<"address">;
1926
+ readonly index: ToField<"u64">;
1927
+ readonly u64Padding: ToField<Vector<"u64">>;
1928
+
1929
+ private constructor(typeArgs: [], fields: ResumePoolEventFields) {
1930
+ this.$fullTypeName = composeSuiType(
1931
+ ResumePoolEvent.$typeName,
1932
+ ...typeArgs
1933
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumePoolEvent";
1934
+ this.$typeArgs = typeArgs;
1935
+
1936
+ this.sender = fields.sender;
1937
+ this.index = fields.index;
1938
+ this.u64Padding = fields.u64Padding;
1939
+ }
1940
+
1941
+ static reified(): ResumePoolEventReified {
1942
+ return {
1943
+ typeName: ResumePoolEvent.$typeName,
1944
+ fullTypeName: composeSuiType(
1945
+ ResumePoolEvent.$typeName,
1946
+ ...[]
1947
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumePoolEvent",
1948
+ typeArgs: [] as [],
1949
+ reifiedTypeArgs: [],
1950
+ fromFields: (fields: Record<string, any>) => ResumePoolEvent.fromFields(fields),
1951
+ fromFieldsWithTypes: (item: FieldsWithTypes) => ResumePoolEvent.fromFieldsWithTypes(item),
1952
+ fromBcs: (data: Uint8Array) => ResumePoolEvent.fromBcs(data),
1953
+ bcs: ResumePoolEvent.bcs,
1954
+ fromJSONField: (field: any) => ResumePoolEvent.fromJSONField(field),
1955
+ fromJSON: (json: Record<string, any>) => ResumePoolEvent.fromJSON(json),
1956
+ fromSuiParsedData: (content: SuiParsedData) => ResumePoolEvent.fromSuiParsedData(content),
1957
+ fetch: async (client: SuiClient, id: string) => ResumePoolEvent.fetch(client, id),
1958
+ new: (fields: ResumePoolEventFields) => {
1959
+ return new ResumePoolEvent([], fields);
1960
+ },
1961
+ kind: "StructClassReified",
1962
+ };
1963
+ }
1964
+
1965
+ static get r() {
1966
+ return ResumePoolEvent.reified();
1967
+ }
1968
+
1969
+ static phantom(): PhantomReified<ToTypeStr<ResumePoolEvent>> {
1970
+ return phantom(ResumePoolEvent.reified());
1971
+ }
1972
+ static get p() {
1973
+ return ResumePoolEvent.phantom();
1974
+ }
1975
+
1976
+ static get bcs() {
1977
+ return bcs.struct("ResumePoolEvent", {
1978
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
1979
+ index: bcs.u64(),
1980
+ u64_padding: bcs.vector(bcs.u64()),
1981
+ });
1982
+ }
1983
+
1984
+ static fromFields(fields: Record<string, any>): ResumePoolEvent {
1985
+ return ResumePoolEvent.reified().new({
1986
+ sender: decodeFromFields("address", fields.sender),
1987
+ index: decodeFromFields("u64", fields.index),
1988
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
1989
+ });
1990
+ }
1991
+
1992
+ static fromFieldsWithTypes(item: FieldsWithTypes): ResumePoolEvent {
1993
+ if (!isResumePoolEvent(item.type)) {
1994
+ throw new Error("not a ResumePoolEvent type");
1995
+ }
1996
+
1997
+ return ResumePoolEvent.reified().new({
1998
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
1999
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
2000
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
2001
+ });
2002
+ }
2003
+
2004
+ static fromBcs(data: Uint8Array): ResumePoolEvent {
2005
+ return ResumePoolEvent.fromFields(ResumePoolEvent.bcs.parse(data));
2006
+ }
2007
+
2008
+ toJSONField() {
2009
+ return {
2010
+ sender: this.sender,
2011
+ index: this.index.toString(),
2012
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
2013
+ };
2014
+ }
2015
+
2016
+ toJSON() {
2017
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
2018
+ }
2019
+
2020
+ static fromJSONField(field: any): ResumePoolEvent {
2021
+ return ResumePoolEvent.reified().new({
2022
+ sender: decodeFromJSONField("address", field.sender),
2023
+ index: decodeFromJSONField("u64", field.index),
2024
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
2025
+ });
2026
+ }
2027
+
2028
+ static fromJSON(json: Record<string, any>): ResumePoolEvent {
2029
+ if (json.$typeName !== ResumePoolEvent.$typeName) {
2030
+ throw new Error("not a WithTwoGenerics json object");
2031
+ }
2032
+
2033
+ return ResumePoolEvent.fromJSONField(json);
2034
+ }
2035
+
2036
+ static fromSuiParsedData(content: SuiParsedData): ResumePoolEvent {
2037
+ if (content.dataType !== "moveObject") {
2038
+ throw new Error("not an object");
2039
+ }
2040
+ if (!isResumePoolEvent(content.type)) {
2041
+ throw new Error(`object at ${(content.fields as any).id} is not a ResumePoolEvent object`);
2042
+ }
2043
+ return ResumePoolEvent.fromFieldsWithTypes(content);
2044
+ }
2045
+
2046
+ static async fetch(client: SuiClient, id: string): Promise<ResumePoolEvent> {
2047
+ const res = await client.getObject({ id, options: { showBcs: true } });
2048
+ if (res.error) {
2049
+ throw new Error(`error fetching ResumePoolEvent object at id ${id}: ${res.error.code}`);
2050
+ }
2051
+ if (res.data?.bcs?.dataType !== "moveObject" || !isResumePoolEvent(res.data.bcs.type)) {
2052
+ throw new Error(`object at id ${id} is not a ResumePoolEvent object`);
2053
+ }
2054
+ return ResumePoolEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
2055
+ }
2056
+ }
2057
+
2058
+ /* ============================== ResumeTokenPoolEvent =============================== */
2059
+
2060
+ export function isResumeTokenPoolEvent(type: string): boolean {
2061
+ type = compressSuiType(type);
2062
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumeTokenPoolEvent";
2063
+ }
2064
+
2065
+ export interface ResumeTokenPoolEventFields {
2066
+ sender: ToField<"address">;
2067
+ index: ToField<"u64">;
2068
+ liquidityToken: ToField<TypeName>;
2069
+ u64Padding: ToField<Vector<"u64">>;
2070
+ }
2071
+
2072
+ export type ResumeTokenPoolEventReified = Reified<ResumeTokenPoolEvent, ResumeTokenPoolEventFields>;
2073
+
2074
+ export class ResumeTokenPoolEvent implements StructClass {
2075
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumeTokenPoolEvent";
2076
+ static readonly $numTypeParams = 0;
2077
+
2078
+ readonly $typeName = ResumeTokenPoolEvent.$typeName;
2079
+
2080
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumeTokenPoolEvent";
2081
+
2082
+ readonly $typeArgs: [];
2083
+
2084
+ readonly sender: ToField<"address">;
2085
+ readonly index: ToField<"u64">;
2086
+ readonly liquidityToken: ToField<TypeName>;
2087
+ readonly u64Padding: ToField<Vector<"u64">>;
2088
+
2089
+ private constructor(typeArgs: [], fields: ResumeTokenPoolEventFields) {
2090
+ this.$fullTypeName = composeSuiType(
2091
+ ResumeTokenPoolEvent.$typeName,
2092
+ ...typeArgs
2093
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumeTokenPoolEvent";
2094
+ this.$typeArgs = typeArgs;
2095
+
2096
+ this.sender = fields.sender;
2097
+ this.index = fields.index;
2098
+ this.liquidityToken = fields.liquidityToken;
2099
+ this.u64Padding = fields.u64Padding;
2100
+ }
2101
+
2102
+ static reified(): ResumeTokenPoolEventReified {
2103
+ return {
2104
+ typeName: ResumeTokenPoolEvent.$typeName,
2105
+ fullTypeName: composeSuiType(
2106
+ ResumeTokenPoolEvent.$typeName,
2107
+ ...[]
2108
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::ResumeTokenPoolEvent",
2109
+ typeArgs: [] as [],
2110
+ reifiedTypeArgs: [],
2111
+ fromFields: (fields: Record<string, any>) => ResumeTokenPoolEvent.fromFields(fields),
2112
+ fromFieldsWithTypes: (item: FieldsWithTypes) => ResumeTokenPoolEvent.fromFieldsWithTypes(item),
2113
+ fromBcs: (data: Uint8Array) => ResumeTokenPoolEvent.fromBcs(data),
2114
+ bcs: ResumeTokenPoolEvent.bcs,
2115
+ fromJSONField: (field: any) => ResumeTokenPoolEvent.fromJSONField(field),
2116
+ fromJSON: (json: Record<string, any>) => ResumeTokenPoolEvent.fromJSON(json),
2117
+ fromSuiParsedData: (content: SuiParsedData) => ResumeTokenPoolEvent.fromSuiParsedData(content),
2118
+ fetch: async (client: SuiClient, id: string) => ResumeTokenPoolEvent.fetch(client, id),
2119
+ new: (fields: ResumeTokenPoolEventFields) => {
2120
+ return new ResumeTokenPoolEvent([], fields);
2121
+ },
2122
+ kind: "StructClassReified",
2123
+ };
2124
+ }
2125
+
2126
+ static get r() {
2127
+ return ResumeTokenPoolEvent.reified();
2128
+ }
2129
+
2130
+ static phantom(): PhantomReified<ToTypeStr<ResumeTokenPoolEvent>> {
2131
+ return phantom(ResumeTokenPoolEvent.reified());
2132
+ }
2133
+ static get p() {
2134
+ return ResumeTokenPoolEvent.phantom();
2135
+ }
2136
+
2137
+ static get bcs() {
2138
+ return bcs.struct("ResumeTokenPoolEvent", {
2139
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
2140
+ index: bcs.u64(),
2141
+ liquidity_token: TypeName.bcs,
2142
+ u64_padding: bcs.vector(bcs.u64()),
2143
+ });
2144
+ }
2145
+
2146
+ static fromFields(fields: Record<string, any>): ResumeTokenPoolEvent {
2147
+ return ResumeTokenPoolEvent.reified().new({
2148
+ sender: decodeFromFields("address", fields.sender),
2149
+ index: decodeFromFields("u64", fields.index),
2150
+ liquidityToken: decodeFromFields(TypeName.reified(), fields.liquidity_token),
2151
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
2152
+ });
2153
+ }
2154
+
2155
+ static fromFieldsWithTypes(item: FieldsWithTypes): ResumeTokenPoolEvent {
2156
+ if (!isResumeTokenPoolEvent(item.type)) {
2157
+ throw new Error("not a ResumeTokenPoolEvent type");
2158
+ }
2159
+
2160
+ return ResumeTokenPoolEvent.reified().new({
2161
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
2162
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
2163
+ liquidityToken: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token),
2164
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
2165
+ });
2166
+ }
2167
+
2168
+ static fromBcs(data: Uint8Array): ResumeTokenPoolEvent {
2169
+ return ResumeTokenPoolEvent.fromFields(ResumeTokenPoolEvent.bcs.parse(data));
2170
+ }
2171
+
2172
+ toJSONField() {
2173
+ return {
2174
+ sender: this.sender,
2175
+ index: this.index.toString(),
2176
+ liquidityToken: this.liquidityToken.toJSONField(),
2177
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
2178
+ };
2179
+ }
2180
+
2181
+ toJSON() {
2182
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
2183
+ }
2184
+
2185
+ static fromJSONField(field: any): ResumeTokenPoolEvent {
2186
+ return ResumeTokenPoolEvent.reified().new({
2187
+ sender: decodeFromJSONField("address", field.sender),
2188
+ index: decodeFromJSONField("u64", field.index),
2189
+ liquidityToken: decodeFromJSONField(TypeName.reified(), field.liquidityToken),
2190
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
2191
+ });
2192
+ }
2193
+
2194
+ static fromJSON(json: Record<string, any>): ResumeTokenPoolEvent {
2195
+ if (json.$typeName !== ResumeTokenPoolEvent.$typeName) {
2196
+ throw new Error("not a WithTwoGenerics json object");
2197
+ }
2198
+
2199
+ return ResumeTokenPoolEvent.fromJSONField(json);
2200
+ }
2201
+
2202
+ static fromSuiParsedData(content: SuiParsedData): ResumeTokenPoolEvent {
2203
+ if (content.dataType !== "moveObject") {
2204
+ throw new Error("not an object");
2205
+ }
2206
+ if (!isResumeTokenPoolEvent(content.type)) {
2207
+ throw new Error(`object at ${(content.fields as any).id} is not a ResumeTokenPoolEvent object`);
2208
+ }
2209
+ return ResumeTokenPoolEvent.fromFieldsWithTypes(content);
2210
+ }
2211
+
2212
+ static async fetch(client: SuiClient, id: string): Promise<ResumeTokenPoolEvent> {
2213
+ const res = await client.getObject({ id, options: { showBcs: true } });
2214
+ if (res.error) {
2215
+ throw new Error(`error fetching ResumeTokenPoolEvent object at id ${id}: ${res.error.code}`);
2216
+ }
2217
+ if (res.data?.bcs?.dataType !== "moveObject" || !isResumeTokenPoolEvent(res.data.bcs.type)) {
2218
+ throw new Error(`object at id ${id} is not a ResumeTokenPoolEvent object`);
2219
+ }
2220
+ return ResumeTokenPoolEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
2221
+ }
2222
+ }
2223
+
2224
+ /* ============================== SpotConfig =============================== */
2225
+
2226
+ export function isSpotConfig(type: string): boolean {
2227
+ type = compressSuiType(type);
2228
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SpotConfig";
2229
+ }
2230
+
2231
+ export interface SpotConfigFields {
2232
+ minDeposit: ToField<"u64">;
2233
+ maxCapacity: ToField<"u64">;
2234
+ targetWeightBp: ToField<"u64">;
2235
+ basicMintFeeBp: ToField<"u64">;
2236
+ additionalMintFeeBp: ToField<"u64">;
2237
+ basicBurnFeeBp: ToField<"u64">;
2238
+ additionalBurnFeeBp: ToField<"u64">;
2239
+ swapFeeBp: ToField<"u64">;
2240
+ swapFeeProtocolShareBp: ToField<"u64">;
2241
+ u64Padding: ToField<Vector<"u64">>;
2242
+ }
2243
+
2244
+ export type SpotConfigReified = Reified<SpotConfig, SpotConfigFields>;
2245
+
2246
+ export class SpotConfig implements StructClass {
2247
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SpotConfig";
2248
+ static readonly $numTypeParams = 0;
2249
+
2250
+ readonly $typeName = SpotConfig.$typeName;
2251
+
2252
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SpotConfig";
2253
+
2254
+ readonly $typeArgs: [];
2255
+
2256
+ readonly minDeposit: ToField<"u64">;
2257
+ readonly maxCapacity: ToField<"u64">;
2258
+ readonly targetWeightBp: ToField<"u64">;
2259
+ readonly basicMintFeeBp: ToField<"u64">;
2260
+ readonly additionalMintFeeBp: ToField<"u64">;
2261
+ readonly basicBurnFeeBp: ToField<"u64">;
2262
+ readonly additionalBurnFeeBp: ToField<"u64">;
2263
+ readonly swapFeeBp: ToField<"u64">;
2264
+ readonly swapFeeProtocolShareBp: ToField<"u64">;
2265
+ readonly u64Padding: ToField<Vector<"u64">>;
2266
+
2267
+ private constructor(typeArgs: [], fields: SpotConfigFields) {
2268
+ this.$fullTypeName = composeSuiType(
2269
+ SpotConfig.$typeName,
2270
+ ...typeArgs
2271
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SpotConfig";
2272
+ this.$typeArgs = typeArgs;
2273
+
2274
+ this.minDeposit = fields.minDeposit;
2275
+ this.maxCapacity = fields.maxCapacity;
2276
+ this.targetWeightBp = fields.targetWeightBp;
2277
+ this.basicMintFeeBp = fields.basicMintFeeBp;
2278
+ this.additionalMintFeeBp = fields.additionalMintFeeBp;
2279
+ this.basicBurnFeeBp = fields.basicBurnFeeBp;
2280
+ this.additionalBurnFeeBp = fields.additionalBurnFeeBp;
2281
+ this.swapFeeBp = fields.swapFeeBp;
2282
+ this.swapFeeProtocolShareBp = fields.swapFeeProtocolShareBp;
2283
+ this.u64Padding = fields.u64Padding;
2284
+ }
2285
+
2286
+ static reified(): SpotConfigReified {
2287
+ return {
2288
+ typeName: SpotConfig.$typeName,
2289
+ fullTypeName: composeSuiType(
2290
+ SpotConfig.$typeName,
2291
+ ...[]
2292
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SpotConfig",
2293
+ typeArgs: [] as [],
2294
+ reifiedTypeArgs: [],
2295
+ fromFields: (fields: Record<string, any>) => SpotConfig.fromFields(fields),
2296
+ fromFieldsWithTypes: (item: FieldsWithTypes) => SpotConfig.fromFieldsWithTypes(item),
2297
+ fromBcs: (data: Uint8Array) => SpotConfig.fromBcs(data),
2298
+ bcs: SpotConfig.bcs,
2299
+ fromJSONField: (field: any) => SpotConfig.fromJSONField(field),
2300
+ fromJSON: (json: Record<string, any>) => SpotConfig.fromJSON(json),
2301
+ fromSuiParsedData: (content: SuiParsedData) => SpotConfig.fromSuiParsedData(content),
2302
+ fetch: async (client: SuiClient, id: string) => SpotConfig.fetch(client, id),
2303
+ new: (fields: SpotConfigFields) => {
2304
+ return new SpotConfig([], fields);
2305
+ },
2306
+ kind: "StructClassReified",
2307
+ };
2308
+ }
2309
+
2310
+ static get r() {
2311
+ return SpotConfig.reified();
2312
+ }
2313
+
2314
+ static phantom(): PhantomReified<ToTypeStr<SpotConfig>> {
2315
+ return phantom(SpotConfig.reified());
2316
+ }
2317
+ static get p() {
2318
+ return SpotConfig.phantom();
2319
+ }
2320
+
2321
+ static get bcs() {
2322
+ return bcs.struct("SpotConfig", {
2323
+ min_deposit: bcs.u64(),
2324
+ max_capacity: bcs.u64(),
2325
+ target_weight_bp: bcs.u64(),
2326
+ basic_mint_fee_bp: bcs.u64(),
2327
+ additional_mint_fee_bp: bcs.u64(),
2328
+ basic_burn_fee_bp: bcs.u64(),
2329
+ additional_burn_fee_bp: bcs.u64(),
2330
+ swap_fee_bp: bcs.u64(),
2331
+ swap_fee_protocol_share_bp: bcs.u64(),
2332
+ u64_padding: bcs.vector(bcs.u64()),
2333
+ });
2334
+ }
2335
+
2336
+ static fromFields(fields: Record<string, any>): SpotConfig {
2337
+ return SpotConfig.reified().new({
2338
+ minDeposit: decodeFromFields("u64", fields.min_deposit),
2339
+ maxCapacity: decodeFromFields("u64", fields.max_capacity),
2340
+ targetWeightBp: decodeFromFields("u64", fields.target_weight_bp),
2341
+ basicMintFeeBp: decodeFromFields("u64", fields.basic_mint_fee_bp),
2342
+ additionalMintFeeBp: decodeFromFields("u64", fields.additional_mint_fee_bp),
2343
+ basicBurnFeeBp: decodeFromFields("u64", fields.basic_burn_fee_bp),
2344
+ additionalBurnFeeBp: decodeFromFields("u64", fields.additional_burn_fee_bp),
2345
+ swapFeeBp: decodeFromFields("u64", fields.swap_fee_bp),
2346
+ swapFeeProtocolShareBp: decodeFromFields("u64", fields.swap_fee_protocol_share_bp),
2347
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
2348
+ });
2349
+ }
2350
+
2351
+ static fromFieldsWithTypes(item: FieldsWithTypes): SpotConfig {
2352
+ if (!isSpotConfig(item.type)) {
2353
+ throw new Error("not a SpotConfig type");
2354
+ }
2355
+
2356
+ return SpotConfig.reified().new({
2357
+ minDeposit: decodeFromFieldsWithTypes("u64", item.fields.min_deposit),
2358
+ maxCapacity: decodeFromFieldsWithTypes("u64", item.fields.max_capacity),
2359
+ targetWeightBp: decodeFromFieldsWithTypes("u64", item.fields.target_weight_bp),
2360
+ basicMintFeeBp: decodeFromFieldsWithTypes("u64", item.fields.basic_mint_fee_bp),
2361
+ additionalMintFeeBp: decodeFromFieldsWithTypes("u64", item.fields.additional_mint_fee_bp),
2362
+ basicBurnFeeBp: decodeFromFieldsWithTypes("u64", item.fields.basic_burn_fee_bp),
2363
+ additionalBurnFeeBp: decodeFromFieldsWithTypes("u64", item.fields.additional_burn_fee_bp),
2364
+ swapFeeBp: decodeFromFieldsWithTypes("u64", item.fields.swap_fee_bp),
2365
+ swapFeeProtocolShareBp: decodeFromFieldsWithTypes("u64", item.fields.swap_fee_protocol_share_bp),
2366
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
2367
+ });
2368
+ }
2369
+
2370
+ static fromBcs(data: Uint8Array): SpotConfig {
2371
+ return SpotConfig.fromFields(SpotConfig.bcs.parse(data));
2372
+ }
2373
+
2374
+ toJSONField() {
2375
+ return {
2376
+ minDeposit: this.minDeposit.toString(),
2377
+ maxCapacity: this.maxCapacity.toString(),
2378
+ targetWeightBp: this.targetWeightBp.toString(),
2379
+ basicMintFeeBp: this.basicMintFeeBp.toString(),
2380
+ additionalMintFeeBp: this.additionalMintFeeBp.toString(),
2381
+ basicBurnFeeBp: this.basicBurnFeeBp.toString(),
2382
+ additionalBurnFeeBp: this.additionalBurnFeeBp.toString(),
2383
+ swapFeeBp: this.swapFeeBp.toString(),
2384
+ swapFeeProtocolShareBp: this.swapFeeProtocolShareBp.toString(),
2385
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
2386
+ };
2387
+ }
2388
+
2389
+ toJSON() {
2390
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
2391
+ }
2392
+
2393
+ static fromJSONField(field: any): SpotConfig {
2394
+ return SpotConfig.reified().new({
2395
+ minDeposit: decodeFromJSONField("u64", field.minDeposit),
2396
+ maxCapacity: decodeFromJSONField("u64", field.maxCapacity),
2397
+ targetWeightBp: decodeFromJSONField("u64", field.targetWeightBp),
2398
+ basicMintFeeBp: decodeFromJSONField("u64", field.basicMintFeeBp),
2399
+ additionalMintFeeBp: decodeFromJSONField("u64", field.additionalMintFeeBp),
2400
+ basicBurnFeeBp: decodeFromJSONField("u64", field.basicBurnFeeBp),
2401
+ additionalBurnFeeBp: decodeFromJSONField("u64", field.additionalBurnFeeBp),
2402
+ swapFeeBp: decodeFromJSONField("u64", field.swapFeeBp),
2403
+ swapFeeProtocolShareBp: decodeFromJSONField("u64", field.swapFeeProtocolShareBp),
2404
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
2405
+ });
2406
+ }
2407
+
2408
+ static fromJSON(json: Record<string, any>): SpotConfig {
2409
+ if (json.$typeName !== SpotConfig.$typeName) {
2410
+ throw new Error("not a WithTwoGenerics json object");
2411
+ }
2412
+
2413
+ return SpotConfig.fromJSONField(json);
2414
+ }
2415
+
2416
+ static fromSuiParsedData(content: SuiParsedData): SpotConfig {
2417
+ if (content.dataType !== "moveObject") {
2418
+ throw new Error("not an object");
2419
+ }
2420
+ if (!isSpotConfig(content.type)) {
2421
+ throw new Error(`object at ${(content.fields as any).id} is not a SpotConfig object`);
2422
+ }
2423
+ return SpotConfig.fromFieldsWithTypes(content);
2424
+ }
2425
+
2426
+ static async fetch(client: SuiClient, id: string): Promise<SpotConfig> {
2427
+ const res = await client.getObject({ id, options: { showBcs: true } });
2428
+ if (res.error) {
2429
+ throw new Error(`error fetching SpotConfig object at id ${id}: ${res.error.code}`);
2430
+ }
2431
+ if (res.data?.bcs?.dataType !== "moveObject" || !isSpotConfig(res.data.bcs.type)) {
2432
+ throw new Error(`object at id ${id} is not a SpotConfig object`);
2433
+ }
2434
+ return SpotConfig.fromBcs(fromB64(res.data.bcs.bcsBytes));
2435
+ }
2436
+ }
2437
+
2438
+ /* ============================== SuspendPoolEvent =============================== */
2439
+
2440
+ export function isSuspendPoolEvent(type: string): boolean {
2441
+ type = compressSuiType(type);
2442
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendPoolEvent";
2443
+ }
2444
+
2445
+ export interface SuspendPoolEventFields {
2446
+ sender: ToField<"address">;
2447
+ index: ToField<"u64">;
2448
+ u64Padding: ToField<Vector<"u64">>;
2449
+ }
2450
+
2451
+ export type SuspendPoolEventReified = Reified<SuspendPoolEvent, SuspendPoolEventFields>;
2452
+
2453
+ export class SuspendPoolEvent implements StructClass {
2454
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendPoolEvent";
2455
+ static readonly $numTypeParams = 0;
2456
+
2457
+ readonly $typeName = SuspendPoolEvent.$typeName;
2458
+
2459
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendPoolEvent";
2460
+
2461
+ readonly $typeArgs: [];
2462
+
2463
+ readonly sender: ToField<"address">;
2464
+ readonly index: ToField<"u64">;
2465
+ readonly u64Padding: ToField<Vector<"u64">>;
2466
+
2467
+ private constructor(typeArgs: [], fields: SuspendPoolEventFields) {
2468
+ this.$fullTypeName = composeSuiType(
2469
+ SuspendPoolEvent.$typeName,
2470
+ ...typeArgs
2471
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendPoolEvent";
2472
+ this.$typeArgs = typeArgs;
2473
+
2474
+ this.sender = fields.sender;
2475
+ this.index = fields.index;
2476
+ this.u64Padding = fields.u64Padding;
2477
+ }
2478
+
2479
+ static reified(): SuspendPoolEventReified {
2480
+ return {
2481
+ typeName: SuspendPoolEvent.$typeName,
2482
+ fullTypeName: composeSuiType(
2483
+ SuspendPoolEvent.$typeName,
2484
+ ...[]
2485
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendPoolEvent",
2486
+ typeArgs: [] as [],
2487
+ reifiedTypeArgs: [],
2488
+ fromFields: (fields: Record<string, any>) => SuspendPoolEvent.fromFields(fields),
2489
+ fromFieldsWithTypes: (item: FieldsWithTypes) => SuspendPoolEvent.fromFieldsWithTypes(item),
2490
+ fromBcs: (data: Uint8Array) => SuspendPoolEvent.fromBcs(data),
2491
+ bcs: SuspendPoolEvent.bcs,
2492
+ fromJSONField: (field: any) => SuspendPoolEvent.fromJSONField(field),
2493
+ fromJSON: (json: Record<string, any>) => SuspendPoolEvent.fromJSON(json),
2494
+ fromSuiParsedData: (content: SuiParsedData) => SuspendPoolEvent.fromSuiParsedData(content),
2495
+ fetch: async (client: SuiClient, id: string) => SuspendPoolEvent.fetch(client, id),
2496
+ new: (fields: SuspendPoolEventFields) => {
2497
+ return new SuspendPoolEvent([], fields);
2498
+ },
2499
+ kind: "StructClassReified",
2500
+ };
2501
+ }
2502
+
2503
+ static get r() {
2504
+ return SuspendPoolEvent.reified();
2505
+ }
2506
+
2507
+ static phantom(): PhantomReified<ToTypeStr<SuspendPoolEvent>> {
2508
+ return phantom(SuspendPoolEvent.reified());
2509
+ }
2510
+ static get p() {
2511
+ return SuspendPoolEvent.phantom();
2512
+ }
2513
+
2514
+ static get bcs() {
2515
+ return bcs.struct("SuspendPoolEvent", {
2516
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
2517
+ index: bcs.u64(),
2518
+ u64_padding: bcs.vector(bcs.u64()),
2519
+ });
2520
+ }
2521
+
2522
+ static fromFields(fields: Record<string, any>): SuspendPoolEvent {
2523
+ return SuspendPoolEvent.reified().new({
2524
+ sender: decodeFromFields("address", fields.sender),
2525
+ index: decodeFromFields("u64", fields.index),
2526
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
2527
+ });
2528
+ }
2529
+
2530
+ static fromFieldsWithTypes(item: FieldsWithTypes): SuspendPoolEvent {
2531
+ if (!isSuspendPoolEvent(item.type)) {
2532
+ throw new Error("not a SuspendPoolEvent type");
2533
+ }
2534
+
2535
+ return SuspendPoolEvent.reified().new({
2536
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
2537
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
2538
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
2539
+ });
2540
+ }
2541
+
2542
+ static fromBcs(data: Uint8Array): SuspendPoolEvent {
2543
+ return SuspendPoolEvent.fromFields(SuspendPoolEvent.bcs.parse(data));
2544
+ }
2545
+
2546
+ toJSONField() {
2547
+ return {
2548
+ sender: this.sender,
2549
+ index: this.index.toString(),
2550
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
2551
+ };
2552
+ }
2553
+
2554
+ toJSON() {
2555
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
2556
+ }
2557
+
2558
+ static fromJSONField(field: any): SuspendPoolEvent {
2559
+ return SuspendPoolEvent.reified().new({
2560
+ sender: decodeFromJSONField("address", field.sender),
2561
+ index: decodeFromJSONField("u64", field.index),
2562
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
2563
+ });
2564
+ }
2565
+
2566
+ static fromJSON(json: Record<string, any>): SuspendPoolEvent {
2567
+ if (json.$typeName !== SuspendPoolEvent.$typeName) {
2568
+ throw new Error("not a WithTwoGenerics json object");
2569
+ }
2570
+
2571
+ return SuspendPoolEvent.fromJSONField(json);
2572
+ }
2573
+
2574
+ static fromSuiParsedData(content: SuiParsedData): SuspendPoolEvent {
2575
+ if (content.dataType !== "moveObject") {
2576
+ throw new Error("not an object");
2577
+ }
2578
+ if (!isSuspendPoolEvent(content.type)) {
2579
+ throw new Error(`object at ${(content.fields as any).id} is not a SuspendPoolEvent object`);
2580
+ }
2581
+ return SuspendPoolEvent.fromFieldsWithTypes(content);
2582
+ }
2583
+
2584
+ static async fetch(client: SuiClient, id: string): Promise<SuspendPoolEvent> {
2585
+ const res = await client.getObject({ id, options: { showBcs: true } });
2586
+ if (res.error) {
2587
+ throw new Error(`error fetching SuspendPoolEvent object at id ${id}: ${res.error.code}`);
2588
+ }
2589
+ if (res.data?.bcs?.dataType !== "moveObject" || !isSuspendPoolEvent(res.data.bcs.type)) {
2590
+ throw new Error(`object at id ${id} is not a SuspendPoolEvent object`);
2591
+ }
2592
+ return SuspendPoolEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
2593
+ }
2594
+ }
2595
+
2596
+ /* ============================== SuspendTokenPoolEvent =============================== */
2597
+
2598
+ export function isSuspendTokenPoolEvent(type: string): boolean {
2599
+ type = compressSuiType(type);
2600
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendTokenPoolEvent";
2601
+ }
2602
+
2603
+ export interface SuspendTokenPoolEventFields {
2604
+ sender: ToField<"address">;
2605
+ index: ToField<"u64">;
2606
+ liquidityToken: ToField<TypeName>;
2607
+ u64Padding: ToField<Vector<"u64">>;
2608
+ }
2609
+
2610
+ export type SuspendTokenPoolEventReified = Reified<SuspendTokenPoolEvent, SuspendTokenPoolEventFields>;
2611
+
2612
+ export class SuspendTokenPoolEvent implements StructClass {
2613
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendTokenPoolEvent";
2614
+ static readonly $numTypeParams = 0;
2615
+
2616
+ readonly $typeName = SuspendTokenPoolEvent.$typeName;
2617
+
2618
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendTokenPoolEvent";
2619
+
2620
+ readonly $typeArgs: [];
2621
+
2622
+ readonly sender: ToField<"address">;
2623
+ readonly index: ToField<"u64">;
2624
+ readonly liquidityToken: ToField<TypeName>;
2625
+ readonly u64Padding: ToField<Vector<"u64">>;
2626
+
2627
+ private constructor(typeArgs: [], fields: SuspendTokenPoolEventFields) {
2628
+ this.$fullTypeName = composeSuiType(
2629
+ SuspendTokenPoolEvent.$typeName,
2630
+ ...typeArgs
2631
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendTokenPoolEvent";
2632
+ this.$typeArgs = typeArgs;
2633
+
2634
+ this.sender = fields.sender;
2635
+ this.index = fields.index;
2636
+ this.liquidityToken = fields.liquidityToken;
2637
+ this.u64Padding = fields.u64Padding;
2638
+ }
2639
+
2640
+ static reified(): SuspendTokenPoolEventReified {
2641
+ return {
2642
+ typeName: SuspendTokenPoolEvent.$typeName,
2643
+ fullTypeName: composeSuiType(
2644
+ SuspendTokenPoolEvent.$typeName,
2645
+ ...[]
2646
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SuspendTokenPoolEvent",
2647
+ typeArgs: [] as [],
2648
+ reifiedTypeArgs: [],
2649
+ fromFields: (fields: Record<string, any>) => SuspendTokenPoolEvent.fromFields(fields),
2650
+ fromFieldsWithTypes: (item: FieldsWithTypes) => SuspendTokenPoolEvent.fromFieldsWithTypes(item),
2651
+ fromBcs: (data: Uint8Array) => SuspendTokenPoolEvent.fromBcs(data),
2652
+ bcs: SuspendTokenPoolEvent.bcs,
2653
+ fromJSONField: (field: any) => SuspendTokenPoolEvent.fromJSONField(field),
2654
+ fromJSON: (json: Record<string, any>) => SuspendTokenPoolEvent.fromJSON(json),
2655
+ fromSuiParsedData: (content: SuiParsedData) => SuspendTokenPoolEvent.fromSuiParsedData(content),
2656
+ fetch: async (client: SuiClient, id: string) => SuspendTokenPoolEvent.fetch(client, id),
2657
+ new: (fields: SuspendTokenPoolEventFields) => {
2658
+ return new SuspendTokenPoolEvent([], fields);
2659
+ },
2660
+ kind: "StructClassReified",
2661
+ };
2662
+ }
2663
+
2664
+ static get r() {
2665
+ return SuspendTokenPoolEvent.reified();
2666
+ }
2667
+
2668
+ static phantom(): PhantomReified<ToTypeStr<SuspendTokenPoolEvent>> {
2669
+ return phantom(SuspendTokenPoolEvent.reified());
2670
+ }
2671
+ static get p() {
2672
+ return SuspendTokenPoolEvent.phantom();
2673
+ }
2674
+
2675
+ static get bcs() {
2676
+ return bcs.struct("SuspendTokenPoolEvent", {
2677
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
2678
+ index: bcs.u64(),
2679
+ liquidity_token: TypeName.bcs,
2680
+ u64_padding: bcs.vector(bcs.u64()),
2681
+ });
2682
+ }
2683
+
2684
+ static fromFields(fields: Record<string, any>): SuspendTokenPoolEvent {
2685
+ return SuspendTokenPoolEvent.reified().new({
2686
+ sender: decodeFromFields("address", fields.sender),
2687
+ index: decodeFromFields("u64", fields.index),
2688
+ liquidityToken: decodeFromFields(TypeName.reified(), fields.liquidity_token),
2689
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
2690
+ });
2691
+ }
2692
+
2693
+ static fromFieldsWithTypes(item: FieldsWithTypes): SuspendTokenPoolEvent {
2694
+ if (!isSuspendTokenPoolEvent(item.type)) {
2695
+ throw new Error("not a SuspendTokenPoolEvent type");
2696
+ }
2697
+
2698
+ return SuspendTokenPoolEvent.reified().new({
2699
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
2700
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
2701
+ liquidityToken: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token),
2702
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
2703
+ });
2704
+ }
2705
+
2706
+ static fromBcs(data: Uint8Array): SuspendTokenPoolEvent {
2707
+ return SuspendTokenPoolEvent.fromFields(SuspendTokenPoolEvent.bcs.parse(data));
2708
+ }
2709
+
2710
+ toJSONField() {
2711
+ return {
2712
+ sender: this.sender,
2713
+ index: this.index.toString(),
2714
+ liquidityToken: this.liquidityToken.toJSONField(),
2715
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
2716
+ };
2717
+ }
2718
+
2719
+ toJSON() {
2720
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
2721
+ }
2722
+
2723
+ static fromJSONField(field: any): SuspendTokenPoolEvent {
2724
+ return SuspendTokenPoolEvent.reified().new({
2725
+ sender: decodeFromJSONField("address", field.sender),
2726
+ index: decodeFromJSONField("u64", field.index),
2727
+ liquidityToken: decodeFromJSONField(TypeName.reified(), field.liquidityToken),
2728
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
2729
+ });
2730
+ }
2731
+
2732
+ static fromJSON(json: Record<string, any>): SuspendTokenPoolEvent {
2733
+ if (json.$typeName !== SuspendTokenPoolEvent.$typeName) {
2734
+ throw new Error("not a WithTwoGenerics json object");
2735
+ }
2736
+
2737
+ return SuspendTokenPoolEvent.fromJSONField(json);
2738
+ }
2739
+
2740
+ static fromSuiParsedData(content: SuiParsedData): SuspendTokenPoolEvent {
2741
+ if (content.dataType !== "moveObject") {
2742
+ throw new Error("not an object");
2743
+ }
2744
+ if (!isSuspendTokenPoolEvent(content.type)) {
2745
+ throw new Error(`object at ${(content.fields as any).id} is not a SuspendTokenPoolEvent object`);
2746
+ }
2747
+ return SuspendTokenPoolEvent.fromFieldsWithTypes(content);
2748
+ }
2749
+
2750
+ static async fetch(client: SuiClient, id: string): Promise<SuspendTokenPoolEvent> {
2751
+ const res = await client.getObject({ id, options: { showBcs: true } });
2752
+ if (res.error) {
2753
+ throw new Error(`error fetching SuspendTokenPoolEvent object at id ${id}: ${res.error.code}`);
2754
+ }
2755
+ if (res.data?.bcs?.dataType !== "moveObject" || !isSuspendTokenPoolEvent(res.data.bcs.type)) {
2756
+ throw new Error(`object at id ${id} is not a SuspendTokenPoolEvent object`);
2757
+ }
2758
+ return SuspendTokenPoolEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
2759
+ }
2760
+ }
2761
+
2762
+ /* ============================== SwapEvent =============================== */
2763
+
2764
+ export function isSwapEvent(type: string): boolean {
2765
+ type = compressSuiType(type);
2766
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SwapEvent";
2767
+ }
2768
+
2769
+ export interface SwapEventFields {
2770
+ sender: ToField<"address">;
2771
+ index: ToField<"u64">;
2772
+ fromTokenType: ToField<TypeName>;
2773
+ fromAmount: ToField<"u64">;
2774
+ toTokenType: ToField<TypeName>;
2775
+ minToAmount: ToField<"u64">;
2776
+ actualToAmount: ToField<"u64">;
2777
+ feeAmount: ToField<"u64">;
2778
+ feeAmountUsd: ToField<"u64">;
2779
+ u64Padding: ToField<Vector<"u64">>;
2780
+ }
2781
+
2782
+ export type SwapEventReified = Reified<SwapEvent, SwapEventFields>;
2783
+
2784
+ export class SwapEvent implements StructClass {
2785
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SwapEvent";
2786
+ static readonly $numTypeParams = 0;
2787
+
2788
+ readonly $typeName = SwapEvent.$typeName;
2789
+
2790
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SwapEvent";
2791
+
2792
+ readonly $typeArgs: [];
2793
+
2794
+ readonly sender: ToField<"address">;
2795
+ readonly index: ToField<"u64">;
2796
+ readonly fromTokenType: ToField<TypeName>;
2797
+ readonly fromAmount: ToField<"u64">;
2798
+ readonly toTokenType: ToField<TypeName>;
2799
+ readonly minToAmount: ToField<"u64">;
2800
+ readonly actualToAmount: ToField<"u64">;
2801
+ readonly feeAmount: ToField<"u64">;
2802
+ readonly feeAmountUsd: ToField<"u64">;
2803
+ readonly u64Padding: ToField<Vector<"u64">>;
2804
+
2805
+ private constructor(typeArgs: [], fields: SwapEventFields) {
2806
+ this.$fullTypeName = composeSuiType(
2807
+ SwapEvent.$typeName,
2808
+ ...typeArgs
2809
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SwapEvent";
2810
+ this.$typeArgs = typeArgs;
2811
+
2812
+ this.sender = fields.sender;
2813
+ this.index = fields.index;
2814
+ this.fromTokenType = fields.fromTokenType;
2815
+ this.fromAmount = fields.fromAmount;
2816
+ this.toTokenType = fields.toTokenType;
2817
+ this.minToAmount = fields.minToAmount;
2818
+ this.actualToAmount = fields.actualToAmount;
2819
+ this.feeAmount = fields.feeAmount;
2820
+ this.feeAmountUsd = fields.feeAmountUsd;
2821
+ this.u64Padding = fields.u64Padding;
2822
+ }
2823
+
2824
+ static reified(): SwapEventReified {
2825
+ return {
2826
+ typeName: SwapEvent.$typeName,
2827
+ fullTypeName: composeSuiType(
2828
+ SwapEvent.$typeName,
2829
+ ...[]
2830
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::SwapEvent",
2831
+ typeArgs: [] as [],
2832
+ reifiedTypeArgs: [],
2833
+ fromFields: (fields: Record<string, any>) => SwapEvent.fromFields(fields),
2834
+ fromFieldsWithTypes: (item: FieldsWithTypes) => SwapEvent.fromFieldsWithTypes(item),
2835
+ fromBcs: (data: Uint8Array) => SwapEvent.fromBcs(data),
2836
+ bcs: SwapEvent.bcs,
2837
+ fromJSONField: (field: any) => SwapEvent.fromJSONField(field),
2838
+ fromJSON: (json: Record<string, any>) => SwapEvent.fromJSON(json),
2839
+ fromSuiParsedData: (content: SuiParsedData) => SwapEvent.fromSuiParsedData(content),
2840
+ fetch: async (client: SuiClient, id: string) => SwapEvent.fetch(client, id),
2841
+ new: (fields: SwapEventFields) => {
2842
+ return new SwapEvent([], fields);
2843
+ },
2844
+ kind: "StructClassReified",
2845
+ };
2846
+ }
2847
+
2848
+ static get r() {
2849
+ return SwapEvent.reified();
2850
+ }
2851
+
2852
+ static phantom(): PhantomReified<ToTypeStr<SwapEvent>> {
2853
+ return phantom(SwapEvent.reified());
2854
+ }
2855
+ static get p() {
2856
+ return SwapEvent.phantom();
2857
+ }
2858
+
2859
+ static get bcs() {
2860
+ return bcs.struct("SwapEvent", {
2861
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
2862
+ index: bcs.u64(),
2863
+ from_token_type: TypeName.bcs,
2864
+ from_amount: bcs.u64(),
2865
+ to_token_type: TypeName.bcs,
2866
+ min_to_amount: bcs.u64(),
2867
+ actual_to_amount: bcs.u64(),
2868
+ fee_amount: bcs.u64(),
2869
+ fee_amount_usd: bcs.u64(),
2870
+ u64_padding: bcs.vector(bcs.u64()),
2871
+ });
2872
+ }
2873
+
2874
+ static fromFields(fields: Record<string, any>): SwapEvent {
2875
+ return SwapEvent.reified().new({
2876
+ sender: decodeFromFields("address", fields.sender),
2877
+ index: decodeFromFields("u64", fields.index),
2878
+ fromTokenType: decodeFromFields(TypeName.reified(), fields.from_token_type),
2879
+ fromAmount: decodeFromFields("u64", fields.from_amount),
2880
+ toTokenType: decodeFromFields(TypeName.reified(), fields.to_token_type),
2881
+ minToAmount: decodeFromFields("u64", fields.min_to_amount),
2882
+ actualToAmount: decodeFromFields("u64", fields.actual_to_amount),
2883
+ feeAmount: decodeFromFields("u64", fields.fee_amount),
2884
+ feeAmountUsd: decodeFromFields("u64", fields.fee_amount_usd),
2885
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
2886
+ });
2887
+ }
2888
+
2889
+ static fromFieldsWithTypes(item: FieldsWithTypes): SwapEvent {
2890
+ if (!isSwapEvent(item.type)) {
2891
+ throw new Error("not a SwapEvent type");
2892
+ }
2893
+
2894
+ return SwapEvent.reified().new({
2895
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
2896
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
2897
+ fromTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.from_token_type),
2898
+ fromAmount: decodeFromFieldsWithTypes("u64", item.fields.from_amount),
2899
+ toTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.to_token_type),
2900
+ minToAmount: decodeFromFieldsWithTypes("u64", item.fields.min_to_amount),
2901
+ actualToAmount: decodeFromFieldsWithTypes("u64", item.fields.actual_to_amount),
2902
+ feeAmount: decodeFromFieldsWithTypes("u64", item.fields.fee_amount),
2903
+ feeAmountUsd: decodeFromFieldsWithTypes("u64", item.fields.fee_amount_usd),
2904
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
2905
+ });
2906
+ }
2907
+
2908
+ static fromBcs(data: Uint8Array): SwapEvent {
2909
+ return SwapEvent.fromFields(SwapEvent.bcs.parse(data));
2910
+ }
2911
+
2912
+ toJSONField() {
2913
+ return {
2914
+ sender: this.sender,
2915
+ index: this.index.toString(),
2916
+ fromTokenType: this.fromTokenType.toJSONField(),
2917
+ fromAmount: this.fromAmount.toString(),
2918
+ toTokenType: this.toTokenType.toJSONField(),
2919
+ minToAmount: this.minToAmount.toString(),
2920
+ actualToAmount: this.actualToAmount.toString(),
2921
+ feeAmount: this.feeAmount.toString(),
2922
+ feeAmountUsd: this.feeAmountUsd.toString(),
2923
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
2924
+ };
2925
+ }
2926
+
2927
+ toJSON() {
2928
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
2929
+ }
2930
+
2931
+ static fromJSONField(field: any): SwapEvent {
2932
+ return SwapEvent.reified().new({
2933
+ sender: decodeFromJSONField("address", field.sender),
2934
+ index: decodeFromJSONField("u64", field.index),
2935
+ fromTokenType: decodeFromJSONField(TypeName.reified(), field.fromTokenType),
2936
+ fromAmount: decodeFromJSONField("u64", field.fromAmount),
2937
+ toTokenType: decodeFromJSONField(TypeName.reified(), field.toTokenType),
2938
+ minToAmount: decodeFromJSONField("u64", field.minToAmount),
2939
+ actualToAmount: decodeFromJSONField("u64", field.actualToAmount),
2940
+ feeAmount: decodeFromJSONField("u64", field.feeAmount),
2941
+ feeAmountUsd: decodeFromJSONField("u64", field.feeAmountUsd),
2942
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
2943
+ });
2944
+ }
2945
+
2946
+ static fromJSON(json: Record<string, any>): SwapEvent {
2947
+ if (json.$typeName !== SwapEvent.$typeName) {
2948
+ throw new Error("not a WithTwoGenerics json object");
2949
+ }
2950
+
2951
+ return SwapEvent.fromJSONField(json);
2952
+ }
2953
+
2954
+ static fromSuiParsedData(content: SuiParsedData): SwapEvent {
2955
+ if (content.dataType !== "moveObject") {
2956
+ throw new Error("not an object");
2957
+ }
2958
+ if (!isSwapEvent(content.type)) {
2959
+ throw new Error(`object at ${(content.fields as any).id} is not a SwapEvent object`);
2960
+ }
2961
+ return SwapEvent.fromFieldsWithTypes(content);
2962
+ }
2963
+
2964
+ static async fetch(client: SuiClient, id: string): Promise<SwapEvent> {
2965
+ const res = await client.getObject({ id, options: { showBcs: true } });
2966
+ if (res.error) {
2967
+ throw new Error(`error fetching SwapEvent object at id ${id}: ${res.error.code}`);
2968
+ }
2969
+ if (res.data?.bcs?.dataType !== "moveObject" || !isSwapEvent(res.data.bcs.type)) {
2970
+ throw new Error(`object at id ${id} is not a SwapEvent object`);
2971
+ }
2972
+ return SwapEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
2973
+ }
2974
+ }
2975
+
2976
+ /* ============================== TokenPool =============================== */
2977
+
2978
+ export function isTokenPool(type: string): boolean {
2979
+ type = compressSuiType(type);
2980
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::TokenPool";
2981
+ }
2982
+
2983
+ export interface TokenPoolFields {
2984
+ tokenType: ToField<TypeName>;
2985
+ config: ToField<Config>;
2986
+ state: ToField<State>;
2987
+ }
2988
+
2989
+ export type TokenPoolReified = Reified<TokenPool, TokenPoolFields>;
2990
+
2991
+ export class TokenPool implements StructClass {
2992
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::TokenPool";
2993
+ static readonly $numTypeParams = 0;
2994
+
2995
+ readonly $typeName = TokenPool.$typeName;
2996
+
2997
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::TokenPool";
2998
+
2999
+ readonly $typeArgs: [];
3000
+
3001
+ readonly tokenType: ToField<TypeName>;
3002
+ readonly config: ToField<Config>;
3003
+ readonly state: ToField<State>;
3004
+
3005
+ private constructor(typeArgs: [], fields: TokenPoolFields) {
3006
+ this.$fullTypeName = composeSuiType(
3007
+ TokenPool.$typeName,
3008
+ ...typeArgs
3009
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::TokenPool";
3010
+ this.$typeArgs = typeArgs;
3011
+
3012
+ this.tokenType = fields.tokenType;
3013
+ this.config = fields.config;
3014
+ this.state = fields.state;
3015
+ }
3016
+
3017
+ static reified(): TokenPoolReified {
3018
+ return {
3019
+ typeName: TokenPool.$typeName,
3020
+ fullTypeName: composeSuiType(
3021
+ TokenPool.$typeName,
3022
+ ...[]
3023
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::TokenPool",
3024
+ typeArgs: [] as [],
3025
+ reifiedTypeArgs: [],
3026
+ fromFields: (fields: Record<string, any>) => TokenPool.fromFields(fields),
3027
+ fromFieldsWithTypes: (item: FieldsWithTypes) => TokenPool.fromFieldsWithTypes(item),
3028
+ fromBcs: (data: Uint8Array) => TokenPool.fromBcs(data),
3029
+ bcs: TokenPool.bcs,
3030
+ fromJSONField: (field: any) => TokenPool.fromJSONField(field),
3031
+ fromJSON: (json: Record<string, any>) => TokenPool.fromJSON(json),
3032
+ fromSuiParsedData: (content: SuiParsedData) => TokenPool.fromSuiParsedData(content),
3033
+ fetch: async (client: SuiClient, id: string) => TokenPool.fetch(client, id),
3034
+ new: (fields: TokenPoolFields) => {
3035
+ return new TokenPool([], fields);
3036
+ },
3037
+ kind: "StructClassReified",
3038
+ };
3039
+ }
3040
+
3041
+ static get r() {
3042
+ return TokenPool.reified();
3043
+ }
3044
+
3045
+ static phantom(): PhantomReified<ToTypeStr<TokenPool>> {
3046
+ return phantom(TokenPool.reified());
3047
+ }
3048
+ static get p() {
3049
+ return TokenPool.phantom();
3050
+ }
3051
+
3052
+ static get bcs() {
3053
+ return bcs.struct("TokenPool", {
3054
+ token_type: TypeName.bcs,
3055
+ config: Config.bcs,
3056
+ state: State.bcs,
3057
+ });
3058
+ }
3059
+
3060
+ static fromFields(fields: Record<string, any>): TokenPool {
3061
+ return TokenPool.reified().new({
3062
+ tokenType: decodeFromFields(TypeName.reified(), fields.token_type),
3063
+ config: decodeFromFields(Config.reified(), fields.config),
3064
+ state: decodeFromFields(State.reified(), fields.state),
3065
+ });
3066
+ }
3067
+
3068
+ static fromFieldsWithTypes(item: FieldsWithTypes): TokenPool {
3069
+ if (!isTokenPool(item.type)) {
3070
+ throw new Error("not a TokenPool type");
3071
+ }
3072
+
3073
+ return TokenPool.reified().new({
3074
+ tokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.token_type),
3075
+ config: decodeFromFieldsWithTypes(Config.reified(), item.fields.config),
3076
+ state: decodeFromFieldsWithTypes(State.reified(), item.fields.state),
3077
+ });
3078
+ }
3079
+
3080
+ static fromBcs(data: Uint8Array): TokenPool {
3081
+ return TokenPool.fromFields(TokenPool.bcs.parse(data));
3082
+ }
3083
+
3084
+ toJSONField() {
3085
+ return {
3086
+ tokenType: this.tokenType.toJSONField(),
3087
+ config: this.config.toJSONField(),
3088
+ state: this.state.toJSONField(),
3089
+ };
3090
+ }
3091
+
3092
+ toJSON() {
3093
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
3094
+ }
3095
+
3096
+ static fromJSONField(field: any): TokenPool {
3097
+ return TokenPool.reified().new({
3098
+ tokenType: decodeFromJSONField(TypeName.reified(), field.tokenType),
3099
+ config: decodeFromJSONField(Config.reified(), field.config),
3100
+ state: decodeFromJSONField(State.reified(), field.state),
3101
+ });
3102
+ }
3103
+
3104
+ static fromJSON(json: Record<string, any>): TokenPool {
3105
+ if (json.$typeName !== TokenPool.$typeName) {
3106
+ throw new Error("not a WithTwoGenerics json object");
3107
+ }
3108
+
3109
+ return TokenPool.fromJSONField(json);
3110
+ }
3111
+
3112
+ static fromSuiParsedData(content: SuiParsedData): TokenPool {
3113
+ if (content.dataType !== "moveObject") {
3114
+ throw new Error("not an object");
3115
+ }
3116
+ if (!isTokenPool(content.type)) {
3117
+ throw new Error(`object at ${(content.fields as any).id} is not a TokenPool object`);
3118
+ }
3119
+ return TokenPool.fromFieldsWithTypes(content);
3120
+ }
3121
+
3122
+ static async fetch(client: SuiClient, id: string): Promise<TokenPool> {
3123
+ const res = await client.getObject({ id, options: { showBcs: true } });
3124
+ if (res.error) {
3125
+ throw new Error(`error fetching TokenPool object at id ${id}: ${res.error.code}`);
3126
+ }
3127
+ if (res.data?.bcs?.dataType !== "moveObject" || !isTokenPool(res.data.bcs.type)) {
3128
+ throw new Error(`object at id ${id} is not a TokenPool object`);
3129
+ }
3130
+ return TokenPool.fromBcs(fromB64(res.data.bcs.bcsBytes));
3131
+ }
3132
+ }
3133
+
3134
+ /* ============================== UpdateBorrowInfoEvent =============================== */
3135
+
3136
+ export function isUpdateBorrowInfoEvent(type: string): boolean {
3137
+ type = compressSuiType(type);
3138
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateBorrowInfoEvent";
3139
+ }
3140
+
3141
+ export interface UpdateBorrowInfoEventFields {
3142
+ index: ToField<"u64">;
3143
+ liquidityTokenType: ToField<TypeName>;
3144
+ previousBorrowTsMs: ToField<"u64">;
3145
+ previousCumulativeBorrowRate: ToField<"u64">;
3146
+ borrowIntervalTsMs: ToField<"u64">;
3147
+ lastBorrowRateTsMs: ToField<"u64">;
3148
+ lastCumulativeBorrowRate: ToField<"u64">;
3149
+ u64Padding: ToField<Vector<"u64">>;
3150
+ }
3151
+
3152
+ export type UpdateBorrowInfoEventReified = Reified<UpdateBorrowInfoEvent, UpdateBorrowInfoEventFields>;
3153
+
3154
+ export class UpdateBorrowInfoEvent implements StructClass {
3155
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateBorrowInfoEvent";
3156
+ static readonly $numTypeParams = 0;
3157
+
3158
+ readonly $typeName = UpdateBorrowInfoEvent.$typeName;
3159
+
3160
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateBorrowInfoEvent";
3161
+
3162
+ readonly $typeArgs: [];
3163
+
3164
+ readonly index: ToField<"u64">;
3165
+ readonly liquidityTokenType: ToField<TypeName>;
3166
+ readonly previousBorrowTsMs: ToField<"u64">;
3167
+ readonly previousCumulativeBorrowRate: ToField<"u64">;
3168
+ readonly borrowIntervalTsMs: ToField<"u64">;
3169
+ readonly lastBorrowRateTsMs: ToField<"u64">;
3170
+ readonly lastCumulativeBorrowRate: ToField<"u64">;
3171
+ readonly u64Padding: ToField<Vector<"u64">>;
3172
+
3173
+ private constructor(typeArgs: [], fields: UpdateBorrowInfoEventFields) {
3174
+ this.$fullTypeName = composeSuiType(
3175
+ UpdateBorrowInfoEvent.$typeName,
3176
+ ...typeArgs
3177
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateBorrowInfoEvent";
3178
+ this.$typeArgs = typeArgs;
3179
+
3180
+ this.index = fields.index;
3181
+ this.liquidityTokenType = fields.liquidityTokenType;
3182
+ this.previousBorrowTsMs = fields.previousBorrowTsMs;
3183
+ this.previousCumulativeBorrowRate = fields.previousCumulativeBorrowRate;
3184
+ this.borrowIntervalTsMs = fields.borrowIntervalTsMs;
3185
+ this.lastBorrowRateTsMs = fields.lastBorrowRateTsMs;
3186
+ this.lastCumulativeBorrowRate = fields.lastCumulativeBorrowRate;
3187
+ this.u64Padding = fields.u64Padding;
3188
+ }
3189
+
3190
+ static reified(): UpdateBorrowInfoEventReified {
3191
+ return {
3192
+ typeName: UpdateBorrowInfoEvent.$typeName,
3193
+ fullTypeName: composeSuiType(
3194
+ UpdateBorrowInfoEvent.$typeName,
3195
+ ...[]
3196
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateBorrowInfoEvent",
3197
+ typeArgs: [] as [],
3198
+ reifiedTypeArgs: [],
3199
+ fromFields: (fields: Record<string, any>) => UpdateBorrowInfoEvent.fromFields(fields),
3200
+ fromFieldsWithTypes: (item: FieldsWithTypes) => UpdateBorrowInfoEvent.fromFieldsWithTypes(item),
3201
+ fromBcs: (data: Uint8Array) => UpdateBorrowInfoEvent.fromBcs(data),
3202
+ bcs: UpdateBorrowInfoEvent.bcs,
3203
+ fromJSONField: (field: any) => UpdateBorrowInfoEvent.fromJSONField(field),
3204
+ fromJSON: (json: Record<string, any>) => UpdateBorrowInfoEvent.fromJSON(json),
3205
+ fromSuiParsedData: (content: SuiParsedData) => UpdateBorrowInfoEvent.fromSuiParsedData(content),
3206
+ fetch: async (client: SuiClient, id: string) => UpdateBorrowInfoEvent.fetch(client, id),
3207
+ new: (fields: UpdateBorrowInfoEventFields) => {
3208
+ return new UpdateBorrowInfoEvent([], fields);
3209
+ },
3210
+ kind: "StructClassReified",
3211
+ };
3212
+ }
3213
+
3214
+ static get r() {
3215
+ return UpdateBorrowInfoEvent.reified();
3216
+ }
3217
+
3218
+ static phantom(): PhantomReified<ToTypeStr<UpdateBorrowInfoEvent>> {
3219
+ return phantom(UpdateBorrowInfoEvent.reified());
3220
+ }
3221
+ static get p() {
3222
+ return UpdateBorrowInfoEvent.phantom();
3223
+ }
3224
+
3225
+ static get bcs() {
3226
+ return bcs.struct("UpdateBorrowInfoEvent", {
3227
+ index: bcs.u64(),
3228
+ liquidity_token_type: TypeName.bcs,
3229
+ previous_borrow_ts_ms: bcs.u64(),
3230
+ previous_cumulative_borrow_rate: bcs.u64(),
3231
+ borrow_interval_ts_ms: bcs.u64(),
3232
+ last_borrow_rate_ts_ms: bcs.u64(),
3233
+ last_cumulative_borrow_rate: bcs.u64(),
3234
+ u64_padding: bcs.vector(bcs.u64()),
3235
+ });
3236
+ }
3237
+
3238
+ static fromFields(fields: Record<string, any>): UpdateBorrowInfoEvent {
3239
+ return UpdateBorrowInfoEvent.reified().new({
3240
+ index: decodeFromFields("u64", fields.index),
3241
+ liquidityTokenType: decodeFromFields(TypeName.reified(), fields.liquidity_token_type),
3242
+ previousBorrowTsMs: decodeFromFields("u64", fields.previous_borrow_ts_ms),
3243
+ previousCumulativeBorrowRate: decodeFromFields("u64", fields.previous_cumulative_borrow_rate),
3244
+ borrowIntervalTsMs: decodeFromFields("u64", fields.borrow_interval_ts_ms),
3245
+ lastBorrowRateTsMs: decodeFromFields("u64", fields.last_borrow_rate_ts_ms),
3246
+ lastCumulativeBorrowRate: decodeFromFields("u64", fields.last_cumulative_borrow_rate),
3247
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
3248
+ });
3249
+ }
3250
+
3251
+ static fromFieldsWithTypes(item: FieldsWithTypes): UpdateBorrowInfoEvent {
3252
+ if (!isUpdateBorrowInfoEvent(item.type)) {
3253
+ throw new Error("not a UpdateBorrowInfoEvent type");
3254
+ }
3255
+
3256
+ return UpdateBorrowInfoEvent.reified().new({
3257
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
3258
+ liquidityTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token_type),
3259
+ previousBorrowTsMs: decodeFromFieldsWithTypes("u64", item.fields.previous_borrow_ts_ms),
3260
+ previousCumulativeBorrowRate: decodeFromFieldsWithTypes("u64", item.fields.previous_cumulative_borrow_rate),
3261
+ borrowIntervalTsMs: decodeFromFieldsWithTypes("u64", item.fields.borrow_interval_ts_ms),
3262
+ lastBorrowRateTsMs: decodeFromFieldsWithTypes("u64", item.fields.last_borrow_rate_ts_ms),
3263
+ lastCumulativeBorrowRate: decodeFromFieldsWithTypes("u64", item.fields.last_cumulative_borrow_rate),
3264
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
3265
+ });
3266
+ }
3267
+
3268
+ static fromBcs(data: Uint8Array): UpdateBorrowInfoEvent {
3269
+ return UpdateBorrowInfoEvent.fromFields(UpdateBorrowInfoEvent.bcs.parse(data));
3270
+ }
3271
+
3272
+ toJSONField() {
3273
+ return {
3274
+ index: this.index.toString(),
3275
+ liquidityTokenType: this.liquidityTokenType.toJSONField(),
3276
+ previousBorrowTsMs: this.previousBorrowTsMs.toString(),
3277
+ previousCumulativeBorrowRate: this.previousCumulativeBorrowRate.toString(),
3278
+ borrowIntervalTsMs: this.borrowIntervalTsMs.toString(),
3279
+ lastBorrowRateTsMs: this.lastBorrowRateTsMs.toString(),
3280
+ lastCumulativeBorrowRate: this.lastCumulativeBorrowRate.toString(),
3281
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
3282
+ };
3283
+ }
3284
+
3285
+ toJSON() {
3286
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
3287
+ }
3288
+
3289
+ static fromJSONField(field: any): UpdateBorrowInfoEvent {
3290
+ return UpdateBorrowInfoEvent.reified().new({
3291
+ index: decodeFromJSONField("u64", field.index),
3292
+ liquidityTokenType: decodeFromJSONField(TypeName.reified(), field.liquidityTokenType),
3293
+ previousBorrowTsMs: decodeFromJSONField("u64", field.previousBorrowTsMs),
3294
+ previousCumulativeBorrowRate: decodeFromJSONField("u64", field.previousCumulativeBorrowRate),
3295
+ borrowIntervalTsMs: decodeFromJSONField("u64", field.borrowIntervalTsMs),
3296
+ lastBorrowRateTsMs: decodeFromJSONField("u64", field.lastBorrowRateTsMs),
3297
+ lastCumulativeBorrowRate: decodeFromJSONField("u64", field.lastCumulativeBorrowRate),
3298
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
3299
+ });
3300
+ }
3301
+
3302
+ static fromJSON(json: Record<string, any>): UpdateBorrowInfoEvent {
3303
+ if (json.$typeName !== UpdateBorrowInfoEvent.$typeName) {
3304
+ throw new Error("not a WithTwoGenerics json object");
3305
+ }
3306
+
3307
+ return UpdateBorrowInfoEvent.fromJSONField(json);
3308
+ }
3309
+
3310
+ static fromSuiParsedData(content: SuiParsedData): UpdateBorrowInfoEvent {
3311
+ if (content.dataType !== "moveObject") {
3312
+ throw new Error("not an object");
3313
+ }
3314
+ if (!isUpdateBorrowInfoEvent(content.type)) {
3315
+ throw new Error(`object at ${(content.fields as any).id} is not a UpdateBorrowInfoEvent object`);
3316
+ }
3317
+ return UpdateBorrowInfoEvent.fromFieldsWithTypes(content);
3318
+ }
3319
+
3320
+ static async fetch(client: SuiClient, id: string): Promise<UpdateBorrowInfoEvent> {
3321
+ const res = await client.getObject({ id, options: { showBcs: true } });
3322
+ if (res.error) {
3323
+ throw new Error(`error fetching UpdateBorrowInfoEvent object at id ${id}: ${res.error.code}`);
3324
+ }
3325
+ if (res.data?.bcs?.dataType !== "moveObject" || !isUpdateBorrowInfoEvent(res.data.bcs.type)) {
3326
+ throw new Error(`object at id ${id} is not a UpdateBorrowInfoEvent object`);
3327
+ }
3328
+ return UpdateBorrowInfoEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
3329
+ }
3330
+ }
3331
+
3332
+ /* ============================== UpdateLiquidityValueEvent =============================== */
3333
+
3334
+ export function isUpdateLiquidityValueEvent(type: string): boolean {
3335
+ type = compressSuiType(type);
3336
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateLiquidityValueEvent";
3337
+ }
3338
+
3339
+ export interface UpdateLiquidityValueEventFields {
3340
+ sender: ToField<"address">;
3341
+ index: ToField<"u64">;
3342
+ liquidityToken: ToField<TypeName>;
3343
+ price: ToField<"u64">;
3344
+ valueInUsd: ToField<"u64">;
3345
+ lpPoolTvlUsd: ToField<"u64">;
3346
+ u64Padding: ToField<Vector<"u64">>;
3347
+ }
3348
+
3349
+ export type UpdateLiquidityValueEventReified = Reified<UpdateLiquidityValueEvent, UpdateLiquidityValueEventFields>;
3350
+
3351
+ export class UpdateLiquidityValueEvent implements StructClass {
3352
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateLiquidityValueEvent";
3353
+ static readonly $numTypeParams = 0;
3354
+
3355
+ readonly $typeName = UpdateLiquidityValueEvent.$typeName;
3356
+
3357
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateLiquidityValueEvent";
3358
+
3359
+ readonly $typeArgs: [];
3360
+
3361
+ readonly sender: ToField<"address">;
3362
+ readonly index: ToField<"u64">;
3363
+ readonly liquidityToken: ToField<TypeName>;
3364
+ readonly price: ToField<"u64">;
3365
+ readonly valueInUsd: ToField<"u64">;
3366
+ readonly lpPoolTvlUsd: ToField<"u64">;
3367
+ readonly u64Padding: ToField<Vector<"u64">>;
3368
+
3369
+ private constructor(typeArgs: [], fields: UpdateLiquidityValueEventFields) {
3370
+ this.$fullTypeName = composeSuiType(
3371
+ UpdateLiquidityValueEvent.$typeName,
3372
+ ...typeArgs
3373
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateLiquidityValueEvent";
3374
+ this.$typeArgs = typeArgs;
3375
+
3376
+ this.sender = fields.sender;
3377
+ this.index = fields.index;
3378
+ this.liquidityToken = fields.liquidityToken;
3379
+ this.price = fields.price;
3380
+ this.valueInUsd = fields.valueInUsd;
3381
+ this.lpPoolTvlUsd = fields.lpPoolTvlUsd;
3382
+ this.u64Padding = fields.u64Padding;
3383
+ }
3384
+
3385
+ static reified(): UpdateLiquidityValueEventReified {
3386
+ return {
3387
+ typeName: UpdateLiquidityValueEvent.$typeName,
3388
+ fullTypeName: composeSuiType(
3389
+ UpdateLiquidityValueEvent.$typeName,
3390
+ ...[]
3391
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateLiquidityValueEvent",
3392
+ typeArgs: [] as [],
3393
+ reifiedTypeArgs: [],
3394
+ fromFields: (fields: Record<string, any>) => UpdateLiquidityValueEvent.fromFields(fields),
3395
+ fromFieldsWithTypes: (item: FieldsWithTypes) => UpdateLiquidityValueEvent.fromFieldsWithTypes(item),
3396
+ fromBcs: (data: Uint8Array) => UpdateLiquidityValueEvent.fromBcs(data),
3397
+ bcs: UpdateLiquidityValueEvent.bcs,
3398
+ fromJSONField: (field: any) => UpdateLiquidityValueEvent.fromJSONField(field),
3399
+ fromJSON: (json: Record<string, any>) => UpdateLiquidityValueEvent.fromJSON(json),
3400
+ fromSuiParsedData: (content: SuiParsedData) => UpdateLiquidityValueEvent.fromSuiParsedData(content),
3401
+ fetch: async (client: SuiClient, id: string) => UpdateLiquidityValueEvent.fetch(client, id),
3402
+ new: (fields: UpdateLiquidityValueEventFields) => {
3403
+ return new UpdateLiquidityValueEvent([], fields);
3404
+ },
3405
+ kind: "StructClassReified",
3406
+ };
3407
+ }
3408
+
3409
+ static get r() {
3410
+ return UpdateLiquidityValueEvent.reified();
3411
+ }
3412
+
3413
+ static phantom(): PhantomReified<ToTypeStr<UpdateLiquidityValueEvent>> {
3414
+ return phantom(UpdateLiquidityValueEvent.reified());
3415
+ }
3416
+ static get p() {
3417
+ return UpdateLiquidityValueEvent.phantom();
3418
+ }
3419
+
3420
+ static get bcs() {
3421
+ return bcs.struct("UpdateLiquidityValueEvent", {
3422
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
3423
+ index: bcs.u64(),
3424
+ liquidity_token: TypeName.bcs,
3425
+ price: bcs.u64(),
3426
+ value_in_usd: bcs.u64(),
3427
+ lp_pool_tvl_usd: bcs.u64(),
3428
+ u64_padding: bcs.vector(bcs.u64()),
3429
+ });
3430
+ }
3431
+
3432
+ static fromFields(fields: Record<string, any>): UpdateLiquidityValueEvent {
3433
+ return UpdateLiquidityValueEvent.reified().new({
3434
+ sender: decodeFromFields("address", fields.sender),
3435
+ index: decodeFromFields("u64", fields.index),
3436
+ liquidityToken: decodeFromFields(TypeName.reified(), fields.liquidity_token),
3437
+ price: decodeFromFields("u64", fields.price),
3438
+ valueInUsd: decodeFromFields("u64", fields.value_in_usd),
3439
+ lpPoolTvlUsd: decodeFromFields("u64", fields.lp_pool_tvl_usd),
3440
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
3441
+ });
3442
+ }
3443
+
3444
+ static fromFieldsWithTypes(item: FieldsWithTypes): UpdateLiquidityValueEvent {
3445
+ if (!isUpdateLiquidityValueEvent(item.type)) {
3446
+ throw new Error("not a UpdateLiquidityValueEvent type");
3447
+ }
3448
+
3449
+ return UpdateLiquidityValueEvent.reified().new({
3450
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
3451
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
3452
+ liquidityToken: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token),
3453
+ price: decodeFromFieldsWithTypes("u64", item.fields.price),
3454
+ valueInUsd: decodeFromFieldsWithTypes("u64", item.fields.value_in_usd),
3455
+ lpPoolTvlUsd: decodeFromFieldsWithTypes("u64", item.fields.lp_pool_tvl_usd),
3456
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
3457
+ });
3458
+ }
3459
+
3460
+ static fromBcs(data: Uint8Array): UpdateLiquidityValueEvent {
3461
+ return UpdateLiquidityValueEvent.fromFields(UpdateLiquidityValueEvent.bcs.parse(data));
3462
+ }
3463
+
3464
+ toJSONField() {
3465
+ return {
3466
+ sender: this.sender,
3467
+ index: this.index.toString(),
3468
+ liquidityToken: this.liquidityToken.toJSONField(),
3469
+ price: this.price.toString(),
3470
+ valueInUsd: this.valueInUsd.toString(),
3471
+ lpPoolTvlUsd: this.lpPoolTvlUsd.toString(),
3472
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
3473
+ };
3474
+ }
3475
+
3476
+ toJSON() {
3477
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
3478
+ }
3479
+
3480
+ static fromJSONField(field: any): UpdateLiquidityValueEvent {
3481
+ return UpdateLiquidityValueEvent.reified().new({
3482
+ sender: decodeFromJSONField("address", field.sender),
3483
+ index: decodeFromJSONField("u64", field.index),
3484
+ liquidityToken: decodeFromJSONField(TypeName.reified(), field.liquidityToken),
3485
+ price: decodeFromJSONField("u64", field.price),
3486
+ valueInUsd: decodeFromJSONField("u64", field.valueInUsd),
3487
+ lpPoolTvlUsd: decodeFromJSONField("u64", field.lpPoolTvlUsd),
3488
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
3489
+ });
3490
+ }
3491
+
3492
+ static fromJSON(json: Record<string, any>): UpdateLiquidityValueEvent {
3493
+ if (json.$typeName !== UpdateLiquidityValueEvent.$typeName) {
3494
+ throw new Error("not a WithTwoGenerics json object");
3495
+ }
3496
+
3497
+ return UpdateLiquidityValueEvent.fromJSONField(json);
3498
+ }
3499
+
3500
+ static fromSuiParsedData(content: SuiParsedData): UpdateLiquidityValueEvent {
3501
+ if (content.dataType !== "moveObject") {
3502
+ throw new Error("not an object");
3503
+ }
3504
+ if (!isUpdateLiquidityValueEvent(content.type)) {
3505
+ throw new Error(`object at ${(content.fields as any).id} is not a UpdateLiquidityValueEvent object`);
3506
+ }
3507
+ return UpdateLiquidityValueEvent.fromFieldsWithTypes(content);
3508
+ }
3509
+
3510
+ static async fetch(client: SuiClient, id: string): Promise<UpdateLiquidityValueEvent> {
3511
+ const res = await client.getObject({ id, options: { showBcs: true } });
3512
+ if (res.error) {
3513
+ throw new Error(`error fetching UpdateLiquidityValueEvent object at id ${id}: ${res.error.code}`);
3514
+ }
3515
+ if (res.data?.bcs?.dataType !== "moveObject" || !isUpdateLiquidityValueEvent(res.data.bcs.type)) {
3516
+ throw new Error(`object at id ${id} is not a UpdateLiquidityValueEvent object`);
3517
+ }
3518
+ return UpdateLiquidityValueEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
3519
+ }
3520
+ }
3521
+
3522
+ /* ============================== UpdateMarginConfigEvent =============================== */
3523
+
3524
+ export function isUpdateMarginConfigEvent(type: string): boolean {
3525
+ type = compressSuiType(type);
3526
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateMarginConfigEvent";
3527
+ }
3528
+
3529
+ export interface UpdateMarginConfigEventFields {
3530
+ sender: ToField<"address">;
3531
+ index: ToField<"u64">;
3532
+ liquidityTokenType: ToField<TypeName>;
3533
+ previousMarginConfig: ToField<MarginConfig>;
3534
+ newMarginConfig: ToField<MarginConfig>;
3535
+ u64Padding: ToField<Vector<"u64">>;
3536
+ }
3537
+
3538
+ export type UpdateMarginConfigEventReified = Reified<UpdateMarginConfigEvent, UpdateMarginConfigEventFields>;
3539
+
3540
+ export class UpdateMarginConfigEvent implements StructClass {
3541
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateMarginConfigEvent";
3542
+ static readonly $numTypeParams = 0;
3543
+
3544
+ readonly $typeName = UpdateMarginConfigEvent.$typeName;
3545
+
3546
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateMarginConfigEvent";
3547
+
3548
+ readonly $typeArgs: [];
3549
+
3550
+ readonly sender: ToField<"address">;
3551
+ readonly index: ToField<"u64">;
3552
+ readonly liquidityTokenType: ToField<TypeName>;
3553
+ readonly previousMarginConfig: ToField<MarginConfig>;
3554
+ readonly newMarginConfig: ToField<MarginConfig>;
3555
+ readonly u64Padding: ToField<Vector<"u64">>;
3556
+
3557
+ private constructor(typeArgs: [], fields: UpdateMarginConfigEventFields) {
3558
+ this.$fullTypeName = composeSuiType(
3559
+ UpdateMarginConfigEvent.$typeName,
3560
+ ...typeArgs
3561
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateMarginConfigEvent";
3562
+ this.$typeArgs = typeArgs;
3563
+
3564
+ this.sender = fields.sender;
3565
+ this.index = fields.index;
3566
+ this.liquidityTokenType = fields.liquidityTokenType;
3567
+ this.previousMarginConfig = fields.previousMarginConfig;
3568
+ this.newMarginConfig = fields.newMarginConfig;
3569
+ this.u64Padding = fields.u64Padding;
3570
+ }
3571
+
3572
+ static reified(): UpdateMarginConfigEventReified {
3573
+ return {
3574
+ typeName: UpdateMarginConfigEvent.$typeName,
3575
+ fullTypeName: composeSuiType(
3576
+ UpdateMarginConfigEvent.$typeName,
3577
+ ...[]
3578
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateMarginConfigEvent",
3579
+ typeArgs: [] as [],
3580
+ reifiedTypeArgs: [],
3581
+ fromFields: (fields: Record<string, any>) => UpdateMarginConfigEvent.fromFields(fields),
3582
+ fromFieldsWithTypes: (item: FieldsWithTypes) => UpdateMarginConfigEvent.fromFieldsWithTypes(item),
3583
+ fromBcs: (data: Uint8Array) => UpdateMarginConfigEvent.fromBcs(data),
3584
+ bcs: UpdateMarginConfigEvent.bcs,
3585
+ fromJSONField: (field: any) => UpdateMarginConfigEvent.fromJSONField(field),
3586
+ fromJSON: (json: Record<string, any>) => UpdateMarginConfigEvent.fromJSON(json),
3587
+ fromSuiParsedData: (content: SuiParsedData) => UpdateMarginConfigEvent.fromSuiParsedData(content),
3588
+ fetch: async (client: SuiClient, id: string) => UpdateMarginConfigEvent.fetch(client, id),
3589
+ new: (fields: UpdateMarginConfigEventFields) => {
3590
+ return new UpdateMarginConfigEvent([], fields);
3591
+ },
3592
+ kind: "StructClassReified",
3593
+ };
3594
+ }
3595
+
3596
+ static get r() {
3597
+ return UpdateMarginConfigEvent.reified();
3598
+ }
3599
+
3600
+ static phantom(): PhantomReified<ToTypeStr<UpdateMarginConfigEvent>> {
3601
+ return phantom(UpdateMarginConfigEvent.reified());
3602
+ }
3603
+ static get p() {
3604
+ return UpdateMarginConfigEvent.phantom();
3605
+ }
3606
+
3607
+ static get bcs() {
3608
+ return bcs.struct("UpdateMarginConfigEvent", {
3609
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
3610
+ index: bcs.u64(),
3611
+ liquidity_token_type: TypeName.bcs,
3612
+ previous_margin_config: MarginConfig.bcs,
3613
+ new_margin_config: MarginConfig.bcs,
3614
+ u64_padding: bcs.vector(bcs.u64()),
3615
+ });
3616
+ }
3617
+
3618
+ static fromFields(fields: Record<string, any>): UpdateMarginConfigEvent {
3619
+ return UpdateMarginConfigEvent.reified().new({
3620
+ sender: decodeFromFields("address", fields.sender),
3621
+ index: decodeFromFields("u64", fields.index),
3622
+ liquidityTokenType: decodeFromFields(TypeName.reified(), fields.liquidity_token_type),
3623
+ previousMarginConfig: decodeFromFields(MarginConfig.reified(), fields.previous_margin_config),
3624
+ newMarginConfig: decodeFromFields(MarginConfig.reified(), fields.new_margin_config),
3625
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
3626
+ });
3627
+ }
3628
+
3629
+ static fromFieldsWithTypes(item: FieldsWithTypes): UpdateMarginConfigEvent {
3630
+ if (!isUpdateMarginConfigEvent(item.type)) {
3631
+ throw new Error("not a UpdateMarginConfigEvent type");
3632
+ }
3633
+
3634
+ return UpdateMarginConfigEvent.reified().new({
3635
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
3636
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
3637
+ liquidityTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token_type),
3638
+ previousMarginConfig: decodeFromFieldsWithTypes(MarginConfig.reified(), item.fields.previous_margin_config),
3639
+ newMarginConfig: decodeFromFieldsWithTypes(MarginConfig.reified(), item.fields.new_margin_config),
3640
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
3641
+ });
3642
+ }
3643
+
3644
+ static fromBcs(data: Uint8Array): UpdateMarginConfigEvent {
3645
+ return UpdateMarginConfigEvent.fromFields(UpdateMarginConfigEvent.bcs.parse(data));
3646
+ }
3647
+
3648
+ toJSONField() {
3649
+ return {
3650
+ sender: this.sender,
3651
+ index: this.index.toString(),
3652
+ liquidityTokenType: this.liquidityTokenType.toJSONField(),
3653
+ previousMarginConfig: this.previousMarginConfig.toJSONField(),
3654
+ newMarginConfig: this.newMarginConfig.toJSONField(),
3655
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
3656
+ };
3657
+ }
3658
+
3659
+ toJSON() {
3660
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
3661
+ }
3662
+
3663
+ static fromJSONField(field: any): UpdateMarginConfigEvent {
3664
+ return UpdateMarginConfigEvent.reified().new({
3665
+ sender: decodeFromJSONField("address", field.sender),
3666
+ index: decodeFromJSONField("u64", field.index),
3667
+ liquidityTokenType: decodeFromJSONField(TypeName.reified(), field.liquidityTokenType),
3668
+ previousMarginConfig: decodeFromJSONField(MarginConfig.reified(), field.previousMarginConfig),
3669
+ newMarginConfig: decodeFromJSONField(MarginConfig.reified(), field.newMarginConfig),
3670
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
3671
+ });
3672
+ }
3673
+
3674
+ static fromJSON(json: Record<string, any>): UpdateMarginConfigEvent {
3675
+ if (json.$typeName !== UpdateMarginConfigEvent.$typeName) {
3676
+ throw new Error("not a WithTwoGenerics json object");
3677
+ }
3678
+
3679
+ return UpdateMarginConfigEvent.fromJSONField(json);
3680
+ }
3681
+
3682
+ static fromSuiParsedData(content: SuiParsedData): UpdateMarginConfigEvent {
3683
+ if (content.dataType !== "moveObject") {
3684
+ throw new Error("not an object");
3685
+ }
3686
+ if (!isUpdateMarginConfigEvent(content.type)) {
3687
+ throw new Error(`object at ${(content.fields as any).id} is not a UpdateMarginConfigEvent object`);
3688
+ }
3689
+ return UpdateMarginConfigEvent.fromFieldsWithTypes(content);
3690
+ }
3691
+
3692
+ static async fetch(client: SuiClient, id: string): Promise<UpdateMarginConfigEvent> {
3693
+ const res = await client.getObject({ id, options: { showBcs: true } });
3694
+ if (res.error) {
3695
+ throw new Error(`error fetching UpdateMarginConfigEvent object at id ${id}: ${res.error.code}`);
3696
+ }
3697
+ if (res.data?.bcs?.dataType !== "moveObject" || !isUpdateMarginConfigEvent(res.data.bcs.type)) {
3698
+ throw new Error(`object at id ${id} is not a UpdateMarginConfigEvent object`);
3699
+ }
3700
+ return UpdateMarginConfigEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
3701
+ }
3702
+ }
3703
+
3704
+ /* ============================== UpdateSpotConfigEvent =============================== */
3705
+
3706
+ export function isUpdateSpotConfigEvent(type: string): boolean {
3707
+ type = compressSuiType(type);
3708
+ return type === "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateSpotConfigEvent";
3709
+ }
3710
+
3711
+ export interface UpdateSpotConfigEventFields {
3712
+ sender: ToField<"address">;
3713
+ index: ToField<"u64">;
3714
+ liquidityTokenType: ToField<TypeName>;
3715
+ previousSpotConfig: ToField<SpotConfig>;
3716
+ newSpotConfig: ToField<SpotConfig>;
3717
+ u64Padding: ToField<Vector<"u64">>;
3718
+ }
3719
+
3720
+ export type UpdateSpotConfigEventReified = Reified<UpdateSpotConfigEvent, UpdateSpotConfigEventFields>;
3721
+
3722
+ export class UpdateSpotConfigEvent implements StructClass {
3723
+ static readonly $typeName = "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateSpotConfigEvent";
3724
+ static readonly $numTypeParams = 0;
3725
+
3726
+ readonly $typeName = UpdateSpotConfigEvent.$typeName;
3727
+
3728
+ readonly $fullTypeName: "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateSpotConfigEvent";
3729
+
3730
+ readonly $typeArgs: [];
3731
+
3732
+ readonly sender: ToField<"address">;
3733
+ readonly index: ToField<"u64">;
3734
+ readonly liquidityTokenType: ToField<TypeName>;
3735
+ readonly previousSpotConfig: ToField<SpotConfig>;
3736
+ readonly newSpotConfig: ToField<SpotConfig>;
3737
+ readonly u64Padding: ToField<Vector<"u64">>;
3738
+
3739
+ private constructor(typeArgs: [], fields: UpdateSpotConfigEventFields) {
3740
+ this.$fullTypeName = composeSuiType(
3741
+ UpdateSpotConfigEvent.$typeName,
3742
+ ...typeArgs
3743
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateSpotConfigEvent";
3744
+ this.$typeArgs = typeArgs;
3745
+
3746
+ this.sender = fields.sender;
3747
+ this.index = fields.index;
3748
+ this.liquidityTokenType = fields.liquidityTokenType;
3749
+ this.previousSpotConfig = fields.previousSpotConfig;
3750
+ this.newSpotConfig = fields.newSpotConfig;
3751
+ this.u64Padding = fields.u64Padding;
3752
+ }
3753
+
3754
+ static reified(): UpdateSpotConfigEventReified {
3755
+ return {
3756
+ typeName: UpdateSpotConfigEvent.$typeName,
3757
+ fullTypeName: composeSuiType(
3758
+ UpdateSpotConfigEvent.$typeName,
3759
+ ...[]
3760
+ ) as "0x4bcf9eade4480bcb9fcd3139ec8d22afda34b25af06092904fcccb06e1b8043c::lp_pool::UpdateSpotConfigEvent",
3761
+ typeArgs: [] as [],
3762
+ reifiedTypeArgs: [],
3763
+ fromFields: (fields: Record<string, any>) => UpdateSpotConfigEvent.fromFields(fields),
3764
+ fromFieldsWithTypes: (item: FieldsWithTypes) => UpdateSpotConfigEvent.fromFieldsWithTypes(item),
3765
+ fromBcs: (data: Uint8Array) => UpdateSpotConfigEvent.fromBcs(data),
3766
+ bcs: UpdateSpotConfigEvent.bcs,
3767
+ fromJSONField: (field: any) => UpdateSpotConfigEvent.fromJSONField(field),
3768
+ fromJSON: (json: Record<string, any>) => UpdateSpotConfigEvent.fromJSON(json),
3769
+ fromSuiParsedData: (content: SuiParsedData) => UpdateSpotConfigEvent.fromSuiParsedData(content),
3770
+ fetch: async (client: SuiClient, id: string) => UpdateSpotConfigEvent.fetch(client, id),
3771
+ new: (fields: UpdateSpotConfigEventFields) => {
3772
+ return new UpdateSpotConfigEvent([], fields);
3773
+ },
3774
+ kind: "StructClassReified",
3775
+ };
3776
+ }
3777
+
3778
+ static get r() {
3779
+ return UpdateSpotConfigEvent.reified();
3780
+ }
3781
+
3782
+ static phantom(): PhantomReified<ToTypeStr<UpdateSpotConfigEvent>> {
3783
+ return phantom(UpdateSpotConfigEvent.reified());
3784
+ }
3785
+ static get p() {
3786
+ return UpdateSpotConfigEvent.phantom();
3787
+ }
3788
+
3789
+ static get bcs() {
3790
+ return bcs.struct("UpdateSpotConfigEvent", {
3791
+ sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val) }),
3792
+ index: bcs.u64(),
3793
+ liquidity_token_type: TypeName.bcs,
3794
+ previous_spot_config: SpotConfig.bcs,
3795
+ new_spot_config: SpotConfig.bcs,
3796
+ u64_padding: bcs.vector(bcs.u64()),
3797
+ });
3798
+ }
3799
+
3800
+ static fromFields(fields: Record<string, any>): UpdateSpotConfigEvent {
3801
+ return UpdateSpotConfigEvent.reified().new({
3802
+ sender: decodeFromFields("address", fields.sender),
3803
+ index: decodeFromFields("u64", fields.index),
3804
+ liquidityTokenType: decodeFromFields(TypeName.reified(), fields.liquidity_token_type),
3805
+ previousSpotConfig: decodeFromFields(SpotConfig.reified(), fields.previous_spot_config),
3806
+ newSpotConfig: decodeFromFields(SpotConfig.reified(), fields.new_spot_config),
3807
+ u64Padding: decodeFromFields(reified.vector("u64"), fields.u64_padding),
3808
+ });
3809
+ }
3810
+
3811
+ static fromFieldsWithTypes(item: FieldsWithTypes): UpdateSpotConfigEvent {
3812
+ if (!isUpdateSpotConfigEvent(item.type)) {
3813
+ throw new Error("not a UpdateSpotConfigEvent type");
3814
+ }
3815
+
3816
+ return UpdateSpotConfigEvent.reified().new({
3817
+ sender: decodeFromFieldsWithTypes("address", item.fields.sender),
3818
+ index: decodeFromFieldsWithTypes("u64", item.fields.index),
3819
+ liquidityTokenType: decodeFromFieldsWithTypes(TypeName.reified(), item.fields.liquidity_token_type),
3820
+ previousSpotConfig: decodeFromFieldsWithTypes(SpotConfig.reified(), item.fields.previous_spot_config),
3821
+ newSpotConfig: decodeFromFieldsWithTypes(SpotConfig.reified(), item.fields.new_spot_config),
3822
+ u64Padding: decodeFromFieldsWithTypes(reified.vector("u64"), item.fields.u64_padding),
3823
+ });
3824
+ }
3825
+
3826
+ static fromBcs(data: Uint8Array): UpdateSpotConfigEvent {
3827
+ return UpdateSpotConfigEvent.fromFields(UpdateSpotConfigEvent.bcs.parse(data));
3828
+ }
3829
+
3830
+ toJSONField() {
3831
+ return {
3832
+ sender: this.sender,
3833
+ index: this.index.toString(),
3834
+ liquidityTokenType: this.liquidityTokenType.toJSONField(),
3835
+ previousSpotConfig: this.previousSpotConfig.toJSONField(),
3836
+ newSpotConfig: this.newSpotConfig.toJSONField(),
3837
+ u64Padding: fieldToJSON<Vector<"u64">>(`vector<u64>`, this.u64Padding),
3838
+ };
3839
+ }
3840
+
3841
+ toJSON() {
3842
+ return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() };
3843
+ }
3844
+
3845
+ static fromJSONField(field: any): UpdateSpotConfigEvent {
3846
+ return UpdateSpotConfigEvent.reified().new({
3847
+ sender: decodeFromJSONField("address", field.sender),
3848
+ index: decodeFromJSONField("u64", field.index),
3849
+ liquidityTokenType: decodeFromJSONField(TypeName.reified(), field.liquidityTokenType),
3850
+ previousSpotConfig: decodeFromJSONField(SpotConfig.reified(), field.previousSpotConfig),
3851
+ newSpotConfig: decodeFromJSONField(SpotConfig.reified(), field.newSpotConfig),
3852
+ u64Padding: decodeFromJSONField(reified.vector("u64"), field.u64Padding),
3853
+ });
3854
+ }
3855
+
3856
+ static fromJSON(json: Record<string, any>): UpdateSpotConfigEvent {
3857
+ if (json.$typeName !== UpdateSpotConfigEvent.$typeName) {
3858
+ throw new Error("not a WithTwoGenerics json object");
3859
+ }
3860
+
3861
+ return UpdateSpotConfigEvent.fromJSONField(json);
3862
+ }
3863
+
3864
+ static fromSuiParsedData(content: SuiParsedData): UpdateSpotConfigEvent {
3865
+ if (content.dataType !== "moveObject") {
3866
+ throw new Error("not an object");
3867
+ }
3868
+ if (!isUpdateSpotConfigEvent(content.type)) {
3869
+ throw new Error(`object at ${(content.fields as any).id} is not a UpdateSpotConfigEvent object`);
3870
+ }
3871
+ return UpdateSpotConfigEvent.fromFieldsWithTypes(content);
3872
+ }
3873
+
3874
+ static async fetch(client: SuiClient, id: string): Promise<UpdateSpotConfigEvent> {
3875
+ const res = await client.getObject({ id, options: { showBcs: true } });
3876
+ if (res.error) {
3877
+ throw new Error(`error fetching UpdateSpotConfigEvent object at id ${id}: ${res.error.code}`);
3878
+ }
3879
+ if (res.data?.bcs?.dataType !== "moveObject" || !isUpdateSpotConfigEvent(res.data.bcs.type)) {
3880
+ throw new Error(`object at id ${id} is not a UpdateSpotConfigEvent object`);
3881
+ }
3882
+ return UpdateSpotConfigEvent.fromBcs(fromB64(res.data.bcs.bcsBytes));
3883
+ }
3884
+ }