@t2000/sdk 1.27.1 → 1.28.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/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/browser.cjs +23 -0
- 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 +23 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-Bheg9UZP.d.ts → types-CvBZ1IrA.d.ts} +98 -80
- package/dist/{types-Cv9ZQ7KK.d.cts → types-DmXSwjQ1.d.cts} +98 -80
- package/dist/{types-BaYOyGKJ.d.cts → types-epj9U13o.d.cts} +43 -1
- package/dist/{types-BaYOyGKJ.d.ts → types-epj9U13o.d.ts} +43 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
-
import { T as TransactionRecord } from './types-
|
|
3
|
+
import { T as TransactionLeg, k as TransactionRecord } from './types-epj9U13o.js';
|
|
4
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -177,6 +177,88 @@ declare function truncateAddress(address: string): string;
|
|
|
177
177
|
*/
|
|
178
178
|
declare function normalizeCoinType(coinType: string): string;
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
182
|
+
*
|
|
183
|
+
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
184
|
+
*
|
|
185
|
+
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
186
|
+
* Tier 2: 15 curated swap assets — hold, trade, and send only.
|
|
187
|
+
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
188
|
+
*
|
|
189
|
+
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
190
|
+
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
191
|
+
*/
|
|
192
|
+
interface CoinMeta {
|
|
193
|
+
type: string;
|
|
194
|
+
decimals: number;
|
|
195
|
+
symbol: string;
|
|
196
|
+
tier?: 1 | 2;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Canonical coin registry.
|
|
200
|
+
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
201
|
+
*/
|
|
202
|
+
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
203
|
+
/**
|
|
204
|
+
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
205
|
+
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
206
|
+
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
207
|
+
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
208
|
+
* tier and still need canonical-symbol resolution.
|
|
209
|
+
*/
|
|
210
|
+
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
213
|
+
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
214
|
+
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
215
|
+
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
216
|
+
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
217
|
+
*/
|
|
218
|
+
declare function isInRegistry(coinType: string): boolean;
|
|
219
|
+
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
220
|
+
declare function isTier1(coinType: string): boolean;
|
|
221
|
+
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
222
|
+
declare function isTier2(coinType: string): boolean;
|
|
223
|
+
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
224
|
+
declare function isSupported(coinType: string): boolean;
|
|
225
|
+
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
226
|
+
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
229
|
+
* Works for both tiered and legacy tokens.
|
|
230
|
+
*/
|
|
231
|
+
declare function getDecimalsForCoinType(coinType: string): number;
|
|
232
|
+
/**
|
|
233
|
+
* Resolve a full coin type to a user-friendly symbol.
|
|
234
|
+
* Returns the last `::` segment if not in the registry.
|
|
235
|
+
*/
|
|
236
|
+
declare function resolveSymbol(coinType: string): string;
|
|
237
|
+
/**
|
|
238
|
+
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
239
|
+
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
240
|
+
*/
|
|
241
|
+
declare const TOKEN_MAP: Record<string, string>;
|
|
242
|
+
/**
|
|
243
|
+
* Resolve a user-friendly token name to its full coin type.
|
|
244
|
+
* Returns the input unchanged if already a full coin type (contains "::").
|
|
245
|
+
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
246
|
+
*/
|
|
247
|
+
declare function resolveTokenType(nameOrType: string): string | null;
|
|
248
|
+
/** Common type constants for direct import. */
|
|
249
|
+
declare const SUI_TYPE: string;
|
|
250
|
+
declare const USDC_TYPE: string;
|
|
251
|
+
declare const USDT_TYPE: string;
|
|
252
|
+
declare const USDSUI_TYPE: string;
|
|
253
|
+
declare const USDE_TYPE: string;
|
|
254
|
+
declare const ETH_TYPE: string;
|
|
255
|
+
declare const WBTC_TYPE: string;
|
|
256
|
+
declare const WAL_TYPE: string;
|
|
257
|
+
declare const NAVX_TYPE: string;
|
|
258
|
+
declare const IKA_TYPE: string;
|
|
259
|
+
declare const LOFI_TYPE: string;
|
|
260
|
+
declare const MANIFEST_TYPE: string;
|
|
261
|
+
|
|
180
262
|
/**
|
|
181
263
|
* Shared transaction classifier.
|
|
182
264
|
*
|
|
@@ -307,88 +389,24 @@ interface ExtractedTransfer {
|
|
|
307
389
|
* because the card guessed direction from the label string).
|
|
308
390
|
*/
|
|
309
391
|
declare function extractTransferDetails(changes: ClassifyBalanceChange[] | undefined, sender: string): ExtractedTransfer;
|
|
310
|
-
|
|
311
392
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
393
|
+
* Extract every non-zero user balance leg for a transaction — not
|
|
394
|
+
* just the largest one. Order is RPC order; callers responsible for
|
|
395
|
+
* any sorting (e.g. audric sorts by USD value once it's priced).
|
|
315
396
|
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
397
|
+
* Sui collapses balance changes by coin type, so a 3-step bundle
|
|
398
|
+
* touching USDC three times surfaces as ONE leg of net USDC delta.
|
|
399
|
+
* Distinguishing per-step legs would require parsing the PTB's
|
|
400
|
+
* commands; this helper deliberately stops at the balance-change
|
|
401
|
+
* granularity because that's what's reliably available across all
|
|
402
|
+
* Sui RPC versions.
|
|
319
403
|
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
type: string;
|
|
325
|
-
decimals: number;
|
|
326
|
-
symbol: string;
|
|
327
|
-
tier?: 1 | 2;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Canonical coin registry.
|
|
331
|
-
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
332
|
-
*/
|
|
333
|
-
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
334
|
-
/**
|
|
335
|
-
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
336
|
-
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
337
|
-
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
338
|
-
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
339
|
-
* tier and still need canonical-symbol resolution.
|
|
340
|
-
*/
|
|
341
|
-
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
342
|
-
/**
|
|
343
|
-
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
344
|
-
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
345
|
-
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
346
|
-
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
347
|
-
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
348
|
-
*/
|
|
349
|
-
declare function isInRegistry(coinType: string): boolean;
|
|
350
|
-
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
351
|
-
declare function isTier1(coinType: string): boolean;
|
|
352
|
-
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
353
|
-
declare function isTier2(coinType: string): boolean;
|
|
354
|
-
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
355
|
-
declare function isSupported(coinType: string): boolean;
|
|
356
|
-
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
357
|
-
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
358
|
-
/**
|
|
359
|
-
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
360
|
-
* Works for both tiered and legacy tokens.
|
|
361
|
-
*/
|
|
362
|
-
declare function getDecimalsForCoinType(coinType: string): number;
|
|
363
|
-
/**
|
|
364
|
-
* Resolve a full coin type to a user-friendly symbol.
|
|
365
|
-
* Returns the last `::` segment if not in the registry.
|
|
366
|
-
*/
|
|
367
|
-
declare function resolveSymbol(coinType: string): string;
|
|
368
|
-
/**
|
|
369
|
-
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
370
|
-
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
404
|
+
* Pre-v1.27.2 the only public API was `extractTransferDetails`,
|
|
405
|
+
* which returned a single "primary" leg and made swap rows
|
|
406
|
+
* unrenderable (showed `Swapped 987.60 MANIFEST` because MANIFEST
|
|
407
|
+
* was the largest raw delta even though USDC was the value side).
|
|
371
408
|
*/
|
|
372
|
-
declare
|
|
373
|
-
/**
|
|
374
|
-
* Resolve a user-friendly token name to its full coin type.
|
|
375
|
-
* Returns the input unchanged if already a full coin type (contains "::").
|
|
376
|
-
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
377
|
-
*/
|
|
378
|
-
declare function resolveTokenType(nameOrType: string): string | null;
|
|
379
|
-
/** Common type constants for direct import. */
|
|
380
|
-
declare const SUI_TYPE: string;
|
|
381
|
-
declare const USDC_TYPE: string;
|
|
382
|
-
declare const USDT_TYPE: string;
|
|
383
|
-
declare const USDSUI_TYPE: string;
|
|
384
|
-
declare const USDE_TYPE: string;
|
|
385
|
-
declare const ETH_TYPE: string;
|
|
386
|
-
declare const WBTC_TYPE: string;
|
|
387
|
-
declare const WAL_TYPE: string;
|
|
388
|
-
declare const NAVX_TYPE: string;
|
|
389
|
-
declare const IKA_TYPE: string;
|
|
390
|
-
declare const LOFI_TYPE: string;
|
|
391
|
-
declare const MANIFEST_TYPE: string;
|
|
409
|
+
declare function extractAllUserLegs(changes: ClassifyBalanceChange[] | undefined, sender: string): TransactionLeg[];
|
|
392
410
|
|
|
393
411
|
declare function queryHistory(client: SuiJsonRpcClient, address: string, limit?: number): Promise<TransactionRecord[]>;
|
|
394
412
|
declare function queryTransaction(client: SuiJsonRpcClient, digest: string, senderAddress: string): Promise<TransactionRecord | null>;
|
|
@@ -561,4 +579,4 @@ interface TxMetadata {
|
|
|
561
579
|
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
562
580
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
563
581
|
|
|
564
|
-
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,
|
|
582
|
+
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, extractAllUserLegs as a5, extractTransferDetails as a6, extractTxCommands as a7, extractTxSender as a8, fallbackLabel as a9, assertAllowedAsset as aA, getCoinMeta as aB, isAllowedAsset as aC, isInRegistry as aD, normalizeAsset as aE, normalizeCoinType as aF, queryHistory as aG, queryTransaction as aH, simulateTransaction as aI, throwIfSimulationFailed as aJ, formatAssetAmount as aa, formatSui as ab, formatUsd as ac, getDecimals as ad, getDecimalsForCoinType as ae, getTier as af, isSupported as ag, isTier1 as ah, isTier2 as ai, mapMoveAbortCode as aj, mapWalletError as ak, mistToSui as al, parseSuiRpcTx as am, rawToStable as an, rawToUsdc as ao, refineLendingLabel as ap, resolveSymbol as aq, resolveTokenType as ar, stableToRaw as as, suiToMist as at, truncateAddress as au, usdcToRaw as av, validateAddress as aw, CETUS_USDC_SUI_POOL as ax, OPERATION_ASSETS as ay, type Operation 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,6 +1,6 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
-
import { T as TransactionRecord } from './types-
|
|
3
|
+
import { T as TransactionLeg, k as TransactionRecord } from './types-epj9U13o.cjs';
|
|
4
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -177,6 +177,88 @@ declare function truncateAddress(address: string): string;
|
|
|
177
177
|
*/
|
|
178
178
|
declare function normalizeCoinType(coinType: string): string;
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
182
|
+
*
|
|
183
|
+
* ZERO heavy dependencies. Safe to import from any context (server, browser, Edge).
|
|
184
|
+
*
|
|
185
|
+
* Tier 1: USDC — the financial layer (save, borrow, receive, yield, allowances, marketplace, MPP).
|
|
186
|
+
* Tier 2: 15 curated swap assets — hold, trade, and send only.
|
|
187
|
+
* No tier: Legacy tokens kept for display accuracy (existing NAVI positions). No new operations.
|
|
188
|
+
*
|
|
189
|
+
* To add a new token: add ONE entry to COIN_REGISTRY below. Everything else derives from it.
|
|
190
|
+
* Gate for Tier 2 addition: confirmed deep Cetus liquidity + clear user need.
|
|
191
|
+
*/
|
|
192
|
+
interface CoinMeta {
|
|
193
|
+
type: string;
|
|
194
|
+
decimals: number;
|
|
195
|
+
symbol: string;
|
|
196
|
+
tier?: 1 | 2;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Canonical coin registry.
|
|
200
|
+
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
201
|
+
*/
|
|
202
|
+
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
203
|
+
/**
|
|
204
|
+
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
205
|
+
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
206
|
+
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
207
|
+
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
208
|
+
* tier and still need canonical-symbol resolution.
|
|
209
|
+
*/
|
|
210
|
+
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
213
|
+
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
214
|
+
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
215
|
+
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
216
|
+
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
217
|
+
*/
|
|
218
|
+
declare function isInRegistry(coinType: string): boolean;
|
|
219
|
+
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
220
|
+
declare function isTier1(coinType: string): boolean;
|
|
221
|
+
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
222
|
+
declare function isTier2(coinType: string): boolean;
|
|
223
|
+
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
224
|
+
declare function isSupported(coinType: string): boolean;
|
|
225
|
+
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
226
|
+
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
229
|
+
* Works for both tiered and legacy tokens.
|
|
230
|
+
*/
|
|
231
|
+
declare function getDecimalsForCoinType(coinType: string): number;
|
|
232
|
+
/**
|
|
233
|
+
* Resolve a full coin type to a user-friendly symbol.
|
|
234
|
+
* Returns the last `::` segment if not in the registry.
|
|
235
|
+
*/
|
|
236
|
+
declare function resolveSymbol(coinType: string): string;
|
|
237
|
+
/**
|
|
238
|
+
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
239
|
+
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
240
|
+
*/
|
|
241
|
+
declare const TOKEN_MAP: Record<string, string>;
|
|
242
|
+
/**
|
|
243
|
+
* Resolve a user-friendly token name to its full coin type.
|
|
244
|
+
* Returns the input unchanged if already a full coin type (contains "::").
|
|
245
|
+
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
246
|
+
*/
|
|
247
|
+
declare function resolveTokenType(nameOrType: string): string | null;
|
|
248
|
+
/** Common type constants for direct import. */
|
|
249
|
+
declare const SUI_TYPE: string;
|
|
250
|
+
declare const USDC_TYPE: string;
|
|
251
|
+
declare const USDT_TYPE: string;
|
|
252
|
+
declare const USDSUI_TYPE: string;
|
|
253
|
+
declare const USDE_TYPE: string;
|
|
254
|
+
declare const ETH_TYPE: string;
|
|
255
|
+
declare const WBTC_TYPE: string;
|
|
256
|
+
declare const WAL_TYPE: string;
|
|
257
|
+
declare const NAVX_TYPE: string;
|
|
258
|
+
declare const IKA_TYPE: string;
|
|
259
|
+
declare const LOFI_TYPE: string;
|
|
260
|
+
declare const MANIFEST_TYPE: string;
|
|
261
|
+
|
|
180
262
|
/**
|
|
181
263
|
* Shared transaction classifier.
|
|
182
264
|
*
|
|
@@ -307,88 +389,24 @@ interface ExtractedTransfer {
|
|
|
307
389
|
* because the card guessed direction from the label string).
|
|
308
390
|
*/
|
|
309
391
|
declare function extractTransferDetails(changes: ClassifyBalanceChange[] | undefined, sender: string): ExtractedTransfer;
|
|
310
|
-
|
|
311
392
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
393
|
+
* Extract every non-zero user balance leg for a transaction — not
|
|
394
|
+
* just the largest one. Order is RPC order; callers responsible for
|
|
395
|
+
* any sorting (e.g. audric sorts by USD value once it's priced).
|
|
315
396
|
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
397
|
+
* Sui collapses balance changes by coin type, so a 3-step bundle
|
|
398
|
+
* touching USDC three times surfaces as ONE leg of net USDC delta.
|
|
399
|
+
* Distinguishing per-step legs would require parsing the PTB's
|
|
400
|
+
* commands; this helper deliberately stops at the balance-change
|
|
401
|
+
* granularity because that's what's reliably available across all
|
|
402
|
+
* Sui RPC versions.
|
|
319
403
|
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
type: string;
|
|
325
|
-
decimals: number;
|
|
326
|
-
symbol: string;
|
|
327
|
-
tier?: 1 | 2;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Canonical coin registry.
|
|
331
|
-
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
332
|
-
*/
|
|
333
|
-
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
334
|
-
/**
|
|
335
|
-
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
336
|
-
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
337
|
-
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
338
|
-
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
339
|
-
* tier and still need canonical-symbol resolution.
|
|
340
|
-
*/
|
|
341
|
-
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
342
|
-
/**
|
|
343
|
-
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
344
|
-
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
345
|
-
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
346
|
-
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
347
|
-
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
348
|
-
*/
|
|
349
|
-
declare function isInRegistry(coinType: string): boolean;
|
|
350
|
-
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
351
|
-
declare function isTier1(coinType: string): boolean;
|
|
352
|
-
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
353
|
-
declare function isTier2(coinType: string): boolean;
|
|
354
|
-
/** Returns true if the coin type is actively supported (Tier 1 or Tier 2). */
|
|
355
|
-
declare function isSupported(coinType: string): boolean;
|
|
356
|
-
/** Returns the tier for a coin type, or undefined if legacy/unknown. */
|
|
357
|
-
declare function getTier(coinType: string): 1 | 2 | undefined;
|
|
358
|
-
/**
|
|
359
|
-
* Get decimals for any coin type. Checks full type match, then suffix match, then defaults to 9.
|
|
360
|
-
* Works for both tiered and legacy tokens.
|
|
361
|
-
*/
|
|
362
|
-
declare function getDecimalsForCoinType(coinType: string): number;
|
|
363
|
-
/**
|
|
364
|
-
* Resolve a full coin type to a user-friendly symbol.
|
|
365
|
-
* Returns the last `::` segment if not in the registry.
|
|
366
|
-
*/
|
|
367
|
-
declare function resolveSymbol(coinType: string): string;
|
|
368
|
-
/**
|
|
369
|
-
* Name → type map for swap resolution. Derived from COIN_REGISTRY.
|
|
370
|
-
* Contains BOTH original-case and UPPERCASE keys for case-insensitive lookup.
|
|
404
|
+
* Pre-v1.27.2 the only public API was `extractTransferDetails`,
|
|
405
|
+
* which returned a single "primary" leg and made swap rows
|
|
406
|
+
* unrenderable (showed `Swapped 987.60 MANIFEST` because MANIFEST
|
|
407
|
+
* was the largest raw delta even though USDC was the value side).
|
|
371
408
|
*/
|
|
372
|
-
declare
|
|
373
|
-
/**
|
|
374
|
-
* Resolve a user-friendly token name to its full coin type.
|
|
375
|
-
* Returns the input unchanged if already a full coin type (contains "::").
|
|
376
|
-
* Case-insensitive: 'usde', 'USDe', 'USDE' all resolve correctly.
|
|
377
|
-
*/
|
|
378
|
-
declare function resolveTokenType(nameOrType: string): string | null;
|
|
379
|
-
/** Common type constants for direct import. */
|
|
380
|
-
declare const SUI_TYPE: string;
|
|
381
|
-
declare const USDC_TYPE: string;
|
|
382
|
-
declare const USDT_TYPE: string;
|
|
383
|
-
declare const USDSUI_TYPE: string;
|
|
384
|
-
declare const USDE_TYPE: string;
|
|
385
|
-
declare const ETH_TYPE: string;
|
|
386
|
-
declare const WBTC_TYPE: string;
|
|
387
|
-
declare const WAL_TYPE: string;
|
|
388
|
-
declare const NAVX_TYPE: string;
|
|
389
|
-
declare const IKA_TYPE: string;
|
|
390
|
-
declare const LOFI_TYPE: string;
|
|
391
|
-
declare const MANIFEST_TYPE: string;
|
|
409
|
+
declare function extractAllUserLegs(changes: ClassifyBalanceChange[] | undefined, sender: string): TransactionLeg[];
|
|
392
410
|
|
|
393
411
|
declare function queryHistory(client: SuiJsonRpcClient, address: string, limit?: number): Promise<TransactionRecord[]>;
|
|
394
412
|
declare function queryTransaction(client: SuiJsonRpcClient, digest: string, senderAddress: string): Promise<TransactionRecord | null>;
|
|
@@ -561,4 +579,4 @@ interface TxMetadata {
|
|
|
561
579
|
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
562
580
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
563
581
|
|
|
564
|
-
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,
|
|
582
|
+
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, extractAllUserLegs as a5, extractTransferDetails as a6, extractTxCommands as a7, extractTxSender as a8, fallbackLabel as a9, assertAllowedAsset as aA, getCoinMeta as aB, isAllowedAsset as aC, isInRegistry as aD, normalizeAsset as aE, normalizeCoinType as aF, queryHistory as aG, queryTransaction as aH, simulateTransaction as aI, throwIfSimulationFailed as aJ, formatAssetAmount as aa, formatSui as ab, formatUsd as ac, getDecimals as ad, getDecimalsForCoinType as ae, getTier as af, isSupported as ag, isTier1 as ah, isTier2 as ai, mapMoveAbortCode as aj, mapWalletError as ak, mistToSui as al, parseSuiRpcTx as am, rawToStable as an, rawToUsdc as ao, refineLendingLabel as ap, resolveSymbol as aq, resolveTokenType as ar, stableToRaw as as, suiToMist as at, truncateAddress as au, usdcToRaw as av, validateAddress as aw, CETUS_USDC_SUI_POOL as ax, OPERATION_ASSETS as ay, type Operation 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 };
|
|
@@ -379,6 +379,30 @@ interface PaymentRequest {
|
|
|
379
379
|
/** Human-readable summary */
|
|
380
380
|
displayText: string;
|
|
381
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* One non-zero user balance change for a transaction. Sui collapses
|
|
384
|
+
* balance changes by coin type, so a 3-step bundle that touches USDC
|
|
385
|
+
* three times surfaces as ONE leg of net USDC delta — not three.
|
|
386
|
+
*
|
|
387
|
+
* [Activity rebuild / 2026-05-10] Added so consumers can render swap
|
|
388
|
+
* + bundle txs accurately instead of picking a single "primary leg"
|
|
389
|
+
* (which made `Swapped 987.60 MANIFEST` look like +$987 of value when
|
|
390
|
+
* the user actually paid 1 USDC for it).
|
|
391
|
+
*/
|
|
392
|
+
interface TransactionLeg {
|
|
393
|
+
/** Full Sui coin type string (e.g. `0x...usdc::USDC`). */
|
|
394
|
+
coinType: string;
|
|
395
|
+
/** Display symbol (USDC, SUI, GOLD, MANIFEST, …) from the token registry. */
|
|
396
|
+
asset: string;
|
|
397
|
+
/** On-chain decimals for this coin (used to format `amount`). */
|
|
398
|
+
decimals: number;
|
|
399
|
+
/** Token quantity as a positive number (e.g. 987.60). */
|
|
400
|
+
amount: number;
|
|
401
|
+
/** Signed raw bigint as a string (preserves sign + precision). */
|
|
402
|
+
rawAmount: string;
|
|
403
|
+
/** `'out'` if the user spent this coin, `'in'` if they received it. */
|
|
404
|
+
direction: 'in' | 'out';
|
|
405
|
+
}
|
|
382
406
|
interface TransactionRecord {
|
|
383
407
|
digest: string;
|
|
384
408
|
/** Coarse bucket — `'send' | 'lending' | 'swap' | 'transaction'`. STABLE. */
|
|
@@ -390,7 +414,23 @@ interface TransactionRecord {
|
|
|
390
414
|
* when missing. Never used by ACI filters.
|
|
391
415
|
*/
|
|
392
416
|
label?: string;
|
|
417
|
+
/**
|
|
418
|
+
* All non-zero user balance legs for this transaction. Single-write
|
|
419
|
+
* txs have `legs.length === 1`; swaps have `2` (one `out`, one
|
|
420
|
+
* `in`); bundles have `> 2`. Order is RPC order — not sorted by
|
|
421
|
+
* size or USD value (audric's activity route prices + sorts).
|
|
422
|
+
*
|
|
423
|
+
* @since SDK v1.27.2 — was missing from earlier shapes; older
|
|
424
|
+
* consumers can keep using `amount` / `asset` / `direction` (which
|
|
425
|
+
* still resolve to the largest absolute leg).
|
|
426
|
+
*/
|
|
427
|
+
legs: TransactionLeg[];
|
|
428
|
+
/**
|
|
429
|
+
* Largest-absolute-leg amount, kept for back-compat with consumers
|
|
430
|
+
* that pre-date `legs[]`. New code should iterate `legs` instead.
|
|
431
|
+
*/
|
|
393
432
|
amount?: number;
|
|
433
|
+
/** @see {@link amount} — back-compat alias for `legs[primary].asset`. */
|
|
394
434
|
asset?: string;
|
|
395
435
|
recipient?: string;
|
|
396
436
|
/**
|
|
@@ -400,6 +440,8 @@ interface TransactionRecord {
|
|
|
400
440
|
* card can render the correct sign even for opaque actions like
|
|
401
441
|
* `swap`/`router`. Undefined when no user balance change is
|
|
402
442
|
* detectable (e.g. pure read-only or admin txs).
|
|
443
|
+
*
|
|
444
|
+
* @see {@link amount} — back-compat alias for `legs[primary].direction`.
|
|
403
445
|
*/
|
|
404
446
|
direction?: 'in' | 'out';
|
|
405
447
|
timestamp: number;
|
|
@@ -506,4 +548,4 @@ interface FinancialSummary {
|
|
|
506
548
|
fetchedAt: number;
|
|
507
549
|
}
|
|
508
550
|
|
|
509
|
-
export { type AssetRates as A, type BalanceResponse as B, type ClaimRewardsResult as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasReserve as G, type HealthFactorResult as H,
|
|
551
|
+
export { type AssetRates as A, type BalanceResponse as B, type ClaimRewardsResult as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasReserve as G, type HealthFactorResult as H, isCetusRouteFresh as I, serializeCetusRoute as J, verifyCetusRouteCoinMatch as K, type MaxBorrowResult as M, OVERLAY_FEE_RATE as O, type PayOptions as P, type RatesResult as R, type SaveResult as S, type TransactionLeg as T, type UnstakeVSuiResult as U, type WithdrawResult as W, type BorrowResult as a, type MaxWithdrawResult as b, type OverlayFeeConfig as c, type PayResult as d, type PendingReward as e, type PositionEntry as f, type PositionsResult as g, type RepayResult as h, type SendResult as i, type SwapRouteResult as j, type TransactionRecord as k, buildSwapTx as l, findSwapRoute as m, type T2000Options as n, type StakeVSuiResult as o, type SwapResult as p, type SwapQuoteResult as q, type PaymentRequest as r, type CompoundRewardsResult as s, type FinancialSummary as t, type HFAlertLevel as u, type SerializedCetusRoute as v, type SerializedCetusRoutePath as w, type SerializedRouterDataV3 as x, addSwapToTx as y, deserializeCetusRoute as z };
|
|
@@ -379,6 +379,30 @@ interface PaymentRequest {
|
|
|
379
379
|
/** Human-readable summary */
|
|
380
380
|
displayText: string;
|
|
381
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* One non-zero user balance change for a transaction. Sui collapses
|
|
384
|
+
* balance changes by coin type, so a 3-step bundle that touches USDC
|
|
385
|
+
* three times surfaces as ONE leg of net USDC delta — not three.
|
|
386
|
+
*
|
|
387
|
+
* [Activity rebuild / 2026-05-10] Added so consumers can render swap
|
|
388
|
+
* + bundle txs accurately instead of picking a single "primary leg"
|
|
389
|
+
* (which made `Swapped 987.60 MANIFEST` look like +$987 of value when
|
|
390
|
+
* the user actually paid 1 USDC for it).
|
|
391
|
+
*/
|
|
392
|
+
interface TransactionLeg {
|
|
393
|
+
/** Full Sui coin type string (e.g. `0x...usdc::USDC`). */
|
|
394
|
+
coinType: string;
|
|
395
|
+
/** Display symbol (USDC, SUI, GOLD, MANIFEST, …) from the token registry. */
|
|
396
|
+
asset: string;
|
|
397
|
+
/** On-chain decimals for this coin (used to format `amount`). */
|
|
398
|
+
decimals: number;
|
|
399
|
+
/** Token quantity as a positive number (e.g. 987.60). */
|
|
400
|
+
amount: number;
|
|
401
|
+
/** Signed raw bigint as a string (preserves sign + precision). */
|
|
402
|
+
rawAmount: string;
|
|
403
|
+
/** `'out'` if the user spent this coin, `'in'` if they received it. */
|
|
404
|
+
direction: 'in' | 'out';
|
|
405
|
+
}
|
|
382
406
|
interface TransactionRecord {
|
|
383
407
|
digest: string;
|
|
384
408
|
/** Coarse bucket — `'send' | 'lending' | 'swap' | 'transaction'`. STABLE. */
|
|
@@ -390,7 +414,23 @@ interface TransactionRecord {
|
|
|
390
414
|
* when missing. Never used by ACI filters.
|
|
391
415
|
*/
|
|
392
416
|
label?: string;
|
|
417
|
+
/**
|
|
418
|
+
* All non-zero user balance legs for this transaction. Single-write
|
|
419
|
+
* txs have `legs.length === 1`; swaps have `2` (one `out`, one
|
|
420
|
+
* `in`); bundles have `> 2`. Order is RPC order — not sorted by
|
|
421
|
+
* size or USD value (audric's activity route prices + sorts).
|
|
422
|
+
*
|
|
423
|
+
* @since SDK v1.27.2 — was missing from earlier shapes; older
|
|
424
|
+
* consumers can keep using `amount` / `asset` / `direction` (which
|
|
425
|
+
* still resolve to the largest absolute leg).
|
|
426
|
+
*/
|
|
427
|
+
legs: TransactionLeg[];
|
|
428
|
+
/**
|
|
429
|
+
* Largest-absolute-leg amount, kept for back-compat with consumers
|
|
430
|
+
* that pre-date `legs[]`. New code should iterate `legs` instead.
|
|
431
|
+
*/
|
|
393
432
|
amount?: number;
|
|
433
|
+
/** @see {@link amount} — back-compat alias for `legs[primary].asset`. */
|
|
394
434
|
asset?: string;
|
|
395
435
|
recipient?: string;
|
|
396
436
|
/**
|
|
@@ -400,6 +440,8 @@ interface TransactionRecord {
|
|
|
400
440
|
* card can render the correct sign even for opaque actions like
|
|
401
441
|
* `swap`/`router`. Undefined when no user balance change is
|
|
402
442
|
* detectable (e.g. pure read-only or admin txs).
|
|
443
|
+
*
|
|
444
|
+
* @see {@link amount} — back-compat alias for `legs[primary].direction`.
|
|
403
445
|
*/
|
|
404
446
|
direction?: 'in' | 'out';
|
|
405
447
|
timestamp: number;
|
|
@@ -506,4 +548,4 @@ interface FinancialSummary {
|
|
|
506
548
|
fetchedAt: number;
|
|
507
549
|
}
|
|
508
550
|
|
|
509
|
-
export { type AssetRates as A, type BalanceResponse as B, type ClaimRewardsResult as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasReserve as G, type HealthFactorResult as H,
|
|
551
|
+
export { type AssetRates as A, type BalanceResponse as B, type ClaimRewardsResult as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasReserve as G, type HealthFactorResult as H, isCetusRouteFresh as I, serializeCetusRoute as J, verifyCetusRouteCoinMatch as K, type MaxBorrowResult as M, OVERLAY_FEE_RATE as O, type PayOptions as P, type RatesResult as R, type SaveResult as S, type TransactionLeg as T, type UnstakeVSuiResult as U, type WithdrawResult as W, type BorrowResult as a, type MaxWithdrawResult as b, type OverlayFeeConfig as c, type PayResult as d, type PendingReward as e, type PositionEntry as f, type PositionsResult as g, type RepayResult as h, type SendResult as i, type SwapRouteResult as j, type TransactionRecord as k, buildSwapTx as l, findSwapRoute as m, type T2000Options as n, type StakeVSuiResult as o, type SwapResult as p, type SwapQuoteResult as q, type PaymentRequest as r, type CompoundRewardsResult as s, type FinancialSummary as t, type HFAlertLevel as u, type SerializedCetusRoute as v, type SerializedCetusRoutePath as w, type SerializedRouterDataV3 as x, addSwapToTx as y, deserializeCetusRoute as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "TypeScript SDK for AI agent bank accounts on Sui — send, save, borrow, swap. NAVI lending + Cetus aggregator routing, sponsored gas, zkLogin compatible.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|