@t2000/sdk 0.56.2 → 1.0.1
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 +8 -25
- package/dist/adapters/descriptors.d.cts +1 -1
- package/dist/adapters/descriptors.d.ts +1 -1
- package/dist/adapters/index.cjs +22 -17
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +12 -9
- package/dist/adapters/index.d.ts +12 -9
- package/dist/adapters/index.js +22 -17
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs +14 -335
- 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 +15 -332
- package/dist/browser.js.map +1 -1
- package/dist/{descriptors-DkKhitk_.d.cts → descriptors-CDVXo3BM.d.cts} +9 -6
- package/dist/{descriptors-DkKhitk_.d.ts → descriptors-CDVXo3BM.d.ts} +9 -6
- package/dist/index.cjs +69 -436
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -20
- package/dist/index.d.ts +24 -20
- package/dist/index.js +71 -433
- package/dist/index.js.map +1 -1
- package/dist/{token-registry-BortlMRr.d.ts → token-registry-CoTPqCbS.d.ts} +19 -84
- package/dist/{token-registry-DWRdYf6m.d.cts → token-registry-DAHghHh2.d.cts} +19 -84
- package/dist/{types-DVVns7_w.d.cts → types-jAD-e7Pq.d.cts} +1 -14
- package/dist/{types-DVVns7_w.d.ts → types-jAD-e7Pq.d.ts} +1 -14
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
+
import { T as TransactionRecord } from './types-jAD-e7Pq.js';
|
|
3
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
4
|
-
import { G as GasMethod, T as TransactionRecord } from './types-DVVns7_w.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Abstract signing interface that decouples the SDK from any specific
|
|
@@ -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' | '
|
|
54
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | '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' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'UNKNOWN';
|
|
55
55
|
interface T2000ErrorData {
|
|
56
56
|
reason?: string;
|
|
57
57
|
[key: string]: unknown;
|
|
@@ -71,87 +71,6 @@ declare class T2000Error extends Error {
|
|
|
71
71
|
declare function mapWalletError(error: unknown): T2000Error;
|
|
72
72
|
declare function mapMoveAbortCode(code: number): string;
|
|
73
73
|
|
|
74
|
-
interface SafeguardConfig {
|
|
75
|
-
locked: boolean;
|
|
76
|
-
maxPerTx: number;
|
|
77
|
-
maxDailySend: number;
|
|
78
|
-
dailyUsed: number;
|
|
79
|
-
dailyResetDate: string;
|
|
80
|
-
maxLeverage?: number;
|
|
81
|
-
maxPositionSize?: number;
|
|
82
|
-
}
|
|
83
|
-
interface TxMetadata {
|
|
84
|
-
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'pay';
|
|
85
|
-
amount?: number;
|
|
86
|
-
}
|
|
87
|
-
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
88
|
-
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
89
|
-
|
|
90
|
-
declare class SafeguardEnforcer {
|
|
91
|
-
private config;
|
|
92
|
-
private readonly configPath;
|
|
93
|
-
constructor(configDir?: string);
|
|
94
|
-
load(): void;
|
|
95
|
-
assertNotLocked(): void;
|
|
96
|
-
check(metadata: TxMetadata): void;
|
|
97
|
-
recordUsage(amount: number): void;
|
|
98
|
-
lock(): void;
|
|
99
|
-
unlock(): void;
|
|
100
|
-
set(key: string, value: unknown): void;
|
|
101
|
-
getConfig(): SafeguardConfig;
|
|
102
|
-
isConfigured(): boolean;
|
|
103
|
-
private resetDailyIfNewDay;
|
|
104
|
-
private save;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface GasExecutionResult {
|
|
108
|
-
digest: string;
|
|
109
|
-
effects: unknown;
|
|
110
|
-
balanceChanges?: unknown[];
|
|
111
|
-
gasMethod: GasMethod;
|
|
112
|
-
gasCostSui: number;
|
|
113
|
-
/** Pre-TX SUI balance in MIST — used internally for proactive gas maintenance. */
|
|
114
|
-
preTxSuiMist?: bigint;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Gas resolution chain:
|
|
118
|
-
* 1. Self-funded (agent has enough SUI)
|
|
119
|
-
* 2. Auto-topup (swap USDC→SUI, then self-fund)
|
|
120
|
-
* 3. Gas Station sponsored (fallback)
|
|
121
|
-
* 4. Fail with INSUFFICIENT_GAS
|
|
122
|
-
*
|
|
123
|
-
* After every successful transaction, proactively tops up SUI if it
|
|
124
|
-
* dropped below threshold — so the user never hits a "no gas" wall.
|
|
125
|
-
*/
|
|
126
|
-
declare function executeWithGas(client: SuiJsonRpcClient, signer: TransactionSigner, buildTx: () => Transaction | Promise<Transaction>, options?: {
|
|
127
|
-
metadata?: TxMetadata;
|
|
128
|
-
enforcer?: SafeguardEnforcer;
|
|
129
|
-
}): Promise<GasExecutionResult>;
|
|
130
|
-
|
|
131
|
-
interface AutoTopUpResult {
|
|
132
|
-
success: boolean;
|
|
133
|
-
tx: string;
|
|
134
|
-
usdcSpent: number;
|
|
135
|
-
suiReceived: number;
|
|
136
|
-
}
|
|
137
|
-
declare function shouldAutoTopUp(client: SuiJsonRpcClient, address: string): Promise<boolean>;
|
|
138
|
-
declare function executeAutoTopUp(_client: SuiJsonRpcClient, _signer: TransactionSigner): Promise<AutoTopUpResult>;
|
|
139
|
-
|
|
140
|
-
type GasRequestType = 'bootstrap' | 'auto-topup' | 'fallback';
|
|
141
|
-
interface GasSponsorResponse {
|
|
142
|
-
txBytes: string;
|
|
143
|
-
sponsorSignature: string;
|
|
144
|
-
gasEstimateUsd: number;
|
|
145
|
-
type: GasRequestType;
|
|
146
|
-
}
|
|
147
|
-
interface GasStatusResponse {
|
|
148
|
-
circuitBreaker: boolean;
|
|
149
|
-
suiPrice: number;
|
|
150
|
-
bootstrapUsed?: number;
|
|
151
|
-
bootstrapRemaining?: number;
|
|
152
|
-
}
|
|
153
|
-
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
154
|
-
|
|
155
74
|
declare const MIST_PER_SUI = 1000000000n;
|
|
156
75
|
declare const SUI_DECIMALS = 9;
|
|
157
76
|
declare const USDC_DECIMALS = 6;
|
|
@@ -500,6 +419,22 @@ declare class SafeguardError extends T2000Error {
|
|
|
500
419
|
};
|
|
501
420
|
}
|
|
502
421
|
|
|
422
|
+
interface SafeguardConfig {
|
|
423
|
+
locked: boolean;
|
|
424
|
+
maxPerTx: number;
|
|
425
|
+
maxDailySend: number;
|
|
426
|
+
dailyUsed: number;
|
|
427
|
+
dailyResetDate: string;
|
|
428
|
+
maxLeverage?: number;
|
|
429
|
+
maxPositionSize?: number;
|
|
430
|
+
}
|
|
431
|
+
interface TxMetadata {
|
|
432
|
+
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'pay';
|
|
433
|
+
amount?: number;
|
|
434
|
+
}
|
|
435
|
+
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
436
|
+
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
437
|
+
|
|
503
438
|
/**
|
|
504
439
|
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
505
440
|
*
|
|
@@ -566,4 +501,4 @@ declare const IKA_TYPE: string;
|
|
|
566
501
|
declare const LOFI_TYPE: string;
|
|
567
502
|
declare const MANIFEST_TYPE: string;
|
|
568
503
|
|
|
569
|
-
export {
|
|
504
|
+
export { classifyAction 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, USDC_TYPE as H, IKA_TYPE as I, USDE_TYPE 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, USDSUI_TYPE as Q, USDT_TYPE as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, WBTC_TYPE as V, WAL_TYPE as W, ZkLoginSigner as X, addCollectFeeToTx as Y, type ZkLoginProof as Z, calculateFee as _, COIN_REGISTRY as a, classifyLabel as a0, classifyTransaction as a1, extractTransferDetails as a2, extractTxCommands as a3, extractTxSender as a4, fallbackLabel as a5, formatAssetAmount as a6, formatSui as a7, formatUsd as a8, getDecimals as a9, normalizeCoinType as aA, queryHistory as aB, queryTransaction as aC, simulateTransaction as aD, throwIfSimulationFailed as aE, getDecimalsForCoinType as aa, getTier as ab, isSupported as ac, isTier1 as ad, isTier2 as ae, mapMoveAbortCode as af, mapWalletError as ag, mistToSui as ah, parseSuiRpcTx as ai, rawToStable as aj, rawToUsdc as ak, refineLendingLabel as al, resolveSymbol as am, resolveTokenType as an, stableToRaw as ao, suiToMist as ap, truncateAddress as aq, usdcToRaw as ar, validateAddress as as, BORROW_FEE_BPS as at, CETUS_USDC_SUI_POOL as au, OPERATION_ASSETS as av, type Operation as aw, SAVE_FEE_BPS as ax, assertAllowedAsset as ay, isAllowedAsset as az, type ClassifyBalanceChange as b, type ClassifyResult as c, type CoinMeta as d, DEFAULT_SAFEGUARD_CONFIG as e, type ExtractedTransfer as f, KeypairSigner as g, LOFI_TYPE 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 SuiRpcTxBlock as s, type SupportedAsset as t, type T2000ErrorCode as u, type T2000ErrorData as v, TOKEN_MAP as w, type TransactionSigner as x, type TxDirection as y, type TxMetadata as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
+
import { T as TransactionRecord } from './types-jAD-e7Pq.cjs';
|
|
3
4
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
4
|
-
import { G as GasMethod, T as TransactionRecord } from './types-DVVns7_w.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Abstract signing interface that decouples the SDK from any specific
|
|
@@ -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' | '
|
|
54
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | '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' | 'FACILITATOR_TIMEOUT' | 'SAFEGUARD_BLOCKED' | 'SWAP_NO_ROUTE' | 'SWAP_FAILED' | 'UNKNOWN';
|
|
55
55
|
interface T2000ErrorData {
|
|
56
56
|
reason?: string;
|
|
57
57
|
[key: string]: unknown;
|
|
@@ -71,87 +71,6 @@ declare class T2000Error extends Error {
|
|
|
71
71
|
declare function mapWalletError(error: unknown): T2000Error;
|
|
72
72
|
declare function mapMoveAbortCode(code: number): string;
|
|
73
73
|
|
|
74
|
-
interface SafeguardConfig {
|
|
75
|
-
locked: boolean;
|
|
76
|
-
maxPerTx: number;
|
|
77
|
-
maxDailySend: number;
|
|
78
|
-
dailyUsed: number;
|
|
79
|
-
dailyResetDate: string;
|
|
80
|
-
maxLeverage?: number;
|
|
81
|
-
maxPositionSize?: number;
|
|
82
|
-
}
|
|
83
|
-
interface TxMetadata {
|
|
84
|
-
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'pay';
|
|
85
|
-
amount?: number;
|
|
86
|
-
}
|
|
87
|
-
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
88
|
-
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
89
|
-
|
|
90
|
-
declare class SafeguardEnforcer {
|
|
91
|
-
private config;
|
|
92
|
-
private readonly configPath;
|
|
93
|
-
constructor(configDir?: string);
|
|
94
|
-
load(): void;
|
|
95
|
-
assertNotLocked(): void;
|
|
96
|
-
check(metadata: TxMetadata): void;
|
|
97
|
-
recordUsage(amount: number): void;
|
|
98
|
-
lock(): void;
|
|
99
|
-
unlock(): void;
|
|
100
|
-
set(key: string, value: unknown): void;
|
|
101
|
-
getConfig(): SafeguardConfig;
|
|
102
|
-
isConfigured(): boolean;
|
|
103
|
-
private resetDailyIfNewDay;
|
|
104
|
-
private save;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface GasExecutionResult {
|
|
108
|
-
digest: string;
|
|
109
|
-
effects: unknown;
|
|
110
|
-
balanceChanges?: unknown[];
|
|
111
|
-
gasMethod: GasMethod;
|
|
112
|
-
gasCostSui: number;
|
|
113
|
-
/** Pre-TX SUI balance in MIST — used internally for proactive gas maintenance. */
|
|
114
|
-
preTxSuiMist?: bigint;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Gas resolution chain:
|
|
118
|
-
* 1. Self-funded (agent has enough SUI)
|
|
119
|
-
* 2. Auto-topup (swap USDC→SUI, then self-fund)
|
|
120
|
-
* 3. Gas Station sponsored (fallback)
|
|
121
|
-
* 4. Fail with INSUFFICIENT_GAS
|
|
122
|
-
*
|
|
123
|
-
* After every successful transaction, proactively tops up SUI if it
|
|
124
|
-
* dropped below threshold — so the user never hits a "no gas" wall.
|
|
125
|
-
*/
|
|
126
|
-
declare function executeWithGas(client: SuiJsonRpcClient, signer: TransactionSigner, buildTx: () => Transaction | Promise<Transaction>, options?: {
|
|
127
|
-
metadata?: TxMetadata;
|
|
128
|
-
enforcer?: SafeguardEnforcer;
|
|
129
|
-
}): Promise<GasExecutionResult>;
|
|
130
|
-
|
|
131
|
-
interface AutoTopUpResult {
|
|
132
|
-
success: boolean;
|
|
133
|
-
tx: string;
|
|
134
|
-
usdcSpent: number;
|
|
135
|
-
suiReceived: number;
|
|
136
|
-
}
|
|
137
|
-
declare function shouldAutoTopUp(client: SuiJsonRpcClient, address: string): Promise<boolean>;
|
|
138
|
-
declare function executeAutoTopUp(_client: SuiJsonRpcClient, _signer: TransactionSigner): Promise<AutoTopUpResult>;
|
|
139
|
-
|
|
140
|
-
type GasRequestType = 'bootstrap' | 'auto-topup' | 'fallback';
|
|
141
|
-
interface GasSponsorResponse {
|
|
142
|
-
txBytes: string;
|
|
143
|
-
sponsorSignature: string;
|
|
144
|
-
gasEstimateUsd: number;
|
|
145
|
-
type: GasRequestType;
|
|
146
|
-
}
|
|
147
|
-
interface GasStatusResponse {
|
|
148
|
-
circuitBreaker: boolean;
|
|
149
|
-
suiPrice: number;
|
|
150
|
-
bootstrapUsed?: number;
|
|
151
|
-
bootstrapRemaining?: number;
|
|
152
|
-
}
|
|
153
|
-
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
154
|
-
|
|
155
74
|
declare const MIST_PER_SUI = 1000000000n;
|
|
156
75
|
declare const SUI_DECIMALS = 9;
|
|
157
76
|
declare const USDC_DECIMALS = 6;
|
|
@@ -500,6 +419,22 @@ declare class SafeguardError extends T2000Error {
|
|
|
500
419
|
};
|
|
501
420
|
}
|
|
502
421
|
|
|
422
|
+
interface SafeguardConfig {
|
|
423
|
+
locked: boolean;
|
|
424
|
+
maxPerTx: number;
|
|
425
|
+
maxDailySend: number;
|
|
426
|
+
dailyUsed: number;
|
|
427
|
+
dailyResetDate: string;
|
|
428
|
+
maxLeverage?: number;
|
|
429
|
+
maxPositionSize?: number;
|
|
430
|
+
}
|
|
431
|
+
interface TxMetadata {
|
|
432
|
+
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'pay';
|
|
433
|
+
amount?: number;
|
|
434
|
+
}
|
|
435
|
+
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "send" | "pay">;
|
|
436
|
+
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
437
|
+
|
|
503
438
|
/**
|
|
504
439
|
* Unified token registry — single source of truth for coin types, decimals, symbols, and tiers.
|
|
505
440
|
*
|
|
@@ -566,4 +501,4 @@ declare const IKA_TYPE: string;
|
|
|
566
501
|
declare const LOFI_TYPE: string;
|
|
567
502
|
declare const MANIFEST_TYPE: string;
|
|
568
503
|
|
|
569
|
-
export {
|
|
504
|
+
export { classifyAction 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, USDC_TYPE as H, IKA_TYPE as I, USDE_TYPE 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, USDSUI_TYPE as Q, USDT_TYPE as R, STABLE_ASSETS as S, T2000Error as T, USDC_DECIMALS as U, WBTC_TYPE as V, WAL_TYPE as W, ZkLoginSigner as X, addCollectFeeToTx as Y, type ZkLoginProof as Z, calculateFee as _, COIN_REGISTRY as a, classifyLabel as a0, classifyTransaction as a1, extractTransferDetails as a2, extractTxCommands as a3, extractTxSender as a4, fallbackLabel as a5, formatAssetAmount as a6, formatSui as a7, formatUsd as a8, getDecimals as a9, normalizeCoinType as aA, queryHistory as aB, queryTransaction as aC, simulateTransaction as aD, throwIfSimulationFailed as aE, getDecimalsForCoinType as aa, getTier as ab, isSupported as ac, isTier1 as ad, isTier2 as ae, mapMoveAbortCode as af, mapWalletError as ag, mistToSui as ah, parseSuiRpcTx as ai, rawToStable as aj, rawToUsdc as ak, refineLendingLabel as al, resolveSymbol as am, resolveTokenType as an, stableToRaw as ao, suiToMist as ap, truncateAddress as aq, usdcToRaw as ar, validateAddress as as, BORROW_FEE_BPS as at, CETUS_USDC_SUI_POOL as au, OPERATION_ASSETS as av, type Operation as aw, SAVE_FEE_BPS as ax, assertAllowedAsset as ay, isAllowedAsset as az, type ClassifyBalanceChange as b, type ClassifyResult as c, type CoinMeta as d, DEFAULT_SAFEGUARD_CONFIG as e, type ExtractedTransfer as f, KeypairSigner as g, LOFI_TYPE 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 SuiRpcTxBlock as s, type SupportedAsset as t, type T2000ErrorCode as u, type T2000ErrorData as v, TOKEN_MAP as w, type TransactionSigner as x, type TxDirection as y, type TxMetadata as z };
|
|
@@ -6,8 +6,6 @@ interface T2000Options {
|
|
|
6
6
|
passphrase?: string;
|
|
7
7
|
network?: 'mainnet' | 'testnet';
|
|
8
8
|
rpcUrl?: string;
|
|
9
|
-
sponsored?: boolean;
|
|
10
|
-
name?: string;
|
|
11
9
|
}
|
|
12
10
|
interface GasReserve {
|
|
13
11
|
sui: number;
|
|
@@ -22,7 +20,6 @@ interface BalanceResponse {
|
|
|
22
20
|
total: number;
|
|
23
21
|
stables: Record<string, number>;
|
|
24
22
|
}
|
|
25
|
-
type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup' | 'none';
|
|
26
23
|
interface SendResult {
|
|
27
24
|
success: boolean;
|
|
28
25
|
tx: string;
|
|
@@ -31,7 +28,6 @@ interface SendResult {
|
|
|
31
28
|
contactName?: string;
|
|
32
29
|
gasCost: number;
|
|
33
30
|
gasCostUnit: string;
|
|
34
|
-
gasMethod: GasMethod;
|
|
35
31
|
balance: BalanceResponse;
|
|
36
32
|
}
|
|
37
33
|
interface SaveResult {
|
|
@@ -41,7 +37,6 @@ interface SaveResult {
|
|
|
41
37
|
apy: number;
|
|
42
38
|
fee: number;
|
|
43
39
|
gasCost: number;
|
|
44
|
-
gasMethod: GasMethod;
|
|
45
40
|
savingsBalance: number;
|
|
46
41
|
}
|
|
47
42
|
interface WithdrawResult {
|
|
@@ -50,7 +45,6 @@ interface WithdrawResult {
|
|
|
50
45
|
amount: number;
|
|
51
46
|
asset?: string;
|
|
52
47
|
gasCost: number;
|
|
53
|
-
gasMethod: GasMethod;
|
|
54
48
|
}
|
|
55
49
|
interface BorrowResult {
|
|
56
50
|
success: boolean;
|
|
@@ -61,7 +55,6 @@ interface BorrowResult {
|
|
|
61
55
|
fee: number;
|
|
62
56
|
healthFactor: number;
|
|
63
57
|
gasCost: number;
|
|
64
|
-
gasMethod: GasMethod;
|
|
65
58
|
}
|
|
66
59
|
interface RepayResult {
|
|
67
60
|
success: boolean;
|
|
@@ -71,7 +64,6 @@ interface RepayResult {
|
|
|
71
64
|
asset?: string;
|
|
72
65
|
remainingDebt: number;
|
|
73
66
|
gasCost: number;
|
|
74
|
-
gasMethod: GasMethod;
|
|
75
67
|
}
|
|
76
68
|
interface HealthFactorResult {
|
|
77
69
|
healthFactor: number;
|
|
@@ -166,7 +158,6 @@ interface TransactionRecord {
|
|
|
166
158
|
direction?: 'in' | 'out';
|
|
167
159
|
timestamp: number;
|
|
168
160
|
gasCost?: number;
|
|
169
|
-
gasMethod?: GasMethod;
|
|
170
161
|
}
|
|
171
162
|
interface PendingReward {
|
|
172
163
|
protocol: string;
|
|
@@ -182,7 +173,6 @@ interface ClaimRewardsResult {
|
|
|
182
173
|
rewards: PendingReward[];
|
|
183
174
|
totalValueUsd: number;
|
|
184
175
|
gasCost: number;
|
|
185
|
-
gasMethod: GasMethod;
|
|
186
176
|
}
|
|
187
177
|
interface CompoundRewardsResult {
|
|
188
178
|
success: boolean;
|
|
@@ -200,7 +190,6 @@ interface StakeVSuiResult {
|
|
|
200
190
|
vSuiReceived: number;
|
|
201
191
|
apy: number;
|
|
202
192
|
gasCost: number;
|
|
203
|
-
gasMethod: GasMethod;
|
|
204
193
|
}
|
|
205
194
|
interface UnstakeVSuiResult {
|
|
206
195
|
success: boolean;
|
|
@@ -208,7 +197,6 @@ interface UnstakeVSuiResult {
|
|
|
208
197
|
vSuiAmount: number;
|
|
209
198
|
suiReceived: number;
|
|
210
199
|
gasCost: number;
|
|
211
|
-
gasMethod: GasMethod;
|
|
212
200
|
}
|
|
213
201
|
interface SwapResult {
|
|
214
202
|
success: boolean;
|
|
@@ -220,7 +208,6 @@ interface SwapResult {
|
|
|
220
208
|
priceImpact: number;
|
|
221
209
|
route: string;
|
|
222
210
|
gasCost: number;
|
|
223
|
-
gasMethod: GasMethod;
|
|
224
211
|
}
|
|
225
212
|
interface SwapQuoteResult {
|
|
226
213
|
fromToken: string;
|
|
@@ -264,4 +251,4 @@ interface FinancialSummary {
|
|
|
264
251
|
fetchedAt: number;
|
|
265
252
|
}
|
|
266
253
|
|
|
267
|
-
export type { AssetRates as A, BalanceResponse as B, ClaimRewardsResult as C, DepositInfo as D, EarningsResult as E, FundStatusResult as F,
|
|
254
|
+
export type { AssetRates as A, BalanceResponse as B, ClaimRewardsResult as C, DepositInfo as D, EarningsResult as E, FundStatusResult as F, GasReserve as G, HealthFactorResult as H, MaxBorrowResult as M, PayOptions as P, RatesResult as R, SaveResult as S, TransactionRecord as T, UnstakeVSuiResult as U, WithdrawResult as W, BorrowResult as a, MaxWithdrawResult as b, PayResult as c, PendingReward as d, PositionEntry as e, PositionsResult as f, RepayResult as g, SendResult as h, T2000Options as i, StakeVSuiResult as j, SwapResult as k, SwapQuoteResult as l, PaymentRequest as m, CompoundRewardsResult as n, FinancialSummary as o, HFAlertLevel as p };
|
|
@@ -6,8 +6,6 @@ interface T2000Options {
|
|
|
6
6
|
passphrase?: string;
|
|
7
7
|
network?: 'mainnet' | 'testnet';
|
|
8
8
|
rpcUrl?: string;
|
|
9
|
-
sponsored?: boolean;
|
|
10
|
-
name?: string;
|
|
11
9
|
}
|
|
12
10
|
interface GasReserve {
|
|
13
11
|
sui: number;
|
|
@@ -22,7 +20,6 @@ interface BalanceResponse {
|
|
|
22
20
|
total: number;
|
|
23
21
|
stables: Record<string, number>;
|
|
24
22
|
}
|
|
25
|
-
type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup' | 'none';
|
|
26
23
|
interface SendResult {
|
|
27
24
|
success: boolean;
|
|
28
25
|
tx: string;
|
|
@@ -31,7 +28,6 @@ interface SendResult {
|
|
|
31
28
|
contactName?: string;
|
|
32
29
|
gasCost: number;
|
|
33
30
|
gasCostUnit: string;
|
|
34
|
-
gasMethod: GasMethod;
|
|
35
31
|
balance: BalanceResponse;
|
|
36
32
|
}
|
|
37
33
|
interface SaveResult {
|
|
@@ -41,7 +37,6 @@ interface SaveResult {
|
|
|
41
37
|
apy: number;
|
|
42
38
|
fee: number;
|
|
43
39
|
gasCost: number;
|
|
44
|
-
gasMethod: GasMethod;
|
|
45
40
|
savingsBalance: number;
|
|
46
41
|
}
|
|
47
42
|
interface WithdrawResult {
|
|
@@ -50,7 +45,6 @@ interface WithdrawResult {
|
|
|
50
45
|
amount: number;
|
|
51
46
|
asset?: string;
|
|
52
47
|
gasCost: number;
|
|
53
|
-
gasMethod: GasMethod;
|
|
54
48
|
}
|
|
55
49
|
interface BorrowResult {
|
|
56
50
|
success: boolean;
|
|
@@ -61,7 +55,6 @@ interface BorrowResult {
|
|
|
61
55
|
fee: number;
|
|
62
56
|
healthFactor: number;
|
|
63
57
|
gasCost: number;
|
|
64
|
-
gasMethod: GasMethod;
|
|
65
58
|
}
|
|
66
59
|
interface RepayResult {
|
|
67
60
|
success: boolean;
|
|
@@ -71,7 +64,6 @@ interface RepayResult {
|
|
|
71
64
|
asset?: string;
|
|
72
65
|
remainingDebt: number;
|
|
73
66
|
gasCost: number;
|
|
74
|
-
gasMethod: GasMethod;
|
|
75
67
|
}
|
|
76
68
|
interface HealthFactorResult {
|
|
77
69
|
healthFactor: number;
|
|
@@ -166,7 +158,6 @@ interface TransactionRecord {
|
|
|
166
158
|
direction?: 'in' | 'out';
|
|
167
159
|
timestamp: number;
|
|
168
160
|
gasCost?: number;
|
|
169
|
-
gasMethod?: GasMethod;
|
|
170
161
|
}
|
|
171
162
|
interface PendingReward {
|
|
172
163
|
protocol: string;
|
|
@@ -182,7 +173,6 @@ interface ClaimRewardsResult {
|
|
|
182
173
|
rewards: PendingReward[];
|
|
183
174
|
totalValueUsd: number;
|
|
184
175
|
gasCost: number;
|
|
185
|
-
gasMethod: GasMethod;
|
|
186
176
|
}
|
|
187
177
|
interface CompoundRewardsResult {
|
|
188
178
|
success: boolean;
|
|
@@ -200,7 +190,6 @@ interface StakeVSuiResult {
|
|
|
200
190
|
vSuiReceived: number;
|
|
201
191
|
apy: number;
|
|
202
192
|
gasCost: number;
|
|
203
|
-
gasMethod: GasMethod;
|
|
204
193
|
}
|
|
205
194
|
interface UnstakeVSuiResult {
|
|
206
195
|
success: boolean;
|
|
@@ -208,7 +197,6 @@ interface UnstakeVSuiResult {
|
|
|
208
197
|
vSuiAmount: number;
|
|
209
198
|
suiReceived: number;
|
|
210
199
|
gasCost: number;
|
|
211
|
-
gasMethod: GasMethod;
|
|
212
200
|
}
|
|
213
201
|
interface SwapResult {
|
|
214
202
|
success: boolean;
|
|
@@ -220,7 +208,6 @@ interface SwapResult {
|
|
|
220
208
|
priceImpact: number;
|
|
221
209
|
route: string;
|
|
222
210
|
gasCost: number;
|
|
223
|
-
gasMethod: GasMethod;
|
|
224
211
|
}
|
|
225
212
|
interface SwapQuoteResult {
|
|
226
213
|
fromToken: string;
|
|
@@ -264,4 +251,4 @@ interface FinancialSummary {
|
|
|
264
251
|
fetchedAt: number;
|
|
265
252
|
}
|
|
266
253
|
|
|
267
|
-
export type { AssetRates as A, BalanceResponse as B, ClaimRewardsResult as C, DepositInfo as D, EarningsResult as E, FundStatusResult as F,
|
|
254
|
+
export type { AssetRates as A, BalanceResponse as B, ClaimRewardsResult as C, DepositInfo as D, EarningsResult as E, FundStatusResult as F, GasReserve as G, HealthFactorResult as H, MaxBorrowResult as M, PayOptions as P, RatesResult as R, SaveResult as S, TransactionRecord as T, UnstakeVSuiResult as U, WithdrawResult as W, BorrowResult as a, MaxWithdrawResult as b, PayResult as c, PendingReward as d, PositionEntry as e, PositionsResult as f, RepayResult as g, SendResult as h, T2000Options as i, StakeVSuiResult as j, SwapResult as k, SwapQuoteResult as l, PaymentRequest as m, CompoundRewardsResult as n, FinancialSummary as o, HFAlertLevel as p };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|