@t2000/sdk 0.22.1 → 0.22.2
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 +22 -22
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +22 -22
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/{token-registry-BBAPkvGS.d.ts → token-registry-DLEKjV8I.d.ts} +17 -2
- package/dist/{token-registry-abuw6uo0.d.cts → token-registry-bf_caDsv.d.cts} +17 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-
|
|
5
|
-
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, 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, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, 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, 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,
|
|
4
|
+
import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-bf_caDsv.cjs';
|
|
5
|
+
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, 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, ao as OPERATION_ASSETS, O as OUTBOUND_OPS, ap as Operation, 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, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, 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, R as ZkLoginSigner, V as addCollectFeeToTx, aq as assertAllowedAsset, 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, ar as isAllowedAsset, 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, as as simulateTransaction, ah as stableToRaw, ai as suiToMist, at as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-bf_caDsv.cjs';
|
|
6
6
|
import { L as LendingAdapter, a as LendingRates } from './descriptors-Be4FAgN5.cjs';
|
|
7
7
|
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';
|
|
8
8
|
import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult } from './types-XWEUAS-X.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-
|
|
5
|
-
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, 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, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, 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, 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,
|
|
4
|
+
import { T as T2000Error, am as SafeguardEnforcer, w as TransactionSigner, Z as ZkLoginProof, s as SupportedAsset } from './token-registry-DLEKjV8I.js';
|
|
5
|
+
export { A as ALL_NAVI_ASSETS, a as AutoTopUpResult, B as BPS_DENOMINATOR, an as CETUS_USDC_SUI_POOL, 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, ao as OPERATION_ASSETS, O as OUTBOUND_OPS, ap as Operation, 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, t as T2000ErrorCode, u as T2000ErrorData, v as TOKEN_MAP, 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, R as ZkLoginSigner, V as addCollectFeeToTx, aq as assertAllowedAsset, 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, ar as isAllowedAsset, 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, as as simulateTransaction, ah as stableToRaw, ai as suiToMist, at as throwIfSimulationFailed, aj as truncateAddress, ak as usdcToRaw, al as validateAddress } from './token-registry-DLEKjV8I.js';
|
|
6
6
|
import { L as LendingAdapter, a as LendingRates } from './descriptors-Be4FAgN5.js';
|
|
7
7
|
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';
|
|
8
8
|
import { j as T2000Options, P as PayOptions, d as PayResult, k as StakeVSuiResult, U as UnstakeVSuiResult, l as SwapResult, m as SwapQuoteResult, i as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, S as SaveResult, W as WithdrawResult, c as MaxWithdrawResult, a as BorrowResult, h as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, e as PendingReward, C as ClaimRewardsResult, g as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult } from './types-XWEUAS-X.js';
|
package/dist/index.js
CHANGED
|
@@ -395,6 +395,7 @@ var init_cetus_swap = __esm({
|
|
|
395
395
|
});
|
|
396
396
|
|
|
397
397
|
// src/constants.ts
|
|
398
|
+
init_errors();
|
|
398
399
|
var MIST_PER_SUI = 1000000000n;
|
|
399
400
|
var SUI_DECIMALS = 9;
|
|
400
401
|
var USDC_DECIMALS = 6;
|
|
@@ -463,6 +464,30 @@ var SUPPORTED_ASSETS = {
|
|
|
463
464
|
};
|
|
464
465
|
var STABLE_ASSETS = ["USDC"];
|
|
465
466
|
var ALL_NAVI_ASSETS = Object.keys(SUPPORTED_ASSETS);
|
|
467
|
+
var OPERATION_ASSETS = {
|
|
468
|
+
save: ["USDC"],
|
|
469
|
+
borrow: ["USDC"],
|
|
470
|
+
withdraw: "*",
|
|
471
|
+
repay: "*",
|
|
472
|
+
send: "*",
|
|
473
|
+
swap: "*"
|
|
474
|
+
};
|
|
475
|
+
function isAllowedAsset(op, asset) {
|
|
476
|
+
const allowed = OPERATION_ASSETS[op];
|
|
477
|
+
if (allowed === "*") return true;
|
|
478
|
+
return allowed.includes(asset.toUpperCase());
|
|
479
|
+
}
|
|
480
|
+
function assertAllowedAsset(op, asset) {
|
|
481
|
+
if (!asset) return;
|
|
482
|
+
if (!isAllowedAsset(op, asset)) {
|
|
483
|
+
const allowed = OPERATION_ASSETS[op];
|
|
484
|
+
const list = Array.isArray(allowed) ? allowed.join(", ") : "any";
|
|
485
|
+
throw new T2000Error(
|
|
486
|
+
"INVALID_ASSET",
|
|
487
|
+
`${op} only supports ${list}. Cannot use ${asset}.${op === "save" ? " Swap to USDC first." : ""}`
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
466
491
|
var T2000_PACKAGE_ID = process.env.T2000_PACKAGE_ID ?? "0xab92e9f1fe549ad3d6a52924a73181b45791e76120b975138fac9ec9b75db9f3";
|
|
467
492
|
var T2000_CONFIG_ID = process.env.T2000_CONFIG_ID ?? "0x408add9aa9322f93cfd87523d8f603006eb8713894f4c460283c58a6888dae8a";
|
|
468
493
|
var T2000_TREASURY_ID = process.env.T2000_TREASURY_ID ?? "0x3bb501b8300125dca59019247941a42af6b292a150ce3cfcce9449456be2ec91";
|
|
@@ -2605,9 +2630,7 @@ var T2000 = class _T2000 extends EventEmitter {
|
|
|
2605
2630
|
// -- Savings --
|
|
2606
2631
|
async save(params) {
|
|
2607
2632
|
this.enforcer.assertNotLocked();
|
|
2608
|
-
|
|
2609
|
-
throw new T2000Error("INVALID_ASSET", "Only USDC deposits are supported. Swap to USDC first.");
|
|
2610
|
-
}
|
|
2633
|
+
assertAllowedAsset("save", params.asset);
|
|
2611
2634
|
const asset = "USDC";
|
|
2612
2635
|
const assetInfo = SUPPORTED_ASSETS[asset];
|
|
2613
2636
|
let amount;
|
|
@@ -3350,6 +3373,6 @@ init_cetus_swap();
|
|
|
3350
3373
|
init_token_registry();
|
|
3351
3374
|
init_volo();
|
|
3352
3375
|
|
|
3353
|
-
export { ALL_NAVI_ASSETS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, KeypairSigner, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getDecimalsForCoinType, getGasStatus, getRates, getSwapQuote, getTier, getVoloStats, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveSymbol, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
3376
|
+
export { ALL_NAVI_ASSETS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, KeypairSigner, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OPERATION_ASSETS, OUTBOUND_OPS, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, addCollectFeeToTx, allDescriptors, assertAllowedAsset, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getDecimalsForCoinType, getGasStatus, getRates, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, resolveSymbol, resolveTokenType, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
3354
3377
|
//# sourceMappingURL=index.js.map
|
|
3355
3378
|
//# sourceMappingURL=index.js.map
|