@t2000/sdk 0.10.0 → 0.10.2
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 +6 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/{index-CrLRqDFL.d.cts → index-UOQejD-B.d.cts} +1 -1
- package/dist/{index-CrLRqDFL.d.ts → index-UOQejD-B.d.ts} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -5
- package/dist/index.d.ts +22 -5
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,9 @@ await agent.save({ amount: 50 });
|
|
|
43
43
|
// Borrow USDC against your collateral
|
|
44
44
|
await agent.borrow({ amount: 25 });
|
|
45
45
|
|
|
46
|
+
// Exchange tokens (e.g. USDC ⇌ SUI)
|
|
47
|
+
await agent.exchange({ from: 'USDC', to: 'SUI', amount: 5 });
|
|
48
|
+
|
|
46
49
|
// Rebalance — move savings to the best rate (dry-run first)
|
|
47
50
|
const plan = await agent.rebalance({ dryRun: true });
|
|
48
51
|
console.log(`+${plan.annualGain.toFixed(2)}/year, break-even: ${plan.breakEvenDays} days`);
|
|
@@ -99,6 +102,8 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
99
102
|
| `agent.borrow({ amount })` | Borrow USDC against collateral | `BorrowResult` |
|
|
100
103
|
| `agent.repay({ amount })` | Repay outstanding USDC borrows. `amount` can be `'all'`. | `RepayResult` |
|
|
101
104
|
| `agent.rebalance({ dryRun?, minYieldDiff?, maxBreakEven? })` | Optimize yield — move savings to best rate across protocols/stablecoins internally. Dry-run for preview. | `RebalanceResult` |
|
|
105
|
+
| `agent.exchange({ from, to, amount, maxSlippage? })` | Exchange tokens via Cetus DEX (e.g. USDC ⇌ SUI). On-chain slippage protection. | `SwapResult` |
|
|
106
|
+
| `agent.exchangeQuote({ from, to, amount })` | Get exchange quote without executing | `{ expectedOutput, priceImpact, poolPrice, fee }` |
|
|
102
107
|
| `agent.exportKey()` | Export private key (bech32 format) | `string` |
|
|
103
108
|
|
|
104
109
|
### Query Methods
|
|
@@ -306,7 +311,7 @@ pnpm --filter @t2000/sdk test
|
|
|
306
311
|
|-----------|-----|-------|
|
|
307
312
|
| Save (deposit) | 0.10% | Protocol fee on deposit |
|
|
308
313
|
| Borrow | 0.05% | Protocol fee on loan |
|
|
309
|
-
|
|
|
314
|
+
| Exchange | **Free** | Cetus pool fees only; used internally by rebalance/auto-convert |
|
|
310
315
|
| Withdraw | Free | |
|
|
311
316
|
| Repay | Free | |
|
|
312
317
|
| Send | Free | |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AdapterCapability,
|
|
1
|
+
export { A as AdapterCapability, l as AdapterPositions, m as AdapterTxResult, C as CetusAdapter, p as HealthInfo, L as LendingAdapter, h as LendingRates, N as NaviAdapter, r as ProtocolDescriptor, s as ProtocolRegistry, v as SuilendAdapter, b as SwapAdapter, w as SwapQuote, x as allDescriptors, y as cetusDescriptor, J as naviDescriptor, Q as sentinelDescriptor, X as suilendDescriptor } from '../index-UOQejD-B.cjs';
|
|
2
2
|
import '@mysten/sui/transactions';
|
|
3
3
|
import '@mysten/sui/jsonRpc';
|
|
4
4
|
import '@mysten/sui/keypairs/ed25519';
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AdapterCapability,
|
|
1
|
+
export { A as AdapterCapability, l as AdapterPositions, m as AdapterTxResult, C as CetusAdapter, p as HealthInfo, L as LendingAdapter, h as LendingRates, N as NaviAdapter, r as ProtocolDescriptor, s as ProtocolRegistry, v as SuilendAdapter, b as SwapAdapter, w as SwapQuote, x as allDescriptors, y as cetusDescriptor, J as naviDescriptor, Q as sentinelDescriptor, X as suilendDescriptor } from '../index-UOQejD-B.js';
|
|
2
2
|
import '@mysten/sui/transactions';
|
|
3
3
|
import '@mysten/sui/jsonRpc';
|
|
4
4
|
import '@mysten/sui/keypairs/ed25519';
|
|
@@ -509,4 +509,4 @@ declare function attack(client: SuiJsonRpcClient, signer: Ed25519Keypair, sentin
|
|
|
509
509
|
/** All registered protocol descriptors — used by the indexer for event classification */
|
|
510
510
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
511
511
|
|
|
512
|
-
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
|
|
512
|
+
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 };
|
|
@@ -509,4 +509,4 @@ declare function attack(client: SuiJsonRpcClient, signer: Ed25519Keypair, sentin
|
|
|
509
509
|
/** All registered protocol descriptors — used by the indexer for event classification */
|
|
510
510
|
declare const allDescriptors: ProtocolDescriptor[];
|
|
511
511
|
|
|
512
|
-
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
|
|
512
|
+
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -3199,8 +3199,8 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
3199
3199
|
}
|
|
3200
3200
|
return hf;
|
|
3201
3201
|
}
|
|
3202
|
-
// --
|
|
3203
|
-
async
|
|
3202
|
+
// -- Exchange --
|
|
3203
|
+
async exchange(params) {
|
|
3204
3204
|
const fromAsset = params.from;
|
|
3205
3205
|
const toAsset = params.to;
|
|
3206
3206
|
if (!(fromAsset in SUPPORTED_ASSETS) || !(toAsset in SUPPORTED_ASSETS)) {
|
|
@@ -3253,7 +3253,7 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
3253
3253
|
gasMethod: gasResult.gasMethod
|
|
3254
3254
|
};
|
|
3255
3255
|
}
|
|
3256
|
-
async
|
|
3256
|
+
async exchangeQuote(params) {
|
|
3257
3257
|
const fromAsset = params.from;
|
|
3258
3258
|
const toAsset = params.to;
|
|
3259
3259
|
const best = await this.registry.bestSwapQuote(fromAsset, toAsset, params.amount);
|