@t2000/sdk 0.3.0 → 0.4.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/adapters/index.cjs +856 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +3 -0
- package/dist/adapters/index.d.ts +3 -0
- package/dist/adapters/index.js +851 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/index-DYQv9Wxo.d.cts +393 -0
- package/dist/index-DYQv9Wxo.d.ts +393 -0
- package/dist/index.cjs +703 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -172
- package/dist/index.d.ts +17 -172
- package/dist/index.js +702 -154
- package/dist/index.js.map +1 -1
- package/package.json +15 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,179 +1,10 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiClient } from '@mysten/sui/client';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
+
import { T as T2000Options, S as SendResult, B as BalanceResponse, a as TransactionRecord, D as DepositInfo, L as LendingAdapter, b as SwapAdapter, c as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, d as BorrowResult, R as RepayResult, e as MaxBorrowResult, H as HealthFactorResult, f as SwapResult, P as PositionsResult, g as RatesResult, h as LendingRates, E as EarningsResult, F as FundStatusResult, i as SentinelAgent, j as SentinelAttackResult, k as SentinelVerdict, G as GasMethod } from './index-DYQv9Wxo.cjs';
|
|
5
|
+
export { A as AdapterCapability, l as AdapterPositions, m as AdapterTxResult, C as CetusAdapter, n as GasReserve, o as HealthInfo, N as NaviAdapter, p as PositionEntry, q as ProtocolRegistry, r as SuilendAdapter, s as SwapQuote } from './index-DYQv9Wxo.cjs';
|
|
4
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
7
|
|
|
6
|
-
interface T2000Options {
|
|
7
|
-
keyPath?: string;
|
|
8
|
-
/** PIN to decrypt the key file. Accepts any string (4+ chars). */
|
|
9
|
-
pin?: string;
|
|
10
|
-
/** @deprecated Use `pin` instead. */
|
|
11
|
-
passphrase?: string;
|
|
12
|
-
network?: 'mainnet' | 'testnet';
|
|
13
|
-
rpcUrl?: string;
|
|
14
|
-
sponsored?: boolean;
|
|
15
|
-
name?: string;
|
|
16
|
-
}
|
|
17
|
-
interface GasReserve {
|
|
18
|
-
sui: number;
|
|
19
|
-
usdEquiv: number;
|
|
20
|
-
}
|
|
21
|
-
interface BalanceResponse {
|
|
22
|
-
available: number;
|
|
23
|
-
savings: number;
|
|
24
|
-
gasReserve: GasReserve;
|
|
25
|
-
total: number;
|
|
26
|
-
assets: Record<string, number>;
|
|
27
|
-
}
|
|
28
|
-
type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup';
|
|
29
|
-
interface SendResult {
|
|
30
|
-
success: boolean;
|
|
31
|
-
tx: string;
|
|
32
|
-
amount: number;
|
|
33
|
-
to: string;
|
|
34
|
-
gasCost: number;
|
|
35
|
-
gasCostUnit: string;
|
|
36
|
-
gasMethod: GasMethod;
|
|
37
|
-
balance: BalanceResponse;
|
|
38
|
-
}
|
|
39
|
-
interface SaveResult {
|
|
40
|
-
success: boolean;
|
|
41
|
-
tx: string;
|
|
42
|
-
amount: number;
|
|
43
|
-
apy: number;
|
|
44
|
-
fee: number;
|
|
45
|
-
gasCost: number;
|
|
46
|
-
gasMethod: GasMethod;
|
|
47
|
-
savingsBalance: number;
|
|
48
|
-
}
|
|
49
|
-
interface WithdrawResult {
|
|
50
|
-
success: boolean;
|
|
51
|
-
tx: string;
|
|
52
|
-
amount: number;
|
|
53
|
-
gasCost: number;
|
|
54
|
-
gasMethod: GasMethod;
|
|
55
|
-
}
|
|
56
|
-
interface BorrowResult {
|
|
57
|
-
success: boolean;
|
|
58
|
-
tx: string;
|
|
59
|
-
amount: number;
|
|
60
|
-
fee: number;
|
|
61
|
-
healthFactor: number;
|
|
62
|
-
gasCost: number;
|
|
63
|
-
gasMethod: GasMethod;
|
|
64
|
-
}
|
|
65
|
-
interface RepayResult {
|
|
66
|
-
success: boolean;
|
|
67
|
-
tx: string;
|
|
68
|
-
amount: number;
|
|
69
|
-
remainingDebt: number;
|
|
70
|
-
gasCost: number;
|
|
71
|
-
gasMethod: GasMethod;
|
|
72
|
-
}
|
|
73
|
-
interface SwapResult {
|
|
74
|
-
success: boolean;
|
|
75
|
-
tx: string;
|
|
76
|
-
fromAmount: number;
|
|
77
|
-
fromAsset: string;
|
|
78
|
-
toAmount: number;
|
|
79
|
-
toAsset: string;
|
|
80
|
-
priceImpact: number;
|
|
81
|
-
fee: number;
|
|
82
|
-
gasCost: number;
|
|
83
|
-
gasMethod: GasMethod;
|
|
84
|
-
}
|
|
85
|
-
interface HealthFactorResult {
|
|
86
|
-
healthFactor: number;
|
|
87
|
-
supplied: number;
|
|
88
|
-
borrowed: number;
|
|
89
|
-
maxBorrow: number;
|
|
90
|
-
liquidationThreshold: number;
|
|
91
|
-
}
|
|
92
|
-
interface MaxWithdrawResult {
|
|
93
|
-
maxAmount: number;
|
|
94
|
-
healthFactorAfter: number;
|
|
95
|
-
currentHF: number;
|
|
96
|
-
}
|
|
97
|
-
interface MaxBorrowResult {
|
|
98
|
-
maxAmount: number;
|
|
99
|
-
healthFactorAfter: number;
|
|
100
|
-
currentHF: number;
|
|
101
|
-
}
|
|
102
|
-
interface RatesResult {
|
|
103
|
-
USDC: {
|
|
104
|
-
saveApy: number;
|
|
105
|
-
borrowApy: number;
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
interface PositionEntry {
|
|
109
|
-
protocol: string;
|
|
110
|
-
asset: string;
|
|
111
|
-
type: 'save' | 'borrow';
|
|
112
|
-
amount: number;
|
|
113
|
-
apy: number;
|
|
114
|
-
}
|
|
115
|
-
interface PositionsResult {
|
|
116
|
-
positions: PositionEntry[];
|
|
117
|
-
}
|
|
118
|
-
interface EarningsResult {
|
|
119
|
-
totalYieldEarned: number;
|
|
120
|
-
currentApy: number;
|
|
121
|
-
dailyEarning: number;
|
|
122
|
-
supplied: number;
|
|
123
|
-
}
|
|
124
|
-
interface FundStatusResult {
|
|
125
|
-
supplied: number;
|
|
126
|
-
apy: number;
|
|
127
|
-
earnedToday: number;
|
|
128
|
-
earnedAllTime: number;
|
|
129
|
-
projectedMonthly: number;
|
|
130
|
-
}
|
|
131
|
-
interface DepositInfo {
|
|
132
|
-
address: string;
|
|
133
|
-
network: string;
|
|
134
|
-
supportedAssets: string[];
|
|
135
|
-
instructions: string;
|
|
136
|
-
}
|
|
137
|
-
interface TransactionRecord {
|
|
138
|
-
digest: string;
|
|
139
|
-
action: string;
|
|
140
|
-
amount?: number;
|
|
141
|
-
asset?: string;
|
|
142
|
-
timestamp: number;
|
|
143
|
-
gasMethod?: GasMethod;
|
|
144
|
-
}
|
|
145
|
-
interface SentinelAgent {
|
|
146
|
-
id: string;
|
|
147
|
-
objectId: string;
|
|
148
|
-
name: string;
|
|
149
|
-
model: string;
|
|
150
|
-
systemPrompt: string;
|
|
151
|
-
attackFee: bigint;
|
|
152
|
-
prizePool: bigint;
|
|
153
|
-
totalAttacks: number;
|
|
154
|
-
successfulBreaches: number;
|
|
155
|
-
state: string;
|
|
156
|
-
}
|
|
157
|
-
interface SentinelVerdict {
|
|
158
|
-
success: boolean;
|
|
159
|
-
score: number;
|
|
160
|
-
agentResponse: string;
|
|
161
|
-
juryResponse: string;
|
|
162
|
-
funResponse: string;
|
|
163
|
-
signature: string;
|
|
164
|
-
timestampMs: number;
|
|
165
|
-
}
|
|
166
|
-
interface SentinelAttackResult {
|
|
167
|
-
attackObjectId: string;
|
|
168
|
-
sentinelId: string;
|
|
169
|
-
prompt: string;
|
|
170
|
-
verdict: SentinelVerdict;
|
|
171
|
-
requestTx: string;
|
|
172
|
-
settleTx: string;
|
|
173
|
-
won: boolean;
|
|
174
|
-
feePaid: number;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
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' | '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' | 'FACILITATOR_TIMEOUT' | 'SENTINEL_API_ERROR' | 'SENTINEL_NOT_FOUND' | 'SENTINEL_TX_FAILED' | 'SENTINEL_TEE_ERROR' | 'UNKNOWN';
|
|
178
9
|
interface T2000ErrorData {
|
|
179
10
|
reason?: string;
|
|
@@ -233,7 +64,9 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
233
64
|
private readonly keypair;
|
|
234
65
|
private readonly client;
|
|
235
66
|
private readonly _address;
|
|
67
|
+
private readonly registry;
|
|
236
68
|
private constructor();
|
|
69
|
+
private static createDefaultRegistry;
|
|
237
70
|
static create(options?: T2000Options): Promise<T2000>;
|
|
238
71
|
static fromPrivateKey(privateKey: string, options?: {
|
|
239
72
|
network?: 'mainnet' | 'testnet';
|
|
@@ -266,22 +99,27 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
266
99
|
}): Promise<TransactionRecord[]>;
|
|
267
100
|
deposit(): Promise<DepositInfo>;
|
|
268
101
|
exportKey(): string;
|
|
102
|
+
registerAdapter(adapter: LendingAdapter | SwapAdapter): Promise<void>;
|
|
269
103
|
save(params: {
|
|
270
104
|
amount: number | 'all';
|
|
271
105
|
asset?: string;
|
|
106
|
+
protocol?: string;
|
|
272
107
|
}): Promise<SaveResult>;
|
|
273
108
|
withdraw(params: {
|
|
274
109
|
amount: number | 'all';
|
|
275
110
|
asset?: string;
|
|
111
|
+
protocol?: string;
|
|
276
112
|
}): Promise<WithdrawResult>;
|
|
277
113
|
maxWithdraw(): Promise<MaxWithdrawResult>;
|
|
278
114
|
borrow(params: {
|
|
279
115
|
amount: number;
|
|
280
116
|
asset?: string;
|
|
117
|
+
protocol?: string;
|
|
281
118
|
}): Promise<BorrowResult>;
|
|
282
119
|
repay(params: {
|
|
283
120
|
amount: number | 'all';
|
|
284
121
|
asset?: string;
|
|
122
|
+
protocol?: string;
|
|
285
123
|
}): Promise<RepayResult>;
|
|
286
124
|
maxBorrow(): Promise<MaxBorrowResult>;
|
|
287
125
|
healthFactor(): Promise<HealthFactorResult>;
|
|
@@ -290,6 +128,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
290
128
|
to: string;
|
|
291
129
|
amount: number;
|
|
292
130
|
maxSlippage?: number;
|
|
131
|
+
protocol?: string;
|
|
293
132
|
}): Promise<SwapResult>;
|
|
294
133
|
swapQuote(params: {
|
|
295
134
|
from: string;
|
|
@@ -306,11 +145,17 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
306
145
|
}>;
|
|
307
146
|
positions(): Promise<PositionsResult>;
|
|
308
147
|
rates(): Promise<RatesResult>;
|
|
148
|
+
allRates(asset?: string): Promise<{
|
|
149
|
+
protocol: string;
|
|
150
|
+
protocolId: string;
|
|
151
|
+
rates: LendingRates;
|
|
152
|
+
}[]>;
|
|
309
153
|
earnings(): Promise<EarningsResult>;
|
|
310
154
|
fundStatus(): Promise<FundStatusResult>;
|
|
311
155
|
sentinelList(): Promise<SentinelAgent[]>;
|
|
312
156
|
sentinelInfo(id: string): Promise<SentinelAgent>;
|
|
313
157
|
sentinelAttack(id: string, prompt: string, fee?: bigint): Promise<SentinelAttackResult>;
|
|
158
|
+
private resolveLending;
|
|
314
159
|
private emitBalanceChange;
|
|
315
160
|
}
|
|
316
161
|
|
|
@@ -454,4 +299,4 @@ interface GasStatusResponse {
|
|
|
454
299
|
}
|
|
455
300
|
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
456
301
|
|
|
457
|
-
export { type AutoTopUpResult, BPS_DENOMINATOR,
|
|
302
|
+
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CLOCK_ID, DEFAULT_NETWORK, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, SENTINEL, SUI_DECIMALS, SUPPORTED_ASSETS, SaveResult, SendResult, SentinelAgent, SentinelAttackResult, SentinelVerdict, type SimulationResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, USDC_DECIMALS, WithdrawResult, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatSui, formatUsd, generateKeypair, getAddress, getGasStatus, getPoolPrice, getRates, getSentinelInfo, getSwapQuote, keypairFromPrivateKey, listSentinels, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToUsdc, requestAttack, saveKey, attack as sentinelAttack, settleAttack, shouldAutoTopUp, simulateTransaction, solveHashcash, submitPrompt, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,179 +1,10 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiClient } from '@mysten/sui/client';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
+
import { T as T2000Options, S as SendResult, B as BalanceResponse, a as TransactionRecord, D as DepositInfo, L as LendingAdapter, b as SwapAdapter, c as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, d as BorrowResult, R as RepayResult, e as MaxBorrowResult, H as HealthFactorResult, f as SwapResult, P as PositionsResult, g as RatesResult, h as LendingRates, E as EarningsResult, F as FundStatusResult, i as SentinelAgent, j as SentinelAttackResult, k as SentinelVerdict, G as GasMethod } from './index-DYQv9Wxo.js';
|
|
5
|
+
export { A as AdapterCapability, l as AdapterPositions, m as AdapterTxResult, C as CetusAdapter, n as GasReserve, o as HealthInfo, N as NaviAdapter, p as PositionEntry, q as ProtocolRegistry, r as SuilendAdapter, s as SwapQuote } from './index-DYQv9Wxo.js';
|
|
4
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
5
7
|
|
|
6
|
-
interface T2000Options {
|
|
7
|
-
keyPath?: string;
|
|
8
|
-
/** PIN to decrypt the key file. Accepts any string (4+ chars). */
|
|
9
|
-
pin?: string;
|
|
10
|
-
/** @deprecated Use `pin` instead. */
|
|
11
|
-
passphrase?: string;
|
|
12
|
-
network?: 'mainnet' | 'testnet';
|
|
13
|
-
rpcUrl?: string;
|
|
14
|
-
sponsored?: boolean;
|
|
15
|
-
name?: string;
|
|
16
|
-
}
|
|
17
|
-
interface GasReserve {
|
|
18
|
-
sui: number;
|
|
19
|
-
usdEquiv: number;
|
|
20
|
-
}
|
|
21
|
-
interface BalanceResponse {
|
|
22
|
-
available: number;
|
|
23
|
-
savings: number;
|
|
24
|
-
gasReserve: GasReserve;
|
|
25
|
-
total: number;
|
|
26
|
-
assets: Record<string, number>;
|
|
27
|
-
}
|
|
28
|
-
type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup';
|
|
29
|
-
interface SendResult {
|
|
30
|
-
success: boolean;
|
|
31
|
-
tx: string;
|
|
32
|
-
amount: number;
|
|
33
|
-
to: string;
|
|
34
|
-
gasCost: number;
|
|
35
|
-
gasCostUnit: string;
|
|
36
|
-
gasMethod: GasMethod;
|
|
37
|
-
balance: BalanceResponse;
|
|
38
|
-
}
|
|
39
|
-
interface SaveResult {
|
|
40
|
-
success: boolean;
|
|
41
|
-
tx: string;
|
|
42
|
-
amount: number;
|
|
43
|
-
apy: number;
|
|
44
|
-
fee: number;
|
|
45
|
-
gasCost: number;
|
|
46
|
-
gasMethod: GasMethod;
|
|
47
|
-
savingsBalance: number;
|
|
48
|
-
}
|
|
49
|
-
interface WithdrawResult {
|
|
50
|
-
success: boolean;
|
|
51
|
-
tx: string;
|
|
52
|
-
amount: number;
|
|
53
|
-
gasCost: number;
|
|
54
|
-
gasMethod: GasMethod;
|
|
55
|
-
}
|
|
56
|
-
interface BorrowResult {
|
|
57
|
-
success: boolean;
|
|
58
|
-
tx: string;
|
|
59
|
-
amount: number;
|
|
60
|
-
fee: number;
|
|
61
|
-
healthFactor: number;
|
|
62
|
-
gasCost: number;
|
|
63
|
-
gasMethod: GasMethod;
|
|
64
|
-
}
|
|
65
|
-
interface RepayResult {
|
|
66
|
-
success: boolean;
|
|
67
|
-
tx: string;
|
|
68
|
-
amount: number;
|
|
69
|
-
remainingDebt: number;
|
|
70
|
-
gasCost: number;
|
|
71
|
-
gasMethod: GasMethod;
|
|
72
|
-
}
|
|
73
|
-
interface SwapResult {
|
|
74
|
-
success: boolean;
|
|
75
|
-
tx: string;
|
|
76
|
-
fromAmount: number;
|
|
77
|
-
fromAsset: string;
|
|
78
|
-
toAmount: number;
|
|
79
|
-
toAsset: string;
|
|
80
|
-
priceImpact: number;
|
|
81
|
-
fee: number;
|
|
82
|
-
gasCost: number;
|
|
83
|
-
gasMethod: GasMethod;
|
|
84
|
-
}
|
|
85
|
-
interface HealthFactorResult {
|
|
86
|
-
healthFactor: number;
|
|
87
|
-
supplied: number;
|
|
88
|
-
borrowed: number;
|
|
89
|
-
maxBorrow: number;
|
|
90
|
-
liquidationThreshold: number;
|
|
91
|
-
}
|
|
92
|
-
interface MaxWithdrawResult {
|
|
93
|
-
maxAmount: number;
|
|
94
|
-
healthFactorAfter: number;
|
|
95
|
-
currentHF: number;
|
|
96
|
-
}
|
|
97
|
-
interface MaxBorrowResult {
|
|
98
|
-
maxAmount: number;
|
|
99
|
-
healthFactorAfter: number;
|
|
100
|
-
currentHF: number;
|
|
101
|
-
}
|
|
102
|
-
interface RatesResult {
|
|
103
|
-
USDC: {
|
|
104
|
-
saveApy: number;
|
|
105
|
-
borrowApy: number;
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
interface PositionEntry {
|
|
109
|
-
protocol: string;
|
|
110
|
-
asset: string;
|
|
111
|
-
type: 'save' | 'borrow';
|
|
112
|
-
amount: number;
|
|
113
|
-
apy: number;
|
|
114
|
-
}
|
|
115
|
-
interface PositionsResult {
|
|
116
|
-
positions: PositionEntry[];
|
|
117
|
-
}
|
|
118
|
-
interface EarningsResult {
|
|
119
|
-
totalYieldEarned: number;
|
|
120
|
-
currentApy: number;
|
|
121
|
-
dailyEarning: number;
|
|
122
|
-
supplied: number;
|
|
123
|
-
}
|
|
124
|
-
interface FundStatusResult {
|
|
125
|
-
supplied: number;
|
|
126
|
-
apy: number;
|
|
127
|
-
earnedToday: number;
|
|
128
|
-
earnedAllTime: number;
|
|
129
|
-
projectedMonthly: number;
|
|
130
|
-
}
|
|
131
|
-
interface DepositInfo {
|
|
132
|
-
address: string;
|
|
133
|
-
network: string;
|
|
134
|
-
supportedAssets: string[];
|
|
135
|
-
instructions: string;
|
|
136
|
-
}
|
|
137
|
-
interface TransactionRecord {
|
|
138
|
-
digest: string;
|
|
139
|
-
action: string;
|
|
140
|
-
amount?: number;
|
|
141
|
-
asset?: string;
|
|
142
|
-
timestamp: number;
|
|
143
|
-
gasMethod?: GasMethod;
|
|
144
|
-
}
|
|
145
|
-
interface SentinelAgent {
|
|
146
|
-
id: string;
|
|
147
|
-
objectId: string;
|
|
148
|
-
name: string;
|
|
149
|
-
model: string;
|
|
150
|
-
systemPrompt: string;
|
|
151
|
-
attackFee: bigint;
|
|
152
|
-
prizePool: bigint;
|
|
153
|
-
totalAttacks: number;
|
|
154
|
-
successfulBreaches: number;
|
|
155
|
-
state: string;
|
|
156
|
-
}
|
|
157
|
-
interface SentinelVerdict {
|
|
158
|
-
success: boolean;
|
|
159
|
-
score: number;
|
|
160
|
-
agentResponse: string;
|
|
161
|
-
juryResponse: string;
|
|
162
|
-
funResponse: string;
|
|
163
|
-
signature: string;
|
|
164
|
-
timestampMs: number;
|
|
165
|
-
}
|
|
166
|
-
interface SentinelAttackResult {
|
|
167
|
-
attackObjectId: string;
|
|
168
|
-
sentinelId: string;
|
|
169
|
-
prompt: string;
|
|
170
|
-
verdict: SentinelVerdict;
|
|
171
|
-
requestTx: string;
|
|
172
|
-
settleTx: string;
|
|
173
|
-
won: boolean;
|
|
174
|
-
feePaid: number;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
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' | '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' | 'FACILITATOR_TIMEOUT' | 'SENTINEL_API_ERROR' | 'SENTINEL_NOT_FOUND' | 'SENTINEL_TX_FAILED' | 'SENTINEL_TEE_ERROR' | 'UNKNOWN';
|
|
178
9
|
interface T2000ErrorData {
|
|
179
10
|
reason?: string;
|
|
@@ -233,7 +64,9 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
233
64
|
private readonly keypair;
|
|
234
65
|
private readonly client;
|
|
235
66
|
private readonly _address;
|
|
67
|
+
private readonly registry;
|
|
236
68
|
private constructor();
|
|
69
|
+
private static createDefaultRegistry;
|
|
237
70
|
static create(options?: T2000Options): Promise<T2000>;
|
|
238
71
|
static fromPrivateKey(privateKey: string, options?: {
|
|
239
72
|
network?: 'mainnet' | 'testnet';
|
|
@@ -266,22 +99,27 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
266
99
|
}): Promise<TransactionRecord[]>;
|
|
267
100
|
deposit(): Promise<DepositInfo>;
|
|
268
101
|
exportKey(): string;
|
|
102
|
+
registerAdapter(adapter: LendingAdapter | SwapAdapter): Promise<void>;
|
|
269
103
|
save(params: {
|
|
270
104
|
amount: number | 'all';
|
|
271
105
|
asset?: string;
|
|
106
|
+
protocol?: string;
|
|
272
107
|
}): Promise<SaveResult>;
|
|
273
108
|
withdraw(params: {
|
|
274
109
|
amount: number | 'all';
|
|
275
110
|
asset?: string;
|
|
111
|
+
protocol?: string;
|
|
276
112
|
}): Promise<WithdrawResult>;
|
|
277
113
|
maxWithdraw(): Promise<MaxWithdrawResult>;
|
|
278
114
|
borrow(params: {
|
|
279
115
|
amount: number;
|
|
280
116
|
asset?: string;
|
|
117
|
+
protocol?: string;
|
|
281
118
|
}): Promise<BorrowResult>;
|
|
282
119
|
repay(params: {
|
|
283
120
|
amount: number | 'all';
|
|
284
121
|
asset?: string;
|
|
122
|
+
protocol?: string;
|
|
285
123
|
}): Promise<RepayResult>;
|
|
286
124
|
maxBorrow(): Promise<MaxBorrowResult>;
|
|
287
125
|
healthFactor(): Promise<HealthFactorResult>;
|
|
@@ -290,6 +128,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
290
128
|
to: string;
|
|
291
129
|
amount: number;
|
|
292
130
|
maxSlippage?: number;
|
|
131
|
+
protocol?: string;
|
|
293
132
|
}): Promise<SwapResult>;
|
|
294
133
|
swapQuote(params: {
|
|
295
134
|
from: string;
|
|
@@ -306,11 +145,17 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
306
145
|
}>;
|
|
307
146
|
positions(): Promise<PositionsResult>;
|
|
308
147
|
rates(): Promise<RatesResult>;
|
|
148
|
+
allRates(asset?: string): Promise<{
|
|
149
|
+
protocol: string;
|
|
150
|
+
protocolId: string;
|
|
151
|
+
rates: LendingRates;
|
|
152
|
+
}[]>;
|
|
309
153
|
earnings(): Promise<EarningsResult>;
|
|
310
154
|
fundStatus(): Promise<FundStatusResult>;
|
|
311
155
|
sentinelList(): Promise<SentinelAgent[]>;
|
|
312
156
|
sentinelInfo(id: string): Promise<SentinelAgent>;
|
|
313
157
|
sentinelAttack(id: string, prompt: string, fee?: bigint): Promise<SentinelAttackResult>;
|
|
158
|
+
private resolveLending;
|
|
314
159
|
private emitBalanceChange;
|
|
315
160
|
}
|
|
316
161
|
|
|
@@ -454,4 +299,4 @@ interface GasStatusResponse {
|
|
|
454
299
|
}
|
|
455
300
|
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
456
301
|
|
|
457
|
-
export { type AutoTopUpResult, BPS_DENOMINATOR,
|
|
302
|
+
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CLOCK_ID, DEFAULT_NETWORK, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, PositionsResult, type ProtocolFeeInfo, RatesResult, RepayResult, SENTINEL, SUI_DECIMALS, SUPPORTED_ASSETS, SaveResult, SendResult, SentinelAgent, SentinelAttackResult, SentinelVerdict, type SimulationResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, USDC_DECIMALS, WithdrawResult, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatSui, formatUsd, generateKeypair, getAddress, getGasStatus, getPoolPrice, getRates, getSentinelInfo, getSwapQuote, keypairFromPrivateKey, listSentinels, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToUsdc, requestAttack, saveKey, attack as sentinelAttack, settleAttack, shouldAutoTopUp, simulateTransaction, solveHashcash, submitPrompt, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|