@t2000/sdk 0.19.17 → 0.19.20
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 +4 -4
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/{index-Br3apJsB.d.cts → index-DAxuyiS2.d.cts} +7 -7
- package/dist/{index-Br3apJsB.d.ts → index-DAxuyiS2.d.ts} +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -144,8 +144,8 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
144
144
|
| `agent.rebalance({ dryRun?, minYieldDiff?, maxBreakEven? })` | Optimize yield — move savings to best rate across protocols/stablecoins internally. Dry-run for preview. | `RebalanceResult` |
|
|
145
145
|
| `agent.swap({ from, to, amount, maxSlippage? })` | Swap tokens via Cetus DEX (e.g. USDC ⇌ SUI). On-chain slippage protection. | `SwapResult` |
|
|
146
146
|
| `agent.swapQuote({ from, to, amount })` | Get swap quote without executing | `{ expectedOutput, priceImpact, poolPrice, fee }` |
|
|
147
|
-
| `agent.buy({ asset, usdAmount, maxSlippage? })` | Buy crypto asset with USD | `
|
|
148
|
-
| `agent.sell({ asset, usdAmount \| 'all', maxSlippage? })` | Sell crypto back to USDC (auto-withdraws if earning) | `
|
|
147
|
+
| `agent.buy({ asset, usdAmount, maxSlippage? })` | Buy crypto asset with USD | `InvestResult` |
|
|
148
|
+
| `agent.sell({ asset, usdAmount \| 'all', maxSlippage? })` | Sell crypto back to USDC (auto-withdraws if earning) | `InvestResult` |
|
|
149
149
|
| `agent.exportKey()` | Export private key (bech32 format) | `string` |
|
|
150
150
|
|
|
151
151
|
### Query Methods
|
|
@@ -195,14 +195,14 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
195
195
|
|
|
196
196
|
**Types:** `SafeguardConfig` — `{ maxPerTx?, maxDailySend?, locked? }` · `SafeguardError` — thrown when limits exceeded or agent locked
|
|
197
197
|
|
|
198
|
-
###
|
|
198
|
+
### Investment Yield Methods
|
|
199
199
|
|
|
200
200
|
| Method | Description | Returns |
|
|
201
201
|
|--------|-------------|---------|
|
|
202
202
|
| `agent.investEarn({ asset })` | Deposit held asset into best-rate lending for yield | `InvestEarnResult` |
|
|
203
203
|
| `agent.investUnearn({ asset })` | Withdraw from lending, keep in portfolio | `InvestUnearnResult` |
|
|
204
204
|
| `agent.investRebalance({ dryRun?, minYieldDiff? })` | Move earning positions to better-rate protocols | `InvestRebalanceResult` |
|
|
205
|
-
| `agent.getPortfolio()` |
|
|
205
|
+
| `agent.getPortfolio()` | Investment positions + P&L (grouped by strategy) | `PortfolioResult` |
|
|
206
206
|
|
|
207
207
|
> **Deprecated aliases:** `agent.exchange()` and `agent.exchangeQuote()` still work but are deprecated — use `agent.swap()` and `agent.swapQuote()`. Similarly, `agent.investBuy()` and `agent.investSell()` are deprecated — use `agent.buy()` and `agent.sell()`.
|
|
208
208
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { K as AdapterCapability, N as AdapterPositions, O as AdapterTxResult, U as CetusAdapter, X as HealthInfo, L as LendingAdapter, x as LendingRates, Z as NaviAdapter, _ as PerpsAdapter,
|
|
1
|
+
export { K as AdapterCapability, N as AdapterPositions, O as AdapterTxResult, U as CetusAdapter, X as HealthInfo, L as LendingAdapter, x as LendingRates, Z as NaviAdapter, _ as PerpsAdapter, a4 as ProtocolDescriptor, a5 as ProtocolRegistry, a8 as SuilendAdapter, f as SwapAdapter, a9 as SwapQuote, aa as allDescriptors, ab as cetusDescriptor, ae as naviDescriptor, ah as sentinelDescriptor, ak as suilendDescriptor } from '../index-DAxuyiS2.cjs';
|
|
2
2
|
import '@mysten/sui/transactions';
|
|
3
3
|
import '@mysten/sui/jsonRpc';
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { K as AdapterCapability, N as AdapterPositions, O as AdapterTxResult, U as CetusAdapter, X as HealthInfo, L as LendingAdapter, x as LendingRates, Z as NaviAdapter, _ as PerpsAdapter,
|
|
1
|
+
export { K as AdapterCapability, N as AdapterPositions, O as AdapterTxResult, U as CetusAdapter, X as HealthInfo, L as LendingAdapter, x as LendingRates, Z as NaviAdapter, _ as PerpsAdapter, a4 as ProtocolDescriptor, a5 as ProtocolRegistry, a8 as SuilendAdapter, f as SwapAdapter, a9 as SwapQuote, aa as allDescriptors, ab as cetusDescriptor, ae as naviDescriptor, ah as sentinelDescriptor, ak as suilendDescriptor } from '../index-DAxuyiS2.js';
|
|
2
2
|
import '@mysten/sui/transactions';
|
|
3
3
|
import '@mysten/sui/jsonRpc';
|
|
@@ -205,7 +205,7 @@ interface SentinelAttackResult {
|
|
|
205
205
|
won: boolean;
|
|
206
206
|
feePaid: number;
|
|
207
207
|
}
|
|
208
|
-
interface
|
|
208
|
+
interface InvestmentRecord {
|
|
209
209
|
id: string;
|
|
210
210
|
type: 'buy' | 'sell';
|
|
211
211
|
asset: string;
|
|
@@ -225,7 +225,7 @@ interface InvestmentPosition {
|
|
|
225
225
|
currentValue: number;
|
|
226
226
|
unrealizedPnL: number;
|
|
227
227
|
unrealizedPnLPct: number;
|
|
228
|
-
trades:
|
|
228
|
+
trades: InvestmentRecord[];
|
|
229
229
|
earning?: boolean;
|
|
230
230
|
earningProtocol?: string;
|
|
231
231
|
earningApy?: number;
|
|
@@ -404,7 +404,7 @@ interface PerpsPosition {
|
|
|
404
404
|
unrealizedPnL: number;
|
|
405
405
|
unrealizedPnLPct: number;
|
|
406
406
|
}
|
|
407
|
-
interface
|
|
407
|
+
interface PerpsTradeResult {
|
|
408
408
|
success: boolean;
|
|
409
409
|
action: 'open' | 'close';
|
|
410
410
|
market: string;
|
|
@@ -417,7 +417,7 @@ interface TradeResult {
|
|
|
417
417
|
realizedPnL?: number;
|
|
418
418
|
tx?: string;
|
|
419
419
|
}
|
|
420
|
-
interface
|
|
420
|
+
interface PerpsPositionsResult {
|
|
421
421
|
positions: PerpsPosition[];
|
|
422
422
|
totalMargin: number;
|
|
423
423
|
totalUnrealizedPnL: number;
|
|
@@ -613,8 +613,8 @@ interface PerpsAdapter {
|
|
|
613
613
|
side: PositionSide;
|
|
614
614
|
margin: number;
|
|
615
615
|
leverage: number;
|
|
616
|
-
}): Promise<
|
|
617
|
-
closePosition(market: string): Promise<
|
|
616
|
+
}): Promise<PerpsTradeResult>;
|
|
617
|
+
closePosition(market: string): Promise<PerpsTradeResult>;
|
|
618
618
|
}
|
|
619
619
|
|
|
620
620
|
declare class ProtocolRegistry {
|
|
@@ -801,4 +801,4 @@ declare function attack(client: SuiJsonRpcClient, signer: TransactionSigner, sen
|
|
|
801
801
|
/** All registered protocol descriptors — used by the indexer for event classification */
|
|
802
802
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
803
803
|
|
|
804
|
-
export { type PerpsPosition 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 SentinelAttackResult as G, type HealthFactorResult as H, type
|
|
804
|
+
export { type PerpsPosition 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 SentinelAttackResult as G, type HealthFactorResult as H, type InvestmentRecord as I, type GasMethod as J, type AdapterCapability as K, type LendingAdapter as L, type MaxWithdrawResult as M, type AdapterPositions as N, type AdapterTxResult as O, type PayOptions as P, type AssetRates as Q, type RepayResult as R, type StrategyDefinition as S, type TransactionSigner as T, CetusAdapter as U, type GasReserve as V, type WithdrawResult as W, type HealthInfo as X, type InvestRebalanceMove as Y, NaviAdapter as Z, type PerpsAdapter as _, type AutoInvestStatus as a, type PerpsPositionsResult as a0, type PerpsTradeResult as a1, type PositionEntry as a2, type PositionSide as a3, type ProtocolDescriptor as a4, ProtocolRegistry as a5, type RebalanceStep as a6, type SentinelVerdict as a7, SuilendAdapter as a8, type SwapQuote as a9, allDescriptors as aa, descriptor$2 as ab, getSentinelInfo as ac, listSentinels as ad, descriptor$3 as ae, requestAttack as af, attack as ag, descriptor as ah, settleAttack as ai, submitPrompt as aj, descriptor$1 as ak, type T2000Options as b, type PayResult as c, type SendResult as d, type TransactionRecord as e, type SwapAdapter as f, type SaveResult as g, type BorrowResult as h, type MaxBorrowResult as i, type SwapResult as j, type InvestResult as k, type InvestEarnResult as l, type InvestRebalanceResult as m, type PendingReward$1 as n, type StrategyBuyResult as o, type StrategySellResult as p, type StrategyRebalanceResult as q, type StrategyStatusResult as r, type AutoInvestRunResult as s, type PortfolioResult as t, type InvestmentPosition as u, type PositionsResult as v, type RatesResult as w, type LendingRates as x, type RebalanceResult as y, type SentinelAgent as z };
|
|
@@ -205,7 +205,7 @@ interface SentinelAttackResult {
|
|
|
205
205
|
won: boolean;
|
|
206
206
|
feePaid: number;
|
|
207
207
|
}
|
|
208
|
-
interface
|
|
208
|
+
interface InvestmentRecord {
|
|
209
209
|
id: string;
|
|
210
210
|
type: 'buy' | 'sell';
|
|
211
211
|
asset: string;
|
|
@@ -225,7 +225,7 @@ interface InvestmentPosition {
|
|
|
225
225
|
currentValue: number;
|
|
226
226
|
unrealizedPnL: number;
|
|
227
227
|
unrealizedPnLPct: number;
|
|
228
|
-
trades:
|
|
228
|
+
trades: InvestmentRecord[];
|
|
229
229
|
earning?: boolean;
|
|
230
230
|
earningProtocol?: string;
|
|
231
231
|
earningApy?: number;
|
|
@@ -404,7 +404,7 @@ interface PerpsPosition {
|
|
|
404
404
|
unrealizedPnL: number;
|
|
405
405
|
unrealizedPnLPct: number;
|
|
406
406
|
}
|
|
407
|
-
interface
|
|
407
|
+
interface PerpsTradeResult {
|
|
408
408
|
success: boolean;
|
|
409
409
|
action: 'open' | 'close';
|
|
410
410
|
market: string;
|
|
@@ -417,7 +417,7 @@ interface TradeResult {
|
|
|
417
417
|
realizedPnL?: number;
|
|
418
418
|
tx?: string;
|
|
419
419
|
}
|
|
420
|
-
interface
|
|
420
|
+
interface PerpsPositionsResult {
|
|
421
421
|
positions: PerpsPosition[];
|
|
422
422
|
totalMargin: number;
|
|
423
423
|
totalUnrealizedPnL: number;
|
|
@@ -613,8 +613,8 @@ interface PerpsAdapter {
|
|
|
613
613
|
side: PositionSide;
|
|
614
614
|
margin: number;
|
|
615
615
|
leverage: number;
|
|
616
|
-
}): Promise<
|
|
617
|
-
closePosition(market: string): Promise<
|
|
616
|
+
}): Promise<PerpsTradeResult>;
|
|
617
|
+
closePosition(market: string): Promise<PerpsTradeResult>;
|
|
618
618
|
}
|
|
619
619
|
|
|
620
620
|
declare class ProtocolRegistry {
|
|
@@ -801,4 +801,4 @@ declare function attack(client: SuiJsonRpcClient, signer: TransactionSigner, sen
|
|
|
801
801
|
/** All registered protocol descriptors — used by the indexer for event classification */
|
|
802
802
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
803
803
|
|
|
804
|
-
export { type PerpsPosition 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 SentinelAttackResult as G, type HealthFactorResult as H, type
|
|
804
|
+
export { type PerpsPosition 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 SentinelAttackResult as G, type HealthFactorResult as H, type InvestmentRecord as I, type GasMethod as J, type AdapterCapability as K, type LendingAdapter as L, type MaxWithdrawResult as M, type AdapterPositions as N, type AdapterTxResult as O, type PayOptions as P, type AssetRates as Q, type RepayResult as R, type StrategyDefinition as S, type TransactionSigner as T, CetusAdapter as U, type GasReserve as V, type WithdrawResult as W, type HealthInfo as X, type InvestRebalanceMove as Y, NaviAdapter as Z, type PerpsAdapter as _, type AutoInvestStatus as a, type PerpsPositionsResult as a0, type PerpsTradeResult as a1, type PositionEntry as a2, type PositionSide as a3, type ProtocolDescriptor as a4, ProtocolRegistry as a5, type RebalanceStep as a6, type SentinelVerdict as a7, SuilendAdapter as a8, type SwapQuote as a9, allDescriptors as aa, descriptor$2 as ab, getSentinelInfo as ac, listSentinels as ad, descriptor$3 as ae, requestAttack as af, attack as ag, descriptor as ah, settleAttack as ai, submitPrompt as aj, descriptor$1 as ak, type T2000Options as b, type PayResult as c, type SendResult as d, type TransactionRecord as e, type SwapAdapter as f, type SaveResult as g, type BorrowResult as h, type MaxBorrowResult as i, type SwapResult as j, type InvestResult as k, type InvestEarnResult as l, type InvestRebalanceResult as m, type PendingReward$1 as n, type StrategyBuyResult as o, type StrategySellResult as p, type StrategyRebalanceResult as q, type StrategyStatusResult as r, type AutoInvestRunResult as s, type PortfolioResult as t, type InvestmentPosition as u, type PositionsResult as v, type RatesResult as w, type LendingRates as x, type RebalanceResult as y, type SentinelAgent as z };
|