@alphafi/alphafi-sdk 0.0.66 → 0.0.67
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 +12 -0
- package/dist/cjs/common/coins.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +116 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +73 -0
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts +6 -0
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +100 -1
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/pyth.d.ts +1 -1
- package/dist/cjs/common/pyth.d.ts.map +1 -1
- package/dist/cjs/common/pyth.js.map +1 -1
- package/dist/cjs/common/types.d.ts +17 -3
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js +17 -2
- package/dist/cjs/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/cjs/transactions/alpha.js +2 -2
- 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 +153 -1
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts +3 -3
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +25 -21
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/navi-looping.d.ts.map +1 -1
- package/dist/cjs/transactions/navi-looping.js +5 -0
- package/dist/cjs/transactions/navi-looping.js.map +1 -1
- package/dist/cjs/transactions/navi.d.ts.map +1 -1
- package/dist/cjs/transactions/navi.js +4 -1
- package/dist/cjs/transactions/navi.js.map +1 -1
- package/dist/cjs/transactions/naviOracle.d.ts +3 -0
- package/dist/cjs/transactions/naviOracle.d.ts.map +1 -0
- package/dist/cjs/transactions/naviOracle.js +18 -0
- package/dist/cjs/transactions/naviOracle.js.map +1 -0
- package/dist/cjs/transactions/withdraw.d.ts.map +1 -1
- package/dist/cjs/transactions/withdraw.js +8 -3
- package/dist/cjs/transactions/withdraw.js.map +1 -1
- package/dist/cjs/transactions/zapDeposit.d.ts +2 -6
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +1207 -1497
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/cjs/utils/prices.d.ts.map +1 -1
- package/dist/cjs/utils/prices.js +1 -1
- package/dist/cjs/utils/prices.js.map +1 -1
- package/dist/esm/common/coins.d.ts.map +1 -1
- package/dist/esm/common/coins.js +12 -0
- package/dist/esm/common/coins.js.map +1 -1
- package/dist/esm/common/constants.d.ts +116 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +73 -0
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts +6 -0
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +99 -0
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/pyth.d.ts +1 -1
- package/dist/esm/common/pyth.d.ts.map +1 -1
- package/dist/esm/common/pyth.js.map +1 -1
- package/dist/esm/common/types.d.ts +17 -3
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js +17 -2
- package/dist/esm/sui-sdk/functions/getPortfolioAmounts.js.map +1 -1
- package/dist/esm/transactions/alpha.js +2 -2
- 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 +151 -1
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts +3 -3
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +26 -22
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/navi-looping.d.ts.map +1 -1
- package/dist/esm/transactions/navi-looping.js +6 -1
- package/dist/esm/transactions/navi-looping.js.map +1 -1
- package/dist/esm/transactions/navi.d.ts.map +1 -1
- package/dist/esm/transactions/navi.js +5 -2
- package/dist/esm/transactions/navi.js.map +1 -1
- package/dist/esm/transactions/naviOracle.d.ts +3 -0
- package/dist/esm/transactions/naviOracle.d.ts.map +1 -0
- package/dist/esm/transactions/naviOracle.js +15 -0
- package/dist/esm/transactions/naviOracle.js.map +1 -0
- package/dist/esm/transactions/withdraw.d.ts.map +1 -1
- package/dist/esm/transactions/withdraw.js +9 -4
- package/dist/esm/transactions/withdraw.js.map +1 -1
- package/dist/esm/transactions/zapDeposit.d.ts +2 -6
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +1208 -1498
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/utils/prices.d.ts.map +1 -1
- package/dist/esm/utils/prices.js +2 -2
- package/dist/esm/utils/prices.js.map +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/functions/alphaLpBreakdown.html +1 -1
- package/docs/functions/cetusLpBreakdown.html +1 -1
- package/docs/functions/claimBlueRewardTxb.html +1 -1
- package/docs/functions/claimRewardTxb.html +1 -1
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +1 -1
- package/docs/functions/coinAmountToXTokensSingleAsset.html +1 -1
- package/docs/functions/coinsInPool.html +1 -1
- package/docs/functions/collectRewards.html +1 -1
- package/docs/functions/deposit.html +1 -1
- package/docs/functions/depositDoubleAssetTxb.html +1 -1
- package/docs/functions/depositSingleAssetTxb.html +1 -1
- package/docs/functions/fetchAfterTransactionEvents.html +1 -1
- package/docs/functions/fetchAutoCompoundingEvents.html +1 -1
- package/docs/functions/fetchAutoCompoundingEventsGql.html +1 -1
- package/docs/functions/fetchCetusPools.html +1 -1
- package/docs/functions/fetchChainIdentifier.html +1 -1
- package/docs/functions/fetchCheckRatioEvents.html +1 -1
- package/docs/functions/fetchLiquidityChangeEvents.html +1 -1
- package/docs/functions/fetchMultiCategoryEvents.html +1 -1
- package/docs/functions/fetchMultiReceipts.html +1 -1
- package/docs/functions/fetchNftHolders.html +1 -1
- package/docs/functions/fetchPools.html +1 -1
- package/docs/functions/fetchPortfolioData.html +1 -1
- package/docs/functions/fetchProtocolData.html +1 -1
- package/docs/functions/fetchTVL.html +1 -1
- package/docs/functions/fetchUserVaultBalances.html +1 -1
- package/docs/functions/fetchUserVaults.html +1 -1
- package/docs/functions/fetchUserWalletData.html +1 -1
- package/docs/functions/fetchVoloExchangeRate.html +1 -1
- package/docs/functions/fetchWithdrawV2Events.html +1 -1
- package/docs/functions/getAirdropShare.html +1 -1
- package/docs/functions/getAllDoubleAssetVaults.html +1 -1
- package/docs/functions/getAllSingleAssetVaults.html +1 -1
- package/docs/functions/getAllVaultBalances.html +1 -1
- package/docs/functions/getAllVaults.html +1 -1
- package/docs/functions/getAlphaUnlocks.html +1 -1
- package/docs/functions/getAlphaVaultBalance.html +1 -1
- package/docs/functions/getAmounts.html +1 -1
- package/docs/functions/getApr.html +1 -1
- package/docs/functions/getAprs.html +1 -1
- package/docs/functions/getApy.html +1 -1
- package/docs/functions/getApys.html +1 -1
- package/docs/functions/getCetusInvestorTicksMap.html +1 -1
- package/docs/functions/getCetusPool.html +1 -1
- package/docs/functions/getCetusSqrtPriceMap.html +1 -1
- package/docs/functions/getCoinAmountsFromLiquidity.html +1 -1
- package/docs/functions/getConf.html +1 -1
- package/docs/functions/getCurrentTick.html +1 -1
- package/docs/functions/getDistributor.html +1 -1
- package/docs/functions/getDoubleAssetVaultBalance.html +1 -1
- package/docs/functions/getDoubleAssetVaults.html +1 -1
- package/docs/functions/getHoldersFromTransactions.html +1 -1
- package/docs/functions/getInvestor.html +1 -1
- package/docs/functions/getInvestorPoolMap.html +1 -1
- package/docs/functions/getLastAutoCompoundTime.html +1 -1
- package/docs/functions/getLatestPrices.html +1 -1
- package/docs/functions/getLiquidity.html +1 -1
- package/docs/functions/getMultiCetusPool.html +1 -1
- package/docs/functions/getMultiInvestor.html +1 -1
- package/docs/functions/getMultiLatestPrices.html +1 -1
- package/docs/functions/getMultiParentPool.html +1 -1
- package/docs/functions/getMultiPool.html +1 -1
- package/docs/functions/getMultiReceipts.html +1 -1
- package/docs/functions/getParentPool.html +1 -1
- package/docs/functions/getPool.html +1 -1
- package/docs/functions/getPoolExchangeRate.html +1 -1
- package/docs/functions/getPoolExchangeRateMap.html +1 -1
- package/docs/functions/getPoolsWeightDistribution.html +1 -1
- package/docs/functions/getPositionRange.html +1 -1
- package/docs/functions/getPositionRanges.html +1 -1
- package/docs/functions/getPositionTicks.html +1 -1
- package/docs/functions/getPriceToTick.html +1 -1
- package/docs/functions/getRebalanceHistories.html +1 -1
- package/docs/functions/getRebalanceHistory.html +1 -1
- package/docs/functions/getReceipts.html +1 -1
- package/docs/functions/getSingleAssetVaultBalance.html +1 -1
- package/docs/functions/getSingleAssetVaults.html +1 -1
- package/docs/functions/getSuiClient.html +2 -2
- package/docs/functions/getSuiNodeUrl.html +2 -2
- package/docs/functions/getTVLs-1.html +1 -1
- package/docs/functions/getTickSpacing.html +1 -1
- package/docs/functions/getTickToPrice.html +1 -1
- package/docs/functions/getTvls.html +1 -1
- package/docs/functions/getUserTokensFromTransactions.html +1 -1
- package/docs/functions/getUserTokensInUsdFromTransactions.html +1 -1
- package/docs/functions/getVaultBalance.html +1 -1
- package/docs/functions/getVaultBalanceForActiveUsers.html +1 -1
- package/docs/functions/getVaults.html +1 -1
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +1 -1
- package/docs/functions/getZapAmounts.html +1 -1
- package/docs/functions/lastAutocompoundTime.html +1 -1
- package/docs/functions/liquidityToTokens.html +1 -1
- package/docs/functions/multiLiquidityToTokens.html +1 -1
- package/docs/functions/multiTokensToUsd.html +1 -1
- package/docs/functions/multiXTokensToLiquidity.html +1 -1
- package/docs/functions/parseUserWalletData.html +1 -1
- package/docs/functions/pendingBlueRewardAmount.html +1 -1
- package/docs/functions/setCustomSuiClient.html +2 -2
- package/docs/functions/setSuiClient.html +2 -2
- package/docs/functions/setSuiNodeUrl.html +2 -2
- package/docs/functions/setWeights.html +1 -1
- package/docs/functions/withdraw.html +1 -1
- package/docs/functions/withdrawAlphaTxb.html +1 -1
- package/docs/functions/withdrawTxb.html +1 -1
- package/docs/functions/zapDepositTxb.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/Coin.html +6 -6
- package/docs/interfaces/CoinPair.html +2 -2
- package/docs/interfaces/NaviVoloData.html +2 -2
- package/docs/interfaces/PoolData.html +2 -2
- package/docs/interfaces/PoolWeightDistribution.html +2 -2
- package/docs/interfaces/RebalanceHistoryType.html +2 -2
- package/docs/modules.html +2 -2
- package/docs/types/AfterTransactionEventNode.html +1 -1
- package/docs/types/Allocator.html +1 -1
- package/docs/types/AlphaFiDoubleAssetVault.html +1 -1
- package/docs/types/AlphaFiMultiVaultBalance.html +1 -1
- package/docs/types/AlphaFiSingleAssetVault.html +1 -1
- package/docs/types/AlphaFiVault.html +1 -1
- package/docs/types/AlphaFiVaultBalance.html +1 -1
- package/docs/types/AlphaPoolType.html +1 -1
- package/docs/types/AlphaReceipt.html +1 -1
- package/docs/types/AlphaReceiptFields.html +1 -1
- package/docs/types/AlphaVaultBalance.html +1 -1
- package/docs/types/AutoBalancePoolNames.html +1 -1
- package/docs/types/AutoCompoundingEventNode.html +1 -1
- package/docs/types/BluefinInvestor.html +1 -1
- package/docs/types/BluefinPoolType.html +1 -1
- package/docs/types/BucketInvestor.html +1 -1
- package/docs/types/CetusInvestor.html +1 -1
- package/docs/types/CetusPoolType.html +1 -1
- package/docs/types/CetusSwapOptions.html +1 -1
- package/docs/types/CoinAmounts.html +1 -1
- package/docs/types/CoinName.html +1 -1
- package/docs/types/CoinType.html +1 -1
- package/docs/types/CommonInvestorFields.html +1 -1
- package/docs/types/CreatePoolOptions.html +1 -1
- package/docs/types/Distributor.html +1 -1
- package/docs/types/DoubleAssetMultiVaultBalance.html +1 -1
- package/docs/types/DoubleAssetPoolNames.html +1 -1
- package/docs/types/DoubleAssetTokenHoldings.html +1 -1
- package/docs/types/DoubleAssetVaultBalance.html +1 -1
- package/docs/types/EventCategory.html +1 -1
- package/docs/types/EventNode.html +1 -1
- package/docs/types/GetHoldersParams.html +1 -1
- package/docs/types/GetTokenHoldingsParams.html +1 -1
- package/docs/types/GetUserTokensFromTransactionsParams.html +1 -1
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +1 -1
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +1 -1
- package/docs/types/GetVaultBalanceParams.html +1 -1
- package/docs/types/HoldingsObj.html +1 -1
- package/docs/types/Icon.html +1 -1
- package/docs/types/Investor.html +1 -1
- package/docs/types/LiquidityChangeEventNode.html +1 -1
- package/docs/types/LiquidityToTokensParams.html +1 -1
- package/docs/types/LiquidityToUsdParams.html +1 -1
- package/docs/types/LoopingDebt.html +1 -1
- package/docs/types/LoopingPoolNames.html +1 -1
- package/docs/types/LpBreakdownType.html +1 -1
- package/docs/types/MemberPoolDataType.html +1 -1
- package/docs/types/MemberType.html +1 -1
- package/docs/types/MultiGetVaultBalancesParams.html +1 -1
- package/docs/types/NaviInvestor.html +1 -1
- package/docs/types/OtherReceiptFields.html +1 -1
- package/docs/types/PoolName.html +1 -1
- package/docs/types/PoolReceipt.html +1 -1
- package/docs/types/PoolType.html +1 -1
- package/docs/types/Receipt.html +1 -1
- package/docs/types/ReceiptGQL.html +1 -1
- package/docs/types/SingleAssetMultiVaultBalance.html +1 -1
- package/docs/types/SingleAssetPoolNames.html +1 -1
- package/docs/types/SingleAssetTokenHoldings.html +1 -1
- package/docs/types/SingleAssetVaultBalance.html +1 -1
- package/docs/types/SingleGetVaultBalancesParams.html +1 -1
- package/docs/types/StrategyType.html +1 -1
- package/docs/types/SuiNetwork.html +1 -1
- package/docs/types/SwapOptions.html +1 -1
- package/docs/types/TickSpacing.html +1 -1
- package/docs/types/TotalWeightType.html +1 -1
- package/docs/types/TransactionBlockType.html +1 -1
- package/docs/types/UserPoolLiquidity.html +1 -1
- package/docs/types/UserPoolTokenHoldings.html +1 -1
- package/docs/types/UserUsdHoldings.html +1 -1
- package/docs/types/VaultBalance.html +1 -1
- package/docs/types/WithdrawV2EventNode.html +1 -1
- package/docs/variables/bluefinPoolMap.html +1 -1
- package/docs/variables/cetusPoolMap.html +1 -1
- package/docs/variables/coinsList.html +1 -1
- package/docs/variables/defunctPoolsSet.html +1 -1
- package/docs/variables/doubleAssetPoolCoinMap.html +1 -1
- package/docs/variables/eventCategories.html +1 -1
- package/docs/variables/ignoredWalletsForDailyRevenue.html +1 -1
- package/docs/variables/loopingAccountAddresses.html +1 -1
- package/docs/variables/loopingPoolCoinMap.html +1 -1
- package/docs/variables/naviAssetMap.html +1 -1
- package/docs/variables/poolIdPoolNameMap.html +1 -1
- package/docs/variables/poolInfo.html +1 -1
- package/docs/variables/singleAssetPoolCoinMap.html +1 -1
- package/docs/variables/stableCoins.html +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withdrawBluefinStsuiTxb = exports.withdrawBluefinType2Txb = exports.withdrawBluefinType1Txb = exports.withdrawBluefinSuiSecondTxb = exports.withdrawBluefinSuiFirstTxb = exports.depositBluefinStsuiTxb = exports.depositBluefinType2Txb = exports.depositBluefinType1Txb = exports.depositBluefinSuiSecondTxb = exports.depositBluefinSuiFirstTxb = void 0;
|
|
3
|
+
exports.withdrawBluefinFungibleTxb = exports.withdrawBluefinStsuiTxb = exports.withdrawBluefinType2Txb = exports.withdrawBluefinType1Txb = exports.withdrawBluefinSuiSecondTxb = exports.withdrawBluefinSuiFirstTxb = exports.depositBluefinFungibleTxb = 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");
|
|
@@ -1323,6 +1323,117 @@ const depositBluefinStsuiTxb = async (amount, poolName, isAmountA, options, tran
|
|
|
1323
1323
|
return txb;
|
|
1324
1324
|
};
|
|
1325
1325
|
exports.depositBluefinStsuiTxb = depositBluefinStsuiTxb;
|
|
1326
|
+
const getCoinObject = async (type, address, tx) => {
|
|
1327
|
+
let txb;
|
|
1328
|
+
if (!tx) {
|
|
1329
|
+
txb = new transactions_1.Transaction();
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
txb = tx;
|
|
1333
|
+
}
|
|
1334
|
+
let coins1 = [];
|
|
1335
|
+
let currentCursor = null;
|
|
1336
|
+
do {
|
|
1337
|
+
const response = await (0, client_js_1.getSuiClient)().getCoins({
|
|
1338
|
+
owner: address,
|
|
1339
|
+
coinType: type,
|
|
1340
|
+
cursor: currentCursor,
|
|
1341
|
+
});
|
|
1342
|
+
coins1 = coins1.concat(response.data);
|
|
1343
|
+
// Check if there's a next page
|
|
1344
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
1345
|
+
currentCursor = response.nextCursor;
|
|
1346
|
+
}
|
|
1347
|
+
else {
|
|
1348
|
+
// No more pages available
|
|
1349
|
+
// console.log("No more receipts available.");
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
} while (true);
|
|
1353
|
+
if (coins1.length >= 1) {
|
|
1354
|
+
//coin1
|
|
1355
|
+
const [coin1] = txb.splitCoins(coins1[0].coinObjectId, [0]);
|
|
1356
|
+
txb.mergeCoins(coin1, coins1.map((c) => c.coinObjectId));
|
|
1357
|
+
return coin1;
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
const depositBluefinFungibleTxb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
1361
|
+
const suiClient = (0, client_js_1.getSuiClient)();
|
|
1362
|
+
const address = options.address;
|
|
1363
|
+
let txb;
|
|
1364
|
+
if (transaction)
|
|
1365
|
+
txb = transaction;
|
|
1366
|
+
else
|
|
1367
|
+
txb = new transactions_1.Transaction();
|
|
1368
|
+
poolName = poolName.toUpperCase();
|
|
1369
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
1370
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
1371
|
+
let coins1 = [];
|
|
1372
|
+
let currentCursor = null;
|
|
1373
|
+
do {
|
|
1374
|
+
const response = await suiClient.getCoins({
|
|
1375
|
+
owner: address,
|
|
1376
|
+
coinType: coins_js_1.coinsList[pool1].type,
|
|
1377
|
+
cursor: currentCursor,
|
|
1378
|
+
});
|
|
1379
|
+
coins1 = coins1.concat(response.data);
|
|
1380
|
+
// Check if there's a next page
|
|
1381
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
1382
|
+
currentCursor = response.nextCursor;
|
|
1383
|
+
}
|
|
1384
|
+
else {
|
|
1385
|
+
// No more pages available
|
|
1386
|
+
// console.log("No more receipts available.");
|
|
1387
|
+
break;
|
|
1388
|
+
}
|
|
1389
|
+
} while (true);
|
|
1390
|
+
const amounts = await (0, deposit_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
1391
|
+
if (amounts) {
|
|
1392
|
+
const amount1 = amounts[0];
|
|
1393
|
+
const amount2 = amounts[1];
|
|
1394
|
+
let coin1;
|
|
1395
|
+
if (coins1.length >= 1) {
|
|
1396
|
+
//coin1
|
|
1397
|
+
[coin1] = txb.splitCoins(txb.object(coins1[0].coinObjectId), [0]);
|
|
1398
|
+
txb.mergeCoins(coin1, coins1.map((c) => c.coinObjectId));
|
|
1399
|
+
const [depositCoinA] = txb.splitCoins(coin1, [amount1]);
|
|
1400
|
+
//coin2
|
|
1401
|
+
const [depositCoinB] = txb.splitCoins(txb.gas, [amount2]);
|
|
1402
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
1403
|
+
if (poolName === "BLUEFIN-FUNGIBLE-STSUI-SUI") {
|
|
1404
|
+
txb.moveCall({
|
|
1405
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_sui_ft_pool::user_deposit`,
|
|
1406
|
+
typeArguments: [
|
|
1407
|
+
coins_js_1.coinsList[pool1].type,
|
|
1408
|
+
coins_js_1.coinsList[pool2].type,
|
|
1409
|
+
poolinfo.receiptType,
|
|
1410
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1411
|
+
],
|
|
1412
|
+
arguments: [
|
|
1413
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_FUNGIBLE_VERSION),
|
|
1414
|
+
txb.object(poolinfo.poolId),
|
|
1415
|
+
depositCoinA,
|
|
1416
|
+
depositCoinB,
|
|
1417
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1418
|
+
txb.object(poolinfo.investorId),
|
|
1419
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1420
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_SUI_POOL),
|
|
1421
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1422
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
1423
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
1424
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1425
|
+
],
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
txb.transferObjects([coin1], address);
|
|
1429
|
+
}
|
|
1430
|
+
else {
|
|
1431
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
return txb;
|
|
1435
|
+
};
|
|
1436
|
+
exports.depositBluefinFungibleTxb = depositBluefinFungibleTxb;
|
|
1326
1437
|
const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
1327
1438
|
const address = options.address;
|
|
1328
1439
|
const txb = new transactions_1.Transaction();
|
|
@@ -2414,4 +2525,45 @@ const withdrawBluefinStsuiTxb = async (xTokens, poolName, options) => {
|
|
|
2414
2525
|
return txb;
|
|
2415
2526
|
};
|
|
2416
2527
|
exports.withdrawBluefinStsuiTxb = withdrawBluefinStsuiTxb;
|
|
2528
|
+
const withdrawBluefinFungibleTxb = async (xTokens, poolName, options) => {
|
|
2529
|
+
const address = options.address;
|
|
2530
|
+
const txb = new transactions_1.Transaction();
|
|
2531
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
2532
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
2533
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
2534
|
+
const ftCoin = await getCoinObject(poolinfo.receiptType, address, txb);
|
|
2535
|
+
if (ftCoin) {
|
|
2536
|
+
const ftCoinsToBurn = txb.splitCoins(ftCoin, [xTokens]);
|
|
2537
|
+
if (poolName === "BLUEFIN-FUNGIBLE-STSUI-SUI") {
|
|
2538
|
+
txb.moveCall({
|
|
2539
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_stsui_sui_ft_pool::user_withdraw`,
|
|
2540
|
+
typeArguments: [
|
|
2541
|
+
coins_js_1.coinsList[pool1].type,
|
|
2542
|
+
coins_js_1.coinsList[pool2].type,
|
|
2543
|
+
poolinfo.receiptType,
|
|
2544
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
2545
|
+
],
|
|
2546
|
+
arguments: [
|
|
2547
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_FUNGIBLE_VERSION),
|
|
2548
|
+
ftCoinsToBurn,
|
|
2549
|
+
txb.object(poolinfo.poolId),
|
|
2550
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
2551
|
+
txb.object(poolinfo.investorId),
|
|
2552
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
2553
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_SUI_POOL),
|
|
2554
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
2555
|
+
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
2556
|
+
txb.object((0, constants_js_1.getConf)().SUI_SYSTEM_STATE),
|
|
2557
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
2558
|
+
],
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2561
|
+
txb.transferObjects([ftCoin], address);
|
|
2562
|
+
}
|
|
2563
|
+
else {
|
|
2564
|
+
throw new Error("No ftCoin found!");
|
|
2565
|
+
}
|
|
2566
|
+
return txb;
|
|
2567
|
+
};
|
|
2568
|
+
exports.withdrawBluefinFungibleTxb = withdrawBluefinFungibleTxb;
|
|
2417
2569
|
//# sourceMappingURL=bluefin.js.map
|