@t2000/sdk 0.19.21 → 0.19.22

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,9 +1,21 @@
1
- import { T as TransactionSigner, I as InvestmentRecord, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, b as T2000Options, P as PayOptions, c as PayResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, L as LendingAdapter, f as SwapAdapter, g as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, h as BorrowResult, R as RepayResult, i as MaxBorrowResult, H as HealthFactorResult, j as SwapResult, k as InvestResult, l as InvestEarnResult, m as InvestRebalanceResult, n as PendingReward, C as ClaimRewardsResult, o as StrategyBuyResult, p as StrategySellResult, q as StrategyRebalanceResult, r as StrategyStatusResult, s as AutoInvestRunResult, t as PortfolioResult, u as InvestmentPosition, v as PositionsResult, w as RatesResult, x as LendingRates, y as RebalanceResult, E as EarningsResult, F as FundStatusResult, z as SentinelAgent, G as SentinelAttackResult, J as GasMethod } from './index-CRyFiIZm.cjs';
2
- export { K as AdapterCapability, N as AdapterPositions, O as AdapterTxResult, Q as AssetRates, U as CetusAdapter, V as GasReserve, X as HealthInfo, Y as InvestRebalanceMove, Z as NaviAdapter, _ as PerpsAdapter, $ as PerpsPosition, a0 as PerpsPositionsResult, a1 as PerpsTradeResult, a2 as PositionEntry, a3 as PositionSide, a4 as ProtocolDescriptor, a5 as ProtocolRegistry, a6 as RebalanceStep, a7 as SentinelVerdict, a8 as SuilendAdapter, a9 as SwapQuote, aa as allDescriptors, ab as cetusDescriptor, ac as getSentinelInfo, ad as listSentinels, ae as naviDescriptor, af as requestAttack, ag as sentinelAttack, ah as sentinelDescriptor, ai as settleAttack, aj as submitPrompt, ak as suilendDescriptor } from './index-CRyFiIZm.cjs';
1
+ import { I as InvestmentRecord, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, T as T2000Options, P as PayOptions, b as PayResult, c as SendResult, B as BalanceResponse, d as TransactionRecord, D as DepositInfo, L as LendingAdapter, e as SwapAdapter, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as SwapResult, j as InvestResult, k as InvestEarnResult, l as InvestRebalanceResult, m as PendingReward, C as ClaimRewardsResult, n as StrategyBuyResult, o as StrategySellResult, p as StrategyRebalanceResult, q as StrategyStatusResult, r as AutoInvestRunResult, s as PortfolioResult, t as InvestmentPosition, u as PositionsResult, v as RatesResult, w as LendingRates, x as RebalanceResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './descriptors-B6qt_mwi.cjs';
2
+ export { y as AdapterCapability, z as AdapterPositions, J as AdapterTxResult, K as AssetRates, N as GasReserve, O as HealthInfo, Q as InvestRebalanceMove, U as PerpsAdapter, V as PerpsPosition, X as PerpsPositionsResult, Y as PerpsTradeResult, Z as PositionEntry, _ as PositionSide, $ as ProtocolDescriptor, a0 as RebalanceStep, a1 as SwapQuote, a2 as allDescriptors, a3 as cetusDescriptor, a4 as naviDescriptor, a5 as suilendDescriptor } from './descriptors-B6qt_mwi.cjs';
3
3
  import { EventEmitter } from 'eventemitter3';
4
4
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
5
5
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
6
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
7
+ export { CetusAdapter, NaviAdapter, ProtocolRegistry, SuilendAdapter } from './adapters/index.cjs';
8
+
9
+ /**
10
+ * Abstract signing interface that decouples the SDK from any specific
11
+ * key management strategy (Ed25519 keypair, zkLogin, multisig, …).
12
+ */
13
+ interface TransactionSigner {
14
+ getAddress(): string;
15
+ signTransaction(txBytes: Uint8Array): Promise<{
16
+ signature: string;
17
+ }>;
18
+ }
7
19
 
8
20
  interface ZkLoginProof {
9
21
  proofPoints: {
@@ -31,7 +43,7 @@ declare class ZkLoginSigner implements TransactionSigner {
31
43
  isExpired(currentEpoch: number): boolean;
32
44
  }
33
45
 
34
- 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' | 'WITHDRAW_FAILED' | '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';
46
+ 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' | 'WITHDRAW_FAILED' | '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' | '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';
35
47
  interface T2000ErrorData {
36
48
  reason?: string;
37
49
  [key: string]: unknown;
@@ -193,17 +205,6 @@ type PerpsMarket = (typeof PERPS_MARKETS)[number];
193
205
  declare const DEFAULT_MAX_LEVERAGE = 5;
194
206
  declare const DEFAULT_MAX_POSITION_SIZE = 1000;
195
207
  declare const GAS_RESERVE_MIN = 0.05;
196
- declare const SENTINEL: {
197
- readonly PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7";
198
- readonly AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac";
199
- readonly ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213";
200
- readonly PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f";
201
- readonly TEE_API: "https://app.suisentinel.xyz/api/consume-prompt";
202
- readonly SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet";
203
- readonly RANDOM: "0x8";
204
- readonly MIN_FEE_MIST: 100000000n;
205
- readonly MAX_PROMPT_TOKENS: 600;
206
- };
207
208
 
208
209
  interface SafeguardConfig {
209
210
  locked: boolean;
@@ -215,10 +216,10 @@ interface SafeguardConfig {
215
216
  maxPositionSize?: number;
216
217
  }
217
218
  interface TxMetadata {
218
- operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'sentinel' | 'invest' | 'trade';
219
+ operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'invest' | 'trade';
219
220
  amount?: number;
220
221
  }
221
- declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "send" | "repay" | "sentinel" | "exchange" | "rebalance" | "pay" | "invest" | "trade">;
222
+ declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "send" | "repay" | "exchange" | "rebalance" | "pay" | "invest" | "trade">;
222
223
  declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
223
224
 
224
225
  declare class SafeguardEnforcer {
@@ -588,9 +589,6 @@ declare class T2000 extends EventEmitter<T2000Events> {
588
589
  }): Promise<RebalanceResult>;
589
590
  earnings(): Promise<EarningsResult>;
590
591
  fundStatus(): Promise<FundStatusResult>;
591
- sentinelList(): Promise<SentinelAgent[]>;
592
- sentinelInfo(id: string): Promise<SentinelAgent>;
593
- sentinelAttack(id: string, prompt: string, fee?: bigint): Promise<SentinelAttackResult>;
594
592
  private getFreeBalance;
595
593
  private resolveLending;
596
594
  private emitBalanceChange;
@@ -738,4 +736,4 @@ interface GasStatusResponse {
738
736
  }
739
737
  declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
740
738
 
741
- 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, InvestmentRecord, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PERPS_MARKETS, PayOptions, PayResult, 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, TransactionSigner, type TxMetadata, USDC_DECIMALS, WithdrawResult, type ZkLoginProof, ZkLoginSigner, 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 };
739
+ 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, InvestmentRecord, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PERPS_MARKETS, PayOptions, PayResult, PendingReward, type PerpsMarket, PortfolioManager, PortfolioResult, PositionsResult, type ProtocolFeeInfo, RatesResult, RebalanceResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StrategyBuyResult, StrategyDefinition, StrategyManager, StrategyRebalanceResult, StrategySellResult, StrategyStatusResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, WithdrawResult, type ZkLoginProof, ZkLoginSigner, 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 };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,21 @@
1
- import { T as TransactionSigner, I as InvestmentRecord, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, b as T2000Options, P as PayOptions, c as PayResult, d as SendResult, B as BalanceResponse, e as TransactionRecord, D as DepositInfo, L as LendingAdapter, f as SwapAdapter, g as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, h as BorrowResult, R as RepayResult, i as MaxBorrowResult, H as HealthFactorResult, j as SwapResult, k as InvestResult, l as InvestEarnResult, m as InvestRebalanceResult, n as PendingReward, C as ClaimRewardsResult, o as StrategyBuyResult, p as StrategySellResult, q as StrategyRebalanceResult, r as StrategyStatusResult, s as AutoInvestRunResult, t as PortfolioResult, u as InvestmentPosition, v as PositionsResult, w as RatesResult, x as LendingRates, y as RebalanceResult, E as EarningsResult, F as FundStatusResult, z as SentinelAgent, G as SentinelAttackResult, J as GasMethod } from './index-CRyFiIZm.js';
2
- export { K as AdapterCapability, N as AdapterPositions, O as AdapterTxResult, Q as AssetRates, U as CetusAdapter, V as GasReserve, X as HealthInfo, Y as InvestRebalanceMove, Z as NaviAdapter, _ as PerpsAdapter, $ as PerpsPosition, a0 as PerpsPositionsResult, a1 as PerpsTradeResult, a2 as PositionEntry, a3 as PositionSide, a4 as ProtocolDescriptor, a5 as ProtocolRegistry, a6 as RebalanceStep, a7 as SentinelVerdict, a8 as SuilendAdapter, a9 as SwapQuote, aa as allDescriptors, ab as cetusDescriptor, ac as getSentinelInfo, ad as listSentinels, ae as naviDescriptor, af as requestAttack, ag as sentinelAttack, ah as sentinelDescriptor, ai as settleAttack, aj as submitPrompt, ak as suilendDescriptor } from './index-CRyFiIZm.js';
1
+ import { I as InvestmentRecord, S as StrategyDefinition, A as AutoInvestSchedule, a as AutoInvestStatus, T as T2000Options, P as PayOptions, b as PayResult, c as SendResult, B as BalanceResponse, d as TransactionRecord, D as DepositInfo, L as LendingAdapter, e as SwapAdapter, f as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, g as BorrowResult, R as RepayResult, h as MaxBorrowResult, H as HealthFactorResult, i as SwapResult, j as InvestResult, k as InvestEarnResult, l as InvestRebalanceResult, m as PendingReward, C as ClaimRewardsResult, n as StrategyBuyResult, o as StrategySellResult, p as StrategyRebalanceResult, q as StrategyStatusResult, r as AutoInvestRunResult, s as PortfolioResult, t as InvestmentPosition, u as PositionsResult, v as RatesResult, w as LendingRates, x as RebalanceResult, E as EarningsResult, F as FundStatusResult, G as GasMethod } from './descriptors-B6qt_mwi.js';
2
+ export { y as AdapterCapability, z as AdapterPositions, J as AdapterTxResult, K as AssetRates, N as GasReserve, O as HealthInfo, Q as InvestRebalanceMove, U as PerpsAdapter, V as PerpsPosition, X as PerpsPositionsResult, Y as PerpsTradeResult, Z as PositionEntry, _ as PositionSide, $ as ProtocolDescriptor, a0 as RebalanceStep, a1 as SwapQuote, a2 as allDescriptors, a3 as cetusDescriptor, a4 as naviDescriptor, a5 as suilendDescriptor } from './descriptors-B6qt_mwi.js';
3
3
  import { EventEmitter } from 'eventemitter3';
4
4
  import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
5
5
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
6
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
7
+ export { CetusAdapter, NaviAdapter, ProtocolRegistry, SuilendAdapter } from './adapters/index.js';
8
+
9
+ /**
10
+ * Abstract signing interface that decouples the SDK from any specific
11
+ * key management strategy (Ed25519 keypair, zkLogin, multisig, …).
12
+ */
13
+ interface TransactionSigner {
14
+ getAddress(): string;
15
+ signTransaction(txBytes: Uint8Array): Promise<{
16
+ signature: string;
17
+ }>;
18
+ }
7
19
 
8
20
  interface ZkLoginProof {
9
21
  proofPoints: {
@@ -31,7 +43,7 @@ declare class ZkLoginSigner implements TransactionSigner {
31
43
  isExpired(currentEpoch: number): boolean;
32
44
  }
33
45
 
34
- 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' | 'WITHDRAW_FAILED' | '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';
46
+ 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' | 'WITHDRAW_FAILED' | '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' | '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';
35
47
  interface T2000ErrorData {
36
48
  reason?: string;
37
49
  [key: string]: unknown;
@@ -193,17 +205,6 @@ type PerpsMarket = (typeof PERPS_MARKETS)[number];
193
205
  declare const DEFAULT_MAX_LEVERAGE = 5;
194
206
  declare const DEFAULT_MAX_POSITION_SIZE = 1000;
195
207
  declare const GAS_RESERVE_MIN = 0.05;
196
- declare const SENTINEL: {
197
- readonly PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7";
198
- readonly AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac";
199
- readonly ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213";
200
- readonly PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f";
201
- readonly TEE_API: "https://app.suisentinel.xyz/api/consume-prompt";
202
- readonly SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet";
203
- readonly RANDOM: "0x8";
204
- readonly MIN_FEE_MIST: 100000000n;
205
- readonly MAX_PROMPT_TOKENS: 600;
206
- };
207
208
 
208
209
  interface SafeguardConfig {
209
210
  locked: boolean;
@@ -215,10 +216,10 @@ interface SafeguardConfig {
215
216
  maxPositionSize?: number;
216
217
  }
217
218
  interface TxMetadata {
218
- operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'sentinel' | 'invest' | 'trade';
219
+ operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'invest' | 'trade';
219
220
  amount?: number;
220
221
  }
221
- declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "send" | "repay" | "sentinel" | "exchange" | "rebalance" | "pay" | "invest" | "trade">;
222
+ declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "send" | "repay" | "exchange" | "rebalance" | "pay" | "invest" | "trade">;
222
223
  declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
223
224
 
224
225
  declare class SafeguardEnforcer {
@@ -588,9 +589,6 @@ declare class T2000 extends EventEmitter<T2000Events> {
588
589
  }): Promise<RebalanceResult>;
589
590
  earnings(): Promise<EarningsResult>;
590
591
  fundStatus(): Promise<FundStatusResult>;
591
- sentinelList(): Promise<SentinelAgent[]>;
592
- sentinelInfo(id: string): Promise<SentinelAgent>;
593
- sentinelAttack(id: string, prompt: string, fee?: bigint): Promise<SentinelAttackResult>;
594
592
  private getFreeBalance;
595
593
  private resolveLending;
596
594
  private emitBalanceChange;
@@ -738,4 +736,4 @@ interface GasStatusResponse {
738
736
  }
739
737
  declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
740
738
 
741
- 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, InvestmentRecord, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PERPS_MARKETS, PayOptions, PayResult, 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, TransactionSigner, type TxMetadata, USDC_DECIMALS, WithdrawResult, type ZkLoginProof, ZkLoginSigner, 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 };
739
+ 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, InvestmentRecord, KeypairSigner, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PERPS_MARKETS, PayOptions, PayResult, PendingReward, type PerpsMarket, PortfolioManager, PortfolioResult, PositionsResult, type ProtocolFeeInfo, RatesResult, RebalanceResult, RepayResult, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, type SimulationResult, type StableAsset, StrategyBuyResult, StrategyDefinition, StrategyManager, StrategyRebalanceResult, StrategySellResult, StrategyStatusResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TransactionSigner, type TxMetadata, USDC_DECIMALS, WithdrawResult, type ZkLoginProof, ZkLoginSigner, 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 };
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ import { access, mkdir, writeFile, readFile } from 'fs/promises';
9
9
  import { join, dirname, resolve } from 'path';
10
10
  import { homedir } from 'os';
11
11
  import { getPools, getLendingPositions, getHealthFactor as getHealthFactor$1, depositCoinPTB, withdrawCoinPTB, borrowCoinPTB, repayCoinPTB, getUserAvailableLendingRewards, summaryLendingRewards, claimLendingRewardsPTB, updateOraclePriceBeforeUserOperationPTB } from '@naviprotocol/lending';
12
- import { bcs } from '@mysten/sui/bcs';
13
12
  import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk';
14
13
  import { SuilendClient, LENDING_MARKET_ID, LENDING_MARKET_TYPE } from '@suilend/sdk/client';
15
14
  import { initializeSuilend, initializeObligations } from '@suilend/sdk/lib/initialize';
@@ -133,18 +132,6 @@ var PERPS_MARKETS = ["SUI-PERP"];
133
132
  var DEFAULT_MAX_LEVERAGE = 5;
134
133
  var DEFAULT_MAX_POSITION_SIZE = 1e3;
135
134
  var GAS_RESERVE_MIN = 0.05;
136
- var SENTINEL = {
137
- PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7",
138
- AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac",
139
- ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213",
140
- PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f",
141
- TEE_API: "https://app.suisentinel.xyz/api/consume-prompt",
142
- SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet",
143
- RANDOM: "0x8",
144
- MIN_FEE_MIST: 100000000n,
145
- // 0.1 SUI
146
- MAX_PROMPT_TOKENS: 600
147
- };
148
135
 
149
136
  // src/errors.ts
150
137
  var T2000Error = class extends Error {
@@ -927,6 +914,7 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
927
914
  }
928
915
  async function addWithdrawToTx(tx, client, address, amount, options = {}) {
929
916
  const asset = options.asset ?? "USDC";
917
+ const sponsored = options.sponsored ?? true;
930
918
  const assetInfo = resolveAssetInfo(asset);
931
919
  const posResult = await getPositions(client, address);
932
920
  const supply = posResult.positions.find(
@@ -944,7 +932,7 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
944
932
  });
945
933
  return { coin, effectiveAmount: 0 };
946
934
  }
947
- await refreshOracle(tx, client, address);
935
+ await refreshOracle(tx, client, address, { skipPythUpdate: sponsored });
948
936
  try {
949
937
  const coin = await withdrawCoinPTB(tx, assetInfo.type, rawAmount, sdkOptions(client));
950
938
  return { coin, effectiveAmount };
@@ -968,8 +956,9 @@ async function addSaveToTx(tx, _client, _address, coin, options = {}) {
968
956
  }
969
957
  async function addRepayToTx(tx, client, address, coin, options = {}) {
970
958
  const asset = options.asset ?? "USDC";
959
+ const sponsored = options.sponsored ?? true;
971
960
  const assetInfo = resolveAssetInfo(asset);
972
- await refreshOracle(tx, client, address);
961
+ await refreshOracle(tx, client, address, { skipPythUpdate: sponsored });
973
962
  try {
974
963
  await repayCoinPTB(tx, assetInfo.type, coin, { env: "prod" });
975
964
  } catch (err) {
@@ -1130,206 +1119,6 @@ async function getFundStatus(client, address) {
1130
1119
  projectedMonthly: earnings.dailyEarning * 30
1131
1120
  };
1132
1121
  }
1133
- var descriptor = {
1134
- id: "sentinel",
1135
- name: "Sui Sentinel",
1136
- packages: [SENTINEL.PACKAGE],
1137
- actionMap: {
1138
- "sentinel::request_attack": "sentinel_attack",
1139
- "sentinel::consume_prompt": "sentinel_settle"
1140
- }
1141
- };
1142
- function mapAgent(raw) {
1143
- return {
1144
- id: raw.agent_id,
1145
- objectId: raw.agent_object_id,
1146
- name: raw.agent_name,
1147
- model: raw.model ?? "unknown",
1148
- systemPrompt: raw.prompt,
1149
- attackFee: BigInt(raw.cost_per_message),
1150
- prizePool: BigInt(raw.total_balance),
1151
- totalAttacks: raw.total_attacks,
1152
- successfulBreaches: raw.successful_breaches ?? 0,
1153
- state: raw.state
1154
- };
1155
- }
1156
- async function listSentinels() {
1157
- const res = await fetch(SENTINEL.SENTINELS_API);
1158
- if (!res.ok) {
1159
- throw new T2000Error("SENTINEL_API_ERROR", `Sentinel API returned ${res.status}`);
1160
- }
1161
- const data = await res.json();
1162
- if (!Array.isArray(data.agents)) {
1163
- throw new T2000Error("SENTINEL_API_ERROR", "Unexpected API response shape");
1164
- }
1165
- return data.agents.filter((a) => a.state === "active").map(mapAgent);
1166
- }
1167
- async function getSentinelInfo(client, sentinelObjectId) {
1168
- const agents = await listSentinels();
1169
- const match = agents.find((a) => a.objectId === sentinelObjectId || a.id === sentinelObjectId);
1170
- if (match) return match;
1171
- const obj = await client.getObject({
1172
- id: sentinelObjectId,
1173
- options: { showContent: true, showType: true }
1174
- });
1175
- if (!obj.data) {
1176
- throw new T2000Error("SENTINEL_NOT_FOUND", `Sentinel ${sentinelObjectId} not found on-chain`);
1177
- }
1178
- const content = obj.data.content;
1179
- if (!content || content.dataType !== "moveObject") {
1180
- throw new T2000Error("SENTINEL_NOT_FOUND", `Object ${sentinelObjectId} is not a Move object`);
1181
- }
1182
- const fields = content.fields;
1183
- return {
1184
- id: fields.id?.id ?? sentinelObjectId,
1185
- objectId: sentinelObjectId,
1186
- name: fields.name ?? "Unknown",
1187
- model: fields.model ?? "unknown",
1188
- systemPrompt: fields.system_prompt ?? "",
1189
- attackFee: BigInt(fields.cost_per_message ?? "0"),
1190
- prizePool: BigInt(fields.balance ?? "0"),
1191
- totalAttacks: Number(fields.total_attacks ?? "0"),
1192
- successfulBreaches: Number(fields.successful_breaches ?? "0"),
1193
- state: fields.state ?? "unknown"
1194
- };
1195
- }
1196
- async function requestAttack(client, signer, sentinelObjectId, feeMist) {
1197
- if (feeMist < SENTINEL.MIN_FEE_MIST) {
1198
- throw new T2000Error("INVALID_AMOUNT", `Attack fee must be at least 0.1 SUI (${SENTINEL.MIN_FEE_MIST} MIST)`);
1199
- }
1200
- const address = signer.getAddress();
1201
- const tx = new Transaction();
1202
- tx.setSender(address);
1203
- const [coin] = tx.splitCoins(tx.gas, [Number(feeMist)]);
1204
- const [attack2] = tx.moveCall({
1205
- target: `${SENTINEL.PACKAGE}::sentinel::request_attack`,
1206
- arguments: [
1207
- tx.object(SENTINEL.AGENT_REGISTRY),
1208
- tx.object(sentinelObjectId),
1209
- tx.object(SENTINEL.PROTOCOL_CONFIG),
1210
- coin,
1211
- tx.object(SENTINEL.RANDOM),
1212
- tx.object(CLOCK_ID)
1213
- ]
1214
- });
1215
- tx.transferObjects([attack2], address);
1216
- const built = await tx.build({ client });
1217
- const { signature } = await signer.signTransaction(built);
1218
- const result = await client.executeTransactionBlock({
1219
- transactionBlock: built,
1220
- signature,
1221
- options: { showObjectChanges: true, showEffects: true }
1222
- });
1223
- await client.waitForTransaction({ digest: result.digest });
1224
- const attackObj = result.objectChanges?.find(
1225
- (c) => c.type === "created" && c.objectType?.includes("::sentinel::Attack")
1226
- );
1227
- const attackObjectId = attackObj && "objectId" in attackObj ? attackObj.objectId : void 0;
1228
- if (!attackObjectId) {
1229
- throw new T2000Error("SENTINEL_TX_FAILED", "Attack object was not created \u2014 transaction may have failed");
1230
- }
1231
- return { attackObjectId, digest: result.digest };
1232
- }
1233
- async function submitPrompt(agentId, attackObjectId, prompt) {
1234
- const res = await fetch(SENTINEL.TEE_API, {
1235
- method: "POST",
1236
- headers: { "Content-Type": "application/json" },
1237
- body: JSON.stringify({
1238
- agent_id: agentId,
1239
- attack_object_id: attackObjectId,
1240
- message: prompt
1241
- })
1242
- });
1243
- if (!res.ok) {
1244
- const body = await res.text().catch(() => "");
1245
- throw new T2000Error("SENTINEL_TEE_ERROR", `TEE returned ${res.status}: ${body.slice(0, 200)}`);
1246
- }
1247
- const raw = await res.json();
1248
- const envelope = raw.response ?? raw;
1249
- const data = envelope.data ?? envelope;
1250
- const signature = raw.signature ?? data.signature;
1251
- const timestampMs = envelope.timestamp_ms ?? data.timestamp_ms;
1252
- if (typeof signature !== "string") {
1253
- throw new T2000Error("SENTINEL_TEE_ERROR", "TEE response missing signature");
1254
- }
1255
- return {
1256
- success: data.success ?? data.is_success,
1257
- score: data.score,
1258
- agentResponse: data.agent_response,
1259
- juryResponse: data.jury_response,
1260
- funResponse: data.fun_response ?? "",
1261
- signature,
1262
- timestampMs
1263
- };
1264
- }
1265
- async function settleAttack(client, signer, sentinelObjectId, attackObjectId, prompt, verdict) {
1266
- const sigBytes = Array.from(Buffer.from(verdict.signature.replace(/^0x/, ""), "hex"));
1267
- const address = signer.getAddress();
1268
- const tx = new Transaction();
1269
- tx.setSender(address);
1270
- tx.moveCall({
1271
- target: `${SENTINEL.PACKAGE}::sentinel::consume_prompt`,
1272
- arguments: [
1273
- tx.object(SENTINEL.AGENT_REGISTRY),
1274
- tx.object(SENTINEL.PROTOCOL_CONFIG),
1275
- tx.object(sentinelObjectId),
1276
- tx.pure.bool(verdict.success),
1277
- tx.pure.string(verdict.agentResponse),
1278
- tx.pure.string(verdict.juryResponse),
1279
- tx.pure.string(verdict.funResponse),
1280
- tx.pure.string(prompt),
1281
- tx.pure.u8(verdict.score),
1282
- tx.pure.u64(verdict.timestampMs),
1283
- tx.pure(bcs.vector(bcs.u8()).serialize(sigBytes)),
1284
- tx.object(SENTINEL.ENCLAVE),
1285
- tx.object(attackObjectId),
1286
- tx.object(CLOCK_ID)
1287
- ]
1288
- });
1289
- const built = await tx.build({ client });
1290
- const { signature } = await signer.signTransaction(built);
1291
- const result = await client.executeTransactionBlock({
1292
- transactionBlock: built,
1293
- signature,
1294
- options: { showEffects: true }
1295
- });
1296
- await client.waitForTransaction({ digest: result.digest });
1297
- const txSuccess = result.effects?.status?.status === "success";
1298
- return { digest: result.digest, success: txSuccess };
1299
- }
1300
- async function attack(client, signer, sentinelId, prompt, feeMist) {
1301
- const sentinel = await getSentinelInfo(client, sentinelId);
1302
- const fee = feeMist ?? sentinel.attackFee;
1303
- if (fee < SENTINEL.MIN_FEE_MIST) {
1304
- throw new T2000Error("INVALID_AMOUNT", `Attack fee must be at least 0.1 SUI`);
1305
- }
1306
- const { attackObjectId, digest: requestTx } = await requestAttack(
1307
- client,
1308
- signer,
1309
- sentinel.objectId,
1310
- fee
1311
- );
1312
- const verdict = await submitPrompt(sentinel.id, attackObjectId, prompt);
1313
- const { digest: settleTx } = await settleAttack(
1314
- client,
1315
- signer,
1316
- sentinel.objectId,
1317
- attackObjectId,
1318
- prompt,
1319
- verdict
1320
- );
1321
- const won = verdict.success && verdict.score >= 70;
1322
- return {
1323
- attackObjectId,
1324
- sentinelId: sentinel.id,
1325
- prompt,
1326
- verdict,
1327
- requestTx,
1328
- settleTx,
1329
- won,
1330
- feePaid: Number(fee) / Number(MIST_PER_SUI)
1331
- };
1332
- }
1333
1122
 
1334
1123
  // src/adapters/registry.ts
1335
1124
  var ProtocolRegistry = class {
@@ -1476,8 +1265,9 @@ var ProtocolRegistry = class {
1476
1265
  }
1477
1266
  };
1478
1267
 
1479
- // src/adapters/navi.ts
1480
- var descriptor2 = {
1268
+ // src/adapters/descriptors.ts
1269
+ var SUILEND_PACKAGE = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
1270
+ var naviDescriptor = {
1481
1271
  id: "navi",
1482
1272
  name: "NAVI Protocol",
1483
1273
  packages: [],
@@ -1493,6 +1283,42 @@ var descriptor2 = {
1493
1283
  "incentive_v3::repay": "repay"
1494
1284
  }
1495
1285
  };
1286
+ var suilendDescriptor = {
1287
+ id: "suilend",
1288
+ name: "Suilend",
1289
+ packages: [SUILEND_PACKAGE],
1290
+ actionMap: {
1291
+ "lending_market::deposit_liquidity_and_mint_ctokens": "save",
1292
+ "lending_market::deposit_ctokens_into_obligation": "save",
1293
+ "lending_market::create_obligation": "save",
1294
+ "lending_market::withdraw_ctokens": "withdraw",
1295
+ "lending_market::redeem_ctokens_and_withdraw_liquidity": "withdraw",
1296
+ "lending_market::redeem_ctokens_and_withdraw_liquidity_request": "withdraw",
1297
+ "lending_market::fulfill_liquidity_request": "withdraw",
1298
+ "lending_market::unstake_sui_from_staker": "withdraw",
1299
+ "lending_market::borrow": "borrow",
1300
+ "lending_market::repay": "repay"
1301
+ }
1302
+ };
1303
+ var cetusDescriptor = {
1304
+ id: "cetus",
1305
+ name: "Cetus DEX",
1306
+ packages: [CETUS_PACKAGE],
1307
+ actionMap: {
1308
+ "router::swap": "swap",
1309
+ "router::swap_ab_bc": "swap",
1310
+ "router::swap_ab_cb": "swap",
1311
+ "router::swap_ba_bc": "swap",
1312
+ "router::swap_ba_cb": "swap"
1313
+ }
1314
+ };
1315
+ var allDescriptors = [
1316
+ naviDescriptor,
1317
+ suilendDescriptor,
1318
+ cetusDescriptor
1319
+ ];
1320
+
1321
+ // src/adapters/navi.ts
1496
1322
  var NaviAdapter = class {
1497
1323
  id = "navi";
1498
1324
  name = "NAVI Protocol";
@@ -1772,18 +1598,6 @@ function fallbackQuote(fromAsset, amount, poolPrice) {
1772
1598
  }
1773
1599
 
1774
1600
  // src/adapters/cetus.ts
1775
- var descriptor3 = {
1776
- id: "cetus",
1777
- name: "Cetus DEX",
1778
- packages: [CETUS_PACKAGE],
1779
- actionMap: {
1780
- "router::swap": "swap",
1781
- "router::swap_ab_bc": "swap",
1782
- "router::swap_ab_cb": "swap",
1783
- "router::swap_ba_bc": "swap",
1784
- "router::swap_ba_cb": "swap"
1785
- }
1786
- };
1787
1601
  var CetusAdapter = class {
1788
1602
  id = "cetus";
1789
1603
  name = "Cetus";
@@ -1842,7 +1656,6 @@ var CetusAdapter = class {
1842
1656
  });
1843
1657
  }
1844
1658
  };
1845
- var SUILEND_PACKAGE = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
1846
1659
  var MIN_HEALTH_FACTOR2 = 1.5;
1847
1660
  async function quietSuilend(fn) {
1848
1661
  const origLog = console.log;
@@ -1859,23 +1672,6 @@ async function quietSuilend(fn) {
1859
1672
  console.warn = origWarn;
1860
1673
  });
1861
1674
  }
1862
- var descriptor4 = {
1863
- id: "suilend",
1864
- name: "Suilend",
1865
- packages: [SUILEND_PACKAGE],
1866
- actionMap: {
1867
- "lending_market::deposit_liquidity_and_mint_ctokens": "save",
1868
- "lending_market::deposit_ctokens_into_obligation": "save",
1869
- "lending_market::create_obligation": "save",
1870
- "lending_market::withdraw_ctokens": "withdraw",
1871
- "lending_market::redeem_ctokens_and_withdraw_liquidity": "withdraw",
1872
- "lending_market::redeem_ctokens_and_withdraw_liquidity_request": "withdraw",
1873
- "lending_market::fulfill_liquidity_request": "withdraw",
1874
- "lending_market::unstake_sui_from_staker": "withdraw",
1875
- "lending_market::borrow": "borrow",
1876
- "lending_market::repay": "repay"
1877
- }
1878
- };
1879
1675
  var SuilendAdapter = class {
1880
1676
  id = "suilend";
1881
1677
  name = "Suilend";
@@ -2683,8 +2479,7 @@ async function resolveGas(client, signer, buildTx) {
2683
2479
  // src/safeguards/types.ts
2684
2480
  var OUTBOUND_OPS = /* @__PURE__ */ new Set([
2685
2481
  "send",
2686
- "pay",
2687
- "sentinel"
2482
+ "pay"
2688
2483
  ]);
2689
2484
  var DEFAULT_SAFEGUARD_CONFIG = {
2690
2485
  locked: false,
@@ -5952,17 +5747,6 @@ var T2000 = class _T2000 extends EventEmitter {
5952
5747
  async fundStatus() {
5953
5748
  return getFundStatus(this.client, this._address);
5954
5749
  }
5955
- // -- Sentinel --
5956
- async sentinelList() {
5957
- return listSentinels();
5958
- }
5959
- async sentinelInfo(id) {
5960
- return getSentinelInfo(this.client, id);
5961
- }
5962
- async sentinelAttack(id, prompt, fee) {
5963
- this.enforcer.check({ operation: "sentinel", amount: fee ? Number(fee) / 1e9 : 0.1 });
5964
- return attack(this.client, this._signer, id, prompt, fee);
5965
- }
5966
5750
  // -- Helpers --
5967
5751
  async getFreeBalance(asset) {
5968
5752
  if (!(asset in INVESTMENT_ASSETS)) return Infinity;
@@ -6115,14 +5899,6 @@ function parseMoveAbort(errorStr) {
6115
5899
  return { reason: errorStr };
6116
5900
  }
6117
5901
 
6118
- // src/adapters/index.ts
6119
- var allDescriptors = [
6120
- descriptor2,
6121
- descriptor4,
6122
- descriptor3,
6123
- descriptor
6124
- ];
6125
-
6126
- export { AutoInvestManager, BPS_DENOMINATOR, CLOCK_ID, CetusAdapter, ContactManager, DEFAULT_MAX_LEVERAGE, DEFAULT_MAX_POSITION_SIZE, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DEFAULT_STRATEGIES, GAS_RESERVE_MIN, INVESTMENT_ASSETS, KeypairSigner, MIST_PER_SUI, NaviAdapter, OUTBOUND_OPS, PERPS_MARKETS, PortfolioManager, ProtocolRegistry, SENTINEL, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, StrategyManager, SuilendAdapter, T2000, T2000Error, USDC_DECIMALS, ZkLoginSigner, addCollectFeeToTx, allDescriptors, calculateFee, descriptor3 as cetusDescriptor, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getPoolPrice, getRates, getSentinelInfo, keypairFromPrivateKey, listSentinels, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, descriptor2 as naviDescriptor, rawToStable, rawToUsdc, requestAttack, saveKey, attack as sentinelAttack, descriptor as sentinelDescriptor, settleAttack, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, submitPrompt, suiToMist, descriptor4 as suilendDescriptor, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
5902
+ export { AutoInvestManager, BPS_DENOMINATOR, CLOCK_ID, CetusAdapter, ContactManager, DEFAULT_MAX_LEVERAGE, DEFAULT_MAX_POSITION_SIZE, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DEFAULT_STRATEGIES, GAS_RESERVE_MIN, INVESTMENT_ASSETS, KeypairSigner, MIST_PER_SUI, NaviAdapter, OUTBOUND_OPS, PERPS_MARKETS, PortfolioManager, ProtocolRegistry, STABLE_ASSETS, SUI_DECIMALS, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, StrategyManager, SuilendAdapter, T2000, T2000Error, USDC_DECIMALS, ZkLoginSigner, addCollectFeeToTx, allDescriptors, calculateFee, cetusDescriptor, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getPoolPrice, getRates, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, suilendDescriptor, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
6127
5903
  //# sourceMappingURL=index.js.map
6128
5904
  //# sourceMappingURL=index.js.map