@alphafi/alphafi-sdk 0.0.54 → 0.0.57
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 +98 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +76 -18
- 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 +127 -40
- 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 +5 -5
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/getLastAutoCompoundTime.js +2 -2
- package/dist/cjs/getLastAutoCompoundTime.js.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchAutoCompoundingEvents.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchAutoCompoundingEvents.js +2 -1
- package/dist/cjs/sui-sdk/events/fetchAutoCompoundingEvents.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +1 -0
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/transactions/7k.d.ts +1 -1
- package/dist/cjs/transactions/7k.d.ts.map +1 -1
- package/dist/cjs/transactions/7k.js +2 -1
- package/dist/cjs/transactions/7k.js.map +1 -1
- package/dist/cjs/transactions/blueRewards.d.ts.map +1 -1
- package/dist/cjs/transactions/blueRewards.js +62 -4
- 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 +502 -132
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/cjs/transactions/collect_rewards.js +5 -1
- package/dist/cjs/transactions/collect_rewards.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +2 -4
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/navi.d.ts.map +1 -1
- package/dist/cjs/transactions/navi.js +64 -0
- package/dist/cjs/transactions/navi.js.map +1 -1
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/cjs/transactions/zapDeposit.js +89 -38
- package/dist/cjs/transactions/zapDeposit.js.map +1 -1
- package/dist/cjs/utils/constants.d.ts.map +1 -1
- package/dist/cjs/utils/constants.js +5 -0
- package/dist/cjs/utils/constants.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 +98 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +76 -18
- 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 +127 -40
- 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 +5 -5
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/getLastAutoCompoundTime.js +2 -2
- package/dist/esm/getLastAutoCompoundTime.js.map +1 -1
- package/dist/esm/sui-sdk/events/fetchAutoCompoundingEvents.d.ts.map +1 -1
- package/dist/esm/sui-sdk/events/fetchAutoCompoundingEvents.js +2 -1
- package/dist/esm/sui-sdk/events/fetchAutoCompoundingEvents.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +1 -0
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/transactions/7k.d.ts +1 -1
- package/dist/esm/transactions/7k.d.ts.map +1 -1
- package/dist/esm/transactions/7k.js +2 -1
- package/dist/esm/transactions/7k.js.map +1 -1
- package/dist/esm/transactions/blueRewards.d.ts.map +1 -1
- package/dist/esm/transactions/blueRewards.js +62 -4
- 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 +502 -132
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/esm/transactions/collect_rewards.js +5 -1
- package/dist/esm/transactions/collect_rewards.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +2 -4
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/navi.d.ts.map +1 -1
- package/dist/esm/transactions/navi.js +64 -0
- package/dist/esm/transactions/navi.js.map +1 -1
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -1
- package/dist/esm/transactions/zapDeposit.js +89 -38
- package/dist/esm/transactions/zapDeposit.js.map +1 -1
- package/dist/esm/utils/constants.d.ts.map +1 -1
- package/dist/esm/utils/constants.js +5 -0
- package/dist/esm/utils/constants.js.map +1 -1
- package/docs/assets/highlight.css +74 -51
- package/docs/assets/icons.js +20 -17
- package/docs/assets/main.js +2163 -5
- package/docs/assets/navigation.js +2 -1
- package/docs/assets/search.js +2 -1
- package/docs/assets/style.css +846 -850
- package/docs/functions/alphaLpBreakdown.html +253 -1
- package/docs/functions/cetusLpBreakdown.html +253 -1
- package/docs/functions/claimBlueRewardTxb.html +258 -1
- package/docs/functions/claimRewardTxb.html +243 -1
- package/docs/functions/coinAmountToXTokensDoubleAsset.html +267 -1
- package/docs/functions/coinAmountToXTokensSingleAsset.html +260 -1
- package/docs/functions/coinsInPool.html +438 -1
- package/docs/functions/collectRewards.html +242 -1
- package/docs/functions/deposit.html +246 -1
- package/docs/functions/depositDoubleAssetTxb.html +270 -1
- package/docs/functions/depositSingleAssetTxb.html +263 -1
- package/docs/functions/fetchAfterTransactionEvents.html +328 -1
- package/docs/functions/fetchAutoCompoundingEvents.html +257 -1
- package/docs/functions/fetchAutoCompoundingEventsGql.html +251 -1
- package/docs/functions/fetchCetusPools.html +231 -1
- package/docs/functions/fetchChainIdentifier.html +233 -1
- package/docs/functions/fetchCheckRatioEvents.html +249 -1
- package/docs/functions/fetchLiquidityChangeEvents.html +257 -1
- package/docs/functions/fetchMultiCategoryEvents.html +348 -1
- package/docs/functions/fetchMultiReceipts.html +261 -1
- package/docs/functions/fetchNftHolders.html +233 -1
- package/docs/functions/fetchPools.html +230 -1
- package/docs/functions/fetchPortfolioData.html +243 -1
- package/docs/functions/fetchProtocolData.html +231 -1
- package/docs/functions/fetchTVL.html +253 -1
- package/docs/functions/fetchUserVaultBalances.html +245 -1
- package/docs/functions/fetchUserVaults.html +243 -1
- package/docs/functions/fetchUserWalletData.html +243 -1
- package/docs/functions/fetchVoloExchangeRate.html +251 -1
- package/docs/functions/fetchWithdrawV2Events.html +255 -1
- package/docs/functions/getAirdropShare.html +243 -1
- package/docs/functions/getAllDoubleAssetVaults.html +235 -1
- package/docs/functions/getAllSingleAssetVaults.html +235 -1
- package/docs/functions/getAllVaultBalances.html +265 -1
- package/docs/functions/getAllVaults.html +233 -1
- package/docs/functions/getAlphaUnlocks.html +245 -1
- package/docs/functions/getAlphaVaultBalance.html +255 -1
- package/docs/functions/getAmounts.html +272 -1
- package/docs/functions/getApr.html +243 -1
- package/docs/functions/getAprs.html +255 -1
- package/docs/functions/getApy.html +243 -1
- package/docs/functions/getApys.html +255 -1
- package/docs/functions/getCetusInvestorTicksMap.html +284 -1
- package/docs/functions/getCetusPool.html +270 -1
- package/docs/functions/getCetusSqrtPriceMap.html +249 -1
- package/docs/functions/getCoinAmountsFromLiquidity.html +273 -1
- package/docs/functions/getConf.html +13163 -1
- package/docs/functions/getCurrentTick.html +247 -1
- package/docs/functions/getDistributor.html +252 -1
- package/docs/functions/getDoubleAssetVaultBalance.html +268 -1
- package/docs/functions/getDoubleAssetVaults.html +253 -1
- package/docs/functions/getHoldersFromTransactions.html +299 -1
- package/docs/functions/getInvestor.html +259 -1
- package/docs/functions/getInvestorPoolMap.html +241 -1
- package/docs/functions/getLastAutoCompoundTime.html +249 -1
- package/docs/functions/getLatestPrices.html +253 -1
- package/docs/functions/getLiquidity.html +260 -1
- package/docs/functions/getMultiCetusPool.html +231 -1
- package/docs/functions/getMultiInvestor.html +231 -1
- package/docs/functions/getMultiLatestPrices.html +233 -1
- package/docs/functions/getMultiParentPool.html +231 -1
- package/docs/functions/getMultiPool.html +231 -1
- package/docs/functions/getMultiReceipts.html +243 -1
- package/docs/functions/getParentPool.html +266 -1
- package/docs/functions/getPool.html +262 -1
- package/docs/functions/getPoolExchangeRate.html +254 -1
- package/docs/functions/getPoolExchangeRateMap.html +249 -1
- package/docs/functions/getPoolsWeightDistribution.html +266 -1
- package/docs/functions/getPositionRange.html +283 -1
- package/docs/functions/getPositionRanges.html +289 -1
- package/docs/functions/getPositionTicks.html +249 -1
- package/docs/functions/getPriceToTick.html +264 -1
- package/docs/functions/getRebalanceHistories.html +269 -1
- package/docs/functions/getRebalanceHistory.html +255 -1
- package/docs/functions/getReceipts.html +268 -1
- package/docs/functions/getSingleAssetVaultBalance.html +268 -1
- package/docs/functions/getSingleAssetVaults.html +253 -1
- package/docs/functions/getSuiClient.html +247 -3
- package/docs/functions/getSuiNodeUrl.html +232 -3
- package/docs/functions/getTVLs-1.html +243 -1
- package/docs/functions/getTickSpacing.html +247 -1
- package/docs/functions/getTickToPrice.html +248 -1
- package/docs/functions/getTvls.html +259 -1
- package/docs/functions/getUserTokensFromTransactions.html +269 -1
- package/docs/functions/getUserTokensInUsdFromTransactions.html +263 -1
- package/docs/functions/getVaultBalance.html +277 -1
- package/docs/functions/getVaultBalanceForActiveUsers.html +261 -1
- package/docs/functions/getVaults.html +250 -1
- package/docs/functions/getXTokenVaultBalanceForActiveUsers.html +261 -1
- package/docs/functions/getZapAmounts.html +323 -1
- package/docs/functions/lastAutocompoundTime.html +249 -1
- package/docs/functions/liquidityToTokens.html +253 -1
- package/docs/functions/multiLiquidityToTokens.html +271 -1
- package/docs/functions/multiTokensToUsd.html +262 -1
- package/docs/functions/multiXTokensToLiquidity.html +257 -1
- package/docs/functions/parseUserWalletData.html +243 -1
- package/docs/functions/pendingBlueRewardAmount.html +256 -1
- package/docs/functions/setCustomSuiClient.html +251 -5
- package/docs/functions/setSuiClient.html +255 -7
- package/docs/functions/setSuiNodeUrl.html +249 -5
- package/docs/functions/setWeights.html +270 -1
- package/docs/functions/withdraw.html +249 -1
- package/docs/functions/withdrawAlphaTxb.html +257 -1
- package/docs/functions/withdrawTxb.html +260 -1
- package/docs/functions/zapDepositTxb.html +300 -1
- package/docs/index.html +587 -41
- package/docs/interfaces/Coin.html +474 -12
- package/docs/interfaces/CoinPair.html +358 -3
- package/docs/interfaces/NaviVoloData.html +514 -3
- package/docs/interfaces/PoolData.html +579 -8
- package/docs/interfaces/PoolWeightDistribution.html +414 -4
- package/docs/interfaces/RebalanceHistoryType.html +652 -9
- package/docs/modules.html +1430 -198
- package/docs/types/AfterTransactionEventNode.html +305 -1
- package/docs/types/Allocator.html +321 -1
- package/docs/types/AlphaFiDoubleAssetVault.html +258 -1
- package/docs/types/AlphaFiMultiVaultBalance.html +219 -1
- package/docs/types/AlphaFiSingleAssetVault.html +244 -1
- package/docs/types/AlphaFiVault.html +214 -1
- package/docs/types/AlphaFiVaultBalance.html +220 -1
- package/docs/types/AlphaPoolType.html +383 -1
- package/docs/types/AlphaReceipt.html +220 -1
- package/docs/types/AlphaReceiptFields.html +421 -1
- package/docs/types/AlphaVaultBalance.html +245 -1
- package/docs/types/AutoBalancePoolNames.html +226 -1
- package/docs/types/AutoCompoundingEventNode.html +230 -1
- package/docs/types/BluefinInvestor.html +209 -1
- package/docs/types/BluefinPoolType.html +440 -1
- package/docs/types/BucketInvestor.html +249 -1
- package/docs/types/CetusInvestor.html +240 -1
- package/docs/types/CetusPoolType.html +433 -1
- package/docs/types/CetusSwapOptions.html +209 -1
- package/docs/types/CoinAmounts.html +216 -1
- package/docs/types/CoinName.html +293 -1
- package/docs/types/CoinType.html +294 -1
- package/docs/types/CommonInvestorFields.html +276 -1
- package/docs/types/CreatePoolOptions.html +246 -1
- package/docs/types/Distributor.html +341 -1
- package/docs/types/DoubleAssetMultiVaultBalance.html +236 -1
- package/docs/types/DoubleAssetPoolNames.html +297 -1
- package/docs/types/DoubleAssetTokenHoldings.html +232 -1
- package/docs/types/DoubleAssetVaultBalance.html +229 -1
- package/docs/types/EventCategory.html +209 -1
- package/docs/types/EventNode.html +229 -1
- package/docs/types/GetHoldersParams.html +221 -1
- package/docs/types/GetTokenHoldingsParams.html +227 -1
- package/docs/types/GetUserTokensFromTransactionsParams.html +233 -1
- package/docs/types/GetUserTokensInUsdFromTransactionsParams.html +244 -1
- package/docs/types/GetVaultBalanceForActiveUsersParams.html +231 -1
- package/docs/types/GetVaultBalanceParams.html +217 -1
- package/docs/types/HoldingsObj.html +223 -1
- package/docs/types/Icon.html +266 -1
- package/docs/types/Investor.html +245 -1
- package/docs/types/LiquidityChangeEventNode.html +220 -1
- package/docs/types/LiquidityToTokensParams.html +255 -1
- package/docs/types/LiquidityToUsdParams.html +267 -1
- package/docs/types/LoopingDebt.html +258 -1
- package/docs/types/LoopingPoolNames.html +216 -1
- package/docs/types/LpBreakdownType.html +238 -1
- package/docs/types/MemberPoolDataType.html +276 -1
- package/docs/types/MemberType.html +269 -1
- package/docs/types/MultiGetVaultBalancesParams.html +229 -1
- package/docs/types/NaviInvestor.html +235 -1
- package/docs/types/OtherReceiptFields.html +373 -1
- package/docs/types/PoolName.html +214 -1
- package/docs/types/PoolReceipt.html +253 -1
- package/docs/types/PoolType.html +388 -1
- package/docs/types/Receipt.html +475 -1
- package/docs/types/ReceiptGQL.html +374 -1
- package/docs/types/SingleAssetMultiVaultBalance.html +232 -1
- package/docs/types/SingleAssetPoolNames.html +244 -1
- package/docs/types/SingleAssetTokenHoldings.html +228 -1
- package/docs/types/SingleAssetVaultBalance.html +223 -1
- package/docs/types/SingleGetVaultBalancesParams.html +224 -1
- package/docs/types/StrategyType.html +221 -1
- package/docs/types/SuiNetwork.html +213 -1
- package/docs/types/SwapOptions.html +248 -1
- package/docs/types/TickSpacing.html +212 -1
- package/docs/types/TotalWeightType.html +246 -1
- package/docs/types/TransactionBlockType.html +358 -1
- package/docs/types/UserPoolLiquidity.html +221 -1
- package/docs/types/UserPoolTokenHoldings.html +217 -1
- package/docs/types/UserUsdHoldings.html +223 -1
- package/docs/types/VaultBalance.html +216 -1
- package/docs/types/WithdrawV2EventNode.html +208 -1
- package/docs/variables/bluefinPoolMap.html +214 -1
- package/docs/variables/cetusPoolMap.html +214 -1
- package/docs/variables/coinsList.html +220 -1
- package/docs/variables/defunctPoolsSet.html +209 -1
- package/docs/variables/doubleAssetPoolCoinMap.html +237 -1
- package/docs/variables/eventCategories.html +210 -1
- package/docs/variables/ignoredWalletsForDailyRevenue.html +218 -1
- package/docs/variables/loopingAccountAddresses.html +219 -1
- package/docs/variables/loopingPoolCoinMap.html +233 -1
- package/docs/variables/naviAssetMap.html +215 -1
- package/docs/variables/poolIdPoolNameMap.html +218 -1
- package/docs/variables/poolInfo.html +319 -1
- package/docs/variables/singleAssetPoolCoinMap.html +229 -1
- package/docs/variables/stableCoins.html +207 -1
- package/package.json +2 -2
- package/prettier.config.js +3 -0
|
@@ -56,7 +56,7 @@ options) {
|
|
|
56
56
|
inAmount: new bn_js_1.default(inputCoinAmount),
|
|
57
57
|
slippage: slippage,
|
|
58
58
|
};
|
|
59
|
-
const result = await zapSwap(swapOptionsI2B, txb);
|
|
59
|
+
const result = await zapSwap(swapOptionsI2B, txb, poolName);
|
|
60
60
|
if (result) {
|
|
61
61
|
amountB = result.amountOut;
|
|
62
62
|
txb = result.tx;
|
|
@@ -89,7 +89,7 @@ options) {
|
|
|
89
89
|
inAmount: new bn_js_1.default(inputCoinAmount),
|
|
90
90
|
slippage: slippage,
|
|
91
91
|
};
|
|
92
|
-
const result = await zapSwap(swapOptionsI2A, txb);
|
|
92
|
+
const result = await zapSwap(swapOptionsI2A, txb, poolName);
|
|
93
93
|
if (result) {
|
|
94
94
|
amountA = result.amountOut;
|
|
95
95
|
txb = result.tx;
|
|
@@ -111,7 +111,7 @@ options) {
|
|
|
111
111
|
inAmount: new bn_js_1.default(amount1),
|
|
112
112
|
slippage: slippage,
|
|
113
113
|
};
|
|
114
|
-
const ratioQuote = await zapGetQuote(swapGateway, swapOptions);
|
|
114
|
+
const ratioQuote = await zapGetQuote(swapGateway, swapOptions, poolName);
|
|
115
115
|
if (ratioQuote === undefined) {
|
|
116
116
|
console.error("Error fetching ratioQuote for zap");
|
|
117
117
|
return undefined;
|
|
@@ -139,7 +139,7 @@ options) {
|
|
|
139
139
|
slippage: slippage,
|
|
140
140
|
};
|
|
141
141
|
if (inputCoinName === coinTypeA) {
|
|
142
|
-
const result = await zapSwap(swapOptionsI2B, txb);
|
|
142
|
+
const result = await zapSwap(swapOptionsI2B, txb, poolName);
|
|
143
143
|
if (result) {
|
|
144
144
|
amountB = result.amountOut;
|
|
145
145
|
txb = result.tx;
|
|
@@ -158,7 +158,7 @@ options) {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
else if (inputCoinName === coinTypeB) {
|
|
161
|
-
const result = await zapSwap(swapOptionsI2A, txb);
|
|
161
|
+
const result = await zapSwap(swapOptionsI2A, txb, poolName);
|
|
162
162
|
if (result) {
|
|
163
163
|
amountA = result.amountOut;
|
|
164
164
|
txb = result.tx;
|
|
@@ -177,7 +177,7 @@ options) {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
|
-
let result = await zapSwap(swapOptionsI2A, txb);
|
|
180
|
+
let result = await zapSwap(swapOptionsI2A, txb, poolName);
|
|
181
181
|
if (result) {
|
|
182
182
|
amountA = result.amountOut;
|
|
183
183
|
txb = result.tx;
|
|
@@ -185,7 +185,7 @@ options) {
|
|
|
185
185
|
coin1 = result.coinOut;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
result = await zapSwap(swapOptionsI2B, txb);
|
|
188
|
+
result = await zapSwap(swapOptionsI2B, txb, poolName);
|
|
189
189
|
if (result) {
|
|
190
190
|
amountB = result.amountOut;
|
|
191
191
|
txb = result.tx;
|
|
@@ -206,8 +206,8 @@ options) {
|
|
|
206
206
|
txb.transferObjects([feeCoinA, feeCoinB], fee_address);
|
|
207
207
|
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
208
208
|
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
209
|
-
amountA = (Number(amountA) * 0.
|
|
210
|
-
amountB = (Number(amountB) * 0.
|
|
209
|
+
amountA = (Number(amountA) * 0.995).toString();
|
|
210
|
+
amountB = (Number(amountB) * 0.995).toString();
|
|
211
211
|
if (maps_js_1.poolInfo[poolName].parentProtocolName === "CETUS") {
|
|
212
212
|
if (pool1 === "CETUS" && pool2 === "SUI") {
|
|
213
213
|
txb = await depositCetusSuiTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
@@ -242,7 +242,7 @@ options) {
|
|
|
242
242
|
txb.setGasBudget(100000000);
|
|
243
243
|
return txb;
|
|
244
244
|
}
|
|
245
|
-
async function zapGetQuote(swapGateway, swapOptions) {
|
|
245
|
+
async function zapGetQuote(swapGateway, swapOptions, poolName) {
|
|
246
246
|
if (swapOptions.pair.coinA.name === "SUI" &&
|
|
247
247
|
swapOptions.pair.coinB.name === "STSUI") {
|
|
248
248
|
const exchangeRate = new decimal_js_1.Decimal(await (0, stsui_sdk_1.stSuiExchangeRate)());
|
|
@@ -256,7 +256,9 @@ async function zapGetQuote(swapGateway, swapOptions) {
|
|
|
256
256
|
return amount.mul(exchangeRate).toString();
|
|
257
257
|
}
|
|
258
258
|
else {
|
|
259
|
-
const quoteResponse = await swapGateway.getQuote(swapOptions
|
|
259
|
+
const quoteResponse = await swapGateway.getQuote(swapOptions, [
|
|
260
|
+
maps_js_1.poolInfo[poolName].parentPoolId,
|
|
261
|
+
]);
|
|
260
262
|
if (quoteResponse) {
|
|
261
263
|
return quoteResponse.returnAmountWithDecimal
|
|
262
264
|
? quoteResponse.returnAmountWithDecimal
|
|
@@ -264,10 +266,9 @@ async function zapGetQuote(swapGateway, swapOptions) {
|
|
|
264
266
|
}
|
|
265
267
|
}
|
|
266
268
|
}
|
|
267
|
-
async function zapSwap(swapOptions, txb) {
|
|
269
|
+
async function zapSwap(swapOptions, txb, poolName) {
|
|
268
270
|
if (swapOptions.pair.coinA.name === "SUI" &&
|
|
269
271
|
swapOptions.pair.coinB.name === "STSUI") {
|
|
270
|
-
console.log("mintTx called");
|
|
271
272
|
const result = await (0, stsui_sdk_1.mintTx)(swapOptions.inAmount ? swapOptions.inAmount.toString() : "0", txb);
|
|
272
273
|
return {
|
|
273
274
|
tx: result.tx,
|
|
@@ -278,14 +279,14 @@ async function zapSwap(swapOptions, txb) {
|
|
|
278
279
|
}
|
|
279
280
|
else if (swapOptions.pair.coinA.name === "STSUI" &&
|
|
280
281
|
swapOptions.pair.coinB.name === "SUI") {
|
|
281
|
-
console.log("redeemTx called");
|
|
282
282
|
const result = await (0, stsui_sdk_1.redeemTx)(swapOptions.inAmount ? swapOptions.inAmount.toString() : "0", txb, { address: swapOptions.senderAddress });
|
|
283
283
|
return result;
|
|
284
284
|
}
|
|
285
285
|
else {
|
|
286
|
-
console.log("7k swap", swapOptions);
|
|
287
286
|
const swapGateway = new _7k_js_1.SevenKGateway();
|
|
288
|
-
const quoteResponse = await swapGateway.getQuote(swapOptions
|
|
287
|
+
const quoteResponse = await swapGateway.getQuote(swapOptions, [
|
|
288
|
+
maps_js_1.poolInfo[poolName].parentPoolId,
|
|
289
|
+
]);
|
|
289
290
|
if (quoteResponse) {
|
|
290
291
|
const result = await swapGateway.getTransactionBlock(swapOptions, quoteResponse, txb);
|
|
291
292
|
return {
|
|
@@ -595,7 +596,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
595
596
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
596
597
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
597
598
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
598
|
-
txb.object((0, constants_js_1.getConf)().
|
|
599
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
599
600
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
600
601
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
601
602
|
],
|
|
@@ -622,7 +623,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
622
623
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
623
624
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
624
625
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_BUCK_POOL),
|
|
625
|
-
txb.object((0, constants_js_1.getConf)().
|
|
626
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
626
627
|
txb.object(maps_js_1.cetusPoolMap["BUCK-SUI"]),
|
|
627
628
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
628
629
|
],
|
|
@@ -649,7 +650,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
649
650
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
650
651
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
651
652
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_AUSD_POOL),
|
|
652
|
-
txb.object((0, constants_js_1.getConf)().
|
|
653
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
653
654
|
txb.object(maps_js_1.cetusPoolMap["AUSD-SUI"]),
|
|
654
655
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
655
656
|
],
|
|
@@ -675,7 +676,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
675
676
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
676
677
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
677
678
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
678
|
-
txb.object((0, constants_js_1.getConf)().
|
|
679
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
679
680
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
680
681
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
681
682
|
],
|
|
@@ -745,7 +746,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
745
746
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
746
747
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
747
748
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
748
|
-
txb.object((0, constants_js_1.getConf)().
|
|
749
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
749
750
|
txb.object(maps_js_1.cetusPoolMap["USDC-USDT"]),
|
|
750
751
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
751
752
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -773,7 +774,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
773
774
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
774
775
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
775
776
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_AUSD_USDC_POOL),
|
|
776
|
-
txb.object((0, constants_js_1.getConf)().
|
|
777
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
777
778
|
txb.object(maps_js_1.cetusPoolMap["USDC-AUSD"]),
|
|
778
779
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
779
780
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -801,7 +802,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
801
802
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
802
803
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
803
804
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
804
|
-
txb.object((0, constants_js_1.getConf)().
|
|
805
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
805
806
|
txb.object(maps_js_1.cetusPoolMap["USDC-WBTC"]),
|
|
806
807
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
807
808
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -829,7 +830,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
829
830
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
830
831
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
831
832
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SEND_USDC_POOL),
|
|
832
|
-
txb.object((0, constants_js_1.getConf)().
|
|
833
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
833
834
|
txb.object(maps_js_1.cetusPoolMap["USDC-SEND"]),
|
|
834
835
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
835
836
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -857,7 +858,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
857
858
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
858
859
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
859
860
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
860
|
-
txb.object((0, constants_js_1.getConf)().
|
|
861
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
861
862
|
txb.object(maps_js_1.cetusPoolMap["USDC-STSUI"]),
|
|
862
863
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
863
864
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -884,7 +885,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
884
885
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
885
886
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
886
887
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
887
|
-
txb.object((0, constants_js_1.getConf)().
|
|
888
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
888
889
|
txb.object(maps_js_1.cetusPoolMap["USDC-USDT"]),
|
|
889
890
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
890
891
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -912,7 +913,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
912
913
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
913
914
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
914
915
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
915
|
-
txb.object((0, constants_js_1.getConf)().
|
|
916
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
916
917
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
917
918
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
918
919
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -939,7 +940,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
939
940
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
940
941
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
941
942
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
942
|
-
txb.object((0, constants_js_1.getConf)().
|
|
943
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
943
944
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUIUSDT"]),
|
|
944
945
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
945
946
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -966,7 +967,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
966
967
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
967
968
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
968
969
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_BLUE_POOL),
|
|
969
|
-
txb.object((0, constants_js_1.getConf)().
|
|
970
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
970
971
|
txb.object(maps_js_1.cetusPoolMap["BLUE-DEEP"]),
|
|
971
972
|
txb.object(maps_js_1.cetusPoolMap["BLUE-SUI"]),
|
|
972
973
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -1037,7 +1038,7 @@ const depositBluefinType2Txb = async (amountA, amountB, poolName, options, trans
|
|
|
1037
1038
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1038
1039
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1039
1040
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_USDC_POOL),
|
|
1040
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1041
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1041
1042
|
txb.object(maps_js_1.cetusPoolMap["ALPHA-USDC"]),
|
|
1042
1043
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1043
1044
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -1065,7 +1066,7 @@ const depositBluefinType2Txb = async (amountA, amountB, poolName, options, trans
|
|
|
1065
1066
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1066
1067
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1067
1068
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_NAVX_VSUI_POOL),
|
|
1068
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1069
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1069
1070
|
txb.object(maps_js_1.cetusPoolMap["NAVX-VSUI"]),
|
|
1070
1071
|
txb.object(maps_js_1.cetusPoolMap["VSUI-SUI"]),
|
|
1071
1072
|
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
@@ -1306,6 +1307,56 @@ const depositBluefinSuiSecondTxb = async (amountA, amountB, poolName, options, t
|
|
|
1306
1307
|
],
|
|
1307
1308
|
});
|
|
1308
1309
|
}
|
|
1310
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-DEEP-SUI") {
|
|
1311
|
+
txb.moveCall({
|
|
1312
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
1313
|
+
typeArguments: [
|
|
1314
|
+
coins_js_1.coinsList[pool1].type,
|
|
1315
|
+
coins_js_1.coinsList[pool2].type,
|
|
1316
|
+
coins_js_1.coinsList["BLUE"].type,
|
|
1317
|
+
],
|
|
1318
|
+
arguments: [
|
|
1319
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
1320
|
+
someReceipt,
|
|
1321
|
+
txb.object(poolinfo.poolId),
|
|
1322
|
+
depositCoinA,
|
|
1323
|
+
depositCoinB,
|
|
1324
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1325
|
+
txb.object(poolinfo.investorId),
|
|
1326
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1327
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1328
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
1329
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1330
|
+
txb.object(maps_js_1.cetusPoolMap["DEEP-SUI"]),
|
|
1331
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1332
|
+
],
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-BLUE-SUI") {
|
|
1336
|
+
txb.moveCall({
|
|
1337
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
1338
|
+
typeArguments: [
|
|
1339
|
+
coins_js_1.coinsList[pool1].type,
|
|
1340
|
+
coins_js_1.coinsList[pool2].type,
|
|
1341
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
1342
|
+
],
|
|
1343
|
+
arguments: [
|
|
1344
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
1345
|
+
someReceipt,
|
|
1346
|
+
txb.object(poolinfo.poolId),
|
|
1347
|
+
depositCoinA,
|
|
1348
|
+
depositCoinB,
|
|
1349
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
1350
|
+
txb.object(poolinfo.investorId),
|
|
1351
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1352
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1353
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1354
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
1355
|
+
txb.object(maps_js_1.cetusPoolMap["BLUE-SUI"]),
|
|
1356
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
1357
|
+
],
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1309
1360
|
txb.transferObjects([coin1Arg, coin2Arg], address);
|
|
1310
1361
|
}
|
|
1311
1362
|
else {
|
|
@@ -1369,7 +1420,7 @@ const depositBluefinStsuiTxb = async (amountA, amountB, poolName, options, trans
|
|
|
1369
1420
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1370
1421
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1371
1422
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_STSUI_USDC_POOL),
|
|
1372
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1423
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1373
1424
|
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
1374
1425
|
txb.object(maps_js_1.bluefinPoolMap["SUI-USDC"]),
|
|
1375
1426
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
@@ -1399,7 +1450,7 @@ const depositBluefinStsuiTxb = async (amountA, amountB, poolName, options, trans
|
|
|
1399
1450
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
1400
1451
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
1401
1452
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_STSUI_POOL),
|
|
1402
|
-
txb.object((0, constants_js_1.getConf)().
|
|
1453
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_BLUE_SUI_POOL),
|
|
1403
1454
|
txb.object(maps_js_1.cetusPoolMap["ALPHA-SUI"]),
|
|
1404
1455
|
txb.object(maps_js_1.bluefinPoolMap["SUI-ALPHA"]),
|
|
1405
1456
|
txb.object((0, constants_js_1.getConf)().LST_INFO),
|
|
@@ -1437,7 +1488,7 @@ async function getZapAmounts(inputCoinAmount, inputCoinName, poolName, slippage,
|
|
|
1437
1488
|
inAmount: new bn_js_1.default(amount1),
|
|
1438
1489
|
slippage: slippage,
|
|
1439
1490
|
};
|
|
1440
|
-
const ratioQuote = await zapGetQuote(swapGateway, swapOptions);
|
|
1491
|
+
const ratioQuote = await zapGetQuote(swapGateway, swapOptions, poolName);
|
|
1441
1492
|
if (ratioQuote) {
|
|
1442
1493
|
const amount1InCoinType2 = Number(ratioQuote);
|
|
1443
1494
|
const totalAmount = amount2 + amount1InCoinType2;
|
|
@@ -1463,16 +1514,16 @@ async function getZapAmounts(inputCoinAmount, inputCoinName, poolName, slippage,
|
|
|
1463
1514
|
slippage: slippage,
|
|
1464
1515
|
};
|
|
1465
1516
|
if (inputCoinName === coinTypeA) {
|
|
1466
|
-
amountB = await zapGetQuote(swapGateway, swapOptionsI2B);
|
|
1517
|
+
amountB = await zapGetQuote(swapGateway, swapOptionsI2B, poolName);
|
|
1467
1518
|
amountA = inputAmountToType1.toString();
|
|
1468
1519
|
}
|
|
1469
1520
|
else if (inputCoinName === coinTypeB) {
|
|
1470
|
-
amountA = await zapGetQuote(swapGateway, swapOptionsI2A);
|
|
1521
|
+
amountA = await zapGetQuote(swapGateway, swapOptionsI2A, poolName);
|
|
1471
1522
|
amountB = inputAmountToType2.toString();
|
|
1472
1523
|
}
|
|
1473
1524
|
else {
|
|
1474
|
-
amountA = await zapGetQuote(swapGateway, swapOptionsI2A);
|
|
1475
|
-
amountB = await zapGetQuote(swapGateway, swapOptionsI2B);
|
|
1525
|
+
amountA = await zapGetQuote(swapGateway, swapOptionsI2A, poolName);
|
|
1526
|
+
amountB = await zapGetQuote(swapGateway, swapOptionsI2B, poolName);
|
|
1476
1527
|
}
|
|
1477
1528
|
if (amountA && amountB) {
|
|
1478
1529
|
const [coin1Price, coin2Price] = await (0, prices_js_1.getLatestPrices)([
|