@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,401 @@
1
+ import {PhantomReified, PhantomToTypeStr, PhantomTypeArgument, Reified, StructClass, ToField, ToPhantomTypeArgument, ToTypeStr, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom} from "../../../../_framework/reified";
2
+ import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
3
+ import {Option} from "../../0x1/option/structs";
4
+ import {String} from "../../0x1/string/structs";
5
+ import {TypeName} from "../../0x1/type-name/structs";
6
+ import {Balance} from "../balance/structs";
7
+ import {ID, UID} from "../object/structs";
8
+ import {VecMap} from "../vec-map/structs";
9
+ import {VecSet} from "../vec-set/structs";
10
+ import {bcs, fromB64, fromHEX, toHEX} from "@mysten/bcs";
11
+ import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
12
+
13
+ /* ============================== RuleKey =============================== */
14
+
15
+ export function isRuleKey(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::token::RuleKey<"); }
16
+
17
+ export interface RuleKeyFields<T extends PhantomTypeArgument> { isProtected: ToField<"bool"> }
18
+
19
+ export type RuleKeyReified<T extends PhantomTypeArgument> = Reified< RuleKey<T>, RuleKeyFields<T> >;
20
+
21
+ export class RuleKey<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::token::RuleKey"; static readonly $numTypeParams = 1;
22
+
23
+ readonly $typeName = RuleKey.$typeName;
24
+
25
+ readonly $fullTypeName: `0x2::token::RuleKey<${PhantomToTypeStr<T>}>`;
26
+
27
+ readonly $typeArgs: [PhantomToTypeStr<T>];
28
+
29
+ readonly isProtected: ToField<"bool">
30
+
31
+ private constructor(typeArgs: [PhantomToTypeStr<T>], fields: RuleKeyFields<T>, ) { this.$fullTypeName = composeSuiType( RuleKey.$typeName, ...typeArgs ) as `0x2::token::RuleKey<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
32
+
33
+ this.isProtected = fields.isProtected; }
34
+
35
+ static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): RuleKeyReified<ToPhantomTypeArgument<T>> { return { typeName: RuleKey.$typeName, fullTypeName: composeSuiType( RuleKey.$typeName, ...[extractType(T)] ) as `0x2::token::RuleKey<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => RuleKey.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => RuleKey.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => RuleKey.fromBcs( T, data, ), bcs: RuleKey.bcs, fromJSONField: (field: any) => RuleKey.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => RuleKey.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => RuleKey.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => RuleKey.fetch( client, T, id, ), new: ( fields: RuleKeyFields<ToPhantomTypeArgument<T>>, ) => { return new RuleKey( [extractType(T)], fields ) }, kind: "StructClassReified", } }
36
+
37
+ static get r() { return RuleKey.reified }
38
+
39
+ static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<RuleKey<ToPhantomTypeArgument<T>>>> { return phantom(RuleKey.reified( T )); } static get p() { return RuleKey.phantom }
40
+
41
+ static get bcs() { return bcs.struct("RuleKey", {
42
+
43
+ is_protected: bcs.bool()
44
+
45
+ }) };
46
+
47
+ static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): RuleKey<ToPhantomTypeArgument<T>> { return RuleKey.reified( typeArg, ).new( { isProtected: decodeFromFields("bool", fields.is_protected) } ) }
48
+
49
+ static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): RuleKey<ToPhantomTypeArgument<T>> { if (!isRuleKey(item.type)) { throw new Error("not a RuleKey type");
50
+
51
+ } assertFieldsWithTypesArgsMatch(item, [typeArg]);
52
+
53
+ return RuleKey.reified( typeArg, ).new( { isProtected: decodeFromFieldsWithTypes("bool", item.fields.is_protected) } ) }
54
+
55
+ static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): RuleKey<ToPhantomTypeArgument<T>> { return RuleKey.fromFields( typeArg, RuleKey.bcs.parse(data) ) }
56
+
57
+ toJSONField() { return {
58
+
59
+ isProtected: this.isProtected,
60
+
61
+ } }
62
+
63
+ toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
64
+
65
+ static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): RuleKey<ToPhantomTypeArgument<T>> { return RuleKey.reified( typeArg, ).new( { isProtected: decodeFromJSONField("bool", field.isProtected) } ) }
66
+
67
+ static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): RuleKey<ToPhantomTypeArgument<T>> { if (json.$typeName !== RuleKey.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(RuleKey.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
68
+
69
+ return RuleKey.fromJSONField( typeArg, json, ) }
70
+
71
+ static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): RuleKey<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isRuleKey(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a RuleKey object`); } return RuleKey.fromFieldsWithTypes( typeArg, content ); }
72
+
73
+ static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<RuleKey<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching RuleKey object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isRuleKey(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a RuleKey object`); }
74
+ return RuleKey.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
75
+
76
+ }
77
+
78
+ /* ============================== ActionRequest =============================== */
79
+
80
+ export function isActionRequest(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::token::ActionRequest<"); }
81
+
82
+ export interface ActionRequestFields<T extends PhantomTypeArgument> { name: ToField<String>; amount: ToField<"u64">; sender: ToField<"address">; recipient: ToField<Option<"address">>; spentBalance: ToField<Option<Balance<T>>>; approvals: ToField<VecSet<TypeName>> }
83
+
84
+ export type ActionRequestReified<T extends PhantomTypeArgument> = Reified< ActionRequest<T>, ActionRequestFields<T> >;
85
+
86
+ export class ActionRequest<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::token::ActionRequest"; static readonly $numTypeParams = 1;
87
+
88
+ readonly $typeName = ActionRequest.$typeName;
89
+
90
+ readonly $fullTypeName: `0x2::token::ActionRequest<${PhantomToTypeStr<T>}>`;
91
+
92
+ readonly $typeArgs: [PhantomToTypeStr<T>];
93
+
94
+ readonly name: ToField<String>; readonly amount: ToField<"u64">; readonly sender: ToField<"address">; readonly recipient: ToField<Option<"address">>; readonly spentBalance: ToField<Option<Balance<T>>>; readonly approvals: ToField<VecSet<TypeName>>
95
+
96
+ private constructor(typeArgs: [PhantomToTypeStr<T>], fields: ActionRequestFields<T>, ) { this.$fullTypeName = composeSuiType( ActionRequest.$typeName, ...typeArgs ) as `0x2::token::ActionRequest<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
97
+
98
+ this.name = fields.name;; this.amount = fields.amount;; this.sender = fields.sender;; this.recipient = fields.recipient;; this.spentBalance = fields.spentBalance;; this.approvals = fields.approvals; }
99
+
100
+ static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): ActionRequestReified<ToPhantomTypeArgument<T>> { return { typeName: ActionRequest.$typeName, fullTypeName: composeSuiType( ActionRequest.$typeName, ...[extractType(T)] ) as `0x2::token::ActionRequest<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => ActionRequest.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => ActionRequest.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => ActionRequest.fromBcs( T, data, ), bcs: ActionRequest.bcs, fromJSONField: (field: any) => ActionRequest.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => ActionRequest.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => ActionRequest.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => ActionRequest.fetch( client, T, id, ), new: ( fields: ActionRequestFields<ToPhantomTypeArgument<T>>, ) => { return new ActionRequest( [extractType(T)], fields ) }, kind: "StructClassReified", } }
101
+
102
+ static get r() { return ActionRequest.reified }
103
+
104
+ static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<ActionRequest<ToPhantomTypeArgument<T>>>> { return phantom(ActionRequest.reified( T )); } static get p() { return ActionRequest.phantom }
105
+
106
+ static get bcs() { return bcs.struct("ActionRequest", {
107
+
108
+ name: String.bcs, amount: bcs.u64(), sender: bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val), }), recipient: Option.bcs(bcs.bytes(32).transform({ input: (val: string) => fromHEX(val), output: (val: Uint8Array) => toHEX(val), })), spent_balance: Option.bcs(Balance.bcs), approvals: VecSet.bcs(TypeName.bcs)
109
+
110
+ }) };
111
+
112
+ static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): ActionRequest<ToPhantomTypeArgument<T>> { return ActionRequest.reified( typeArg, ).new( { name: decodeFromFields(String.reified(), fields.name), amount: decodeFromFields("u64", fields.amount), sender: decodeFromFields("address", fields.sender), recipient: decodeFromFields(Option.reified("address"), fields.recipient), spentBalance: decodeFromFields(Option.reified(Balance.reified(typeArg)), fields.spent_balance), approvals: decodeFromFields(VecSet.reified(TypeName.reified()), fields.approvals) } ) }
113
+
114
+ static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): ActionRequest<ToPhantomTypeArgument<T>> { if (!isActionRequest(item.type)) { throw new Error("not a ActionRequest type");
115
+
116
+ } assertFieldsWithTypesArgsMatch(item, [typeArg]);
117
+
118
+ return ActionRequest.reified( typeArg, ).new( { name: decodeFromFieldsWithTypes(String.reified(), item.fields.name), amount: decodeFromFieldsWithTypes("u64", item.fields.amount), sender: decodeFromFieldsWithTypes("address", item.fields.sender), recipient: decodeFromFieldsWithTypes(Option.reified("address"), item.fields.recipient), spentBalance: decodeFromFieldsWithTypes(Option.reified(Balance.reified(typeArg)), item.fields.spent_balance), approvals: decodeFromFieldsWithTypes(VecSet.reified(TypeName.reified()), item.fields.approvals) } ) }
119
+
120
+ static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): ActionRequest<ToPhantomTypeArgument<T>> { return ActionRequest.fromFields( typeArg, ActionRequest.bcs.parse(data) ) }
121
+
122
+ toJSONField() { return {
123
+
124
+ name: this.name,amount: this.amount.toString(),sender: this.sender,recipient: fieldToJSON<Option<"address">>(`0x1::option::Option<address>`, this.recipient),spentBalance: fieldToJSON<Option<Balance<T>>>(`0x1::option::Option<0x2::balance::Balance<${this.$typeArgs[0]}>>`, this.spentBalance),approvals: this.approvals.toJSONField(),
125
+
126
+ } }
127
+
128
+ toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
129
+
130
+ static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): ActionRequest<ToPhantomTypeArgument<T>> { return ActionRequest.reified( typeArg, ).new( { name: decodeFromJSONField(String.reified(), field.name), amount: decodeFromJSONField("u64", field.amount), sender: decodeFromJSONField("address", field.sender), recipient: decodeFromJSONField(Option.reified("address"), field.recipient), spentBalance: decodeFromJSONField(Option.reified(Balance.reified(typeArg)), field.spentBalance), approvals: decodeFromJSONField(VecSet.reified(TypeName.reified()), field.approvals) } ) }
131
+
132
+ static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): ActionRequest<ToPhantomTypeArgument<T>> { if (json.$typeName !== ActionRequest.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(ActionRequest.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
133
+
134
+ return ActionRequest.fromJSONField( typeArg, json, ) }
135
+
136
+ static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): ActionRequest<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isActionRequest(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a ActionRequest object`); } return ActionRequest.fromFieldsWithTypes( typeArg, content ); }
137
+
138
+ static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<ActionRequest<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching ActionRequest object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isActionRequest(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a ActionRequest object`); }
139
+ return ActionRequest.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
140
+
141
+ }
142
+
143
+ /* ============================== Token =============================== */
144
+
145
+ export function isToken(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::token::Token<"); }
146
+
147
+ export interface TokenFields<T extends PhantomTypeArgument> { id: ToField<UID>; balance: ToField<Balance<T>> }
148
+
149
+ export type TokenReified<T extends PhantomTypeArgument> = Reified< Token<T>, TokenFields<T> >;
150
+
151
+ export class Token<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::token::Token"; static readonly $numTypeParams = 1;
152
+
153
+ readonly $typeName = Token.$typeName;
154
+
155
+ readonly $fullTypeName: `0x2::token::Token<${PhantomToTypeStr<T>}>`;
156
+
157
+ readonly $typeArgs: [PhantomToTypeStr<T>];
158
+
159
+ readonly id: ToField<UID>; readonly balance: ToField<Balance<T>>
160
+
161
+ private constructor(typeArgs: [PhantomToTypeStr<T>], fields: TokenFields<T>, ) { this.$fullTypeName = composeSuiType( Token.$typeName, ...typeArgs ) as `0x2::token::Token<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
162
+
163
+ this.id = fields.id;; this.balance = fields.balance; }
164
+
165
+ static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): TokenReified<ToPhantomTypeArgument<T>> { return { typeName: Token.$typeName, fullTypeName: composeSuiType( Token.$typeName, ...[extractType(T)] ) as `0x2::token::Token<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => Token.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Token.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => Token.fromBcs( T, data, ), bcs: Token.bcs, fromJSONField: (field: any) => Token.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => Token.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => Token.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => Token.fetch( client, T, id, ), new: ( fields: TokenFields<ToPhantomTypeArgument<T>>, ) => { return new Token( [extractType(T)], fields ) }, kind: "StructClassReified", } }
166
+
167
+ static get r() { return Token.reified }
168
+
169
+ static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<Token<ToPhantomTypeArgument<T>>>> { return phantom(Token.reified( T )); } static get p() { return Token.phantom }
170
+
171
+ static get bcs() { return bcs.struct("Token", {
172
+
173
+ id: UID.bcs, balance: Balance.bcs
174
+
175
+ }) };
176
+
177
+ static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): Token<ToPhantomTypeArgument<T>> { return Token.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), balance: decodeFromFields(Balance.reified(typeArg), fields.balance) } ) }
178
+
179
+ static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): Token<ToPhantomTypeArgument<T>> { if (!isToken(item.type)) { throw new Error("not a Token type");
180
+
181
+ } assertFieldsWithTypesArgsMatch(item, [typeArg]);
182
+
183
+ return Token.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), balance: decodeFromFieldsWithTypes(Balance.reified(typeArg), item.fields.balance) } ) }
184
+
185
+ static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): Token<ToPhantomTypeArgument<T>> { return Token.fromFields( typeArg, Token.bcs.parse(data) ) }
186
+
187
+ toJSONField() { return {
188
+
189
+ id: this.id,balance: this.balance.toJSONField(),
190
+
191
+ } }
192
+
193
+ toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
194
+
195
+ static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): Token<ToPhantomTypeArgument<T>> { return Token.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), balance: decodeFromJSONField(Balance.reified(typeArg), field.balance) } ) }
196
+
197
+ static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): Token<ToPhantomTypeArgument<T>> { if (json.$typeName !== Token.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(Token.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
198
+
199
+ return Token.fromJSONField( typeArg, json, ) }
200
+
201
+ static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): Token<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isToken(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Token object`); } return Token.fromFieldsWithTypes( typeArg, content ); }
202
+
203
+ static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<Token<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Token object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isToken(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Token object`); }
204
+ return Token.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
205
+
206
+ }
207
+
208
+ /* ============================== TokenPolicy =============================== */
209
+
210
+ export function isTokenPolicy(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::token::TokenPolicy<"); }
211
+
212
+ export interface TokenPolicyFields<T extends PhantomTypeArgument> { id: ToField<UID>; spentBalance: ToField<Balance<T>>; rules: ToField<VecMap<String, VecSet<TypeName>>> }
213
+
214
+ export type TokenPolicyReified<T extends PhantomTypeArgument> = Reified< TokenPolicy<T>, TokenPolicyFields<T> >;
215
+
216
+ export class TokenPolicy<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::token::TokenPolicy"; static readonly $numTypeParams = 1;
217
+
218
+ readonly $typeName = TokenPolicy.$typeName;
219
+
220
+ readonly $fullTypeName: `0x2::token::TokenPolicy<${PhantomToTypeStr<T>}>`;
221
+
222
+ readonly $typeArgs: [PhantomToTypeStr<T>];
223
+
224
+ readonly id: ToField<UID>; readonly spentBalance: ToField<Balance<T>>; readonly rules: ToField<VecMap<String, VecSet<TypeName>>>
225
+
226
+ private constructor(typeArgs: [PhantomToTypeStr<T>], fields: TokenPolicyFields<T>, ) { this.$fullTypeName = composeSuiType( TokenPolicy.$typeName, ...typeArgs ) as `0x2::token::TokenPolicy<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
227
+
228
+ this.id = fields.id;; this.spentBalance = fields.spentBalance;; this.rules = fields.rules; }
229
+
230
+ static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): TokenPolicyReified<ToPhantomTypeArgument<T>> { return { typeName: TokenPolicy.$typeName, fullTypeName: composeSuiType( TokenPolicy.$typeName, ...[extractType(T)] ) as `0x2::token::TokenPolicy<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => TokenPolicy.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => TokenPolicy.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => TokenPolicy.fromBcs( T, data, ), bcs: TokenPolicy.bcs, fromJSONField: (field: any) => TokenPolicy.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => TokenPolicy.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => TokenPolicy.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => TokenPolicy.fetch( client, T, id, ), new: ( fields: TokenPolicyFields<ToPhantomTypeArgument<T>>, ) => { return new TokenPolicy( [extractType(T)], fields ) }, kind: "StructClassReified", } }
231
+
232
+ static get r() { return TokenPolicy.reified }
233
+
234
+ static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<TokenPolicy<ToPhantomTypeArgument<T>>>> { return phantom(TokenPolicy.reified( T )); } static get p() { return TokenPolicy.phantom }
235
+
236
+ static get bcs() { return bcs.struct("TokenPolicy", {
237
+
238
+ id: UID.bcs, spent_balance: Balance.bcs, rules: VecMap.bcs(String.bcs, VecSet.bcs(TypeName.bcs))
239
+
240
+ }) };
241
+
242
+ static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): TokenPolicy<ToPhantomTypeArgument<T>> { return TokenPolicy.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), spentBalance: decodeFromFields(Balance.reified(typeArg), fields.spent_balance), rules: decodeFromFields(VecMap.reified(String.reified(), VecSet.reified(TypeName.reified())), fields.rules) } ) }
243
+
244
+ static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): TokenPolicy<ToPhantomTypeArgument<T>> { if (!isTokenPolicy(item.type)) { throw new Error("not a TokenPolicy type");
245
+
246
+ } assertFieldsWithTypesArgsMatch(item, [typeArg]);
247
+
248
+ return TokenPolicy.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), spentBalance: decodeFromFieldsWithTypes(Balance.reified(typeArg), item.fields.spent_balance), rules: decodeFromFieldsWithTypes(VecMap.reified(String.reified(), VecSet.reified(TypeName.reified())), item.fields.rules) } ) }
249
+
250
+ static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): TokenPolicy<ToPhantomTypeArgument<T>> { return TokenPolicy.fromFields( typeArg, TokenPolicy.bcs.parse(data) ) }
251
+
252
+ toJSONField() { return {
253
+
254
+ id: this.id,spentBalance: this.spentBalance.toJSONField(),rules: this.rules.toJSONField(),
255
+
256
+ } }
257
+
258
+ toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
259
+
260
+ static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): TokenPolicy<ToPhantomTypeArgument<T>> { return TokenPolicy.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), spentBalance: decodeFromJSONField(Balance.reified(typeArg), field.spentBalance), rules: decodeFromJSONField(VecMap.reified(String.reified(), VecSet.reified(TypeName.reified())), field.rules) } ) }
261
+
262
+ static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): TokenPolicy<ToPhantomTypeArgument<T>> { if (json.$typeName !== TokenPolicy.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(TokenPolicy.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
263
+
264
+ return TokenPolicy.fromJSONField( typeArg, json, ) }
265
+
266
+ static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): TokenPolicy<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isTokenPolicy(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a TokenPolicy object`); } return TokenPolicy.fromFieldsWithTypes( typeArg, content ); }
267
+
268
+ static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<TokenPolicy<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching TokenPolicy object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isTokenPolicy(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a TokenPolicy object`); }
269
+ return TokenPolicy.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
270
+
271
+ }
272
+
273
+ /* ============================== TokenPolicyCap =============================== */
274
+
275
+ export function isTokenPolicyCap(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::token::TokenPolicyCap<"); }
276
+
277
+ export interface TokenPolicyCapFields<T extends PhantomTypeArgument> { id: ToField<UID>; for: ToField<ID> }
278
+
279
+ export type TokenPolicyCapReified<T extends PhantomTypeArgument> = Reified< TokenPolicyCap<T>, TokenPolicyCapFields<T> >;
280
+
281
+ export class TokenPolicyCap<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::token::TokenPolicyCap"; static readonly $numTypeParams = 1;
282
+
283
+ readonly $typeName = TokenPolicyCap.$typeName;
284
+
285
+ readonly $fullTypeName: `0x2::token::TokenPolicyCap<${PhantomToTypeStr<T>}>`;
286
+
287
+ readonly $typeArgs: [PhantomToTypeStr<T>];
288
+
289
+ readonly id: ToField<UID>; readonly for: ToField<ID>
290
+
291
+ private constructor(typeArgs: [PhantomToTypeStr<T>], fields: TokenPolicyCapFields<T>, ) { this.$fullTypeName = composeSuiType( TokenPolicyCap.$typeName, ...typeArgs ) as `0x2::token::TokenPolicyCap<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
292
+
293
+ this.id = fields.id;; this.for = fields.for; }
294
+
295
+ static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): TokenPolicyCapReified<ToPhantomTypeArgument<T>> { return { typeName: TokenPolicyCap.$typeName, fullTypeName: composeSuiType( TokenPolicyCap.$typeName, ...[extractType(T)] ) as `0x2::token::TokenPolicyCap<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => TokenPolicyCap.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => TokenPolicyCap.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => TokenPolicyCap.fromBcs( T, data, ), bcs: TokenPolicyCap.bcs, fromJSONField: (field: any) => TokenPolicyCap.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => TokenPolicyCap.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => TokenPolicyCap.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => TokenPolicyCap.fetch( client, T, id, ), new: ( fields: TokenPolicyCapFields<ToPhantomTypeArgument<T>>, ) => { return new TokenPolicyCap( [extractType(T)], fields ) }, kind: "StructClassReified", } }
296
+
297
+ static get r() { return TokenPolicyCap.reified }
298
+
299
+ static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<TokenPolicyCap<ToPhantomTypeArgument<T>>>> { return phantom(TokenPolicyCap.reified( T )); } static get p() { return TokenPolicyCap.phantom }
300
+
301
+ static get bcs() { return bcs.struct("TokenPolicyCap", {
302
+
303
+ id: UID.bcs, for: ID.bcs
304
+
305
+ }) };
306
+
307
+ static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): TokenPolicyCap<ToPhantomTypeArgument<T>> { return TokenPolicyCap.reified( typeArg, ).new( { id: decodeFromFields(UID.reified(), fields.id), for: decodeFromFields(ID.reified(), fields.for) } ) }
308
+
309
+ static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): TokenPolicyCap<ToPhantomTypeArgument<T>> { if (!isTokenPolicyCap(item.type)) { throw new Error("not a TokenPolicyCap type");
310
+
311
+ } assertFieldsWithTypesArgsMatch(item, [typeArg]);
312
+
313
+ return TokenPolicyCap.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(UID.reified(), item.fields.id), for: decodeFromFieldsWithTypes(ID.reified(), item.fields.for) } ) }
314
+
315
+ static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): TokenPolicyCap<ToPhantomTypeArgument<T>> { return TokenPolicyCap.fromFields( typeArg, TokenPolicyCap.bcs.parse(data) ) }
316
+
317
+ toJSONField() { return {
318
+
319
+ id: this.id,for: this.for,
320
+
321
+ } }
322
+
323
+ toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
324
+
325
+ static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): TokenPolicyCap<ToPhantomTypeArgument<T>> { return TokenPolicyCap.reified( typeArg, ).new( { id: decodeFromJSONField(UID.reified(), field.id), for: decodeFromJSONField(ID.reified(), field.for) } ) }
326
+
327
+ static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): TokenPolicyCap<ToPhantomTypeArgument<T>> { if (json.$typeName !== TokenPolicyCap.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(TokenPolicyCap.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
328
+
329
+ return TokenPolicyCap.fromJSONField( typeArg, json, ) }
330
+
331
+ static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): TokenPolicyCap<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isTokenPolicyCap(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a TokenPolicyCap object`); } return TokenPolicyCap.fromFieldsWithTypes( typeArg, content ); }
332
+
333
+ static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<TokenPolicyCap<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching TokenPolicyCap object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isTokenPolicyCap(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a TokenPolicyCap object`); }
334
+ return TokenPolicyCap.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
335
+
336
+ }
337
+
338
+ /* ============================== TokenPolicyCreated =============================== */
339
+
340
+ export function isTokenPolicyCreated(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::token::TokenPolicyCreated<"); }
341
+
342
+ export interface TokenPolicyCreatedFields<T extends PhantomTypeArgument> { id: ToField<ID>; isMutable: ToField<"bool"> }
343
+
344
+ export type TokenPolicyCreatedReified<T extends PhantomTypeArgument> = Reified< TokenPolicyCreated<T>, TokenPolicyCreatedFields<T> >;
345
+
346
+ export class TokenPolicyCreated<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::token::TokenPolicyCreated"; static readonly $numTypeParams = 1;
347
+
348
+ readonly $typeName = TokenPolicyCreated.$typeName;
349
+
350
+ readonly $fullTypeName: `0x2::token::TokenPolicyCreated<${PhantomToTypeStr<T>}>`;
351
+
352
+ readonly $typeArgs: [PhantomToTypeStr<T>];
353
+
354
+ readonly id: ToField<ID>; readonly isMutable: ToField<"bool">
355
+
356
+ private constructor(typeArgs: [PhantomToTypeStr<T>], fields: TokenPolicyCreatedFields<T>, ) { this.$fullTypeName = composeSuiType( TokenPolicyCreated.$typeName, ...typeArgs ) as `0x2::token::TokenPolicyCreated<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
357
+
358
+ this.id = fields.id;; this.isMutable = fields.isMutable; }
359
+
360
+ static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): TokenPolicyCreatedReified<ToPhantomTypeArgument<T>> { return { typeName: TokenPolicyCreated.$typeName, fullTypeName: composeSuiType( TokenPolicyCreated.$typeName, ...[extractType(T)] ) as `0x2::token::TokenPolicyCreated<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => TokenPolicyCreated.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => TokenPolicyCreated.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => TokenPolicyCreated.fromBcs( T, data, ), bcs: TokenPolicyCreated.bcs, fromJSONField: (field: any) => TokenPolicyCreated.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => TokenPolicyCreated.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => TokenPolicyCreated.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => TokenPolicyCreated.fetch( client, T, id, ), new: ( fields: TokenPolicyCreatedFields<ToPhantomTypeArgument<T>>, ) => { return new TokenPolicyCreated( [extractType(T)], fields ) }, kind: "StructClassReified", } }
361
+
362
+ static get r() { return TokenPolicyCreated.reified }
363
+
364
+ static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<TokenPolicyCreated<ToPhantomTypeArgument<T>>>> { return phantom(TokenPolicyCreated.reified( T )); } static get p() { return TokenPolicyCreated.phantom }
365
+
366
+ static get bcs() { return bcs.struct("TokenPolicyCreated", {
367
+
368
+ id: ID.bcs, is_mutable: bcs.bool()
369
+
370
+ }) };
371
+
372
+ static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): TokenPolicyCreated<ToPhantomTypeArgument<T>> { return TokenPolicyCreated.reified( typeArg, ).new( { id: decodeFromFields(ID.reified(), fields.id), isMutable: decodeFromFields("bool", fields.is_mutable) } ) }
373
+
374
+ static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): TokenPolicyCreated<ToPhantomTypeArgument<T>> { if (!isTokenPolicyCreated(item.type)) { throw new Error("not a TokenPolicyCreated type");
375
+
376
+ } assertFieldsWithTypesArgsMatch(item, [typeArg]);
377
+
378
+ return TokenPolicyCreated.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id), isMutable: decodeFromFieldsWithTypes("bool", item.fields.is_mutable) } ) }
379
+
380
+ static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): TokenPolicyCreated<ToPhantomTypeArgument<T>> { return TokenPolicyCreated.fromFields( typeArg, TokenPolicyCreated.bcs.parse(data) ) }
381
+
382
+ toJSONField() { return {
383
+
384
+ id: this.id,isMutable: this.isMutable,
385
+
386
+ } }
387
+
388
+ toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
389
+
390
+ static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): TokenPolicyCreated<ToPhantomTypeArgument<T>> { return TokenPolicyCreated.reified( typeArg, ).new( { id: decodeFromJSONField(ID.reified(), field.id), isMutable: decodeFromJSONField("bool", field.isMutable) } ) }
391
+
392
+ static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): TokenPolicyCreated<ToPhantomTypeArgument<T>> { if (json.$typeName !== TokenPolicyCreated.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(TokenPolicyCreated.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
393
+
394
+ return TokenPolicyCreated.fromJSONField( typeArg, json, ) }
395
+
396
+ static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): TokenPolicyCreated<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isTokenPolicyCreated(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a TokenPolicyCreated object`); } return TokenPolicyCreated.fromFieldsWithTypes( typeArg, content ); }
397
+
398
+ static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<TokenPolicyCreated<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching TokenPolicyCreated object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isTokenPolicyCreated(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a TokenPolicyCreated object`); }
399
+ return TokenPolicyCreated.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
400
+
401
+ }
@@ -0,0 +1,70 @@
1
+ import {PhantomReified, PhantomToTypeStr, PhantomTypeArgument, Reified, StructClass, ToField, ToPhantomTypeArgument, ToTypeStr, assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, phantom} from "../../../../_framework/reified";
2
+ import {FieldsWithTypes, composeSuiType, compressSuiType} from "../../../../_framework/util";
3
+ import {ID} from "../object/structs";
4
+ import {bcs, fromB64} from "@mysten/bcs";
5
+ import {SuiClient, SuiParsedData} from "@mysten/sui.js/client";
6
+
7
+ /* ============================== Receiving =============================== */
8
+
9
+ export function isReceiving(type: string): boolean { type = compressSuiType(type); return type.startsWith("0x2::transfer::Receiving<"); }
10
+
11
+ export interface ReceivingFields<T extends PhantomTypeArgument> { id: ToField<ID>; version: ToField<"u64"> }
12
+
13
+ export type ReceivingReified<T extends PhantomTypeArgument> = Reified< Receiving<T>, ReceivingFields<T> >;
14
+
15
+ export class Receiving<T extends PhantomTypeArgument> implements StructClass { static readonly $typeName = "0x2::transfer::Receiving"; static readonly $numTypeParams = 1;
16
+
17
+ readonly $typeName = Receiving.$typeName;
18
+
19
+ readonly $fullTypeName: `0x2::transfer::Receiving<${PhantomToTypeStr<T>}>`;
20
+
21
+ readonly $typeArgs: [PhantomToTypeStr<T>];
22
+
23
+ readonly id: ToField<ID>; readonly version: ToField<"u64">
24
+
25
+ private constructor(typeArgs: [PhantomToTypeStr<T>], fields: ReceivingFields<T>, ) { this.$fullTypeName = composeSuiType( Receiving.$typeName, ...typeArgs ) as `0x2::transfer::Receiving<${PhantomToTypeStr<T>}>`; this.$typeArgs = typeArgs;
26
+
27
+ this.id = fields.id;; this.version = fields.version; }
28
+
29
+ static reified<T extends PhantomReified<PhantomTypeArgument>>( T: T ): ReceivingReified<ToPhantomTypeArgument<T>> { return { typeName: Receiving.$typeName, fullTypeName: composeSuiType( Receiving.$typeName, ...[extractType(T)] ) as `0x2::transfer::Receiving<${PhantomToTypeStr<ToPhantomTypeArgument<T>>}>`, typeArgs: [ extractType(T) ] as [PhantomToTypeStr<ToPhantomTypeArgument<T>>], reifiedTypeArgs: [T], fromFields: (fields: Record<string, any>) => Receiving.fromFields( T, fields, ), fromFieldsWithTypes: (item: FieldsWithTypes) => Receiving.fromFieldsWithTypes( T, item, ), fromBcs: (data: Uint8Array) => Receiving.fromBcs( T, data, ), bcs: Receiving.bcs, fromJSONField: (field: any) => Receiving.fromJSONField( T, field, ), fromJSON: (json: Record<string, any>) => Receiving.fromJSON( T, json, ), fromSuiParsedData: (content: SuiParsedData) => Receiving.fromSuiParsedData( T, content, ), fetch: async (client: SuiClient, id: string) => Receiving.fetch( client, T, id, ), new: ( fields: ReceivingFields<ToPhantomTypeArgument<T>>, ) => { return new Receiving( [extractType(T)], fields ) }, kind: "StructClassReified", } }
30
+
31
+ static get r() { return Receiving.reified }
32
+
33
+ static phantom<T extends PhantomReified<PhantomTypeArgument>>( T: T ): PhantomReified<ToTypeStr<Receiving<ToPhantomTypeArgument<T>>>> { return phantom(Receiving.reified( T )); } static get p() { return Receiving.phantom }
34
+
35
+ static get bcs() { return bcs.struct("Receiving", {
36
+
37
+ id: ID.bcs, version: bcs.u64()
38
+
39
+ }) };
40
+
41
+ static fromFields<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, fields: Record<string, any> ): Receiving<ToPhantomTypeArgument<T>> { return Receiving.reified( typeArg, ).new( { id: decodeFromFields(ID.reified(), fields.id), version: decodeFromFields("u64", fields.version) } ) }
42
+
43
+ static fromFieldsWithTypes<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, item: FieldsWithTypes ): Receiving<ToPhantomTypeArgument<T>> { if (!isReceiving(item.type)) { throw new Error("not a Receiving type");
44
+
45
+ } assertFieldsWithTypesArgsMatch(item, [typeArg]);
46
+
47
+ return Receiving.reified( typeArg, ).new( { id: decodeFromFieldsWithTypes(ID.reified(), item.fields.id), version: decodeFromFieldsWithTypes("u64", item.fields.version) } ) }
48
+
49
+ static fromBcs<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, data: Uint8Array ): Receiving<ToPhantomTypeArgument<T>> { return Receiving.fromFields( typeArg, Receiving.bcs.parse(data) ) }
50
+
51
+ toJSONField() { return {
52
+
53
+ id: this.id,version: this.version.toString(),
54
+
55
+ } }
56
+
57
+ toJSON() { return { $typeName: this.$typeName, $typeArgs: this.$typeArgs, ...this.toJSONField() } }
58
+
59
+ static fromJSONField<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, field: any ): Receiving<ToPhantomTypeArgument<T>> { return Receiving.reified( typeArg, ).new( { id: decodeFromJSONField(ID.reified(), field.id), version: decodeFromJSONField("u64", field.version) } ) }
60
+
61
+ static fromJSON<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, json: Record<string, any> ): Receiving<ToPhantomTypeArgument<T>> { if (json.$typeName !== Receiving.$typeName) { throw new Error("not a WithTwoGenerics json object") }; assertReifiedTypeArgsMatch( composeSuiType(Receiving.$typeName, extractType(typeArg)), json.$typeArgs, [typeArg], )
62
+
63
+ return Receiving.fromJSONField( typeArg, json, ) }
64
+
65
+ static fromSuiParsedData<T extends PhantomReified<PhantomTypeArgument>>( typeArg: T, content: SuiParsedData ): Receiving<ToPhantomTypeArgument<T>> { if (content.dataType !== "moveObject") { throw new Error("not an object"); } if (!isReceiving(content.type)) { throw new Error(`object at ${(content.fields as any).id} is not a Receiving object`); } return Receiving.fromFieldsWithTypes( typeArg, content ); }
66
+
67
+ static async fetch<T extends PhantomReified<PhantomTypeArgument>>( client: SuiClient, typeArg: T, id: string ): Promise<Receiving<ToPhantomTypeArgument<T>>> { const res = await client.getObject({ id, options: { showBcs: true, }, }); if (res.error) { throw new Error(`error fetching Receiving object at id ${id}: ${res.error.code}`); } if (res.data?.bcs?.dataType !== "moveObject" || !isReceiving(res.data.bcs.type)) { throw new Error(`object at id ${id} is not a Receiving object`); }
68
+ return Receiving.fromBcs( typeArg, fromB64(res.data.bcs.bcsBytes) ); }
69
+
70
+ }