aftermath-ts-sdk 0.0.162 → 0.0.164

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 (387) hide show
  1. package/dist/general/api/dynamicFieldsApiHelpers.d.ts +29 -6
  2. package/dist/general/api/dynamicFieldsApiHelpers.d.ts.map +1 -1
  3. package/dist/general/api/dynamicFieldsApiHelpers.js +31 -31
  4. package/dist/general/api/eventsApiHelpers.d.ts +23 -8
  5. package/dist/general/api/eventsApiHelpers.d.ts.map +1 -1
  6. package/dist/general/api/eventsApiHelpers.js +38 -33
  7. package/dist/general/api/inspectionsApiHelpers.js +9 -9
  8. package/dist/general/api/objectsApiHelpers.d.ts +150 -110
  9. package/dist/general/api/objectsApiHelpers.d.ts.map +1 -1
  10. package/dist/general/api/objectsApiHelpers.js +32 -27
  11. package/dist/general/api/rpcApiHelpers.js +9 -9
  12. package/dist/general/api/transactionsApiHelpers.d.ts +9 -4
  13. package/dist/general/api/transactionsApiHelpers.d.ts.map +1 -1
  14. package/dist/general/api/transactionsApiHelpers.js +28 -19
  15. package/dist/general/historicalData/historicalData.js +6 -6
  16. package/dist/general/historicalData/historicalDataApi.js +6 -6
  17. package/dist/general/historicalData/historicalDataApiInterface.d.ts +2 -1
  18. package/dist/general/historicalData/historicalDataApiInterface.d.ts.map +1 -1
  19. package/dist/general/prices/coingecko/coinGeckoApiHelpers.js +24 -24
  20. package/dist/general/prices/coingecko/coinGeckoPricesApi.js +15 -15
  21. package/dist/general/prices/placeholder/placeholderPricesApi.d.ts.map +1 -1
  22. package/dist/general/prices/placeholder/placeholderPricesApi.js +40 -33
  23. package/dist/general/prices/prices.js +6 -6
  24. package/dist/general/prices/pyth/pythPricesApi.js +12 -12
  25. package/dist/general/prices/pyth/pythPricesApiHelpers.js +12 -12
  26. package/dist/general/providers/aftermath.d.ts +4 -2
  27. package/dist/general/providers/aftermath.d.ts.map +1 -1
  28. package/dist/general/providers/aftermath.js +22 -20
  29. package/dist/general/providers/aftermathApi.d.ts +4 -2
  30. package/dist/general/providers/aftermathApi.d.ts.map +1 -1
  31. package/dist/general/providers/aftermathApi.js +34 -32
  32. package/dist/general/types/configTypes.d.ts +94 -14
  33. package/dist/general/types/configTypes.d.ts.map +1 -1
  34. package/dist/general/types/generalTypes.d.ts +12 -1
  35. package/dist/general/types/generalTypes.d.ts.map +1 -1
  36. package/dist/general/utils/caller.d.ts.map +1 -1
  37. package/dist/general/utils/caller.js +11 -9
  38. package/dist/general/utils/casting.d.ts +4 -4
  39. package/dist/general/utils/casting.d.ts.map +1 -1
  40. package/dist/general/utils/casting.js +22 -22
  41. package/dist/general/utils/fixed.d.ts +5 -0
  42. package/dist/general/utils/fixed.d.ts.map +1 -1
  43. package/dist/general/utils/fixed.js +4 -0
  44. package/dist/general/utils/helpers.js +21 -21
  45. package/dist/general/wallet/wallet.js +6 -6
  46. package/dist/general/wallet/walletApi.js +12 -12
  47. package/dist/packages/capys/capy.d.ts +4 -4
  48. package/dist/packages/capys/capy.d.ts.map +1 -1
  49. package/dist/packages/capys/capy.js +15 -15
  50. package/dist/packages/coin/api/coinApi.d.ts +18 -5
  51. package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
  52. package/dist/packages/coin/api/coinApi.js +109 -15
  53. package/dist/packages/coin/coin.d.ts +4 -5
  54. package/dist/packages/coin/coin.d.ts.map +1 -1
  55. package/dist/packages/coin/coin.js +28 -28
  56. package/dist/packages/coin/coinTypes.d.ts +4 -0
  57. package/dist/packages/coin/coinTypes.d.ts.map +1 -1
  58. package/dist/packages/{referralVault/api/referralVaultApiHelpers.d.ts → external/baySwap/baySwapApi.d.ts} +49 -77
  59. package/dist/packages/external/baySwap/baySwapApi.d.ts.map +1 -0
  60. package/dist/packages/external/baySwap/baySwapApi.js +176 -0
  61. package/dist/packages/external/baySwap/baySwapTypes.d.ts +29 -0
  62. package/dist/packages/external/baySwap/baySwapTypes.d.ts.map +1 -0
  63. package/dist/packages/external/baySwap/baySwapTypes.js +15 -0
  64. package/dist/packages/external/{deepBook/deepBookApiHelper.d.ts → blueMove/blueMoveApi.d.ts} +42 -87
  65. package/dist/packages/external/blueMove/blueMoveApi.d.ts.map +1 -0
  66. package/dist/packages/external/blueMove/blueMoveApi.js +249 -0
  67. package/dist/packages/external/blueMove/blueMoveTypes.d.ts +87 -0
  68. package/dist/packages/external/blueMove/blueMoveTypes.d.ts.map +1 -0
  69. package/dist/packages/external/blueMove/blueMoveTypes.js +13 -0
  70. package/dist/packages/external/cetus/cetusApi.d.ts +240 -11
  71. package/dist/packages/external/cetus/cetusApi.d.ts.map +1 -1
  72. package/dist/packages/external/cetus/cetusApi.js +295 -28
  73. package/dist/packages/external/deepBook/deepBookApi.d.ts +406 -5
  74. package/dist/packages/external/deepBook/deepBookApi.d.ts.map +1 -1
  75. package/dist/packages/external/deepBook/deepBookApi.js +332 -35
  76. package/dist/packages/external/deepBook/deepBookTypes.d.ts +4 -6
  77. package/dist/packages/external/deepBook/deepBookTypes.d.ts.map +1 -1
  78. package/dist/packages/external/deepBook/deepBookTypes.js +2 -2
  79. package/dist/packages/{faucet/api/faucetApiHelpers.d.ts → external/interest/interestApi.d.ts} +45 -19
  80. package/dist/packages/external/interest/interestApi.d.ts.map +1 -0
  81. package/dist/packages/external/interest/interestApi.js +178 -0
  82. package/dist/packages/external/interest/interestTypes.d.ts +37 -0
  83. package/dist/packages/external/interest/interestTypes.d.ts.map +1 -0
  84. package/dist/packages/external/interest/interestTypes.js +12 -0
  85. package/dist/packages/external/kriya/kriyaApi.d.ts +148 -0
  86. package/dist/packages/external/kriya/kriyaApi.d.ts.map +1 -0
  87. package/dist/packages/external/kriya/kriyaApi.js +191 -0
  88. package/dist/packages/external/kriya/kriyaTypes.d.ts +59 -0
  89. package/dist/packages/external/kriya/kriyaTypes.d.ts.map +1 -0
  90. package/dist/packages/external/kriya/kriyaTypes.js +16 -0
  91. package/dist/packages/external/suiswap/suiswapApi.d.ts +145 -0
  92. package/dist/packages/external/suiswap/suiswapApi.d.ts.map +1 -0
  93. package/dist/packages/external/suiswap/suiswapApi.js +197 -0
  94. package/dist/packages/external/suiswap/suiswapTypes.d.ts +75 -0
  95. package/dist/packages/external/suiswap/suiswapTypes.d.ts.map +1 -0
  96. package/dist/packages/external/suiswap/suiswapTypes.js +10 -0
  97. package/dist/packages/external/turbos/turbosApi.d.ts +206 -8
  98. package/dist/packages/external/turbos/turbosApi.d.ts.map +1 -1
  99. package/dist/packages/external/turbos/turbosApi.js +471 -27
  100. package/dist/packages/farms/farmsStakedPosition.d.ts +20 -0
  101. package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -0
  102. package/dist/packages/farms/farmsStakedPosition.js +63 -0
  103. package/dist/packages/farms/farmsStakingPool.d.ts +9 -0
  104. package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -0
  105. package/dist/packages/farms/farmsStakingPool.js +20 -0
  106. package/dist/packages/farms/farmsTypes.d.ts +37 -0
  107. package/dist/packages/farms/farmsTypes.d.ts.map +1 -0
  108. package/dist/packages/farms/index.d.ts +3 -0
  109. package/dist/packages/farms/index.d.ts.map +1 -0
  110. package/dist/packages/{capys → farms}/index.js +2 -3
  111. package/dist/packages/faucet/api/faucetApi.d.ts +117 -8
  112. package/dist/packages/faucet/api/faucetApi.d.ts.map +1 -1
  113. package/dist/packages/faucet/api/faucetApi.js +112 -27
  114. package/dist/packages/faucet/api/faucetApiCasting.js +3 -3
  115. package/dist/packages/faucet/faucet.js +15 -15
  116. package/dist/packages/index.d.ts +3 -1
  117. package/dist/packages/index.d.ts.map +1 -1
  118. package/dist/packages/index.js +3 -1
  119. package/dist/packages/nftAmm/api/nftAmmApi.d.ts +168 -16
  120. package/dist/packages/nftAmm/api/nftAmmApi.d.ts.map +1 -1
  121. package/dist/packages/nftAmm/api/nftAmmApi.js +227 -33
  122. package/dist/packages/nftAmm/api/nftAmmApiCasting.js +12 -12
  123. package/dist/packages/nftAmm/nftAmm.js +12 -12
  124. package/dist/packages/nftAmm/nftAmmMarket.js +15 -15
  125. package/dist/packages/perpetuals/api/perpetualsApi.d.ts +650 -0
  126. package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -0
  127. package/dist/packages/perpetuals/api/perpetualsApi.js +387 -0
  128. package/dist/packages/perpetuals/api/perpetualsCasting.d.ts +22 -0
  129. package/dist/packages/perpetuals/api/perpetualsCasting.d.ts.map +1 -0
  130. package/dist/packages/perpetuals/api/perpetualsCasting.js +201 -0
  131. package/dist/packages/perpetuals/index.d.ts +4 -0
  132. package/dist/packages/perpetuals/index.d.ts.map +1 -0
  133. package/dist/{external/nojo → packages/perpetuals}/index.js +3 -5
  134. package/dist/packages/perpetuals/perpetuals.d.ts +17 -0
  135. package/dist/packages/perpetuals/perpetuals.d.ts.map +1 -0
  136. package/dist/packages/perpetuals/perpetuals.js +50 -0
  137. package/dist/packages/perpetuals/perpetualsAccount.d.ts +22 -0
  138. package/dist/packages/perpetuals/perpetualsAccount.d.ts.map +1 -0
  139. package/dist/packages/perpetuals/perpetualsAccount.js +65 -0
  140. package/dist/packages/perpetuals/perpetualsMarket.d.ts +20 -0
  141. package/dist/packages/perpetuals/perpetualsMarket.d.ts.map +1 -0
  142. package/dist/packages/perpetuals/perpetualsMarket.js +52 -0
  143. package/dist/packages/perpetuals/perpetualsTypes.d.ts +184 -0
  144. package/dist/packages/perpetuals/perpetualsTypes.d.ts.map +1 -0
  145. package/dist/packages/perpetuals/utils/comparators.d.ts +4 -0
  146. package/dist/packages/perpetuals/utils/comparators.d.ts.map +1 -0
  147. package/dist/packages/perpetuals/utils/comparators.js +25 -0
  148. package/dist/packages/perpetuals/utils/critBitTreeUtils.d.ts +7 -0
  149. package/dist/packages/perpetuals/utils/critBitTreeUtils.d.ts.map +1 -0
  150. package/dist/packages/perpetuals/utils/critBitTreeUtils.js +40 -0
  151. package/dist/packages/perpetuals/utils/helpers.d.ts +5 -0
  152. package/dist/packages/perpetuals/utils/helpers.d.ts.map +1 -0
  153. package/dist/packages/perpetuals/utils/helpers.js +9 -0
  154. package/dist/packages/perpetuals/utils/index.d.ts +4 -0
  155. package/dist/packages/perpetuals/utils/index.d.ts.map +1 -0
  156. package/dist/packages/perpetuals/utils/index.js +19 -0
  157. package/dist/packages/pools/api/poolsApi.d.ts +261 -35
  158. package/dist/packages/pools/api/poolsApi.d.ts.map +1 -1
  159. package/dist/packages/pools/api/poolsApi.js +621 -130
  160. package/dist/packages/pools/api/poolsApiCasting.d.ts.map +1 -1
  161. package/dist/packages/pools/api/poolsApiCasting.js +10 -7
  162. package/dist/packages/pools/api/poolsApiCastingTypes.d.ts +4 -1
  163. package/dist/packages/pools/api/poolsApiCastingTypes.d.ts.map +1 -1
  164. package/dist/packages/pools/pool.d.ts.map +1 -1
  165. package/dist/packages/pools/pool.js +22 -19
  166. package/dist/packages/pools/pools.js +34 -34
  167. package/dist/packages/pools/poolsTypes.d.ts +9 -1
  168. package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
  169. package/dist/packages/pools/utils/cmmmCalculations.d.ts.map +1 -1
  170. package/dist/packages/pools/utils/cmmmCalculations.js +81 -77
  171. package/dist/packages/referralVault/api/referralVaultApi.d.ts +166 -4
  172. package/dist/packages/referralVault/api/referralVaultApi.d.ts.map +1 -1
  173. package/dist/packages/referralVault/api/referralVaultApi.js +80 -14
  174. package/dist/packages/referralVault/referralVault.js +9 -9
  175. package/dist/packages/router/api/routerApi.d.ts +14 -5
  176. package/dist/packages/router/api/routerApi.d.ts.map +1 -1
  177. package/dist/packages/router/api/routerApi.js +40 -25
  178. package/dist/packages/router/api/routerApiCasting.d.ts +6 -0
  179. package/dist/packages/router/api/routerApiCasting.d.ts.map +1 -0
  180. package/dist/packages/router/api/routerApiCasting.js +22 -0
  181. package/dist/packages/router/api/routerApiCastingTypes.d.ts +11 -0
  182. package/dist/packages/router/api/routerApiCastingTypes.d.ts.map +1 -0
  183. package/dist/packages/router/api/routerApiHelpers.js +30 -30
  184. package/dist/packages/router/api/routerAsyncApiHelpers.js +18 -18
  185. package/dist/packages/router/api/routerSynchronousApiHelpers.d.ts +88 -3
  186. package/dist/packages/router/api/routerSynchronousApiHelpers.d.ts.map +1 -1
  187. package/dist/packages/router/api/routerSynchronousApiHelpers.js +125 -28
  188. package/dist/packages/router/router.d.ts +2 -1
  189. package/dist/packages/router/router.d.ts.map +1 -1
  190. package/dist/packages/router/router.js +23 -15
  191. package/dist/packages/router/routerTypes.d.ts +19 -5
  192. package/dist/packages/router/routerTypes.d.ts.map +1 -1
  193. package/dist/packages/router/routerTypes.js +5 -1
  194. package/dist/packages/router/utils/async/routerAsyncApiInterface.d.ts +1 -8
  195. package/dist/packages/router/utils/async/routerAsyncApiInterface.d.ts.map +1 -1
  196. package/dist/packages/router/utils/async/routerAsyncGraph.js +15 -15
  197. package/dist/packages/router/utils/synchronous/interfaces/routerPoolInterface.d.ts +5 -2
  198. package/dist/packages/router/utils/synchronous/interfaces/routerPoolInterface.d.ts.map +1 -1
  199. package/dist/packages/router/utils/synchronous/interfaces/routerPoolInterface.js +30 -14
  200. package/dist/packages/router/utils/synchronous/routerGraph.js +36 -36
  201. package/dist/packages/router/utils/synchronous/routerPools/aftermathRouterPool.d.ts +5 -2
  202. package/dist/packages/router/utils/synchronous/routerPools/aftermathRouterPool.d.ts.map +1 -1
  203. package/dist/packages/router/utils/synchronous/routerPools/aftermathRouterPool.js +18 -16
  204. package/dist/packages/router/utils/synchronous/routerPools/baySwapRouterPool.d.ts +102 -0
  205. package/dist/packages/router/utils/synchronous/routerPools/baySwapRouterPool.d.ts.map +1 -0
  206. package/dist/packages/router/utils/synchronous/routerPools/baySwapRouterPool.js +217 -0
  207. package/dist/packages/router/utils/synchronous/routerPools/blueMoveRouterPool.d.ts +102 -0
  208. package/dist/packages/router/utils/synchronous/routerPools/blueMoveRouterPool.d.ts.map +1 -0
  209. package/dist/packages/router/utils/synchronous/routerPools/blueMoveRouterPool.js +221 -0
  210. package/dist/packages/router/utils/synchronous/routerPools/cetusRouterPool.d.ts +5 -2
  211. package/dist/packages/router/utils/synchronous/routerPools/cetusRouterPool.d.ts.map +1 -1
  212. package/dist/packages/router/utils/synchronous/routerPools/cetusRouterPool.js +11 -11
  213. package/dist/packages/router/utils/synchronous/routerPools/deepBookRouterPool.d.ts +5 -2
  214. package/dist/packages/router/utils/synchronous/routerPools/deepBookRouterPool.d.ts.map +1 -1
  215. package/dist/packages/router/utils/synchronous/routerPools/deepBookRouterPool.js +16 -16
  216. package/dist/packages/router/utils/synchronous/routerPools/interestRouterPool.d.ts +96 -0
  217. package/dist/packages/router/utils/synchronous/routerPools/interestRouterPool.d.ts.map +1 -0
  218. package/dist/packages/router/utils/synchronous/routerPools/interestRouterPool.js +174 -0
  219. package/dist/packages/router/utils/synchronous/routerPools/kriyaRouterPool.d.ts +102 -0
  220. package/dist/packages/router/utils/synchronous/routerPools/kriyaRouterPool.d.ts.map +1 -0
  221. package/dist/packages/router/utils/synchronous/routerPools/kriyaRouterPool.js +216 -0
  222. package/dist/packages/router/utils/synchronous/routerPools/{nojoRouterPool.d.ts → suiswapRouterPool.d.ts} +35 -14
  223. package/dist/packages/router/utils/synchronous/routerPools/suiswapRouterPool.d.ts.map +1 -0
  224. package/dist/packages/router/utils/synchronous/routerPools/suiswapRouterPool.js +217 -0
  225. package/dist/packages/router/utils/synchronous/routerPools/turbosRouterPool.d.ts +5 -2
  226. package/dist/packages/router/utils/synchronous/routerPools/turbosRouterPool.d.ts.map +1 -1
  227. package/dist/packages/router/utils/synchronous/routerPools/turbosRouterPool.js +11 -11
  228. package/dist/packages/staking/api/stakingApi.d.ts +173 -10
  229. package/dist/packages/staking/api/stakingApi.d.ts.map +1 -1
  230. package/dist/packages/staking/api/stakingApi.js +373 -32
  231. package/dist/packages/staking/api/stakingApiCasting.d.ts.map +1 -1
  232. package/dist/packages/staking/api/stakingApiCasting.js +6 -6
  233. package/dist/packages/staking/staking.js +18 -18
  234. package/dist/packages/sui/api/suiApi.d.ts +0 -2
  235. package/dist/packages/sui/api/suiApi.d.ts.map +1 -1
  236. package/dist/packages/sui/api/suiApi.js +9 -9
  237. package/dist/packages/sui/sui.js +9 -9
  238. package/dist/packages/suiFrens/api/suiFrensApi.d.ts +80 -0
  239. package/dist/packages/suiFrens/api/suiFrensApi.d.ts.map +1 -0
  240. package/dist/packages/suiFrens/api/suiFrensApi.js +564 -0
  241. package/dist/packages/suiFrens/api/suiFrensApiCasting.d.ts +13 -0
  242. package/dist/packages/suiFrens/api/suiFrensApiCasting.d.ts.map +1 -0
  243. package/dist/packages/suiFrens/api/suiFrensApiCasting.js +108 -0
  244. package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.d.ts +51 -0
  245. package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.d.ts.map +1 -0
  246. package/dist/packages/suiFrens/api/suiFrensApiCastingTypes.js +2 -0
  247. package/dist/packages/suiFrens/index.d.ts +4 -0
  248. package/dist/packages/suiFrens/index.d.ts.map +1 -0
  249. package/dist/packages/suiFrens/index.js +19 -0
  250. package/dist/packages/suiFrens/stakedSuiFrenReceipt.d.ts +13 -0
  251. package/dist/packages/suiFrens/stakedSuiFrenReceipt.d.ts.map +1 -0
  252. package/dist/packages/{capys/stakedCapyReceipt.js → suiFrens/stakedSuiFrenReceipt.js} +21 -21
  253. package/dist/packages/suiFrens/suiFren.d.ts +10 -0
  254. package/dist/packages/suiFrens/suiFren.d.ts.map +1 -0
  255. package/dist/packages/suiFrens/suiFren.js +39 -0
  256. package/dist/packages/suiFrens/suiFrens.d.ts +32 -0
  257. package/dist/packages/suiFrens/suiFrens.d.ts.map +1 -0
  258. package/dist/packages/suiFrens/suiFrens.js +143 -0
  259. package/dist/packages/suiFrens/suiFrensTypes.d.ts +89 -0
  260. package/dist/packages/suiFrens/suiFrensTypes.d.ts.map +1 -0
  261. package/dist/packages/suiFrens/suiFrensTypes.js +2 -0
  262. package/dist/types.d.ts +3 -2
  263. package/dist/types.d.ts.map +1 -1
  264. package/dist/types.js +4 -2
  265. package/package.json +12 -5
  266. package/dist/external/nojo/amm/index.d.ts +0 -2
  267. package/dist/external/nojo/amm/index.d.ts.map +0 -1
  268. package/dist/external/nojo/amm/index.js +0 -4
  269. package/dist/external/nojo/amm/init.d.ts +0 -3
  270. package/dist/external/nojo/amm/init.d.ts.map +0 -1
  271. package/dist/external/nojo/amm/init.js +0 -31
  272. package/dist/external/nojo/amm/pool/errors.d.ts +0 -41
  273. package/dist/external/nojo/amm/pool/errors.d.ts.map +0 -1
  274. package/dist/external/nojo/amm/pool/errors.js +0 -75
  275. package/dist/external/nojo/amm/pool/functions.d.ts +0 -356
  276. package/dist/external/nojo/amm/pool/functions.d.ts.map +0 -1
  277. package/dist/external/nojo/amm/pool/functions.js +0 -173
  278. package/dist/external/nojo/amm/pool/structs.d.ts +0 -94
  279. package/dist/external/nojo/amm/pool/structs.d.ts.map +0 -1
  280. package/dist/external/nojo/amm/pool/structs.js +0 -278
  281. package/dist/external/nojo/amm/util/functions.d.ts +0 -359
  282. package/dist/external/nojo/amm/util/functions.d.ts.map +0 -1
  283. package/dist/external/nojo/amm/util/functions.js +0 -198
  284. package/dist/external/nojo/framework/balance.d.ts +0 -19
  285. package/dist/external/nojo/framework/balance.d.ts.map +0 -1
  286. package/dist/external/nojo/framework/balance.js +0 -44
  287. package/dist/external/nojo/framework/bcs.d.ts +0 -3
  288. package/dist/external/nojo/framework/bcs.d.ts.map +0 -1
  289. package/dist/external/nojo/framework/bcs.js +0 -5
  290. package/dist/external/nojo/framework/coin.d.ts +0 -42
  291. package/dist/external/nojo/framework/coin.d.ts.map +0 -1
  292. package/dist/external/nojo/framework/coin.js +0 -144
  293. package/dist/external/nojo/framework/dynamic-field.d.ts +0 -25
  294. package/dist/external/nojo/framework/dynamic-field.d.ts.map +0 -1
  295. package/dist/external/nojo/framework/dynamic-field.js +0 -89
  296. package/dist/external/nojo/framework/init.d.ts +0 -3
  297. package/dist/external/nojo/framework/init.d.ts.map +0 -1
  298. package/dist/external/nojo/framework/init.js +0 -41
  299. package/dist/external/nojo/framework/loader.d.ts +0 -12
  300. package/dist/external/nojo/framework/loader.d.ts.map +0 -1
  301. package/dist/external/nojo/framework/loader.js +0 -103
  302. package/dist/external/nojo/framework/object.d.ts +0 -33
  303. package/dist/external/nojo/framework/object.d.ts.map +0 -1
  304. package/dist/external/nojo/framework/object.js +0 -89
  305. package/dist/external/nojo/framework/table.d.ts +0 -23
  306. package/dist/external/nojo/framework/table.d.ts.map +0 -1
  307. package/dist/external/nojo/framework/table.js +0 -83
  308. package/dist/external/nojo/framework/type-name.d.ts +0 -15
  309. package/dist/external/nojo/framework/type-name.d.ts.map +0 -1
  310. package/dist/external/nojo/framework/type-name.js +0 -34
  311. package/dist/external/nojo/framework/type.d.ts +0 -24
  312. package/dist/external/nojo/framework/type.d.ts.map +0 -1
  313. package/dist/external/nojo/framework/type.js +0 -120
  314. package/dist/external/nojo/framework/util.d.ts +0 -31
  315. package/dist/external/nojo/framework/util.d.ts.map +0 -1
  316. package/dist/external/nojo/framework/util.js +0 -49
  317. package/dist/external/nojo/index.d.ts +0 -6
  318. package/dist/external/nojo/index.d.ts.map +0 -1
  319. package/dist/external/nojo/init.d.ts +0 -2
  320. package/dist/external/nojo/init.d.ts.map +0 -1
  321. package/dist/external/nojo/init.js +0 -39
  322. package/dist/packages/capys/api/capysApi.d.ts +0 -37
  323. package/dist/packages/capys/api/capysApi.d.ts.map +0 -1
  324. package/dist/packages/capys/api/capysApi.js +0 -200
  325. package/dist/packages/capys/api/capysApiCasting.d.ts +0 -13
  326. package/dist/packages/capys/api/capysApiCasting.d.ts.map +0 -1
  327. package/dist/packages/capys/api/capysApiCasting.js +0 -108
  328. package/dist/packages/capys/api/capysApiCastingTypes.d.ts +0 -51
  329. package/dist/packages/capys/api/capysApiCastingTypes.d.ts.map +0 -1
  330. package/dist/packages/capys/api/capysApiHelpers.d.ts +0 -48
  331. package/dist/packages/capys/api/capysApiHelpers.d.ts.map +0 -1
  332. package/dist/packages/capys/api/capysApiHelpers.js +0 -386
  333. package/dist/packages/capys/capys.d.ts +0 -32
  334. package/dist/packages/capys/capys.d.ts.map +0 -1
  335. package/dist/packages/capys/capys.js +0 -151
  336. package/dist/packages/capys/capysTypes.d.ts +0 -89
  337. package/dist/packages/capys/capysTypes.d.ts.map +0 -1
  338. package/dist/packages/capys/index.d.ts +0 -4
  339. package/dist/packages/capys/index.d.ts.map +0 -1
  340. package/dist/packages/capys/stakedCapyReceipt.d.ts +0 -14
  341. package/dist/packages/capys/stakedCapyReceipt.d.ts.map +0 -1
  342. package/dist/packages/coin/api/coinApiHelpers.d.ts +0 -23
  343. package/dist/packages/coin/api/coinApiHelpers.d.ts.map +0 -1
  344. package/dist/packages/coin/api/coinApiHelpers.js +0 -203
  345. package/dist/packages/external/cetus/cetusApiHelpers.d.ts +0 -247
  346. package/dist/packages/external/cetus/cetusApiHelpers.d.ts.map +0 -1
  347. package/dist/packages/external/cetus/cetusApiHelpers.js +0 -303
  348. package/dist/packages/external/deepBook/deepBookApiHelper.d.ts.map +0 -1
  349. package/dist/packages/external/deepBook/deepBookApiHelper.js +0 -193
  350. package/dist/packages/external/nojo/nojoAmmApi.d.ts +0 -24
  351. package/dist/packages/external/nojo/nojoAmmApi.d.ts.map +0 -1
  352. package/dist/packages/external/nojo/nojoAmmApi.js +0 -86
  353. package/dist/packages/external/nojo/nojoAmmApiHelpers.d.ts +0 -14
  354. package/dist/packages/external/nojo/nojoAmmApiHelpers.d.ts.map +0 -1
  355. package/dist/packages/external/nojo/nojoAmmApiHelpers.js +0 -69
  356. package/dist/packages/external/nojo/nojoAmmTypes.d.ts +0 -9
  357. package/dist/packages/external/nojo/nojoAmmTypes.d.ts.map +0 -1
  358. package/dist/packages/external/nojo/nojoAmmTypes.js +0 -7
  359. package/dist/packages/external/turbos/turbosApiHelpers.d.ts +0 -205
  360. package/dist/packages/external/turbos/turbosApiHelpers.d.ts.map +0 -1
  361. package/dist/packages/external/turbos/turbosApiHelpers.js +0 -325
  362. package/dist/packages/faucet/api/faucetApiHelpers.d.ts.map +0 -1
  363. package/dist/packages/faucet/api/faucetApiHelpers.js +0 -90
  364. package/dist/packages/nftAmm/api/nftAmmApiHelpers.d.ts +0 -193
  365. package/dist/packages/nftAmm/api/nftAmmApiHelpers.d.ts.map +0 -1
  366. package/dist/packages/nftAmm/api/nftAmmApiHelpers.js +0 -238
  367. package/dist/packages/pools/api/poolsApiHelpers.d.ts +0 -204
  368. package/dist/packages/pools/api/poolsApiHelpers.d.ts.map +0 -1
  369. package/dist/packages/pools/api/poolsApiHelpers.js +0 -523
  370. package/dist/packages/referralVault/api/referralVaultApiHelpers.d.ts.map +0 -1
  371. package/dist/packages/referralVault/api/referralVaultApiHelpers.js +0 -86
  372. package/dist/packages/router/utils/synchronous/routerPools/nojoRouterPool.d.ts.map +0 -1
  373. package/dist/packages/router/utils/synchronous/routerPools/nojoRouterPool.js +0 -99
  374. package/dist/packages/staking/api/stakingApiHelpers.d.ts +0 -212
  375. package/dist/packages/staking/api/stakingApiHelpers.d.ts.map +0 -1
  376. package/dist/packages/staking/api/stakingApiHelpers.js +0 -400
  377. package/dist/packages/sui/api/suiApiCasting.d.ts +0 -3
  378. package/dist/packages/sui/api/suiApiCasting.d.ts.map +0 -1
  379. package/dist/packages/sui/api/suiApiCasting.js +0 -6
  380. package/dist/packages/sui/api/suiApiCastingTypes.d.ts +0 -2
  381. package/dist/packages/sui/api/suiApiCastingTypes.d.ts.map +0 -1
  382. package/dist/packages/sui/api/suiApiHelpers.d.ts +0 -6
  383. package/dist/packages/sui/api/suiApiHelpers.d.ts.map +0 -1
  384. package/dist/packages/sui/api/suiApiHelpers.js +0 -13
  385. /package/dist/packages/{capys/api/capysApiCastingTypes.js → farms/farmsTypes.js} +0 -0
  386. /package/dist/packages/{capys/capysTypes.js → perpetuals/perpetualsTypes.js} +0 -0
  387. /package/dist/packages/{sui/api/suiApiCastingTypes.js → router/api/routerApiCastingTypes.js} +0 -0
@@ -0,0 +1,564 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SuiFrensApi = void 0;
13
+ const sui_js_1 = require("@mysten/sui.js");
14
+ const suiFrensApiCasting_1 = require("./suiFrensApiCasting");
15
+ const coin_1 = require("../../coin/coin");
16
+ const helpers_1 = require("../../../general/utils/helpers");
17
+ const suiFrens_1 = require("../suiFrens");
18
+ const utils_1 = require("../../../general/utils");
19
+ const eventsApiHelpers_1 = require("../../../general/api/eventsApiHelpers");
20
+ class SuiFrensApi {
21
+ // =========================================================================
22
+ // Constructor
23
+ // =========================================================================
24
+ constructor(Provider) {
25
+ this.Provider = Provider;
26
+ // =========================================================================
27
+ // Public Methods
28
+ // =========================================================================
29
+ // =========================================================================
30
+ // Inspections
31
+ // =========================================================================
32
+ this.fetchStakedSuiFrenFeesEarned = (stakedSuiFrenReceiptObjectId) => __awaiter(this, void 0, void 0, function* () {
33
+ const [suiFrenFeesEarnedIndividual, suiFrenFeesEarnedGlobal] = yield Promise.all([
34
+ this.fetchStakedSuiFrenFeesEarnedIndividual(stakedSuiFrenReceiptObjectId),
35
+ this.fetchStakedSuiFrenFeesEarnedGlobal(),
36
+ ]);
37
+ return {
38
+ individualFees: suiFrenFeesEarnedIndividual,
39
+ globalFees: suiFrenFeesEarnedGlobal,
40
+ };
41
+ });
42
+ this.fetchIsSuiFrenPackageOnChain = () => this.Provider.Objects().fetchDoesObjectExist(this.addresses.packages.suiFren);
43
+ this.fetchSuiFrensStakedInSuiFrenVaultWithAttributes = (inputs) => __awaiter(this, void 0, void 0, function* () {
44
+ var _a;
45
+ const { limit, attributes } = inputs;
46
+ const isComplete = (suiFrens) => {
47
+ return (this.filterSuiFrensWithAttributes(suiFrens, attributes).length >=
48
+ limit);
49
+ };
50
+ const suiFrensWithCursor = yield this.Provider.DynamicFields().fetchDynamicFieldsUntil(Object.assign(Object.assign({}, inputs), { fetchFunc: this.fetchSuiFrensStakedInSuiFrenVault, isComplete }));
51
+ const filteredSuiFrens = this.filterSuiFrensWithAttributes(suiFrensWithCursor.dynamicFieldObjects, attributes);
52
+ const resizedSuiFrensWithCursor = {
53
+ nextCursor: ((_a = suiFrensWithCursor.nextCursor) !== null && _a !== void 0 ? _a : limit < filteredSuiFrens.length)
54
+ ? filteredSuiFrens[limit].objectId
55
+ : suiFrensWithCursor.nextCursor,
56
+ dynamicFieldObjects: filteredSuiFrens.slice(0, limit),
57
+ };
58
+ return resizedSuiFrensWithCursor;
59
+ });
60
+ this.fetchStakedSuiFrenFeesEarnedIndividual = (stakingReceiptId) => __awaiter(this, void 0, void 0, function* () {
61
+ const tx = this.suiFrenFeesEarnedIndividualDevInspectTransaction(stakingReceiptId);
62
+ const bytes = yield this.Provider.Inspections().fetchFirstBytesFromTxOutput(tx);
63
+ return utils_1.Casting.bigIntFromBytes(bytes);
64
+ });
65
+ this.fetchStakedSuiFrenFeesEarnedGlobal = () => __awaiter(this, void 0, void 0, function* () {
66
+ const tx = this.suiFrenFeesEarnedGlobalDevInspectTransaction();
67
+ const bytes = yield this.Provider.Inspections().fetchFirstBytesFromTxOutput(tx);
68
+ return utils_1.Casting.bigIntFromBytes(bytes);
69
+ });
70
+ this.suiFrenFeesEarnedIndividualDevInspectTransaction = (stakingReceiptId) => {
71
+ const tx = new sui_js_1.TransactionBlock();
72
+ tx.moveCall({
73
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.suiFrenVault.moduleName, SuiFrensApi.constants.suiFrenVault.modules.suiFrenVault.functions
74
+ .feesEarnedIndividual.name),
75
+ typeArguments: [],
76
+ arguments: [
77
+ tx.object(this.addresses.objects.suiFrenVault),
78
+ tx.object(stakingReceiptId),
79
+ ],
80
+ });
81
+ return tx;
82
+ };
83
+ this.suiFrenFeesEarnedGlobalDevInspectTransaction = () => {
84
+ const tx = new sui_js_1.TransactionBlock();
85
+ tx.moveCall({
86
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.suiFrenVault.moduleName, SuiFrensApi.constants.suiFrenVault.modules.suiFrenVault.functions
87
+ .feesEarnedGlobal.name),
88
+ typeArguments: [],
89
+ arguments: [tx.object(this.addresses.objects.suiFrenVault)],
90
+ });
91
+ return tx;
92
+ };
93
+ // =========================================================================
94
+ // Events
95
+ // =========================================================================
96
+ this.fetchSuiFrenBornEvents = (inputs) => __awaiter(this, void 0, void 0, function* () {
97
+ return yield this.Provider.Events().fetchCastEventsWithCursor(Object.assign(Object.assign({}, inputs), { query: {
98
+ MoveEventType: this.eventTypes.suiFrenBorn,
99
+ }, eventFromEventOnChain: suiFrensApiCasting_1.SuiFrensApiCasting.suiFrenBornEventFromOnChain }));
100
+ });
101
+ this.fetchBreedSuiFrensEvents = (inputs) => __awaiter(this, void 0, void 0, function* () {
102
+ return yield this.Provider.Events().fetchCastEventsWithCursor(Object.assign(Object.assign({}, inputs), { query: {
103
+ MoveEventType: this.eventTypes.breedSuiFrens,
104
+ }, eventFromEventOnChain: suiFrensApiCasting_1.SuiFrensApiCasting.breedSuiFrensEventFromOnChain }));
105
+ });
106
+ this.fetchStakeSuiFrenEvents = (inputs) => __awaiter(this, void 0, void 0, function* () {
107
+ return yield this.Provider.Events().fetchCastEventsWithCursor(Object.assign(Object.assign({}, inputs), { query: {
108
+ MoveEventType: this.eventTypes.stakeSuiFren,
109
+ }, eventFromEventOnChain: suiFrensApiCasting_1.SuiFrensApiCasting.stakeSuiFrenEventFromOnChain }));
110
+ });
111
+ this.fetchUnstakeSuiFrenEvents = (inputs) => __awaiter(this, void 0, void 0, function* () {
112
+ return yield this.Provider.Events().fetchCastEventsWithCursor(Object.assign(Object.assign({}, inputs), { query: {
113
+ MoveEventType: this.eventTypes.unstakeSuiFren,
114
+ }, eventFromEventOnChain: suiFrensApiCasting_1.SuiFrensApiCasting.unstakeSuiFrenEventFromOnChain }));
115
+ });
116
+ // =========================================================================
117
+ // Objects
118
+ // =========================================================================
119
+ // =========================================================================
120
+ // SuiFren Objects
121
+ // =========================================================================
122
+ this.fetchSuiFrens = (suiFrenIds) => __awaiter(this, void 0, void 0, function* () {
123
+ return this.Provider.Objects().fetchCastObjectBatch({
124
+ objectIds: suiFrenIds,
125
+ objectFromSuiObjectResponse: suiFrensApiCasting_1.SuiFrensApiCasting.suiFrenObjectFromSuiObjectResponse,
126
+ });
127
+ });
128
+ this.fetchSuiFrensOwnedByAddress = (walletAddress) => __awaiter(this, void 0, void 0, function* () {
129
+ return yield this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
130
+ walletAddress,
131
+ objectType: this.objectTypes.suiFrenObjectType,
132
+ objectFromSuiObjectResponse: suiFrensApiCasting_1.SuiFrensApiCasting.suiFrenObjectFromSuiObjectResponse,
133
+ });
134
+ });
135
+ this.fetchStakedSuiFrens = (suiFrenIds) => __awaiter(this, void 0, void 0, function* () {
136
+ return this.Provider.Objects().fetchCastObjectBatch({
137
+ objectIds: suiFrenIds,
138
+ objectFromSuiObjectResponse: suiFrensApiCasting_1.SuiFrensApiCasting.suiFrenObjectFromSuiObjectResponse,
139
+ });
140
+ });
141
+ this.fetchStakedSuiFrensOwnedByAddress = (walletAddress) => __awaiter(this, void 0, void 0, function* () {
142
+ // i. obtain all owned StakingReceipt
143
+ const suiFrenIdsStakedByAddress = (yield this.fetchStakedSuiFrenReceiptOwnedByAddress(walletAddress)).map((suiFrenStakingReceipt) => suiFrenStakingReceipt.suiFrenId);
144
+ // ii. obtain a SuiFren object from each SuiFren ObjectId
145
+ const stakedSuiFrens = yield this.fetchStakedSuiFrens(suiFrenIdsStakedByAddress);
146
+ return stakedSuiFrens;
147
+ });
148
+ this.fetchSuiFrenVault = (suiFrenVaultId) => __awaiter(this, void 0, void 0, function* () {
149
+ return this.Provider.Objects().fetchCastObject({
150
+ objectId: suiFrenVaultId,
151
+ objectFromSuiObjectResponse: suiFrensApiCasting_1.SuiFrensApiCasting.suiFrenVaultObjectFromSuiObjectResponse,
152
+ });
153
+ });
154
+ this.fetchSuiFrensStakedInSuiFrenVault = (inputs) => __awaiter(this, void 0, void 0, function* () {
155
+ const suiFrenVaultId = this.addresses.objects.suiFrenVault;
156
+ const suiFrenType = this.objectTypes.suiFrenObjectType;
157
+ return yield this.Provider.DynamicFields().fetchCastDynamicFieldsOfTypeWithCursor(Object.assign(Object.assign({}, inputs), { parentObjectId: suiFrenVaultId, objectsFromObjectIds: this.fetchSuiFrens, dynamicFieldType: suiFrenType }));
158
+ });
159
+ // =========================================================================
160
+ // Staked SuiFren Receipt Objects
161
+ // =========================================================================
162
+ this.fetchStakedSuiFrenReceipt = (suiFrenStakingReceipt) => __awaiter(this, void 0, void 0, function* () {
163
+ return this.Provider.Objects().fetchCastObject({
164
+ objectId: suiFrenStakingReceipt,
165
+ objectFromSuiObjectResponse: suiFrensApiCasting_1.SuiFrensApiCasting.stakedSuiFrenReceiptObjectFromSuiObjectResponse,
166
+ });
167
+ });
168
+ this.fetchStakedSuiFrenReceipts = (suiFrenStakingReceipts) => __awaiter(this, void 0, void 0, function* () {
169
+ return this.Provider.Objects().fetchCastObjectBatch({
170
+ objectIds: suiFrenStakingReceipts,
171
+ objectFromSuiObjectResponse: suiFrensApiCasting_1.SuiFrensApiCasting.stakedSuiFrenReceiptObjectFromSuiObjectResponse,
172
+ });
173
+ });
174
+ this.fetchStakedSuiFrenReceiptOwnedByAddress = (walletAddress) => __awaiter(this, void 0, void 0, function* () {
175
+ return yield this.Provider.Objects().fetchCastObjectsOwnedByAddressOfType({
176
+ walletAddress,
177
+ objectType: this.objectTypes.stakedSuiFrenReceiptObjectType,
178
+ objectFromSuiObjectResponse: suiFrensApiCasting_1.SuiFrensApiCasting.stakedSuiFrenReceiptObjectFromSuiObjectResponse,
179
+ });
180
+ });
181
+ this.fetchStakedSuiFrenReceiptWithSuiFrensOwnedByAddress = (walletAddress) => __awaiter(this, void 0, void 0, function* () {
182
+ // i. obtain all owned StakingReceipt
183
+ const stakingReceipts = yield this.fetchStakedSuiFrenReceiptOwnedByAddress(walletAddress);
184
+ // ii. obtain all SuiFren Object Ids
185
+ const suiFrenIdsStakedByAddress = stakingReceipts.map((suiFrenStakingReceipt) => suiFrenStakingReceipt.suiFrenId);
186
+ // iii. obtain a SuiFren object from each SuiFren ObjectId
187
+ let indexStakedSuiFrens = {};
188
+ (yield this.fetchStakedSuiFrens(suiFrenIdsStakedByAddress)).forEach((stakedSuiFren) => {
189
+ indexStakedSuiFrens[stakedSuiFren.objectId] = stakedSuiFren;
190
+ });
191
+ // iv. construct a StakingReceiptWithSuiFren object from each StakingReceipt <> SuiFren pair
192
+ const suiFrenStakingReceiptsWithSuiFren = stakingReceipts.map((stakingReceipt) => {
193
+ return {
194
+ objectId: stakingReceipt.objectId,
195
+ suiFren: indexStakedSuiFrens[stakingReceipt.suiFrenId],
196
+ unlockEpoch: stakingReceipt.unlockEpoch,
197
+ };
198
+ });
199
+ return suiFrenStakingReceiptsWithSuiFren;
200
+ });
201
+ // =========================================================================
202
+ // Transactions
203
+ // =========================================================================
204
+ // =========================================================================
205
+ // SuiFren Staking
206
+ // =========================================================================
207
+ this.fetchStakeSuiFrenTransaction = (suiFrenId) => this.Provider.Transactions().fetchSetGasBudgetAndSerializeTx(this.suiFrenStakeSuiFrenTransaction(suiFrenId));
208
+ this.fetchUnstakeSuiFrenTransaction = (stakingReceiptId) => this.Provider.Transactions().fetchSetGasBudgetAndSerializeTx(this.suiFrenUnstakeSuiFrenTransaction(stakingReceiptId));
209
+ this.fetchWithdrawStakedSuiFrenFeesTransaction = (stakingReceiptId) => this.Provider.Transactions().fetchSetGasBudgetAndSerializeTx(this.suiFrenWithdrawFeesTransaction(stakingReceiptId));
210
+ this.fetchWithdrawStakedSuiFrenFeesAmountTransaction = (stakingReceiptId, amount) => this.Provider.Transactions().fetchSetGasBudgetAndSerializeTx(this.suiFrenWithdrawFeesAmountTransaction(stakingReceiptId, amount));
211
+ this.fetchSuiFrenTransferTransaction = (stakingReceiptId, recipient) => this.Provider.Transactions().fetchSetGasBudgetAndSerializeTx(this.suiFrenTransferTransaction(stakingReceiptId, recipient));
212
+ // =========================================================================
213
+ // Breeding Transactions
214
+ // =========================================================================
215
+ this.fetchBreedSuiFrensTransaction = (walletAddress, parentOneId, parentTwoId) => __awaiter(this, void 0, void 0, function* () {
216
+ const [parentOneIsOwned, parentTwoIsOwned] = yield Promise.all([
217
+ this.Provider.Objects().fetchIsObjectOwnedByAddress({
218
+ objectId: parentOneId,
219
+ walletAddress,
220
+ }),
221
+ this.Provider.Objects().fetchIsObjectOwnedByAddress({
222
+ objectId: parentTwoId,
223
+ walletAddress,
224
+ }),
225
+ ]);
226
+ const transaction = yield this.fetchSuiFrenBuildBreedTransaction(walletAddress, parentOneId, parentOneIsOwned, parentTwoId, parentTwoIsOwned);
227
+ return this.Provider.Transactions().fetchSetGasBudgetAndSerializeTx(transaction);
228
+ });
229
+ this.fetchSuiFrenBuildBreedTransaction = (walletAddress, parentOneId, parentOneIsOwned, parentTwoId, parentTwoIsOwned) => __awaiter(this, void 0, void 0, function* () {
230
+ if (parentOneIsOwned && parentTwoIsOwned) {
231
+ // i. both suiFrens are owned
232
+ return this.fetchBuildBreedAndKeepTransaction(walletAddress, parentOneId, parentTwoId);
233
+ }
234
+ else if (parentOneIsOwned && !parentTwoIsOwned) {
235
+ // iia. one of the SuiFrens is owned and the other is staked
236
+ return this.fetchBuildBreedWithStakedAndKeepTransaction(walletAddress, parentOneId, parentTwoId);
237
+ }
238
+ else if (!parentOneIsOwned && parentTwoIsOwned) {
239
+ // iib. one of the SuiFren's is owned and the other is staked
240
+ return this.fetchBuildBreedWithStakedAndKeepTransaction(walletAddress, parentTwoId, parentOneId);
241
+ }
242
+ else {
243
+ // iii. both SuiFrens are staked
244
+ return this.fetchBuildBreedStakedWithStakedAndKeepTransaction(walletAddress, parentTwoId, parentOneId);
245
+ }
246
+ });
247
+ this.fetchBuildBreedWithStakedAndKeepTransaction = (walletAddress, parentOneId, parentTwoId) => __awaiter(this, void 0, void 0, function* () {
248
+ const tx = new sui_js_1.TransactionBlock();
249
+ tx.setSender(walletAddress);
250
+ const feeCoinType = suiFrens_1.SuiFrens.constants.breedingFees.coinType;
251
+ const feeCoinAmount = suiFrens_1.SuiFrens.constants.breedingFees.amounts.breedWithStakedAndKeep;
252
+ const coinArg = yield this.Provider.Coin().fetchCoinWithAmountTx({
253
+ tx,
254
+ walletAddress,
255
+ coinType: feeCoinType,
256
+ coinAmount: feeCoinAmount,
257
+ });
258
+ const finalTx = this.addStakeBreedWithStakedAndKeepCommandToTransaction(tx, coinArg, parentOneId, parentTwoId);
259
+ return finalTx;
260
+ });
261
+ this.fetchBuildBreedStakedWithStakedAndKeepTransaction = (walletAddress, parentOneId, parentTwoId) => __awaiter(this, void 0, void 0, function* () {
262
+ const tx = new sui_js_1.TransactionBlock();
263
+ tx.setSender(walletAddress);
264
+ const feeCoinType = suiFrens_1.SuiFrens.constants.breedingFees.coinType;
265
+ const feeCoinAmount = suiFrens_1.SuiFrens.constants.breedingFees.amounts.breedStakedWithStakedAndKeep;
266
+ const coinArg = yield this.Provider.Coin().fetchCoinWithAmountTx({
267
+ tx,
268
+ walletAddress,
269
+ coinType: feeCoinType,
270
+ coinAmount: feeCoinAmount,
271
+ });
272
+ const finalTx = this.addStakeBreedWithStakedAndKeepCommandToTransaction(tx, coinArg, parentOneId, parentTwoId);
273
+ return finalTx;
274
+ });
275
+ this.fetchBuildBreedAndKeepTransaction = (walletAddress, parentOneId, parentTwoId) => __awaiter(this, void 0, void 0, function* () {
276
+ const tx = new sui_js_1.TransactionBlock();
277
+ tx.setSender(walletAddress);
278
+ const feeCoinType = suiFrens_1.SuiFrens.constants.breedingFees.coinType;
279
+ const feeCoinAmount = suiFrens_1.SuiFrens.constants.breedingFees.amounts.breedAndKeep;
280
+ const coinArg = yield this.Provider.Coin().fetchCoinWithAmountTx({
281
+ tx,
282
+ walletAddress,
283
+ coinType: feeCoinType,
284
+ coinAmount: feeCoinAmount,
285
+ });
286
+ const finalTx = this.addStakeBreedAndKeepCommandToTransaction(tx, coinArg, parentOneId, parentTwoId);
287
+ return finalTx;
288
+ });
289
+ // =========================================================================
290
+ // Transaction Commands
291
+ // =========================================================================
292
+ // =========================================================================
293
+ // Breeding Transaction
294
+ // =========================================================================
295
+ this.addStakeBreedAndKeepCommandToTransaction = (tx, coinId, parentOneId, parentTwoId) => {
296
+ tx.add({
297
+ kind: "MoveCall",
298
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
299
+ .breedAndKeep.name),
300
+ typeArguments: [],
301
+ arguments: [
302
+ tx.object(this.addresses.objects.suiFrenVault),
303
+ tx.object(this.addresses.objects.suiFrenRegistry),
304
+ typeof coinId === "string" ? tx.object(coinId) : coinId,
305
+ tx.object(parentOneId),
306
+ tx.object(parentTwoId),
307
+ ],
308
+ });
309
+ return tx;
310
+ };
311
+ this.addStakeBreedWithStakedAndKeepCommandToTransaction = (tx, coinId, parentOneId, parentTwoId) => {
312
+ tx.add({
313
+ kind: "MoveCall",
314
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
315
+ .breedWithStakedAndKeep.name),
316
+ typeArguments: [],
317
+ arguments: [
318
+ tx.object(this.addresses.objects.suiFrenVault),
319
+ tx.object(this.addresses.objects.suiFrenRegistry),
320
+ typeof coinId === "string" ? tx.object(coinId) : coinId,
321
+ tx.object(parentOneId),
322
+ tx.object(parentTwoId),
323
+ ],
324
+ });
325
+ return tx;
326
+ };
327
+ this.addStakeBreedStakedWithStakedAndKeepCommandToTransaction = (tx, coinId, parentOneId, parentTwoId) => {
328
+ tx.add({
329
+ kind: "MoveCall",
330
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
331
+ .breedStakedWithStakedAndKeep.name),
332
+ typeArguments: [],
333
+ arguments: [
334
+ tx.object(this.addresses.objects.suiFrenVault),
335
+ tx.object(this.addresses.objects.suiFrenRegistry),
336
+ tx.object(coinId),
337
+ tx.object(parentOneId),
338
+ tx.object(parentTwoId),
339
+ ],
340
+ });
341
+ return tx;
342
+ };
343
+ // =========================================================================
344
+ // Staking Transaction Commands
345
+ // =========================================================================
346
+ this.suiFrenStakeSuiFrenTransaction = (suiFrenId) => {
347
+ const tx = new sui_js_1.TransactionBlock();
348
+ tx.moveCall({
349
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
350
+ .stakeSuiFren.name),
351
+ typeArguments: [],
352
+ arguments: [
353
+ tx.object(this.addresses.objects.suiFrenVault),
354
+ tx.object(suiFrenId),
355
+ ],
356
+ });
357
+ return tx;
358
+ };
359
+ this.suiFrenUnstakeSuiFrenTransaction = (stakingReceiptId) => {
360
+ const tx = new sui_js_1.TransactionBlock();
361
+ tx.moveCall({
362
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
363
+ .unstakeSuiFren.name),
364
+ typeArguments: [],
365
+ arguments: [
366
+ tx.object(this.addresses.objects.suiFrenVault),
367
+ tx.object(stakingReceiptId),
368
+ ],
369
+ });
370
+ return tx;
371
+ };
372
+ this.suiFrenTransferTransaction = (stakingReceiptId, recipient) => {
373
+ const tx = new sui_js_1.TransactionBlock();
374
+ tx.moveCall({
375
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
376
+ .transfer.name),
377
+ typeArguments: [],
378
+ arguments: [
379
+ tx.object(this.addresses.objects.suiFrenVault),
380
+ tx.object(stakingReceiptId),
381
+ tx.pure(recipient),
382
+ ],
383
+ });
384
+ return tx;
385
+ };
386
+ // =========================================================================
387
+ // Fee Transaction Commands
388
+ // =========================================================================
389
+ this.suiFrenWithdrawFeesTransaction = (stakingReceiptId) => {
390
+ const tx = new sui_js_1.TransactionBlock();
391
+ tx.moveCall({
392
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
393
+ .withdrawFees.name),
394
+ typeArguments: [],
395
+ arguments: [
396
+ tx.object(this.addresses.objects.suiFrenVault),
397
+ tx.object(stakingReceiptId),
398
+ ],
399
+ });
400
+ return tx;
401
+ };
402
+ this.suiFrenWithdrawFeesAmountTransaction = (stakingReceiptId, amount) => {
403
+ const tx = new sui_js_1.TransactionBlock();
404
+ tx.moveCall({
405
+ target: helpers_1.Helpers.transactions.createTxTarget(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.suiFrenVault.modules.interface.functions
406
+ .withdrawFeesAmount.name),
407
+ typeArguments: [],
408
+ arguments: [
409
+ tx.object(this.addresses.objects.suiFrenVault),
410
+ tx.object(stakingReceiptId),
411
+ tx.pure(amount.toString()),
412
+ ],
413
+ });
414
+ return tx;
415
+ };
416
+ // =========================================================================
417
+ // Stats
418
+ // =========================================================================
419
+ // TODO: make this function not exported from sdk (only internal use)
420
+ // NOTE: this calculation will be incorrect if feeCoinType is different for each fee
421
+ this.calcSuiFrenBreedingFees = (breedSuiFrenEvents, feeCoinDecimals, feeCoinPrice) => {
422
+ const breedingFeesInFeeCoin = helpers_1.Helpers.sum(breedSuiFrenEvents.map((event) => coin_1.Coin.balanceWithDecimals(event.feeCoinWithBalance.balance, feeCoinDecimals)));
423
+ const breedingFeesUsd = feeCoinPrice * breedingFeesInFeeCoin;
424
+ return {
425
+ amount: breedingFeesInFeeCoin,
426
+ amountUsd: breedingFeesUsd,
427
+ };
428
+ };
429
+ this.fetchSuiFrenStats = () => __awaiter(this, void 0, void 0, function* () {
430
+ const breedSuiFrenEventsWithinTime = yield this.Provider.Events().fetchEventsWithinTime({
431
+ fetchEventsFunc: this.fetchBreedSuiFrensEvents,
432
+ timeUnit: "hour",
433
+ time: 24,
434
+ });
435
+ const feeCoin = breedSuiFrenEventsWithinTime.length === 0
436
+ ? suiFrens_1.SuiFrens.constants.breedingFees.coinType
437
+ : breedSuiFrenEventsWithinTime[0].feeCoinWithBalance.coin;
438
+ const feeCoinDecimals = (yield this.Provider.Coin().fetchCoinMetadata(feeCoin)).decimals;
439
+ const feeCoinPrice = yield this.Provider.Prices().fetchPrice(feeCoin);
440
+ const breedingFeesDaily = this.calcSuiFrenBreedingFees(breedSuiFrenEventsWithinTime, feeCoinDecimals, feeCoinPrice);
441
+ const suiFrenVault = yield this.fetchSuiFrenVault(this.addresses.objects.suiFrenVault);
442
+ const { bredSuiFrens, stakedSuiFrens, breedingFeesGlobal } = yield this.fetchSuiFrenVaultStats(suiFrenVault, feeCoinDecimals, feeCoinPrice);
443
+ return {
444
+ bredSuiFrens,
445
+ stakedSuiFrens,
446
+ breedingFeeCoin: feeCoin,
447
+ breedingFeesGlobal,
448
+ breedingFeesDaily,
449
+ breedingVolumeDaily: breedSuiFrenEventsWithinTime.length,
450
+ };
451
+ });
452
+ this.fetchSuiFrenVaultStats = (suiFrenVault, feeCoinDecimals, feeCoinPrice) => __awaiter(this, void 0, void 0, function* () {
453
+ const globalFeesWithDecimals = coin_1.Coin.balanceWithDecimals(suiFrenVault.globalFees, feeCoinDecimals);
454
+ const globalFeesUsd = feeCoinPrice * globalFeesWithDecimals;
455
+ const breedingFeesGlobal = {
456
+ amount: globalFeesWithDecimals,
457
+ amountUsd: globalFeesUsd,
458
+ };
459
+ return {
460
+ bredSuiFrens: suiFrenVault.bredSuiFrens,
461
+ stakedSuiFrens: suiFrenVault.stakedSuiFrens,
462
+ breedingFeesGlobal,
463
+ };
464
+ });
465
+ // =========================================================================
466
+ // SuiFren Attribute Filtering
467
+ // =========================================================================
468
+ this.filterSuiFrensWithAttributes = (suiFrens, attributes) => suiFrens.filter((suiFren) => attributes.every((attribute) => suiFren.fields.attributes.some((suiFrenAttribute) => suiFrenAttribute.name === attribute.name &&
469
+ suiFrenAttribute.value === attribute.value)));
470
+ // =========================================================================
471
+ // Helpers
472
+ // =========================================================================
473
+ this.isStakedSuiFrenReceiptObjectType = (suiObjectInfo) => suiObjectInfo.type === this.objectTypes.stakedSuiFrenReceiptObjectType;
474
+ this.isSuiFrenObjectType = (suiObjectInfo) => suiObjectInfo.type === this.objectTypes.suiFrenObjectType;
475
+ // =========================================================================
476
+ // Private Methods
477
+ // =========================================================================
478
+ // =========================================================================
479
+ // Event Types
480
+ // =========================================================================
481
+ this.suiFrenBornEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.suiFren, SuiFrensApi.constants.suiFren.modules.suiFren.moduleName, SuiFrensApi.constants.eventNames.suiFrenBorn);
482
+ this.breedSuiFrensEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.eventNames.breedSuiFren);
483
+ this.stakeSuiFrenEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.eventNames.stakeSuiFren);
484
+ this.unstakeSuiFrenEventType = () => eventsApiHelpers_1.EventsApiHelpers.createEventType(this.addresses.packages.suiFrenVault, SuiFrensApi.constants.suiFrenVault.modules.interface.moduleName, SuiFrensApi.constants.eventNames.unstakeSuiFren);
485
+ const addresses = this.Provider.addresses.suiFrens;
486
+ if (!addresses)
487
+ throw new Error("not all required addresses have been set in provider");
488
+ this.addresses = addresses;
489
+ this.objectTypes = {
490
+ suiFrenObjectType: `${addresses.packages.suiFren}::suiFren::SuiFren`,
491
+ stakedSuiFrenReceiptObjectType: `${addresses.packages.suiFrenVault}::suiFren_vault::StakingReceipt`,
492
+ };
493
+ this.eventTypes = {
494
+ suiFrenBorn: this.suiFrenBornEventType(),
495
+ breedSuiFrens: this.breedSuiFrensEventType(),
496
+ stakeSuiFren: this.stakeSuiFrenEventType(),
497
+ unstakeSuiFren: this.unstakeSuiFrenEventType(),
498
+ };
499
+ }
500
+ }
501
+ exports.SuiFrensApi = SuiFrensApi;
502
+ // =========================================================================
503
+ // Constants
504
+ // =========================================================================
505
+ SuiFrensApi.constants = {
506
+ suiFren: {
507
+ modules: {
508
+ suiFren: {
509
+ moduleName: "suiFren",
510
+ },
511
+ },
512
+ },
513
+ suiFrenVault: {
514
+ modules: {
515
+ interface: {
516
+ moduleName: "interface",
517
+ functions: {
518
+ stakeSuiFren: {
519
+ name: "stake_suiFren",
520
+ },
521
+ unstakeSuiFren: {
522
+ name: "unstake_suiFren",
523
+ },
524
+ withdrawFees: {
525
+ name: "withdraw_fees",
526
+ },
527
+ withdrawFeesAmount: {
528
+ name: "withdraw_fees_amount",
529
+ },
530
+ breedAndKeep: {
531
+ name: "breed_and_keep",
532
+ },
533
+ breedWithStakedAndKeep: {
534
+ name: "breed_with_staked_and_keep",
535
+ },
536
+ breedStakedWithStakedAndKeep: {
537
+ name: "breed_staked_with_staked_and_keep",
538
+ },
539
+ transfer: {
540
+ name: "transfer",
541
+ },
542
+ },
543
+ },
544
+ suiFrenVault: {
545
+ moduleName: "suiFren_vault",
546
+ functions: {
547
+ feesEarnedIndividual: {
548
+ name: "fees_earned_individual",
549
+ },
550
+ feesEarnedGlobal: {
551
+ name: "fees_earned_global",
552
+ },
553
+ },
554
+ },
555
+ },
556
+ },
557
+ eventNames: {
558
+ suiFrenBorn: "SuiFrenBorn",
559
+ breedSuiFren: "BreedSuiFrenEvent",
560
+ stakeSuiFren: "StakeSuiFrenEvent",
561
+ unstakeSuiFren: "UnstakeSuiFrenEvent",
562
+ withdrawFees: "WithdrawFeesEvent",
563
+ },
564
+ };
@@ -0,0 +1,13 @@
1
+ import { SuiObjectResponse } from "@mysten/sui.js";
2
+ import { BreedSuiFrensEvent, SuiFrenBornEvent, SuiFrenObject, SuiFrenVaultObject, StakeSuiFrenEvent, StakedSuiFrenReceiptObject, UnstakeSuiFrenEvent } from "../suiFrensTypes";
3
+ import { BreedSuiFrenEventOnChain as BreedSuiFrensEventOnChain, SuiFrenBornEventOnChain, StakeSuiFrenEventOnChain, UnstakeSuiFrenEventOnChain } from "./suiFrensApiCastingTypes";
4
+ export declare class SuiFrensApiCasting {
5
+ static suiFrenObjectFromSuiObjectResponse: (data: SuiObjectResponse) => SuiFrenObject;
6
+ static stakedSuiFrenReceiptObjectFromSuiObjectResponse: (data: SuiObjectResponse) => StakedSuiFrenReceiptObject;
7
+ static suiFrenVaultObjectFromSuiObjectResponse: (data: SuiObjectResponse) => SuiFrenVaultObject;
8
+ static suiFrenBornEventFromOnChain: (eventOnChain: SuiFrenBornEventOnChain) => SuiFrenBornEvent;
9
+ static breedSuiFrensEventFromOnChain: (eventOnChain: BreedSuiFrensEventOnChain) => BreedSuiFrensEvent;
10
+ static stakeSuiFrenEventFromOnChain: (eventOnChain: StakeSuiFrenEventOnChain) => StakeSuiFrenEvent;
11
+ static unstakeSuiFrenEventFromOnChain: (eventOnChain: UnstakeSuiFrenEventOnChain) => UnstakeSuiFrenEvent;
12
+ }
13
+ //# sourceMappingURL=suiFrensApiCasting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suiFrensApiCasting.d.ts","sourceRoot":"","sources":["../../../../src/packages/suiFrens/api/suiFrensApiCasting.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,wBAAwB,IAAI,yBAAyB,EACrD,uBAAuB,EAGvB,wBAAwB,EAExB,0BAA0B,EAC1B,MAAM,2BAA2B,CAAC;AAGnC,qBAAa,kBAAkB;IAK9B,OAAc,kCAAkC,SACzC,iBAAiB,KACrB,aAAa,CAgBd;IAEF,OAAc,+CAA+C,SACtD,iBAAiB,KACrB,0BAA0B,CAS3B;IAgBF,OAAc,uCAAuC,SAC9C,iBAAiB,KACrB,kBAAkB,CASnB;IAMF,OAAc,2BAA2B,6CAEtC,gBAAgB,CAWjB;IAEF,OAAc,6BAA6B,+CAExC,kBAAkB,CAenB;IAEF,OAAc,4BAA4B,8CAEvC,iBAAiB,CAWlB;IAEF,OAAc,8BAA8B,gDAEzC,mBAAmB,CASpB;CACF"}