@t2000/sdk 1.1.0 → 1.1.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/README.md +1 -1
- package/dist/adapters/index.cjs +0 -2
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js +0 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs +0 -2
- 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 +0 -2
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/{types-CWnyOY9f.d.ts → types-BhiUiiNs.d.ts} +23 -15
- package/dist/{types-Bx0uh6g9.d.cts → types-CMVkJNFp.d.cts} +23 -15
- package/package.json +2 -1
|
@@ -386,21 +386,14 @@ declare function throwIfSimulationFailed(sim: SimulationResult): void;
|
|
|
386
386
|
/**
|
|
387
387
|
* Protocol fee primitives — wallet-direct transfer model.
|
|
388
388
|
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* writes a `ProtocolFeeLedger` row tagged with the operation classified from the
|
|
395
|
-
* tx's moveCall targets.
|
|
389
|
+
* Fees are collected by splitting from the payment coin and transferring directly
|
|
390
|
+
* to the treasury wallet inside the same PTB. Atomic with the operation (PTB
|
|
391
|
+
* semantics); the wallet IS the ledger; the server-side indexer reads
|
|
392
|
+
* `balanceChanges` and writes a `ProtocolFeeLedger` row tagged with the operation
|
|
393
|
+
* classified from the tx's moveCall targets.
|
|
396
394
|
*
|
|
397
395
|
* The SDK / CLI never call this helper — they're fee-free by design (t2000 = infra
|
|
398
396
|
* brand, no opinion on fees). Audric's `prepare/route.ts` is the canonical caller.
|
|
399
|
-
*
|
|
400
|
-
* Pre-1.1.0 callers: `addCollectFeeToTx` and `reportFee` were removed in this
|
|
401
|
-
* release. Migration: replace `addCollectFeeToTx(tx, coin, op)` with
|
|
402
|
-
* `addFeeTransfer(tx, coin, FEE_BPS_FOR_OP, T2000_OVERLAY_FEE_WALLET)` BEFORE the
|
|
403
|
-
* NAVI deposit step (order matters — the deposit consumes the coin).
|
|
404
397
|
*/
|
|
405
398
|
|
|
406
399
|
type FeeOperation = 'save' | 'borrow' | 'swap';
|
|
@@ -424,8 +417,7 @@ declare function calculateFee(operation: FeeOperation, amount: number): Protocol
|
|
|
424
417
|
* the deposit will have consumed the coin and the split will fail.
|
|
425
418
|
*
|
|
426
419
|
* Atomicity: `splitCoins` + `transferObjects` are PTB ops; if anything later in
|
|
427
|
-
* the PTB reverts, the fee transfer reverts too.
|
|
428
|
-
* deprecated `t2000::treasury::collect_fee` Move call.
|
|
420
|
+
* the PTB reverts, the fee transfer reverts too.
|
|
429
421
|
*
|
|
430
422
|
* @param tx Active PTB
|
|
431
423
|
* @param paymentCoin Coin to split the fee from (mutated in place)
|
|
@@ -459,6 +451,22 @@ interface CoinMeta {
|
|
|
459
451
|
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
460
452
|
*/
|
|
461
453
|
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
454
|
+
/**
|
|
455
|
+
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
456
|
+
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
457
|
+
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
458
|
+
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
459
|
+
* tier and still need canonical-symbol resolution.
|
|
460
|
+
*/
|
|
461
|
+
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
462
|
+
/**
|
|
463
|
+
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
464
|
+
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
465
|
+
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
466
|
+
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
467
|
+
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
468
|
+
*/
|
|
469
|
+
declare function isInRegistry(coinType: string): boolean;
|
|
462
470
|
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
463
471
|
declare function isTier1(coinType: string): boolean;
|
|
464
472
|
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
@@ -610,4 +618,4 @@ interface TxMetadata {
|
|
|
610
618
|
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
611
619
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
612
620
|
|
|
613
|
-
export { WAL_TYPE 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 T2000ErrorData as H, IKA_TYPE as I, T2000_OVERLAY_FEE_WALLET 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, TOKEN_MAP as Q, type TransactionSigner as R, SAVE_FEE_BPS as S, T2000Error as T, type TxDirection as U, type TxMetadata as V, USDC_DECIMALS as W, USDC_TYPE as X, USDE_TYPE as Y, USDSUI_TYPE as Z, USDT_TYPE as _, BPS_DENOMINATOR as a, WBTC_TYPE as a0, type ZkLoginProof as a1, ZkLoginSigner as a2, addFeeTransfer as a3, buildSwapTx as a4, calculateFee as a5, classifyAction as a6, classifyLabel as a7, classifyTransaction as a8, extractTransferDetails as a9, validateAddress as aA, CETUS_USDC_SUI_POOL as aB, OPERATION_ASSETS as aC, type Operation as aD, assertAllowedAsset as aE,
|
|
621
|
+
export { WAL_TYPE 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 T2000ErrorData as H, IKA_TYPE as I, T2000_OVERLAY_FEE_WALLET 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, TOKEN_MAP as Q, type TransactionSigner as R, SAVE_FEE_BPS as S, T2000Error as T, type TxDirection as U, type TxMetadata as V, USDC_DECIMALS as W, USDC_TYPE as X, USDE_TYPE as Y, USDSUI_TYPE as Z, USDT_TYPE as _, BPS_DENOMINATOR as a, WBTC_TYPE as a0, type ZkLoginProof as a1, ZkLoginSigner as a2, addFeeTransfer as a3, buildSwapTx as a4, calculateFee as a5, classifyAction as a6, classifyLabel as a7, classifyTransaction as a8, extractTransferDetails as a9, validateAddress as aA, CETUS_USDC_SUI_POOL as aB, OPERATION_ASSETS as aC, type Operation as aD, assertAllowedAsset as aE, getCoinMeta as aF, isAllowedAsset as aG, isInRegistry as aH, normalizeCoinType as aI, queryHistory as aJ, queryTransaction as aK, simulateTransaction as aL, throwIfSimulationFailed as aM, extractTxCommands as aa, extractTxSender as ab, fallbackLabel as ac, findSwapRoute as ad, formatAssetAmount as ae, formatSui as af, formatUsd as ag, getDecimals as ah, getDecimalsForCoinType as ai, getTier as aj, isSupported as ak, isTier1 as al, isTier2 as am, mapMoveAbortCode as an, mapWalletError as ao, mistToSui as ap, parseSuiRpcTx as aq, rawToStable as ar, rawToUsdc as as, refineLendingLabel as at, resolveSymbol as au, resolveTokenType as av, stableToRaw as aw, suiToMist as ax, truncateAddress as ay, usdcToRaw 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, OVERLAY_FEE_RATE as k, type OverlayFeeConfig as l, STABLE_ASSETS as m, SUI_DECIMALS as n, SUI_TYPE as o, SUPPORTED_ASSETS as p, type SafeguardConfig as q, SafeguardError as r, type SafeguardErrorDetails as s, type SafeguardRule as t, type SimulationResult as u, type StableAsset as v, type SuiRpcTxBlock as w, type SupportedAsset as x, type SwapRouteResult as y, type T2000ErrorCode as z };
|
|
@@ -386,21 +386,14 @@ declare function throwIfSimulationFailed(sim: SimulationResult): void;
|
|
|
386
386
|
/**
|
|
387
387
|
* Protocol fee primitives — wallet-direct transfer model.
|
|
388
388
|
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* writes a `ProtocolFeeLedger` row tagged with the operation classified from the
|
|
395
|
-
* tx's moveCall targets.
|
|
389
|
+
* Fees are collected by splitting from the payment coin and transferring directly
|
|
390
|
+
* to the treasury wallet inside the same PTB. Atomic with the operation (PTB
|
|
391
|
+
* semantics); the wallet IS the ledger; the server-side indexer reads
|
|
392
|
+
* `balanceChanges` and writes a `ProtocolFeeLedger` row tagged with the operation
|
|
393
|
+
* classified from the tx's moveCall targets.
|
|
396
394
|
*
|
|
397
395
|
* The SDK / CLI never call this helper — they're fee-free by design (t2000 = infra
|
|
398
396
|
* brand, no opinion on fees). Audric's `prepare/route.ts` is the canonical caller.
|
|
399
|
-
*
|
|
400
|
-
* Pre-1.1.0 callers: `addCollectFeeToTx` and `reportFee` were removed in this
|
|
401
|
-
* release. Migration: replace `addCollectFeeToTx(tx, coin, op)` with
|
|
402
|
-
* `addFeeTransfer(tx, coin, FEE_BPS_FOR_OP, T2000_OVERLAY_FEE_WALLET)` BEFORE the
|
|
403
|
-
* NAVI deposit step (order matters — the deposit consumes the coin).
|
|
404
397
|
*/
|
|
405
398
|
|
|
406
399
|
type FeeOperation = 'save' | 'borrow' | 'swap';
|
|
@@ -424,8 +417,7 @@ declare function calculateFee(operation: FeeOperation, amount: number): Protocol
|
|
|
424
417
|
* the deposit will have consumed the coin and the split will fail.
|
|
425
418
|
*
|
|
426
419
|
* Atomicity: `splitCoins` + `transferObjects` are PTB ops; if anything later in
|
|
427
|
-
* the PTB reverts, the fee transfer reverts too.
|
|
428
|
-
* deprecated `t2000::treasury::collect_fee` Move call.
|
|
420
|
+
* the PTB reverts, the fee transfer reverts too.
|
|
429
421
|
*
|
|
430
422
|
* @param tx Active PTB
|
|
431
423
|
* @param paymentCoin Coin to split the fee from (mutated in place)
|
|
@@ -459,6 +451,22 @@ interface CoinMeta {
|
|
|
459
451
|
* Key = user-friendly name (used in swap_execute, CLI, prompts).
|
|
460
452
|
*/
|
|
461
453
|
declare const COIN_REGISTRY: Record<string, CoinMeta>;
|
|
454
|
+
/**
|
|
455
|
+
* Returns the registry metadata for a coin type, or `undefined` if the coin
|
|
456
|
+
* is not in the registry. Use this when you need to distinguish "known coin"
|
|
457
|
+
* from "supported coin" — `isSupported` only flags tiered (active) coins,
|
|
458
|
+
* but legacy coins like USDsui / USDe / USDT are in the registry without a
|
|
459
|
+
* tier and still need canonical-symbol resolution.
|
|
460
|
+
*/
|
|
461
|
+
declare function getCoinMeta(coinType: string): CoinMeta | undefined;
|
|
462
|
+
/**
|
|
463
|
+
* Returns true if the coin type appears anywhere in COIN_REGISTRY (tier 1, 2,
|
|
464
|
+
* OR legacy/no-tier). Different from `isSupported`, which excludes legacy
|
|
465
|
+
* entries. The blockvision-prices canonical-symbol gate uses this looser
|
|
466
|
+
* check so that USDsui (legacy/no-tier today, but with a registry-canonical
|
|
467
|
+
* mixed-case symbol) still wins over BlockVision's uppercase 'USDSUI'.
|
|
468
|
+
*/
|
|
469
|
+
declare function isInRegistry(coinType: string): boolean;
|
|
462
470
|
/** Returns true if the coin type is Tier 1 (USDC — the financial layer). */
|
|
463
471
|
declare function isTier1(coinType: string): boolean;
|
|
464
472
|
/** Returns true if the coin type is Tier 2 (curated swap asset). */
|
|
@@ -610,4 +618,4 @@ interface TxMetadata {
|
|
|
610
618
|
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
611
619
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
612
620
|
|
|
613
|
-
export { WAL_TYPE 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 T2000ErrorData as H, IKA_TYPE as I, T2000_OVERLAY_FEE_WALLET 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, TOKEN_MAP as Q, type TransactionSigner as R, SAVE_FEE_BPS as S, T2000Error as T, type TxDirection as U, type TxMetadata as V, USDC_DECIMALS as W, USDC_TYPE as X, USDE_TYPE as Y, USDSUI_TYPE as Z, USDT_TYPE as _, BPS_DENOMINATOR as a, WBTC_TYPE as a0, type ZkLoginProof as a1, ZkLoginSigner as a2, addFeeTransfer as a3, buildSwapTx as a4, calculateFee as a5, classifyAction as a6, classifyLabel as a7, classifyTransaction as a8, extractTransferDetails as a9, validateAddress as aA, CETUS_USDC_SUI_POOL as aB, OPERATION_ASSETS as aC, type Operation as aD, assertAllowedAsset as aE,
|
|
621
|
+
export { WAL_TYPE 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 T2000ErrorData as H, IKA_TYPE as I, T2000_OVERLAY_FEE_WALLET 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, TOKEN_MAP as Q, type TransactionSigner as R, SAVE_FEE_BPS as S, T2000Error as T, type TxDirection as U, type TxMetadata as V, USDC_DECIMALS as W, USDC_TYPE as X, USDE_TYPE as Y, USDSUI_TYPE as Z, USDT_TYPE as _, BPS_DENOMINATOR as a, WBTC_TYPE as a0, type ZkLoginProof as a1, ZkLoginSigner as a2, addFeeTransfer as a3, buildSwapTx as a4, calculateFee as a5, classifyAction as a6, classifyLabel as a7, classifyTransaction as a8, extractTransferDetails as a9, validateAddress as aA, CETUS_USDC_SUI_POOL as aB, OPERATION_ASSETS as aC, type Operation as aD, assertAllowedAsset as aE, getCoinMeta as aF, isAllowedAsset as aG, isInRegistry as aH, normalizeCoinType as aI, queryHistory as aJ, queryTransaction as aK, simulateTransaction as aL, throwIfSimulationFailed as aM, extractTxCommands as aa, extractTxSender as ab, fallbackLabel as ac, findSwapRoute as ad, formatAssetAmount as ae, formatSui as af, formatUsd as ag, getDecimals as ah, getDecimalsForCoinType as ai, getTier as aj, isSupported as ak, isTier1 as al, isTier2 as am, mapMoveAbortCode as an, mapWalletError as ao, mistToSui as ap, parseSuiRpcTx as aq, rawToStable as ar, rawToUsdc as as, refineLendingLabel as at, resolveSymbol as au, resolveTokenType as av, stableToRaw as aw, suiToMist as ax, truncateAddress as ay, usdcToRaw 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, OVERLAY_FEE_RATE as k, type OverlayFeeConfig as l, STABLE_ASSETS as m, SUI_DECIMALS as n, SUI_TYPE as o, SUPPORTED_ASSETS as p, type SafeguardConfig as q, SafeguardError as r, type SafeguardErrorDetails as s, type SafeguardRule as t, type SimulationResult as u, type StableAsset as v, type SuiRpcTxBlock as w, type SupportedAsset as x, type SwapRouteResult as y, type T2000ErrorCode as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
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",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"eslint": "^9",
|
|
65
65
|
"tsup": "^8",
|
|
66
66
|
"typescript": "^5",
|
|
67
|
+
"typescript-eslint": "^8.58.0",
|
|
67
68
|
"vitest": "^3"
|
|
68
69
|
},
|
|
69
70
|
"license": "MIT",
|