@alphafi/alphafi-sdk 0.0.39 → 0.0.41
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.map +1 -1
- package/dist/cjs/adminFunctions.js +9 -1
- package/dist/cjs/adminFunctions.js.map +1 -1
- package/dist/cjs/common/coins.d.ts.map +1 -1
- package/dist/cjs/common/coins.js +18 -0
- package/dist/cjs/common/coins.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +288 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +214 -8
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts +1 -0
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +207 -14
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/types.d.ts +58 -5
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.js +49 -36
- package/dist/cjs/graphql/getMultiReceipts.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -9
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +17 -8
- 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/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +6 -12
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +6 -3
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +42 -26
- package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/cjs/transactions/7k.d.ts +13 -0
- package/dist/cjs/transactions/7k.d.ts.map +1 -0
- package/dist/cjs/transactions/7k.js +46 -0
- package/dist/cjs/transactions/7k.js.map +1 -0
- package/dist/cjs/transactions/alpha.d.ts.map +1 -1
- package/dist/cjs/transactions/alpha.js +1 -0
- 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 +937 -91
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/cetus.d.ts +0 -3
- package/dist/cjs/transactions/cetus.d.ts.map +1 -1
- package/dist/cjs/transactions/cetus.js +4 -63
- package/dist/cjs/transactions/cetus.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts +3 -0
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +77 -1
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/deposit1.d.ts +1 -0
- package/dist/cjs/transactions/deposit1.d.ts.map +1 -0
- package/dist/cjs/transactions/deposit1.js +86 -0
- package/dist/cjs/transactions/deposit1.js.map +1 -0
- package/dist/cjs/transactions/types.d.ts +14 -0
- package/dist/cjs/transactions/types.d.ts.map +1 -0
- package/dist/cjs/transactions/types.js +3 -0
- package/dist/cjs/transactions/types.js.map +1 -0
- package/dist/cjs/transactions/withdraw.d.ts.map +1 -1
- package/dist/cjs/transactions/withdraw.js +17 -2
- package/dist/cjs/transactions/withdraw.js.map +1 -1
- package/dist/cjs/transactions/zapDeposit.d.ts +9 -0
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +1117 -725
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/adminFunctions.d.ts.map +1 -1
- package/dist/esm/adminFunctions.js +10 -2
- package/dist/esm/adminFunctions.js.map +1 -1
- package/dist/esm/common/coins.d.ts.map +1 -1
- package/dist/esm/common/coins.js +18 -0
- package/dist/esm/common/coins.js.map +1 -1
- package/dist/esm/common/constants.d.ts +288 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +214 -8
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts +1 -0
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +206 -13
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/types.d.ts +58 -5
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.js +49 -36
- package/dist/esm/graphql/getMultiReceipts.js.map +1 -1
- package/dist/esm/index.d.ts +5 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -9
- 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/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +7 -13
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +6 -3
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +43 -26
- package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/esm/transactions/7k.d.ts +13 -0
- package/dist/esm/transactions/7k.d.ts.map +1 -0
- package/dist/esm/transactions/7k.js +42 -0
- package/dist/esm/transactions/7k.js.map +1 -0
- package/dist/esm/transactions/alpha.d.ts.map +1 -1
- package/dist/esm/transactions/alpha.js +1 -0
- 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 +928 -86
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/cetus.d.ts +0 -3
- package/dist/esm/transactions/cetus.d.ts.map +1 -1
- package/dist/esm/transactions/cetus.js +2 -57
- package/dist/esm/transactions/cetus.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts +3 -0
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +74 -2
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/deposit1.d.ts +2 -0
- package/dist/esm/transactions/deposit1.d.ts.map +1 -0
- package/dist/esm/transactions/deposit1.js +86 -0
- package/dist/esm/transactions/deposit1.js.map +1 -0
- package/dist/esm/transactions/types.d.ts +14 -0
- package/dist/esm/transactions/types.d.ts.map +1 -0
- package/dist/esm/transactions/types.js +2 -0
- package/dist/esm/transactions/types.js.map +1 -0
- package/dist/esm/transactions/withdraw.d.ts.map +1 -1
- package/dist/esm/transactions/withdraw.js +18 -3
- package/dist/esm/transactions/withdraw.js.map +1 -1
- package/dist/esm/transactions/zapDeposit.d.ts +9 -1
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +1113 -726
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/docs/assets/highlight.css +78 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1493 -0
- package/docs/functions/alphaLpBreakdown.html +1 -0
- package/docs/functions/cetusLpBreakdown.html +1 -0
- package/docs/functions/claimRewardTxb.html +1 -0
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +1 -0
- package/docs/functions/coinAmountToXTokensSingleAsset.html +1 -0
- package/docs/functions/coinsInPool.html +1 -0
- package/docs/functions/collectRewards.html +1 -0
- package/docs/functions/deposit.html +1 -0
- package/docs/functions/depositDoubleAssetTxb.html +1 -0
- package/docs/functions/depositSingleAssetTxb.html +1 -0
- package/docs/functions/fetchAfterTransactionEvents.html +1 -0
- package/docs/functions/fetchAutoCompoundingEvents.html +1 -0
- package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -0
- package/docs/functions/fetchCetusPools.html +1 -0
- package/docs/functions/fetchChainIdentifier.html +1 -0
- package/docs/functions/fetchCheckRatioEvents.html +1 -0
- package/docs/functions/fetchLiquidityChangeEvents.html +1 -0
- package/docs/functions/fetchMultiReceipts.html +1 -0
- package/docs/functions/fetchNftHolders.html +1 -0
- package/docs/functions/fetchPools.html +1 -0
- package/docs/functions/fetchPortfolioData.html +1 -0
- package/docs/functions/fetchProtocolData.html +1 -0
- package/docs/functions/fetchTVL.html +1 -0
- package/docs/functions/fetchUserVaultBalances.html +1 -0
- package/docs/functions/fetchUserVaults.html +1 -0
- package/docs/functions/fetchUserWalletData.html +1 -0
- package/docs/functions/fetchWithdrawV2Events.html +1 -0
- package/docs/functions/getAirdropShare.html +1 -0
- package/docs/functions/getAllDoubleAssetVaults.html +1 -0
- package/docs/functions/getAllSingleAssetVaults.html +1 -0
- package/docs/functions/getAllVaultBalances.html +1 -0
- package/docs/functions/getAllVaults.html +1 -0
- package/docs/functions/getAlphaUnlocks.html +1 -0
- package/docs/functions/getAlphaVaultBalance.html +1 -0
- package/docs/functions/getAmounts.html +1 -0
- package/docs/functions/getApr.html +1 -0
- package/docs/functions/getAprs.html +1 -0
- package/docs/functions/getApy.html +1 -0
- package/docs/functions/getApys.html +1 -0
- package/docs/functions/getCetusInvestorTicksMap.html +1 -0
- package/docs/functions/getCetusSqrtPriceMap.html +1 -0
- package/docs/functions/getCoinAmountsFromLiquidity.html +1 -0
- package/docs/functions/getConf.html +1 -0
- package/docs/functions/getCurrentTick.html +1 -0
- package/docs/functions/getDoubleAssetVaultBalance.html +1 -0
- package/docs/functions/getDoubleAssetVaults.html +1 -0
- package/docs/functions/getHoldersFromTransactions.html +1 -0
- package/docs/functions/getInvestor.html +1 -0
- package/docs/functions/getInvestorPoolMap.html +1 -0
- package/docs/functions/getLastAutoCompoundTime.html +1 -0
- package/docs/functions/getLatestPrices.html +1 -0
- package/docs/functions/getLiquidity.html +1 -0
- package/docs/functions/getMultiInvestor.html +1 -0
- package/docs/functions/getMultiLatestPrices.html +1 -0
- package/docs/functions/getMultiParentPool.html +1 -0
- package/docs/functions/getMultiPool.html +1 -0
- package/docs/functions/getMultiReceipts.html +1 -0
- package/docs/functions/getParentPool.html +1 -0
- package/docs/functions/getPool.html +1 -0
- package/docs/functions/getPoolExchangeRateMap.html +1 -0
- package/docs/functions/getPositionRange.html +1 -0
- package/docs/functions/getPositionTicks.html +1 -0
- package/docs/functions/getPriceToTick.html +1 -0
- package/docs/functions/getRebalanceHistories.html +1 -0
- package/docs/functions/getRebalanceHistory.html +1 -0
- package/docs/functions/getReceipts.html +1 -0
- package/docs/functions/getSingleAssetVaultBalance.html +1 -0
- package/docs/functions/getSingleAssetVaults.html +1 -0
- package/docs/functions/getSuiClient.html +3 -0
- package/docs/functions/getSuiNodeUrl.html +3 -0
- package/docs/functions/getTVLs.html +1 -0
- package/docs/functions/getTickToPrice.html +1 -0
- package/docs/functions/getUserTokensFromTransactions.html +1 -0
- package/docs/functions/getUserTokensInUsdFromTransactions.html +1 -0
- package/docs/functions/getVaultBalance.html +1 -0
- package/docs/functions/getVaultBalanceForActiveUsers.html +1 -0
- package/docs/functions/getVaults.html +1 -0
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +1 -0
- package/docs/functions/getZapAmounts.html +1 -0
- package/docs/functions/lastAutocompoundTime.html +1 -0
- package/docs/functions/liquidityToTokens.html +1 -0
- package/docs/functions/multiLiquidityToTokens.html +1 -0
- package/docs/functions/multiTokensToUsd.html +1 -0
- package/docs/functions/multiXTokensToLiquidity.html +1 -0
- package/docs/functions/parseUserWalletData.html +1 -0
- package/docs/functions/setSuiClient.html +7 -0
- package/docs/functions/setSuiNodeUrl.html +5 -0
- package/docs/functions/withdraw.html +1 -0
- package/docs/functions/withdrawAlphaTxb.html +1 -0
- package/docs/functions/withdrawTxb.html +1 -0
- package/docs/functions/zapDepositTxb.html +1 -0
- package/docs/index.html +76 -0
- package/docs/interfaces/Coin.html +12 -0
- package/docs/interfaces/CoinPair.html +3 -0
- package/docs/interfaces/NaviVoloData.html +3 -0
- package/docs/interfaces/RebalanceHistoryType.html +9 -0
- package/docs/modules.html +177 -0
- package/docs/types/AfterTransactionEventNode.html +1 -0
- package/docs/types/Allocator.html +1 -0
- package/docs/types/AlphaFiDoubleAssetVault.html +1 -0
- package/docs/types/AlphaFiMultiVaultBalance.html +1 -0
- package/docs/types/AlphaFiSingleAssetVault.html +1 -0
- package/docs/types/AlphaFiVault.html +1 -0
- package/docs/types/AlphaFiVaultBalance.html +1 -0
- package/docs/types/AlphaPoolType.html +1 -0
- package/docs/types/AlphaReceipt.html +1 -0
- package/docs/types/AlphaReceiptFields.html +1 -0
- package/docs/types/AlphaVaultBalance.html +1 -0
- package/docs/types/AutoCompoundingEventNode.html +1 -0
- package/docs/types/BluefinInvestor.html +1 -0
- package/docs/types/BluefinPoolType.html +1 -0
- package/docs/types/BucketInvestor.html +1 -0
- package/docs/types/CetusInvestor.html +1 -0
- package/docs/types/CetusPoolType.html +1 -0
- package/docs/types/CetusSwapOptions.html +1 -0
- package/docs/types/CoinAmounts.html +1 -0
- package/docs/types/CoinName.html +1 -0
- package/docs/types/CoinType.html +1 -0
- package/docs/types/CommonInvestorFields.html +1 -0
- package/docs/types/CreatePoolOptions.html +1 -0
- package/docs/types/Distributor.html +1 -0
- package/docs/types/DoubleAssetMultiVaultBalance.html +1 -0
- package/docs/types/DoubleAssetPoolNames.html +1 -0
- package/docs/types/DoubleAssetTokenHoldings.html +1 -0
- package/docs/types/DoubleAssetVaultBalance.html +1 -0
- package/docs/types/GetHoldersParams.html +1 -0
- package/docs/types/GetTokenHoldingsParams.html +1 -0
- package/docs/types/GetUserTokensFromTransactionsParams.html +1 -0
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +1 -0
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +1 -0
- package/docs/types/GetVaultBalanceParams.html +1 -0
- package/docs/types/HoldingsObj.html +1 -0
- package/docs/types/Icon.html +1 -0
- package/docs/types/Investor.html +1 -0
- package/docs/types/LiquidityChangeEventNode.html +1 -0
- package/docs/types/LiquidityToTokensParams.html +1 -0
- package/docs/types/LiquidityToUsdParams.html +1 -0
- package/docs/types/LoopingDebt.html +1 -0
- package/docs/types/LpBreakdownType.html +1 -0
- package/docs/types/MemberPoolDataType.html +1 -0
- package/docs/types/MemberType.html +1 -0
- package/docs/types/MultiGetVaultBalancesParams.html +1 -0
- package/docs/types/NaviInvestor.html +1 -0
- package/docs/types/OtherReceiptFields.html +1 -0
- package/docs/types/PoolName.html +1 -0
- package/docs/types/PoolReceipt.html +1 -0
- package/docs/types/PoolType.html +1 -0
- package/docs/types/Receipt.html +1 -0
- package/docs/types/ReceiptGQL.html +1 -0
- package/docs/types/SingleAssetMultiVaultBalance.html +1 -0
- package/docs/types/SingleAssetPoolNames.html +1 -0
- package/docs/types/SingleAssetTokenHoldings.html +1 -0
- package/docs/types/SingleAssetVaultBalance.html +1 -0
- package/docs/types/SingleGetVaultBalancesParams.html +1 -0
- package/docs/types/StrategyType.html +1 -0
- package/docs/types/SuiNetwork.html +1 -0
- package/docs/types/SwapOptions.html +1 -0
- package/docs/types/TickSpacing.html +1 -0
- package/docs/types/TotalWeightType.html +1 -0
- package/docs/types/TransactionBlockType.html +1 -0
- package/docs/types/UserPoolLiquidity.html +1 -0
- package/docs/types/UserPoolTokenHoldings.html +1 -0
- package/docs/types/UserUsdHoldings.html +1 -0
- package/docs/types/VaultBalance.html +1 -0
- package/docs/types/WithdrawV2EventNode.html +1 -0
- package/docs/variables/bluefinPoolMap.html +1 -0
- package/docs/variables/cetusPoolMap.html +1 -0
- package/docs/variables/coinsList.html +1 -0
- package/docs/variables/defunctPoolsSet.html +1 -0
- package/docs/variables/doubleAssetPoolCoinMap.html +1 -0
- package/docs/variables/ignoredWalletsForDailyRevenue.html +1 -0
- package/docs/variables/loopingAccountAddresses.html +1 -0
- package/docs/variables/loopingPoolCoinMap.html +1 -0
- package/docs/variables/naviAssetMap.html +1 -0
- package/docs/variables/poolIdPoolNameMap.html +1 -0
- package/docs/variables/poolInfo.html +1 -0
- package/docs/variables/singleAssetPoolCoinMap.html +1 -0
- package/docs/variables/stableCoins.html +1 -0
- package/package.json +2 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withdrawBluefinType2Txb = exports.withdrawBluefinType1Txb = exports.withdrawBluefinSuiFirstTxb = exports.depositBluefinType2Txb = exports.depositBluefinType1Txb = exports.depositBluefinSuiFirstTxb = void 0;
|
|
3
|
+
exports.withdrawBluefinStsuiTxb = exports.withdrawBluefinType2Txb = exports.withdrawBluefinType1Txb = exports.withdrawBluefinSuiSecondTxb = exports.withdrawBluefinSuiFirstTxb = exports.depositBluefinStsuiTxb = exports.depositBluefinType2Txb = exports.depositBluefinType1Txb = exports.depositBluefinSuiSecondTxb = exports.depositBluefinSuiFirstTxb = void 0;
|
|
4
4
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
5
5
|
const coins_js_1 = require("../common/coins.js");
|
|
6
6
|
const constants_js_1 = require("../common/constants.js");
|
|
7
7
|
const maps_js_1 = require("../common/maps.js");
|
|
8
8
|
const getReceipts_js_1 = require("../sui-sdk/functions/getReceipts.js");
|
|
9
|
-
const cetus_js_1 = require("./cetus.js");
|
|
10
9
|
const client_js_1 = require("../sui-sdk/client.js");
|
|
10
|
+
const deposit_js_1 = require("./deposit.js");
|
|
11
11
|
const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
12
12
|
const suiClient = (0, client_js_1.getSuiClient)();
|
|
13
13
|
const address = options.address;
|
|
@@ -39,7 +39,7 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
39
39
|
break;
|
|
40
40
|
}
|
|
41
41
|
} while (true);
|
|
42
|
-
const amounts = await (0,
|
|
42
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
43
43
|
if (amounts) {
|
|
44
44
|
const amount1 = amounts[0];
|
|
45
45
|
const amount2 = amounts[1];
|
|
@@ -67,14 +67,13 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
67
67
|
arguments: [txb.object(receipt[0].objectId)],
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
console.log(poolinfo.poolId);
|
|
71
70
|
if (poolName === "BLUEFIN-SUI-USDC") {
|
|
72
71
|
txb.moveCall({
|
|
73
72
|
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit`,
|
|
74
73
|
typeArguments: [
|
|
75
74
|
coins_js_1.coinsList[pool1].type,
|
|
76
75
|
coins_js_1.coinsList[pool2].type,
|
|
77
|
-
coins_js_1.coinsList["
|
|
76
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
78
77
|
coins_js_1.coinsList["SUI"].type,
|
|
79
78
|
],
|
|
80
79
|
arguments: [
|
|
@@ -89,7 +88,7 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
89
88
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
90
89
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
91
90
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
92
|
-
txb.object((0, constants_js_1.getConf)().
|
|
91
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
93
92
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
94
93
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
95
94
|
],
|
|
@@ -101,7 +100,7 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
101
100
|
typeArguments: [
|
|
102
101
|
coins_js_1.coinsList[pool1].type,
|
|
103
102
|
coins_js_1.coinsList[pool2].type,
|
|
104
|
-
coins_js_1.coinsList["
|
|
103
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
105
104
|
coins_js_1.coinsList["SUI"].type,
|
|
106
105
|
],
|
|
107
106
|
arguments: [
|
|
@@ -116,7 +115,7 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
116
115
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
117
116
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
118
117
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_BUCK_POOL),
|
|
119
|
-
txb.object((0, constants_js_1.getConf)().
|
|
118
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
120
119
|
txb.object(maps_js_1.cetusPoolMap["BUCK-SUI"]),
|
|
121
120
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
122
121
|
],
|
|
@@ -128,7 +127,7 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
128
127
|
typeArguments: [
|
|
129
128
|
coins_js_1.coinsList[pool1].type,
|
|
130
129
|
coins_js_1.coinsList[pool2].type,
|
|
131
|
-
coins_js_1.coinsList["
|
|
130
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
132
131
|
coins_js_1.coinsList["SUI"].type,
|
|
133
132
|
],
|
|
134
133
|
arguments: [
|
|
@@ -143,7 +142,7 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
143
142
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
144
143
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
145
144
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_AUSD_POOL),
|
|
146
|
-
txb.object((0, constants_js_1.getConf)().
|
|
145
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
147
146
|
txb.object(maps_js_1.cetusPoolMap["AUSD-SUI"]),
|
|
148
147
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
149
148
|
],
|
|
@@ -158,6 +157,181 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
158
157
|
return txb;
|
|
159
158
|
};
|
|
160
159
|
exports.depositBluefinSuiFirstTxb = depositBluefinSuiFirstTxb;
|
|
160
|
+
const depositBluefinSuiSecondTxb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
161
|
+
const suiClient = (0, client_js_1.getSuiClient)();
|
|
162
|
+
const address = options.address;
|
|
163
|
+
let txb;
|
|
164
|
+
if (transaction)
|
|
165
|
+
txb = transaction;
|
|
166
|
+
else
|
|
167
|
+
txb = new transactions_1.Transaction();
|
|
168
|
+
poolName = poolName.toUpperCase();
|
|
169
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
170
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
171
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
172
|
+
let coins1 = [];
|
|
173
|
+
let currentCursor = null;
|
|
174
|
+
do {
|
|
175
|
+
const response = await suiClient.getCoins({
|
|
176
|
+
owner: address,
|
|
177
|
+
coinType: coins_js_1.coinsList[pool1].type,
|
|
178
|
+
cursor: currentCursor,
|
|
179
|
+
});
|
|
180
|
+
coins1 = coins1.concat(response.data);
|
|
181
|
+
// Check if there's a next page
|
|
182
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
183
|
+
currentCursor = response.nextCursor;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
// No more pages available
|
|
187
|
+
// console.log("No more receipts available.");
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
} while (true);
|
|
191
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
192
|
+
if (amounts) {
|
|
193
|
+
const amount1 = amounts[0];
|
|
194
|
+
const amount2 = amounts[1];
|
|
195
|
+
let coin1;
|
|
196
|
+
if (coins1.length >= 1) {
|
|
197
|
+
//coin1
|
|
198
|
+
[coin1] = txb.splitCoins(txb.object(coins1[0].coinObjectId), [0]);
|
|
199
|
+
txb.mergeCoins(coin1, coins1.map((c) => c.coinObjectId));
|
|
200
|
+
const [depositCoinA] = txb.splitCoins(coin1, [amount1]);
|
|
201
|
+
//coin2
|
|
202
|
+
const [depositCoinB] = txb.splitCoins(txb.gas, [amount2]);
|
|
203
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
204
|
+
let someReceipt;
|
|
205
|
+
if (receipt.length == 0) {
|
|
206
|
+
[someReceipt] = txb.moveCall({
|
|
207
|
+
target: `0x1::option::none`,
|
|
208
|
+
typeArguments: [poolinfo.receiptType],
|
|
209
|
+
arguments: [],
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
[someReceipt] = txb.moveCall({
|
|
214
|
+
target: `0x1::option::some`,
|
|
215
|
+
typeArguments: [receipt[0].content.type],
|
|
216
|
+
arguments: [txb.object(receipt[0].objectId)],
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
if (poolName === "BLUEFIN-BLUE-SUI") {
|
|
220
|
+
txb.moveCall({
|
|
221
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
222
|
+
typeArguments: [
|
|
223
|
+
coins_js_1.coinsList[pool1].type,
|
|
224
|
+
coins_js_1.coinsList[pool2].type,
|
|
225
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
226
|
+
coins_js_1.coinsList["SUI"].type,
|
|
227
|
+
],
|
|
228
|
+
arguments: [
|
|
229
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
230
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
231
|
+
someReceipt,
|
|
232
|
+
txb.object(poolinfo.poolId),
|
|
233
|
+
depositCoinA,
|
|
234
|
+
depositCoinB,
|
|
235
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
236
|
+
txb.object(poolinfo.investorId),
|
|
237
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
238
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
239
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
240
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
241
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-SUI"]),
|
|
242
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
243
|
+
],
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
else if (poolName === "BLUEFIN-WBTC-SUI") {
|
|
247
|
+
txb.moveCall({
|
|
248
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
249
|
+
typeArguments: [
|
|
250
|
+
coins_js_1.coinsList[pool1].type,
|
|
251
|
+
coins_js_1.coinsList[pool2].type,
|
|
252
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
253
|
+
coins_js_1.coinsList["SUI"].type,
|
|
254
|
+
],
|
|
255
|
+
arguments: [
|
|
256
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
257
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
258
|
+
someReceipt,
|
|
259
|
+
txb.object(poolinfo.poolId),
|
|
260
|
+
depositCoinA,
|
|
261
|
+
depositCoinB,
|
|
262
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
263
|
+
txb.object(poolinfo.investorId),
|
|
264
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
265
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
266
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_SUI_POOL),
|
|
267
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
268
|
+
txb.object(maps_js_1.cetusPoolMap["WBTC-SUI"]),
|
|
269
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
270
|
+
],
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
else if (poolName === "BLUEFIN-DEEP-SUI") {
|
|
274
|
+
txb.moveCall({
|
|
275
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
276
|
+
typeArguments: [
|
|
277
|
+
coins_js_1.coinsList[pool1].type,
|
|
278
|
+
coins_js_1.coinsList[pool2].type,
|
|
279
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
280
|
+
coins_js_1.coinsList["SUI"].type,
|
|
281
|
+
],
|
|
282
|
+
arguments: [
|
|
283
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
284
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
285
|
+
someReceipt,
|
|
286
|
+
txb.object(poolinfo.poolId),
|
|
287
|
+
depositCoinA,
|
|
288
|
+
depositCoinB,
|
|
289
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
290
|
+
txb.object(poolinfo.investorId),
|
|
291
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
292
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
293
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
294
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
295
|
+
txb.object(maps_js_1.cetusPoolMap["DEEP-SUI"]),
|
|
296
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
297
|
+
],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
else if (poolName === "BLUEFIN-STSUI-SUI") {
|
|
301
|
+
txb.moveCall({
|
|
302
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_sui_pool::user_deposit`,
|
|
303
|
+
typeArguments: [
|
|
304
|
+
coins_js_1.coinsList[pool1].type,
|
|
305
|
+
coins_js_1.coinsList[pool2].type,
|
|
306
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
307
|
+
],
|
|
308
|
+
arguments: [
|
|
309
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
310
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
311
|
+
someReceipt,
|
|
312
|
+
txb.object(poolinfo.poolId),
|
|
313
|
+
depositCoinA,
|
|
314
|
+
depositCoinB,
|
|
315
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
316
|
+
txb.object(poolinfo.investorId),
|
|
317
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
318
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_SUI_POOL),
|
|
319
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
320
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
321
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
322
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
323
|
+
],
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
txb.transferObjects([coin1], address);
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return txb;
|
|
333
|
+
};
|
|
334
|
+
exports.depositBluefinSuiSecondTxb = depositBluefinSuiSecondTxb;
|
|
161
335
|
const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
162
336
|
const suiClient = (0, client_js_1.getSuiClient)();
|
|
163
337
|
const address = options.address;
|
|
@@ -208,7 +382,7 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
208
382
|
break;
|
|
209
383
|
}
|
|
210
384
|
} while (true);
|
|
211
|
-
const amounts = await (0,
|
|
385
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
212
386
|
if (amounts) {
|
|
213
387
|
const amount1 = amounts[0];
|
|
214
388
|
const amount2 = amounts[1];
|
|
@@ -245,7 +419,7 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
245
419
|
typeArguments: [
|
|
246
420
|
coins_js_1.coinsList[pool1].type,
|
|
247
421
|
coins_js_1.coinsList[pool2].type,
|
|
248
|
-
coins_js_1.coinsList["
|
|
422
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
249
423
|
coins_js_1.coinsList["SUI"].type,
|
|
250
424
|
],
|
|
251
425
|
arguments: [
|
|
@@ -260,7 +434,7 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
260
434
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
261
435
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
262
436
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
263
|
-
txb.object((0, constants_js_1.getConf)().
|
|
437
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
264
438
|
txb.object(maps_js_1.cetusPoolMap["USDC-USDT"]),
|
|
265
439
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
266
440
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -273,7 +447,7 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
273
447
|
typeArguments: [
|
|
274
448
|
coins_js_1.coinsList[pool1].type,
|
|
275
449
|
coins_js_1.coinsList[pool2].type,
|
|
276
|
-
coins_js_1.coinsList["
|
|
450
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
277
451
|
coins_js_1.coinsList["SUI"].type,
|
|
278
452
|
],
|
|
279
453
|
arguments: [
|
|
@@ -288,7 +462,7 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
288
462
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
289
463
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
290
464
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_AUSD_USDC_POOL),
|
|
291
|
-
txb.object((0, constants_js_1.getConf)().
|
|
465
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
292
466
|
txb.object(maps_js_1.cetusPoolMap["USDC-AUSD"]),
|
|
293
467
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
294
468
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -301,7 +475,7 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
301
475
|
typeArguments: [
|
|
302
476
|
coins_js_1.coinsList[pool1].type,
|
|
303
477
|
coins_js_1.coinsList[pool2].type,
|
|
304
|
-
coins_js_1.coinsList["
|
|
478
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
305
479
|
coins_js_1.coinsList["SUI"].type,
|
|
306
480
|
],
|
|
307
481
|
arguments: [
|
|
@@ -316,13 +490,69 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
316
490
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
317
491
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
318
492
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
319
|
-
txb.object((0, constants_js_1.getConf)().
|
|
493
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
320
494
|
txb.object(maps_js_1.cetusPoolMap["USDC-WBTC"]),
|
|
321
495
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
322
496
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
323
497
|
],
|
|
324
498
|
});
|
|
325
499
|
}
|
|
500
|
+
else if (poolName === "BLUEFIN-SEND-USDC") {
|
|
501
|
+
txb.moveCall({
|
|
502
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
503
|
+
typeArguments: [
|
|
504
|
+
coins_js_1.coinsList[pool1].type,
|
|
505
|
+
coins_js_1.coinsList[pool2].type,
|
|
506
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
507
|
+
coins_js_1.coinsList["SUI"].type,
|
|
508
|
+
],
|
|
509
|
+
arguments: [
|
|
510
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
511
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
512
|
+
someReceipt,
|
|
513
|
+
txb.object(poolinfo.poolId),
|
|
514
|
+
depositCoinA,
|
|
515
|
+
depositCoinB,
|
|
516
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
517
|
+
txb.object(poolinfo.investorId),
|
|
518
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
519
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
520
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SEND_USDC_POOL),
|
|
521
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
522
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SEND"]),
|
|
523
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
524
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
525
|
+
],
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
else if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
529
|
+
txb.moveCall({
|
|
530
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
531
|
+
typeArguments: [
|
|
532
|
+
coins_js_1.coinsList[pool1].type,
|
|
533
|
+
coins_js_1.coinsList[pool2].type,
|
|
534
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
535
|
+
coins_js_1.coinsList["SUI"].type,
|
|
536
|
+
],
|
|
537
|
+
arguments: [
|
|
538
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
539
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
540
|
+
someReceipt,
|
|
541
|
+
txb.object(poolinfo.poolId),
|
|
542
|
+
depositCoinA,
|
|
543
|
+
depositCoinB,
|
|
544
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
545
|
+
txb.object(poolinfo.investorId),
|
|
546
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
547
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
548
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
549
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
550
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-STSUI"]),
|
|
551
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
552
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
553
|
+
],
|
|
554
|
+
});
|
|
555
|
+
}
|
|
326
556
|
txb.transferObjects([coin1], address);
|
|
327
557
|
txb.transferObjects([coin2], address);
|
|
328
558
|
}
|
|
@@ -383,7 +613,7 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
383
613
|
break;
|
|
384
614
|
}
|
|
385
615
|
} while (true);
|
|
386
|
-
const amounts = await (0,
|
|
616
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
387
617
|
if (amounts) {
|
|
388
618
|
const amount1 = amounts[0];
|
|
389
619
|
const amount2 = amounts[1];
|
|
@@ -420,7 +650,7 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
420
650
|
typeArguments: [
|
|
421
651
|
coins_js_1.coinsList[pool1].type,
|
|
422
652
|
coins_js_1.coinsList[pool2].type,
|
|
423
|
-
coins_js_1.coinsList["
|
|
653
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
424
654
|
coins_js_1.coinsList["SUI"].type,
|
|
425
655
|
],
|
|
426
656
|
arguments: [
|
|
@@ -435,7 +665,7 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
435
665
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
436
666
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
437
667
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_USDC_POOL),
|
|
438
|
-
txb.object((0, constants_js_1.getConf)().
|
|
668
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
439
669
|
txb.object(maps_js_1.cetusPoolMap["ALPHA-USDC"]),
|
|
440
670
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
441
671
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -448,7 +678,7 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
448
678
|
typeArguments: [
|
|
449
679
|
coins_js_1.coinsList[pool1].type,
|
|
450
680
|
coins_js_1.coinsList[pool2].type,
|
|
451
|
-
coins_js_1.coinsList["
|
|
681
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
452
682
|
coins_js_1.coinsList["SUI"].type,
|
|
453
683
|
],
|
|
454
684
|
arguments: [
|
|
@@ -463,58 +693,409 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
463
693
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
464
694
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
465
695
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_NAVX_VSUI_POOL),
|
|
466
|
-
txb.object((0, constants_js_1.getConf)().
|
|
696
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
467
697
|
txb.object(maps_js_1.cetusPoolMap["NAVX-VSUI"]),
|
|
468
698
|
txb.object(maps_js_1.cetusPoolMap["VSUI-SUI"]),
|
|
469
699
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
470
700
|
],
|
|
471
701
|
});
|
|
472
702
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
703
|
+
else if (poolName === "BLUEFIN-BLUE-USDC") {
|
|
704
|
+
txb.moveCall({
|
|
705
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
706
|
+
typeArguments: [
|
|
707
|
+
coins_js_1.coinsList[pool1].type,
|
|
708
|
+
coins_js_1.coinsList[pool2].type,
|
|
709
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
710
|
+
coins_js_1.coinsList["SUI"].type,
|
|
711
|
+
],
|
|
712
|
+
arguments: [
|
|
713
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
714
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
715
|
+
someReceipt,
|
|
716
|
+
txb.object(poolinfo.poolId),
|
|
717
|
+
depositCoinA,
|
|
718
|
+
depositCoinB,
|
|
719
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
720
|
+
txb.object(poolinfo.investorId),
|
|
721
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
722
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
723
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_USDC_POOL),
|
|
724
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
725
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-USDC"]),
|
|
726
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
727
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
728
|
+
],
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
else if (poolName === "BLUEFIN-STSUI-ETH") {
|
|
732
|
+
txb.moveCall({
|
|
733
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
734
|
+
typeArguments: [
|
|
735
|
+
coins_js_1.coinsList[pool1].type,
|
|
736
|
+
coins_js_1.coinsList[pool2].type,
|
|
737
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
738
|
+
coins_js_1.coinsList["SUI"].type,
|
|
739
|
+
],
|
|
740
|
+
arguments: [
|
|
741
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
742
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
743
|
+
someReceipt,
|
|
744
|
+
txb.object(poolinfo.poolId),
|
|
745
|
+
depositCoinA,
|
|
746
|
+
depositCoinB,
|
|
747
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
748
|
+
txb.object(poolinfo.investorId),
|
|
749
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
750
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
751
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_ETH_POOL),
|
|
752
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
753
|
+
txb.object(maps_js_1.cetusPoolMap["STSUI-ETH"]),
|
|
754
|
+
txb.object(maps_js_1.cetusPoolMap["ETH-SUI"]),
|
|
755
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
756
|
+
],
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
else if (poolName === "BLUEFIN-STSUI-WSOL") {
|
|
760
|
+
txb.moveCall({
|
|
761
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
762
|
+
typeArguments: [
|
|
763
|
+
coins_js_1.coinsList[pool1].type,
|
|
764
|
+
coins_js_1.coinsList[pool2].type,
|
|
765
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
766
|
+
coins_js_1.coinsList["SUI"].type,
|
|
767
|
+
],
|
|
768
|
+
arguments: [
|
|
769
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
770
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
771
|
+
someReceipt,
|
|
772
|
+
txb.object(poolinfo.poolId),
|
|
773
|
+
depositCoinA,
|
|
774
|
+
depositCoinB,
|
|
775
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
776
|
+
txb.object(poolinfo.investorId),
|
|
777
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
778
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
779
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_WSOL_POOL),
|
|
780
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
781
|
+
txb.object(maps_js_1.cetusPoolMap["STSUI-WSOL"]),
|
|
782
|
+
txb.object(maps_js_1.cetusPoolMap["WSOL-SUI"]),
|
|
783
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
784
|
+
],
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
txb.transferObjects([coin1], address);
|
|
788
|
+
txb.transferObjects([coin2], address);
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return txb;
|
|
795
|
+
};
|
|
796
|
+
exports.depositBluefinType2Txb = depositBluefinType2Txb;
|
|
797
|
+
const depositBluefinStsuiTxb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
798
|
+
const suiClient = (0, client_js_1.getSuiClient)();
|
|
799
|
+
const address = options.address;
|
|
800
|
+
let txb;
|
|
801
|
+
if (transaction)
|
|
802
|
+
txb = transaction;
|
|
803
|
+
else
|
|
804
|
+
txb = new transactions_1.Transaction();
|
|
805
|
+
poolName = poolName.toUpperCase();
|
|
806
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
807
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
808
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
809
|
+
let coins1 = [];
|
|
810
|
+
let coins2 = [];
|
|
811
|
+
let currentCursor = null;
|
|
812
|
+
do {
|
|
813
|
+
const response = await suiClient.getCoins({
|
|
814
|
+
owner: address,
|
|
815
|
+
coinType: coins_js_1.coinsList[pool1].type,
|
|
816
|
+
cursor: currentCursor,
|
|
817
|
+
});
|
|
818
|
+
coins1 = coins1.concat(response.data);
|
|
819
|
+
// Check if there's a next page
|
|
820
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
821
|
+
currentCursor = response.nextCursor;
|
|
822
|
+
}
|
|
823
|
+
else {
|
|
824
|
+
// No more pages available
|
|
825
|
+
// console.log("No more receipts available.");
|
|
826
|
+
break;
|
|
827
|
+
}
|
|
828
|
+
} while (true);
|
|
829
|
+
currentCursor = null;
|
|
830
|
+
do {
|
|
831
|
+
const response = await suiClient.getCoins({
|
|
832
|
+
owner: address,
|
|
833
|
+
coinType: coins_js_1.coinsList[pool2].type,
|
|
834
|
+
cursor: currentCursor,
|
|
835
|
+
});
|
|
836
|
+
coins2 = coins2.concat(response.data);
|
|
837
|
+
// Check if there's a next page
|
|
838
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
839
|
+
currentCursor = response.nextCursor;
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
// No more pages available
|
|
843
|
+
// console.log("No more receipts available.");
|
|
844
|
+
break;
|
|
845
|
+
}
|
|
846
|
+
} while (true);
|
|
847
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
848
|
+
console.log(amounts);
|
|
849
|
+
if (amounts) {
|
|
850
|
+
const amount1 = amounts[0];
|
|
851
|
+
const amount2 = amounts[1];
|
|
852
|
+
let coin1;
|
|
853
|
+
let coin2;
|
|
854
|
+
if (coins1.length >= 1 && coins2.length >= 1) {
|
|
855
|
+
//coin1
|
|
856
|
+
[coin1] = txb.splitCoins(txb.object(coins1[0].coinObjectId), [0]);
|
|
857
|
+
txb.mergeCoins(coin1, coins1.map((c) => c.coinObjectId));
|
|
858
|
+
const [depositCoinA] = txb.splitCoins(coin1, [amount1]);
|
|
859
|
+
//coin2
|
|
860
|
+
[coin2] = txb.splitCoins(txb.object(coins2[0].coinObjectId), [0]);
|
|
861
|
+
txb.mergeCoins(coin2, coins2.map((c) => c.coinObjectId));
|
|
862
|
+
const [depositCoinB] = txb.splitCoins(coin2, [amount2]);
|
|
863
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
864
|
+
let someReceipt;
|
|
865
|
+
if (receipt.length == 0) {
|
|
866
|
+
[someReceipt] = txb.moveCall({
|
|
867
|
+
target: `0x1::option::none`,
|
|
868
|
+
typeArguments: [poolinfo.receiptType],
|
|
869
|
+
arguments: [],
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
[someReceipt] = txb.moveCall({
|
|
874
|
+
target: `0x1::option::some`,
|
|
875
|
+
typeArguments: [receipt[0].content.type],
|
|
876
|
+
arguments: [txb.object(receipt[0].objectId)],
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
880
|
+
txb.moveCall({
|
|
881
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_first_pool::user_deposit`,
|
|
882
|
+
typeArguments: [
|
|
883
|
+
coins_js_1.coinsList[pool1].type,
|
|
884
|
+
coins_js_1.coinsList[pool2].type,
|
|
885
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
886
|
+
],
|
|
887
|
+
arguments: [
|
|
888
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_STSUI_VERSION),
|
|
889
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
890
|
+
someReceipt,
|
|
891
|
+
txb.object(poolinfo.poolId),
|
|
892
|
+
depositCoinA,
|
|
893
|
+
depositCoinB,
|
|
894
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
895
|
+
txb.object(poolinfo.investorId),
|
|
896
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
897
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
898
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
899
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
900
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
901
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
902
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
903
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
904
|
+
txb.pure.bool(true),
|
|
905
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
906
|
+
],
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
else if (poolName === "BLUEFIN-ALPHA-STSUI") {
|
|
910
|
+
txb.moveCall({
|
|
911
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_second_pool::user_deposit`,
|
|
912
|
+
typeArguments: [
|
|
913
|
+
coins_js_1.coinsList[pool1].type,
|
|
914
|
+
coins_js_1.coinsList[pool2].type,
|
|
915
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
916
|
+
],
|
|
917
|
+
arguments: [
|
|
918
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_STSUI_VERSION),
|
|
919
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
920
|
+
someReceipt,
|
|
921
|
+
txb.object(poolinfo.poolId),
|
|
922
|
+
depositCoinA,
|
|
923
|
+
depositCoinB,
|
|
924
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
925
|
+
txb.object(poolinfo.investorId),
|
|
926
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
927
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
928
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_STSUI_POOL),
|
|
929
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
930
|
+
txb.object(maps_js_1.cetusPoolMap["ALPHA-SUI"]),
|
|
931
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-ALPHA"]),
|
|
932
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
933
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
934
|
+
txb.pure.bool(false),
|
|
935
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
936
|
+
],
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
txb.transferObjects([coin1], address);
|
|
940
|
+
txb.transferObjects([coin2], address);
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return txb;
|
|
947
|
+
};
|
|
948
|
+
exports.depositBluefinStsuiTxb = depositBluefinStsuiTxb;
|
|
949
|
+
const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
950
|
+
const address = options.address;
|
|
951
|
+
const txb = new transactions_1.Transaction();
|
|
952
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
953
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
954
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
955
|
+
const alphaReceipt = await (0, getReceipts_js_1.getReceipts)("ALPHA", address, true);
|
|
956
|
+
if (receipt.length > 0) {
|
|
957
|
+
let alpha_receipt;
|
|
958
|
+
if (alphaReceipt.length == 0) {
|
|
959
|
+
[alpha_receipt] = txb.moveCall({
|
|
960
|
+
target: `0x1::option::none`,
|
|
961
|
+
typeArguments: [(0, constants_js_1.getConf)().ALPHA_POOL_RECEIPT],
|
|
962
|
+
arguments: [],
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
[alpha_receipt] = txb.moveCall({
|
|
967
|
+
target: `0x1::option::some`,
|
|
968
|
+
typeArguments: [alphaReceipt[0].content.type],
|
|
969
|
+
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
973
|
+
if (poolName === "BLUEFIN-SUI-USDC") {
|
|
974
|
+
txb.moveCall({
|
|
975
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_withdraw`,
|
|
976
|
+
typeArguments: [
|
|
977
|
+
coins_js_1.coinsList[pool1].type,
|
|
978
|
+
coins_js_1.coinsList[pool2].type,
|
|
979
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
980
|
+
coins_js_1.coinsList["SUI"].type,
|
|
981
|
+
],
|
|
982
|
+
arguments: [
|
|
983
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
984
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
985
|
+
txb.object(receipt[0].objectId),
|
|
986
|
+
alpha_receipt,
|
|
987
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
988
|
+
txb.object(poolinfo.poolId),
|
|
989
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
990
|
+
txb.object(poolinfo.investorId),
|
|
991
|
+
txb.pure.u128(xTokens),
|
|
992
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
993
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
994
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
995
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
996
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
997
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
998
|
+
],
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
else if (poolName === "BLUEFIN-SUI-BUCK") {
|
|
1002
|
+
txb.moveCall({
|
|
1003
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_withdraw`,
|
|
1004
|
+
typeArguments: [
|
|
1005
|
+
coins_js_1.coinsList[pool1].type,
|
|
1006
|
+
coins_js_1.coinsList[pool2].type,
|
|
1007
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1008
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1009
|
+
],
|
|
1010
|
+
arguments: [
|
|
1011
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1012
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1013
|
+
txb.object(receipt[0].objectId),
|
|
1014
|
+
alpha_receipt,
|
|
1015
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1016
|
+
txb.object(poolinfo.poolId),
|
|
1017
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1018
|
+
txb.object(poolinfo.investorId),
|
|
1019
|
+
txb.pure.u128(xTokens),
|
|
1020
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1021
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1022
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_BUCK_POOL),
|
|
1023
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1024
|
+
txb.object(maps_js_1.cetusPoolMap["BUCK-SUI"]),
|
|
1025
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1026
|
+
],
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
else if (poolName === "BLUEFIN-SUI-AUSD") {
|
|
1030
|
+
txb.moveCall({
|
|
1031
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_withdraw`,
|
|
1032
|
+
typeArguments: [
|
|
1033
|
+
coins_js_1.coinsList[pool1].type,
|
|
1034
|
+
coins_js_1.coinsList[pool2].type,
|
|
1035
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1036
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1037
|
+
],
|
|
1038
|
+
arguments: [
|
|
1039
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1040
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1041
|
+
txb.object(receipt[0].objectId),
|
|
1042
|
+
alpha_receipt,
|
|
1043
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1044
|
+
txb.object(poolinfo.poolId),
|
|
1045
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1046
|
+
txb.object(poolinfo.investorId),
|
|
1047
|
+
txb.pure.u128(xTokens),
|
|
1048
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1049
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1050
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_AUSD_POOL),
|
|
1051
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1052
|
+
txb.object(maps_js_1.cetusPoolMap["AUSD-SUI"]),
|
|
1053
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1054
|
+
],
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
else {
|
|
1059
|
+
throw new Error("No receipt found!");
|
|
1060
|
+
}
|
|
1061
|
+
return txb;
|
|
1062
|
+
};
|
|
1063
|
+
exports.withdrawBluefinSuiFirstTxb = withdrawBluefinSuiFirstTxb;
|
|
1064
|
+
const withdrawBluefinSuiSecondTxb = async (xTokens, poolName, options) => {
|
|
1065
|
+
const address = options.address;
|
|
1066
|
+
const txb = new transactions_1.Transaction();
|
|
1067
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
1068
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
1069
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
1070
|
+
const alphaReceipt = await (0, getReceipts_js_1.getReceipts)("ALPHA", address, true);
|
|
1071
|
+
if (receipt.length > 0) {
|
|
1072
|
+
let alpha_receipt;
|
|
1073
|
+
if (alphaReceipt.length == 0) {
|
|
1074
|
+
[alpha_receipt] = txb.moveCall({
|
|
1075
|
+
target: `0x1::option::none`,
|
|
1076
|
+
typeArguments: [(0, constants_js_1.getConf)().ALPHA_POOL_RECEIPT],
|
|
1077
|
+
arguments: [],
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
else {
|
|
1081
|
+
[alpha_receipt] = txb.moveCall({
|
|
1082
|
+
target: `0x1::option::some`,
|
|
1083
|
+
typeArguments: [alphaReceipt[0].content.type],
|
|
1084
|
+
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
1088
|
+
if (poolName === "BLUEFIN-BLUE-SUI") {
|
|
1089
|
+
txb.moveCall({
|
|
1090
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_withdraw`,
|
|
1091
|
+
typeArguments: [
|
|
1092
|
+
coins_js_1.coinsList[pool1].type,
|
|
1093
|
+
coins_js_1.coinsList[pool2].type,
|
|
1094
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
1095
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1096
|
+
],
|
|
1097
|
+
arguments: [
|
|
1098
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
518
1099
|
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
519
1100
|
txb.object(receipt[0].objectId),
|
|
520
1101
|
alpha_receipt,
|
|
@@ -525,20 +1106,20 @@ const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
|
525
1106
|
txb.pure.u128(xTokens),
|
|
526
1107
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
527
1108
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
528
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1109
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
529
1110
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
530
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
1111
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-SUI"]),
|
|
531
1112
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
532
1113
|
],
|
|
533
1114
|
});
|
|
534
1115
|
}
|
|
535
|
-
else if (poolName === "BLUEFIN-SUI
|
|
1116
|
+
else if (poolName === "BLUEFIN-WBTC-SUI") {
|
|
536
1117
|
txb.moveCall({
|
|
537
|
-
target: `${poolinfo.packageId}::
|
|
1118
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_withdraw`,
|
|
538
1119
|
typeArguments: [
|
|
539
1120
|
coins_js_1.coinsList[pool1].type,
|
|
540
1121
|
coins_js_1.coinsList[pool2].type,
|
|
541
|
-
coins_js_1.coinsList["
|
|
1122
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
542
1123
|
coins_js_1.coinsList["SUI"].type,
|
|
543
1124
|
],
|
|
544
1125
|
arguments: [
|
|
@@ -553,20 +1134,20 @@ const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
|
553
1134
|
txb.pure.u128(xTokens),
|
|
554
1135
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
555
1136
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
556
|
-
txb.object((0, constants_js_1.getConf)().
|
|
557
|
-
txb.object((0, constants_js_1.getConf)().
|
|
558
|
-
txb.object(maps_js_1.cetusPoolMap["
|
|
1137
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_SUI_POOL),
|
|
1138
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1139
|
+
txb.object(maps_js_1.cetusPoolMap["WBTC-SUI"]),
|
|
559
1140
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
560
1141
|
],
|
|
561
1142
|
});
|
|
562
1143
|
}
|
|
563
|
-
else if (poolName === "BLUEFIN-SUI
|
|
1144
|
+
else if (poolName === "BLUEFIN-DEEP-SUI") {
|
|
564
1145
|
txb.moveCall({
|
|
565
|
-
target: `${poolinfo.packageId}::
|
|
1146
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_withdraw`,
|
|
566
1147
|
typeArguments: [
|
|
567
1148
|
coins_js_1.coinsList[pool1].type,
|
|
568
1149
|
coins_js_1.coinsList[pool2].type,
|
|
569
|
-
coins_js_1.coinsList["
|
|
1150
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
570
1151
|
coins_js_1.coinsList["SUI"].type,
|
|
571
1152
|
],
|
|
572
1153
|
arguments: [
|
|
@@ -581,9 +1162,36 @@ const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
|
581
1162
|
txb.pure.u128(xTokens),
|
|
582
1163
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
583
1164
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
584
|
-
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_AUSD_POOL),
|
|
585
1165
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
586
|
-
txb.object(
|
|
1166
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1167
|
+
txb.object(maps_js_1.cetusPoolMap["DEEP-SUI"]),
|
|
1168
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1169
|
+
],
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
else if (poolName === "BLUEFIN-STSUI-SUI") {
|
|
1173
|
+
txb.moveCall({
|
|
1174
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_sui_pool::user_withdraw`,
|
|
1175
|
+
typeArguments: [
|
|
1176
|
+
coins_js_1.coinsList[pool1].type,
|
|
1177
|
+
coins_js_1.coinsList[pool2].type,
|
|
1178
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1179
|
+
],
|
|
1180
|
+
arguments: [
|
|
1181
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1182
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1183
|
+
txb.object(receipt[0].objectId),
|
|
1184
|
+
alpha_receipt,
|
|
1185
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1186
|
+
txb.object(poolinfo.poolId),
|
|
1187
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1188
|
+
txb.object(poolinfo.investorId),
|
|
1189
|
+
txb.pure.u128(xTokens),
|
|
1190
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1191
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_SUI_POOL),
|
|
1192
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1193
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1194
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
587
1195
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
588
1196
|
],
|
|
589
1197
|
});
|
|
@@ -594,7 +1202,7 @@ const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
|
594
1202
|
}
|
|
595
1203
|
return txb;
|
|
596
1204
|
};
|
|
597
|
-
exports.
|
|
1205
|
+
exports.withdrawBluefinSuiSecondTxb = withdrawBluefinSuiSecondTxb;
|
|
598
1206
|
const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
599
1207
|
const address = options.address;
|
|
600
1208
|
const txb = new transactions_1.Transaction();
|
|
@@ -625,7 +1233,7 @@ const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
625
1233
|
typeArguments: [
|
|
626
1234
|
coins_js_1.coinsList[pool1].type,
|
|
627
1235
|
coins_js_1.coinsList[pool2].type,
|
|
628
|
-
coins_js_1.coinsList["
|
|
1236
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
629
1237
|
coins_js_1.coinsList["SUI"].type,
|
|
630
1238
|
],
|
|
631
1239
|
arguments: [
|
|
@@ -641,7 +1249,7 @@ const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
641
1249
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
642
1250
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
643
1251
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
644
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1252
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
645
1253
|
txb.object(maps_js_1.cetusPoolMap["USDC-USDT"]),
|
|
646
1254
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
647
1255
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -654,7 +1262,7 @@ const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
654
1262
|
typeArguments: [
|
|
655
1263
|
coins_js_1.coinsList[pool1].type,
|
|
656
1264
|
coins_js_1.coinsList[pool2].type,
|
|
657
|
-
coins_js_1.coinsList["
|
|
1265
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
658
1266
|
coins_js_1.coinsList["SUI"].type,
|
|
659
1267
|
],
|
|
660
1268
|
arguments: [
|
|
@@ -670,7 +1278,7 @@ const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
670
1278
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
671
1279
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
672
1280
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_AUSD_USDC_POOL),
|
|
673
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1281
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
674
1282
|
txb.object(maps_js_1.cetusPoolMap["USDC-AUSD"]),
|
|
675
1283
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
676
1284
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -683,7 +1291,7 @@ const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
683
1291
|
typeArguments: [
|
|
684
1292
|
coins_js_1.coinsList[pool1].type,
|
|
685
1293
|
coins_js_1.coinsList[pool2].type,
|
|
686
|
-
coins_js_1.coinsList["
|
|
1294
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
687
1295
|
coins_js_1.coinsList["SUI"].type,
|
|
688
1296
|
],
|
|
689
1297
|
arguments: [
|
|
@@ -699,13 +1307,71 @@ const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
699
1307
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
700
1308
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
701
1309
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
702
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1310
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
703
1311
|
txb.object(maps_js_1.cetusPoolMap["USDC-WBTC"]),
|
|
704
1312
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
705
1313
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
706
1314
|
],
|
|
707
1315
|
});
|
|
708
1316
|
}
|
|
1317
|
+
else if (poolName === "BLUEFIN-SEND-USDC") {
|
|
1318
|
+
txb.moveCall({
|
|
1319
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_withdraw`,
|
|
1320
|
+
typeArguments: [
|
|
1321
|
+
coins_js_1.coinsList[pool1].type,
|
|
1322
|
+
coins_js_1.coinsList[pool2].type,
|
|
1323
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1324
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1325
|
+
],
|
|
1326
|
+
arguments: [
|
|
1327
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1328
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1329
|
+
txb.object(receipt[0].objectId),
|
|
1330
|
+
alpha_receipt,
|
|
1331
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1332
|
+
txb.object(poolinfo.poolId),
|
|
1333
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1334
|
+
txb.object(poolinfo.investorId),
|
|
1335
|
+
txb.pure.u128(xTokens),
|
|
1336
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1337
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1338
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SEND_USDC_POOL),
|
|
1339
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1340
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SEND"]),
|
|
1341
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1342
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1343
|
+
],
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
else if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
1347
|
+
txb.moveCall({
|
|
1348
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_withdraw`,
|
|
1349
|
+
typeArguments: [
|
|
1350
|
+
coins_js_1.coinsList[pool1].type,
|
|
1351
|
+
coins_js_1.coinsList[pool2].type,
|
|
1352
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1353
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1354
|
+
],
|
|
1355
|
+
arguments: [
|
|
1356
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1357
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1358
|
+
txb.object(receipt[0].objectId),
|
|
1359
|
+
alpha_receipt,
|
|
1360
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1361
|
+
txb.object(poolinfo.poolId),
|
|
1362
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1363
|
+
txb.object(poolinfo.investorId),
|
|
1364
|
+
txb.pure.u128(xTokens),
|
|
1365
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1366
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1367
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
1368
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1369
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-STSUI"]),
|
|
1370
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1371
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1372
|
+
],
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
709
1375
|
}
|
|
710
1376
|
else {
|
|
711
1377
|
throw new Error("No receipt found!");
|
|
@@ -743,7 +1409,7 @@ const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
743
1409
|
typeArguments: [
|
|
744
1410
|
coins_js_1.coinsList[pool1].type,
|
|
745
1411
|
coins_js_1.coinsList[pool2].type,
|
|
746
|
-
coins_js_1.coinsList["
|
|
1412
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
747
1413
|
coins_js_1.coinsList["SUI"].type,
|
|
748
1414
|
],
|
|
749
1415
|
arguments: [
|
|
@@ -759,7 +1425,7 @@ const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
759
1425
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
760
1426
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
761
1427
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_USDC_POOL),
|
|
762
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1428
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
763
1429
|
txb.object(maps_js_1.cetusPoolMap["ALPHA-USDC"]),
|
|
764
1430
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
765
1431
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -772,7 +1438,7 @@ const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
772
1438
|
typeArguments: [
|
|
773
1439
|
coins_js_1.coinsList[pool1].type,
|
|
774
1440
|
coins_js_1.coinsList[pool2].type,
|
|
775
|
-
coins_js_1.coinsList["
|
|
1441
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
776
1442
|
coins_js_1.coinsList["SUI"].type,
|
|
777
1443
|
],
|
|
778
1444
|
arguments: [
|
|
@@ -788,13 +1454,100 @@ const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
788
1454
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
789
1455
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
790
1456
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_NAVX_VSUI_POOL),
|
|
791
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1457
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
792
1458
|
txb.object(maps_js_1.cetusPoolMap["NAVX-VSUI"]),
|
|
793
1459
|
txb.object(maps_js_1.cetusPoolMap["VSUI-SUI"]),
|
|
794
1460
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
795
1461
|
],
|
|
796
1462
|
});
|
|
797
1463
|
}
|
|
1464
|
+
else if (poolName === "BLUEFIN-BLUE-USDC") {
|
|
1465
|
+
txb.moveCall({
|
|
1466
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
1467
|
+
typeArguments: [
|
|
1468
|
+
coins_js_1.coinsList[pool1].type,
|
|
1469
|
+
coins_js_1.coinsList[pool2].type,
|
|
1470
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
1471
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1472
|
+
],
|
|
1473
|
+
arguments: [
|
|
1474
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1475
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1476
|
+
txb.object(receipt[0].objectId),
|
|
1477
|
+
alpha_receipt,
|
|
1478
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1479
|
+
txb.object(poolinfo.poolId),
|
|
1480
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1481
|
+
txb.object(poolinfo.investorId),
|
|
1482
|
+
txb.pure.u128(xTokens),
|
|
1483
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1484
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1485
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_USDC_POOL),
|
|
1486
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
1487
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-USDC"]),
|
|
1488
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1489
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1490
|
+
],
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
else if (poolName === "BLUEFIN-STSUI-ETH") {
|
|
1494
|
+
txb.moveCall({
|
|
1495
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
1496
|
+
typeArguments: [
|
|
1497
|
+
coins_js_1.coinsList[pool1].type,
|
|
1498
|
+
coins_js_1.coinsList[pool2].type,
|
|
1499
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1500
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1501
|
+
],
|
|
1502
|
+
arguments: [
|
|
1503
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1504
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1505
|
+
txb.object(receipt[0].objectId),
|
|
1506
|
+
alpha_receipt,
|
|
1507
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1508
|
+
txb.object(poolinfo.poolId),
|
|
1509
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1510
|
+
txb.object(poolinfo.investorId),
|
|
1511
|
+
txb.pure.u128(xTokens),
|
|
1512
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1513
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1514
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_ETH_POOL),
|
|
1515
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1516
|
+
txb.object(maps_js_1.cetusPoolMap["STSUI-ETH"]),
|
|
1517
|
+
txb.object(maps_js_1.cetusPoolMap["ETH-SUI"]),
|
|
1518
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1519
|
+
],
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
else if (poolName === "BLUEFIN-STSUI-WSOL") {
|
|
1523
|
+
txb.moveCall({
|
|
1524
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
1525
|
+
typeArguments: [
|
|
1526
|
+
coins_js_1.coinsList[pool1].type,
|
|
1527
|
+
coins_js_1.coinsList[pool2].type,
|
|
1528
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1529
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1530
|
+
],
|
|
1531
|
+
arguments: [
|
|
1532
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1533
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1534
|
+
txb.object(receipt[0].objectId),
|
|
1535
|
+
alpha_receipt,
|
|
1536
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1537
|
+
txb.object(poolinfo.poolId),
|
|
1538
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1539
|
+
txb.object(poolinfo.investorId),
|
|
1540
|
+
txb.pure.u128(xTokens),
|
|
1541
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1542
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1543
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_WSOL_POOL),
|
|
1544
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1545
|
+
txb.object(maps_js_1.cetusPoolMap["STSUI-WSOL"]),
|
|
1546
|
+
txb.object(maps_js_1.cetusPoolMap["WSOL-SUI"]),
|
|
1547
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1548
|
+
],
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
798
1551
|
}
|
|
799
1552
|
else {
|
|
800
1553
|
throw new Error("No receipt found!");
|
|
@@ -802,4 +1555,97 @@ const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
802
1555
|
return txb;
|
|
803
1556
|
};
|
|
804
1557
|
exports.withdrawBluefinType2Txb = withdrawBluefinType2Txb;
|
|
1558
|
+
const withdrawBluefinStsuiTxb = async (xTokens, poolName, options) => {
|
|
1559
|
+
const address = options.address;
|
|
1560
|
+
const txb = new transactions_1.Transaction();
|
|
1561
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
1562
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
1563
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
1564
|
+
const alphaReceipt = await (0, getReceipts_js_1.getReceipts)("ALPHA", address, true);
|
|
1565
|
+
if (receipt.length > 0) {
|
|
1566
|
+
let alpha_receipt;
|
|
1567
|
+
if (alphaReceipt.length == 0) {
|
|
1568
|
+
[alpha_receipt] = txb.moveCall({
|
|
1569
|
+
target: `0x1::option::none`,
|
|
1570
|
+
typeArguments: [(0, constants_js_1.getConf)().ALPHA_POOL_RECEIPT],
|
|
1571
|
+
arguments: [],
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
else {
|
|
1575
|
+
[alpha_receipt] = txb.moveCall({
|
|
1576
|
+
target: `0x1::option::some`,
|
|
1577
|
+
typeArguments: [alphaReceipt[0].content.type],
|
|
1578
|
+
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
1582
|
+
if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
1583
|
+
txb.moveCall({
|
|
1584
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_first_pool::user_withdraw`,
|
|
1585
|
+
typeArguments: [
|
|
1586
|
+
coins_js_1.coinsList[pool1].type,
|
|
1587
|
+
coins_js_1.coinsList[pool2].type,
|
|
1588
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1589
|
+
],
|
|
1590
|
+
arguments: [
|
|
1591
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_STSUI_VERSION),
|
|
1592
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1593
|
+
txb.object(receipt[0].objectId),
|
|
1594
|
+
alpha_receipt,
|
|
1595
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1596
|
+
txb.object(poolinfo.poolId),
|
|
1597
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1598
|
+
txb.object(poolinfo.investorId),
|
|
1599
|
+
txb.pure.u128(xTokens),
|
|
1600
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1601
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1602
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
1603
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1604
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1605
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
1606
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1607
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1608
|
+
txb.pure.bool(true),
|
|
1609
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1610
|
+
],
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
else if (poolName === "BLUEFIN-ALPHA-STSUI") {
|
|
1614
|
+
txb.moveCall({
|
|
1615
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_second_pool::user_withdraw`,
|
|
1616
|
+
typeArguments: [
|
|
1617
|
+
coins_js_1.coinsList[pool1].type,
|
|
1618
|
+
coins_js_1.coinsList[pool2].type,
|
|
1619
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1620
|
+
],
|
|
1621
|
+
arguments: [
|
|
1622
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_STSUI_VERSION),
|
|
1623
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1624
|
+
txb.object(receipt[0].objectId),
|
|
1625
|
+
alpha_receipt,
|
|
1626
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
1627
|
+
txb.object(poolinfo.poolId),
|
|
1628
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1629
|
+
txb.object(poolinfo.investorId),
|
|
1630
|
+
txb.pure.u128(xTokens),
|
|
1631
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1632
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1633
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_STSUI_POOL),
|
|
1634
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
1635
|
+
txb.object(maps_js_1.cetusPoolMap["ALPHA-SUI"]),
|
|
1636
|
+
txb.object(maps_js_1.bluefinPoolMap["SUI-ALPHA"]),
|
|
1637
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1638
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1639
|
+
txb.pure.bool(false),
|
|
1640
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1641
|
+
],
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
else {
|
|
1646
|
+
throw new Error("No receipt found!");
|
|
1647
|
+
}
|
|
1648
|
+
return txb;
|
|
1649
|
+
};
|
|
1650
|
+
exports.withdrawBluefinStsuiTxb = withdrawBluefinStsuiTxb;
|
|
805
1651
|
//# sourceMappingURL=bluefin.js.map
|