@alphafi/alphafi-sdk 0.0.53 → 0.0.55
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/#t.ts# +8 -0
- package/dist/cjs/adminFunctions.d.ts +6 -5
- package/dist/cjs/adminFunctions.d.ts.map +1 -1
- package/dist/cjs/adminFunctions.js +38 -15
- package/dist/cjs/adminFunctions.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +60 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +63 -11
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +58 -1
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/types.d.ts +2 -2
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchMultiCategoryEvents.d.ts +1 -2
- package/dist/cjs/sui-sdk/events/fetchMultiCategoryEvents.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchMultiCategoryEvents.js.map +1 -1
- package/dist/cjs/sui-sdk/events/types.d.ts +2 -0
- package/dist/cjs/sui-sdk/events/types.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/events/types.js +6 -0
- package/dist/cjs/sui-sdk/events/types.js.map +1 -1
- package/dist/cjs/transactions/blueRewards.d.ts.map +1 -1
- package/dist/cjs/transactions/blueRewards.js +71 -0
- package/dist/cjs/transactions/blueRewards.js.map +1 -1
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
- package/dist/cjs/transactions/bluefin.js +312 -157
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +414 -123
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/adminFunctions.d.ts +6 -5
- package/dist/esm/adminFunctions.d.ts.map +1 -1
- package/dist/esm/adminFunctions.js +37 -15
- package/dist/esm/adminFunctions.js.map +1 -1
- package/dist/esm/common/constants.d.ts +60 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +63 -11
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +58 -1
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/types.d.ts +2 -2
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/events/fetchMultiCategoryEvents.d.ts +1 -2
- package/dist/esm/sui-sdk/events/fetchMultiCategoryEvents.d.ts.map +1 -1
- package/dist/esm/sui-sdk/events/fetchMultiCategoryEvents.js.map +1 -1
- package/dist/esm/sui-sdk/events/types.d.ts +2 -0
- package/dist/esm/sui-sdk/events/types.d.ts.map +1 -1
- package/dist/esm/sui-sdk/events/types.js +5 -1
- package/dist/esm/sui-sdk/events/types.js.map +1 -1
- package/dist/esm/transactions/blueRewards.d.ts.map +1 -1
- package/dist/esm/transactions/blueRewards.js +71 -0
- package/dist/esm/transactions/blueRewards.js.map +1 -1
- package/dist/esm/transactions/bluefin.d.ts.map +1 -1
- package/dist/esm/transactions/bluefin.js +312 -157
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +414 -123
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/docs/assets/navigation.js +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 -0
- 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 +5 -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 -0
- 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 -0
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zapDeposit.d.ts","sourceRoot":"","sources":["../../../src/transactions/zapDeposit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEZ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAe,MAAM,oBAAoB,CAAC;AAkBrE,wBAAsB,aAAa,CACjC,aAAa,EAAE,QAAQ,EACvB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,EAAE,8BAA8B;AAChD,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA+
|
|
1
|
+
{"version":3,"file":"zapDeposit.d.ts","sourceRoot":"","sources":["../../../src/transactions/zapDeposit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEZ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAe,MAAM,oBAAoB,CAAC;AAkBrE,wBAAsB,aAAa,CACjC,aAAa,EAAE,QAAQ,EACvB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,EAAE,8BAA8B;AAChD,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA+TlC;AA2wCD,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,QAAQ,EACvB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAC5B,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAqFvD"}
|
|
@@ -25,153 +25,222 @@ options) {
|
|
|
25
25
|
const swapObjectA = coins_js_1.coinsList[coinTypeA];
|
|
26
26
|
const swapObjectB = coins_js_1.coinsList[coinTypeB];
|
|
27
27
|
const inputObject = coins_js_1.coinsList[inputCoinName];
|
|
28
|
+
const swapGateway = new _7k_js_1.SevenKGateway();
|
|
28
29
|
let coin1, coin2;
|
|
30
|
+
let amountA, amountB;
|
|
29
31
|
const amounts = await (0, deposit_js_1.getAmounts)(poolName, true, "100000001");
|
|
30
|
-
if (amounts) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
let amountA, amountB;
|
|
50
|
-
const swapOptionsI2A = {
|
|
32
|
+
if (!amounts) {
|
|
33
|
+
console.error("Error fetching amounts for zap");
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
if (Number(amounts[0]) === 0) {
|
|
37
|
+
amountA = "0";
|
|
38
|
+
coin1 = txb.moveCall({
|
|
39
|
+
target: "0x2::coin::zero",
|
|
40
|
+
typeArguments: [swapObjectA.type],
|
|
41
|
+
arguments: [],
|
|
42
|
+
});
|
|
43
|
+
if (inputCoinName === coinTypeB) {
|
|
44
|
+
amountB = inputCoinAmount.toString();
|
|
45
|
+
const res = await splitFromExisting(coinTypeB, amountB, txb, suiClient, address);
|
|
46
|
+
txb = res.tx;
|
|
47
|
+
coin2 = res.coinOut;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const swapOptionsI2B = {
|
|
51
51
|
pair: {
|
|
52
52
|
coinA: inputObject,
|
|
53
|
-
coinB:
|
|
53
|
+
coinB: swapObjectB,
|
|
54
54
|
},
|
|
55
55
|
senderAddress: address,
|
|
56
|
-
inAmount: new bn_js_1.default(
|
|
56
|
+
inAmount: new bn_js_1.default(inputCoinAmount),
|
|
57
57
|
slippage: slippage,
|
|
58
58
|
};
|
|
59
|
-
const
|
|
59
|
+
const result = await zapSwap(swapOptionsI2B, txb);
|
|
60
|
+
if (result) {
|
|
61
|
+
amountB = result.amountOut;
|
|
62
|
+
txb = result.tx;
|
|
63
|
+
if (result.coinOut) {
|
|
64
|
+
coin2 = result.coinOut;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (Number(amounts[1]) === 0) {
|
|
70
|
+
amountB = "0";
|
|
71
|
+
coin2 = txb.moveCall({
|
|
72
|
+
target: "0x2::coin::zero",
|
|
73
|
+
typeArguments: [swapObjectB.type],
|
|
74
|
+
arguments: [],
|
|
75
|
+
});
|
|
76
|
+
if (inputCoinName === coinTypeA) {
|
|
77
|
+
amountA = inputCoinAmount.toString();
|
|
78
|
+
const res = await splitFromExisting(coinTypeA, amountA, txb, suiClient, address);
|
|
79
|
+
txb = res.tx;
|
|
80
|
+
coin1 = res.coinOut;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
const swapOptionsI2A = {
|
|
60
84
|
pair: {
|
|
61
85
|
coinA: inputObject,
|
|
62
|
-
coinB:
|
|
86
|
+
coinB: swapObjectA,
|
|
63
87
|
},
|
|
64
88
|
senderAddress: address,
|
|
65
|
-
inAmount: new bn_js_1.default(
|
|
89
|
+
inAmount: new bn_js_1.default(inputCoinAmount),
|
|
66
90
|
slippage: slippage,
|
|
67
91
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
coin2 = result.coinOut;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
amountA = inputAmountToType1.toString();
|
|
78
|
-
if (result && result.remainingLSTCoin) {
|
|
79
|
-
coin1 = result.remainingLSTCoin;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
const res = await splitFromExisting(coinTypeA, amountA, txb, suiClient, address);
|
|
83
|
-
txb = res.tx;
|
|
84
|
-
coin1 = res.coinOut;
|
|
92
|
+
const result = await zapSwap(swapOptionsI2A, txb);
|
|
93
|
+
if (result) {
|
|
94
|
+
amountA = result.amountOut;
|
|
95
|
+
txb = result.tx;
|
|
96
|
+
if (result.coinOut) {
|
|
97
|
+
coin1 = result.coinOut;
|
|
85
98
|
}
|
|
86
99
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
const amount1 = Number(amounts[0]);
|
|
104
|
+
const amount2 = Number(amounts[1]);
|
|
105
|
+
const swapOptions = {
|
|
106
|
+
pair: {
|
|
107
|
+
coinA: swapObjectA,
|
|
108
|
+
coinB: swapObjectB,
|
|
109
|
+
},
|
|
110
|
+
senderAddress: address,
|
|
111
|
+
inAmount: new bn_js_1.default(amount1),
|
|
112
|
+
slippage: slippage,
|
|
113
|
+
};
|
|
114
|
+
const ratioQuote = await zapGetQuote(swapGateway, swapOptions);
|
|
115
|
+
if (ratioQuote === undefined) {
|
|
116
|
+
console.error("Error fetching ratioQuote for zap");
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
const amount1InCoinType2 = Number(ratioQuote);
|
|
120
|
+
const totalAmount = amount2 + amount1InCoinType2;
|
|
121
|
+
const inputAmountToType1 = Math.floor((inputCoinAmount * amount1InCoinType2) / totalAmount);
|
|
122
|
+
const inputAmountToType2 = Math.floor((inputCoinAmount * amount2) / totalAmount);
|
|
123
|
+
const swapOptionsI2A = {
|
|
124
|
+
pair: {
|
|
125
|
+
coinA: inputObject,
|
|
126
|
+
coinB: swapObjectA,
|
|
127
|
+
},
|
|
128
|
+
senderAddress: address,
|
|
129
|
+
inAmount: new bn_js_1.default(inputAmountToType1),
|
|
130
|
+
slippage: slippage,
|
|
131
|
+
};
|
|
132
|
+
const swapOptionsI2B = {
|
|
133
|
+
pair: {
|
|
134
|
+
coinA: inputObject,
|
|
135
|
+
coinB: swapObjectB,
|
|
136
|
+
},
|
|
137
|
+
senderAddress: address,
|
|
138
|
+
inAmount: new bn_js_1.default(inputAmountToType2),
|
|
139
|
+
slippage: slippage,
|
|
140
|
+
};
|
|
141
|
+
if (inputCoinName === coinTypeA) {
|
|
142
|
+
const result = await zapSwap(swapOptionsI2B, txb);
|
|
143
|
+
if (result) {
|
|
144
|
+
amountB = result.amountOut;
|
|
145
|
+
txb = result.tx;
|
|
146
|
+
if (result.coinOut) {
|
|
147
|
+
coin2 = result.coinOut;
|
|
104
148
|
}
|
|
105
149
|
}
|
|
150
|
+
amountA = inputAmountToType1.toString();
|
|
151
|
+
if (result && result.remainingLSTCoin) {
|
|
152
|
+
coin1 = result.remainingLSTCoin;
|
|
153
|
+
}
|
|
106
154
|
else {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
txb = result.tx;
|
|
111
|
-
if (result.coinOut) {
|
|
112
|
-
coin1 = result.coinOut;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
result = await zapSwap(swapOptionsI2B, txb);
|
|
116
|
-
if (result) {
|
|
117
|
-
amountB = result.amountOut;
|
|
118
|
-
txb = result.tx;
|
|
119
|
-
if (result.coinOut) {
|
|
120
|
-
coin2 = result.coinOut;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
155
|
+
const res = await splitFromExisting(coinTypeA, amountA, txb, suiClient, address);
|
|
156
|
+
txb = res.tx;
|
|
157
|
+
coin1 = res.coinOut;
|
|
123
158
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
txb.transferObjects([feeCoinA, feeCoinB], fee_address);
|
|
133
|
-
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
134
|
-
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
135
|
-
if (inputCoinName === "USDT") {
|
|
136
|
-
amountA = (Number(amountA) * 0.995).toString();
|
|
137
|
-
amountB = (Number(amountB) * 0.995).toString();
|
|
159
|
+
}
|
|
160
|
+
else if (inputCoinName === coinTypeB) {
|
|
161
|
+
const result = await zapSwap(swapOptionsI2A, txb);
|
|
162
|
+
if (result) {
|
|
163
|
+
amountA = result.amountOut;
|
|
164
|
+
txb = result.tx;
|
|
165
|
+
if (result.coinOut) {
|
|
166
|
+
coin1 = result.coinOut;
|
|
138
167
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
168
|
+
}
|
|
169
|
+
if (result && result.remainingLSTCoin) {
|
|
170
|
+
coin2 = result.remainingLSTCoin;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
amountB = inputAmountToType2.toString();
|
|
174
|
+
const res = await splitFromExisting(coinTypeB, amountB, txb, suiClient, address);
|
|
175
|
+
txb = res.tx;
|
|
176
|
+
coin2 = res.coinOut;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
let result = await zapSwap(swapOptionsI2A, txb);
|
|
181
|
+
if (result) {
|
|
182
|
+
amountA = result.amountOut;
|
|
183
|
+
txb = result.tx;
|
|
184
|
+
if (result.coinOut) {
|
|
185
|
+
coin1 = result.coinOut;
|
|
149
186
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
txb = await depositBluefinSuiFirstTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
158
|
-
}
|
|
159
|
-
else if (pool2 === "SUI") {
|
|
160
|
-
txb = await depositBluefinSuiSecondTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
161
|
-
}
|
|
162
|
-
else if (pool1 === "STSUI" || pool2 === "STSUI") {
|
|
163
|
-
txb = await depositBluefinStsuiTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
txb = await depositBluefinType1Txb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
167
|
-
}
|
|
187
|
+
}
|
|
188
|
+
result = await zapSwap(swapOptionsI2B, txb);
|
|
189
|
+
if (result) {
|
|
190
|
+
amountB = result.amountOut;
|
|
191
|
+
txb = result.tx;
|
|
192
|
+
if (result.coinOut) {
|
|
193
|
+
coin2 = result.coinOut;
|
|
168
194
|
}
|
|
169
195
|
}
|
|
170
|
-
txb.setGasBudget(100000000);
|
|
171
|
-
return txb;
|
|
172
196
|
}
|
|
173
197
|
}
|
|
174
|
-
|
|
198
|
+
if (amountA && amountB && coin1 && coin2) {
|
|
199
|
+
// fee charge
|
|
200
|
+
const fee_address = (0, constants_js_1.getConf)().FEE_ADDRESS;
|
|
201
|
+
const feePercentage = 0.05;
|
|
202
|
+
const amountAFee = ((Number(amountA) * feePercentage) / 100).toFixed(0);
|
|
203
|
+
const amountBFee = ((Number(amountB) * feePercentage) / 100).toFixed(0);
|
|
204
|
+
const [feeCoinA] = txb.splitCoins(coin1, [amountAFee]);
|
|
205
|
+
const [feeCoinB] = txb.splitCoins(coin2, [amountBFee]);
|
|
206
|
+
txb.transferObjects([feeCoinA, feeCoinB], fee_address);
|
|
207
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
208
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
209
|
+
amountA = (Number(amountA) * 0.999).toString();
|
|
210
|
+
amountB = (Number(amountB) * 0.999).toString();
|
|
211
|
+
if (maps_js_1.poolInfo[poolName].parentProtocolName === "CETUS") {
|
|
212
|
+
if (pool1 === "CETUS" && pool2 === "SUI") {
|
|
213
|
+
txb = await depositCetusSuiTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
214
|
+
}
|
|
215
|
+
else if (pool2 === "SUI") {
|
|
216
|
+
txb = await depositCetusAlphaSuiTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
txb = await depositCetus(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else if (maps_js_1.poolInfo[poolName].parentProtocolName === "BLUEFIN") {
|
|
223
|
+
if (poolName === "BLUEFIN-NAVX-VSUI" ||
|
|
224
|
+
poolName === "BLUEFIN-ALPHA-USDC" ||
|
|
225
|
+
poolName === "BLUEFIN-BLUE-USDC") {
|
|
226
|
+
txb = await depositBluefinType2Txb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
227
|
+
}
|
|
228
|
+
else if (pool1 === "SUI") {
|
|
229
|
+
txb = await depositBluefinSuiFirstTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
230
|
+
}
|
|
231
|
+
else if (pool2 === "SUI") {
|
|
232
|
+
txb = await depositBluefinSuiSecondTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
233
|
+
}
|
|
234
|
+
else if (pool1 === "STSUI" || pool2 === "STSUI") {
|
|
235
|
+
txb = await depositBluefinStsuiTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
txb = await depositBluefinType1Txb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
txb.setGasBudget(100000000);
|
|
243
|
+
return txb;
|
|
175
244
|
}
|
|
176
245
|
async function zapGetQuote(swapGateway, swapOptions) {
|
|
177
246
|
if (swapOptions.pair.coinA.name === "SUI" &&
|
|
@@ -198,6 +267,7 @@ async function zapGetQuote(swapGateway, swapOptions) {
|
|
|
198
267
|
async function zapSwap(swapOptions, txb) {
|
|
199
268
|
if (swapOptions.pair.coinA.name === "SUI" &&
|
|
200
269
|
swapOptions.pair.coinB.name === "STSUI") {
|
|
270
|
+
console.log("mintTx called");
|
|
201
271
|
const result = await (0, stsui_sdk_1.mintTx)(swapOptions.inAmount ? swapOptions.inAmount.toString() : "0", txb);
|
|
202
272
|
return {
|
|
203
273
|
tx: result.tx,
|
|
@@ -208,10 +278,12 @@ async function zapSwap(swapOptions, txb) {
|
|
|
208
278
|
}
|
|
209
279
|
else if (swapOptions.pair.coinA.name === "STSUI" &&
|
|
210
280
|
swapOptions.pair.coinB.name === "SUI") {
|
|
281
|
+
console.log("redeemTx called");
|
|
211
282
|
const result = await (0, stsui_sdk_1.redeemTx)(swapOptions.inAmount ? swapOptions.inAmount.toString() : "0", txb, { address: swapOptions.senderAddress });
|
|
212
283
|
return result;
|
|
213
284
|
}
|
|
214
285
|
else {
|
|
286
|
+
console.log("7k swap", swapOptions);
|
|
215
287
|
const swapGateway = new _7k_js_1.SevenKGateway();
|
|
216
288
|
const quoteResponse = await swapGateway.getQuote(swapOptions);
|
|
217
289
|
if (quoteResponse) {
|
|
@@ -381,7 +453,7 @@ const depositCetusAlphaSuiTxb = async (amountA, amountB, poolName, options, tran
|
|
|
381
453
|
});
|
|
382
454
|
}
|
|
383
455
|
txb.moveCall({
|
|
384
|
-
target: `${
|
|
456
|
+
target: `${poolinfo.packageId}::alphafi_cetus_sui_pool::user_deposit`,
|
|
385
457
|
typeArguments: [coins_js_1.coinsList[pool1].type, coins_js_1.coinsList[pool2].type],
|
|
386
458
|
arguments: [
|
|
387
459
|
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
@@ -394,7 +466,7 @@ const depositCetusAlphaSuiTxb = async (amountA, amountB, poolName, options, tran
|
|
|
394
466
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
395
467
|
txb.object((0, constants_js_1.getConf)().CETUS_REWARDER_GLOBAL_VAULT_ID),
|
|
396
468
|
txb.object(maps_js_1.cetusPoolMap["CETUS-SUI"]),
|
|
397
|
-
txb.object(
|
|
469
|
+
txb.object(maps_js_1.cetusPoolMap[poolName]),
|
|
398
470
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
399
471
|
],
|
|
400
472
|
});
|
|
@@ -583,6 +655,32 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
583
655
|
],
|
|
584
656
|
});
|
|
585
657
|
}
|
|
658
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-SUI-USDC") {
|
|
659
|
+
txb.moveCall({
|
|
660
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit`,
|
|
661
|
+
typeArguments: [
|
|
662
|
+
coins_js_1.coinsList[pool1].type,
|
|
663
|
+
coins_js_1.coinsList[pool2].type,
|
|
664
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
665
|
+
coins_js_1.coinsList["SUI"].type,
|
|
666
|
+
],
|
|
667
|
+
arguments: [
|
|
668
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
669
|
+
someReceipt,
|
|
670
|
+
txb.object(poolinfo.poolId),
|
|
671
|
+
depositCoinA,
|
|
672
|
+
depositCoinB,
|
|
673
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
674
|
+
txb.object(poolinfo.investorId),
|
|
675
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
676
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
677
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
678
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
679
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
680
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
681
|
+
],
|
|
682
|
+
});
|
|
683
|
+
}
|
|
586
684
|
txb.transferObjects([coin1Arg, coin2Arg], address);
|
|
587
685
|
}
|
|
588
686
|
else {
|
|
@@ -738,6 +836,143 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
738
836
|
],
|
|
739
837
|
});
|
|
740
838
|
}
|
|
839
|
+
else if (poolName === "BLUEFIN-STSUI-USDC") {
|
|
840
|
+
txb.moveCall({
|
|
841
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
842
|
+
typeArguments: [
|
|
843
|
+
coins_js_1.coinsList[pool1].type,
|
|
844
|
+
coins_js_1.coinsList[pool2].type,
|
|
845
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
846
|
+
coins_js_1.coinsList["SUI"].type,
|
|
847
|
+
],
|
|
848
|
+
arguments: [
|
|
849
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
850
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
851
|
+
someReceipt,
|
|
852
|
+
txb.object(poolinfo.poolId),
|
|
853
|
+
depositCoinA,
|
|
854
|
+
depositCoinB,
|
|
855
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
856
|
+
txb.object(poolinfo.investorId),
|
|
857
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
858
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
859
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
860
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
861
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-STSUI"]),
|
|
862
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
863
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
864
|
+
],
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-USDT-USDC") {
|
|
868
|
+
txb.moveCall({
|
|
869
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
870
|
+
typeArguments: [
|
|
871
|
+
coins_js_1.coinsList["USDT"].type,
|
|
872
|
+
coins_js_1.coinsList["USDC"].type,
|
|
873
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
874
|
+
coins_js_1.coinsList["SUI"].type,
|
|
875
|
+
],
|
|
876
|
+
arguments: [
|
|
877
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
878
|
+
someReceipt,
|
|
879
|
+
txb.object(poolinfo.poolId),
|
|
880
|
+
depositCoinA,
|
|
881
|
+
depositCoinB,
|
|
882
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
883
|
+
txb.object(poolinfo.investorId),
|
|
884
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
885
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
886
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
887
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
888
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-USDT"]),
|
|
889
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
890
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
891
|
+
],
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
else if (poolName === "BLUEFIN-SUIUSDT-USDC") {
|
|
895
|
+
txb.moveCall({
|
|
896
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
897
|
+
typeArguments: [
|
|
898
|
+
coins_js_1.coinsList[pool1].type,
|
|
899
|
+
coins_js_1.coinsList[pool2].type,
|
|
900
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
901
|
+
coins_js_1.coinsList["SUI"].type,
|
|
902
|
+
],
|
|
903
|
+
arguments: [
|
|
904
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
905
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
906
|
+
someReceipt,
|
|
907
|
+
txb.object(poolinfo.poolId),
|
|
908
|
+
depositCoinA,
|
|
909
|
+
depositCoinB,
|
|
910
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
911
|
+
txb.object(poolinfo.investorId),
|
|
912
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
913
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
914
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
915
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
916
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
917
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
918
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
919
|
+
],
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-SUIUSDT-USDC") {
|
|
923
|
+
txb.moveCall({
|
|
924
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
925
|
+
typeArguments: [
|
|
926
|
+
coins_js_1.coinsList["SUIUSDT"].type,
|
|
927
|
+
coins_js_1.coinsList["USDC"].type,
|
|
928
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
929
|
+
coins_js_1.coinsList["SUI"].type,
|
|
930
|
+
],
|
|
931
|
+
arguments: [
|
|
932
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
933
|
+
someReceipt,
|
|
934
|
+
txb.object(poolinfo.poolId),
|
|
935
|
+
depositCoinA,
|
|
936
|
+
depositCoinB,
|
|
937
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
938
|
+
txb.object(poolinfo.investorId),
|
|
939
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
940
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
941
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
942
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
943
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
944
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
945
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
946
|
+
],
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-DEEP-BLUE") {
|
|
950
|
+
txb.moveCall({
|
|
951
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
952
|
+
typeArguments: [
|
|
953
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
954
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
955
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
956
|
+
coins_js_1.coinsList["SUI"].type,
|
|
957
|
+
],
|
|
958
|
+
arguments: [
|
|
959
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
960
|
+
someReceipt,
|
|
961
|
+
txb.object(poolinfo.poolId),
|
|
962
|
+
depositCoinA,
|
|
963
|
+
depositCoinB,
|
|
964
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
965
|
+
txb.object(poolinfo.investorId),
|
|
966
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
967
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
968
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_BLUE_POOL),
|
|
969
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL_AUTOCOMPOUND),
|
|
970
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-DEEP"]),
|
|
971
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-SUI"]),
|
|
972
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
973
|
+
],
|
|
974
|
+
});
|
|
975
|
+
}
|
|
741
976
|
txb.transferObjects([coin1Arg, coin2Arg], address);
|
|
742
977
|
}
|
|
743
978
|
else {
|
|
@@ -865,6 +1100,62 @@ const depositBluefinType2Txb = async (amountA, amountB, poolName, options, trans
|
|
|
865
1100
|
],
|
|
866
1101
|
});
|
|
867
1102
|
}
|
|
1103
|
+
else if (poolName === "BLUEFIN-STSUI-ETH") {
|
|
1104
|
+
txb.moveCall({
|
|
1105
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
1106
|
+
typeArguments: [
|
|
1107
|
+
coins_js_1.coinsList[pool1].type,
|
|
1108
|
+
coins_js_1.coinsList[pool2].type,
|
|
1109
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1110
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1111
|
+
],
|
|
1112
|
+
arguments: [
|
|
1113
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1114
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1115
|
+
someReceipt,
|
|
1116
|
+
txb.object(poolinfo.poolId),
|
|
1117
|
+
depositCoinA,
|
|
1118
|
+
depositCoinB,
|
|
1119
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1120
|
+
txb.object(poolinfo.investorId),
|
|
1121
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1122
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1123
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_ETH_POOL),
|
|
1124
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1125
|
+
txb.object(maps_js_1.cetusPoolMap["STSUI-ETH"]),
|
|
1126
|
+
txb.object(maps_js_1.cetusPoolMap["ETH-SUI"]),
|
|
1127
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1128
|
+
],
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
else if (poolName === "BLUEFIN-STSUI-WSOL") {
|
|
1132
|
+
txb.moveCall({
|
|
1133
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
1134
|
+
typeArguments: [
|
|
1135
|
+
coins_js_1.coinsList[pool1].type,
|
|
1136
|
+
coins_js_1.coinsList[pool2].type,
|
|
1137
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1138
|
+
coins_js_1.coinsList["SUI"].type,
|
|
1139
|
+
],
|
|
1140
|
+
arguments: [
|
|
1141
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
1142
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
1143
|
+
someReceipt,
|
|
1144
|
+
txb.object(poolinfo.poolId),
|
|
1145
|
+
depositCoinA,
|
|
1146
|
+
depositCoinB,
|
|
1147
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1148
|
+
txb.object(poolinfo.investorId),
|
|
1149
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1150
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1151
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_WSOL_POOL),
|
|
1152
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1153
|
+
txb.object(maps_js_1.cetusPoolMap["STSUI-WSOL"]),
|
|
1154
|
+
txb.object(maps_js_1.cetusPoolMap["WSOL-SUI"]),
|
|
1155
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1156
|
+
],
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
868
1159
|
txb.transferObjects([coin1Arg, coin2Arg], address);
|
|
869
1160
|
}
|
|
870
1161
|
else {
|