@t2000/sdk 0.7.2 → 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.
@@ -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
- USDC: {
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, _asset: string, options?: {
380
+ buildSaveTx(address: string, amount: number, asset: string, options?: {
341
381
  collectFee?: boolean;
342
382
  }): Promise<AdapterTxResult>;
343
- buildWithdrawTx(address: string, amount: number, _asset: string): Promise<AdapterTxResult & {
383
+ buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
344
384
  effectiveAmount: number;
345
385
  }>;
346
- buildBorrowTx(address: string, amount: number, _asset: string, options?: {
386
+ buildBorrowTx(address: string, amount: number, asset: string, options?: {
347
387
  collectFee?: boolean;
348
388
  }): Promise<AdapterTxResult>;
349
- buildRepayTx(address: string, amount: number, _asset: string): Promise<AdapterTxResult>;
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, _asset: string, options?: {
441
+ buildSaveTx(address: string, amount: number, asset: string, options?: {
402
442
  collectFee?: boolean;
403
443
  }): Promise<AdapterTxResult>;
404
- buildWithdrawTx(address: string, amount: number, _asset: string): Promise<AdapterTxResult & {
444
+ buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
405
445
  effectiveAmount: number;
406
446
  }>;
407
- buildBorrowTx(_address: string, _amount: number, _asset: string, _options?: {
447
+ buildBorrowTx(address: string, amount: number, asset: string, options?: {
408
448
  collectFee?: boolean;
409
449
  }): Promise<AdapterTxResult>;
410
- buildRepayTx(_address: string, _amount: number, _asset: string): Promise<AdapterTxResult>;
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(_address: string, _asset: string): Promise<{
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, attack as I, descriptor as J, settleAttack as K, type LendingAdapter as L, type MaxWithdrawResult as M, NaviAdapter as N, submitPrompt as O, type PositionsResult as P, descriptor$1 as Q, type RepayResult as R, type SendResult as S, type T2000Options as T, type WithdrawResult as W, 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 SentinelAgent as i, type SentinelAttackResult as j, type AdapterPositions as k, type AdapterTxResult as l, type GasReserve as m, type HealthInfo as n, type PositionEntry as o, type ProtocolDescriptor as p, ProtocolRegistry as q, type SentinelVerdict as r, SuilendAdapter as s, type SwapQuote as t, allDescriptors as u, descriptor$2 as v, getSentinelInfo as w, listSentinels as x, descriptor$3 as y, requestAttack as z };
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
- USDC: {
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, _asset: string, options?: {
380
+ buildSaveTx(address: string, amount: number, asset: string, options?: {
341
381
  collectFee?: boolean;
342
382
  }): Promise<AdapterTxResult>;
343
- buildWithdrawTx(address: string, amount: number, _asset: string): Promise<AdapterTxResult & {
383
+ buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
344
384
  effectiveAmount: number;
345
385
  }>;
346
- buildBorrowTx(address: string, amount: number, _asset: string, options?: {
386
+ buildBorrowTx(address: string, amount: number, asset: string, options?: {
347
387
  collectFee?: boolean;
348
388
  }): Promise<AdapterTxResult>;
349
- buildRepayTx(address: string, amount: number, _asset: string): Promise<AdapterTxResult>;
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, _asset: string, options?: {
441
+ buildSaveTx(address: string, amount: number, asset: string, options?: {
402
442
  collectFee?: boolean;
403
443
  }): Promise<AdapterTxResult>;
404
- buildWithdrawTx(address: string, amount: number, _asset: string): Promise<AdapterTxResult & {
444
+ buildWithdrawTx(address: string, amount: number, asset: string): Promise<AdapterTxResult & {
405
445
  effectiveAmount: number;
406
446
  }>;
407
- buildBorrowTx(_address: string, _amount: number, _asset: string, _options?: {
447
+ buildBorrowTx(address: string, amount: number, asset: string, options?: {
408
448
  collectFee?: boolean;
409
449
  }): Promise<AdapterTxResult>;
410
- buildRepayTx(_address: string, _amount: number, _asset: string): Promise<AdapterTxResult>;
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(_address: string, _asset: string): Promise<{
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, attack as I, descriptor as J, settleAttack as K, type LendingAdapter as L, type MaxWithdrawResult as M, NaviAdapter as N, submitPrompt as O, type PositionsResult as P, descriptor$1 as Q, type RepayResult as R, type SendResult as S, type T2000Options as T, type WithdrawResult as W, 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 SentinelAgent as i, type SentinelAttackResult as j, type AdapterPositions as k, type AdapterTxResult as l, type GasReserve as m, type HealthInfo as n, type PositionEntry as o, type ProtocolDescriptor as p, ProtocolRegistry as q, type SentinelVerdict as r, SuilendAdapter as s, type SwapQuote as t, allDescriptors as u, descriptor$2 as v, getSentinelInfo as w, listSentinels as x, descriptor$3 as y, requestAttack as z };
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 };