@t2000/sdk 0.7.1 → 0.8.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 +19 -6
- package/dist/adapters/index.cjs +338 -128
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +338 -128
- package/dist/adapters/index.js.map +1 -1
- package/dist/{index-rT0oHn8M.d.cts → index-DNjooNFy.d.cts} +54 -14
- package/dist/{index-rT0oHn8M.d.ts → index-DNjooNFy.d.ts} +54 -14
- package/dist/index.cjs +641 -161
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -3
- package/dist/index.d.ts +45 -3
- package/dist/index.js +637 -162
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -138,6 +138,7 @@ interface BalanceResponse {
|
|
|
138
138
|
gasReserve: GasReserve;
|
|
139
139
|
total: number;
|
|
140
140
|
assets: Record<string, number>;
|
|
141
|
+
stables: Record<string, number>;
|
|
141
142
|
}
|
|
142
143
|
type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup';
|
|
143
144
|
interface SendResult {
|
|
@@ -154,6 +155,7 @@ interface SaveResult {
|
|
|
154
155
|
success: boolean;
|
|
155
156
|
tx: string;
|
|
156
157
|
amount: number;
|
|
158
|
+
asset: string;
|
|
157
159
|
apy: number;
|
|
158
160
|
fee: number;
|
|
159
161
|
gasCost: number;
|
|
@@ -213,11 +215,12 @@ interface MaxBorrowResult {
|
|
|
213
215
|
healthFactorAfter: number;
|
|
214
216
|
currentHF: number;
|
|
215
217
|
}
|
|
218
|
+
interface AssetRates {
|
|
219
|
+
saveApy: number;
|
|
220
|
+
borrowApy: number;
|
|
221
|
+
}
|
|
216
222
|
interface RatesResult {
|
|
217
|
-
|
|
218
|
-
saveApy: number;
|
|
219
|
-
borrowApy: number;
|
|
220
|
-
};
|
|
223
|
+
[asset: string]: AssetRates;
|
|
221
224
|
}
|
|
222
225
|
interface PositionEntry {
|
|
223
226
|
protocol: string;
|
|
@@ -242,6 +245,30 @@ interface FundStatusResult {
|
|
|
242
245
|
earnedAllTime: number;
|
|
243
246
|
projectedMonthly: number;
|
|
244
247
|
}
|
|
248
|
+
interface RebalanceStep {
|
|
249
|
+
action: 'withdraw' | 'swap' | 'deposit';
|
|
250
|
+
protocol?: string;
|
|
251
|
+
fromAsset?: string;
|
|
252
|
+
toAsset?: string;
|
|
253
|
+
amount: number;
|
|
254
|
+
estimatedOutput?: number;
|
|
255
|
+
}
|
|
256
|
+
interface RebalanceResult {
|
|
257
|
+
executed: boolean;
|
|
258
|
+
steps: RebalanceStep[];
|
|
259
|
+
fromProtocol: string;
|
|
260
|
+
fromAsset: string;
|
|
261
|
+
toProtocol: string;
|
|
262
|
+
toAsset: string;
|
|
263
|
+
amount: number;
|
|
264
|
+
currentApy: number;
|
|
265
|
+
newApy: number;
|
|
266
|
+
annualGain: number;
|
|
267
|
+
estimatedSwapCost: number;
|
|
268
|
+
breakEvenDays: number;
|
|
269
|
+
txDigests: string[];
|
|
270
|
+
totalGasCost: number;
|
|
271
|
+
}
|
|
245
272
|
interface DepositInfo {
|
|
246
273
|
address: string;
|
|
247
274
|
network: string;
|
|
@@ -307,6 +334,17 @@ declare class ProtocolRegistry {
|
|
|
307
334
|
adapter: SwapAdapter;
|
|
308
335
|
quote: SwapQuote;
|
|
309
336
|
}>;
|
|
337
|
+
bestSaveRateAcrossAssets(): Promise<{
|
|
338
|
+
adapter: LendingAdapter;
|
|
339
|
+
rate: LendingRates;
|
|
340
|
+
asset: string;
|
|
341
|
+
}>;
|
|
342
|
+
allRatesAcrossAssets(): Promise<Array<{
|
|
343
|
+
protocol: string;
|
|
344
|
+
protocolId: string;
|
|
345
|
+
asset: string;
|
|
346
|
+
rates: LendingRates;
|
|
347
|
+
}>>;
|
|
310
348
|
allRates(asset: string): Promise<Array<{
|
|
311
349
|
protocol: string;
|
|
312
350
|
protocolId: string;
|
|
@@ -321,6 +359,8 @@ declare class ProtocolRegistry {
|
|
|
321
359
|
getSwap(id: string): SwapAdapter | undefined;
|
|
322
360
|
listLending(): LendingAdapter[];
|
|
323
361
|
listSwap(): SwapAdapter[];
|
|
362
|
+
isSupportedAsset(asset: string, capability?: AdapterCapability): boolean;
|
|
363
|
+
getSupportedAssets(capability?: AdapterCapability): string[];
|
|
324
364
|
}
|
|
325
365
|
|
|
326
366
|
declare const descriptor$3: ProtocolDescriptor;
|
|
@@ -337,16 +377,16 @@ declare class NaviAdapter implements LendingAdapter {
|
|
|
337
377
|
getRates(asset: string): Promise<LendingRates>;
|
|
338
378
|
getPositions(address: string): Promise<AdapterPositions>;
|
|
339
379
|
getHealth(address: string): Promise<HealthInfo>;
|
|
340
|
-
buildSaveTx(address: string, amount: number,
|
|
380
|
+
buildSaveTx(address: string, amount: number, asset: string, options?: {
|
|
341
381
|
collectFee?: boolean;
|
|
342
382
|
}): Promise<AdapterTxResult>;
|
|
343
|
-
buildWithdrawTx(address: string, amount: number,
|
|
383
|
+
buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
|
|
344
384
|
effectiveAmount: number;
|
|
345
385
|
}>;
|
|
346
|
-
buildBorrowTx(address: string, amount: number,
|
|
386
|
+
buildBorrowTx(address: string, amount: number, asset: string, options?: {
|
|
347
387
|
collectFee?: boolean;
|
|
348
388
|
}): Promise<AdapterTxResult>;
|
|
349
|
-
buildRepayTx(address: string, amount: number,
|
|
389
|
+
buildRepayTx(address: string, amount: number, asset: string): Promise<AdapterTxResult>;
|
|
350
390
|
maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
|
|
351
391
|
maxBorrow(address: string, _asset: string): Promise<MaxBorrowResult>;
|
|
352
392
|
}
|
|
@@ -398,22 +438,22 @@ declare class SuilendAdapter implements LendingAdapter {
|
|
|
398
438
|
getRates(asset: string): Promise<LendingRates>;
|
|
399
439
|
getPositions(address: string): Promise<AdapterPositions>;
|
|
400
440
|
getHealth(address: string): Promise<HealthInfo>;
|
|
401
|
-
buildSaveTx(address: string, amount: number,
|
|
441
|
+
buildSaveTx(address: string, amount: number, asset: string, options?: {
|
|
402
442
|
collectFee?: boolean;
|
|
403
443
|
}): Promise<AdapterTxResult>;
|
|
404
|
-
buildWithdrawTx(address: string, amount: number,
|
|
444
|
+
buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
|
|
405
445
|
effectiveAmount: number;
|
|
406
446
|
}>;
|
|
407
|
-
buildBorrowTx(
|
|
447
|
+
buildBorrowTx(address: string, amount: number, asset: string, options?: {
|
|
408
448
|
collectFee?: boolean;
|
|
409
449
|
}): Promise<AdapterTxResult>;
|
|
410
|
-
buildRepayTx(
|
|
450
|
+
buildRepayTx(address: string, amount: number, asset: string): Promise<AdapterTxResult>;
|
|
411
451
|
maxWithdraw(address: string, _asset: string): Promise<{
|
|
412
452
|
maxAmount: number;
|
|
413
453
|
healthFactorAfter: number;
|
|
414
454
|
currentHF: number;
|
|
415
455
|
}>;
|
|
416
|
-
maxBorrow(
|
|
456
|
+
maxBorrow(address: string, _asset: string): Promise<{
|
|
417
457
|
maxAmount: number;
|
|
418
458
|
healthFactorAfter: number;
|
|
419
459
|
currentHF: number;
|
|
@@ -438,4 +478,4 @@ declare function attack(client: SuiJsonRpcClient, signer: Ed25519Keypair, sentin
|
|
|
438
478
|
/** All registered protocol descriptors — used by the indexer for event classification */
|
|
439
479
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
440
480
|
|
|
441
|
-
export { type AdapterCapability as A, type BalanceResponse as B, CetusAdapter as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasMethod as G, type HealthFactorResult as H,
|
|
481
|
+
export { type AdapterCapability as A, type BalanceResponse as B, CetusAdapter as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasMethod as G, type HealthFactorResult as H, listSentinels as I, descriptor$3 as J, requestAttack as K, type LendingAdapter as L, type MaxWithdrawResult as M, NaviAdapter as N, attack as O, type PositionsResult as P, descriptor as Q, type RepayResult as R, type SendResult as S, type T2000Options as T, settleAttack as U, submitPrompt as V, type WithdrawResult as W, descriptor$1 as X, type TransactionRecord as a, type SwapAdapter as b, type SaveResult as c, type BorrowResult as d, type MaxBorrowResult as e, type SwapResult as f, type RatesResult as g, type LendingRates as h, type RebalanceResult as i, type SentinelAgent as j, type SentinelAttackResult as k, type AdapterPositions as l, type AdapterTxResult as m, type AssetRates as n, type GasReserve as o, type HealthInfo as p, type PositionEntry as q, type ProtocolDescriptor as r, ProtocolRegistry as s, type RebalanceStep as t, type SentinelVerdict as u, SuilendAdapter as v, type SwapQuote as w, allDescriptors as x, descriptor$2 as y, getSentinelInfo as z };
|
|
@@ -138,6 +138,7 @@ interface BalanceResponse {
|
|
|
138
138
|
gasReserve: GasReserve;
|
|
139
139
|
total: number;
|
|
140
140
|
assets: Record<string, number>;
|
|
141
|
+
stables: Record<string, number>;
|
|
141
142
|
}
|
|
142
143
|
type GasMethod = 'self-funded' | 'sponsored' | 'auto-topup';
|
|
143
144
|
interface SendResult {
|
|
@@ -154,6 +155,7 @@ interface SaveResult {
|
|
|
154
155
|
success: boolean;
|
|
155
156
|
tx: string;
|
|
156
157
|
amount: number;
|
|
158
|
+
asset: string;
|
|
157
159
|
apy: number;
|
|
158
160
|
fee: number;
|
|
159
161
|
gasCost: number;
|
|
@@ -213,11 +215,12 @@ interface MaxBorrowResult {
|
|
|
213
215
|
healthFactorAfter: number;
|
|
214
216
|
currentHF: number;
|
|
215
217
|
}
|
|
218
|
+
interface AssetRates {
|
|
219
|
+
saveApy: number;
|
|
220
|
+
borrowApy: number;
|
|
221
|
+
}
|
|
216
222
|
interface RatesResult {
|
|
217
|
-
|
|
218
|
-
saveApy: number;
|
|
219
|
-
borrowApy: number;
|
|
220
|
-
};
|
|
223
|
+
[asset: string]: AssetRates;
|
|
221
224
|
}
|
|
222
225
|
interface PositionEntry {
|
|
223
226
|
protocol: string;
|
|
@@ -242,6 +245,30 @@ interface FundStatusResult {
|
|
|
242
245
|
earnedAllTime: number;
|
|
243
246
|
projectedMonthly: number;
|
|
244
247
|
}
|
|
248
|
+
interface RebalanceStep {
|
|
249
|
+
action: 'withdraw' | 'swap' | 'deposit';
|
|
250
|
+
protocol?: string;
|
|
251
|
+
fromAsset?: string;
|
|
252
|
+
toAsset?: string;
|
|
253
|
+
amount: number;
|
|
254
|
+
estimatedOutput?: number;
|
|
255
|
+
}
|
|
256
|
+
interface RebalanceResult {
|
|
257
|
+
executed: boolean;
|
|
258
|
+
steps: RebalanceStep[];
|
|
259
|
+
fromProtocol: string;
|
|
260
|
+
fromAsset: string;
|
|
261
|
+
toProtocol: string;
|
|
262
|
+
toAsset: string;
|
|
263
|
+
amount: number;
|
|
264
|
+
currentApy: number;
|
|
265
|
+
newApy: number;
|
|
266
|
+
annualGain: number;
|
|
267
|
+
estimatedSwapCost: number;
|
|
268
|
+
breakEvenDays: number;
|
|
269
|
+
txDigests: string[];
|
|
270
|
+
totalGasCost: number;
|
|
271
|
+
}
|
|
245
272
|
interface DepositInfo {
|
|
246
273
|
address: string;
|
|
247
274
|
network: string;
|
|
@@ -307,6 +334,17 @@ declare class ProtocolRegistry {
|
|
|
307
334
|
adapter: SwapAdapter;
|
|
308
335
|
quote: SwapQuote;
|
|
309
336
|
}>;
|
|
337
|
+
bestSaveRateAcrossAssets(): Promise<{
|
|
338
|
+
adapter: LendingAdapter;
|
|
339
|
+
rate: LendingRates;
|
|
340
|
+
asset: string;
|
|
341
|
+
}>;
|
|
342
|
+
allRatesAcrossAssets(): Promise<Array<{
|
|
343
|
+
protocol: string;
|
|
344
|
+
protocolId: string;
|
|
345
|
+
asset: string;
|
|
346
|
+
rates: LendingRates;
|
|
347
|
+
}>>;
|
|
310
348
|
allRates(asset: string): Promise<Array<{
|
|
311
349
|
protocol: string;
|
|
312
350
|
protocolId: string;
|
|
@@ -321,6 +359,8 @@ declare class ProtocolRegistry {
|
|
|
321
359
|
getSwap(id: string): SwapAdapter | undefined;
|
|
322
360
|
listLending(): LendingAdapter[];
|
|
323
361
|
listSwap(): SwapAdapter[];
|
|
362
|
+
isSupportedAsset(asset: string, capability?: AdapterCapability): boolean;
|
|
363
|
+
getSupportedAssets(capability?: AdapterCapability): string[];
|
|
324
364
|
}
|
|
325
365
|
|
|
326
366
|
declare const descriptor$3: ProtocolDescriptor;
|
|
@@ -337,16 +377,16 @@ declare class NaviAdapter implements LendingAdapter {
|
|
|
337
377
|
getRates(asset: string): Promise<LendingRates>;
|
|
338
378
|
getPositions(address: string): Promise<AdapterPositions>;
|
|
339
379
|
getHealth(address: string): Promise<HealthInfo>;
|
|
340
|
-
buildSaveTx(address: string, amount: number,
|
|
380
|
+
buildSaveTx(address: string, amount: number, asset: string, options?: {
|
|
341
381
|
collectFee?: boolean;
|
|
342
382
|
}): Promise<AdapterTxResult>;
|
|
343
|
-
buildWithdrawTx(address: string, amount: number,
|
|
383
|
+
buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
|
|
344
384
|
effectiveAmount: number;
|
|
345
385
|
}>;
|
|
346
|
-
buildBorrowTx(address: string, amount: number,
|
|
386
|
+
buildBorrowTx(address: string, amount: number, asset: string, options?: {
|
|
347
387
|
collectFee?: boolean;
|
|
348
388
|
}): Promise<AdapterTxResult>;
|
|
349
|
-
buildRepayTx(address: string, amount: number,
|
|
389
|
+
buildRepayTx(address: string, amount: number, asset: string): Promise<AdapterTxResult>;
|
|
350
390
|
maxWithdraw(address: string, _asset: string): Promise<MaxWithdrawResult>;
|
|
351
391
|
maxBorrow(address: string, _asset: string): Promise<MaxBorrowResult>;
|
|
352
392
|
}
|
|
@@ -398,22 +438,22 @@ declare class SuilendAdapter implements LendingAdapter {
|
|
|
398
438
|
getRates(asset: string): Promise<LendingRates>;
|
|
399
439
|
getPositions(address: string): Promise<AdapterPositions>;
|
|
400
440
|
getHealth(address: string): Promise<HealthInfo>;
|
|
401
|
-
buildSaveTx(address: string, amount: number,
|
|
441
|
+
buildSaveTx(address: string, amount: number, asset: string, options?: {
|
|
402
442
|
collectFee?: boolean;
|
|
403
443
|
}): Promise<AdapterTxResult>;
|
|
404
|
-
buildWithdrawTx(address: string, amount: number,
|
|
444
|
+
buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
|
|
405
445
|
effectiveAmount: number;
|
|
406
446
|
}>;
|
|
407
|
-
buildBorrowTx(
|
|
447
|
+
buildBorrowTx(address: string, amount: number, asset: string, options?: {
|
|
408
448
|
collectFee?: boolean;
|
|
409
449
|
}): Promise<AdapterTxResult>;
|
|
410
|
-
buildRepayTx(
|
|
450
|
+
buildRepayTx(address: string, amount: number, asset: string): Promise<AdapterTxResult>;
|
|
411
451
|
maxWithdraw(address: string, _asset: string): Promise<{
|
|
412
452
|
maxAmount: number;
|
|
413
453
|
healthFactorAfter: number;
|
|
414
454
|
currentHF: number;
|
|
415
455
|
}>;
|
|
416
|
-
maxBorrow(
|
|
456
|
+
maxBorrow(address: string, _asset: string): Promise<{
|
|
417
457
|
maxAmount: number;
|
|
418
458
|
healthFactorAfter: number;
|
|
419
459
|
currentHF: number;
|
|
@@ -438,4 +478,4 @@ declare function attack(client: SuiJsonRpcClient, signer: Ed25519Keypair, sentin
|
|
|
438
478
|
/** All registered protocol descriptors — used by the indexer for event classification */
|
|
439
479
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
440
480
|
|
|
441
|
-
export { type AdapterCapability as A, type BalanceResponse as B, CetusAdapter as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasMethod as G, type HealthFactorResult as H,
|
|
481
|
+
export { type AdapterCapability as A, type BalanceResponse as B, CetusAdapter as C, type DepositInfo as D, type EarningsResult as E, type FundStatusResult as F, type GasMethod as G, type HealthFactorResult as H, listSentinels as I, descriptor$3 as J, requestAttack as K, type LendingAdapter as L, type MaxWithdrawResult as M, NaviAdapter as N, attack as O, type PositionsResult as P, descriptor as Q, type RepayResult as R, type SendResult as S, type T2000Options as T, settleAttack as U, submitPrompt as V, type WithdrawResult as W, descriptor$1 as X, type TransactionRecord as a, type SwapAdapter as b, type SaveResult as c, type BorrowResult as d, type MaxBorrowResult as e, type SwapResult as f, type RatesResult as g, type LendingRates as h, type RebalanceResult as i, type SentinelAgent as j, type SentinelAttackResult as k, type AdapterPositions as l, type AdapterTxResult as m, type AssetRates as n, type GasReserve as o, type HealthInfo as p, type PositionEntry as q, type ProtocolDescriptor as r, ProtocolRegistry as s, type RebalanceStep as t, type SentinelVerdict as u, SuilendAdapter as v, type SwapQuote as w, allDescriptors as x, descriptor$2 as y, getSentinelInfo as z };
|