@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/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 { W as TxMetadata, p as SafeguardConfig, T as T2000Error, az as T2000Options, U as TransactionSigner, P as PayOptions, l as PayResult, aA as SwapResult, aB as SwapQuoteResult, y as SupportedAsset, t as SendResult, B as BalanceResponse, R as TransactionRecord, f as DepositInfo, aC as PaymentRequest, a2 as ZkLoginProof, aD as SuiCoreClient, aE as SendableAsset, k as OverlayFeeConfig, aF as SponsoredCoinMergeCache, z as SwapRouteResult } from './types-C01EGu76.cjs';
5
- export { aG as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aH as CoinPage, aI as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, e as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, aJ as GASLESS_MIN_STABLE_AMOUNT, aK as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, aL as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aM as Operation, aN as SENDABLE_ASSETS, S as STABLE_ASSETS, m as SUI_DECIMALS, n as SUI_TYPE, o as SUPPORTED_ASSETS, q as SafeguardError, r as SafeguardErrorDetails, s as SafeguardRule, aO as SelectAndSplitResult, aP as SerializedCetusRoute, aQ as SerializedCetusRoutePath, aR as SerializedRouterDataV3, u as SimulationResult, v as StableAsset, w as SuiHolding, x as SuiRpcTxBlock, A as T2000ErrorCode, F as T2000ErrorData, H as T2000_OVERLAY_FEE_WALLET, J as TOKEN_MAP, Q as TransactionLeg, V as TxDirection, X as USDC_DECIMALS, Y as USDC_TYPE, Z as USDE_TYPE, _ as USDSUI_TYPE, $ as USDT_TYPE, a0 as WAL_TYPE, a1 as WBTC_TYPE, a3 as ZkLoginSigner, aS as addSwapToTx, aT as assertAllowedAsset, a4 as buildSwapTx, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, aU as deserializeCetusRoute, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, aV as fetchAllCoins, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, aW as getCoinMeta, ai as getDecimals, aj as getDecimalsForCoinType, aX as getSuiClient, aY as getSuiGrpcClient, aZ as isAllowedAsset, a_ as isCetusRouteFresh, a$ as isInRegistry, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, b0 as normalizeAsset, b1 as normalizeCoinType, an as parseSuiRpcTx, ao as payWithMpp, b2 as queryHistory, b3 as queryTransaction, ap as rawToStable, aq as rawToUsdc, ar as refineLendingLabel, as as resolveSymbol, at as resolveTokenType, b4 as selectAndSplitCoin, b5 as selectSuiCoin, b6 as serializeCetusRoute, b7 as simulateTransaction, au as stableToRaw, av as suiToMist, b8 as throwIfSimulationFailed, aw as truncateAddress, ax as usdcToRaw, ay as validateAddress, b9 as verifyCetusRouteCoinMatch } from './types-C01EGu76.cjs';
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
- declare class SafeguardEnforcer {
13
- private config;
14
- private readonly configPath;
15
- constructor(configDir?: string);
16
- load(): void;
17
- assertNotLocked(): void;
18
- check(metadata: TxMetadata): void;
19
- recordUsage(amount: number): void;
20
- lock(): void;
21
- unlock(): void;
22
- set(key: string, value: unknown): void;
23
- getConfig(): SafeguardConfig;
24
- isConfigured(): boolean;
25
- private resetDailyIfNewDay;
26
- private save;
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
- readonly enforcer: SafeguardEnforcer;
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, SafeguardConfig, SafeguardEnforcer, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, composeTx, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getSponsoredSwapProviders, getSwapQuote, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, validateLabel, walletExists };
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 { W as TxMetadata, p as SafeguardConfig, T as T2000Error, az as T2000Options, U as TransactionSigner, P as PayOptions, l as PayResult, aA as SwapResult, aB as SwapQuoteResult, y as SupportedAsset, t as SendResult, B as BalanceResponse, R as TransactionRecord, f as DepositInfo, aC as PaymentRequest, a2 as ZkLoginProof, aD as SuiCoreClient, aE as SendableAsset, k as OverlayFeeConfig, aF as SponsoredCoinMergeCache, z as SwapRouteResult } from './types-C01EGu76.js';
5
- export { aG as CETUS_USDC_SUI_POOL, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, aH as CoinPage, aI as DEFAULT_GRPC_URL, D as DEFAULT_NETWORK, e as DEFAULT_SAFEGUARD_CONFIG, E as ETH_TYPE, g as ExtractedTransfer, aJ as GASLESS_MIN_STABLE_AMOUNT, aK as GASLESS_STABLE_TYPES, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, aL as OPERATION_ASSETS, O as OVERLAY_FEE_RATE, aM as Operation, aN as SENDABLE_ASSETS, S as STABLE_ASSETS, m as SUI_DECIMALS, n as SUI_TYPE, o as SUPPORTED_ASSETS, q as SafeguardError, r as SafeguardErrorDetails, s as SafeguardRule, aO as SelectAndSplitResult, aP as SerializedCetusRoute, aQ as SerializedCetusRoutePath, aR as SerializedRouterDataV3, u as SimulationResult, v as StableAsset, w as SuiHolding, x as SuiRpcTxBlock, A as T2000ErrorCode, F as T2000ErrorData, H as T2000_OVERLAY_FEE_WALLET, J as TOKEN_MAP, Q as TransactionLeg, V as TxDirection, X as USDC_DECIMALS, Y as USDC_TYPE, Z as USDE_TYPE, _ as USDSUI_TYPE, $ as USDT_TYPE, a0 as WAL_TYPE, a1 as WBTC_TYPE, a3 as ZkLoginSigner, aS as addSwapToTx, aT as assertAllowedAsset, a4 as buildSwapTx, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, aU as deserializeCetusRoute, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, aV as fetchAllCoins, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, aW as getCoinMeta, ai as getDecimals, aj as getDecimalsForCoinType, aX as getSuiClient, aY as getSuiGrpcClient, aZ as isAllowedAsset, a_ as isCetusRouteFresh, a$ as isInRegistry, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, b0 as normalizeAsset, b1 as normalizeCoinType, an as parseSuiRpcTx, ao as payWithMpp, b2 as queryHistory, b3 as queryTransaction, ap as rawToStable, aq as rawToUsdc, ar as refineLendingLabel, as as resolveSymbol, at as resolveTokenType, b4 as selectAndSplitCoin, b5 as selectSuiCoin, b6 as serializeCetusRoute, b7 as simulateTransaction, au as stableToRaw, av as suiToMist, b8 as throwIfSimulationFailed, aw as truncateAddress, ax as usdcToRaw, ay as validateAddress, b9 as verifyCetusRouteCoinMatch } from './types-C01EGu76.js';
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
- declare class SafeguardEnforcer {
13
- private config;
14
- private readonly configPath;
15
- constructor(configDir?: string);
16
- load(): void;
17
- assertNotLocked(): void;
18
- check(metadata: TxMetadata): void;
19
- recordUsage(amount: number): void;
20
- lock(): void;
21
- unlock(): void;
22
- set(key: string, value: unknown): void;
23
- getConfig(): SafeguardConfig;
24
- isConfigured(): boolean;
25
- private resetDailyIfNewDay;
26
- private save;
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
- readonly enforcer: SafeguardEnforcer;
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, SafeguardConfig, SafeguardEnforcer, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, composeTx, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getSponsoredSwapProviders, getSwapQuote, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, validateLabel, walletExists };
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 };