@t2000/sdk 0.21.16 → 0.22.0
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/README.md +37 -9
- package/dist/adapters/index.cjs +1 -1
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs +44 -22
- 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 +38 -23
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +63 -57
- 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 +60 -58
- package/dist/index.js.map +1 -1
- package/dist/{token-registry-CVba8FI2.d.ts → token-registry-BBAPkvGS.d.ts} +24 -10
- package/dist/{token-registry-DIl3H4Jh.d.cts → token-registry-abuw6uo0.d.cts} +24 -10
- package/package.json +1 -1
|
@@ -51,7 +51,7 @@ declare class ZkLoginSigner implements TransactionSigner {
|
|
|
51
51
|
isExpired(currentEpoch: number): boolean;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'USDC_SPONSOR_FAILED' | 'USDC_SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'WITHDRAW_FAILED' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'UNKNOWN';
|
|
54
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'USDC_SPONSOR_FAILED' | 'USDC_SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'INVALID_ASSET' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'WITHDRAW_FAILED' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'UNKNOWN';
|
|
55
55
|
interface T2000ErrorData {
|
|
56
56
|
reason?: string;
|
|
57
57
|
[key: string]: unknown;
|
|
@@ -214,7 +214,7 @@ declare const SUPPORTED_ASSETS: {
|
|
|
214
214
|
};
|
|
215
215
|
};
|
|
216
216
|
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
217
|
-
type StableAsset = 'USDC'
|
|
217
|
+
type StableAsset = 'USDC';
|
|
218
218
|
declare const STABLE_ASSETS: readonly StableAsset[];
|
|
219
219
|
declare const ALL_NAVI_ASSETS: readonly SupportedAsset[];
|
|
220
220
|
declare const DEFAULT_NETWORK: "mainnet";
|
|
@@ -287,27 +287,39 @@ declare class SafeguardError extends T2000Error {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
|
-
* Unified token registry — single source of truth for coin types, decimals, and
|
|
290
|
+
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
291
291
|
*
|
|
292
292
|
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
293
|
-
*
|
|
294
|
-
*
|
|
293
|
+
*
|
|
294
|
+
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
295
|
+
* Tier 2: 13 curated swap assets — hold, trade, and send only.
|
|
296
|
+
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
295
297
|
*
|
|
296
298
|
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
299
|
+
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
297
300
|
*/
|
|
298
301
|
interface CoinMeta {
|
|
299
302
|
type: string;
|
|
300
303
|
decimals: number;
|
|
301
304
|
symbol: string;
|
|
305
|
+
tier?: 1 | 2;
|
|
302
306
|
}
|
|
303
307
|
/**
|
|
304
|
-
* Canonical coin registry.
|
|
308
|
+
* Canonical coin registry.
|
|
305
309
|
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
306
310
|
*/
|
|
307
311
|
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
312
|
+
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
313
|
+
declare function isTier1(coinType: string): boolean;
|
|
314
|
+
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
315
|
+
declare function isTier2(coinType: string): boolean;
|
|
316
|
+
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
317
|
+
declare function isSupported(coinType: string): boolean;
|
|
318
|
+
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
319
|
+
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
308
320
|
/**
|
|
309
321
|
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
310
|
-
*
|
|
322
|
+
* Works for both tiered and legacy tokens.
|
|
311
323
|
*/
|
|
312
324
|
declare function getDecimalsForCoinType(coinType: string): number;
|
|
313
325
|
/**
|
|
@@ -318,7 +330,6 @@ declare function resolveSymbol(coinType: string): string;
|
|
|
318
330
|
/**
|
|
319
331
|
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
320
332
|
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
321
|
-
* Backward-compatible with the original TOKEN_MAP in cetus-swap.ts.
|
|
322
333
|
*/
|
|
323
334
|
declare const TOKEN_MAP: Record<string, string>;
|
|
324
335
|
/**
|
|
@@ -327,7 +338,7 @@ declare const TOKEN_MAP: Record<string, string>;
|
|
|
327
338
|
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
328
339
|
*/
|
|
329
340
|
declare function resolveTokenType(nameOrType: string): string | null;
|
|
330
|
-
/** Common type constants for direct import
|
|
341
|
+
/** Common type constants for direct import. */
|
|
331
342
|
declare const SUI_TYPE: string;
|
|
332
343
|
declare const USDC_TYPE: string;
|
|
333
344
|
declare const USDT_TYPE: string;
|
|
@@ -337,5 +348,8 @@ declare const ETH_TYPE: string;
|
|
|
337
348
|
declare const WBTC_TYPE: string;
|
|
338
349
|
declare const WAL_TYPE: string;
|
|
339
350
|
declare const NAVX_TYPE: string;
|
|
351
|
+
declare const IKA_TYPE: string;
|
|
352
|
+
declare const LOFI_TYPE: string;
|
|
353
|
+
declare const MANIFEST_TYPE: string;
|
|
340
354
|
|
|
341
|
-
export {
|
|
355
|
+
export { formatAssetAmount as $, ALL_NAVI_ASSETS as A, BPS_DENOMINATOR as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, type FeeOperation as F, GAS_RESERVE_MIN as G, USDSUI_TYPE as H, IKA_TYPE as I, USDT_TYPE as J, KeypairSigner as K, LOFI_TYPE as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OUTBOUND_OPS as O, type ProtocolFeeInfo as P, WBTC_TYPE as Q, ZkLoginSigner as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, addCollectFeeToTx as V, WAL_TYPE as W, calculateFee as X, executeAutoTopUp as Y, type ZkLoginProof as Z, executeWithGas as _, type AutoTopUpResult as a, formatSui as a0, formatUsd as a1, getDecimals as a2, getDecimalsForCoinType as a3, getGasStatus as a4, getTier as a5, isSupported as a6, isTier1 as a7, isTier2 as a8, mapMoveAbortCode as a9, mapWalletError as aa, mistToSui as ab, rawToStable as ac, rawToUsdc as ad, resolveSymbol as ae, resolveTokenType as af, shouldAutoTopUp as ag, stableToRaw as ah, suiToMist as ai, truncateAddress as aj, usdcToRaw as ak, validateAddress as al, SafeguardEnforcer as am, CETUS_USDC_SUI_POOL as an, simulateTransaction as ao, throwIfSimulationFailed as ap, COIN_REGISTRY as b, type CoinMeta as c, DEFAULT_SAFEGUARD_CONFIG as d, type GasExecutionResult as e, type GasRequestType as f, type GasSponsorResponse as g, type GasStatusResponse as h, MIST_PER_SUI as i, SUI_DECIMALS as j, SUI_TYPE as k, SUPPORTED_ASSETS as l, type SafeguardConfig as m, SafeguardError as n, type SafeguardErrorDetails as o, type SafeguardRule as p, type SimulationResult as q, type StableAsset as r, type SupportedAsset as s, type T2000ErrorCode as t, type T2000ErrorData as u, TOKEN_MAP as v, type TransactionSigner as w, type TxMetadata as x, USDC_TYPE as y, USDE_TYPE as z };
|
|
@@ -51,7 +51,7 @@ declare class ZkLoginSigner implements TransactionSigner {
|
|
|
51
51
|
isExpired(currentEpoch: number): boolean;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'USDC_SPONSOR_FAILED' | 'USDC_SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'WITHDRAW_FAILED' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'UNKNOWN';
|
|
54
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'USDC_SPONSOR_FAILED' | 'USDC_SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'INVALID_ASSET' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'WITHDRAW_FAILED' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'UNKNOWN';
|
|
55
55
|
interface T2000ErrorData {
|
|
56
56
|
reason?: string;
|
|
57
57
|
[key: string]: unknown;
|
|
@@ -214,7 +214,7 @@ declare const SUPPORTED_ASSETS: {
|
|
|
214
214
|
};
|
|
215
215
|
};
|
|
216
216
|
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
217
|
-
type StableAsset = 'USDC'
|
|
217
|
+
type StableAsset = 'USDC';
|
|
218
218
|
declare const STABLE_ASSETS: readonly StableAsset[];
|
|
219
219
|
declare const ALL_NAVI_ASSETS: readonly SupportedAsset[];
|
|
220
220
|
declare const DEFAULT_NETWORK: "mainnet";
|
|
@@ -287,27 +287,39 @@ declare class SafeguardError extends T2000Error {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
|
-
* Unified token registry — single source of truth for coin types, decimals, and
|
|
290
|
+
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
291
291
|
*
|
|
292
292
|
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
293
|
-
*
|
|
294
|
-
*
|
|
293
|
+
*
|
|
294
|
+
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
295
|
+
* Tier 2: 13 curated swap assets — hold, trade, and send only.
|
|
296
|
+
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
295
297
|
*
|
|
296
298
|
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
299
|
+
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
297
300
|
*/
|
|
298
301
|
interface CoinMeta {
|
|
299
302
|
type: string;
|
|
300
303
|
decimals: number;
|
|
301
304
|
symbol: string;
|
|
305
|
+
tier?: 1 | 2;
|
|
302
306
|
}
|
|
303
307
|
/**
|
|
304
|
-
* Canonical coin registry.
|
|
308
|
+
* Canonical coin registry.
|
|
305
309
|
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
306
310
|
*/
|
|
307
311
|
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
312
|
+
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
313
|
+
declare function isTier1(coinType: string): boolean;
|
|
314
|
+
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
315
|
+
declare function isTier2(coinType: string): boolean;
|
|
316
|
+
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
317
|
+
declare function isSupported(coinType: string): boolean;
|
|
318
|
+
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
319
|
+
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
308
320
|
/**
|
|
309
321
|
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
310
|
-
*
|
|
322
|
+
* Works for both tiered and legacy tokens.
|
|
311
323
|
*/
|
|
312
324
|
declare function getDecimalsForCoinType(coinType: string): number;
|
|
313
325
|
/**
|
|
@@ -318,7 +330,6 @@ declare function resolveSymbol(coinType: string): string;
|
|
|
318
330
|
/**
|
|
319
331
|
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
320
332
|
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
321
|
-
* Backward-compatible with the original TOKEN_MAP in cetus-swap.ts.
|
|
322
333
|
*/
|
|
323
334
|
declare const TOKEN_MAP: Record<string, string>;
|
|
324
335
|
/**
|
|
@@ -327,7 +338,7 @@ declare const TOKEN_MAP: Record<string, string>;
|
|
|
327
338
|
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
328
339
|
*/
|
|
329
340
|
declare function resolveTokenType(nameOrType: string): string | null;
|
|
330
|
-
/** Common type constants for direct import
|
|
341
|
+
/** Common type constants for direct import. */
|
|
331
342
|
declare const SUI_TYPE: string;
|
|
332
343
|
declare const USDC_TYPE: string;
|
|
333
344
|
declare const USDT_TYPE: string;
|
|
@@ -337,5 +348,8 @@ declare const ETH_TYPE: string;
|
|
|
337
348
|
declare const WBTC_TYPE: string;
|
|
338
349
|
declare const WAL_TYPE: string;
|
|
339
350
|
declare const NAVX_TYPE: string;
|
|
351
|
+
declare const IKA_TYPE: string;
|
|
352
|
+
declare const LOFI_TYPE: string;
|
|
353
|
+
declare const MANIFEST_TYPE: string;
|
|
340
354
|
|
|
341
|
-
export {
|
|
355
|
+
export { formatAssetAmount as $, ALL_NAVI_ASSETS as A, BPS_DENOMINATOR as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, type FeeOperation as F, GAS_RESERVE_MIN as G, USDSUI_TYPE as H, IKA_TYPE as I, USDT_TYPE as J, KeypairSigner as K, LOFI_TYPE as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OUTBOUND_OPS as O, type ProtocolFeeInfo as P, WBTC_TYPE as Q, ZkLoginSigner as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, addCollectFeeToTx as V, WAL_TYPE as W, calculateFee as X, executeAutoTopUp as Y, type ZkLoginProof as Z, executeWithGas as _, type AutoTopUpResult as a, formatSui as a0, formatUsd as a1, getDecimals as a2, getDecimalsForCoinType as a3, getGasStatus as a4, getTier as a5, isSupported as a6, isTier1 as a7, isTier2 as a8, mapMoveAbortCode as a9, mapWalletError as aa, mistToSui as ab, rawToStable as ac, rawToUsdc as ad, resolveSymbol as ae, resolveTokenType as af, shouldAutoTopUp as ag, stableToRaw as ah, suiToMist as ai, truncateAddress as aj, usdcToRaw as ak, validateAddress as al, SafeguardEnforcer as am, CETUS_USDC_SUI_POOL as an, simulateTransaction as ao, throwIfSimulationFailed as ap, COIN_REGISTRY as b, type CoinMeta as c, DEFAULT_SAFEGUARD_CONFIG as d, type GasExecutionResult as e, type GasRequestType as f, type GasSponsorResponse as g, type GasStatusResponse as h, MIST_PER_SUI as i, SUI_DECIMALS as j, SUI_TYPE as k, SUPPORTED_ASSETS as l, type SafeguardConfig as m, SafeguardError as n, type SafeguardErrorDetails as o, type SafeguardRule as p, type SimulationResult as q, type StableAsset as r, type SupportedAsset as s, type T2000ErrorCode as t, type T2000ErrorData as u, TOKEN_MAP as v, type TransactionSigner as w, type TxMetadata as x, USDC_TYPE as y, USDE_TYPE as z };
|