@t2000/sdk 0.28.9 → 0.31.1
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/adapters/descriptors.d.cts +1 -1
- package/dist/adapters/descriptors.d.ts +1 -1
- package/dist/adapters/index.d.cts +3 -3
- package/dist/adapters/index.d.ts +3 -3
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/{descriptors-Be4FAgN5.d.cts → descriptors-DkKhitk_.d.cts} +1 -1
- package/dist/{descriptors-Be4FAgN5.d.ts → descriptors-DkKhitk_.d.ts} +1 -1
- package/dist/index.cjs +128 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +129 -2
- package/dist/index.js.map +1 -1
- package/dist/{token-registry-CX_RDDO_.d.ts → token-registry-BDUX2-5v.d.ts} +1 -1
- package/dist/{token-registry-BYEXDwjs.d.cts → token-registry-Dh-awSh7.d.cts} +1 -1
- package/dist/{types-D9NstGUu.d.cts → types-Clhh7dHT.d.cts} +10 -1
- package/dist/{types-D9NstGUu.d.ts → types-Clhh7dHT.d.ts} +10 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.cjs';
|
|
2
2
|
import '@mysten/sui/transactions';
|
|
3
3
|
import '@mysten/sui/jsonRpc';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.js';
|
|
2
2
|
import '@mysten/sui/transactions';
|
|
3
3
|
import '@mysten/sui/jsonRpc';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult,
|
|
2
|
-
export {
|
|
3
|
-
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
1
|
+
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-DkKhitk_.cjs';
|
|
2
|
+
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.cjs';
|
|
3
|
+
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-Clhh7dHT.cjs';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult,
|
|
2
|
-
export {
|
|
3
|
-
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
1
|
+
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-DkKhitk_.js';
|
|
2
|
+
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.js';
|
|
3
|
+
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-Clhh7dHT.js';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-
|
|
1
|
+
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-Dh-awSh7.cjs';
|
|
2
|
+
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-Clhh7dHT.cjs';
|
|
3
3
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import '@mysten/sui/jsonRpc';
|
|
5
5
|
import '@mysten/sui/transactions';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-
|
|
1
|
+
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, C as CLOCK_ID, b as COIN_REGISTRY, c as CoinMeta, D as DEFAULT_NETWORK, d as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, F as FeeOperation, G as GAS_RESERVE_MIN, e as GasExecutionResult, f as GasRequestType, g as GasSponsorResponse, h as GasStatusResponse, I as IKA_TYPE, K as KeypairSigner, L as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, O as OUTBOUND_OPS, P as ProtocolFeeInfo, S as STABLE_ASSETS, j as SUI_DECIMALS, k as SUI_TYPE, l as SUPPORTED_ASSETS, m as SafeguardConfig, n as SafeguardError, o as SafeguardErrorDetails, p as SafeguardRule, q as SimulationResult, r as StableAsset, s as SupportedAsset, T as T2000Error, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, w as TransactionSigner, x as TxMetadata, U as USDC_DECIMALS, y as USDC_TYPE, z as USDE_TYPE, H as USDSUI_TYPE, J as USDT_TYPE, W as WAL_TYPE, Q as WBTC_TYPE, Z as ZkLoginProof, R as ZkLoginSigner, V as addCollectFeeToTx, X as calculateFee, Y as executeAutoTopUp, _ as executeWithGas, $ as formatAssetAmount, a0 as formatSui, a1 as formatUsd, a2 as getDecimals, a3 as getDecimalsForCoinType, a4 as getGasStatus, a5 as getTier, a6 as isSupported, a7 as isTier1, a8 as isTier2, a9 as mapMoveAbortCode, aa as mapWalletError, ab as mistToSui, ac as rawToStable, ad as rawToUsdc, ae as resolveSymbol, af as resolveTokenType, ag as shouldAutoTopUp, ah as stableToRaw, ai as suiToMist, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-BDUX2-5v.js';
|
|
2
|
+
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasMethod, b as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, c as MaxWithdrawResult, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, T as TransactionRecord, W as WithdrawResult } from './types-Clhh7dHT.js';
|
|
3
3
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import '@mysten/sui/jsonRpc';
|
|
5
5
|
import '@mysten/sui/transactions';
|
|
@@ -124,4 +124,4 @@ interface PendingReward {
|
|
|
124
124
|
declare const naviDescriptor: ProtocolDescriptor;
|
|
125
125
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
126
126
|
|
|
127
|
-
export { type AdapterCapability as A, type HealthInfo as H, type LendingAdapter as L, type
|
|
127
|
+
export { type AdapterCapability as A, type HealthInfo as H, type LendingAdapter as L, type PendingReward as P, type LendingRates as a, type AdapterPositions as b, type AdapterTxResult as c, type ProtocolDescriptor as d, allDescriptors as e, naviDescriptor as n };
|
|
@@ -124,4 +124,4 @@ interface PendingReward {
|
|
|
124
124
|
declare const naviDescriptor: ProtocolDescriptor;
|
|
125
125
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
126
126
|
|
|
127
|
-
export { type AdapterCapability as A, type HealthInfo as H, type LendingAdapter as L, type
|
|
127
|
+
export { type AdapterCapability as A, type HealthInfo as H, type LendingAdapter as L, type PendingReward as P, type LendingRates as a, type AdapterPositions as b, type AdapterTxResult as c, type ProtocolDescriptor as d, allDescriptors as e, naviDescriptor as n };
|
package/dist/index.cjs
CHANGED
|
@@ -3147,6 +3147,133 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
3147
3147
|
gasMethod: claimResult.gasMethod
|
|
3148
3148
|
};
|
|
3149
3149
|
}
|
|
3150
|
+
/**
|
|
3151
|
+
* Claim pending rewards, swap non-USDC tokens to USDC via Cetus, and deposit into NAVI.
|
|
3152
|
+
* Multi-step: claim (transfers to wallet) -> swap each reward token to USDC -> deposit USDC.
|
|
3153
|
+
* Minimum threshold: skips if total rewards < $0.10 (gas not worth it).
|
|
3154
|
+
*/
|
|
3155
|
+
async compoundRewards(options = {}) {
|
|
3156
|
+
this.enforcer.assertNotLocked();
|
|
3157
|
+
const minValue = options.minValueUsd ?? 0.1;
|
|
3158
|
+
const USDC_TYPE3 = SUPPORTED_ASSETS.USDC.type;
|
|
3159
|
+
const USDC_DEC = SUPPORTED_ASSETS.USDC.decimals;
|
|
3160
|
+
const pending = await this.getPendingRewards();
|
|
3161
|
+
const nonTrivial = pending.filter((r) => r.amount > 0);
|
|
3162
|
+
if (nonTrivial.length === 0) {
|
|
3163
|
+
return {
|
|
3164
|
+
success: true,
|
|
3165
|
+
claimTx: "",
|
|
3166
|
+
swapTxs: [],
|
|
3167
|
+
depositTx: "",
|
|
3168
|
+
rewards: pending,
|
|
3169
|
+
totalCompoundedUsdc: 0,
|
|
3170
|
+
totalGasCost: 0
|
|
3171
|
+
};
|
|
3172
|
+
}
|
|
3173
|
+
const totalPendingUsd = pending.reduce((s, r) => s + r.estimatedValueUsd, 0);
|
|
3174
|
+
if (totalPendingUsd > 0 && totalPendingUsd < minValue) {
|
|
3175
|
+
return {
|
|
3176
|
+
success: true,
|
|
3177
|
+
claimTx: "",
|
|
3178
|
+
swapTxs: [],
|
|
3179
|
+
depositTx: "",
|
|
3180
|
+
rewards: pending,
|
|
3181
|
+
totalCompoundedUsdc: 0,
|
|
3182
|
+
totalGasCost: 0
|
|
3183
|
+
};
|
|
3184
|
+
}
|
|
3185
|
+
const preUsdcCoins = await this._fetchCoins(USDC_TYPE3);
|
|
3186
|
+
const preUsdcRaw = preUsdcCoins.reduce((s, c) => s + BigInt(c.balance), 0n);
|
|
3187
|
+
const claimResult = await this.claimRewards();
|
|
3188
|
+
if (!claimResult.tx) {
|
|
3189
|
+
return {
|
|
3190
|
+
success: false,
|
|
3191
|
+
claimTx: "",
|
|
3192
|
+
swapTxs: [],
|
|
3193
|
+
depositTx: "",
|
|
3194
|
+
rewards: pending,
|
|
3195
|
+
totalCompoundedUsdc: 0,
|
|
3196
|
+
totalGasCost: 0
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
const { findSwapRoute: findSwapRoute2, buildSwapTx: buildSwapTx2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
3200
|
+
const swapTxs = [];
|
|
3201
|
+
let totalGasCost = claimResult.gasCost;
|
|
3202
|
+
for (const reward of nonTrivial) {
|
|
3203
|
+
if (!reward.coinType) continue;
|
|
3204
|
+
if (reward.coinType === USDC_TYPE3) continue;
|
|
3205
|
+
try {
|
|
3206
|
+
const decimals = getDecimalsForCoinType(reward.coinType) ?? 9;
|
|
3207
|
+
const rawAmount = BigInt(Math.floor(reward.amount * 10 ** decimals));
|
|
3208
|
+
if (rawAmount <= 0n) continue;
|
|
3209
|
+
const coins = await this._fetchCoins(reward.coinType);
|
|
3210
|
+
if (coins.length === 0) continue;
|
|
3211
|
+
const route = await findSwapRoute2({
|
|
3212
|
+
walletAddress: this._address,
|
|
3213
|
+
from: reward.coinType,
|
|
3214
|
+
to: USDC_TYPE3,
|
|
3215
|
+
amount: rawAmount,
|
|
3216
|
+
byAmountIn: true
|
|
3217
|
+
});
|
|
3218
|
+
if (!route || route.insufficientLiquidity) continue;
|
|
3219
|
+
const swapResult = await executeWithGas(this.client, this._signer, async () => {
|
|
3220
|
+
const tx = new transactions.Transaction();
|
|
3221
|
+
tx.setSender(this._address);
|
|
3222
|
+
const freshCoins = await this._fetchCoins(reward.coinType);
|
|
3223
|
+
if (freshCoins.length === 0) return tx;
|
|
3224
|
+
const merged = this._mergeCoinsInTx(tx, freshCoins);
|
|
3225
|
+
const [inputCoin] = tx.splitCoins(merged, [rawAmount]);
|
|
3226
|
+
const outputCoin = await buildSwapTx2({
|
|
3227
|
+
walletAddress: this._address,
|
|
3228
|
+
route,
|
|
3229
|
+
tx,
|
|
3230
|
+
inputCoin,
|
|
3231
|
+
slippage: 0.01
|
|
3232
|
+
});
|
|
3233
|
+
tx.transferObjects([outputCoin], this._address);
|
|
3234
|
+
return tx;
|
|
3235
|
+
});
|
|
3236
|
+
swapTxs.push(swapResult.digest);
|
|
3237
|
+
totalGasCost += swapResult.gasCostSui;
|
|
3238
|
+
} catch (err) {
|
|
3239
|
+
console.warn(`[compound] Failed to swap ${reward.symbol}:`, err instanceof Error ? err.message : err);
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
const postUsdcCoins = await this._fetchCoins(USDC_TYPE3);
|
|
3243
|
+
const postUsdcRaw = postUsdcCoins.reduce((s, c) => s + BigInt(c.balance), 0n);
|
|
3244
|
+
const gainedRaw = postUsdcRaw > preUsdcRaw ? postUsdcRaw - preUsdcRaw : 0n;
|
|
3245
|
+
const depositUsdc = Number(gainedRaw) / 10 ** USDC_DEC;
|
|
3246
|
+
let depositTx = "";
|
|
3247
|
+
if (gainedRaw > 0n) {
|
|
3248
|
+
try {
|
|
3249
|
+
const adapter = await this.resolveLending(void 0, "USDC", "save");
|
|
3250
|
+
const depositResult = await executeWithGas(this.client, this._signer, async () => {
|
|
3251
|
+
const tx = new transactions.Transaction();
|
|
3252
|
+
tx.setSender(this._address);
|
|
3253
|
+
const coins = await this._fetchCoins(USDC_TYPE3);
|
|
3254
|
+
if (coins.length === 0) throw new exports.T2000Error("INSUFFICIENT_BALANCE", "No USDC coins after swap");
|
|
3255
|
+
const merged = this._mergeCoinsInTx(tx, coins);
|
|
3256
|
+
const [inputCoin] = tx.splitCoins(merged, [gainedRaw]);
|
|
3257
|
+
await adapter.addSaveToTx(tx, this._address, inputCoin, "USDC", { collectFee: false });
|
|
3258
|
+
return tx;
|
|
3259
|
+
});
|
|
3260
|
+
depositTx = depositResult.digest;
|
|
3261
|
+
totalGasCost += depositResult.gasCostSui;
|
|
3262
|
+
} catch (err) {
|
|
3263
|
+
console.warn("[compound] NAVI deposit failed:", err instanceof Error ? err.message : err);
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
const hasSubstantiveResult = swapTxs.length > 0 || depositTx !== "";
|
|
3267
|
+
return {
|
|
3268
|
+
success: hasSubstantiveResult,
|
|
3269
|
+
claimTx: claimResult.tx,
|
|
3270
|
+
swapTxs,
|
|
3271
|
+
depositTx,
|
|
3272
|
+
rewards: nonTrivial,
|
|
3273
|
+
totalCompoundedUsdc: depositUsdc,
|
|
3274
|
+
totalGasCost
|
|
3275
|
+
};
|
|
3276
|
+
}
|
|
3150
3277
|
// -- Info --
|
|
3151
3278
|
async positions() {
|
|
3152
3279
|
const allPositions = await this.registry.allPositions(this._address);
|
|
@@ -3704,6 +3831,7 @@ exports.getDecimals = getDecimals;
|
|
|
3704
3831
|
exports.getDecimalsForCoinType = getDecimalsForCoinType;
|
|
3705
3832
|
exports.getFinancialSummary = getFinancialSummary;
|
|
3706
3833
|
exports.getGasStatus = getGasStatus;
|
|
3834
|
+
exports.getPendingRewards = getPendingRewards;
|
|
3707
3835
|
exports.getRates = getRates;
|
|
3708
3836
|
exports.getSwapQuote = getSwapQuote;
|
|
3709
3837
|
exports.getTier = getTier;
|