@t2000/sdk 0.17.29 → 0.18.3

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.
Files changed (259) hide show
  1. package/dist/adapters/index.d.cts +1 -1
  2. package/dist/adapters/index.d.ts +4 -10
  3. package/dist/adapters/index.js +2107 -15
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/{index-DdtOBw42.d.ts → index-Co0lp99l.d.cts} +23 -1
  6. package/dist/{index-DdtOBw42.d.cts → index-Co0lp99l.d.ts} +23 -1
  7. package/dist/index.cjs +102 -1
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +8 -3
  10. package/dist/index.d.ts +654 -30
  11. package/dist/index.js +6154 -21
  12. package/dist/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/dist/adapters/cetus.d.ts +0 -29
  15. package/dist/adapters/cetus.d.ts.map +0 -1
  16. package/dist/adapters/cetus.js +0 -74
  17. package/dist/adapters/cetus.js.map +0 -1
  18. package/dist/adapters/cetus.test.d.ts +0 -2
  19. package/dist/adapters/cetus.test.d.ts.map +0 -1
  20. package/dist/adapters/cetus.test.js +0 -57
  21. package/dist/adapters/cetus.test.js.map +0 -1
  22. package/dist/adapters/compliance.test.d.ts +0 -8
  23. package/dist/adapters/compliance.test.d.ts.map +0 -1
  24. package/dist/adapters/compliance.test.js +0 -202
  25. package/dist/adapters/compliance.test.js.map +0 -1
  26. package/dist/adapters/index.d.ts.map +0 -1
  27. package/dist/adapters/navi.d.ts +0 -41
  28. package/dist/adapters/navi.d.ts.map +0 -1
  29. package/dist/adapters/navi.js +0 -102
  30. package/dist/adapters/navi.js.map +0 -1
  31. package/dist/adapters/navi.test.d.ts +0 -2
  32. package/dist/adapters/navi.test.d.ts.map +0 -1
  33. package/dist/adapters/navi.test.js +0 -164
  34. package/dist/adapters/navi.test.js.map +0 -1
  35. package/dist/adapters/registry.d.ts +0 -47
  36. package/dist/adapters/registry.d.ts.map +0 -1
  37. package/dist/adapters/registry.js +0 -162
  38. package/dist/adapters/registry.js.map +0 -1
  39. package/dist/adapters/registry.test.d.ts +0 -2
  40. package/dist/adapters/registry.test.d.ts.map +0 -1
  41. package/dist/adapters/registry.test.js +0 -197
  42. package/dist/adapters/registry.test.js.map +0 -1
  43. package/dist/adapters/suilend.d.ts +0 -71
  44. package/dist/adapters/suilend.d.ts.map +0 -1
  45. package/dist/adapters/suilend.js +0 -826
  46. package/dist/adapters/suilend.js.map +0 -1
  47. package/dist/adapters/suilend.test.d.ts +0 -2
  48. package/dist/adapters/suilend.test.d.ts.map +0 -1
  49. package/dist/adapters/suilend.test.js +0 -294
  50. package/dist/adapters/suilend.test.js.map +0 -1
  51. package/dist/adapters/types.d.ts +0 -160
  52. package/dist/adapters/types.d.ts.map +0 -1
  53. package/dist/adapters/types.js +0 -2
  54. package/dist/adapters/types.js.map +0 -1
  55. package/dist/auto-invest.d.ts +0 -23
  56. package/dist/auto-invest.d.ts.map +0 -1
  57. package/dist/auto-invest.js +0 -131
  58. package/dist/auto-invest.js.map +0 -1
  59. package/dist/auto-invest.test.d.ts +0 -2
  60. package/dist/auto-invest.test.d.ts.map +0 -1
  61. package/dist/auto-invest.test.js +0 -220
  62. package/dist/auto-invest.test.js.map +0 -1
  63. package/dist/constants.d.ts +0 -177
  64. package/dist/constants.d.ts.map +0 -1
  65. package/dist/constants.js +0 -135
  66. package/dist/constants.js.map +0 -1
  67. package/dist/contacts.d.ts +0 -25
  68. package/dist/contacts.d.ts.map +0 -1
  69. package/dist/contacts.js +0 -83
  70. package/dist/contacts.js.map +0 -1
  71. package/dist/contacts.test.d.ts +0 -2
  72. package/dist/contacts.test.d.ts.map +0 -1
  73. package/dist/contacts.test.js +0 -164
  74. package/dist/contacts.test.js.map +0 -1
  75. package/dist/errors.d.ts +0 -26
  76. package/dist/errors.d.ts.map +0 -1
  77. package/dist/errors.js +0 -81
  78. package/dist/errors.js.map +0 -1
  79. package/dist/errors.test.d.ts +0 -2
  80. package/dist/errors.test.d.ts.map +0 -1
  81. package/dist/errors.test.js +0 -48
  82. package/dist/errors.test.js.map +0 -1
  83. package/dist/gas/autoTopUp.d.ts +0 -18
  84. package/dist/gas/autoTopUp.d.ts.map +0 -1
  85. package/dist/gas/autoTopUp.js +0 -55
  86. package/dist/gas/autoTopUp.js.map +0 -1
  87. package/dist/gas/autoTopUp.test.d.ts +0 -2
  88. package/dist/gas/autoTopUp.test.d.ts.map +0 -1
  89. package/dist/gas/autoTopUp.test.js +0 -59
  90. package/dist/gas/autoTopUp.test.js.map +0 -1
  91. package/dist/gas/gasStation.d.ts +0 -23
  92. package/dist/gas/gasStation.d.ts.map +0 -1
  93. package/dist/gas/gasStation.js +0 -58
  94. package/dist/gas/gasStation.js.map +0 -1
  95. package/dist/gas/index.d.ts +0 -4
  96. package/dist/gas/index.d.ts.map +0 -1
  97. package/dist/gas/index.js +0 -4
  98. package/dist/gas/index.js.map +0 -1
  99. package/dist/gas/manager.d.ts +0 -24
  100. package/dist/gas/manager.d.ts.map +0 -1
  101. package/dist/gas/manager.js +0 -142
  102. package/dist/gas/manager.js.map +0 -1
  103. package/dist/gas/manager.test.d.ts +0 -2
  104. package/dist/gas/manager.test.d.ts.map +0 -1
  105. package/dist/gas/manager.test.js +0 -220
  106. package/dist/gas/manager.test.js.map +0 -1
  107. package/dist/gas/serialization.test.d.ts +0 -2
  108. package/dist/gas/serialization.test.d.ts.map +0 -1
  109. package/dist/gas/serialization.test.js +0 -47
  110. package/dist/gas/serialization.test.js.map +0 -1
  111. package/dist/index.d.ts.map +0 -1
  112. package/dist/invest.test.d.ts +0 -2
  113. package/dist/invest.test.d.ts.map +0 -1
  114. package/dist/invest.test.js +0 -256
  115. package/dist/invest.test.js.map +0 -1
  116. package/dist/portfolio.d.ts +0 -39
  117. package/dist/portfolio.d.ts.map +0 -1
  118. package/dist/portfolio.js +0 -201
  119. package/dist/portfolio.js.map +0 -1
  120. package/dist/portfolio.test.d.ts +0 -2
  121. package/dist/portfolio.test.d.ts.map +0 -1
  122. package/dist/portfolio.test.js +0 -301
  123. package/dist/portfolio.test.js.map +0 -1
  124. package/dist/protocols/cetus.d.ts +0 -73
  125. package/dist/protocols/cetus.d.ts.map +0 -1
  126. package/dist/protocols/cetus.js +0 -267
  127. package/dist/protocols/cetus.js.map +0 -1
  128. package/dist/protocols/cetus.test.d.ts +0 -2
  129. package/dist/protocols/cetus.test.d.ts.map +0 -1
  130. package/dist/protocols/cetus.test.js +0 -325
  131. package/dist/protocols/cetus.test.js.map +0 -1
  132. package/dist/protocols/navi.d.ts +0 -59
  133. package/dist/protocols/navi.d.ts.map +0 -1
  134. package/dist/protocols/navi.js +0 -945
  135. package/dist/protocols/navi.js.map +0 -1
  136. package/dist/protocols/navi.test.d.ts +0 -2
  137. package/dist/protocols/navi.test.d.ts.map +0 -1
  138. package/dist/protocols/navi.test.js +0 -339
  139. package/dist/protocols/navi.test.js.map +0 -1
  140. package/dist/protocols/protocolFee.d.ts +0 -17
  141. package/dist/protocols/protocolFee.d.ts.map +0 -1
  142. package/dist/protocols/protocolFee.js +0 -62
  143. package/dist/protocols/protocolFee.js.map +0 -1
  144. package/dist/protocols/protocolFee.test.d.ts +0 -2
  145. package/dist/protocols/protocolFee.test.d.ts.map +0 -1
  146. package/dist/protocols/protocolFee.test.js +0 -137
  147. package/dist/protocols/protocolFee.test.js.map +0 -1
  148. package/dist/protocols/sentinel.d.ts +0 -18
  149. package/dist/protocols/sentinel.d.ts.map +0 -1
  150. package/dist/protocols/sentinel.js +0 -188
  151. package/dist/protocols/sentinel.js.map +0 -1
  152. package/dist/protocols/sentinel.test.d.ts +0 -2
  153. package/dist/protocols/sentinel.test.d.ts.map +0 -1
  154. package/dist/protocols/sentinel.test.js +0 -199
  155. package/dist/protocols/sentinel.test.js.map +0 -1
  156. package/dist/protocols/yieldTracker.d.ts +0 -6
  157. package/dist/protocols/yieldTracker.d.ts.map +0 -1
  158. package/dist/protocols/yieldTracker.js +0 -29
  159. package/dist/protocols/yieldTracker.js.map +0 -1
  160. package/dist/safeguards/enforcer.d.ts +0 -18
  161. package/dist/safeguards/enforcer.d.ts.map +0 -1
  162. package/dist/safeguards/enforcer.js +0 -130
  163. package/dist/safeguards/enforcer.js.map +0 -1
  164. package/dist/safeguards/enforcer.test.d.ts +0 -2
  165. package/dist/safeguards/enforcer.test.d.ts.map +0 -1
  166. package/dist/safeguards/enforcer.test.js +0 -212
  167. package/dist/safeguards/enforcer.test.js.map +0 -1
  168. package/dist/safeguards/errors.d.ts +0 -24
  169. package/dist/safeguards/errors.d.ts.map +0 -1
  170. package/dist/safeguards/errors.js +0 -31
  171. package/dist/safeguards/errors.js.map +0 -1
  172. package/dist/safeguards/index.d.ts +0 -6
  173. package/dist/safeguards/index.d.ts.map +0 -1
  174. package/dist/safeguards/index.js +0 -4
  175. package/dist/safeguards/index.js.map +0 -1
  176. package/dist/safeguards/types.d.ts +0 -16
  177. package/dist/safeguards/types.d.ts.map +0 -1
  178. package/dist/safeguards/types.js +0 -13
  179. package/dist/safeguards/types.js.map +0 -1
  180. package/dist/strategy.d.ts +0 -22
  181. package/dist/strategy.d.ts.map +0 -1
  182. package/dist/strategy.js +0 -113
  183. package/dist/strategy.js.map +0 -1
  184. package/dist/strategy.test.d.ts +0 -2
  185. package/dist/strategy.test.d.ts.map +0 -1
  186. package/dist/strategy.test.js +0 -212
  187. package/dist/strategy.test.js.map +0 -1
  188. package/dist/t2000.d.ts +0 -219
  189. package/dist/t2000.d.ts.map +0 -1
  190. package/dist/t2000.integration.test.d.ts +0 -2
  191. package/dist/t2000.integration.test.d.ts.map +0 -1
  192. package/dist/t2000.integration.test.js +0 -954
  193. package/dist/t2000.integration.test.js.map +0 -1
  194. package/dist/t2000.js +0 -2416
  195. package/dist/t2000.js.map +0 -1
  196. package/dist/types.d.ts +0 -419
  197. package/dist/types.d.ts.map +0 -1
  198. package/dist/types.js +0 -2
  199. package/dist/types.js.map +0 -1
  200. package/dist/utils/format.d.ts +0 -22
  201. package/dist/utils/format.d.ts.map +0 -1
  202. package/dist/utils/format.js +0 -71
  203. package/dist/utils/format.js.map +0 -1
  204. package/dist/utils/format.test.d.ts +0 -2
  205. package/dist/utils/format.test.d.ts.map +0 -1
  206. package/dist/utils/format.test.js +0 -187
  207. package/dist/utils/format.test.js.map +0 -1
  208. package/dist/utils/hashcash.d.ts +0 -2
  209. package/dist/utils/hashcash.d.ts.map +0 -1
  210. package/dist/utils/hashcash.js +0 -27
  211. package/dist/utils/hashcash.js.map +0 -1
  212. package/dist/utils/hashcash.test.d.ts +0 -2
  213. package/dist/utils/hashcash.test.d.ts.map +0 -1
  214. package/dist/utils/hashcash.test.js +0 -40
  215. package/dist/utils/hashcash.test.js.map +0 -1
  216. package/dist/utils/retry.d.ts +0 -9
  217. package/dist/utils/retry.d.ts.map +0 -1
  218. package/dist/utils/retry.js +0 -47
  219. package/dist/utils/retry.js.map +0 -1
  220. package/dist/utils/simulate.d.ts +0 -15
  221. package/dist/utils/simulate.d.ts.map +0 -1
  222. package/dist/utils/simulate.js +0 -75
  223. package/dist/utils/simulate.js.map +0 -1
  224. package/dist/utils/simulate.test.d.ts +0 -2
  225. package/dist/utils/simulate.test.d.ts.map +0 -1
  226. package/dist/utils/simulate.test.js +0 -80
  227. package/dist/utils/simulate.test.js.map +0 -1
  228. package/dist/utils/sui.d.ts +0 -6
  229. package/dist/utils/sui.d.ts.map +0 -1
  230. package/dist/utils/sui.js +0 -28
  231. package/dist/utils/sui.js.map +0 -1
  232. package/dist/utils/sui.test.d.ts +0 -2
  233. package/dist/utils/sui.test.d.ts.map +0 -1
  234. package/dist/utils/sui.test.js +0 -58
  235. package/dist/utils/sui.test.js.map +0 -1
  236. package/dist/wallet/balance.d.ts +0 -4
  237. package/dist/wallet/balance.d.ts.map +0 -1
  238. package/dist/wallet/balance.js +0 -98
  239. package/dist/wallet/balance.js.map +0 -1
  240. package/dist/wallet/history.d.ts +0 -4
  241. package/dist/wallet/history.d.ts.map +0 -1
  242. package/dist/wallet/history.js +0 -38
  243. package/dist/wallet/history.js.map +0 -1
  244. package/dist/wallet/keyManager.d.ts +0 -9
  245. package/dist/wallet/keyManager.d.ts.map +0 -1
  246. package/dist/wallet/keyManager.js +0 -113
  247. package/dist/wallet/keyManager.js.map +0 -1
  248. package/dist/wallet/keyManager.test.d.ts +0 -2
  249. package/dist/wallet/keyManager.test.d.ts.map +0 -1
  250. package/dist/wallet/keyManager.test.js +0 -55
  251. package/dist/wallet/keyManager.test.js.map +0 -1
  252. package/dist/wallet/send.d.ts +0 -24
  253. package/dist/wallet/send.d.ts.map +0 -1
  254. package/dist/wallet/send.js +0 -95
  255. package/dist/wallet/send.js.map +0 -1
  256. package/dist/wallet/send.test.d.ts +0 -2
  257. package/dist/wallet/send.test.d.ts.map +0 -1
  258. package/dist/wallet/send.test.js +0 -69
  259. package/dist/wallet/send.test.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,30 +1,654 @@
1
- export { T2000 } from './t2000.js';
2
- export { ContactManager } from './contacts.js';
3
- export type { Contact, ContactMap } from './contacts.js';
4
- export { PortfolioManager } from './portfolio.js';
5
- export { StrategyManager } from './strategy.js';
6
- export { AutoInvestManager } from './auto-invest.js';
7
- export { T2000Error, mapWalletError, mapMoveAbortCode } from './errors.js';
8
- export type { T2000ErrorCode, T2000ErrorData } from './errors.js';
9
- export type { T2000Options, BalanceResponse, GasReserve, GasMethod, SendResult, SaveResult, WithdrawResult, BorrowResult, RepayResult, SwapResult, HealthFactorResult, MaxWithdrawResult, MaxBorrowResult, AssetRates, RatesResult, PositionEntry, PositionsResult, EarningsResult, FundStatusResult, RebalanceStep, RebalanceResult, DepositInfo, TransactionRecord, SentinelAgent, SentinelVerdict, SentinelAttackResult, InvestmentTrade, InvestmentPosition, PortfolioResult, InvestResult, InvestEarnResult, InvestRebalanceResult, InvestRebalanceMove, StrategyDefinition, StrategyBuyResult, StrategySellResult, StrategyRebalanceResult, StrategyStatusResult, AutoInvestSchedule, AutoInvestStatus, AutoInvestRunResult, PositionSide, PerpsPosition, TradeResult, TradePositionsResult, PendingReward, ClaimRewardsResult, } from './types.js';
10
- export { MIST_PER_SUI, SUI_DECIMALS, USDC_DECIMALS, BPS_DENOMINATOR, SUPPORTED_ASSETS, CLOCK_ID, DEFAULT_NETWORK, SENTINEL, } from './constants.js';
11
- export type { SupportedAsset, StableAsset, InvestmentAsset, PerpsMarket } from './constants.js';
12
- export { STABLE_ASSETS, INVESTMENT_ASSETS, PERPS_MARKETS, DEFAULT_MAX_LEVERAGE, DEFAULT_MAX_POSITION_SIZE, GAS_RESERVE_MIN, DEFAULT_STRATEGIES, } from './constants.js';
13
- export { validateAddress, truncateAddress } from './utils/sui.js';
14
- export { mistToSui, suiToMist, usdcToRaw, rawToUsdc, stableToRaw, rawToStable, getDecimals, formatUsd, formatSui, formatAssetAmount, } from './utils/format.js';
15
- export { generateKeypair, keypairFromPrivateKey, saveKey, loadKey, walletExists, exportPrivateKey, getAddress, } from './wallet/keyManager.js';
16
- export { solveHashcash } from './utils/hashcash.js';
17
- export { calculateFee, addCollectFeeToTx } from './protocols/protocolFee.js';
18
- export type { ProtocolFeeInfo, FeeOperation } from './protocols/protocolFee.js';
19
- export { simulateTransaction, throwIfSimulationFailed } from './utils/simulate.js';
20
- export type { SimulationResult } from './utils/simulate.js';
21
- export { getPoolPrice } from './protocols/cetus.js';
22
- export { getRates } from './protocols/navi.js';
23
- export * from './adapters/index.js';
24
- export { listSentinels, getSentinelInfo, requestAttack, submitPrompt, settleAttack, attack as sentinelAttack, } from './protocols/sentinel.js';
25
- export { SafeguardEnforcer, SafeguardError } from './safeguards/index.js';
26
- export type { SafeguardConfig, TxMetadata, SafeguardRule, SafeguardErrorDetails } from './safeguards/index.js';
27
- export { OUTBOUND_OPS, DEFAULT_SAFEGUARD_CONFIG } from './safeguards/index.js';
28
- export { executeWithGas, shouldAutoTopUp, executeAutoTopUp, getGasStatus, } from './gas/index.js';
29
- export type { GasExecutionResult, AutoTopUpResult, GasSponsorResponse, GasStatusResponse, GasRequestType, } from './gas/index.js';
30
- //# sourceMappingURL=index.d.ts.map
1
+ import { I as InvestmentTrade, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, T as T2000Options, b as SendResult, B as BalanceResponse, c as TransactionRecord, D as DepositInfo, L as LendingAdapter, d as SwapAdapter, e as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, f as BorrowResult, R as RepayResult, g as MaxBorrowResult, H as HealthFactorResult, h as SwapResult, i as InvestResult, j as InvestEarnResult, k as InvestRebalanceResult, P as PendingReward, C as ClaimRewardsResult, l as StrategyBuyResult, m as StrategySellResult, n as StrategyRebalanceResult, o as StrategyStatusResult, p as AutoInvestRunResult, q as PortfolioResult, r as InvestmentPosition, s as PositionsResult, t as RatesResult, u as LendingRates, v as RebalanceResult, E as EarningsResult, F as FundStatusResult, w as SentinelAgent, x as SentinelAttackResult, G as GasMethod } from './index-Co0lp99l.js';
2
+ export { y as AdapterCapability, z as AdapterPositions, J as AdapterTxResult, K as AssetRates, N as CetusAdapter, O as GasReserve, Q as HealthInfo, U as InvestRebalanceMove, V as NaviAdapter, X as PerpsAdapter, Y as PerpsPosition, Z as PositionEntry, _ as PositionSide, $ as ProtocolDescriptor, a0 as ProtocolRegistry, a1 as RebalanceStep, a2 as SentinelVerdict, a3 as SuilendAdapter, a4 as SwapQuote, a5 as TradePositionsResult, a6 as TradeResult, a7 as allDescriptors, a8 as cetusDescriptor, a9 as getSentinelInfo, aa as listSentinels, ab as naviDescriptor, ac as requestAttack, ad as sentinelAttack, ae as sentinelDescriptor, af as settleAttack, ag as submitPrompt, ah as suilendDescriptor } from './index-Co0lp99l.js';
3
+ import { EventEmitter } from 'eventemitter3';
4
+ import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
5
+ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
+ import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
7
+
8
+ type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'SWAP_FAILED' | 'SLIPPAGE_EXCEEDED' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SENTINEL_API_ERROR' | 'SENTINEL_NOT_FOUND' | 'SENTINEL_TX_FAILED' | 'SENTINEL_TEE_ERROR' | 'SAFEGUARD_BLOCKED' | 'INSUFFICIENT_INVESTMENT' | 'INVESTMENT_LOCKED' | 'INVEST_ALREADY_EARNING' | 'INVEST_NOT_EARNING' | 'BORROW_GUARD_INVESTMENT' | 'STRATEGY_NOT_FOUND' | 'STRATEGY_INVALID_ALLOCATIONS' | 'STRATEGY_HAS_POSITIONS' | 'STRATEGY_BUILTIN' | 'STRATEGY_MIN_AMOUNT' | 'AUTO_INVEST_NOT_FOUND' | 'AUTO_INVEST_INSUFFICIENT' | 'MARKET_NOT_SUPPORTED' | 'LEVERAGE_EXCEEDED' | 'POSITION_SIZE_EXCEEDED' | 'BLUEFIN_AUTH_FAILED' | 'BLUEFIN_API_ERROR' | 'POSITION_NOT_FOUND' | 'UNKNOWN';
9
+ interface T2000ErrorData {
10
+ reason?: string;
11
+ [key: string]: unknown;
12
+ }
13
+ declare class T2000Error extends Error {
14
+ readonly code: T2000ErrorCode;
15
+ readonly data?: T2000ErrorData;
16
+ readonly retryable: boolean;
17
+ constructor(code: T2000ErrorCode, message: string, data?: T2000ErrorData, retryable?: boolean);
18
+ toJSON(): {
19
+ retryable: boolean;
20
+ data?: T2000ErrorData | undefined;
21
+ error: T2000ErrorCode;
22
+ message: string;
23
+ };
24
+ }
25
+ declare function mapWalletError(error: unknown): T2000Error;
26
+ declare function mapMoveAbortCode(code: number): string;
27
+
28
+ declare const MIST_PER_SUI = 1000000000n;
29
+ declare const SUI_DECIMALS = 9;
30
+ declare const USDC_DECIMALS = 6;
31
+ declare const BPS_DENOMINATOR = 10000n;
32
+ declare const CLOCK_ID = "0x6";
33
+ declare const SUPPORTED_ASSETS: {
34
+ readonly USDC: {
35
+ readonly type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
36
+ readonly decimals: 6;
37
+ readonly symbol: "USDC";
38
+ readonly displayName: "USDC";
39
+ };
40
+ readonly USDT: {
41
+ readonly type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT";
42
+ readonly decimals: 6;
43
+ readonly symbol: "USDT";
44
+ readonly displayName: "suiUSDT";
45
+ };
46
+ readonly USDe: {
47
+ readonly type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
48
+ readonly decimals: 6;
49
+ readonly symbol: "USDe";
50
+ readonly displayName: "suiUSDe";
51
+ };
52
+ readonly USDsui: {
53
+ readonly type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
54
+ readonly decimals: 6;
55
+ readonly symbol: "USDsui";
56
+ readonly displayName: "USDsui";
57
+ };
58
+ readonly SUI: {
59
+ readonly type: "0x2::sui::SUI";
60
+ readonly decimals: 9;
61
+ readonly symbol: "SUI";
62
+ readonly displayName: "SUI";
63
+ };
64
+ readonly BTC: {
65
+ readonly type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC";
66
+ readonly decimals: 8;
67
+ readonly symbol: "BTC";
68
+ readonly displayName: "Bitcoin";
69
+ };
70
+ readonly ETH: {
71
+ readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
72
+ readonly decimals: 8;
73
+ readonly symbol: "ETH";
74
+ readonly displayName: "Ethereum";
75
+ };
76
+ readonly GOLD: {
77
+ readonly type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM";
78
+ readonly decimals: 9;
79
+ readonly symbol: "GOLD";
80
+ readonly displayName: "Gold";
81
+ };
82
+ };
83
+ type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
84
+ type StableAsset = Exclude<SupportedAsset, 'SUI' | 'BTC' | 'ETH' | 'GOLD'>;
85
+ declare const STABLE_ASSETS: readonly StableAsset[];
86
+ declare const DEFAULT_NETWORK: "mainnet";
87
+ declare const INVESTMENT_ASSETS: {
88
+ readonly SUI: {
89
+ readonly type: "0x2::sui::SUI";
90
+ readonly decimals: 9;
91
+ readonly symbol: "SUI";
92
+ readonly displayName: "SUI";
93
+ };
94
+ readonly BTC: {
95
+ readonly type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC";
96
+ readonly decimals: 8;
97
+ readonly symbol: "BTC";
98
+ readonly displayName: "Bitcoin";
99
+ };
100
+ readonly ETH: {
101
+ readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
102
+ readonly decimals: 8;
103
+ readonly symbol: "ETH";
104
+ readonly displayName: "Ethereum";
105
+ };
106
+ readonly GOLD: {
107
+ readonly type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM";
108
+ readonly decimals: 9;
109
+ readonly symbol: "GOLD";
110
+ readonly displayName: "Gold";
111
+ };
112
+ };
113
+ type InvestmentAsset = keyof typeof INVESTMENT_ASSETS;
114
+ declare const DEFAULT_STRATEGIES: {
115
+ readonly bluechip: {
116
+ readonly name: "Bluechip / Large-Cap";
117
+ readonly allocations: {
118
+ readonly BTC: 50;
119
+ readonly ETH: 30;
120
+ readonly SUI: 20;
121
+ };
122
+ readonly description: "Large-cap crypto index";
123
+ readonly custom: false;
124
+ };
125
+ readonly layer1: {
126
+ readonly name: "Smart Contract Platforms";
127
+ readonly allocations: {
128
+ readonly ETH: 50;
129
+ readonly SUI: 50;
130
+ };
131
+ readonly description: "Smart contract platforms";
132
+ readonly custom: false;
133
+ };
134
+ readonly 'sui-heavy': {
135
+ readonly name: "Sui-Weighted Portfolio";
136
+ readonly allocations: {
137
+ readonly BTC: 20;
138
+ readonly ETH: 20;
139
+ readonly SUI: 60;
140
+ };
141
+ readonly description: "Sui-weighted portfolio";
142
+ readonly custom: false;
143
+ };
144
+ readonly 'all-weather': {
145
+ readonly name: "All-Weather Portfolio";
146
+ readonly allocations: {
147
+ readonly BTC: 30;
148
+ readonly ETH: 20;
149
+ readonly SUI: 20;
150
+ readonly GOLD: 30;
151
+ };
152
+ readonly description: "Crypto and commodities";
153
+ readonly custom: false;
154
+ };
155
+ readonly 'safe-haven': {
156
+ readonly name: "Safe Haven";
157
+ readonly allocations: {
158
+ readonly BTC: 50;
159
+ readonly GOLD: 50;
160
+ };
161
+ readonly description: "Store-of-value assets";
162
+ readonly custom: false;
163
+ };
164
+ };
165
+ declare const PERPS_MARKETS: readonly ["SUI-PERP"];
166
+ type PerpsMarket = (typeof PERPS_MARKETS)[number];
167
+ declare const DEFAULT_MAX_LEVERAGE = 5;
168
+ declare const DEFAULT_MAX_POSITION_SIZE = 1000;
169
+ declare const GAS_RESERVE_MIN = 0.05;
170
+ declare const SENTINEL: {
171
+ readonly PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7";
172
+ readonly AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac";
173
+ readonly ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213";
174
+ readonly PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f";
175
+ readonly TEE_API: "https://app.suisentinel.xyz/api/consume-prompt";
176
+ readonly SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet";
177
+ readonly RANDOM: "0x8";
178
+ readonly MIN_FEE_MIST: 100000000n;
179
+ readonly MAX_PROMPT_TOKENS: 600;
180
+ };
181
+
182
+ interface SafeguardConfig {
183
+ locked: boolean;
184
+ maxPerTx: number;
185
+ maxDailySend: number;
186
+ dailyUsed: number;
187
+ dailyResetDate: string;
188
+ maxLeverage?: number;
189
+ maxPositionSize?: number;
190
+ }
191
+ interface TxMetadata {
192
+ operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'sentinel' | 'invest' | 'trade';
193
+ amount?: number;
194
+ }
195
+ declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "sentinel" | "send" | "exchange" | "rebalance" | "pay" | "invest" | "trade">;
196
+ declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
197
+
198
+ declare class SafeguardEnforcer {
199
+ private config;
200
+ private readonly configPath;
201
+ constructor(configDir?: string);
202
+ load(): void;
203
+ assertNotLocked(): void;
204
+ check(metadata: TxMetadata): void;
205
+ recordUsage(amount: number): void;
206
+ lock(): void;
207
+ unlock(): void;
208
+ set(key: string, value: unknown): void;
209
+ getConfig(): SafeguardConfig;
210
+ isConfigured(): boolean;
211
+ private resetDailyIfNewDay;
212
+ private save;
213
+ }
214
+
215
+ interface Contact {
216
+ name: string;
217
+ address: string;
218
+ }
219
+ type ContactMap = Record<string, Contact>;
220
+ declare class ContactManager {
221
+ private contacts;
222
+ private readonly filePath;
223
+ private readonly dir;
224
+ constructor(configDir?: string);
225
+ private load;
226
+ private save;
227
+ add(name: string, address: string): {
228
+ action: 'added' | 'updated';
229
+ };
230
+ remove(name: string): boolean;
231
+ get(name: string): Contact | undefined;
232
+ list(): Contact[];
233
+ resolve(nameOrAddress: string): {
234
+ address: string;
235
+ contactName?: string;
236
+ };
237
+ private validateName;
238
+ }
239
+
240
+ interface StoredPosition {
241
+ totalAmount: number;
242
+ costBasis: number;
243
+ avgPrice: number;
244
+ trades: InvestmentTrade[];
245
+ earning?: boolean;
246
+ earningProtocol?: string;
247
+ earningApy?: number;
248
+ }
249
+ declare class PortfolioManager {
250
+ private data;
251
+ private readonly filePath;
252
+ private readonly dir;
253
+ constructor(configDir?: string);
254
+ private load;
255
+ private save;
256
+ recordBuy(trade: InvestmentTrade): void;
257
+ recordSell(trade: InvestmentTrade): number;
258
+ getPosition(asset: string): StoredPosition | undefined;
259
+ getPositions(): Array<{
260
+ asset: string;
261
+ } & StoredPosition>;
262
+ recordEarn(asset: string, protocol: string, apy: number): void;
263
+ recordUnearn(asset: string): void;
264
+ closePosition(asset: string): void;
265
+ isEarning(asset: string): boolean;
266
+ getRealizedPnL(): number;
267
+ recordStrategyBuy(strategyKey: string, trade: InvestmentTrade): void;
268
+ recordStrategySell(strategyKey: string, trade: InvestmentTrade): number;
269
+ getStrategyPositions(strategyKey: string): Array<{
270
+ asset: string;
271
+ } & StoredPosition>;
272
+ getAllStrategyKeys(): string[];
273
+ clearStrategy(strategyKey: string): void;
274
+ hasStrategyPositions(strategyKey: string): boolean;
275
+ }
276
+
277
+ declare class StrategyManager {
278
+ private data;
279
+ private readonly filePath;
280
+ private readonly dir;
281
+ private seeded;
282
+ constructor(configDir?: string);
283
+ private load;
284
+ private save;
285
+ private seedDefaults;
286
+ getAll(): Record<string, StrategyDefinition>;
287
+ get(name: string): StrategyDefinition;
288
+ create(params: {
289
+ name: string;
290
+ allocations: Record<string, number>;
291
+ description?: string;
292
+ }): StrategyDefinition;
293
+ delete(name: string): void;
294
+ validateAllocations(allocations: Record<string, number>): void;
295
+ validateMinAmount(allocations: Record<string, number>, totalUsd: number): void;
296
+ }
297
+
298
+ declare class AutoInvestManager {
299
+ private data;
300
+ private readonly filePath;
301
+ private readonly dir;
302
+ constructor(configDir?: string);
303
+ private load;
304
+ private save;
305
+ setup(params: {
306
+ amount: number;
307
+ frequency: 'daily' | 'weekly' | 'monthly';
308
+ strategy?: string;
309
+ asset?: string;
310
+ dayOfWeek?: number;
311
+ dayOfMonth?: number;
312
+ }): AutoInvestSchedule;
313
+ getStatus(): AutoInvestStatus;
314
+ getSchedule(id: string): AutoInvestSchedule;
315
+ recordRun(id: string, amountInvested: number): void;
316
+ stop(id: string): void;
317
+ remove(id: string): void;
318
+ }
319
+
320
+ interface T2000Events {
321
+ balanceChange: (event: {
322
+ asset: string;
323
+ previous: number;
324
+ current: number;
325
+ cause: string;
326
+ tx?: string;
327
+ }) => void;
328
+ healthWarning: (event: {
329
+ healthFactor: number;
330
+ threshold: number;
331
+ severity: 'warning';
332
+ }) => void;
333
+ healthCritical: (event: {
334
+ healthFactor: number;
335
+ threshold: number;
336
+ severity: 'critical';
337
+ }) => void;
338
+ yield: (event: {
339
+ earned: number;
340
+ total: number;
341
+ apy: number;
342
+ timestamp: number;
343
+ }) => void;
344
+ gasAutoTopUp: (result: {
345
+ usdcSpent: number;
346
+ suiReceived: number;
347
+ }) => void;
348
+ gasStationFallback: (event: {
349
+ reason: string;
350
+ method: string;
351
+ suiUsed: number;
352
+ }) => void;
353
+ error: (error: T2000Error) => void;
354
+ }
355
+ declare class T2000 extends EventEmitter<T2000Events> {
356
+ private readonly keypair;
357
+ private readonly client;
358
+ private readonly _address;
359
+ private readonly registry;
360
+ readonly enforcer: SafeguardEnforcer;
361
+ readonly contacts: ContactManager;
362
+ readonly portfolio: PortfolioManager;
363
+ readonly strategies: StrategyManager;
364
+ readonly autoInvest: AutoInvestManager;
365
+ private constructor();
366
+ private static createDefaultRegistry;
367
+ static create(options?: T2000Options): Promise<T2000>;
368
+ static fromPrivateKey(privateKey: string, options?: {
369
+ network?: 'mainnet' | 'testnet';
370
+ rpcUrl?: string;
371
+ }): T2000;
372
+ static init(options: {
373
+ pin: string;
374
+ passphrase?: string;
375
+ keyPath?: string;
376
+ name?: string;
377
+ sponsored?: boolean;
378
+ }): Promise<{
379
+ agent: T2000;
380
+ address: string;
381
+ sponsored: boolean;
382
+ }>;
383
+ /** SuiJsonRpcClient used by this agent — exposed for x402 and other integrations. */
384
+ get suiClient(): SuiJsonRpcClient;
385
+ /** Ed25519Keypair used by this agent — exposed for x402 and other integrations. */
386
+ get signer(): Ed25519Keypair;
387
+ address(): string;
388
+ send(params: {
389
+ to: string;
390
+ amount: number;
391
+ asset?: string;
392
+ }): Promise<SendResult>;
393
+ balance(): Promise<BalanceResponse>;
394
+ history(params?: {
395
+ limit?: number;
396
+ }): Promise<TransactionRecord[]>;
397
+ deposit(): Promise<DepositInfo>;
398
+ exportKey(): string;
399
+ registerAdapter(adapter: LendingAdapter | SwapAdapter): Promise<void>;
400
+ save(params: {
401
+ amount: number | 'all';
402
+ protocol?: string;
403
+ }): Promise<SaveResult>;
404
+ withdraw(params: {
405
+ amount: number | 'all';
406
+ protocol?: string;
407
+ }): Promise<WithdrawResult>;
408
+ private withdrawAllProtocols;
409
+ private _fetchCoins;
410
+ private _mergeCoinsInTx;
411
+ private _swapToUsdc;
412
+ private _swapFromUsdc;
413
+ private _convertWalletStablesToUsdc;
414
+ maxWithdraw(): Promise<MaxWithdrawResult>;
415
+ private adjustMaxBorrowForInvestments;
416
+ borrow(params: {
417
+ amount: number;
418
+ protocol?: string;
419
+ }): Promise<BorrowResult>;
420
+ repay(params: {
421
+ amount: number | 'all';
422
+ protocol?: string;
423
+ }): Promise<RepayResult>;
424
+ private _repayAllBorrows;
425
+ maxBorrow(): Promise<MaxBorrowResult>;
426
+ healthFactor(): Promise<HealthFactorResult>;
427
+ exchange(params: {
428
+ from: string;
429
+ to: string;
430
+ amount: number;
431
+ maxSlippage?: number;
432
+ _bypassInvestmentGuard?: boolean;
433
+ }): Promise<SwapResult>;
434
+ exchangeQuote(params: {
435
+ from: string;
436
+ to: string;
437
+ amount: number;
438
+ }): Promise<{
439
+ expectedOutput: number;
440
+ priceImpact: number;
441
+ poolPrice: number;
442
+ fee: {
443
+ amount: number;
444
+ rate: number;
445
+ };
446
+ }>;
447
+ investBuy(params: {
448
+ asset: InvestmentAsset;
449
+ usdAmount: number;
450
+ maxSlippage?: number;
451
+ }): Promise<InvestResult>;
452
+ investSell(params: {
453
+ asset: InvestmentAsset;
454
+ usdAmount: number | 'all';
455
+ maxSlippage?: number;
456
+ _strategyOnly?: boolean;
457
+ }): Promise<InvestResult>;
458
+ investEarn(params: {
459
+ asset: InvestmentAsset;
460
+ protocol?: string;
461
+ }): Promise<InvestEarnResult>;
462
+ investUnearn(params: {
463
+ asset: InvestmentAsset;
464
+ }): Promise<InvestEarnResult>;
465
+ investRebalance(opts?: {
466
+ dryRun?: boolean;
467
+ minYieldDiff?: number;
468
+ }): Promise<InvestRebalanceResult>;
469
+ getPendingRewards(): Promise<PendingReward[]>;
470
+ claimRewards(): Promise<ClaimRewardsResult>;
471
+ private swapRewardTokensToUsdc;
472
+ investStrategy(params: {
473
+ strategy: string;
474
+ usdAmount: number;
475
+ dryRun?: boolean;
476
+ }): Promise<StrategyBuyResult>;
477
+ sellStrategy(params: {
478
+ strategy: string;
479
+ }): Promise<StrategySellResult>;
480
+ rebalanceStrategy(params: {
481
+ strategy: string;
482
+ }): Promise<StrategyRebalanceResult>;
483
+ getStrategyStatus(name: string): Promise<StrategyStatusResult>;
484
+ setupAutoInvest(params: {
485
+ amount: number;
486
+ frequency: 'daily' | 'weekly' | 'monthly';
487
+ strategy?: string;
488
+ asset?: string;
489
+ dayOfWeek?: number;
490
+ dayOfMonth?: number;
491
+ }): AutoInvestSchedule;
492
+ getAutoInvestStatus(): AutoInvestStatus;
493
+ runAutoInvest(): Promise<AutoInvestRunResult>;
494
+ stopAutoInvest(id: string): void;
495
+ getPortfolio(): Promise<PortfolioResult & {
496
+ strategyPositions?: Record<string, InvestmentPosition[]>;
497
+ }>;
498
+ positions(): Promise<PositionsResult>;
499
+ rates(): Promise<RatesResult>;
500
+ allRates(asset?: string): Promise<{
501
+ protocol: string;
502
+ protocolId: string;
503
+ rates: LendingRates;
504
+ }[]>;
505
+ allRatesAcrossAssets(): Promise<{
506
+ protocol: string;
507
+ protocolId: string;
508
+ asset: string;
509
+ rates: LendingRates;
510
+ }[]>;
511
+ rebalance(opts?: {
512
+ dryRun?: boolean;
513
+ minYieldDiff?: number;
514
+ maxBreakEven?: number;
515
+ }): Promise<RebalanceResult>;
516
+ earnings(): Promise<EarningsResult>;
517
+ fundStatus(): Promise<FundStatusResult>;
518
+ sentinelList(): Promise<SentinelAgent[]>;
519
+ sentinelInfo(id: string): Promise<SentinelAgent>;
520
+ sentinelAttack(id: string, prompt: string, fee?: bigint): Promise<SentinelAttackResult>;
521
+ private getFreeBalance;
522
+ private resolveLending;
523
+ private emitBalanceChange;
524
+ }
525
+
526
+ declare function validateAddress(address: string): string;
527
+ declare function truncateAddress(address: string): string;
528
+
529
+ declare function mistToSui(mist: bigint): number;
530
+ declare function suiToMist(sui: number): bigint;
531
+ declare function usdcToRaw(amount: number): bigint;
532
+ declare function rawToUsdc(raw: bigint): number;
533
+ declare function stableToRaw(amount: number, decimals: number): bigint;
534
+ declare function rawToStable(raw: bigint, decimals: number): number;
535
+ declare function getDecimals(asset: SupportedAsset): number;
536
+ declare function formatUsd(amount: number): string;
537
+ declare function formatSui(amount: number): string;
538
+ declare function formatAssetAmount(amount: number, asset: string): string;
539
+
540
+ declare function generateKeypair(): Ed25519Keypair;
541
+ declare function keypairFromPrivateKey(privateKey: string): Ed25519Keypair;
542
+ declare function saveKey(keypair: Ed25519Keypair, passphrase: string, keyPath?: string): Promise<string>;
543
+ declare function loadKey(passphrase: string, keyPath?: string): Promise<Ed25519Keypair>;
544
+ declare function walletExists(keyPath?: string): Promise<boolean>;
545
+ declare function exportPrivateKey(keypair: Ed25519Keypair): string;
546
+ declare function getAddress(keypair: Ed25519Keypair): string;
547
+
548
+ declare function solveHashcash(challenge: string): string;
549
+
550
+ type FeeOperation = 'save' | 'swap' | 'borrow';
551
+ interface ProtocolFeeInfo {
552
+ amount: number;
553
+ asset: string;
554
+ rate: number;
555
+ rawAmount: bigint;
556
+ }
557
+ declare function calculateFee(operation: FeeOperation, amount: number): ProtocolFeeInfo;
558
+ /**
559
+ * Add on-chain fee collection to an existing PTB via t2000::treasury::collect_fee().
560
+ * The Move function splits the fee from the payment coin and stores it in the
561
+ * Treasury's internal Balance<T>. Atomic — reverts with the operation if it fails.
562
+ */
563
+ declare function addCollectFeeToTx(tx: Transaction, paymentCoin: TransactionObjectArgument, operation: FeeOperation): void;
564
+
565
+ interface SimulationResult {
566
+ success: boolean;
567
+ gasEstimateSui: number;
568
+ error?: {
569
+ moveAbortCode?: number;
570
+ moveModule?: string;
571
+ reason: string;
572
+ rawError: string;
573
+ };
574
+ }
575
+ declare function simulateTransaction(client: SuiJsonRpcClient, tx: Transaction, sender: string): Promise<SimulationResult>;
576
+ declare function throwIfSimulationFailed(sim: SimulationResult): void;
577
+
578
+ declare function getPoolPrice(client: SuiJsonRpcClient): Promise<number>;
579
+
580
+ declare function getRates(client: SuiJsonRpcClient): Promise<RatesResult>;
581
+
582
+ type SafeguardRule = 'locked' | 'maxPerTx' | 'maxDailySend';
583
+ interface SafeguardErrorDetails {
584
+ attempted?: number;
585
+ limit?: number;
586
+ current?: number;
587
+ }
588
+ declare class SafeguardError extends T2000Error {
589
+ readonly rule: SafeguardRule;
590
+ readonly details: SafeguardErrorDetails;
591
+ constructor(rule: SafeguardRule, details: SafeguardErrorDetails, message?: string);
592
+ toJSON(): {
593
+ error: "SAFEGUARD_BLOCKED";
594
+ message: string;
595
+ retryable: boolean;
596
+ data: {
597
+ attempted?: number;
598
+ limit?: number;
599
+ current?: number;
600
+ rule: SafeguardRule;
601
+ };
602
+ };
603
+ }
604
+
605
+ interface GasExecutionResult {
606
+ digest: string;
607
+ effects: unknown;
608
+ gasMethod: GasMethod;
609
+ gasCostSui: number;
610
+ }
611
+ /**
612
+ * Gas resolution chain:
613
+ * 1. Self-funded (agent has enough SUI)
614
+ * 2. Auto-topup (swap USDC→SUI, then self-fund)
615
+ * 3. Gas Station sponsored (fallback)
616
+ * 4. Fail with INSUFFICIENT_GAS
617
+ */
618
+ declare function executeWithGas(client: SuiJsonRpcClient, keypair: Ed25519Keypair, buildTx: () => Transaction | Promise<Transaction>, options?: {
619
+ metadata?: TxMetadata;
620
+ enforcer?: SafeguardEnforcer;
621
+ }): Promise<GasExecutionResult>;
622
+
623
+ interface AutoTopUpResult {
624
+ success: boolean;
625
+ tx: string;
626
+ usdcSpent: number;
627
+ suiReceived: number;
628
+ }
629
+ declare function shouldAutoTopUp(client: SuiJsonRpcClient, address: string): Promise<boolean>;
630
+ /**
631
+ * Self-fund a USDC→SUI swap to replenish gas.
632
+ *
633
+ * Uses the agent's remaining SUI to pay for the swap gas (~0.007 SUI).
634
+ * This avoids the chicken-and-egg problem of needing gas station sponsorship
635
+ * to get gas, and works even when the gas station is down.
636
+ */
637
+ declare function executeAutoTopUp(client: SuiJsonRpcClient, keypair: Ed25519Keypair): Promise<AutoTopUpResult>;
638
+
639
+ type GasRequestType = 'bootstrap' | 'auto-topup' | 'fallback';
640
+ interface GasSponsorResponse {
641
+ txBytes: string;
642
+ sponsorSignature: string;
643
+ gasEstimateUsd: number;
644
+ type: GasRequestType;
645
+ }
646
+ interface GasStatusResponse {
647
+ circuitBreaker: boolean;
648
+ suiPrice: number;
649
+ bootstrapUsed?: number;
650
+ bootstrapRemaining?: number;
651
+ }
652
+ declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
653
+
654
+ export { AutoInvestManager, AutoInvestRunResult, AutoInvestSchedule, AutoInvestStatus, type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CLOCK_ID, ClaimRewardsResult, type Contact, ContactManager, type ContactMap, DEFAULT_MAX_LEVERAGE, DEFAULT_MAX_POSITION_SIZE, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DEFAULT_STRATEGIES, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, INVESTMENT_ASSETS, InvestEarnResult, InvestRebalanceResult, InvestResult, type InvestmentAsset, InvestmentPosition, InvestmentTrade, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PERPS_MARKETS, PendingReward, type PerpsMarket, PortfolioManager, PortfolioResult, PositionsResult, type ProtocolFeeInfo, RatesResult, RebalanceResult, RepayResult, SENTINEL, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, SentinelAgent, SentinelAttackResult, type SimulationResult, type StableAsset, StrategyBuyResult, StrategyDefinition, StrategyManager, StrategyRebalanceResult, StrategySellResult, StrategyStatusResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TxMetadata, USDC_DECIMALS, WithdrawResult, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getPoolPrice, getRates, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };