@alphafi/alphafi-sdk 0.0.40 → 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/common/coins.d.ts.map +1 -1
- package/dist/cjs/common/coins.js +6 -0
- package/dist/cjs/common/coins.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +153 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +118 -3
- 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 +107 -1
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/types.d.ts +4 -4
- 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 +4 -9
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +10 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +4 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +41 -25
- 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 +6 -0
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
- package/dist/cjs/transactions/bluefin.js +475 -6
- 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 +68 -0
- 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 +8 -1
- 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/common/coins.d.ts.map +1 -1
- package/dist/esm/common/coins.js +6 -0
- package/dist/esm/common/coins.js.map +1 -1
- package/dist/esm/common/constants.d.ts +153 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +118 -3
- 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 +106 -0
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/types.d.ts +4 -4
- 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 +4 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +2 -2
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +4 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +42 -25
- 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 +6 -0
- package/dist/esm/transactions/bluefin.d.ts.map +1 -1
- package/dist/esm/transactions/bluefin.js +469 -2
- 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 +65 -1
- 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 +9 -2
- 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 +51 -74
- package/docs/assets/icons.js +17 -20
- package/docs/assets/main.js +5 -2163
- package/docs/assets/navigation.js +1 -2
- package/docs/assets/search.js +1 -2
- package/docs/assets/style.css +850 -846
- package/docs/functions/alphaLpBreakdown.html +1 -253
- package/docs/functions/cetusLpBreakdown.html +1 -253
- package/docs/functions/claimRewardTxb.html +1 -243
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +1 -267
- package/docs/functions/coinAmountToXTokensSingleAsset.html +1 -260
- package/docs/functions/coinsInPool.html +1 -438
- package/docs/functions/collectRewards.html +1 -242
- package/docs/functions/deposit.html +1 -246
- package/docs/functions/depositDoubleAssetTxb.html +1 -270
- package/docs/functions/depositSingleAssetTxb.html +1 -263
- package/docs/functions/fetchAfterTransactionEvents.html +1 -306
- package/docs/functions/fetchAutoCompoundingEvents.html +1 -257
- package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -251
- package/docs/functions/fetchCetusPools.html +1 -231
- package/docs/functions/fetchChainIdentifier.html +1 -233
- package/docs/functions/fetchCheckRatioEvents.html +1 -249
- package/docs/functions/fetchLiquidityChangeEvents.html +1 -257
- package/docs/functions/fetchMultiReceipts.html +1 -261
- package/docs/functions/fetchNftHolders.html +1 -233
- package/docs/functions/fetchPools.html +1 -230
- package/docs/functions/fetchPortfolioData.html +1 -243
- package/docs/functions/fetchProtocolData.html +1 -231
- package/docs/functions/fetchTVL.html +1 -253
- package/docs/functions/fetchUserVaultBalances.html +1 -245
- package/docs/functions/fetchUserVaults.html +1 -243
- package/docs/functions/fetchUserWalletData.html +1 -243
- package/docs/functions/fetchWithdrawV2Events.html +1 -255
- package/docs/functions/getAirdropShare.html +1 -243
- package/docs/functions/getAllDoubleAssetVaults.html +1 -235
- package/docs/functions/getAllSingleAssetVaults.html +1 -235
- package/docs/functions/getAllVaultBalances.html +1 -265
- package/docs/functions/getAllVaults.html +1 -233
- package/docs/functions/getAlphaUnlocks.html +1 -245
- package/docs/functions/getAlphaVaultBalance.html +1 -255
- package/docs/functions/getAmounts.html +1 -272
- package/docs/functions/getApr.html +1 -243
- package/docs/functions/getAprs.html +1 -255
- package/docs/functions/getApy.html +1 -243
- package/docs/functions/getApys.html +1 -255
- package/docs/functions/getCetusInvestorTicksMap.html +1 -284
- package/docs/functions/getCetusSqrtPriceMap.html +1 -249
- package/docs/functions/getCoinAmountsFromLiquidity.html +1 -266
- package/docs/functions/getConf.html +1 -9882
- package/docs/functions/getCurrentTick.html +1 -247
- package/docs/functions/getDoubleAssetVaultBalance.html +1 -268
- package/docs/functions/getDoubleAssetVaults.html +1 -253
- package/docs/functions/getHoldersFromTransactions.html +1 -299
- package/docs/functions/getInvestor.html +1 -259
- package/docs/functions/getInvestorPoolMap.html +1 -241
- package/docs/functions/getLastAutoCompoundTime.html +1 -249
- package/docs/functions/getLatestPrices.html +1 -0
- package/docs/functions/getLiquidity.html +1 -260
- 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 -256
- package/docs/functions/getPool.html +1 -262
- package/docs/functions/getPoolExchangeRateMap.html +1 -249
- package/docs/functions/getPositionRange.html +1 -0
- package/docs/functions/getPositionTicks.html +1 -249
- package/docs/functions/getPriceToTick.html +1 -254
- package/docs/functions/getRebalanceHistories.html +1 -269
- package/docs/functions/getRebalanceHistory.html +1 -255
- package/docs/functions/getReceipts.html +1 -268
- package/docs/functions/getSingleAssetVaultBalance.html +1 -268
- package/docs/functions/getSingleAssetVaults.html +1 -253
- package/docs/functions/getSuiClient.html +3 -247
- package/docs/functions/getSuiNodeUrl.html +3 -232
- package/docs/functions/getTVLs.html +1 -243
- package/docs/functions/getTickToPrice.html +1 -254
- package/docs/functions/getUserTokensFromTransactions.html +1 -269
- package/docs/functions/getUserTokensInUsdFromTransactions.html +1 -263
- package/docs/functions/getVaultBalance.html +1 -277
- package/docs/functions/getVaultBalanceForActiveUsers.html +1 -261
- package/docs/functions/getVaults.html +1 -250
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +1 -261
- package/docs/functions/getZapAmounts.html +1 -0
- package/docs/functions/lastAutocompoundTime.html +1 -249
- package/docs/functions/liquidityToTokens.html +1 -253
- package/docs/functions/multiLiquidityToTokens.html +1 -271
- package/docs/functions/multiTokensToUsd.html +1 -262
- package/docs/functions/multiXTokensToLiquidity.html +1 -257
- package/docs/functions/parseUserWalletData.html +1 -243
- package/docs/functions/setSuiClient.html +7 -255
- package/docs/functions/setSuiNodeUrl.html +5 -249
- package/docs/functions/withdraw.html +1 -249
- package/docs/functions/withdrawAlphaTxb.html +1 -257
- package/docs/functions/withdrawTxb.html +1 -260
- package/docs/functions/zapDepositTxb.html +1 -0
- package/docs/index.html +41 -587
- package/docs/interfaces/Coin.html +12 -474
- package/docs/interfaces/CoinPair.html +3 -358
- package/docs/interfaces/NaviVoloData.html +3 -514
- package/docs/interfaces/RebalanceHistoryType.html +9 -652
- package/docs/modules.html +177 -1440
- package/docs/types/AfterTransactionEventNode.html +1 -305
- package/docs/types/Allocator.html +1 -321
- package/docs/types/AlphaFiDoubleAssetVault.html +1 -258
- package/docs/types/AlphaFiMultiVaultBalance.html +1 -219
- package/docs/types/AlphaFiSingleAssetVault.html +1 -244
- package/docs/types/AlphaFiVault.html +1 -214
- package/docs/types/AlphaFiVaultBalance.html +1 -220
- package/docs/types/AlphaPoolType.html +1 -383
- package/docs/types/AlphaReceipt.html +1 -220
- package/docs/types/AlphaReceiptFields.html +1 -421
- package/docs/types/AlphaVaultBalance.html +1 -245
- package/docs/types/AutoCompoundingEventNode.html +1 -225
- package/docs/types/BluefinInvestor.html +1 -209
- package/docs/types/BluefinPoolType.html +1 -209
- package/docs/types/BucketInvestor.html +1 -249
- package/docs/types/CetusInvestor.html +1 -240
- package/docs/types/CetusPoolType.html +1 -433
- package/docs/types/CetusSwapOptions.html +1 -209
- package/docs/types/CoinAmounts.html +1 -216
- package/docs/types/CoinName.html +1 -281
- package/docs/types/CoinType.html +1 -282
- package/docs/types/CommonInvestorFields.html +1 -276
- package/docs/types/CreatePoolOptions.html +1 -246
- package/docs/types/Distributor.html +1 -341
- package/docs/types/DoubleAssetMultiVaultBalance.html +1 -236
- package/docs/types/DoubleAssetPoolNames.html +1 -267
- package/docs/types/DoubleAssetTokenHoldings.html +1 -232
- package/docs/types/DoubleAssetVaultBalance.html +1 -229
- package/docs/types/GetHoldersParams.html +1 -221
- package/docs/types/GetTokenHoldingsParams.html +1 -227
- package/docs/types/GetUserTokensFromTransactionsParams.html +1 -233
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +1 -244
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +1 -231
- package/docs/types/GetVaultBalanceParams.html +1 -217
- package/docs/types/HoldingsObj.html +1 -223
- package/docs/types/Icon.html +1 -266
- package/docs/types/Investor.html +1 -245
- package/docs/types/LiquidityChangeEventNode.html +1 -220
- package/docs/types/LiquidityToTokensParams.html +1 -255
- package/docs/types/LiquidityToUsdParams.html +1 -267
- package/docs/types/LoopingDebt.html +1 -258
- package/docs/types/LpBreakdownType.html +1 -238
- package/docs/types/MemberPoolDataType.html +1 -276
- package/docs/types/MemberType.html +1 -269
- package/docs/types/MultiGetVaultBalancesParams.html +1 -229
- package/docs/types/NaviInvestor.html +1 -235
- package/docs/types/OtherReceiptFields.html +1 -373
- package/docs/types/PoolName.html +1 -304
- package/docs/types/PoolReceipt.html +1 -253
- package/docs/types/PoolType.html +1 -388
- package/docs/types/Receipt.html +1 -475
- package/docs/types/ReceiptGQL.html +1 -374
- package/docs/types/SingleAssetMultiVaultBalance.html +1 -232
- package/docs/types/SingleAssetPoolNames.html +1 -247
- package/docs/types/SingleAssetTokenHoldings.html +1 -228
- package/docs/types/SingleAssetVaultBalance.html +1 -223
- package/docs/types/SingleGetVaultBalancesParams.html +1 -224
- package/docs/types/StrategyType.html +1 -217
- package/docs/types/SuiNetwork.html +1 -213
- package/docs/types/SwapOptions.html +1 -248
- package/docs/types/TickSpacing.html +1 -212
- package/docs/types/TotalWeightType.html +1 -246
- package/docs/types/TransactionBlockType.html +1 -358
- package/docs/types/UserPoolLiquidity.html +1 -221
- package/docs/types/UserPoolTokenHoldings.html +1 -217
- package/docs/types/UserUsdHoldings.html +1 -223
- package/docs/types/VaultBalance.html +1 -216
- package/docs/types/WithdrawV2EventNode.html +1 -208
- package/docs/variables/bluefinPoolMap.html +1 -214
- package/docs/variables/cetusPoolMap.html +1 -214
- package/docs/variables/coinsList.html +1 -220
- package/docs/variables/defunctPoolsSet.html +1 -209
- package/docs/variables/doubleAssetPoolCoinMap.html +1 -237
- package/docs/variables/ignoredWalletsForDailyRevenue.html +1 -0
- package/docs/variables/loopingAccountAddresses.html +1 -219
- package/docs/variables/loopingPoolCoinMap.html +1 -233
- package/docs/variables/naviAssetMap.html +1 -215
- package/docs/variables/poolIdPoolNameMap.html +1 -218
- package/docs/variables/poolInfo.html +1 -304
- package/docs/variables/singleAssetPoolCoinMap.html +1 -229
- package/docs/variables/stableCoins.html +1 -207
- package/package.json +2 -1
- package/docs/functions/bucketDepositTx.html +0 -267
- package/docs/functions/bucketWithdrawTx.html +0 -267
- package/docs/functions/depositAlphaTxb.html +0 -250
- package/docs/functions/depositBluefinSuiFirstTxb.html +0 -302
- package/docs/functions/depositBluefinType1Txb.html +0 -300
- package/docs/functions/depositBluefinType2Txb.html +0 -300
- package/docs/functions/depositCetusAlphaSuiTxb.html +0 -300
- package/docs/functions/depositCetusSuiTxb.html +0 -298
- package/docs/functions/depositCetusTxb.html +0 -298
- package/docs/functions/loopingDeposit.html +0 -277
- package/docs/functions/loopingWithdraw.html +0 -278
- package/docs/functions/naviDepositTx.html +0 -278
- package/docs/functions/naviHasuiSuiLoopDepositTx.html +0 -271
- package/docs/functions/naviHasuiSuiLoopWithdrawTx.html +0 -271
- package/docs/functions/naviSuiVsuiLoopDepositTx.html +0 -271
- package/docs/functions/naviSuiVsuiLoopWithdrawTx.html +0 -271
- package/docs/functions/naviUsdcUsdtLoopDepositTx.html +0 -271
- package/docs/functions/naviUsdcUsdtLoopWithdrawTx.html +0 -271
- package/docs/functions/naviUsdtUsdcLoopDepositTx.html +0 -271
- package/docs/functions/naviUsdtUsdcLoopWithdrawTx.html +0 -271
- package/docs/functions/naviWithdrawTx.html +0 -278
- package/docs/functions/withdrawBluefinSuiFirstTxb.html +0 -282
- package/docs/functions/withdrawBluefinType1Txb.html +0 -280
- package/docs/functions/withdrawBluefinType2Txb.html +0 -280
- package/docs/functions/withdrawCetusAlphaSuiTxb.html +0 -282
- package/docs/functions/withdrawCetusSuiTxb.html +0 -278
- package/docs/functions/withdrawCetusTxb.html +0 -278
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withdrawBluefinType2Txb = exports.withdrawBluefinType1Txb = exports.withdrawBluefinSuiSecondTxb = exports.withdrawBluefinSuiFirstTxb = exports.depositBluefinType2Txb = exports.depositBluefinType1Txb = exports.depositBluefinSuiSecondTxb = 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];
|
|
@@ -188,7 +188,7 @@ const depositBluefinSuiSecondTxb = async (amount, poolName, isAmountA, options,
|
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
} while (true);
|
|
191
|
-
const amounts = await (0,
|
|
191
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
192
192
|
if (amounts) {
|
|
193
193
|
const amount1 = amounts[0];
|
|
194
194
|
const amount2 = amounts[1];
|
|
@@ -297,6 +297,32 @@ const depositBluefinSuiSecondTxb = async (amount, poolName, isAmountA, options,
|
|
|
297
297
|
],
|
|
298
298
|
});
|
|
299
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
|
+
}
|
|
300
326
|
txb.transferObjects([coin1], address);
|
|
301
327
|
}
|
|
302
328
|
else {
|
|
@@ -356,7 +382,7 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
356
382
|
break;
|
|
357
383
|
}
|
|
358
384
|
} while (true);
|
|
359
|
-
const amounts = await (0,
|
|
385
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
360
386
|
if (amounts) {
|
|
361
387
|
const amount1 = amounts[0];
|
|
362
388
|
const amount2 = amounts[1];
|
|
@@ -499,6 +525,34 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
499
525
|
],
|
|
500
526
|
});
|
|
501
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
|
+
}
|
|
502
556
|
txb.transferObjects([coin1], address);
|
|
503
557
|
txb.transferObjects([coin2], address);
|
|
504
558
|
}
|
|
@@ -559,7 +613,7 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
559
613
|
break;
|
|
560
614
|
}
|
|
561
615
|
} while (true);
|
|
562
|
-
const amounts = await (0,
|
|
616
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
563
617
|
if (amounts) {
|
|
564
618
|
const amount1 = amounts[0];
|
|
565
619
|
const amount2 = amounts[1];
|
|
@@ -674,6 +728,62 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
674
728
|
],
|
|
675
729
|
});
|
|
676
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
|
+
}
|
|
677
787
|
txb.transferObjects([coin1], address);
|
|
678
788
|
txb.transferObjects([coin2], address);
|
|
679
789
|
}
|
|
@@ -684,6 +794,158 @@ const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
684
794
|
return txb;
|
|
685
795
|
};
|
|
686
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;
|
|
687
949
|
const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
688
950
|
const address = options.address;
|
|
689
951
|
const txb = new transactions_1.Transaction();
|
|
@@ -907,6 +1169,33 @@ const withdrawBluefinSuiSecondTxb = async (xTokens, poolName, options) => {
|
|
|
907
1169
|
],
|
|
908
1170
|
});
|
|
909
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),
|
|
1195
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1196
|
+
],
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
910
1199
|
}
|
|
911
1200
|
else {
|
|
912
1201
|
throw new Error("No receipt found!");
|
|
@@ -1054,6 +1343,35 @@ const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
|
1054
1343
|
],
|
|
1055
1344
|
});
|
|
1056
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
|
+
}
|
|
1057
1375
|
}
|
|
1058
1376
|
else {
|
|
1059
1377
|
throw new Error("No receipt found!");
|
|
@@ -1172,6 +1490,64 @@ const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
1172
1490
|
],
|
|
1173
1491
|
});
|
|
1174
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
|
+
}
|
|
1175
1551
|
}
|
|
1176
1552
|
else {
|
|
1177
1553
|
throw new Error("No receipt found!");
|
|
@@ -1179,4 +1555,97 @@ const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
|
1179
1555
|
return txb;
|
|
1180
1556
|
};
|
|
1181
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;
|
|
1182
1651
|
//# sourceMappingURL=bluefin.js.map
|