@t2000/sdk 0.10.3 → 0.11.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 +20 -4
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/index.cjs +184 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -3
- package/dist/index.d.ts +61 -3
- package/dist/index.js +182 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,10 +97,10 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
97
97
|
| `agent.address()` | Wallet Sui address | `string` |
|
|
98
98
|
| `agent.balance()` | Available USDC + savings + gas reserve | `BalanceResponse` |
|
|
99
99
|
| `agent.send({ to, amount, asset? })` | Transfer USDC to any Sui address | `SendResult` |
|
|
100
|
-
| `agent.save({ amount, protocol? })` | Deposit
|
|
100
|
+
| `agent.save({ amount, protocol? })` | Deposit to savings (earn APY). Auto-converts non-USDC stables. Auto-selects best rate or specify `protocol`. `amount` can be `'all'`. | `SaveResult` |
|
|
101
101
|
| `agent.withdraw({ amount })` | Withdraw from savings. Always returns USDC (auto-swaps non-USDC positions). `amount` can be `'all'`. | `WithdrawResult` |
|
|
102
102
|
| `agent.borrow({ amount })` | Borrow USDC against collateral | `BorrowResult` |
|
|
103
|
-
| `agent.repay({ amount })` | Repay outstanding USDC
|
|
103
|
+
| `agent.repay({ amount })` | Repay outstanding debt (auto-swaps USDC to borrowed asset if non-USDC). `amount` can be `'all'`. | `RepayResult` |
|
|
104
104
|
| `agent.rebalance({ dryRun?, minYieldDiff?, maxBreakEven? })` | Optimize yield — move savings to best rate across protocols/stablecoins internally. Dry-run for preview. | `RebalanceResult` |
|
|
105
105
|
| `agent.exchange({ from, to, amount, maxSlippage? })` | Exchange tokens via Cetus DEX (e.g. USDC ⇌ SUI). On-chain slippage protection. | `SwapResult` |
|
|
106
106
|
| `agent.exchangeQuote({ from, to, amount })` | Get exchange quote without executing | `{ expectedOutput, priceImpact, poolPrice, fee }` |
|
|
@@ -129,6 +129,20 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
|
129
129
|
| `agent.sentinelInfo(id)` | Get sentinel details (from API or on-chain) | `SentinelAgent` |
|
|
130
130
|
| `agent.sentinelAttack(id, prompt, fee?)` | Full attack flow: request → TEE → settle | `SentinelAttackResult` |
|
|
131
131
|
|
|
132
|
+
### Safeguards (Enforcer)
|
|
133
|
+
|
|
134
|
+
| Method | Description | Returns |
|
|
135
|
+
|--------|-------------|---------|
|
|
136
|
+
| `agent.enforcer.getConfig()` | Get safeguard settings | `SafeguardConfig` |
|
|
137
|
+
| `agent.enforcer.set({ maxPerTx?, maxDailySend? })` | Set per-transaction and/or daily send limits | `void` |
|
|
138
|
+
| `agent.enforcer.lock()` | Lock agent (freeze all operations) | `void` |
|
|
139
|
+
| `agent.enforcer.unlock(pin)` | Unlock agent | `void` |
|
|
140
|
+
| `agent.enforcer.check(amount)` | Check if amount is allowed under limits | `void` (throws `SafeguardError` if not) |
|
|
141
|
+
| `agent.enforcer.recordUsage(amount)` | Record send for daily limit tracking | `void` |
|
|
142
|
+
| `agent.enforcer.isConfigured()` | Whether safeguards are set up | `boolean` |
|
|
143
|
+
|
|
144
|
+
**Types:** `SafeguardConfig` — `{ maxPerTx?, maxDailySend?, locked? }` · `SafeguardError` — thrown when limits exceeded or agent locked
|
|
145
|
+
|
|
132
146
|
### Key Management
|
|
133
147
|
|
|
134
148
|
```typescript
|
|
@@ -249,8 +263,10 @@ Options like `pin`, `keyPath`, and `rpcUrl` are passed directly to `T2000.create
|
|
|
249
263
|
|
|
250
264
|
## Supported Assets
|
|
251
265
|
|
|
252
|
-
User-facing
|
|
253
|
-
|
|
266
|
+
User-facing commands are denominated in USDC — the user always thinks in USDC.
|
|
267
|
+
Save auto-converts non-USDC wallet stablecoins, withdraw auto-swaps non-USDC
|
|
268
|
+
positions back to USDC, and repay auto-swaps USDC to the borrowed asset if
|
|
269
|
+
debt is non-USDC (from rebalance). Rebalance optimizes across all stablecoins internally.
|
|
254
270
|
|
|
255
271
|
| Asset | Display | Type | Decimals | Save | Borrow | Withdraw | Rebalance (internal) |
|
|
256
272
|
|-------|---------|------|----------|------|--------|----------|---------------------|
|