@alphafi/alphafi-sdk 0.0.38 → 0.0.40

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 (343) hide show
  1. package/dist/cjs/adminFunctions.d.ts +6 -0
  2. package/dist/cjs/adminFunctions.d.ts.map +1 -0
  3. package/dist/cjs/adminFunctions.js +60 -0
  4. package/dist/cjs/adminFunctions.js.map +1 -0
  5. package/dist/cjs/common/coins.d.ts.map +1 -1
  6. package/dist/cjs/common/coins.js +13 -2
  7. package/dist/cjs/common/coins.js.map +1 -1
  8. package/dist/cjs/common/constants.d.ts +183 -0
  9. package/dist/cjs/common/constants.d.ts.map +1 -1
  10. package/dist/cjs/common/constants.js +144 -18
  11. package/dist/cjs/common/constants.js.map +1 -1
  12. package/dist/cjs/common/maps.d.ts +2 -2
  13. package/dist/cjs/common/maps.d.ts.map +1 -1
  14. package/dist/cjs/common/maps.js +267 -42
  15. package/dist/cjs/common/maps.js.map +1 -1
  16. package/dist/cjs/common/types.d.ts +168 -6
  17. package/dist/cjs/common/types.d.ts.map +1 -1
  18. package/dist/cjs/common/types.js.map +1 -1
  19. package/dist/cjs/getTVL.d.ts +5 -0
  20. package/dist/cjs/getTVL.d.ts.map +1 -0
  21. package/dist/cjs/getTVL.js +109 -0
  22. package/dist/cjs/getTVL.js.map +1 -0
  23. package/dist/cjs/graphql/getMultiReceipts.d.ts.map +1 -1
  24. package/dist/cjs/graphql/getMultiReceipts.js +16 -57
  25. package/dist/cjs/graphql/getMultiReceipts.js.map +1 -1
  26. package/dist/cjs/index.d.ts +10 -1
  27. package/dist/cjs/index.d.ts.map +1 -1
  28. package/dist/cjs/index.js +21 -2
  29. package/dist/cjs/index.js.map +1 -1
  30. package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.d.ts.map +1 -1
  31. package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.js +2 -3
  32. package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.js.map +1 -1
  33. package/dist/cjs/sui-sdk/functions/fetchUserVaults.js.map +1 -1
  34. package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
  35. package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +5 -11
  36. package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
  37. package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +5 -3
  38. package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
  39. package/dist/cjs/sui-sdk/functions/getReceipts.js +50 -3
  40. package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
  41. package/dist/cjs/transactions/alpha.d.ts +1 -1
  42. package/dist/cjs/transactions/alpha.d.ts.map +1 -1
  43. package/dist/cjs/transactions/alpha.js.map +1 -1
  44. package/dist/cjs/transactions/bluefin.d.ts +12 -0
  45. package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
  46. package/dist/cjs/transactions/bluefin.js +768 -43
  47. package/dist/cjs/transactions/bluefin.js.map +1 -1
  48. package/dist/cjs/transactions/bucket.d.ts +1 -1
  49. package/dist/cjs/transactions/bucket.js.map +1 -1
  50. package/dist/cjs/transactions/cetus.d.ts +1 -1
  51. package/dist/cjs/transactions/cetus.d.ts.map +1 -1
  52. package/dist/cjs/transactions/cetus.js +3 -3
  53. package/dist/cjs/transactions/cetus.js.map +1 -1
  54. package/dist/cjs/transactions/collect_rewards.d.ts.map +1 -1
  55. package/dist/cjs/transactions/collect_rewards.js +23 -2
  56. package/dist/cjs/transactions/collect_rewards.js.map +1 -1
  57. package/dist/cjs/transactions/deposit.d.ts.map +1 -1
  58. package/dist/cjs/transactions/deposit.js +23 -5
  59. package/dist/cjs/transactions/deposit.js.map +1 -1
  60. package/dist/cjs/transactions/navi-looping.d.ts +33 -0
  61. package/dist/cjs/transactions/navi-looping.d.ts.map +1 -0
  62. package/dist/cjs/transactions/navi-looping.js +597 -0
  63. package/dist/cjs/transactions/navi-looping.js.map +1 -0
  64. package/dist/cjs/transactions/navi.d.ts +1 -1
  65. package/dist/cjs/transactions/navi.d.ts.map +1 -1
  66. package/dist/cjs/transactions/navi.js +128 -0
  67. package/dist/cjs/transactions/navi.js.map +1 -1
  68. package/dist/cjs/transactions/withdraw.d.ts.map +1 -1
  69. package/dist/cjs/transactions/withdraw.js +20 -2
  70. package/dist/cjs/transactions/withdraw.js.map +1 -1
  71. package/dist/esm/adminFunctions.d.ts +6 -0
  72. package/dist/esm/adminFunctions.d.ts.map +1 -0
  73. package/dist/esm/adminFunctions.js +53 -0
  74. package/dist/esm/adminFunctions.js.map +1 -0
  75. package/dist/esm/common/coins.d.ts.map +1 -1
  76. package/dist/esm/common/coins.js +13 -2
  77. package/dist/esm/common/coins.js.map +1 -1
  78. package/dist/esm/common/constants.d.ts +183 -0
  79. package/dist/esm/common/constants.d.ts.map +1 -1
  80. package/dist/esm/common/constants.js +144 -18
  81. package/dist/esm/common/constants.js.map +1 -1
  82. package/dist/esm/common/maps.d.ts +2 -2
  83. package/dist/esm/common/maps.d.ts.map +1 -1
  84. package/dist/esm/common/maps.js +267 -42
  85. package/dist/esm/common/maps.js.map +1 -1
  86. package/dist/esm/common/types.d.ts +168 -6
  87. package/dist/esm/common/types.d.ts.map +1 -1
  88. package/dist/esm/common/types.js.map +1 -1
  89. package/dist/esm/getTVL.d.ts +5 -0
  90. package/dist/esm/getTVL.d.ts.map +1 -0
  91. package/dist/esm/getTVL.js +103 -0
  92. package/dist/esm/getTVL.js.map +1 -0
  93. package/dist/esm/graphql/getMultiReceipts.d.ts.map +1 -1
  94. package/dist/esm/graphql/getMultiReceipts.js +16 -57
  95. package/dist/esm/graphql/getMultiReceipts.js.map +1 -1
  96. package/dist/esm/index.d.ts +10 -1
  97. package/dist/esm/index.d.ts.map +1 -1
  98. package/dist/esm/index.js +12 -1
  99. package/dist/esm/index.js.map +1 -1
  100. package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.d.ts.map +1 -1
  101. package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.js +2 -3
  102. package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.js.map +1 -1
  103. package/dist/esm/sui-sdk/functions/fetchUserVaults.js.map +1 -1
  104. package/dist/esm/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
  105. package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +5 -11
  106. package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
  107. package/dist/esm/sui-sdk/functions/getReceipts.d.ts +5 -3
  108. package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
  109. package/dist/esm/sui-sdk/functions/getReceipts.js +50 -4
  110. package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
  111. package/dist/esm/transactions/alpha.d.ts +1 -1
  112. package/dist/esm/transactions/alpha.d.ts.map +1 -1
  113. package/dist/esm/transactions/alpha.js.map +1 -1
  114. package/dist/esm/transactions/bluefin.d.ts +12 -0
  115. package/dist/esm/transactions/bluefin.d.ts.map +1 -1
  116. package/dist/esm/transactions/bluefin.js +763 -42
  117. package/dist/esm/transactions/bluefin.js.map +1 -1
  118. package/dist/esm/transactions/bucket.d.ts +1 -1
  119. package/dist/esm/transactions/bucket.js.map +1 -1
  120. package/dist/esm/transactions/cetus.d.ts +1 -1
  121. package/dist/esm/transactions/cetus.d.ts.map +1 -1
  122. package/dist/esm/transactions/cetus.js +3 -3
  123. package/dist/esm/transactions/cetus.js.map +1 -1
  124. package/dist/esm/transactions/collect_rewards.d.ts.map +1 -1
  125. package/dist/esm/transactions/collect_rewards.js +23 -2
  126. package/dist/esm/transactions/collect_rewards.js.map +1 -1
  127. package/dist/esm/transactions/deposit.d.ts.map +1 -1
  128. package/dist/esm/transactions/deposit.js +24 -6
  129. package/dist/esm/transactions/deposit.js.map +1 -1
  130. package/dist/esm/transactions/navi-looping.d.ts +33 -0
  131. package/dist/esm/transactions/navi-looping.d.ts.map +1 -0
  132. package/dist/esm/transactions/navi-looping.js +585 -0
  133. package/dist/esm/transactions/navi-looping.js.map +1 -0
  134. package/dist/esm/transactions/navi.d.ts +1 -1
  135. package/dist/esm/transactions/navi.d.ts.map +1 -1
  136. package/dist/esm/transactions/navi.js +128 -0
  137. package/dist/esm/transactions/navi.js.map +1 -1
  138. package/dist/esm/transactions/withdraw.d.ts.map +1 -1
  139. package/dist/esm/transactions/withdraw.js +21 -3
  140. package/dist/esm/transactions/withdraw.js.map +1 -1
  141. package/docs/assets/highlight.css +101 -0
  142. package/docs/assets/icons.js +21 -0
  143. package/docs/assets/icons.svg +1 -0
  144. package/docs/assets/main.js +2218 -0
  145. package/docs/assets/navigation.js +2 -0
  146. package/docs/assets/search.js +2 -0
  147. package/docs/assets/style.css +1489 -0
  148. package/docs/functions/alphaLpBreakdown.html +253 -0
  149. package/docs/functions/bucketDepositTx.html +267 -0
  150. package/docs/functions/bucketWithdrawTx.html +267 -0
  151. package/docs/functions/cetusLpBreakdown.html +253 -0
  152. package/docs/functions/claimRewardTxb.html +243 -0
  153. package/docs/functions/coinAmountToXTokensDoubleAsset.html +267 -0
  154. package/docs/functions/coinAmountToXTokensSingleAsset.html +260 -0
  155. package/docs/functions/coinsInPool.html +438 -0
  156. package/docs/functions/collectRewards.html +242 -0
  157. package/docs/functions/deposit.html +246 -0
  158. package/docs/functions/depositAlphaTxb.html +250 -0
  159. package/docs/functions/depositBluefinSuiFirstTxb.html +302 -0
  160. package/docs/functions/depositBluefinType1Txb.html +300 -0
  161. package/docs/functions/depositBluefinType2Txb.html +300 -0
  162. package/docs/functions/depositCetusAlphaSuiTxb.html +300 -0
  163. package/docs/functions/depositCetusSuiTxb.html +298 -0
  164. package/docs/functions/depositCetusTxb.html +298 -0
  165. package/docs/functions/depositDoubleAssetTxb.html +270 -0
  166. package/docs/functions/depositSingleAssetTxb.html +263 -0
  167. package/docs/functions/fetchAfterTransactionEvents.html +306 -0
  168. package/docs/functions/fetchAutoCompoundingEvents.html +257 -0
  169. package/docs/functions/fetchAutoCompoundingEventsGql.html +251 -0
  170. package/docs/functions/fetchCetusPools.html +231 -0
  171. package/docs/functions/fetchChainIdentifier.html +233 -0
  172. package/docs/functions/fetchCheckRatioEvents.html +249 -0
  173. package/docs/functions/fetchLiquidityChangeEvents.html +257 -0
  174. package/docs/functions/fetchMultiReceipts.html +261 -0
  175. package/docs/functions/fetchNftHolders.html +233 -0
  176. package/docs/functions/fetchPools.html +230 -0
  177. package/docs/functions/fetchPortfolioData.html +243 -0
  178. package/docs/functions/fetchProtocolData.html +231 -0
  179. package/docs/functions/fetchTVL.html +253 -0
  180. package/docs/functions/fetchUserVaultBalances.html +245 -0
  181. package/docs/functions/fetchUserVaults.html +243 -0
  182. package/docs/functions/fetchUserWalletData.html +243 -0
  183. package/docs/functions/fetchWithdrawV2Events.html +255 -0
  184. package/docs/functions/getAirdropShare.html +243 -0
  185. package/docs/functions/getAllDoubleAssetVaults.html +235 -0
  186. package/docs/functions/getAllSingleAssetVaults.html +235 -0
  187. package/docs/functions/getAllVaultBalances.html +265 -0
  188. package/docs/functions/getAllVaults.html +233 -0
  189. package/docs/functions/getAlphaUnlocks.html +245 -0
  190. package/docs/functions/getAlphaVaultBalance.html +255 -0
  191. package/docs/functions/getAmounts.html +272 -0
  192. package/docs/functions/getApr.html +243 -0
  193. package/docs/functions/getAprs.html +255 -0
  194. package/docs/functions/getApy.html +243 -0
  195. package/docs/functions/getApys.html +255 -0
  196. package/docs/functions/getCetusInvestorTicksMap.html +284 -0
  197. package/docs/functions/getCetusSqrtPriceMap.html +249 -0
  198. package/docs/functions/getCoinAmountsFromLiquidity.html +266 -0
  199. package/docs/functions/getConf.html +9882 -0
  200. package/docs/functions/getCurrentTick.html +247 -0
  201. package/docs/functions/getDoubleAssetVaultBalance.html +268 -0
  202. package/docs/functions/getDoubleAssetVaults.html +253 -0
  203. package/docs/functions/getHoldersFromTransactions.html +299 -0
  204. package/docs/functions/getInvestor.html +259 -0
  205. package/docs/functions/getInvestorPoolMap.html +241 -0
  206. package/docs/functions/getLastAutoCompoundTime.html +249 -0
  207. package/docs/functions/getLiquidity.html +260 -0
  208. package/docs/functions/getParentPool.html +256 -0
  209. package/docs/functions/getPool.html +262 -0
  210. package/docs/functions/getPoolExchangeRateMap.html +249 -0
  211. package/docs/functions/getPositionTicks.html +249 -0
  212. package/docs/functions/getPriceToTick.html +254 -0
  213. package/docs/functions/getRebalanceHistories.html +269 -0
  214. package/docs/functions/getRebalanceHistory.html +255 -0
  215. package/docs/functions/getReceipts.html +268 -0
  216. package/docs/functions/getSingleAssetVaultBalance.html +268 -0
  217. package/docs/functions/getSingleAssetVaults.html +253 -0
  218. package/docs/functions/getSuiClient.html +247 -0
  219. package/docs/functions/getSuiNodeUrl.html +232 -0
  220. package/docs/functions/getTVLs.html +243 -0
  221. package/docs/functions/getTickToPrice.html +254 -0
  222. package/docs/functions/getUserTokensFromTransactions.html +269 -0
  223. package/docs/functions/getUserTokensInUsdFromTransactions.html +263 -0
  224. package/docs/functions/getVaultBalance.html +277 -0
  225. package/docs/functions/getVaultBalanceForActiveUsers.html +261 -0
  226. package/docs/functions/getVaults.html +250 -0
  227. package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +261 -0
  228. package/docs/functions/lastAutocompoundTime.html +249 -0
  229. package/docs/functions/liquidityToTokens.html +253 -0
  230. package/docs/functions/loopingDeposit.html +277 -0
  231. package/docs/functions/loopingWithdraw.html +278 -0
  232. package/docs/functions/multiLiquidityToTokens.html +271 -0
  233. package/docs/functions/multiTokensToUsd.html +262 -0
  234. package/docs/functions/multiXTokensToLiquidity.html +257 -0
  235. package/docs/functions/naviDepositTx.html +278 -0
  236. package/docs/functions/naviHasuiSuiLoopDepositTx.html +271 -0
  237. package/docs/functions/naviHasuiSuiLoopWithdrawTx.html +271 -0
  238. package/docs/functions/naviSuiVsuiLoopDepositTx.html +271 -0
  239. package/docs/functions/naviSuiVsuiLoopWithdrawTx.html +271 -0
  240. package/docs/functions/naviUsdcUsdtLoopDepositTx.html +271 -0
  241. package/docs/functions/naviUsdcUsdtLoopWithdrawTx.html +271 -0
  242. package/docs/functions/naviUsdtUsdcLoopDepositTx.html +271 -0
  243. package/docs/functions/naviUsdtUsdcLoopWithdrawTx.html +271 -0
  244. package/docs/functions/naviWithdrawTx.html +278 -0
  245. package/docs/functions/parseUserWalletData.html +243 -0
  246. package/docs/functions/setSuiClient.html +255 -0
  247. package/docs/functions/setSuiNodeUrl.html +249 -0
  248. package/docs/functions/withdraw.html +249 -0
  249. package/docs/functions/withdrawAlphaTxb.html +257 -0
  250. package/docs/functions/withdrawBluefinSuiFirstTxb.html +282 -0
  251. package/docs/functions/withdrawBluefinType1Txb.html +280 -0
  252. package/docs/functions/withdrawBluefinType2Txb.html +280 -0
  253. package/docs/functions/withdrawCetusAlphaSuiTxb.html +282 -0
  254. package/docs/functions/withdrawCetusSuiTxb.html +278 -0
  255. package/docs/functions/withdrawCetusTxb.html +278 -0
  256. package/docs/functions/withdrawTxb.html +260 -0
  257. package/docs/index.html +622 -0
  258. package/docs/interfaces/Coin.html +474 -0
  259. package/docs/interfaces/CoinPair.html +358 -0
  260. package/docs/interfaces/NaviVoloData.html +514 -0
  261. package/docs/interfaces/RebalanceHistoryType.html +652 -0
  262. package/docs/modules.html +1440 -0
  263. package/docs/types/AfterTransactionEventNode.html +305 -0
  264. package/docs/types/Allocator.html +321 -0
  265. package/docs/types/AlphaFiDoubleAssetVault.html +258 -0
  266. package/docs/types/AlphaFiMultiVaultBalance.html +219 -0
  267. package/docs/types/AlphaFiSingleAssetVault.html +244 -0
  268. package/docs/types/AlphaFiVault.html +214 -0
  269. package/docs/types/AlphaFiVaultBalance.html +220 -0
  270. package/docs/types/AlphaPoolType.html +383 -0
  271. package/docs/types/AlphaReceipt.html +220 -0
  272. package/docs/types/AlphaReceiptFields.html +421 -0
  273. package/docs/types/AlphaVaultBalance.html +245 -0
  274. package/docs/types/AutoCompoundingEventNode.html +225 -0
  275. package/docs/types/BluefinInvestor.html +209 -0
  276. package/docs/types/BluefinPoolType.html +209 -0
  277. package/docs/types/BucketInvestor.html +249 -0
  278. package/docs/types/CetusInvestor.html +240 -0
  279. package/docs/types/CetusPoolType.html +433 -0
  280. package/docs/types/CetusSwapOptions.html +209 -0
  281. package/docs/types/CoinAmounts.html +216 -0
  282. package/docs/types/CoinName.html +281 -0
  283. package/docs/types/CoinType.html +282 -0
  284. package/docs/types/CommonInvestorFields.html +276 -0
  285. package/docs/types/CreatePoolOptions.html +246 -0
  286. package/docs/types/Distributor.html +341 -0
  287. package/docs/types/DoubleAssetMultiVaultBalance.html +236 -0
  288. package/docs/types/DoubleAssetPoolNames.html +267 -0
  289. package/docs/types/DoubleAssetTokenHoldings.html +232 -0
  290. package/docs/types/DoubleAssetVaultBalance.html +229 -0
  291. package/docs/types/GetHoldersParams.html +221 -0
  292. package/docs/types/GetTokenHoldingsParams.html +227 -0
  293. package/docs/types/GetUserTokensFromTransactionsParams.html +233 -0
  294. package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +244 -0
  295. package/docs/types/GetVaultBalanceForActiveUsersParams.html +231 -0
  296. package/docs/types/GetVaultBalanceParams.html +217 -0
  297. package/docs/types/HoldingsObj.html +223 -0
  298. package/docs/types/Icon.html +266 -0
  299. package/docs/types/Investor.html +245 -0
  300. package/docs/types/LiquidityChangeEventNode.html +220 -0
  301. package/docs/types/LiquidityToTokensParams.html +255 -0
  302. package/docs/types/LiquidityToUsdParams.html +267 -0
  303. package/docs/types/LoopingDebt.html +258 -0
  304. package/docs/types/LpBreakdownType.html +238 -0
  305. package/docs/types/MemberPoolDataType.html +276 -0
  306. package/docs/types/MemberType.html +269 -0
  307. package/docs/types/MultiGetVaultBalancesParams.html +229 -0
  308. package/docs/types/NaviInvestor.html +235 -0
  309. package/docs/types/OtherReceiptFields.html +373 -0
  310. package/docs/types/PoolName.html +304 -0
  311. package/docs/types/PoolReceipt.html +253 -0
  312. package/docs/types/PoolType.html +388 -0
  313. package/docs/types/Receipt.html +475 -0
  314. package/docs/types/ReceiptGQL.html +374 -0
  315. package/docs/types/SingleAssetMultiVaultBalance.html +232 -0
  316. package/docs/types/SingleAssetPoolNames.html +247 -0
  317. package/docs/types/SingleAssetTokenHoldings.html +228 -0
  318. package/docs/types/SingleAssetVaultBalance.html +223 -0
  319. package/docs/types/SingleGetVaultBalancesParams.html +224 -0
  320. package/docs/types/StrategyType.html +217 -0
  321. package/docs/types/SuiNetwork.html +213 -0
  322. package/docs/types/SwapOptions.html +248 -0
  323. package/docs/types/TickSpacing.html +212 -0
  324. package/docs/types/TotalWeightType.html +246 -0
  325. package/docs/types/TransactionBlockType.html +358 -0
  326. package/docs/types/UserPoolLiquidity.html +221 -0
  327. package/docs/types/UserPoolTokenHoldings.html +217 -0
  328. package/docs/types/UserUsdHoldings.html +223 -0
  329. package/docs/types/VaultBalance.html +216 -0
  330. package/docs/types/WithdrawV2EventNode.html +208 -0
  331. package/docs/variables/bluefinPoolMap.html +214 -0
  332. package/docs/variables/cetusPoolMap.html +214 -0
  333. package/docs/variables/coinsList.html +220 -0
  334. package/docs/variables/defunctPoolsSet.html +209 -0
  335. package/docs/variables/doubleAssetPoolCoinMap.html +237 -0
  336. package/docs/variables/loopingAccountAddresses.html +219 -0
  337. package/docs/variables/loopingPoolCoinMap.html +233 -0
  338. package/docs/variables/naviAssetMap.html +215 -0
  339. package/docs/variables/poolIdPoolNameMap.html +218 -0
  340. package/docs/variables/poolInfo.html +304 -0
  341. package/docs/variables/singleAssetPoolCoinMap.html +229 -0
  342. package/docs/variables/stableCoins.html +207 -0
  343. package/package.json +1 -1
@@ -0,0 +1,585 @@
1
+ import { Transaction } from "@mysten/sui/transactions";
2
+ import { getConf } from "../common/constants.js";
3
+ import { getSuiClient } from "../sui-sdk/client.js";
4
+ import { cetusPoolMap, poolInfo, singleAssetPoolCoinMap, } from "../common/maps.js";
5
+ import { coinsList } from "../common/coins.js";
6
+ import { getReceipts } from "../sui-sdk/functions/getReceipts.js";
7
+ export async function loopingDeposit(poolName, amount, options) {
8
+ let txb = new Transaction();
9
+ if (poolName === "NAVI-LOOP-HASUI-SUI") {
10
+ txb = await naviHasuiSuiLoopDepositTx(amount, options);
11
+ }
12
+ else if (poolName === "NAVI-LOOP-SUI-VSUI") {
13
+ txb = await naviSuiVsuiLoopDepositTx(amount, options);
14
+ }
15
+ else if (poolName === "NAVI-LOOP-USDC-USDT") {
16
+ txb = await naviUsdcUsdtLoopDepositTx(amount, options);
17
+ }
18
+ else if (poolName === "NAVI-LOOP-USDT-USDC") {
19
+ txb = await naviUsdtUsdcLoopDepositTx(amount, options);
20
+ }
21
+ return txb;
22
+ }
23
+ export async function loopingWithdraw(poolName, xTokens, options) {
24
+ let txb = new Transaction();
25
+ if (poolName === "NAVI-LOOP-HASUI-SUI") {
26
+ txb = await naviHasuiSuiLoopWithdrawTx(xTokens, options);
27
+ }
28
+ else if (poolName === "NAVI-LOOP-SUI-VSUI") {
29
+ txb = await naviSuiVsuiLoopWithdrawTx(xTokens, options);
30
+ }
31
+ else if (poolName === "NAVI-LOOP-USDC-USDT") {
32
+ txb = await naviUsdcUsdtLoopWithdrawTx(xTokens, options);
33
+ }
34
+ else if (poolName === "NAVI-LOOP-USDT-USDC") {
35
+ txb = await naviUsdtUsdcLoopWithdrawTx(xTokens, options);
36
+ }
37
+ return txb;
38
+ }
39
+ export async function naviHasuiSuiLoopDepositTx(amount, options) {
40
+ const C = await getConf();
41
+ const suiClient = getSuiClient();
42
+ const address = options.address;
43
+ const txb = new Transaction();
44
+ const poolData = poolInfo["NAVI-LOOP-HASUI-SUI"];
45
+ const receipt = await getReceipts("NAVI-LOOP-HASUI-SUI", address, true);
46
+ let coins = [];
47
+ let currentCursor = null;
48
+ do {
49
+ const response = await suiClient.getCoins({
50
+ owner: address,
51
+ coinType: coinsList[singleAssetPoolCoinMap["NAVI-LOOP-HASUI-SUI"].coin].type,
52
+ cursor: currentCursor,
53
+ });
54
+ coins = coins.concat(response.data);
55
+ // Check if there's a next page
56
+ if (response.hasNextPage && response.nextCursor) {
57
+ currentCursor = response.nextCursor;
58
+ }
59
+ else {
60
+ // No more pages available
61
+ // console.log("No more receipts available.");
62
+ break;
63
+ }
64
+ } while (true);
65
+ if (coins.length >= 1) {
66
+ const [coin] = txb.splitCoins(txb.object(coins[0].coinObjectId), [0]);
67
+ txb.mergeCoins(coin, coins.map((c) => c.coinObjectId));
68
+ const [depositCoin] = txb.splitCoins(coin, [amount]);
69
+ let someReceipt;
70
+ if (receipt.length == 0) {
71
+ [someReceipt] = txb.moveCall({
72
+ target: `0x1::option::none`,
73
+ typeArguments: [poolData.receiptType],
74
+ arguments: [],
75
+ });
76
+ }
77
+ else {
78
+ [someReceipt] = txb.moveCall({
79
+ target: `0x1::option::some`,
80
+ typeArguments: [receipt[0].content.type],
81
+ arguments: [txb.object(receipt[0].objectId)],
82
+ });
83
+ }
84
+ txb.moveCall({
85
+ target: `${poolData.packageId}::alphafi_navi_hasui_sui_pool::user_deposit`, // change package id for testing
86
+ typeArguments: [C.NAVX_COIN_TYPE],
87
+ arguments: [
88
+ txb.object(C.ALPHA_2_VERSION), // change version object id for testing
89
+ txb.object(C.VERSION),
90
+ someReceipt,
91
+ txb.object(poolData.poolId),
92
+ depositCoin,
93
+ txb.object(poolData.investorId),
94
+ txb.object(C.ALPHA_DISTRIBUTOR),
95
+ txb.object(C.PRICE_ORACLE),
96
+ txb.object(C.NAVI_STORAGE),
97
+ txb.object(C.NAVI_HASUI_POOL),
98
+ txb.object(C.NAVI_SUI_POOL),
99
+ txb.object(C.NAVI_INCENTIVE_V1),
100
+ txb.object(C.NAVI_INCENTIVE_V2),
101
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
102
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
103
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
104
+ txb.object(cetusPoolMap["NAVX-SUI"]),
105
+ txb.object(cetusPoolMap["VSUI-SUI"]),
106
+ txb.object(cetusPoolMap["HASUI-SUI"]),
107
+ txb.object(C.HAEDEL_STAKING),
108
+ txb.object(C.SUI_SYSTEM_STATE),
109
+ txb.object(C.CLOCK_PACKAGE_ID),
110
+ ],
111
+ });
112
+ txb.transferObjects([coin], address);
113
+ }
114
+ else {
115
+ throw new Error("No coin");
116
+ }
117
+ return txb;
118
+ }
119
+ export async function naviSuiVsuiLoopDepositTx(amount, options) {
120
+ const C = await getConf();
121
+ const address = options.address;
122
+ const txb = new Transaction();
123
+ const poolData = poolInfo["NAVI-LOOP-SUI-VSUI"];
124
+ const receipt = await getReceipts("NAVI-LOOP-SUI-VSUI", address, true);
125
+ let someReceipt;
126
+ if (receipt.length == 0) {
127
+ [someReceipt] = txb.moveCall({
128
+ target: `0x1::option::none`,
129
+ typeArguments: [poolData.receiptType],
130
+ arguments: [],
131
+ });
132
+ }
133
+ else {
134
+ [someReceipt] = txb.moveCall({
135
+ target: `0x1::option::some`,
136
+ typeArguments: [receipt[0].content.type],
137
+ arguments: [txb.object(receipt[0].objectId)],
138
+ });
139
+ }
140
+ const [depositCoin] = txb.splitCoins(txb.gas, [amount]);
141
+ txb.moveCall({
142
+ target: `${poolData.packageId}::alphafi_navi_sui_vsui_pool::user_deposit`,
143
+ typeArguments: [coinsList["NAVX"].type],
144
+ arguments: [
145
+ txb.object(C.ALPHA_2_VERSION),
146
+ txb.object(C.VERSION),
147
+ someReceipt,
148
+ txb.object(poolData.poolId),
149
+ depositCoin,
150
+ txb.object(poolData.investorId),
151
+ txb.object(C.ALPHA_DISTRIBUTOR),
152
+ txb.object(C.PRICE_ORACLE),
153
+ txb.object(C.NAVI_STORAGE),
154
+ txb.object(C.NAVI_VSUI_POOL),
155
+ txb.object(C.NAVI_SUI_POOL),
156
+ txb.object(C.NAVI_INCENTIVE_V1),
157
+ txb.object(C.NAVI_INCENTIVE_V2),
158
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
159
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
160
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
161
+ txb.object(cetusPoolMap["NAVX-SUI"]),
162
+ txb.object(cetusPoolMap["VSUI-SUI"]),
163
+ txb.object(C.VOLO_NATIVE_POOL),
164
+ txb.object(C.VOLO_METADATA),
165
+ txb.object(C.SUI_SYSTEM_STATE),
166
+ txb.object(C.KRIYA_VSUI_SUI_POOL),
167
+ txb.object(C.KRIYA_VERSION),
168
+ txb.object(C.CLOCK_PACKAGE_ID),
169
+ ],
170
+ });
171
+ return txb;
172
+ }
173
+ export async function naviUsdcUsdtLoopDepositTx(amount, options) {
174
+ const C = await getConf();
175
+ const suiClient = getSuiClient();
176
+ const address = options.address;
177
+ const txb = new Transaction();
178
+ const poolData = poolInfo["NAVI-LOOP-USDC-USDT"];
179
+ const receipt = await getReceipts("NAVI-LOOP-USDC-USDT", address, true);
180
+ let coins = [];
181
+ let currentCursor = null;
182
+ do {
183
+ const response = await suiClient.getCoins({
184
+ owner: address,
185
+ coinType: coinsList[singleAssetPoolCoinMap["NAVI-LOOP-USDC-USDT"].coin].type,
186
+ cursor: currentCursor,
187
+ });
188
+ coins = coins.concat(response.data);
189
+ // Check if there's a next page
190
+ if (response.hasNextPage && response.nextCursor) {
191
+ currentCursor = response.nextCursor;
192
+ }
193
+ else {
194
+ // No more pages available
195
+ // console.log("No more receipts available.");
196
+ break;
197
+ }
198
+ } while (true);
199
+ if (coins.length >= 1) {
200
+ const [coin] = txb.splitCoins(txb.object(coins[0].coinObjectId), [0]);
201
+ txb.mergeCoins(coin, coins.map((c) => c.coinObjectId));
202
+ const [depositCoin] = txb.splitCoins(coin, [amount]);
203
+ let someReceipt;
204
+ if (receipt.length == 0) {
205
+ [someReceipt] = txb.moveCall({
206
+ target: `0x1::option::none`,
207
+ typeArguments: [poolData.receiptType],
208
+ arguments: [],
209
+ });
210
+ }
211
+ else {
212
+ [someReceipt] = txb.moveCall({
213
+ target: `0x1::option::some`,
214
+ typeArguments: [receipt[0].content.type],
215
+ arguments: [txb.object(receipt[0].objectId)],
216
+ });
217
+ }
218
+ txb.moveCall({
219
+ target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::user_deposit`,
220
+ arguments: [
221
+ txb.object(C.ALPHA_2_VERSION),
222
+ txb.object(C.VERSION),
223
+ someReceipt,
224
+ txb.object(poolData.poolId),
225
+ depositCoin,
226
+ txb.object(poolData.investorId),
227
+ txb.object(C.ALPHA_DISTRIBUTOR),
228
+ txb.object(C.PRICE_ORACLE),
229
+ txb.object(C.NAVI_STORAGE),
230
+ txb.object(C.NAVI_USDC_POOL),
231
+ txb.object(C.NAVI_USDT_POOL),
232
+ txb.object(C.NAVI_INCENTIVE_V1),
233
+ txb.object(C.NAVI_INCENTIVE_V2),
234
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
235
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
236
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
237
+ txb.object(cetusPoolMap["VSUI-SUI"]),
238
+ txb.object(cetusPoolMap["NAVX-SUI"]),
239
+ txb.object(cetusPoolMap["USDC-SUI"]),
240
+ txb.object(cetusPoolMap["USDC-USDT"]),
241
+ txb.object(C.CLOCK_PACKAGE_ID),
242
+ ],
243
+ });
244
+ txb.transferObjects([coin], address);
245
+ }
246
+ else {
247
+ throw new Error("No coin");
248
+ }
249
+ return txb;
250
+ }
251
+ export async function naviUsdtUsdcLoopDepositTx(amount, options) {
252
+ const C = await getConf();
253
+ const suiClient = getSuiClient();
254
+ const address = options.address;
255
+ const txb = new Transaction();
256
+ const poolData = poolInfo["NAVI-LOOP-USDT-USDC"];
257
+ const receipt = await getReceipts("NAVI-LOOP-USDT-USDC", address, true);
258
+ let coins = [];
259
+ let currentCursor = null;
260
+ do {
261
+ const response = await suiClient.getCoins({
262
+ owner: address,
263
+ coinType: coinsList[singleAssetPoolCoinMap["NAVI-LOOP-USDT-USDC"].coin].type,
264
+ cursor: currentCursor,
265
+ });
266
+ coins = coins.concat(response.data);
267
+ // Check if there's a next page
268
+ if (response.hasNextPage && response.nextCursor) {
269
+ currentCursor = response.nextCursor;
270
+ }
271
+ else {
272
+ // No more pages available
273
+ // console.log("No more receipts available.");
274
+ break;
275
+ }
276
+ } while (true);
277
+ if (coins.length >= 1) {
278
+ const [coin] = txb.splitCoins(txb.object(coins[0].coinObjectId), [0]);
279
+ txb.mergeCoins(coin, coins.map((c) => c.coinObjectId));
280
+ const [depositCoin] = txb.splitCoins(coin, [amount]);
281
+ let someReceipt;
282
+ if (receipt.length == 0) {
283
+ [someReceipt] = txb.moveCall({
284
+ target: `0x1::option::none`,
285
+ typeArguments: [poolData.receiptType],
286
+ arguments: [],
287
+ });
288
+ }
289
+ else {
290
+ [someReceipt] = txb.moveCall({
291
+ target: `0x1::option::some`,
292
+ typeArguments: [receipt[0].content.type],
293
+ arguments: [txb.object(receipt[0].objectId)],
294
+ });
295
+ }
296
+ txb.moveCall({
297
+ target: `${poolData.packageId}::alphafi_navi_usdt_usdc_pool::user_deposit`,
298
+ typeArguments: [coinsList["NAVX"].type],
299
+ arguments: [
300
+ txb.object(C.ALPHA_5_VERSION),
301
+ txb.object(C.VERSION),
302
+ someReceipt,
303
+ txb.object(poolData.poolId),
304
+ depositCoin,
305
+ txb.object(poolData.investorId),
306
+ txb.object(C.ALPHA_DISTRIBUTOR),
307
+ txb.object(C.PRICE_ORACLE),
308
+ txb.object(C.NAVI_STORAGE),
309
+ txb.object(C.NAVI_USDT_POOL),
310
+ txb.object(C.NAVI_USDC_POOL),
311
+ txb.object(C.NAVI_INCENTIVE_V1),
312
+ txb.object(C.NAVI_INCENTIVE_V2),
313
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
314
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
315
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
316
+ txb.object(cetusPoolMap["VSUI-SUI"]),
317
+ txb.object(cetusPoolMap["USDC-USDT"]),
318
+ txb.object(cetusPoolMap["USDC-SUI"]),
319
+ txb.object(cetusPoolMap["NAVX-SUI"]),
320
+ txb.object(C.CLOCK_PACKAGE_ID),
321
+ ],
322
+ });
323
+ txb.transferObjects([coin], address);
324
+ }
325
+ else {
326
+ throw new Error("No coin");
327
+ }
328
+ return txb;
329
+ }
330
+ export async function naviHasuiSuiLoopWithdrawTx(xTokens, options) {
331
+ const C = await getConf();
332
+ const address = options.address;
333
+ const txb = new Transaction();
334
+ const poolData = poolInfo["NAVI-LOOP-HASUI-SUI"];
335
+ const receipt = await getReceipts("NAVI-LOOP-HASUI-SUI", address, true);
336
+ const alphaReceipt = await getReceipts("ALPHA", address, true);
337
+ if (receipt.length > 0) {
338
+ let alpha_receipt;
339
+ if (alphaReceipt.length == 0) {
340
+ [alpha_receipt] = txb.moveCall({
341
+ target: `0x1::option::none`,
342
+ typeArguments: [C.ALPHA_POOL_RECEIPT],
343
+ arguments: [],
344
+ });
345
+ }
346
+ else {
347
+ [alpha_receipt] = txb.moveCall({
348
+ target: `0x1::option::some`,
349
+ typeArguments: [alphaReceipt[0].content.type],
350
+ arguments: [txb.object(alphaReceipt[0].objectId)],
351
+ });
352
+ }
353
+ const [hasuiCoin] = txb.moveCall({
354
+ target: `${poolData.packageId}::alphafi_navi_hasui_sui_pool::user_withdraw`, // change package id for testing
355
+ typeArguments: [C.NAVX_COIN_TYPE],
356
+ arguments: [
357
+ txb.object(C.ALPHA_2_VERSION), // change version object id for testing
358
+ txb.object(C.VERSION),
359
+ txb.object(receipt[0].objectId),
360
+ alpha_receipt,
361
+ txb.object(C.ALPHA_POOL),
362
+ txb.object(poolData.poolId),
363
+ txb.pure.u64(xTokens),
364
+ txb.object(poolData.investorId),
365
+ txb.object(C.ALPHA_DISTRIBUTOR),
366
+ txb.object(C.PRICE_ORACLE),
367
+ txb.object(C.NAVI_STORAGE),
368
+ txb.object(C.NAVI_HASUI_POOL),
369
+ txb.object(C.NAVI_SUI_POOL),
370
+ txb.object(C.NAVI_INCENTIVE_V1),
371
+ txb.object(C.NAVI_INCENTIVE_V2),
372
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
373
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
374
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
375
+ txb.object(cetusPoolMap["NAVX-SUI"]),
376
+ txb.object(cetusPoolMap["VSUI-SUI"]),
377
+ txb.object(cetusPoolMap["HASUI-SUI"]),
378
+ txb.object(C.HAEDEL_STAKING),
379
+ txb.object(C.SUI_SYSTEM_STATE),
380
+ txb.object(C.CLOCK_PACKAGE_ID),
381
+ ],
382
+ });
383
+ txb.moveCall({
384
+ target: `0x2::transfer::public_transfer`,
385
+ typeArguments: [`0x2::coin::Coin<${coinsList["HASUI"].type}>`],
386
+ arguments: [hasuiCoin, txb.pure.address(address)],
387
+ });
388
+ }
389
+ else {
390
+ throw new Error(`No ${"NAVI-LOOP-HASUI-SUI"} Receipt`);
391
+ }
392
+ return txb;
393
+ }
394
+ export async function naviSuiVsuiLoopWithdrawTx(xTokens, options) {
395
+ const C = await getConf();
396
+ const address = options.address;
397
+ const txb = new Transaction();
398
+ const poolData = poolInfo["NAVI-LOOP-SUI-VSUI"];
399
+ const receipt = await getReceipts("NAVI-LOOP-SUI-VSUI", address, true);
400
+ const alphaReceipt = await getReceipts("ALPHA", address, true);
401
+ if (receipt.length > 0) {
402
+ let alpha_receipt;
403
+ if (alphaReceipt.length == 0) {
404
+ [alpha_receipt] = txb.moveCall({
405
+ target: `0x1::option::none`,
406
+ typeArguments: [C.ALPHA_POOL_RECEIPT],
407
+ arguments: [],
408
+ });
409
+ }
410
+ else {
411
+ [alpha_receipt] = txb.moveCall({
412
+ target: `0x1::option::some`,
413
+ typeArguments: [alphaReceipt[0].content.type],
414
+ arguments: [txb.object(alphaReceipt[0].objectId)],
415
+ });
416
+ }
417
+ const [vsui_coin] = txb.moveCall({
418
+ target: `${poolData.packageId}::alphafi_navi_sui_vsui_pool::user_withdraw`,
419
+ typeArguments: [coinsList["NAVX"].type],
420
+ arguments: [
421
+ txb.object(C.ALPHA_2_VERSION),
422
+ txb.object(C.VERSION),
423
+ txb.object(receipt[0].objectId),
424
+ alpha_receipt,
425
+ txb.object(C.ALPHA_POOL),
426
+ txb.object(poolData.poolId),
427
+ txb.pure.u64(xTokens),
428
+ txb.object(poolData.investorId),
429
+ txb.object(C.ALPHA_DISTRIBUTOR),
430
+ txb.object(C.PRICE_ORACLE),
431
+ txb.object(C.NAVI_STORAGE),
432
+ txb.object(C.NAVI_VSUI_POOL),
433
+ txb.object(C.NAVI_SUI_POOL),
434
+ txb.object(C.NAVI_INCENTIVE_V1),
435
+ txb.object(C.NAVI_INCENTIVE_V2),
436
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
437
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
438
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
439
+ txb.object(cetusPoolMap["NAVX-SUI"]),
440
+ txb.object(cetusPoolMap["VSUI-SUI"]),
441
+ txb.object(C.VOLO_NATIVE_POOL),
442
+ txb.object(C.VOLO_METADATA),
443
+ txb.object(C.SUI_SYSTEM_STATE),
444
+ txb.object(C.KRIYA_VSUI_SUI_POOL),
445
+ txb.object(C.KRIYA_VERSION),
446
+ txb.object(C.CLOCK_PACKAGE_ID),
447
+ ],
448
+ });
449
+ txb.moveCall({
450
+ target: `0x2::transfer::public_transfer`,
451
+ typeArguments: [`0x2::coin::Coin<${coinsList["VSUI"].type}>`],
452
+ arguments: [vsui_coin, txb.pure.address(address)],
453
+ });
454
+ }
455
+ else {
456
+ throw new Error(`No ${"NAVI-LOOP-SUI-VSUI"} Receipt`);
457
+ }
458
+ return txb;
459
+ }
460
+ export async function naviUsdcUsdtLoopWithdrawTx(xTokens, options) {
461
+ const C = await getConf();
462
+ const address = options.address;
463
+ const txb = new Transaction();
464
+ const poolData = poolInfo["NAVI-LOOP-USDC-USDT"];
465
+ const receipt = await getReceipts("NAVI-LOOP-USDC-USDT", address, true);
466
+ const alphaReceipt = await getReceipts("ALPHA", address, true);
467
+ if (receipt.length > 0) {
468
+ let alpha_receipt;
469
+ if (alphaReceipt.length == 0) {
470
+ [alpha_receipt] = txb.moveCall({
471
+ target: `0x1::option::none`,
472
+ typeArguments: [C.ALPHA_POOL_RECEIPT],
473
+ arguments: [],
474
+ });
475
+ }
476
+ else {
477
+ [alpha_receipt] = txb.moveCall({
478
+ target: `0x1::option::some`,
479
+ typeArguments: [alphaReceipt[0].content.type],
480
+ arguments: [txb.object(alphaReceipt[0].objectId)],
481
+ });
482
+ }
483
+ const [usdcCoin] = txb.moveCall({
484
+ target: `${poolData.packageId}::alphafi_navi_native_usdc_usdt_pool::user_withdraw`,
485
+ arguments: [
486
+ txb.object(C.ALPHA_2_VERSION),
487
+ txb.object(C.VERSION),
488
+ txb.object(receipt[0].objectId),
489
+ alpha_receipt,
490
+ txb.object(C.ALPHA_POOL),
491
+ txb.object(poolData.poolId),
492
+ txb.pure.u256(xTokens),
493
+ txb.object(poolData.investorId),
494
+ txb.object(C.ALPHA_DISTRIBUTOR),
495
+ txb.object(C.PRICE_ORACLE),
496
+ txb.object(C.NAVI_STORAGE),
497
+ txb.object(C.NAVI_USDC_POOL),
498
+ txb.object(C.NAVI_USDT_POOL),
499
+ txb.object(C.NAVI_INCENTIVE_V1),
500
+ txb.object(C.NAVI_INCENTIVE_V2),
501
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
502
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
503
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
504
+ txb.object(cetusPoolMap["VSUI-SUI"]),
505
+ txb.object(cetusPoolMap["NAVX-SUI"]),
506
+ txb.object(cetusPoolMap["USDC-SUI"]),
507
+ txb.object(cetusPoolMap["USDC-USDT"]),
508
+ txb.object(C.CLOCK_PACKAGE_ID),
509
+ ],
510
+ });
511
+ txb.moveCall({
512
+ target: `0x2::transfer::public_transfer`,
513
+ typeArguments: [`0x2::coin::Coin<${coinsList["USDC"].type}>`],
514
+ arguments: [usdcCoin, txb.pure.address(address)],
515
+ });
516
+ }
517
+ else {
518
+ throw new Error(`No ${"NAVI-LOOP-USDC-USDT"} Receipt`);
519
+ }
520
+ return txb;
521
+ }
522
+ export async function naviUsdtUsdcLoopWithdrawTx(xTokens, options) {
523
+ const C = await getConf();
524
+ const address = options.address;
525
+ const txb = new Transaction();
526
+ const poolData = poolInfo["NAVI-LOOP-USDT-USDC"];
527
+ const receipt = await getReceipts("NAVI-LOOP-USDT-USDC", address, true);
528
+ const alphaReceipt = await getReceipts("ALPHA", address, true);
529
+ if (receipt.length > 0) {
530
+ let alpha_receipt;
531
+ if (alphaReceipt.length == 0) {
532
+ [alpha_receipt] = txb.moveCall({
533
+ target: `0x1::option::none`,
534
+ typeArguments: [C.ALPHA_POOL_RECEIPT],
535
+ arguments: [],
536
+ });
537
+ }
538
+ else {
539
+ [alpha_receipt] = txb.moveCall({
540
+ target: `0x1::option::some`,
541
+ typeArguments: [alphaReceipt[0].content.type],
542
+ arguments: [txb.object(alphaReceipt[0].objectId)],
543
+ });
544
+ }
545
+ const [usdtCoin] = txb.moveCall({
546
+ target: `${poolData.packageId}::alphafi_navi_usdt_usdc_pool::user_withdraw`,
547
+ typeArguments: [coinsList["NAVX"].type],
548
+ arguments: [
549
+ txb.object(C.ALPHA_5_VERSION),
550
+ txb.object(C.VERSION),
551
+ txb.object(receipt[0].objectId),
552
+ alpha_receipt,
553
+ txb.object(C.ALPHA_POOL),
554
+ txb.object(poolData.poolId),
555
+ txb.pure.u256(xTokens),
556
+ txb.object(poolData.investorId),
557
+ txb.object(C.ALPHA_DISTRIBUTOR),
558
+ txb.object(C.PRICE_ORACLE),
559
+ txb.object(C.NAVI_STORAGE),
560
+ txb.object(C.NAVI_USDT_POOL),
561
+ txb.object(C.NAVI_USDC_POOL),
562
+ txb.object(C.NAVI_INCENTIVE_V1),
563
+ txb.object(C.NAVI_INCENTIVE_V2),
564
+ txb.object(C.NAVI_VSUI_FUNDS_POOL),
565
+ txb.object(C.NAVI_NAVX_FUNDS_POOL),
566
+ txb.object(C.CETUS_GLOBAL_CONFIG_ID),
567
+ txb.object(cetusPoolMap["VSUI-SUI"]),
568
+ txb.object(cetusPoolMap["USDC-USDT"]),
569
+ txb.object(cetusPoolMap["USDC-SUI"]),
570
+ txb.object(cetusPoolMap["NAVX-SUI"]),
571
+ txb.object(C.CLOCK_PACKAGE_ID),
572
+ ],
573
+ });
574
+ txb.moveCall({
575
+ target: `0x2::transfer::public_transfer`,
576
+ typeArguments: [`0x2::coin::Coin<${coinsList["USDT"].type}>`],
577
+ arguments: [usdtCoin, txb.pure.address(address)],
578
+ });
579
+ }
580
+ else {
581
+ throw new Error(`No ${"NAVI-LOOP-USDT-USDC"} Receipt`);
582
+ }
583
+ return txb;
584
+ }
585
+ //# sourceMappingURL=navi-looping.js.map