@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.
- package/dist/cjs/adminFunctions.d.ts +6 -0
- package/dist/cjs/adminFunctions.d.ts.map +1 -0
- package/dist/cjs/adminFunctions.js +60 -0
- package/dist/cjs/adminFunctions.js.map +1 -0
- package/dist/cjs/common/coins.d.ts.map +1 -1
- package/dist/cjs/common/coins.js +13 -2
- package/dist/cjs/common/coins.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +183 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +144 -18
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts +2 -2
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +267 -42
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/types.d.ts +168 -6
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/getTVL.d.ts +5 -0
- package/dist/cjs/getTVL.d.ts.map +1 -0
- package/dist/cjs/getTVL.js +109 -0
- package/dist/cjs/getTVL.js.map +1 -0
- package/dist/cjs/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.js +16 -57
- package/dist/cjs/graphql/getMultiReceipts.js.map +1 -1
- package/dist/cjs/index.d.ts +10 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +21 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.js +2 -3
- package/dist/cjs/sui-sdk/functions/fetchUserVaultBalances.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaults.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +5 -11
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +5 -3
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +50 -3
- package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/cjs/transactions/alpha.d.ts +1 -1
- package/dist/cjs/transactions/alpha.d.ts.map +1 -1
- package/dist/cjs/transactions/alpha.js.map +1 -1
- package/dist/cjs/transactions/bluefin.d.ts +12 -0
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
- package/dist/cjs/transactions/bluefin.js +768 -43
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/bucket.d.ts +1 -1
- package/dist/cjs/transactions/bucket.js.map +1 -1
- package/dist/cjs/transactions/cetus.d.ts +1 -1
- package/dist/cjs/transactions/cetus.d.ts.map +1 -1
- package/dist/cjs/transactions/cetus.js +3 -3
- package/dist/cjs/transactions/cetus.js.map +1 -1
- package/dist/cjs/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/cjs/transactions/collect_rewards.js +23 -2
- package/dist/cjs/transactions/collect_rewards.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +23 -5
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/navi-looping.d.ts +33 -0
- package/dist/cjs/transactions/navi-looping.d.ts.map +1 -0
- package/dist/cjs/transactions/navi-looping.js +597 -0
- package/dist/cjs/transactions/navi-looping.js.map +1 -0
- package/dist/cjs/transactions/navi.d.ts +1 -1
- package/dist/cjs/transactions/navi.d.ts.map +1 -1
- package/dist/cjs/transactions/navi.js +128 -0
- package/dist/cjs/transactions/navi.js.map +1 -1
- package/dist/cjs/transactions/withdraw.d.ts.map +1 -1
- package/dist/cjs/transactions/withdraw.js +20 -2
- package/dist/cjs/transactions/withdraw.js.map +1 -1
- package/dist/esm/adminFunctions.d.ts +6 -0
- package/dist/esm/adminFunctions.d.ts.map +1 -0
- package/dist/esm/adminFunctions.js +53 -0
- package/dist/esm/adminFunctions.js.map +1 -0
- package/dist/esm/common/coins.d.ts.map +1 -1
- package/dist/esm/common/coins.js +13 -2
- package/dist/esm/common/coins.js.map +1 -1
- package/dist/esm/common/constants.d.ts +183 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +144 -18
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts +2 -2
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +267 -42
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/types.d.ts +168 -6
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/getTVL.d.ts +5 -0
- package/dist/esm/getTVL.d.ts.map +1 -0
- package/dist/esm/getTVL.js +103 -0
- package/dist/esm/getTVL.js.map +1 -0
- package/dist/esm/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.js +16 -57
- package/dist/esm/graphql/getMultiReceipts.js.map +1 -1
- package/dist/esm/index.d.ts +10 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +12 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.js +2 -3
- package/dist/esm/sui-sdk/functions/fetchUserVaultBalances.js.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaults.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +5 -11
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +5 -3
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +50 -4
- package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/esm/transactions/alpha.d.ts +1 -1
- package/dist/esm/transactions/alpha.d.ts.map +1 -1
- package/dist/esm/transactions/alpha.js.map +1 -1
- package/dist/esm/transactions/bluefin.d.ts +12 -0
- package/dist/esm/transactions/bluefin.d.ts.map +1 -1
- package/dist/esm/transactions/bluefin.js +763 -42
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/bucket.d.ts +1 -1
- package/dist/esm/transactions/bucket.js.map +1 -1
- package/dist/esm/transactions/cetus.d.ts +1 -1
- package/dist/esm/transactions/cetus.d.ts.map +1 -1
- package/dist/esm/transactions/cetus.js +3 -3
- package/dist/esm/transactions/cetus.js.map +1 -1
- package/dist/esm/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/esm/transactions/collect_rewards.js +23 -2
- package/dist/esm/transactions/collect_rewards.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +24 -6
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/navi-looping.d.ts +33 -0
- package/dist/esm/transactions/navi-looping.d.ts.map +1 -0
- package/dist/esm/transactions/navi-looping.js +585 -0
- package/dist/esm/transactions/navi-looping.js.map +1 -0
- package/dist/esm/transactions/navi.d.ts +1 -1
- package/dist/esm/transactions/navi.d.ts.map +1 -1
- package/dist/esm/transactions/navi.js +128 -0
- package/dist/esm/transactions/navi.js.map +1 -1
- package/dist/esm/transactions/withdraw.d.ts.map +1 -1
- package/dist/esm/transactions/withdraw.js +21 -3
- package/dist/esm/transactions/withdraw.js.map +1 -1
- package/docs/assets/highlight.css +101 -0
- package/docs/assets/icons.js +21 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +2218 -0
- package/docs/assets/navigation.js +2 -0
- package/docs/assets/search.js +2 -0
- package/docs/assets/style.css +1489 -0
- package/docs/functions/alphaLpBreakdown.html +253 -0
- package/docs/functions/bucketDepositTx.html +267 -0
- package/docs/functions/bucketWithdrawTx.html +267 -0
- package/docs/functions/cetusLpBreakdown.html +253 -0
- package/docs/functions/claimRewardTxb.html +243 -0
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +267 -0
- package/docs/functions/coinAmountToXTokensSingleAsset.html +260 -0
- package/docs/functions/coinsInPool.html +438 -0
- package/docs/functions/collectRewards.html +242 -0
- package/docs/functions/deposit.html +246 -0
- package/docs/functions/depositAlphaTxb.html +250 -0
- package/docs/functions/depositBluefinSuiFirstTxb.html +302 -0
- package/docs/functions/depositBluefinType1Txb.html +300 -0
- package/docs/functions/depositBluefinType2Txb.html +300 -0
- package/docs/functions/depositCetusAlphaSuiTxb.html +300 -0
- package/docs/functions/depositCetusSuiTxb.html +298 -0
- package/docs/functions/depositCetusTxb.html +298 -0
- package/docs/functions/depositDoubleAssetTxb.html +270 -0
- package/docs/functions/depositSingleAssetTxb.html +263 -0
- package/docs/functions/fetchAfterTransactionEvents.html +306 -0
- package/docs/functions/fetchAutoCompoundingEvents.html +257 -0
- package/docs/functions/fetchAutoCompoundingEventsGql.html +251 -0
- package/docs/functions/fetchCetusPools.html +231 -0
- package/docs/functions/fetchChainIdentifier.html +233 -0
- package/docs/functions/fetchCheckRatioEvents.html +249 -0
- package/docs/functions/fetchLiquidityChangeEvents.html +257 -0
- package/docs/functions/fetchMultiReceipts.html +261 -0
- package/docs/functions/fetchNftHolders.html +233 -0
- package/docs/functions/fetchPools.html +230 -0
- package/docs/functions/fetchPortfolioData.html +243 -0
- package/docs/functions/fetchProtocolData.html +231 -0
- package/docs/functions/fetchTVL.html +253 -0
- package/docs/functions/fetchUserVaultBalances.html +245 -0
- package/docs/functions/fetchUserVaults.html +243 -0
- package/docs/functions/fetchUserWalletData.html +243 -0
- package/docs/functions/fetchWithdrawV2Events.html +255 -0
- package/docs/functions/getAirdropShare.html +243 -0
- package/docs/functions/getAllDoubleAssetVaults.html +235 -0
- package/docs/functions/getAllSingleAssetVaults.html +235 -0
- package/docs/functions/getAllVaultBalances.html +265 -0
- package/docs/functions/getAllVaults.html +233 -0
- package/docs/functions/getAlphaUnlocks.html +245 -0
- package/docs/functions/getAlphaVaultBalance.html +255 -0
- package/docs/functions/getAmounts.html +272 -0
- package/docs/functions/getApr.html +243 -0
- package/docs/functions/getAprs.html +255 -0
- package/docs/functions/getApy.html +243 -0
- package/docs/functions/getApys.html +255 -0
- package/docs/functions/getCetusInvestorTicksMap.html +284 -0
- package/docs/functions/getCetusSqrtPriceMap.html +249 -0
- package/docs/functions/getCoinAmountsFromLiquidity.html +266 -0
- package/docs/functions/getConf.html +9882 -0
- package/docs/functions/getCurrentTick.html +247 -0
- package/docs/functions/getDoubleAssetVaultBalance.html +268 -0
- package/docs/functions/getDoubleAssetVaults.html +253 -0
- package/docs/functions/getHoldersFromTransactions.html +299 -0
- package/docs/functions/getInvestor.html +259 -0
- package/docs/functions/getInvestorPoolMap.html +241 -0
- package/docs/functions/getLastAutoCompoundTime.html +249 -0
- package/docs/functions/getLiquidity.html +260 -0
- package/docs/functions/getParentPool.html +256 -0
- package/docs/functions/getPool.html +262 -0
- package/docs/functions/getPoolExchangeRateMap.html +249 -0
- package/docs/functions/getPositionTicks.html +249 -0
- package/docs/functions/getPriceToTick.html +254 -0
- package/docs/functions/getRebalanceHistories.html +269 -0
- package/docs/functions/getRebalanceHistory.html +255 -0
- package/docs/functions/getReceipts.html +268 -0
- package/docs/functions/getSingleAssetVaultBalance.html +268 -0
- package/docs/functions/getSingleAssetVaults.html +253 -0
- package/docs/functions/getSuiClient.html +247 -0
- package/docs/functions/getSuiNodeUrl.html +232 -0
- package/docs/functions/getTVLs.html +243 -0
- package/docs/functions/getTickToPrice.html +254 -0
- package/docs/functions/getUserTokensFromTransactions.html +269 -0
- package/docs/functions/getUserTokensInUsdFromTransactions.html +263 -0
- package/docs/functions/getVaultBalance.html +277 -0
- package/docs/functions/getVaultBalanceForActiveUsers.html +261 -0
- package/docs/functions/getVaults.html +250 -0
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +261 -0
- package/docs/functions/lastAutocompoundTime.html +249 -0
- package/docs/functions/liquidityToTokens.html +253 -0
- package/docs/functions/loopingDeposit.html +277 -0
- package/docs/functions/loopingWithdraw.html +278 -0
- package/docs/functions/multiLiquidityToTokens.html +271 -0
- package/docs/functions/multiTokensToUsd.html +262 -0
- package/docs/functions/multiXTokensToLiquidity.html +257 -0
- package/docs/functions/naviDepositTx.html +278 -0
- package/docs/functions/naviHasuiSuiLoopDepositTx.html +271 -0
- package/docs/functions/naviHasuiSuiLoopWithdrawTx.html +271 -0
- package/docs/functions/naviSuiVsuiLoopDepositTx.html +271 -0
- package/docs/functions/naviSuiVsuiLoopWithdrawTx.html +271 -0
- package/docs/functions/naviUsdcUsdtLoopDepositTx.html +271 -0
- package/docs/functions/naviUsdcUsdtLoopWithdrawTx.html +271 -0
- package/docs/functions/naviUsdtUsdcLoopDepositTx.html +271 -0
- package/docs/functions/naviUsdtUsdcLoopWithdrawTx.html +271 -0
- package/docs/functions/naviWithdrawTx.html +278 -0
- package/docs/functions/parseUserWalletData.html +243 -0
- package/docs/functions/setSuiClient.html +255 -0
- package/docs/functions/setSuiNodeUrl.html +249 -0
- package/docs/functions/withdraw.html +249 -0
- package/docs/functions/withdrawAlphaTxb.html +257 -0
- package/docs/functions/withdrawBluefinSuiFirstTxb.html +282 -0
- package/docs/functions/withdrawBluefinType1Txb.html +280 -0
- package/docs/functions/withdrawBluefinType2Txb.html +280 -0
- package/docs/functions/withdrawCetusAlphaSuiTxb.html +282 -0
- package/docs/functions/withdrawCetusSuiTxb.html +278 -0
- package/docs/functions/withdrawCetusTxb.html +278 -0
- package/docs/functions/withdrawTxb.html +260 -0
- package/docs/index.html +622 -0
- package/docs/interfaces/Coin.html +474 -0
- package/docs/interfaces/CoinPair.html +358 -0
- package/docs/interfaces/NaviVoloData.html +514 -0
- package/docs/interfaces/RebalanceHistoryType.html +652 -0
- package/docs/modules.html +1440 -0
- package/docs/types/AfterTransactionEventNode.html +305 -0
- package/docs/types/Allocator.html +321 -0
- package/docs/types/AlphaFiDoubleAssetVault.html +258 -0
- package/docs/types/AlphaFiMultiVaultBalance.html +219 -0
- package/docs/types/AlphaFiSingleAssetVault.html +244 -0
- package/docs/types/AlphaFiVault.html +214 -0
- package/docs/types/AlphaFiVaultBalance.html +220 -0
- package/docs/types/AlphaPoolType.html +383 -0
- package/docs/types/AlphaReceipt.html +220 -0
- package/docs/types/AlphaReceiptFields.html +421 -0
- package/docs/types/AlphaVaultBalance.html +245 -0
- package/docs/types/AutoCompoundingEventNode.html +225 -0
- package/docs/types/BluefinInvestor.html +209 -0
- package/docs/types/BluefinPoolType.html +209 -0
- package/docs/types/BucketInvestor.html +249 -0
- package/docs/types/CetusInvestor.html +240 -0
- package/docs/types/CetusPoolType.html +433 -0
- package/docs/types/CetusSwapOptions.html +209 -0
- package/docs/types/CoinAmounts.html +216 -0
- package/docs/types/CoinName.html +281 -0
- package/docs/types/CoinType.html +282 -0
- package/docs/types/CommonInvestorFields.html +276 -0
- package/docs/types/CreatePoolOptions.html +246 -0
- package/docs/types/Distributor.html +341 -0
- package/docs/types/DoubleAssetMultiVaultBalance.html +236 -0
- package/docs/types/DoubleAssetPoolNames.html +267 -0
- package/docs/types/DoubleAssetTokenHoldings.html +232 -0
- package/docs/types/DoubleAssetVaultBalance.html +229 -0
- package/docs/types/GetHoldersParams.html +221 -0
- package/docs/types/GetTokenHoldingsParams.html +227 -0
- package/docs/types/GetUserTokensFromTransactionsParams.html +233 -0
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +244 -0
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +231 -0
- package/docs/types/GetVaultBalanceParams.html +217 -0
- package/docs/types/HoldingsObj.html +223 -0
- package/docs/types/Icon.html +266 -0
- package/docs/types/Investor.html +245 -0
- package/docs/types/LiquidityChangeEventNode.html +220 -0
- package/docs/types/LiquidityToTokensParams.html +255 -0
- package/docs/types/LiquidityToUsdParams.html +267 -0
- package/docs/types/LoopingDebt.html +258 -0
- package/docs/types/LpBreakdownType.html +238 -0
- package/docs/types/MemberPoolDataType.html +276 -0
- package/docs/types/MemberType.html +269 -0
- package/docs/types/MultiGetVaultBalancesParams.html +229 -0
- package/docs/types/NaviInvestor.html +235 -0
- package/docs/types/OtherReceiptFields.html +373 -0
- package/docs/types/PoolName.html +304 -0
- package/docs/types/PoolReceipt.html +253 -0
- package/docs/types/PoolType.html +388 -0
- package/docs/types/Receipt.html +475 -0
- package/docs/types/ReceiptGQL.html +374 -0
- package/docs/types/SingleAssetMultiVaultBalance.html +232 -0
- package/docs/types/SingleAssetPoolNames.html +247 -0
- package/docs/types/SingleAssetTokenHoldings.html +228 -0
- package/docs/types/SingleAssetVaultBalance.html +223 -0
- package/docs/types/SingleGetVaultBalancesParams.html +224 -0
- package/docs/types/StrategyType.html +217 -0
- package/docs/types/SuiNetwork.html +213 -0
- package/docs/types/SwapOptions.html +248 -0
- package/docs/types/TickSpacing.html +212 -0
- package/docs/types/TotalWeightType.html +246 -0
- package/docs/types/TransactionBlockType.html +358 -0
- package/docs/types/UserPoolLiquidity.html +221 -0
- package/docs/types/UserPoolTokenHoldings.html +217 -0
- package/docs/types/UserUsdHoldings.html +223 -0
- package/docs/types/VaultBalance.html +216 -0
- package/docs/types/WithdrawV2EventNode.html +208 -0
- package/docs/variables/bluefinPoolMap.html +214 -0
- package/docs/variables/cetusPoolMap.html +214 -0
- package/docs/variables/coinsList.html +220 -0
- package/docs/variables/defunctPoolsSet.html +209 -0
- package/docs/variables/doubleAssetPoolCoinMap.html +237 -0
- package/docs/variables/loopingAccountAddresses.html +219 -0
- package/docs/variables/loopingPoolCoinMap.html +233 -0
- package/docs/variables/naviAssetMap.html +215 -0
- package/docs/variables/poolIdPoolNameMap.html +218 -0
- package/docs/variables/poolInfo.html +304 -0
- package/docs/variables/singleAssetPoolCoinMap.html +229 -0
- package/docs/variables/stableCoins.html +207 -0
- 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
|