@t2000/sdk 5.1.0 → 5.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 +0 -43
- 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 +1 -42
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +198 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -19
- package/dist/index.d.ts +100 -19
- package/dist/index.js +187 -152
- package/dist/index.js.map +1 -1
- package/dist/{types-C01EGu76.d.cts → simulate-BTIIpnXc.d.cts} +3 -39
- package/dist/{types-C01EGu76.d.ts → simulate-BTIIpnXc.d.ts} +3 -39
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,29 +1,106 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import { T as T2000Error, at as T2000Options, F as TransactionSigner, P as PayOptions, k as PayResult, au as SwapResult, av as SwapQuoteResult, t as SupportedAsset, o as SendResult, B as BalanceResponse, A as TransactionRecord, e as DepositInfo, aw as PaymentRequest, Z as ZkLoginProof, ax as SuiCoreClient, ay as SendableAsset, j as OverlayFeeConfig, az as SponsoredCoinMergeCache, u as SwapRouteResult } from './simulate-BTIIpnXc.cjs';
|
|
5
|
+
export { aA as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aB as CoinPage, aC as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, E as ETH_TYPE, f as ExtractedTransfer, aD as GASLESS_MIN_STABLE_AMOUNT, aE as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aF as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aG as Operation, aH as SENDABLE_ASSETS, S as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, aI as SelectAndSplitResult, aJ as SerializedCetusRoute, aK as SerializedCetusRoutePath, aL as SerializedRouterDataV3, p as SimulationResult, q as StableAsset, r as SuiHolding, s as SuiRpcTxBlock, v as T2000ErrorCode, w as T2000ErrorData, x as T2000_OVERLAY_FEE_WALLET, y as TOKEN_MAP, z as TransactionLeg, H as TxDirection, U as USDC_DECIMALS, J as USDC_TYPE, Q as USDE_TYPE, R as USDSUI_TYPE, V as USDT_TYPE, W as WAL_TYPE, X as WBTC_TYPE, Y as ZkLoginSigner, aM as addSwapToTx, aN as assertAllowedAsset, _ as buildSwapTx, $ as classifyAction, a0 as classifyLabel, a1 as classifyTransaction, aO as deserializeCetusRoute, a2 as executeTx, a3 as extractAllUserLegs, a4 as extractTransferDetails, a5 as extractTxCommands, a6 as extractTxSender, a7 as fallbackLabel, aP as fetchAllCoins, a8 as findSwapRoute, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, aQ as getCoinMeta, ac as getDecimals, ad as getDecimalsForCoinType, aR as getSuiClient, aS as getSuiGrpcClient, aT as isAllowedAsset, aU as isCetusRouteFresh, aV as isInRegistry, ae as mapMoveAbortCode, af as mapWalletError, ag as mistToSui, aW as normalizeAsset, aX as normalizeCoinType, ah as parseSuiRpcTx, ai as payWithMpp, aY as queryHistory, aZ as queryTransaction, aj as rawToStable, ak as rawToUsdc, al as refineLendingLabel, am as resolveSymbol, an as resolveTokenType, a_ as selectAndSplitCoin, a$ as selectSuiCoin, b0 as serializeCetusRoute, b1 as simulateTransaction, ao as stableToRaw, ap as suiToMist, b2 as throwIfSimulationFailed, aq as truncateAddress, ar as usdcToRaw, as as validateAddress, b3 as verifyCetusRouteCoinMatch } from './simulate-BTIIpnXc.cjs';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
9
9
|
import '@cetusprotocol/aggregator-sdk';
|
|
10
10
|
import '@mysten/sui/jsonRpc';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
interface LimitsConfig {
|
|
13
|
+
/** Caps any single outbound write (send | swap | pay) by USD value. */
|
|
14
|
+
perTxUsd?: number;
|
|
15
|
+
/** Caps CUMULATIVE outbound spend (all writes) per UTC day, by USD value. */
|
|
16
|
+
dailyUsd?: number;
|
|
17
|
+
}
|
|
18
|
+
interface DailySpend {
|
|
19
|
+
/** UTC date `YYYY-MM-DD` the running total applies to. */
|
|
20
|
+
date: string;
|
|
21
|
+
/** USD spent so far on `date`. */
|
|
22
|
+
usd: number;
|
|
23
|
+
}
|
|
24
|
+
interface LimitsFile {
|
|
25
|
+
limits?: LimitsConfig;
|
|
26
|
+
dailySpend?: DailySpend;
|
|
27
|
+
}
|
|
28
|
+
declare function readLimitsFile(configDir?: string): LimitsFile;
|
|
29
|
+
/**
|
|
30
|
+
* Write the limits + dailySpend keys, PRESERVING any other keys already on
|
|
31
|
+
* disk (a config file may carry unrelated data). Mode 0600.
|
|
32
|
+
*/
|
|
33
|
+
declare function writeLimitsFile(file: LimitsFile, configDir?: string): string;
|
|
34
|
+
declare function getLimits(configDir?: string): LimitsConfig | undefined;
|
|
35
|
+
declare function hasLimits(configDir?: string): boolean;
|
|
36
|
+
/** Merge-set limits (only provided fields change). Returns the written path. */
|
|
37
|
+
declare function setLimits(limits: LimitsConfig, configDir?: string): string;
|
|
38
|
+
/** Remove all limits (keeps the dailySpend ledger). Returns the written path. */
|
|
39
|
+
declare function clearLimits(configDir?: string): string;
|
|
40
|
+
/** Cumulative USD spent so far today (0 when the ledger is from a prior day). */
|
|
41
|
+
declare function dailySpentToday(configDir?: string): number;
|
|
42
|
+
/** Add `usd` to today's running total (resets on UTC date rollover). */
|
|
43
|
+
declare function recordDailySpend(usd: number, configDir?: string): void;
|
|
44
|
+
|
|
45
|
+
type LimitKind = 'perTxUsd' | 'dailyUsd';
|
|
46
|
+
type LimitOperation = 'send' | 'swap' | 'pay';
|
|
47
|
+
declare class LimitExceededError extends Error {
|
|
48
|
+
readonly code = "LIMIT_EXCEEDED";
|
|
49
|
+
readonly operation: LimitOperation;
|
|
50
|
+
readonly limitKind: LimitKind;
|
|
51
|
+
readonly limit: number;
|
|
52
|
+
readonly attempted: number;
|
|
53
|
+
constructor(params: {
|
|
54
|
+
operation: LimitOperation;
|
|
55
|
+
limitKind: LimitKind;
|
|
56
|
+
limit: number;
|
|
57
|
+
attempted: number;
|
|
58
|
+
});
|
|
59
|
+
toJSON(): unknown;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Best-effort USD value for an asset+amount pair, for the limit gate. Stables
|
|
64
|
+
* are 1:1; SUI (and anything else) returns `null` — "unknown, don't gate".
|
|
65
|
+
* The limits are USD-denominated; SUI-USD gating would need a price lookup and
|
|
66
|
+
* is intentionally out of scope (matches the prior CLI behavior).
|
|
67
|
+
*/
|
|
68
|
+
declare function approxUsdValue(asset: string, amount: number): number | null;
|
|
69
|
+
/**
|
|
70
|
+
* Pure gate — no I/O. Returns silently when allowed; throws
|
|
71
|
+
* `LimitExceededError` when blocked.
|
|
72
|
+
*/
|
|
73
|
+
declare function assertLimitConfig(input: {
|
|
74
|
+
limits: LimitsConfig | undefined;
|
|
75
|
+
spentTodayUsd: number;
|
|
76
|
+
operation: LimitOperation;
|
|
77
|
+
amountUsd: number;
|
|
78
|
+
force?: boolean;
|
|
79
|
+
}): void;
|
|
80
|
+
interface LimitAssertInput {
|
|
81
|
+
operation: LimitOperation;
|
|
82
|
+
/** This write's USD value. Pass 0 / non-positive to skip (e.g. SUI sends). */
|
|
83
|
+
amountUsd: number;
|
|
84
|
+
/** When true, skip the gate. */
|
|
85
|
+
force?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The spending-limit enforcer — reads/writes `~/.t2000/config.json` (or a
|
|
89
|
+
* `configDir` override for tests). Constructed once by the T2000 agent and
|
|
90
|
+
* called around every outbound write; also drives the CLI `t2 limit` commands.
|
|
91
|
+
*/
|
|
92
|
+
declare class LimitEnforcer {
|
|
93
|
+
private readonly configDir?;
|
|
94
|
+
constructor(configDir?: string | undefined);
|
|
95
|
+
/** Throws `LimitExceededError` when the write exceeds an opted-in cap. */
|
|
96
|
+
assert(input: LimitAssertInput): void;
|
|
97
|
+
/** Add a settled write's USD value to today's cumulative total. */
|
|
98
|
+
record(amountUsd: number): void;
|
|
99
|
+
getLimits(): LimitsConfig | undefined;
|
|
100
|
+
hasLimits(): boolean;
|
|
101
|
+
setLimits(limits: LimitsConfig): void;
|
|
102
|
+
clearLimits(): void;
|
|
103
|
+
dailySpentToday(): number;
|
|
27
104
|
}
|
|
28
105
|
|
|
29
106
|
interface T2000Events {
|
|
@@ -57,7 +134,9 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
57
134
|
private readonly _keypair?;
|
|
58
135
|
private readonly client;
|
|
59
136
|
private readonly _address;
|
|
60
|
-
|
|
137
|
+
/** Unified spending-limit gate (per-tx + cumulative daily, USD). Shared by
|
|
138
|
+
* CLI + MCP + programmatic writes — one gate, no bypass (R-0 Finding 1). */
|
|
139
|
+
readonly limits: LimitEnforcer;
|
|
61
140
|
private constructor();
|
|
62
141
|
private constructor();
|
|
63
142
|
static create(options?: T2000Options): Promise<T2000>;
|
|
@@ -87,6 +166,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
87
166
|
amount: number;
|
|
88
167
|
byAmountIn?: boolean;
|
|
89
168
|
slippage?: number;
|
|
169
|
+
force?: boolean;
|
|
90
170
|
}): Promise<SwapResult>;
|
|
91
171
|
/**
|
|
92
172
|
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25]
|
|
@@ -128,6 +208,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
128
208
|
to: string;
|
|
129
209
|
amount: number;
|
|
130
210
|
asset: SupportedAsset;
|
|
211
|
+
force?: boolean;
|
|
131
212
|
}): Promise<SendResult>;
|
|
132
213
|
/**
|
|
133
214
|
* Resolve a recipient string into a canonical 0x address:
|
|
@@ -888,4 +969,4 @@ declare function fullHandle(label: string): string;
|
|
|
888
969
|
*/
|
|
889
970
|
declare function displayHandle(label: string): string;
|
|
890
971
|
|
|
891
|
-
export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, DepositInfo, InvalidAddressError, type LabelValidationResult, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX,
|
|
972
|
+
export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,106 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import { T as T2000Error, at as T2000Options, F as TransactionSigner, P as PayOptions, k as PayResult, au as SwapResult, av as SwapQuoteResult, t as SupportedAsset, o as SendResult, B as BalanceResponse, A as TransactionRecord, e as DepositInfo, aw as PaymentRequest, Z as ZkLoginProof, ax as SuiCoreClient, ay as SendableAsset, j as OverlayFeeConfig, az as SponsoredCoinMergeCache, u as SwapRouteResult } from './simulate-BTIIpnXc.js';
|
|
5
|
+
export { aA as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aB as CoinPage, aC as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, E as ETH_TYPE, f as ExtractedTransfer, aD as GASLESS_MIN_STABLE_AMOUNT, aE as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, g as KeypairSigner, L as LABEL_PATTERNS, h as LOFI_TYPE, M as MANIFEST_TYPE, i as MIST_PER_SUI, N as NAVX_TYPE, aF as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aG as Operation, aH as SENDABLE_ASSETS, S as STABLE_ASSETS, l as SUI_DECIMALS, m as SUI_TYPE, n as SUPPORTED_ASSETS, aI as SelectAndSplitResult, aJ as SerializedCetusRoute, aK as SerializedCetusRoutePath, aL as SerializedRouterDataV3, p as SimulationResult, q as StableAsset, r as SuiHolding, s as SuiRpcTxBlock, v as T2000ErrorCode, w as T2000ErrorData, x as T2000_OVERLAY_FEE_WALLET, y as TOKEN_MAP, z as TransactionLeg, H as TxDirection, U as USDC_DECIMALS, J as USDC_TYPE, Q as USDE_TYPE, R as USDSUI_TYPE, V as USDT_TYPE, W as WAL_TYPE, X as WBTC_TYPE, Y as ZkLoginSigner, aM as addSwapToTx, aN as assertAllowedAsset, _ as buildSwapTx, $ as classifyAction, a0 as classifyLabel, a1 as classifyTransaction, aO as deserializeCetusRoute, a2 as executeTx, a3 as extractAllUserLegs, a4 as extractTransferDetails, a5 as extractTxCommands, a6 as extractTxSender, a7 as fallbackLabel, aP as fetchAllCoins, a8 as findSwapRoute, a9 as formatAssetAmount, aa as formatSui, ab as formatUsd, aQ as getCoinMeta, ac as getDecimals, ad as getDecimalsForCoinType, aR as getSuiClient, aS as getSuiGrpcClient, aT as isAllowedAsset, aU as isCetusRouteFresh, aV as isInRegistry, ae as mapMoveAbortCode, af as mapWalletError, ag as mistToSui, aW as normalizeAsset, aX as normalizeCoinType, ah as parseSuiRpcTx, ai as payWithMpp, aY as queryHistory, aZ as queryTransaction, aj as rawToStable, ak as rawToUsdc, al as refineLendingLabel, am as resolveSymbol, an as resolveTokenType, a_ as selectAndSplitCoin, a$ as selectSuiCoin, b0 as serializeCetusRoute, b1 as simulateTransaction, ao as stableToRaw, ap as suiToMist, b2 as throwIfSimulationFailed, aq as truncateAddress, ar as usdcToRaw, as as validateAddress, b3 as verifyCetusRouteCoinMatch } from './simulate-BTIIpnXc.js';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
import { SuinsClient } from '@mysten/suins';
|
|
8
8
|
import '@mysten/sui/client';
|
|
9
9
|
import '@cetusprotocol/aggregator-sdk';
|
|
10
10
|
import '@mysten/sui/jsonRpc';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
interface LimitsConfig {
|
|
13
|
+
/** Caps any single outbound write (send | swap | pay) by USD value. */
|
|
14
|
+
perTxUsd?: number;
|
|
15
|
+
/** Caps CUMULATIVE outbound spend (all writes) per UTC day, by USD value. */
|
|
16
|
+
dailyUsd?: number;
|
|
17
|
+
}
|
|
18
|
+
interface DailySpend {
|
|
19
|
+
/** UTC date `YYYY-MM-DD` the running total applies to. */
|
|
20
|
+
date: string;
|
|
21
|
+
/** USD spent so far on `date`. */
|
|
22
|
+
usd: number;
|
|
23
|
+
}
|
|
24
|
+
interface LimitsFile {
|
|
25
|
+
limits?: LimitsConfig;
|
|
26
|
+
dailySpend?: DailySpend;
|
|
27
|
+
}
|
|
28
|
+
declare function readLimitsFile(configDir?: string): LimitsFile;
|
|
29
|
+
/**
|
|
30
|
+
* Write the limits + dailySpend keys, PRESERVING any other keys already on
|
|
31
|
+
* disk (a config file may carry unrelated data). Mode 0600.
|
|
32
|
+
*/
|
|
33
|
+
declare function writeLimitsFile(file: LimitsFile, configDir?: string): string;
|
|
34
|
+
declare function getLimits(configDir?: string): LimitsConfig | undefined;
|
|
35
|
+
declare function hasLimits(configDir?: string): boolean;
|
|
36
|
+
/** Merge-set limits (only provided fields change). Returns the written path. */
|
|
37
|
+
declare function setLimits(limits: LimitsConfig, configDir?: string): string;
|
|
38
|
+
/** Remove all limits (keeps the dailySpend ledger). Returns the written path. */
|
|
39
|
+
declare function clearLimits(configDir?: string): string;
|
|
40
|
+
/** Cumulative USD spent so far today (0 when the ledger is from a prior day). */
|
|
41
|
+
declare function dailySpentToday(configDir?: string): number;
|
|
42
|
+
/** Add `usd` to today's running total (resets on UTC date rollover). */
|
|
43
|
+
declare function recordDailySpend(usd: number, configDir?: string): void;
|
|
44
|
+
|
|
45
|
+
type LimitKind = 'perTxUsd' | 'dailyUsd';
|
|
46
|
+
type LimitOperation = 'send' | 'swap' | 'pay';
|
|
47
|
+
declare class LimitExceededError extends Error {
|
|
48
|
+
readonly code = "LIMIT_EXCEEDED";
|
|
49
|
+
readonly operation: LimitOperation;
|
|
50
|
+
readonly limitKind: LimitKind;
|
|
51
|
+
readonly limit: number;
|
|
52
|
+
readonly attempted: number;
|
|
53
|
+
constructor(params: {
|
|
54
|
+
operation: LimitOperation;
|
|
55
|
+
limitKind: LimitKind;
|
|
56
|
+
limit: number;
|
|
57
|
+
attempted: number;
|
|
58
|
+
});
|
|
59
|
+
toJSON(): unknown;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Best-effort USD value for an asset+amount pair, for the limit gate. Stables
|
|
64
|
+
* are 1:1; SUI (and anything else) returns `null` — "unknown, don't gate".
|
|
65
|
+
* The limits are USD-denominated; SUI-USD gating would need a price lookup and
|
|
66
|
+
* is intentionally out of scope (matches the prior CLI behavior).
|
|
67
|
+
*/
|
|
68
|
+
declare function approxUsdValue(asset: string, amount: number): number | null;
|
|
69
|
+
/**
|
|
70
|
+
* Pure gate — no I/O. Returns silently when allowed; throws
|
|
71
|
+
* `LimitExceededError` when blocked.
|
|
72
|
+
*/
|
|
73
|
+
declare function assertLimitConfig(input: {
|
|
74
|
+
limits: LimitsConfig | undefined;
|
|
75
|
+
spentTodayUsd: number;
|
|
76
|
+
operation: LimitOperation;
|
|
77
|
+
amountUsd: number;
|
|
78
|
+
force?: boolean;
|
|
79
|
+
}): void;
|
|
80
|
+
interface LimitAssertInput {
|
|
81
|
+
operation: LimitOperation;
|
|
82
|
+
/** This write's USD value. Pass 0 / non-positive to skip (e.g. SUI sends). */
|
|
83
|
+
amountUsd: number;
|
|
84
|
+
/** When true, skip the gate. */
|
|
85
|
+
force?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The spending-limit enforcer — reads/writes `~/.t2000/config.json` (or a
|
|
89
|
+
* `configDir` override for tests). Constructed once by the T2000 agent and
|
|
90
|
+
* called around every outbound write; also drives the CLI `t2 limit` commands.
|
|
91
|
+
*/
|
|
92
|
+
declare class LimitEnforcer {
|
|
93
|
+
private readonly configDir?;
|
|
94
|
+
constructor(configDir?: string | undefined);
|
|
95
|
+
/** Throws `LimitExceededError` when the write exceeds an opted-in cap. */
|
|
96
|
+
assert(input: LimitAssertInput): void;
|
|
97
|
+
/** Add a settled write's USD value to today's cumulative total. */
|
|
98
|
+
record(amountUsd: number): void;
|
|
99
|
+
getLimits(): LimitsConfig | undefined;
|
|
100
|
+
hasLimits(): boolean;
|
|
101
|
+
setLimits(limits: LimitsConfig): void;
|
|
102
|
+
clearLimits(): void;
|
|
103
|
+
dailySpentToday(): number;
|
|
27
104
|
}
|
|
28
105
|
|
|
29
106
|
interface T2000Events {
|
|
@@ -57,7 +134,9 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
57
134
|
private readonly _keypair?;
|
|
58
135
|
private readonly client;
|
|
59
136
|
private readonly _address;
|
|
60
|
-
|
|
137
|
+
/** Unified spending-limit gate (per-tx + cumulative daily, USD). Shared by
|
|
138
|
+
* CLI + MCP + programmatic writes — one gate, no bypass (R-0 Finding 1). */
|
|
139
|
+
readonly limits: LimitEnforcer;
|
|
61
140
|
private constructor();
|
|
62
141
|
private constructor();
|
|
63
142
|
static create(options?: T2000Options): Promise<T2000>;
|
|
@@ -87,6 +166,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
87
166
|
amount: number;
|
|
88
167
|
byAmountIn?: boolean;
|
|
89
168
|
slippage?: number;
|
|
169
|
+
force?: boolean;
|
|
90
170
|
}): Promise<SwapResult>;
|
|
91
171
|
/**
|
|
92
172
|
* [SPEC_AGENTIC_STACK P1 / SDK F2 — 2026-05-25]
|
|
@@ -128,6 +208,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
128
208
|
to: string;
|
|
129
209
|
amount: number;
|
|
130
210
|
asset: SupportedAsset;
|
|
211
|
+
force?: boolean;
|
|
131
212
|
}): Promise<SendResult>;
|
|
132
213
|
/**
|
|
133
214
|
* Resolve a recipient string into a canonical 0x address:
|
|
@@ -888,4 +969,4 @@ declare function fullHandle(label: string): string;
|
|
|
888
969
|
*/
|
|
889
970
|
declare function displayHandle(label: string): string;
|
|
890
971
|
|
|
891
|
-
export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, DepositInfo, InvalidAddressError, type LabelValidationResult, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX,
|
|
972
|
+
export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
|