@t2000/sdk 0.19.23 → 0.20.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/README.md +34 -150
- package/dist/adapters/descriptors.cjs +1 -42
- package/dist/adapters/descriptors.cjs.map +1 -1
- package/dist/adapters/descriptors.d.cts +1 -1
- package/dist/adapters/descriptors.d.ts +1 -1
- package/dist/adapters/descriptors.js +2 -41
- package/dist/adapters/descriptors.js.map +1 -1
- package/dist/adapters/index.cjs +3 -745
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +4 -171
- package/dist/adapters/index.d.ts +4 -171
- package/dist/adapters/index.js +4 -742
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.js +20 -178
- package/dist/browser.js.map +1 -1
- package/dist/descriptors-Be4FAgN5.d.cts +127 -0
- package/dist/descriptors-Be4FAgN5.d.ts +127 -0
- package/dist/index-D1DxZ1DK.d.ts +292 -0
- package/dist/index-MP_J_nSO.d.cts +292 -0
- package/dist/index.cjs +680 -3461
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -313
- package/dist/index.d.ts +34 -313
- package/dist/index.js +592 -3360
- package/dist/index.js.map +1 -1
- package/package.json +5 -8
- package/dist/descriptors-B6qt_mwi.d.cts +0 -584
- package/dist/descriptors-B6qt_mwi.d.ts +0 -584
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2000/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "TypeScript SDK for AI agent bank accounts on Sui — send, save, borrow, rebalance",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -39,8 +39,7 @@
|
|
|
39
39
|
"defi",
|
|
40
40
|
"sdk",
|
|
41
41
|
"usdc",
|
|
42
|
-
"navi"
|
|
43
|
-
"cetus"
|
|
42
|
+
"navi"
|
|
44
43
|
],
|
|
45
44
|
"author": "t2000",
|
|
46
45
|
"repository": {
|
|
@@ -50,16 +49,14 @@
|
|
|
50
49
|
},
|
|
51
50
|
"homepage": "https://t2000.ai",
|
|
52
51
|
"dependencies": {
|
|
53
|
-
"@cetusprotocol/aggregator-sdk": "^1.4.
|
|
52
|
+
"@cetusprotocol/aggregator-sdk": "^1.4.8",
|
|
54
53
|
"@mysten/sui": "^2.11.0",
|
|
55
54
|
"@mysten/zklogin": "^0.8.1",
|
|
56
55
|
"@naviprotocol/lending": "^1.4.0",
|
|
57
56
|
"@pythnetwork/pyth-sui-js": "^2.4.0",
|
|
58
|
-
"@
|
|
59
|
-
"@suilend/sui-fe": "^2.0.6",
|
|
57
|
+
"@suimpp/mpp": "^0.3.1",
|
|
60
58
|
"eventemitter3": "^5",
|
|
61
|
-
"mppx": "^0.4.9"
|
|
62
|
-
"@t2000/mpp-sui": "0.1.16"
|
|
59
|
+
"mppx": "^0.4.9"
|
|
63
60
|
},
|
|
64
61
|
"devDependencies": {
|
|
65
62
|
"@types/node": "^20",
|
|
@@ -1,584 +0,0 @@
|
|
|
1
|
-
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
2
|
-
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
|
-
|
|
4
|
-
interface T2000Options {
|
|
5
|
-
keyPath?: string;
|
|
6
|
-
/** PIN to decrypt the key file. Accepts any string (4+ chars). */
|
|
7
|
-
pin?: string;
|
|
8
|
-
/** @deprecated Use `pin` instead. */
|
|
9
|
-
passphrase?: string;
|
|
10
|
-
network?: 'mainnet' | 'testnet';
|
|
11
|
-
rpcUrl?: string;
|
|
12
|
-
sponsored?: boolean;
|
|
13
|
-
name?: string;
|
|
14
|
-
}
|
|
15
|
-
interface GasReserve {
|
|
16
|
-
sui: number;
|
|
17
|
-
usdEquiv: number;
|
|
18
|
-
}
|
|
19
|
-
interface BalanceResponse {
|
|
20
|
-
available: number;
|
|
21
|
-
savings: number;
|
|
22
|
-
debt: number;
|
|
23
|
-
investment: number;
|
|
24
|
-
investmentPnL: number;
|
|
25
|
-
pendingRewards: number;
|
|
26
|
-
gasReserve: GasReserve;
|
|
27
|
-
total: number;
|
|
28
|
-
assets: Record<string, number>;
|
|
29
|
-
stables: Record<string, number>;
|
|
30
|
-
}
|
|
31
|
-
type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup' | 'none';
|
|
32
|
-
interface SendResult {
|
|
33
|
-
success: boolean;
|
|
34
|
-
tx: string;
|
|
35
|
-
amount: number;
|
|
36
|
-
to: string;
|
|
37
|
-
contactName?: string;
|
|
38
|
-
gasCost: number;
|
|
39
|
-
gasCostUnit: string;
|
|
40
|
-
gasMethod: GasMethod;
|
|
41
|
-
balance: BalanceResponse;
|
|
42
|
-
}
|
|
43
|
-
interface SaveResult {
|
|
44
|
-
success: boolean;
|
|
45
|
-
tx: string;
|
|
46
|
-
amount: number;
|
|
47
|
-
apy: number;
|
|
48
|
-
fee: number;
|
|
49
|
-
gasCost: number;
|
|
50
|
-
gasMethod: GasMethod;
|
|
51
|
-
savingsBalance: number;
|
|
52
|
-
}
|
|
53
|
-
interface WithdrawResult {
|
|
54
|
-
success: boolean;
|
|
55
|
-
tx: string;
|
|
56
|
-
amount: number;
|
|
57
|
-
gasCost: number;
|
|
58
|
-
gasMethod: GasMethod;
|
|
59
|
-
}
|
|
60
|
-
interface BorrowResult {
|
|
61
|
-
success: boolean;
|
|
62
|
-
tx: string;
|
|
63
|
-
amount: number;
|
|
64
|
-
fee: number;
|
|
65
|
-
healthFactor: number;
|
|
66
|
-
gasCost: number;
|
|
67
|
-
gasMethod: GasMethod;
|
|
68
|
-
}
|
|
69
|
-
interface RepayResult {
|
|
70
|
-
success: boolean;
|
|
71
|
-
tx: string;
|
|
72
|
-
amount: number;
|
|
73
|
-
remainingDebt: number;
|
|
74
|
-
gasCost: number;
|
|
75
|
-
gasMethod: GasMethod;
|
|
76
|
-
}
|
|
77
|
-
interface SwapResult {
|
|
78
|
-
success: boolean;
|
|
79
|
-
tx: string;
|
|
80
|
-
fromAmount: number;
|
|
81
|
-
fromAsset: string;
|
|
82
|
-
toAmount: number;
|
|
83
|
-
toAsset: string;
|
|
84
|
-
priceImpact: number;
|
|
85
|
-
fee: number;
|
|
86
|
-
gasCost: number;
|
|
87
|
-
gasMethod: GasMethod;
|
|
88
|
-
}
|
|
89
|
-
interface HealthFactorResult {
|
|
90
|
-
healthFactor: number;
|
|
91
|
-
supplied: number;
|
|
92
|
-
borrowed: number;
|
|
93
|
-
maxBorrow: number;
|
|
94
|
-
liquidationThreshold: number;
|
|
95
|
-
}
|
|
96
|
-
interface MaxWithdrawResult {
|
|
97
|
-
maxAmount: number;
|
|
98
|
-
healthFactorAfter: number;
|
|
99
|
-
currentHF: number;
|
|
100
|
-
}
|
|
101
|
-
interface MaxBorrowResult {
|
|
102
|
-
maxAmount: number;
|
|
103
|
-
healthFactorAfter: number;
|
|
104
|
-
currentHF: number;
|
|
105
|
-
}
|
|
106
|
-
interface AssetRates {
|
|
107
|
-
saveApy: number;
|
|
108
|
-
borrowApy: number;
|
|
109
|
-
}
|
|
110
|
-
interface RatesResult {
|
|
111
|
-
[asset: string]: AssetRates;
|
|
112
|
-
}
|
|
113
|
-
interface PositionEntry {
|
|
114
|
-
protocol: string;
|
|
115
|
-
asset: string;
|
|
116
|
-
type: 'save' | 'borrow';
|
|
117
|
-
amount: number;
|
|
118
|
-
amountUsd?: number;
|
|
119
|
-
apy: number;
|
|
120
|
-
}
|
|
121
|
-
interface PositionsResult {
|
|
122
|
-
positions: PositionEntry[];
|
|
123
|
-
}
|
|
124
|
-
interface EarningsResult {
|
|
125
|
-
totalYieldEarned: number;
|
|
126
|
-
currentApy: number;
|
|
127
|
-
dailyEarning: number;
|
|
128
|
-
supplied: number;
|
|
129
|
-
}
|
|
130
|
-
interface FundStatusResult {
|
|
131
|
-
supplied: number;
|
|
132
|
-
apy: number;
|
|
133
|
-
earnedToday: number;
|
|
134
|
-
earnedAllTime: number;
|
|
135
|
-
projectedMonthly: number;
|
|
136
|
-
}
|
|
137
|
-
interface RebalanceStep {
|
|
138
|
-
action: 'withdraw' | 'swap' | 'deposit';
|
|
139
|
-
protocol?: string;
|
|
140
|
-
fromAsset?: string;
|
|
141
|
-
toAsset?: string;
|
|
142
|
-
amount: number;
|
|
143
|
-
estimatedOutput?: number;
|
|
144
|
-
}
|
|
145
|
-
interface RebalanceResult {
|
|
146
|
-
executed: boolean;
|
|
147
|
-
steps: RebalanceStep[];
|
|
148
|
-
fromProtocol: string;
|
|
149
|
-
fromAsset: string;
|
|
150
|
-
toProtocol: string;
|
|
151
|
-
toAsset: string;
|
|
152
|
-
amount: number;
|
|
153
|
-
currentApy: number;
|
|
154
|
-
newApy: number;
|
|
155
|
-
annualGain: number;
|
|
156
|
-
estimatedSwapCost: number;
|
|
157
|
-
breakEvenDays: number;
|
|
158
|
-
txDigests: string[];
|
|
159
|
-
totalGasCost: number;
|
|
160
|
-
}
|
|
161
|
-
interface DepositInfo {
|
|
162
|
-
address: string;
|
|
163
|
-
network: string;
|
|
164
|
-
supportedAssets: string[];
|
|
165
|
-
instructions: string;
|
|
166
|
-
}
|
|
167
|
-
interface TransactionRecord {
|
|
168
|
-
digest: string;
|
|
169
|
-
action: string;
|
|
170
|
-
amount?: number;
|
|
171
|
-
asset?: string;
|
|
172
|
-
recipient?: string;
|
|
173
|
-
timestamp: number;
|
|
174
|
-
gasCost?: number;
|
|
175
|
-
gasMethod?: GasMethod;
|
|
176
|
-
}
|
|
177
|
-
interface InvestmentRecord {
|
|
178
|
-
id: string;
|
|
179
|
-
type: 'buy' | 'sell';
|
|
180
|
-
asset: string;
|
|
181
|
-
amount: number;
|
|
182
|
-
price: number;
|
|
183
|
-
usdValue: number;
|
|
184
|
-
fee: number;
|
|
185
|
-
tx: string;
|
|
186
|
-
timestamp: string;
|
|
187
|
-
}
|
|
188
|
-
interface InvestmentPosition {
|
|
189
|
-
asset: string;
|
|
190
|
-
totalAmount: number;
|
|
191
|
-
costBasis: number;
|
|
192
|
-
avgPrice: number;
|
|
193
|
-
currentPrice: number;
|
|
194
|
-
currentValue: number;
|
|
195
|
-
unrealizedPnL: number;
|
|
196
|
-
unrealizedPnLPct: number;
|
|
197
|
-
trades: InvestmentRecord[];
|
|
198
|
-
earning?: boolean;
|
|
199
|
-
earningProtocol?: string;
|
|
200
|
-
earningApy?: number;
|
|
201
|
-
}
|
|
202
|
-
interface PortfolioResult {
|
|
203
|
-
positions: InvestmentPosition[];
|
|
204
|
-
totalInvested: number;
|
|
205
|
-
totalValue: number;
|
|
206
|
-
unrealizedPnL: number;
|
|
207
|
-
unrealizedPnLPct: number;
|
|
208
|
-
realizedPnL: number;
|
|
209
|
-
}
|
|
210
|
-
interface InvestResult {
|
|
211
|
-
success: boolean;
|
|
212
|
-
tx: string;
|
|
213
|
-
type: 'buy' | 'sell';
|
|
214
|
-
asset: string;
|
|
215
|
-
amount: number;
|
|
216
|
-
price: number;
|
|
217
|
-
usdValue: number;
|
|
218
|
-
fee: number;
|
|
219
|
-
gasCost: number;
|
|
220
|
-
gasMethod: GasMethod;
|
|
221
|
-
realizedPnL?: number;
|
|
222
|
-
position: InvestmentPosition;
|
|
223
|
-
}
|
|
224
|
-
interface InvestEarnResult {
|
|
225
|
-
success: boolean;
|
|
226
|
-
tx: string;
|
|
227
|
-
asset: string;
|
|
228
|
-
amount: number;
|
|
229
|
-
protocol: string;
|
|
230
|
-
apy: number;
|
|
231
|
-
gasCost: number;
|
|
232
|
-
gasMethod: GasMethod;
|
|
233
|
-
}
|
|
234
|
-
interface InvestRebalanceMove {
|
|
235
|
-
asset: string;
|
|
236
|
-
fromProtocol: string;
|
|
237
|
-
toProtocol: string;
|
|
238
|
-
amount: number;
|
|
239
|
-
oldApy: number;
|
|
240
|
-
newApy: number;
|
|
241
|
-
txDigests: string[];
|
|
242
|
-
gasCost: number;
|
|
243
|
-
}
|
|
244
|
-
interface InvestRebalanceResult {
|
|
245
|
-
executed: boolean;
|
|
246
|
-
moves: InvestRebalanceMove[];
|
|
247
|
-
totalGasCost: number;
|
|
248
|
-
skipped: Array<{
|
|
249
|
-
asset: string;
|
|
250
|
-
protocol: string;
|
|
251
|
-
apy: number;
|
|
252
|
-
bestApy: number;
|
|
253
|
-
reason: string;
|
|
254
|
-
}>;
|
|
255
|
-
}
|
|
256
|
-
interface StrategyDefinition {
|
|
257
|
-
name: string;
|
|
258
|
-
allocations: Record<string, number>;
|
|
259
|
-
description: string;
|
|
260
|
-
custom: boolean;
|
|
261
|
-
}
|
|
262
|
-
interface StrategyBuyResult {
|
|
263
|
-
success: boolean;
|
|
264
|
-
strategy: string;
|
|
265
|
-
totalInvested: number;
|
|
266
|
-
buys: Array<{
|
|
267
|
-
asset: string;
|
|
268
|
-
usdAmount: number;
|
|
269
|
-
amount: number;
|
|
270
|
-
price: number;
|
|
271
|
-
tx: string;
|
|
272
|
-
}>;
|
|
273
|
-
gasCost: number;
|
|
274
|
-
gasMethod: GasMethod;
|
|
275
|
-
}
|
|
276
|
-
interface StrategySellResult {
|
|
277
|
-
success: boolean;
|
|
278
|
-
strategy: string;
|
|
279
|
-
totalProceeds: number;
|
|
280
|
-
realizedPnL: number;
|
|
281
|
-
sells: Array<{
|
|
282
|
-
asset: string;
|
|
283
|
-
amount: number;
|
|
284
|
-
usdValue: number;
|
|
285
|
-
realizedPnL: number;
|
|
286
|
-
tx: string;
|
|
287
|
-
}>;
|
|
288
|
-
failed?: Array<{
|
|
289
|
-
asset: string;
|
|
290
|
-
reason: string;
|
|
291
|
-
}>;
|
|
292
|
-
gasCost: number;
|
|
293
|
-
gasMethod: GasMethod;
|
|
294
|
-
}
|
|
295
|
-
interface StrategyRebalanceResult {
|
|
296
|
-
success: boolean;
|
|
297
|
-
strategy: string;
|
|
298
|
-
trades: Array<{
|
|
299
|
-
action: 'buy' | 'sell';
|
|
300
|
-
asset: string;
|
|
301
|
-
usdAmount: number;
|
|
302
|
-
amount: number;
|
|
303
|
-
tx: string;
|
|
304
|
-
}>;
|
|
305
|
-
beforeWeights: Record<string, number>;
|
|
306
|
-
afterWeights: Record<string, number>;
|
|
307
|
-
targetWeights: Record<string, number>;
|
|
308
|
-
}
|
|
309
|
-
interface StrategyStatusResult {
|
|
310
|
-
definition: StrategyDefinition;
|
|
311
|
-
positions: InvestmentPosition[];
|
|
312
|
-
currentWeights: Record<string, number>;
|
|
313
|
-
totalValue: number;
|
|
314
|
-
}
|
|
315
|
-
interface AutoInvestSchedule {
|
|
316
|
-
id: string;
|
|
317
|
-
strategy?: string;
|
|
318
|
-
asset?: string;
|
|
319
|
-
amount: number;
|
|
320
|
-
frequency: 'daily' | 'weekly' | 'monthly';
|
|
321
|
-
dayOfWeek?: number;
|
|
322
|
-
dayOfMonth?: number;
|
|
323
|
-
lastRun?: string;
|
|
324
|
-
nextRun: string;
|
|
325
|
-
enabled: boolean;
|
|
326
|
-
totalInvested: number;
|
|
327
|
-
runCount: number;
|
|
328
|
-
}
|
|
329
|
-
interface AutoInvestStatus {
|
|
330
|
-
schedules: AutoInvestSchedule[];
|
|
331
|
-
pendingRuns: AutoInvestSchedule[];
|
|
332
|
-
}
|
|
333
|
-
interface AutoInvestRunResult {
|
|
334
|
-
executed: Array<{
|
|
335
|
-
scheduleId: string;
|
|
336
|
-
strategy?: string;
|
|
337
|
-
asset?: string;
|
|
338
|
-
amount: number;
|
|
339
|
-
result: StrategyBuyResult | InvestResult;
|
|
340
|
-
}>;
|
|
341
|
-
skipped: Array<{
|
|
342
|
-
scheduleId: string;
|
|
343
|
-
reason: string;
|
|
344
|
-
}>;
|
|
345
|
-
}
|
|
346
|
-
interface PendingReward$1 {
|
|
347
|
-
protocol: string;
|
|
348
|
-
asset: string;
|
|
349
|
-
coinType: string;
|
|
350
|
-
symbol: string;
|
|
351
|
-
amount: number;
|
|
352
|
-
estimatedValueUsd: number;
|
|
353
|
-
}
|
|
354
|
-
interface ClaimRewardsResult {
|
|
355
|
-
success: boolean;
|
|
356
|
-
tx: string;
|
|
357
|
-
rewards: PendingReward$1[];
|
|
358
|
-
totalValueUsd: number;
|
|
359
|
-
usdcReceived: number;
|
|
360
|
-
gasCost: number;
|
|
361
|
-
gasMethod: GasMethod;
|
|
362
|
-
}
|
|
363
|
-
type PositionSide = 'long' | 'short';
|
|
364
|
-
interface PerpsPosition {
|
|
365
|
-
market: string;
|
|
366
|
-
side: PositionSide;
|
|
367
|
-
margin: number;
|
|
368
|
-
leverage: number;
|
|
369
|
-
size: number;
|
|
370
|
-
entryPrice: number;
|
|
371
|
-
markPrice: number;
|
|
372
|
-
liquidationPrice: number;
|
|
373
|
-
unrealizedPnL: number;
|
|
374
|
-
unrealizedPnLPct: number;
|
|
375
|
-
}
|
|
376
|
-
interface PerpsTradeResult {
|
|
377
|
-
success: boolean;
|
|
378
|
-
action: 'open' | 'close';
|
|
379
|
-
market: string;
|
|
380
|
-
side: PositionSide;
|
|
381
|
-
margin: number;
|
|
382
|
-
leverage: number;
|
|
383
|
-
size: number;
|
|
384
|
-
entryPrice: number;
|
|
385
|
-
liquidationPrice?: number;
|
|
386
|
-
realizedPnL?: number;
|
|
387
|
-
tx?: string;
|
|
388
|
-
}
|
|
389
|
-
interface PerpsPositionsResult {
|
|
390
|
-
positions: PerpsPosition[];
|
|
391
|
-
totalMargin: number;
|
|
392
|
-
totalUnrealizedPnL: number;
|
|
393
|
-
}
|
|
394
|
-
interface PayOptions {
|
|
395
|
-
url: string;
|
|
396
|
-
method?: string;
|
|
397
|
-
body?: string;
|
|
398
|
-
headers?: Record<string, string>;
|
|
399
|
-
maxPrice?: number;
|
|
400
|
-
}
|
|
401
|
-
interface PayResult {
|
|
402
|
-
status: number;
|
|
403
|
-
body: unknown;
|
|
404
|
-
paid: boolean;
|
|
405
|
-
cost?: number;
|
|
406
|
-
receipt?: {
|
|
407
|
-
reference: string;
|
|
408
|
-
timestamp: string;
|
|
409
|
-
};
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
type AdapterCapability = 'save' | 'withdraw' | 'borrow' | 'repay' | 'swap' | 'perps';
|
|
413
|
-
/**
|
|
414
|
-
* Describes a protocol for indexer event classification.
|
|
415
|
-
* Each adapter exports one of these so the server can auto-build
|
|
416
|
-
* detection rules without manual sync.
|
|
417
|
-
*
|
|
418
|
-
* To add a new protocol: export a `descriptor` from your adapter file.
|
|
419
|
-
*/
|
|
420
|
-
interface ProtocolDescriptor {
|
|
421
|
-
/** Unique protocol ID — must match the adapter's `id` field */
|
|
422
|
-
id: string;
|
|
423
|
-
/** Human-readable name */
|
|
424
|
-
name: string;
|
|
425
|
-
/**
|
|
426
|
-
* On-chain package IDs that identify this protocol's transactions.
|
|
427
|
-
* For protocols with upgradeable packages, list the original/base package.
|
|
428
|
-
*/
|
|
429
|
-
packages: string[];
|
|
430
|
-
/**
|
|
431
|
-
* Maps `module::function` patterns to action types.
|
|
432
|
-
* The indexer matches Move call targets against these patterns.
|
|
433
|
-
* For dynamic package IDs (e.g. NAVI), matching is done on module::function only.
|
|
434
|
-
*/
|
|
435
|
-
actionMap: Record<string, string>;
|
|
436
|
-
/**
|
|
437
|
-
* If true, the indexer matches by module::function suffix only,
|
|
438
|
-
* ignoring the package ID prefix. Use for protocols with frequently
|
|
439
|
-
* upgraded (dynamic) package IDs.
|
|
440
|
-
*/
|
|
441
|
-
dynamicPackageId?: boolean;
|
|
442
|
-
}
|
|
443
|
-
interface AdapterTxResult {
|
|
444
|
-
tx: Transaction;
|
|
445
|
-
feeCoin?: TransactionObjectArgument;
|
|
446
|
-
meta?: Record<string, unknown>;
|
|
447
|
-
}
|
|
448
|
-
interface LendingRates {
|
|
449
|
-
asset: string;
|
|
450
|
-
saveApy: number;
|
|
451
|
-
borrowApy: number;
|
|
452
|
-
}
|
|
453
|
-
interface AdapterPositions {
|
|
454
|
-
supplies: Array<{
|
|
455
|
-
asset: string;
|
|
456
|
-
amount: number;
|
|
457
|
-
amountUsd?: number;
|
|
458
|
-
apy: number;
|
|
459
|
-
}>;
|
|
460
|
-
borrows: Array<{
|
|
461
|
-
asset: string;
|
|
462
|
-
amount: number;
|
|
463
|
-
amountUsd?: number;
|
|
464
|
-
apy: number;
|
|
465
|
-
}>;
|
|
466
|
-
}
|
|
467
|
-
interface HealthInfo {
|
|
468
|
-
healthFactor: number;
|
|
469
|
-
supplied: number;
|
|
470
|
-
borrowed: number;
|
|
471
|
-
maxBorrow: number;
|
|
472
|
-
liquidationThreshold: number;
|
|
473
|
-
}
|
|
474
|
-
interface SwapQuote {
|
|
475
|
-
expectedOutput: number;
|
|
476
|
-
priceImpact: number;
|
|
477
|
-
poolPrice: number;
|
|
478
|
-
}
|
|
479
|
-
interface LendingAdapter {
|
|
480
|
-
readonly id: string;
|
|
481
|
-
readonly name: string;
|
|
482
|
-
readonly version: string;
|
|
483
|
-
readonly capabilities: readonly AdapterCapability[];
|
|
484
|
-
readonly supportedAssets: readonly string[];
|
|
485
|
-
readonly supportsSameAssetBorrow: boolean;
|
|
486
|
-
init(client: SuiJsonRpcClient): Promise<void>;
|
|
487
|
-
getRates(asset: string): Promise<LendingRates>;
|
|
488
|
-
getPositions(address: string): Promise<AdapterPositions>;
|
|
489
|
-
getHealth(address: string): Promise<HealthInfo>;
|
|
490
|
-
buildSaveTx(address: string, amount: number, asset: string, options?: {
|
|
491
|
-
collectFee?: boolean;
|
|
492
|
-
sponsored?: boolean;
|
|
493
|
-
}): Promise<AdapterTxResult>;
|
|
494
|
-
buildWithdrawTx(address: string, amount: number, asset: string, options?: {
|
|
495
|
-
sponsored?: boolean;
|
|
496
|
-
}): Promise<AdapterTxResult & {
|
|
497
|
-
effectiveAmount: number;
|
|
498
|
-
}>;
|
|
499
|
-
buildBorrowTx(address: string, amount: number, asset: string, options?: {
|
|
500
|
-
collectFee?: boolean;
|
|
501
|
-
sponsored?: boolean;
|
|
502
|
-
}): Promise<AdapterTxResult>;
|
|
503
|
-
buildRepayTx(address: string, amount: number, asset: string, options?: {
|
|
504
|
-
sponsored?: boolean;
|
|
505
|
-
skipOracle?: boolean;
|
|
506
|
-
}): Promise<AdapterTxResult>;
|
|
507
|
-
maxWithdraw(address: string, asset: string): Promise<{
|
|
508
|
-
maxAmount: number;
|
|
509
|
-
healthFactorAfter: number;
|
|
510
|
-
currentHF: number;
|
|
511
|
-
}>;
|
|
512
|
-
maxBorrow(address: string, asset: string): Promise<{
|
|
513
|
-
maxAmount: number;
|
|
514
|
-
healthFactorAfter: number;
|
|
515
|
-
currentHF: number;
|
|
516
|
-
}>;
|
|
517
|
-
addWithdrawToTx?(tx: Transaction, address: string, amount: number, asset: string): Promise<{
|
|
518
|
-
coin: TransactionObjectArgument;
|
|
519
|
-
effectiveAmount: number;
|
|
520
|
-
}>;
|
|
521
|
-
addSaveToTx?(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
|
|
522
|
-
collectFee?: boolean;
|
|
523
|
-
}): Promise<void>;
|
|
524
|
-
addRepayToTx?(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string): Promise<void>;
|
|
525
|
-
getPendingRewards?(address: string): Promise<PendingReward[]>;
|
|
526
|
-
addClaimRewardsToTx?(tx: Transaction, address: string): Promise<PendingReward[]>;
|
|
527
|
-
}
|
|
528
|
-
interface PendingReward {
|
|
529
|
-
protocol: string;
|
|
530
|
-
asset: string;
|
|
531
|
-
coinType: string;
|
|
532
|
-
symbol: string;
|
|
533
|
-
amount: number;
|
|
534
|
-
estimatedValueUsd: number;
|
|
535
|
-
}
|
|
536
|
-
interface SwapAdapter {
|
|
537
|
-
readonly id: string;
|
|
538
|
-
readonly name: string;
|
|
539
|
-
readonly version: string;
|
|
540
|
-
readonly capabilities: readonly AdapterCapability[];
|
|
541
|
-
init(client: SuiJsonRpcClient): Promise<void>;
|
|
542
|
-
getQuote(from: string, to: string, amount: number): Promise<SwapQuote>;
|
|
543
|
-
buildSwapTx(address: string, from: string, to: string, amount: number, maxSlippageBps?: number): Promise<AdapterTxResult & {
|
|
544
|
-
estimatedOut: number;
|
|
545
|
-
toDecimals: number;
|
|
546
|
-
}>;
|
|
547
|
-
getSupportedPairs(): Array<{
|
|
548
|
-
from: string;
|
|
549
|
-
to: string;
|
|
550
|
-
}>;
|
|
551
|
-
getPoolPrice(): Promise<number>;
|
|
552
|
-
addSwapToTx?(tx: Transaction, address: string, inputCoin: TransactionObjectArgument, from: string, to: string, amount: number, maxSlippageBps?: number): Promise<{
|
|
553
|
-
outputCoin: TransactionObjectArgument;
|
|
554
|
-
estimatedOut: number;
|
|
555
|
-
toDecimals: number;
|
|
556
|
-
}>;
|
|
557
|
-
}
|
|
558
|
-
interface PerpsAdapter {
|
|
559
|
-
readonly id: string;
|
|
560
|
-
readonly name: string;
|
|
561
|
-
readonly version: string;
|
|
562
|
-
readonly capabilities: readonly AdapterCapability[];
|
|
563
|
-
readonly supportedMarkets: readonly string[];
|
|
564
|
-
init(keypair: unknown, network: 'mainnet' | 'testnet'): Promise<void>;
|
|
565
|
-
getAccountBalance(address: string): Promise<number>;
|
|
566
|
-
getPositions(address: string): Promise<PerpsPosition[]>;
|
|
567
|
-
getMarketPrice(market: string): Promise<number>;
|
|
568
|
-
deposit(amount: number): Promise<string>;
|
|
569
|
-
withdraw(amount: number): Promise<string>;
|
|
570
|
-
openPosition(params: {
|
|
571
|
-
market: string;
|
|
572
|
-
side: PositionSide;
|
|
573
|
-
margin: number;
|
|
574
|
-
leverage: number;
|
|
575
|
-
}): Promise<PerpsTradeResult>;
|
|
576
|
-
closePosition(market: string): Promise<PerpsTradeResult>;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
declare const naviDescriptor: ProtocolDescriptor;
|
|
580
|
-
declare const suilendDescriptor: ProtocolDescriptor;
|
|
581
|
-
declare const cetusDescriptor: ProtocolDescriptor;
|
|
582
|
-
declare const allDescriptors: ProtocolDescriptor[];
|
|
583
|
-
|
|
584
|
-
export { type ProtocolDescriptor as $, type AutoInvestSchedule as A, type BalanceResponse as B, type ClaimRewardsResult as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasMethod as G, type HealthFactorResult as H, type InvestmentRecord as I, type AdapterTxResult as J, type AssetRates as K, type LendingAdapter as L, type MaxWithdrawResult as M, type GasReserve as N, type HealthInfo as O, type PayOptions as P, type InvestRebalanceMove as Q, type RepayResult as R, type StrategyDefinition as S, type T2000Options as T, type PerpsAdapter as U, type PerpsPosition as V, type WithdrawResult as W, type PerpsPositionsResult as X, type PerpsTradeResult as Y, type PositionEntry as Z, type PositionSide as _, type AutoInvestStatus as a, type RebalanceStep as a0, type SwapQuote as a1, allDescriptors as a2, cetusDescriptor as a3, naviDescriptor as a4, suilendDescriptor as a5, type PendingReward as a6, type PayResult as b, type SendResult as c, type TransactionRecord as d, type SwapAdapter as e, type SaveResult as f, type BorrowResult as g, type MaxBorrowResult as h, type SwapResult as i, type InvestResult as j, type InvestEarnResult as k, type InvestRebalanceResult as l, type PendingReward$1 as m, type StrategyBuyResult as n, type StrategySellResult as o, type StrategyRebalanceResult as p, type StrategyStatusResult as q, type AutoInvestRunResult as r, type PortfolioResult as s, type InvestmentPosition as t, type PositionsResult as u, type RatesResult as v, type LendingRates as w, type RebalanceResult as x, type AdapterCapability as y, type AdapterPositions as z };
|