@t2000/sdk 4.2.2 → 4.3.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/dist/browser.cjs +101 -2
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +100 -3
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +98 -80
- 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 +97 -81
- package/dist/index.js.map +1 -1
- package/dist/{types-CElCPOFA.d.ts → types-CFV4VcJJ.d.cts} +102 -86
- package/dist/{types-BjvEpkwT.d.cts → types-DqRLGfOC.d.ts} +102 -86
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
-
import {
|
|
4
|
-
import { T as TransactionLeg, k as TransactionRecord } from './types-Ch0zVUpC.js';
|
|
3
|
+
import { P as PayOptions, d as PayResult, T as TransactionLeg, k as TransactionRecord } from './types-Ch0zVUpC.cjs';
|
|
5
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Abstract signing interface that decouples the SDK from any specific
|
|
@@ -61,13 +61,111 @@ declare class ZkLoginSigner implements TransactionSigner {
|
|
|
61
61
|
signTransaction(txBytes: Uint8Array): Promise<{
|
|
62
62
|
signature: string;
|
|
63
63
|
}>;
|
|
64
|
-
signPersonalMessage(
|
|
64
|
+
signPersonalMessage(messageBytes: Uint8Array): Promise<{
|
|
65
65
|
signature: string;
|
|
66
66
|
bytes: string;
|
|
67
67
|
}>;
|
|
68
68
|
isExpired(currentEpoch: number): boolean;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
73
|
+
*
|
|
74
|
+
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
75
|
+
*
|
|
76
|
+
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
77
|
+
* Tier 2: 15 curated swap assets — hold, trade, and send only.
|
|
78
|
+
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
79
|
+
*
|
|
80
|
+
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
81
|
+
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
82
|
+
*/
|
|
83
|
+
interface CoinMeta {
|
|
84
|
+
type: string;
|
|
85
|
+
decimals: number;
|
|
86
|
+
symbol: string;
|
|
87
|
+
tier?: 1 | 2;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Canonical coin registry.
|
|
91
|
+
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
92
|
+
*/
|
|
93
|
+
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
96
|
+
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
97
|
+
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
98
|
+
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
99
|
+
* tier and still need canonical-symbol resolution.
|
|
100
|
+
*/
|
|
101
|
+
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
104
|
+
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
105
|
+
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
106
|
+
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
107
|
+
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
108
|
+
*/
|
|
109
|
+
declare function isInRegistry(coinType: string): boolean;
|
|
110
|
+
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
111
|
+
declare function isTier1(coinType: string): boolean;
|
|
112
|
+
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
113
|
+
declare function isTier2(coinType: string): boolean;
|
|
114
|
+
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
115
|
+
declare function isSupported(coinType: string): boolean;
|
|
116
|
+
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
117
|
+
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
120
|
+
* Works for both tiered and legacy tokens.
|
|
121
|
+
*/
|
|
122
|
+
declare function getDecimalsForCoinType(coinType: string): number;
|
|
123
|
+
/**
|
|
124
|
+
* Resolve a full coin type to a user-friendly symbol.
|
|
125
|
+
* Returns the last `::` segment if not in the registry.
|
|
126
|
+
*/
|
|
127
|
+
declare function resolveSymbol(coinType: string): string;
|
|
128
|
+
/**
|
|
129
|
+
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
130
|
+
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
131
|
+
*/
|
|
132
|
+
declare const TOKEN_MAP: Record<string, string>;
|
|
133
|
+
/**
|
|
134
|
+
* Resolve a user-friendly token name to its full coin type.
|
|
135
|
+
* Returns the input unchanged if already a full coin type (contains "::").
|
|
136
|
+
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
137
|
+
*/
|
|
138
|
+
declare function resolveTokenType(nameOrType: string): string | null;
|
|
139
|
+
/** Common type constants for direct import. */
|
|
140
|
+
declare const SUI_TYPE: string;
|
|
141
|
+
declare const USDC_TYPE: string;
|
|
142
|
+
declare const USDT_TYPE: string;
|
|
143
|
+
declare const USDSUI_TYPE: string;
|
|
144
|
+
declare const USDE_TYPE: string;
|
|
145
|
+
declare const ETH_TYPE: string;
|
|
146
|
+
declare const WBTC_TYPE: string;
|
|
147
|
+
declare const WAL_TYPE: string;
|
|
148
|
+
declare const NAVX_TYPE: string;
|
|
149
|
+
declare const IKA_TYPE: string;
|
|
150
|
+
declare const LOFI_TYPE: string;
|
|
151
|
+
declare const MANIFEST_TYPE: string;
|
|
152
|
+
|
|
153
|
+
declare function payWithMpp(args: {
|
|
154
|
+
signer: TransactionSigner;
|
|
155
|
+
client: SuiJsonRpcClient;
|
|
156
|
+
options: PayOptions;
|
|
157
|
+
}): Promise<PayResult>;
|
|
158
|
+
|
|
159
|
+
type SuiTransactionEffects = NonNullable<Awaited<ReturnType<SuiJsonRpcClient['executeTransactionBlock']>>['effects']>;
|
|
160
|
+
type BuildClient = NonNullable<Parameters<Transaction['build']>[0]>['client'];
|
|
161
|
+
declare function executeTx(client: SuiJsonRpcClient, signer: TransactionSigner, buildTx: () => Promise<Transaction> | Transaction, options?: {
|
|
162
|
+
buildClient?: BuildClient;
|
|
163
|
+
}): Promise<{
|
|
164
|
+
digest: string;
|
|
165
|
+
gasCostSui: number;
|
|
166
|
+
effects: SuiTransactionEffects | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
|
|
71
169
|
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'ADDRESS_BALANCE_UNSPONSORABLE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'WALLET_CORRUPT' | 'INVALID_KEY' | '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' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'SUINS_NOT_REGISTERED' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'CHAIN_MODE_INVALID' | 'UNKNOWN';
|
|
72
170
|
interface T2000ErrorData {
|
|
73
171
|
reason?: string;
|
|
@@ -246,88 +344,6 @@ declare function truncateAddress(address: string): string;
|
|
|
246
344
|
*/
|
|
247
345
|
declare function normalizeCoinType(coinType: string): string;
|
|
248
346
|
|
|
249
|
-
/**
|
|
250
|
-
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
251
|
-
*
|
|
252
|
-
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
253
|
-
*
|
|
254
|
-
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
255
|
-
* Tier 2: 15 curated swap assets — hold, trade, and send only.
|
|
256
|
-
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
257
|
-
*
|
|
258
|
-
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
259
|
-
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
260
|
-
*/
|
|
261
|
-
interface CoinMeta {
|
|
262
|
-
type: string;
|
|
263
|
-
decimals: number;
|
|
264
|
-
symbol: string;
|
|
265
|
-
tier?: 1 | 2;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Canonical coin registry.
|
|
269
|
-
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
270
|
-
*/
|
|
271
|
-
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
272
|
-
/**
|
|
273
|
-
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
274
|
-
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
275
|
-
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
276
|
-
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
277
|
-
* tier and still need canonical-symbol resolution.
|
|
278
|
-
*/
|
|
279
|
-
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
280
|
-
/**
|
|
281
|
-
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
282
|
-
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
283
|
-
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
284
|
-
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
285
|
-
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
286
|
-
*/
|
|
287
|
-
declare function isInRegistry(coinType: string): boolean;
|
|
288
|
-
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
289
|
-
declare function isTier1(coinType: string): boolean;
|
|
290
|
-
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
291
|
-
declare function isTier2(coinType: string): boolean;
|
|
292
|
-
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
293
|
-
declare function isSupported(coinType: string): boolean;
|
|
294
|
-
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
295
|
-
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
296
|
-
/**
|
|
297
|
-
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
298
|
-
* Works for both tiered and legacy tokens.
|
|
299
|
-
*/
|
|
300
|
-
declare function getDecimalsForCoinType(coinType: string): number;
|
|
301
|
-
/**
|
|
302
|
-
* Resolve a full coin type to a user-friendly symbol.
|
|
303
|
-
* Returns the last `::` segment if not in the registry.
|
|
304
|
-
*/
|
|
305
|
-
declare function resolveSymbol(coinType: string): string;
|
|
306
|
-
/**
|
|
307
|
-
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
308
|
-
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
309
|
-
*/
|
|
310
|
-
declare const TOKEN_MAP: Record<string, string>;
|
|
311
|
-
/**
|
|
312
|
-
* Resolve a user-friendly token name to its full coin type.
|
|
313
|
-
* Returns the input unchanged if already a full coin type (contains "::").
|
|
314
|
-
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
315
|
-
*/
|
|
316
|
-
declare function resolveTokenType(nameOrType: string): string | null;
|
|
317
|
-
/** Common type constants for direct import. */
|
|
318
|
-
declare const SUI_TYPE: string;
|
|
319
|
-
declare const USDC_TYPE: string;
|
|
320
|
-
declare const USDT_TYPE: string;
|
|
321
|
-
declare const USDSUI_TYPE: string;
|
|
322
|
-
declare const USDE_TYPE: string;
|
|
323
|
-
declare const ETH_TYPE: string;
|
|
324
|
-
declare const WBTC_TYPE: string;
|
|
325
|
-
declare const WAL_TYPE: string;
|
|
326
|
-
declare const NAVX_TYPE: string;
|
|
327
|
-
declare const IKA_TYPE: string;
|
|
328
|
-
declare const LOFI_TYPE: string;
|
|
329
|
-
declare const MANIFEST_TYPE: string;
|
|
330
|
-
|
|
331
347
|
/**
|
|
332
348
|
* Shared transaction classifier.
|
|
333
349
|
*
|
|
@@ -648,4 +664,4 @@ interface TxMetadata {
|
|
|
648
664
|
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
649
665
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
650
666
|
|
|
651
|
-
export { ZkLoginSigner as $, ALL_NAVI_ASSETS as A, BORROW_FEE_BPS as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, type FeeOperation as F, GAS_RESERVE_MIN as G, type TransactionSigner as H, IKA_TYPE as I, type TxDirection as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OUTBOUND_OPS as O, type ProtocolFeeInfo as P, type TxMetadata as Q, USDC_TYPE as R, SAVE_FEE_BPS as S, T2000Error as T, USDC_DECIMALS as U, USDE_TYPE as V, USDSUI_TYPE as W, USDT_TYPE as X, WAL_TYPE as Y, WBTC_TYPE as Z, type ZkLoginProof as _, BPS_DENOMINATOR as a, addFeeTransfer as a0, calculateFee as a1, classifyAction as a2, classifyLabel as a3, classifyTransaction as a4,
|
|
667
|
+
export { ZkLoginSigner as $, ALL_NAVI_ASSETS as A, BORROW_FEE_BPS as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, type FeeOperation as F, GAS_RESERVE_MIN as G, type TransactionSigner as H, IKA_TYPE as I, type TxDirection as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OUTBOUND_OPS as O, type ProtocolFeeInfo as P, type TxMetadata as Q, USDC_TYPE as R, SAVE_FEE_BPS as S, T2000Error as T, USDC_DECIMALS as U, USDE_TYPE as V, USDSUI_TYPE as W, USDT_TYPE as X, WAL_TYPE as Y, WBTC_TYPE as Z, type ZkLoginProof as _, BPS_DENOMINATOR as a, addFeeTransfer as a0, calculateFee as a1, classifyAction as a2, classifyLabel as a3, classifyTransaction as a4, executeTx as a5, extractAllUserLegs as a6, extractTransferDetails as a7, extractTxCommands as a8, extractTxSender as a9, CETUS_USDC_SUI_POOL as aA, DEFAULT_GRPC_URL as aB, GASLESS_MIN_STABLE_AMOUNT as aC, GASLESS_STABLE_TYPES as aD, OPERATION_ASSETS as aE, type Operation as aF, SAVEABLE_ASSETS as aG, SENDABLE_ASSETS as aH, type SaveableAsset as aI, assertAllowedAsset as aJ, createSuiClient as aK, getCoinMeta as aL, getSuiClient as aM, getSuiGrpcClient as aN, isAllowedAsset as aO, isInRegistry as aP, normalizeAsset as aQ, normalizeCoinType as aR, queryHistory as aS, queryTransaction as aT, simulateTransaction as aU, throwIfSimulationFailed as aV, fallbackLabel as aa, formatAssetAmount as ab, formatSui as ac, formatUsd as ad, getDecimals as ae, getDecimalsForCoinType as af, getTier as ag, isSupported as ah, isTier1 as ai, isTier2 as aj, mapMoveAbortCode as ak, mapWalletError as al, mistToSui as am, parseSuiRpcTx as an, payWithMpp as ao, rawToStable as ap, rawToUsdc as aq, refineLendingLabel as ar, resolveSymbol as as, resolveTokenType as at, stableToRaw as au, suiToMist as av, truncateAddress as aw, usdcToRaw as ax, validateAddress as ay, type SendableAsset as az, COIN_REGISTRY as b, type ClassifyBalanceChange as c, type ClassifyResult as d, type CoinMeta as e, DEFAULT_SAFEGUARD_CONFIG as f, type ExtractedTransfer as g, KeypairSigner as h, LOFI_TYPE as i, MIST_PER_SUI as j, STABLE_ASSETS as k, SUI_DECIMALS as l, SUI_TYPE as m, SUPPORTED_ASSETS as n, type SafeguardConfig as o, SafeguardError as p, type SafeguardErrorDetails as q, type SafeguardRule as r, type SimulationResult as s, type StableAsset as t, type SuiRpcTxBlock as u, type SupportedAsset as v, type T2000ErrorCode as w, type T2000ErrorData as x, T2000_OVERLAY_FEE_WALLET as y, TOKEN_MAP as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
-
import {
|
|
4
|
-
import { T as TransactionLeg, k as TransactionRecord } from './types-Ch0zVUpC.cjs';
|
|
3
|
+
import { P as PayOptions, d as PayResult, T as TransactionLeg, k as TransactionRecord } from './types-Ch0zVUpC.js';
|
|
5
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
|
+
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Abstract signing interface that decouples the SDK from any specific
|
|
@@ -61,13 +61,111 @@ declare class ZkLoginSigner implements TransactionSigner {
|
|
|
61
61
|
signTransaction(txBytes: Uint8Array): Promise<{
|
|
62
62
|
signature: string;
|
|
63
63
|
}>;
|
|
64
|
-
signPersonalMessage(
|
|
64
|
+
signPersonalMessage(messageBytes: Uint8Array): Promise<{
|
|
65
65
|
signature: string;
|
|
66
66
|
bytes: string;
|
|
67
67
|
}>;
|
|
68
68
|
isExpired(currentEpoch: number): boolean;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
73
|
+
*
|
|
74
|
+
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
75
|
+
*
|
|
76
|
+
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
77
|
+
* Tier 2: 15 curated swap assets — hold, trade, and send only.
|
|
78
|
+
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
79
|
+
*
|
|
80
|
+
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
81
|
+
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
82
|
+
*/
|
|
83
|
+
interface CoinMeta {
|
|
84
|
+
type: string;
|
|
85
|
+
decimals: number;
|
|
86
|
+
symbol: string;
|
|
87
|
+
tier?: 1 | 2;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Canonical coin registry.
|
|
91
|
+
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
92
|
+
*/
|
|
93
|
+
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
96
|
+
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
97
|
+
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
98
|
+
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
99
|
+
* tier and still need canonical-symbol resolution.
|
|
100
|
+
*/
|
|
101
|
+
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
104
|
+
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
105
|
+
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
106
|
+
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
107
|
+
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
108
|
+
*/
|
|
109
|
+
declare function isInRegistry(coinType: string): boolean;
|
|
110
|
+
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
111
|
+
declare function isTier1(coinType: string): boolean;
|
|
112
|
+
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
113
|
+
declare function isTier2(coinType: string): boolean;
|
|
114
|
+
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
115
|
+
declare function isSupported(coinType: string): boolean;
|
|
116
|
+
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
117
|
+
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
120
|
+
* Works for both tiered and legacy tokens.
|
|
121
|
+
*/
|
|
122
|
+
declare function getDecimalsForCoinType(coinType: string): number;
|
|
123
|
+
/**
|
|
124
|
+
* Resolve a full coin type to a user-friendly symbol.
|
|
125
|
+
* Returns the last `::` segment if not in the registry.
|
|
126
|
+
*/
|
|
127
|
+
declare function resolveSymbol(coinType: string): string;
|
|
128
|
+
/**
|
|
129
|
+
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
130
|
+
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
131
|
+
*/
|
|
132
|
+
declare const TOKEN_MAP: Record<string, string>;
|
|
133
|
+
/**
|
|
134
|
+
* Resolve a user-friendly token name to its full coin type.
|
|
135
|
+
* Returns the input unchanged if already a full coin type (contains "::").
|
|
136
|
+
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
137
|
+
*/
|
|
138
|
+
declare function resolveTokenType(nameOrType: string): string | null;
|
|
139
|
+
/** Common type constants for direct import. */
|
|
140
|
+
declare const SUI_TYPE: string;
|
|
141
|
+
declare const USDC_TYPE: string;
|
|
142
|
+
declare const USDT_TYPE: string;
|
|
143
|
+
declare const USDSUI_TYPE: string;
|
|
144
|
+
declare const USDE_TYPE: string;
|
|
145
|
+
declare const ETH_TYPE: string;
|
|
146
|
+
declare const WBTC_TYPE: string;
|
|
147
|
+
declare const WAL_TYPE: string;
|
|
148
|
+
declare const NAVX_TYPE: string;
|
|
149
|
+
declare const IKA_TYPE: string;
|
|
150
|
+
declare const LOFI_TYPE: string;
|
|
151
|
+
declare const MANIFEST_TYPE: string;
|
|
152
|
+
|
|
153
|
+
declare function payWithMpp(args: {
|
|
154
|
+
signer: TransactionSigner;
|
|
155
|
+
client: SuiJsonRpcClient;
|
|
156
|
+
options: PayOptions;
|
|
157
|
+
}): Promise<PayResult>;
|
|
158
|
+
|
|
159
|
+
type SuiTransactionEffects = NonNullable<Awaited<ReturnType<SuiJsonRpcClient['executeTransactionBlock']>>['effects']>;
|
|
160
|
+
type BuildClient = NonNullable<Parameters<Transaction['build']>[0]>['client'];
|
|
161
|
+
declare function executeTx(client: SuiJsonRpcClient, signer: TransactionSigner, buildTx: () => Promise<Transaction> | Transaction, options?: {
|
|
162
|
+
buildClient?: BuildClient;
|
|
163
|
+
}): Promise<{
|
|
164
|
+
digest: string;
|
|
165
|
+
gasCostSui: number;
|
|
166
|
+
effects: SuiTransactionEffects | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
|
|
71
169
|
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'ADDRESS_BALANCE_UNSPONSORABLE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'WALLET_CORRUPT' | 'INVALID_KEY' | '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' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'SUINS_NOT_REGISTERED' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'CHAIN_MODE_INVALID' | 'UNKNOWN';
|
|
72
170
|
interface T2000ErrorData {
|
|
73
171
|
reason?: string;
|
|
@@ -246,88 +344,6 @@ declare function truncateAddress(address: string): string;
|
|
|
246
344
|
*/
|
|
247
345
|
declare function normalizeCoinType(coinType: string): string;
|
|
248
346
|
|
|
249
|
-
/**
|
|
250
|
-
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
251
|
-
*
|
|
252
|
-
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
253
|
-
*
|
|
254
|
-
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
255
|
-
* Tier 2: 15 curated swap assets — hold, trade, and send only.
|
|
256
|
-
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
257
|
-
*
|
|
258
|
-
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
259
|
-
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
260
|
-
*/
|
|
261
|
-
interface CoinMeta {
|
|
262
|
-
type: string;
|
|
263
|
-
decimals: number;
|
|
264
|
-
symbol: string;
|
|
265
|
-
tier?: 1 | 2;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Canonical coin registry.
|
|
269
|
-
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
270
|
-
*/
|
|
271
|
-
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
272
|
-
/**
|
|
273
|
-
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
274
|
-
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
275
|
-
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
276
|
-
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
277
|
-
* tier and still need canonical-symbol resolution.
|
|
278
|
-
*/
|
|
279
|
-
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
280
|
-
/**
|
|
281
|
-
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
282
|
-
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
283
|
-
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
284
|
-
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
285
|
-
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
286
|
-
*/
|
|
287
|
-
declare function isInRegistry(coinType: string): boolean;
|
|
288
|
-
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
289
|
-
declare function isTier1(coinType: string): boolean;
|
|
290
|
-
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
291
|
-
declare function isTier2(coinType: string): boolean;
|
|
292
|
-
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
293
|
-
declare function isSupported(coinType: string): boolean;
|
|
294
|
-
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
295
|
-
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
296
|
-
/**
|
|
297
|
-
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
298
|
-
* Works for both tiered and legacy tokens.
|
|
299
|
-
*/
|
|
300
|
-
declare function getDecimalsForCoinType(coinType: string): number;
|
|
301
|
-
/**
|
|
302
|
-
* Resolve a full coin type to a user-friendly symbol.
|
|
303
|
-
* Returns the last `::` segment if not in the registry.
|
|
304
|
-
*/
|
|
305
|
-
declare function resolveSymbol(coinType: string): string;
|
|
306
|
-
/**
|
|
307
|
-
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
308
|
-
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
309
|
-
*/
|
|
310
|
-
declare const TOKEN_MAP: Record<string, string>;
|
|
311
|
-
/**
|
|
312
|
-
* Resolve a user-friendly token name to its full coin type.
|
|
313
|
-
* Returns the input unchanged if already a full coin type (contains "::").
|
|
314
|
-
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
315
|
-
*/
|
|
316
|
-
declare function resolveTokenType(nameOrType: string): string | null;
|
|
317
|
-
/** Common type constants for direct import. */
|
|
318
|
-
declare const SUI_TYPE: string;
|
|
319
|
-
declare const USDC_TYPE: string;
|
|
320
|
-
declare const USDT_TYPE: string;
|
|
321
|
-
declare const USDSUI_TYPE: string;
|
|
322
|
-
declare const USDE_TYPE: string;
|
|
323
|
-
declare const ETH_TYPE: string;
|
|
324
|
-
declare const WBTC_TYPE: string;
|
|
325
|
-
declare const WAL_TYPE: string;
|
|
326
|
-
declare const NAVX_TYPE: string;
|
|
327
|
-
declare const IKA_TYPE: string;
|
|
328
|
-
declare const LOFI_TYPE: string;
|
|
329
|
-
declare const MANIFEST_TYPE: string;
|
|
330
|
-
|
|
331
347
|
/**
|
|
332
348
|
* Shared transaction classifier.
|
|
333
349
|
*
|
|
@@ -648,4 +664,4 @@ interface TxMetadata {
|
|
|
648
664
|
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
649
665
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
650
666
|
|
|
651
|
-
export { ZkLoginSigner as $, ALL_NAVI_ASSETS as A, BORROW_FEE_BPS as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, type FeeOperation as F, GAS_RESERVE_MIN as G, type TransactionSigner as H, IKA_TYPE as I, type TxDirection as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OUTBOUND_OPS as O, type ProtocolFeeInfo as P, type TxMetadata as Q, USDC_TYPE as R, SAVE_FEE_BPS as S, T2000Error as T, USDC_DECIMALS as U, USDE_TYPE as V, USDSUI_TYPE as W, USDT_TYPE as X, WAL_TYPE as Y, WBTC_TYPE as Z, type ZkLoginProof as _, BPS_DENOMINATOR as a, addFeeTransfer as a0, calculateFee as a1, classifyAction as a2, classifyLabel as a3, classifyTransaction as a4,
|
|
667
|
+
export { ZkLoginSigner as $, ALL_NAVI_ASSETS as A, BORROW_FEE_BPS as B, CLOCK_ID as C, DEFAULT_NETWORK as D, ETH_TYPE as E, type FeeOperation as F, GAS_RESERVE_MIN as G, type TransactionSigner as H, IKA_TYPE as I, type TxDirection as J, KNOWN_TARGETS as K, LABEL_PATTERNS as L, MANIFEST_TYPE as M, NAVX_TYPE as N, OUTBOUND_OPS as O, type ProtocolFeeInfo as P, type TxMetadata as Q, USDC_TYPE as R, SAVE_FEE_BPS as S, T2000Error as T, USDC_DECIMALS as U, USDE_TYPE as V, USDSUI_TYPE as W, USDT_TYPE as X, WAL_TYPE as Y, WBTC_TYPE as Z, type ZkLoginProof as _, BPS_DENOMINATOR as a, addFeeTransfer as a0, calculateFee as a1, classifyAction as a2, classifyLabel as a3, classifyTransaction as a4, executeTx as a5, extractAllUserLegs as a6, extractTransferDetails as a7, extractTxCommands as a8, extractTxSender as a9, CETUS_USDC_SUI_POOL as aA, DEFAULT_GRPC_URL as aB, GASLESS_MIN_STABLE_AMOUNT as aC, GASLESS_STABLE_TYPES as aD, OPERATION_ASSETS as aE, type Operation as aF, SAVEABLE_ASSETS as aG, SENDABLE_ASSETS as aH, type SaveableAsset as aI, assertAllowedAsset as aJ, createSuiClient as aK, getCoinMeta as aL, getSuiClient as aM, getSuiGrpcClient as aN, isAllowedAsset as aO, isInRegistry as aP, normalizeAsset as aQ, normalizeCoinType as aR, queryHistory as aS, queryTransaction as aT, simulateTransaction as aU, throwIfSimulationFailed as aV, fallbackLabel as aa, formatAssetAmount as ab, formatSui as ac, formatUsd as ad, getDecimals as ae, getDecimalsForCoinType as af, getTier as ag, isSupported as ah, isTier1 as ai, isTier2 as aj, mapMoveAbortCode as ak, mapWalletError as al, mistToSui as am, parseSuiRpcTx as an, payWithMpp as ao, rawToStable as ap, rawToUsdc as aq, refineLendingLabel as ar, resolveSymbol as as, resolveTokenType as at, stableToRaw as au, suiToMist as av, truncateAddress as aw, usdcToRaw as ax, validateAddress as ay, type SendableAsset as az, COIN_REGISTRY as b, type ClassifyBalanceChange as c, type ClassifyResult as d, type CoinMeta as e, DEFAULT_SAFEGUARD_CONFIG as f, type ExtractedTransfer as g, KeypairSigner as h, LOFI_TYPE as i, MIST_PER_SUI as j, STABLE_ASSETS as k, SUI_DECIMALS as l, SUI_TYPE as m, SUPPORTED_ASSETS as n, type SafeguardConfig as o, SafeguardError as p, type SafeguardErrorDetails as q, type SafeguardRule as r, type SimulationResult as s, type StableAsset as t, type SuiRpcTxBlock as u, type SupportedAsset as v, type T2000ErrorCode as w, type T2000ErrorData as x, T2000_OVERLAY_FEE_WALLET as y, TOKEN_MAP as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "TypeScript SDK for Agent Wallets on Sui — gasless USDC + USDsui transfers, Cetus swap routing, NAVI lending (programmatic), MPP paid API access, zkLogin compatible.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|