@alphafi/alphafi-sdk 0.0.55 → 0.0.58
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 +93 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +90 -25
- 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 +91 -39
- 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 +4 -4
- 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 +18 -6
- 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 +364 -40
- 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 +93 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +90 -25
- 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 +91 -39
- 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 +4 -4
- 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 +18 -6
- 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 +364 -40
- 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
|
@@ -51,7 +51,7 @@ options) {
|
|
|
51
51
|
inAmount: new BN(inputCoinAmount),
|
|
52
52
|
slippage: slippage,
|
|
53
53
|
};
|
|
54
|
-
const result = await zapSwap(swapOptionsI2B, txb);
|
|
54
|
+
const result = await zapSwap(swapOptionsI2B, txb, poolName);
|
|
55
55
|
if (result) {
|
|
56
56
|
amountB = result.amountOut;
|
|
57
57
|
txb = result.tx;
|
|
@@ -84,7 +84,7 @@ options) {
|
|
|
84
84
|
inAmount: new BN(inputCoinAmount),
|
|
85
85
|
slippage: slippage,
|
|
86
86
|
};
|
|
87
|
-
const result = await zapSwap(swapOptionsI2A, txb);
|
|
87
|
+
const result = await zapSwap(swapOptionsI2A, txb, poolName);
|
|
88
88
|
if (result) {
|
|
89
89
|
amountA = result.amountOut;
|
|
90
90
|
txb = result.tx;
|
|
@@ -106,7 +106,7 @@ options) {
|
|
|
106
106
|
inAmount: new BN(amount1),
|
|
107
107
|
slippage: slippage,
|
|
108
108
|
};
|
|
109
|
-
const ratioQuote = await zapGetQuote(swapGateway, swapOptions);
|
|
109
|
+
const ratioQuote = await zapGetQuote(swapGateway, swapOptions, poolName);
|
|
110
110
|
if (ratioQuote === undefined) {
|
|
111
111
|
console.error("Error fetching ratioQuote for zap");
|
|
112
112
|
return undefined;
|
|
@@ -134,7 +134,7 @@ options) {
|
|
|
134
134
|
slippage: slippage,
|
|
135
135
|
};
|
|
136
136
|
if (inputCoinName === coinTypeA) {
|
|
137
|
-
const result = await zapSwap(swapOptionsI2B, txb);
|
|
137
|
+
const result = await zapSwap(swapOptionsI2B, txb, poolName);
|
|
138
138
|
if (result) {
|
|
139
139
|
amountB = result.amountOut;
|
|
140
140
|
txb = result.tx;
|
|
@@ -153,7 +153,7 @@ options) {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
else if (inputCoinName === coinTypeB) {
|
|
156
|
-
const result = await zapSwap(swapOptionsI2A, txb);
|
|
156
|
+
const result = await zapSwap(swapOptionsI2A, txb, poolName);
|
|
157
157
|
if (result) {
|
|
158
158
|
amountA = result.amountOut;
|
|
159
159
|
txb = result.tx;
|
|
@@ -172,7 +172,7 @@ options) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
|
-
let result = await zapSwap(swapOptionsI2A, txb);
|
|
175
|
+
let result = await zapSwap(swapOptionsI2A, txb, poolName);
|
|
176
176
|
if (result) {
|
|
177
177
|
amountA = result.amountOut;
|
|
178
178
|
txb = result.tx;
|
|
@@ -180,7 +180,7 @@ options) {
|
|
|
180
180
|
coin1 = result.coinOut;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
result = await zapSwap(swapOptionsI2B, txb);
|
|
183
|
+
result = await zapSwap(swapOptionsI2B, txb, poolName);
|
|
184
184
|
if (result) {
|
|
185
185
|
amountB = result.amountOut;
|
|
186
186
|
txb = result.tx;
|
|
@@ -201,8 +201,8 @@ options) {
|
|
|
201
201
|
txb.transferObjects([feeCoinA, feeCoinB], fee_address);
|
|
202
202
|
const pool1 = doubleAssetPoolCoinMap[poolName].coin1;
|
|
203
203
|
const pool2 = doubleAssetPoolCoinMap[poolName].coin2;
|
|
204
|
-
amountA = (Number(amountA) * 0.
|
|
205
|
-
amountB = (Number(amountB) * 0.
|
|
204
|
+
amountA = (Number(amountA) * 0.995).toString();
|
|
205
|
+
amountB = (Number(amountB) * 0.995).toString();
|
|
206
206
|
if (poolInfo[poolName].parentProtocolName === "CETUS") {
|
|
207
207
|
if (pool1 === "CETUS" && pool2 === "SUI") {
|
|
208
208
|
txb = await depositCetusSuiTxb(amountA, amountB, poolName, { address }, txb, coin1, coin2);
|
|
@@ -237,7 +237,7 @@ options) {
|
|
|
237
237
|
txb.setGasBudget(100000000);
|
|
238
238
|
return txb;
|
|
239
239
|
}
|
|
240
|
-
async function zapGetQuote(swapGateway, swapOptions) {
|
|
240
|
+
async function zapGetQuote(swapGateway, swapOptions, poolName) {
|
|
241
241
|
if (swapOptions.pair.coinA.name === "SUI" &&
|
|
242
242
|
swapOptions.pair.coinB.name === "STSUI") {
|
|
243
243
|
const exchangeRate = new Decimal(await stSuiExchangeRate());
|
|
@@ -251,7 +251,9 @@ async function zapGetQuote(swapGateway, swapOptions) {
|
|
|
251
251
|
return amount.mul(exchangeRate).toString();
|
|
252
252
|
}
|
|
253
253
|
else {
|
|
254
|
-
const quoteResponse = await swapGateway.getQuote(swapOptions
|
|
254
|
+
const quoteResponse = await swapGateway.getQuote(swapOptions, [
|
|
255
|
+
poolInfo[poolName].parentPoolId,
|
|
256
|
+
]);
|
|
255
257
|
if (quoteResponse) {
|
|
256
258
|
return quoteResponse.returnAmountWithDecimal
|
|
257
259
|
? quoteResponse.returnAmountWithDecimal
|
|
@@ -259,10 +261,9 @@ async function zapGetQuote(swapGateway, swapOptions) {
|
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
}
|
|
262
|
-
async function zapSwap(swapOptions, txb) {
|
|
264
|
+
async function zapSwap(swapOptions, txb, poolName) {
|
|
263
265
|
if (swapOptions.pair.coinA.name === "SUI" &&
|
|
264
266
|
swapOptions.pair.coinB.name === "STSUI") {
|
|
265
|
-
console.log("mintTx called");
|
|
266
267
|
const result = await mintTx(swapOptions.inAmount ? swapOptions.inAmount.toString() : "0", txb);
|
|
267
268
|
return {
|
|
268
269
|
tx: result.tx,
|
|
@@ -273,14 +274,14 @@ async function zapSwap(swapOptions, txb) {
|
|
|
273
274
|
}
|
|
274
275
|
else if (swapOptions.pair.coinA.name === "STSUI" &&
|
|
275
276
|
swapOptions.pair.coinB.name === "SUI") {
|
|
276
|
-
console.log("redeemTx called");
|
|
277
277
|
const result = await redeemTx(swapOptions.inAmount ? swapOptions.inAmount.toString() : "0", txb, { address: swapOptions.senderAddress });
|
|
278
278
|
return result;
|
|
279
279
|
}
|
|
280
280
|
else {
|
|
281
|
-
console.log("7k swap", swapOptions);
|
|
282
281
|
const swapGateway = new SevenKGateway();
|
|
283
|
-
const quoteResponse = await swapGateway.getQuote(swapOptions
|
|
282
|
+
const quoteResponse = await swapGateway.getQuote(swapOptions, [
|
|
283
|
+
poolInfo[poolName].parentPoolId,
|
|
284
|
+
]);
|
|
284
285
|
if (quoteResponse) {
|
|
285
286
|
const result = await swapGateway.getTransactionBlock(swapOptions, quoteResponse, txb);
|
|
286
287
|
return {
|
|
@@ -590,7 +591,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
590
591
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
591
592
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
592
593
|
txb.object(getConf().BLUEFIN_SUI_USDC_POOL),
|
|
593
|
-
txb.object(getConf().
|
|
594
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
594
595
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
595
596
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
596
597
|
],
|
|
@@ -617,7 +618,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
617
618
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
618
619
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
619
620
|
txb.object(getConf().BLUEFIN_SUI_BUCK_POOL),
|
|
620
|
-
txb.object(getConf().
|
|
621
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
621
622
|
txb.object(cetusPoolMap["BUCK-SUI"]),
|
|
622
623
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
623
624
|
],
|
|
@@ -644,7 +645,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
644
645
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
645
646
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
646
647
|
txb.object(getConf().BLUEFIN_SUI_AUSD_POOL),
|
|
647
|
-
txb.object(getConf().
|
|
648
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
648
649
|
txb.object(cetusPoolMap["AUSD-SUI"]),
|
|
649
650
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
650
651
|
],
|
|
@@ -670,7 +671,7 @@ const depositBluefinSuiFirstTxb = async (amountA, amountB, poolName, options, tr
|
|
|
670
671
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
671
672
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
672
673
|
txb.object(getConf().BLUEFIN_SUI_USDC_POOL),
|
|
673
|
-
txb.object(getConf().
|
|
674
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
674
675
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
675
676
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
676
677
|
],
|
|
@@ -740,7 +741,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
740
741
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
741
742
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
742
743
|
txb.object(getConf().BLUEFIN_USDT_USDC_POOL),
|
|
743
|
-
txb.object(getConf().
|
|
744
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
744
745
|
txb.object(cetusPoolMap["USDC-USDT"]),
|
|
745
746
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
746
747
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -768,7 +769,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
768
769
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
769
770
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
770
771
|
txb.object(getConf().BLUEFIN_AUSD_USDC_POOL),
|
|
771
|
-
txb.object(getConf().
|
|
772
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
772
773
|
txb.object(cetusPoolMap["USDC-AUSD"]),
|
|
773
774
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
774
775
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -796,7 +797,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
796
797
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
797
798
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
798
799
|
txb.object(getConf().BLUEFIN_WBTC_USDC_POOL),
|
|
799
|
-
txb.object(getConf().
|
|
800
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
800
801
|
txb.object(cetusPoolMap["USDC-WBTC"]),
|
|
801
802
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
802
803
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -824,7 +825,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
824
825
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
825
826
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
826
827
|
txb.object(getConf().BLUEFIN_SEND_USDC_POOL),
|
|
827
|
-
txb.object(getConf().
|
|
828
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
828
829
|
txb.object(cetusPoolMap["USDC-SEND"]),
|
|
829
830
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
830
831
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -852,7 +853,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
852
853
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
853
854
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
854
855
|
txb.object(getConf().BLUEFIN_STSUI_USDC_POOL),
|
|
855
|
-
txb.object(getConf().
|
|
856
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
856
857
|
txb.object(cetusPoolMap["USDC-STSUI"]),
|
|
857
858
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
858
859
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -879,7 +880,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
879
880
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
880
881
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
881
882
|
txb.object(getConf().BLUEFIN_USDT_USDC_POOL),
|
|
882
|
-
txb.object(getConf().
|
|
883
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
883
884
|
txb.object(cetusPoolMap["USDC-USDT"]),
|
|
884
885
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
885
886
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -907,7 +908,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
907
908
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
908
909
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
909
910
|
txb.object(getConf().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
910
|
-
txb.object(getConf().
|
|
911
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
911
912
|
txb.object(cetusPoolMap["USDC-SUIUSDT"]),
|
|
912
913
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
913
914
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -934,7 +935,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
934
935
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
935
936
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
936
937
|
txb.object(getConf().BLUEFIN_SUIUSDT_USDC_POOL),
|
|
937
|
-
txb.object(getConf().
|
|
938
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
938
939
|
txb.object(cetusPoolMap["USDC-SUIUSDT"]),
|
|
939
940
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
940
941
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -961,7 +962,7 @@ const depositBluefinType1Txb = async (amountA, amountB, poolName, options, trans
|
|
|
961
962
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
962
963
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
963
964
|
txb.object(getConf().BLUEFIN_DEEP_BLUE_POOL),
|
|
964
|
-
txb.object(getConf().
|
|
965
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
965
966
|
txb.object(cetusPoolMap["BLUE-DEEP"]),
|
|
966
967
|
txb.object(cetusPoolMap["BLUE-SUI"]),
|
|
967
968
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -1032,7 +1033,7 @@ const depositBluefinType2Txb = async (amountA, amountB, poolName, options, trans
|
|
|
1032
1033
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1033
1034
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1034
1035
|
txb.object(getConf().BLUEFIN_ALPHA_USDC_POOL),
|
|
1035
|
-
txb.object(getConf().
|
|
1036
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1036
1037
|
txb.object(cetusPoolMap["ALPHA-USDC"]),
|
|
1037
1038
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
1038
1039
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -1060,7 +1061,7 @@ const depositBluefinType2Txb = async (amountA, amountB, poolName, options, trans
|
|
|
1060
1061
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1061
1062
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1062
1063
|
txb.object(getConf().BLUEFIN_NAVX_VSUI_POOL),
|
|
1063
|
-
txb.object(getConf().
|
|
1064
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1064
1065
|
txb.object(cetusPoolMap["NAVX-VSUI"]),
|
|
1065
1066
|
txb.object(cetusPoolMap["VSUI-SUI"]),
|
|
1066
1067
|
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
@@ -1301,6 +1302,56 @@ const depositBluefinSuiSecondTxb = async (amountA, amountB, poolName, options, t
|
|
|
1301
1302
|
],
|
|
1302
1303
|
});
|
|
1303
1304
|
}
|
|
1305
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-DEEP-SUI") {
|
|
1306
|
+
txb.moveCall({
|
|
1307
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
1308
|
+
typeArguments: [
|
|
1309
|
+
coinsList[pool1].type,
|
|
1310
|
+
coinsList[pool2].type,
|
|
1311
|
+
coinsList["BLUE"].type,
|
|
1312
|
+
],
|
|
1313
|
+
arguments: [
|
|
1314
|
+
txb.object(getConf().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
1315
|
+
someReceipt,
|
|
1316
|
+
txb.object(poolinfo.poolId),
|
|
1317
|
+
depositCoinA,
|
|
1318
|
+
depositCoinB,
|
|
1319
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1320
|
+
txb.object(poolinfo.investorId),
|
|
1321
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1322
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1323
|
+
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
1324
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1325
|
+
txb.object(cetusPoolMap["DEEP-SUI"]),
|
|
1326
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1327
|
+
],
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
else if (poolName === "BLUEFIN-AUTOBALANCE-BLUE-SUI") {
|
|
1331
|
+
txb.moveCall({
|
|
1332
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_second_pool::user_deposit`,
|
|
1333
|
+
typeArguments: [
|
|
1334
|
+
coinsList[pool1].type,
|
|
1335
|
+
coinsList[pool2].type,
|
|
1336
|
+
coinsList["DEEP"].type,
|
|
1337
|
+
],
|
|
1338
|
+
arguments: [
|
|
1339
|
+
txb.object(getConf().ALPHA_BLUEFIN_AUTOBALANCE_VERSION),
|
|
1340
|
+
someReceipt,
|
|
1341
|
+
txb.object(poolinfo.poolId),
|
|
1342
|
+
depositCoinA,
|
|
1343
|
+
depositCoinB,
|
|
1344
|
+
txb.object(getConf().ALPHA_DISTRIBUTOR),
|
|
1345
|
+
txb.object(poolinfo.investorId),
|
|
1346
|
+
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1347
|
+
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1348
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1349
|
+
txb.object(getConf().BLUEFIN_DEEP_SUI_POOL),
|
|
1350
|
+
txb.object(cetusPoolMap["BLUE-SUI"]),
|
|
1351
|
+
txb.object(getConf().CLOCK_PACKAGE_ID),
|
|
1352
|
+
],
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1304
1355
|
txb.transferObjects([coin1Arg, coin2Arg], address);
|
|
1305
1356
|
}
|
|
1306
1357
|
else {
|
|
@@ -1364,7 +1415,7 @@ const depositBluefinStsuiTxb = async (amountA, amountB, poolName, options, trans
|
|
|
1364
1415
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1365
1416
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1366
1417
|
txb.object(getConf().BLUEFIN_STSUI_USDC_POOL),
|
|
1367
|
-
txb.object(getConf().
|
|
1418
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1368
1419
|
txb.object(cetusPoolMap["USDC-SUI"]),
|
|
1369
1420
|
txb.object(bluefinPoolMap["SUI-USDC"]),
|
|
1370
1421
|
txb.object(getConf().LST_INFO),
|
|
@@ -1394,7 +1445,7 @@ const depositBluefinStsuiTxb = async (amountA, amountB, poolName, options, trans
|
|
|
1394
1445
|
txb.object(getConf().BLUEFIN_GLOBAL_CONFIG),
|
|
1395
1446
|
txb.object(getConf().CETUS_GLOBAL_CONFIG_ID),
|
|
1396
1447
|
txb.object(getConf().BLUEFIN_ALPHA_STSUI_POOL),
|
|
1397
|
-
txb.object(getConf().
|
|
1448
|
+
txb.object(getConf().BLUEFIN_BLUE_SUI_POOL),
|
|
1398
1449
|
txb.object(cetusPoolMap["ALPHA-SUI"]),
|
|
1399
1450
|
txb.object(bluefinPoolMap["SUI-ALPHA"]),
|
|
1400
1451
|
txb.object(getConf().LST_INFO),
|
|
@@ -1432,7 +1483,7 @@ export async function getZapAmounts(inputCoinAmount, inputCoinName, poolName, sl
|
|
|
1432
1483
|
inAmount: new BN(amount1),
|
|
1433
1484
|
slippage: slippage,
|
|
1434
1485
|
};
|
|
1435
|
-
const ratioQuote = await zapGetQuote(swapGateway, swapOptions);
|
|
1486
|
+
const ratioQuote = await zapGetQuote(swapGateway, swapOptions, poolName);
|
|
1436
1487
|
if (ratioQuote) {
|
|
1437
1488
|
const amount1InCoinType2 = Number(ratioQuote);
|
|
1438
1489
|
const totalAmount = amount2 + amount1InCoinType2;
|
|
@@ -1458,16 +1509,16 @@ export async function getZapAmounts(inputCoinAmount, inputCoinName, poolName, sl
|
|
|
1458
1509
|
slippage: slippage,
|
|
1459
1510
|
};
|
|
1460
1511
|
if (inputCoinName === coinTypeA) {
|
|
1461
|
-
amountB = await zapGetQuote(swapGateway, swapOptionsI2B);
|
|
1512
|
+
amountB = await zapGetQuote(swapGateway, swapOptionsI2B, poolName);
|
|
1462
1513
|
amountA = inputAmountToType1.toString();
|
|
1463
1514
|
}
|
|
1464
1515
|
else if (inputCoinName === coinTypeB) {
|
|
1465
|
-
amountA = await zapGetQuote(swapGateway, swapOptionsI2A);
|
|
1516
|
+
amountA = await zapGetQuote(swapGateway, swapOptionsI2A, poolName);
|
|
1466
1517
|
amountB = inputAmountToType2.toString();
|
|
1467
1518
|
}
|
|
1468
1519
|
else {
|
|
1469
|
-
amountA = await zapGetQuote(swapGateway, swapOptionsI2A);
|
|
1470
|
-
amountB = await zapGetQuote(swapGateway, swapOptionsI2B);
|
|
1520
|
+
amountA = await zapGetQuote(swapGateway, swapOptionsI2A, poolName);
|
|
1521
|
+
amountB = await zapGetQuote(swapGateway, swapOptionsI2B, poolName);
|
|
1471
1522
|
}
|
|
1472
1523
|
if (amountA && amountB) {
|
|
1473
1524
|
const [coin1Price, coin2Price] = await getLatestPrices([
|