@t2000/sdk 0.20.5 → 0.20.6
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/index.cjs +33 -5
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +33 -5
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.js +27 -2
- package/dist/browser.js.map +1 -1
- package/dist/{index-D1DxZ1DK.d.ts → index-BwknZes_.d.ts} +1 -0
- package/dist/{index-MP_J_nSO.d.cts → index-HeR6WZTF.d.cts} +1 -0
- package/dist/index.cjs +57 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +57 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,8 +3,8 @@ import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import { L as LendingAdapter, a as LendingRates } from './descriptors-Be4FAgN5.cjs';
|
|
5
5
|
export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, P as ProtocolDescriptor, d as allDescriptors, n as naviDescriptor } from './descriptors-Be4FAgN5.cjs';
|
|
6
|
-
import { T as T2000Options, P as PayOptions, a as PayResult, S as StakeVSuiResult, U as UnstakeVSuiResult, b as SwapResult, c as SwapQuoteResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as PendingReward, C as ClaimRewardsResult, j as PositionsResult, k as RatesResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './index-
|
|
7
|
-
export { A as AssetRates, l as GasReserve, N as NaviAdapter, m as PositionEntry, n as ProtocolRegistry } from './index-
|
|
6
|
+
import { T as T2000Options, P as PayOptions, a as PayResult, S as StakeVSuiResult, U as UnstakeVSuiResult, b as SwapResult, c as SwapQuoteResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as PendingReward, C as ClaimRewardsResult, j as PositionsResult, k as RatesResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './index-HeR6WZTF.cjs';
|
|
7
|
+
export { A as AssetRates, l as GasReserve, N as NaviAdapter, m as PositionEntry, n as ProtocolRegistry } from './index-HeR6WZTF.cjs';
|
|
8
8
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
9
9
|
import { RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
|
|
10
10
|
|
|
@@ -101,10 +101,35 @@ declare const SUPPORTED_ASSETS: {
|
|
|
101
101
|
readonly symbol: "SUI";
|
|
102
102
|
readonly displayName: "SUI";
|
|
103
103
|
};
|
|
104
|
+
readonly WAL: {
|
|
105
|
+
readonly type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL";
|
|
106
|
+
readonly decimals: 9;
|
|
107
|
+
readonly symbol: "WAL";
|
|
108
|
+
readonly displayName: "WAL";
|
|
109
|
+
};
|
|
110
|
+
readonly ETH: {
|
|
111
|
+
readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
|
|
112
|
+
readonly decimals: 8;
|
|
113
|
+
readonly symbol: "ETH";
|
|
114
|
+
readonly displayName: "suiETH";
|
|
115
|
+
};
|
|
116
|
+
readonly NAVX: {
|
|
117
|
+
readonly type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX";
|
|
118
|
+
readonly decimals: 9;
|
|
119
|
+
readonly symbol: "NAVX";
|
|
120
|
+
readonly displayName: "NAVX";
|
|
121
|
+
};
|
|
122
|
+
readonly GOLD: {
|
|
123
|
+
readonly type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM";
|
|
124
|
+
readonly decimals: 6;
|
|
125
|
+
readonly symbol: "GOLD";
|
|
126
|
+
readonly displayName: "XAUM";
|
|
127
|
+
};
|
|
104
128
|
};
|
|
105
129
|
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
106
|
-
type StableAsset =
|
|
130
|
+
type StableAsset = 'USDC' | 'USDT' | 'USDe' | 'USDsui';
|
|
107
131
|
declare const STABLE_ASSETS: readonly StableAsset[];
|
|
132
|
+
declare const ALL_NAVI_ASSETS: readonly SupportedAsset[];
|
|
108
133
|
declare const DEFAULT_NETWORK: "mainnet";
|
|
109
134
|
declare const CETUS_USDC_SUI_POOL = "0x51e883ba7c0b566a26cbc8a94cd33eb0abd418a77cc1e60ad22fd9b1f29cd2ab";
|
|
110
135
|
declare const GAS_RESERVE_MIN = 0.05;
|
|
@@ -535,4 +560,4 @@ interface GasStatusResponse {
|
|
|
535
560
|
}
|
|
536
561
|
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
537
562
|
|
|
538
|
-
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TOKEN_MAP, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
563
|
+
export { ALL_NAVI_ASSETS, type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TOKEN_MAP, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import { L as LendingAdapter, a as LendingRates } from './descriptors-Be4FAgN5.js';
|
|
5
5
|
export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H as HealthInfo, P as ProtocolDescriptor, d as allDescriptors, n as naviDescriptor } from './descriptors-Be4FAgN5.js';
|
|
6
|
-
import { T as T2000Options, P as PayOptions, a as PayResult, S as StakeVSuiResult, U as UnstakeVSuiResult, b as SwapResult, c as SwapQuoteResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as PendingReward, C as ClaimRewardsResult, j as PositionsResult, k as RatesResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './index-
|
|
7
|
-
export { A as AssetRates, l as GasReserve, N as NaviAdapter, m as PositionEntry, n as ProtocolRegistry } from './index-
|
|
6
|
+
import { T as T2000Options, P as PayOptions, a as PayResult, S as StakeVSuiResult, U as UnstakeVSuiResult, b as SwapResult, c as SwapQuoteResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as PendingReward, C as ClaimRewardsResult, j as PositionsResult, k as RatesResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './index-BwknZes_.js';
|
|
7
|
+
export { A as AssetRates, l as GasReserve, N as NaviAdapter, m as PositionEntry, n as ProtocolRegistry } from './index-BwknZes_.js';
|
|
8
8
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
9
9
|
import { RouterDataV3 } from '@cetusprotocol/aggregator-sdk';
|
|
10
10
|
|
|
@@ -101,10 +101,35 @@ declare const SUPPORTED_ASSETS: {
|
|
|
101
101
|
readonly symbol: "SUI";
|
|
102
102
|
readonly displayName: "SUI";
|
|
103
103
|
};
|
|
104
|
+
readonly WAL: {
|
|
105
|
+
readonly type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL";
|
|
106
|
+
readonly decimals: 9;
|
|
107
|
+
readonly symbol: "WAL";
|
|
108
|
+
readonly displayName: "WAL";
|
|
109
|
+
};
|
|
110
|
+
readonly ETH: {
|
|
111
|
+
readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
|
|
112
|
+
readonly decimals: 8;
|
|
113
|
+
readonly symbol: "ETH";
|
|
114
|
+
readonly displayName: "suiETH";
|
|
115
|
+
};
|
|
116
|
+
readonly NAVX: {
|
|
117
|
+
readonly type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX";
|
|
118
|
+
readonly decimals: 9;
|
|
119
|
+
readonly symbol: "NAVX";
|
|
120
|
+
readonly displayName: "NAVX";
|
|
121
|
+
};
|
|
122
|
+
readonly GOLD: {
|
|
123
|
+
readonly type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM";
|
|
124
|
+
readonly decimals: 6;
|
|
125
|
+
readonly symbol: "GOLD";
|
|
126
|
+
readonly displayName: "XAUM";
|
|
127
|
+
};
|
|
104
128
|
};
|
|
105
129
|
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
106
|
-
type StableAsset =
|
|
130
|
+
type StableAsset = 'USDC' | 'USDT' | 'USDe' | 'USDsui';
|
|
107
131
|
declare const STABLE_ASSETS: readonly StableAsset[];
|
|
132
|
+
declare const ALL_NAVI_ASSETS: readonly SupportedAsset[];
|
|
108
133
|
declare const DEFAULT_NETWORK: "mainnet";
|
|
109
134
|
declare const CETUS_USDC_SUI_POOL = "0x51e883ba7c0b566a26cbc8a94cd33eb0abd418a77cc1e60ad22fd9b1f29cd2ab";
|
|
110
135
|
declare const GAS_RESERVE_MIN = 0.05;
|
|
@@ -535,4 +560,4 @@ interface GasStatusResponse {
|
|
|
535
560
|
}
|
|
536
561
|
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
537
562
|
|
|
538
|
-
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TOKEN_MAP, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
563
|
+
export { ALL_NAVI_ASSETS, type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CETUS_USDC_SUI_POOL, CLOCK_ID, ClaimRewardsResult, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PayOptions, PayResult, PendingReward, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StakeVSuiResult, type SupportedAsset, SwapQuoteResult, SwapResult, type SwapRouteResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TOKEN_MAP, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStats, WithdrawResult, type ZkLoginProof, ZkLoginSigner, addCollectFeeToTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
package/dist/index.js
CHANGED
|
@@ -360,9 +360,34 @@ var SUPPORTED_ASSETS = {
|
|
|
360
360
|
decimals: 9,
|
|
361
361
|
symbol: "SUI",
|
|
362
362
|
displayName: "SUI"
|
|
363
|
+
},
|
|
364
|
+
WAL: {
|
|
365
|
+
type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
366
|
+
decimals: 9,
|
|
367
|
+
symbol: "WAL",
|
|
368
|
+
displayName: "WAL"
|
|
369
|
+
},
|
|
370
|
+
ETH: {
|
|
371
|
+
type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH",
|
|
372
|
+
decimals: 8,
|
|
373
|
+
symbol: "ETH",
|
|
374
|
+
displayName: "suiETH"
|
|
375
|
+
},
|
|
376
|
+
NAVX: {
|
|
377
|
+
type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX",
|
|
378
|
+
decimals: 9,
|
|
379
|
+
symbol: "NAVX",
|
|
380
|
+
displayName: "NAVX"
|
|
381
|
+
},
|
|
382
|
+
GOLD: {
|
|
383
|
+
type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM",
|
|
384
|
+
decimals: 6,
|
|
385
|
+
symbol: "GOLD",
|
|
386
|
+
displayName: "XAUM"
|
|
363
387
|
}
|
|
364
388
|
};
|
|
365
|
-
var STABLE_ASSETS = ["USDC"];
|
|
389
|
+
var STABLE_ASSETS = ["USDC", "USDT", "USDe", "USDsui"];
|
|
390
|
+
var ALL_NAVI_ASSETS = Object.keys(SUPPORTED_ASSETS);
|
|
366
391
|
var T2000_PACKAGE_ID = process.env.T2000_PACKAGE_ID ?? "0xab92e9f1fe549ad3d6a52924a73181b45791e76120b975138fac9ec9b75db9f3";
|
|
367
392
|
var T2000_CONFIG_ID = process.env.T2000_CONFIG_ID ?? "0x408add9aa9322f93cfd87523d8f603006eb8713894f4c460283c58a6888dae8a";
|
|
368
393
|
var T2000_TREASURY_ID = process.env.T2000_TREASURY_ID ?? "0x3bb501b8300125dca59019247941a42af6b292a150ce3cfcce9449456be2ec91";
|
|
@@ -844,7 +869,6 @@ async function reportFee(agentAddress, operation, feeAmount, feeRate, txDigest)
|
|
|
844
869
|
}
|
|
845
870
|
init_errors();
|
|
846
871
|
var MIN_HEALTH_FACTOR = 1.5;
|
|
847
|
-
var NAVI_SUPPORTED_ASSETS = [...STABLE_ASSETS, "SUI", "ETH", "GOLD"];
|
|
848
872
|
function sdkOptions(client) {
|
|
849
873
|
return { env: "prod", client, cacheTime: 0, disableCache: true };
|
|
850
874
|
}
|
|
@@ -888,7 +912,11 @@ var NAVI_SYMBOL_MAP = {
|
|
|
888
912
|
USDC: "USDC",
|
|
889
913
|
USDT: "USDT",
|
|
890
914
|
USDe: "USDe",
|
|
891
|
-
USDsui: "USDsui"
|
|
915
|
+
USDsui: "USDsui",
|
|
916
|
+
WAL: "WAL",
|
|
917
|
+
NAVX: "NAVX",
|
|
918
|
+
ETH: "ETH",
|
|
919
|
+
GOLD: "GOLD"
|
|
892
920
|
};
|
|
893
921
|
function resolveNaviSymbol(sdkSymbol, coinType) {
|
|
894
922
|
for (const [key, info] of Object.entries(SUPPORTED_ASSETS)) {
|
|
@@ -963,7 +991,7 @@ async function getRates(client) {
|
|
|
963
991
|
try {
|
|
964
992
|
const pools = await getPools(sdkOptions(client));
|
|
965
993
|
const result = {};
|
|
966
|
-
for (const asset of
|
|
994
|
+
for (const asset of ALL_NAVI_ASSETS) {
|
|
967
995
|
const targetType = SUPPORTED_ASSETS[asset].type;
|
|
968
996
|
const pool = pools.find((p) => {
|
|
969
997
|
const poolSuffix = (p.suiCoinType || p.coinType || "").split("::").slice(1).join("::").toLowerCase();
|
|
@@ -1423,7 +1451,7 @@ var NaviAdapter = class {
|
|
|
1423
1451
|
name = "NAVI Protocol";
|
|
1424
1452
|
version = "1.0.0";
|
|
1425
1453
|
capabilities = ["save", "withdraw", "borrow", "repay"];
|
|
1426
|
-
supportedAssets = [...
|
|
1454
|
+
supportedAssets = [...ALL_NAVI_ASSETS];
|
|
1427
1455
|
supportsSameAssetBorrow = true;
|
|
1428
1456
|
client;
|
|
1429
1457
|
async init(client) {
|
|
@@ -2462,20 +2490,34 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
2462
2490
|
const asset = params.asset ?? "USDC";
|
|
2463
2491
|
const assetInfo = SUPPORTED_ASSETS[asset];
|
|
2464
2492
|
if (!assetInfo) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unsupported asset: ${asset}`);
|
|
2465
|
-
const
|
|
2493
|
+
const isStable = STABLE_ASSETS.includes(asset);
|
|
2466
2494
|
let amount;
|
|
2467
2495
|
if (params.amount === "all") {
|
|
2468
|
-
|
|
2496
|
+
if (isStable) {
|
|
2497
|
+
const bal = await queryBalance(this.client, this._address);
|
|
2498
|
+
amount = (bal.available ?? 0) - 1;
|
|
2499
|
+
} else if (asset === "SUI") {
|
|
2500
|
+
const suiBal = await this.client.getBalance({ owner: this._address, coinType: assetInfo.type });
|
|
2501
|
+
const suiAmount = Number(suiBal.totalBalance) / 10 ** assetInfo.decimals;
|
|
2502
|
+
amount = suiAmount - 0.15;
|
|
2503
|
+
} else {
|
|
2504
|
+
const coins = await this._fetchCoins(assetInfo.type);
|
|
2505
|
+
const totalRaw = coins.reduce((sum, c) => sum + BigInt(c.balance), 0n);
|
|
2506
|
+
amount = Number(totalRaw) / 10 ** assetInfo.decimals;
|
|
2507
|
+
}
|
|
2469
2508
|
if (amount <= 0) {
|
|
2470
|
-
throw new T2000Error("INSUFFICIENT_BALANCE",
|
|
2471
|
-
reason: "
|
|
2472
|
-
|
|
2509
|
+
throw new T2000Error("INSUFFICIENT_BALANCE", `No ${asset} available to save`, {
|
|
2510
|
+
reason: "insufficient_balance",
|
|
2511
|
+
asset
|
|
2473
2512
|
});
|
|
2474
2513
|
}
|
|
2475
2514
|
} else {
|
|
2476
2515
|
amount = params.amount;
|
|
2477
|
-
if (
|
|
2478
|
-
|
|
2516
|
+
if (isStable) {
|
|
2517
|
+
const bal = await queryBalance(this.client, this._address);
|
|
2518
|
+
if (amount > (bal.available ?? 0)) {
|
|
2519
|
+
throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient balance. Available: $${(bal.available ?? 0).toFixed(2)}, requested: $${amount.toFixed(2)}`);
|
|
2520
|
+
}
|
|
2479
2521
|
}
|
|
2480
2522
|
}
|
|
2481
2523
|
const fee = calculateFee("save", amount);
|
|
@@ -2598,11 +2640,12 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
2598
2640
|
finalAmount = built.effectiveAmount;
|
|
2599
2641
|
return built.tx;
|
|
2600
2642
|
});
|
|
2601
|
-
this.emitBalanceChange(
|
|
2643
|
+
this.emitBalanceChange(target.asset, finalAmount, "withdraw", gasResult.digest);
|
|
2602
2644
|
return {
|
|
2603
2645
|
success: true,
|
|
2604
2646
|
tx: gasResult.digest,
|
|
2605
2647
|
amount: finalAmount,
|
|
2648
|
+
asset: target.asset,
|
|
2606
2649
|
gasCost: gasResult.gasCostSui,
|
|
2607
2650
|
gasMethod: gasResult.gasMethod
|
|
2608
2651
|
};
|
|
@@ -3206,6 +3249,6 @@ async function getSwapQuote(params) {
|
|
|
3206
3249
|
init_cetus_swap();
|
|
3207
3250
|
init_volo();
|
|
3208
3251
|
|
|
3209
|
-
export { BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, GAS_RESERVE_MIN, KeypairSigner, MIST_PER_SUI, NaviAdapter, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
3252
|
+
export { ALL_NAVI_ASSETS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, GAS_RESERVE_MIN, KeypairSigner, MIST_PER_SUI, NaviAdapter, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
3210
3253
|
//# sourceMappingURL=index.js.map
|
|
3211
3254
|
//# sourceMappingURL=index.js.map
|