@t2000/sdk 3.3.0 → 4.0.1
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 -322
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/browser.cjs +5 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -1
- package/dist/browser.d.ts +2 -1
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +245 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -16
- package/dist/index.d.ts +117 -16
- package/dist/index.js +238 -113
- package/dist/index.js.map +1 -1
- package/dist/{types-C1DH4kPA.d.cts → types-CqpN8a8R.d.cts} +55 -4
- package/dist/{types-DjeENMuV.d.ts → types-_U9XXGFR.d.ts} +55 -4
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,344 +1,41 @@
|
|
|
1
1
|
# @t2000/sdk
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The TypeScript SDK for Agent Wallets on Sui. One class (`T2000`) — wallet signing, gasless USDC + USDsui sends, Cetus swap routing, MPP paid API access, and programmatic NAVI lending builders.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@t2000/sdk)
|
|
6
|
+
[](https://www.npmjs.com/package/@t2000/cli)
|
|
7
|
+
[](https://developers.t2000.ai/agent-sdk)
|
|
8
|
+
[](https://github.com/mission69b/t2000/blob/main/LICENSE)
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
[](https://opensource.org/licenses/MIT)
|
|
9
|
-
|
|
10
|
-
**[Website](https://t2000.ai)** · **[GitHub](https://github.com/mission69b/t2000)** · **[CLI](https://www.npmjs.com/package/@t2000/cli)** · **[MPP](https://www.npmjs.com/package/@suimpp/mpp)** · **[MCP](https://www.npmjs.com/package/@t2000/mcp)**
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
10
|
+
## Install
|
|
13
11
|
|
|
14
12
|
```bash
|
|
15
13
|
npm install @t2000/sdk
|
|
16
|
-
# or
|
|
17
|
-
pnpm add @t2000/sdk
|
|
18
|
-
# or
|
|
19
|
-
yarn add @t2000/sdk
|
|
20
14
|
```
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
Requires Node.js 18+ · TypeScript 5+ recommended.
|
|
23
17
|
|
|
24
|
-
## Quick
|
|
18
|
+
## Quick start
|
|
25
19
|
|
|
26
20
|
```typescript
|
|
27
21
|
import { T2000 } from '@t2000/sdk';
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
// Or load an existing one
|
|
33
|
-
const agent = await T2000.create({ pin: 'my-secret' });
|
|
34
|
-
|
|
35
|
-
// Check balance
|
|
36
|
-
const balance = await agent.balance();
|
|
37
|
-
console.log(`$${balance.available} USDC available`);
|
|
38
|
-
|
|
39
|
-
// Send USDC — recipient can be a 0x address, a SuiNS name, or a saved contact alias
|
|
40
|
-
await agent.send({ to: '0x...', amount: 10 });
|
|
41
|
-
await agent.send({ to: 'alex.sui', amount: 10 }); // SuiNS — resolved on-chain
|
|
42
|
-
// Legacy contact aliases (~/.t2000/contacts.json) still work but emit a deprecation
|
|
43
|
-
// warning on first use per process. Sunset target: next major SDK release.
|
|
44
|
-
|
|
45
|
-
// Save (earn yield — auto-selects best rate via NAVI)
|
|
46
|
-
await agent.save({ amount: 50 });
|
|
47
|
-
|
|
48
|
-
// Borrow USDC against your collateral
|
|
49
|
-
await agent.borrow({ amount: 25 });
|
|
50
|
-
|
|
51
|
-
// Withdraw from savings (USDC)
|
|
52
|
-
await agent.withdraw({ amount: 25 });
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## API Reference
|
|
56
|
-
|
|
57
|
-
### `T2000.init(options)` — Create a new wallet
|
|
58
|
-
|
|
59
|
-
Creates a new Agentic Wallet (generates keypair, encrypts, and saves to disk). Fund the returned address with a small amount of SUI for gas (Mercuryo: https://exchange.mercuryo.io/?widget_id=89960d1a-8db7-49e5-8823-4c5e01c1cea2) plus USDC to transact.
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
const { agent, address } = await T2000.init({
|
|
63
|
-
pin: 'my-secret', // Required — encrypts the key
|
|
64
|
-
keyPath: '~/.t2000/wallet.key', // Optional — custom key file path
|
|
65
|
-
});
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### `T2000.create(options)` — Load an existing wallet
|
|
69
|
-
|
|
70
|
-
Loads an existing Agentic Wallet from an encrypted key file. Throws `WALLET_NOT_FOUND` if no wallet exists.
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
const agent = await T2000.create({
|
|
74
|
-
pin: 'my-secret', // Required — decrypts the key
|
|
75
|
-
keyPath: '~/.t2000/wallet.key', // Optional — custom key file path
|
|
76
|
-
rpcUrl: 'https://...', // Optional — custom Sui RPC endpoint
|
|
77
|
-
});
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### `T2000.fromPrivateKey(key, options?)` — Load from raw key
|
|
81
|
-
|
|
82
|
-
Synchronous factory that creates an agent from a raw private key (bech32 `suiprivkey1...` or hex).
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
const agent = T2000.fromPrivateKey('suiprivkey1q...');
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Core Methods
|
|
89
|
-
|
|
90
|
-
| Method | Description | Returns |
|
|
91
|
-
|--------|-------------|---------|
|
|
92
|
-
| `agent.address()` | Wallet Sui address | `string` |
|
|
93
|
-
| `agent.balance()` | Available USDC + savings + gas reserve | `BalanceResponse` |
|
|
94
|
-
| `agent.send({ to, amount, asset? })` | Transfer USDC (or other supported asset) to a 0x address, SuiNS name (`alex.sui`), or saved contact alias. Priority: hex > SuiNS > contact. `SendResult.suinsName` / `.contactName` flag which path resolved. | `SendResult` |
|
|
95
|
-
| `agent.resolveRecipient(input)` | Public resolver — same hex / SuiNS / contact priority used by `send()`. Useful for dryRun previews where you need the resolved address before committing. | `{ address, suinsName?, contactName? }` |
|
|
96
|
-
| `agent.receive({ amount?, currency?, memo?, label? })` | Generate payment request with Payment Kit URI (`sui:pay?...`), nonce for duplicate prevention | `PaymentRequest` |
|
|
97
|
-
| `agent.save({ amount, asset?, protocol? })` | Deposit **USDC or USDsui** to NAVI savings (v0.51.0+). `asset` defaults to `'USDC'`. Auto-selects best rate or specify `protocol`. `amount` can be `'all'`. | `SaveResult` |
|
|
98
|
-
| `agent.withdraw({ amount, asset? })` | Withdraw from savings. `amount` can be `'all'`. Optional `asset` (default: USDC; also supports USDsui plus legacy USDe / SUI). | `WithdrawResult` |
|
|
99
|
-
| `agent.borrow({ amount, asset? })` | Borrow **USDC or USDsui** against collateral (v0.51.0+). `asset` defaults to `'USDC'`. | `BorrowResult` |
|
|
100
|
-
| `agent.repay({ amount, asset? })` | Repay outstanding **USDC or USDsui** debt (v0.51.1+). Pass `asset` to target a specific debt; omit for highest-APY repay. **Symmetry enforced:** USDsui debt is repaid with USDsui coins (and USDC with USDC). `amount` can be `'all'`. | `RepayResult` |
|
|
101
|
-
| `agent.swap({ from, to, amount, slippage? })` | Swap tokens via Cetus Aggregator (20+ DEXs). User-friendly names or full coin types. | `SwapResult` |
|
|
102
|
-
| `agent.exportKey()` | Export private key (bech32 format) | `string` |
|
|
103
|
-
|
|
104
|
-
### Query Methods
|
|
105
|
-
|
|
106
|
-
| Method | Description | Returns |
|
|
107
|
-
|--------|-------------|---------|
|
|
108
|
-
| `agent.healthFactor()` | Lending health factor | `HealthFactorResult` |
|
|
109
|
-
| `agent.earnings()` | Yield earned to date | `EarningsResult` |
|
|
110
|
-
| `agent.rates()` | Best save/borrow APYs across protocols | `RatesResult` |
|
|
111
|
-
| `agent.allRatesAcrossAssets()` | Per-protocol rate data across assets | `Array<{ protocol, asset, rates }>` |
|
|
112
|
-
| `agent.positions()` | All open DeFi positions | `PositionsResult` |
|
|
113
|
-
| `agent.fundStatus()` | Complete savings summary | `FundStatusResult` |
|
|
114
|
-
| `agent.maxWithdraw()` | Max safe withdrawal amount | `MaxWithdrawResult` |
|
|
115
|
-
| `agent.maxBorrow()` | Max safe borrow amount | `MaxBorrowResult` |
|
|
116
|
-
| `agent.deposit()` | Wallet address + funding instructions | `DepositInfo` |
|
|
117
|
-
| `agent.history({ limit? })` | Transaction history (default: all) | `TransactionRecord[]` |
|
|
118
|
-
| `agent.swapQuote({ from, to, amount })` | Preview swap route, output amount, and price impact (no execution) | `SwapQuoteResult` |
|
|
119
|
-
|
|
120
|
-
### Contacts Methods
|
|
121
|
-
|
|
122
|
-
| Method | Description | Returns |
|
|
123
|
-
|--------|-------------|---------|
|
|
124
|
-
| `agent.contacts.add(name, address)` | Save a named contact | `void` |
|
|
125
|
-
| `agent.contacts.remove(name)` | Remove a contact | `void` |
|
|
126
|
-
| `agent.contacts.list()` | List all saved contacts | `Contact[]` |
|
|
127
|
-
| `agent.contacts.get(name)` | Get a contact by name | `Contact` |
|
|
128
|
-
| `agent.contacts.resolve(nameOrAddress)` | Resolve name to address (passthrough if already an address) | `string` |
|
|
129
|
-
|
|
130
|
-
### Safeguards (Enforcer)
|
|
131
|
-
|
|
132
|
-
| Method | Description | Returns |
|
|
133
|
-
|--------|-------------|---------|
|
|
134
|
-
| `agent.enforcer.getConfig()` | Get safeguard settings | `SafeguardConfig` |
|
|
135
|
-
| `agent.enforcer.set({ maxPerTx?, maxDailySend? })` | Set per-transaction and/or daily send limits | `void` |
|
|
136
|
-
| `agent.enforcer.lock()` | Lock agent (freeze all operations) | `void` |
|
|
137
|
-
| `agent.enforcer.unlock(pin)` | Unlock agent | `void` |
|
|
138
|
-
| `agent.enforcer.check(amount)` | Check if amount is allowed under limits | `void` (throws `SafeguardError` if not) |
|
|
139
|
-
| `agent.enforcer.recordUsage(amount)` | Record send for daily limit tracking | `void` |
|
|
140
|
-
| `agent.enforcer.isConfigured()` | Whether safeguards are set up | `boolean` |
|
|
141
|
-
|
|
142
|
-
**Types:** `SafeguardConfig` — `{ maxPerTx?, maxDailySend?, locked? }` · `SafeguardError` — thrown when limits exceeded or agent locked
|
|
143
|
-
|
|
144
|
-
### Key Management
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
import {
|
|
148
|
-
generateKeypair,
|
|
149
|
-
keypairFromPrivateKey,
|
|
150
|
-
exportPrivateKey,
|
|
151
|
-
getAddress,
|
|
152
|
-
saveKey,
|
|
153
|
-
loadKey,
|
|
154
|
-
walletExists,
|
|
155
|
-
} from '@t2000/sdk';
|
|
156
|
-
|
|
157
|
-
// Generate a new keypair
|
|
158
|
-
const keypair = generateKeypair();
|
|
159
|
-
|
|
160
|
-
// Import from private key (bech32 or hex)
|
|
161
|
-
const imported = keypairFromPrivateKey('suiprivkey1...');
|
|
162
|
-
|
|
163
|
-
// Export private key (bech32 format)
|
|
164
|
-
const privkey = exportPrivateKey(keypair);
|
|
165
|
-
|
|
166
|
-
// Get the Sui address
|
|
167
|
-
const address = getAddress(keypair);
|
|
168
|
-
|
|
169
|
-
// Check if wallet exists on disk
|
|
170
|
-
const exists = await walletExists();
|
|
23
|
+
const { agent, address } = await T2000.init(); // new wallet (Bech32, 0o600 perms)
|
|
24
|
+
const agent = await T2000.create(); // load from ~/.t2000/wallet.key
|
|
25
|
+
const agent = T2000.fromPrivateKey('suiprivkey1…'); // in-memory load (no file)
|
|
171
26
|
|
|
172
|
-
|
|
173
|
-
await
|
|
174
|
-
|
|
27
|
+
await agent.send({ to: 'alice.sui', amount: 5, asset: 'USDC' }); // gasless
|
|
28
|
+
await agent.swap({ from: 'USDC', to: 'SUI', amount: 100 }); // Cetus, needs SUI
|
|
29
|
+
await agent.pay({ url: 'https://mpp.t2000.ai/openai/v1/chat/completions', method: 'POST', body, maxPrice: 0.10 });
|
|
175
30
|
```
|
|
176
31
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
```typescript
|
|
180
|
-
agent.on('balanceChange', (e) => {
|
|
181
|
-
console.log(`${e.cause}: ${e.asset} ${e.previous} → ${e.current}`);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
agent.on('healthWarning', (e) => {
|
|
185
|
-
console.log(`Health factor: ${e.healthFactor} (warning)`);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
agent.on('healthCritical', (e) => {
|
|
189
|
-
console.log(`Health factor: ${e.healthFactor} (critical — below 1.2)`);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
agent.on('yield', (e) => {
|
|
193
|
-
console.log(`Earned: $${e.earned}, total: $${e.total}`);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
agent.on('error', (e) => {
|
|
197
|
-
console.error(`Error: ${e.code} — ${e.message}`);
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Utility Functions
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
import {
|
|
205
|
-
mistToSui,
|
|
206
|
-
suiToMist,
|
|
207
|
-
usdcToRaw,
|
|
208
|
-
rawToUsdc,
|
|
209
|
-
formatUsd,
|
|
210
|
-
formatSui,
|
|
211
|
-
validateAddress,
|
|
212
|
-
truncateAddress,
|
|
213
|
-
} from '@t2000/sdk';
|
|
214
|
-
|
|
215
|
-
mistToSui(1_000_000_000n); // 1.0
|
|
216
|
-
usdcToRaw(10.50); // 10_500_000n
|
|
217
|
-
formatUsd(1234.5); // "$1234.50"
|
|
218
|
-
truncateAddress('0xabcdef...1234'); // "0xabcd...1234"
|
|
219
|
-
validateAddress('0x...'); // throws if invalid
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Advanced: Exposed Internals
|
|
223
|
-
|
|
224
|
-
For integrations (like `@suimpp/mpp`), the agent exposes:
|
|
225
|
-
|
|
226
|
-
```typescript
|
|
227
|
-
agent.suiClient; // SuiJsonRpcClient instance
|
|
228
|
-
agent.signer; // Ed25519Keypair
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
## Gas
|
|
232
|
-
|
|
233
|
-
Every transaction is self-funded by the agent's wallet. Keep at least ~0.05 SUI on hand. If gas runs out the SDK throws `INSUFFICIENT_GAS` — top up via Mercuryo (https://exchange.mercuryo.io/?widget_id=89960d1a-8db7-49e5-8823-4c5e01c1cea2) or any Sui exchange.
|
|
234
|
-
|
|
235
|
-
> **Audric web app exception:** Audric web users transact under Enoki gas sponsorship (zkLogin), so `INSUFFICIENT_GAS` is not a user-facing concern there. The SDK itself is sponsorship-agnostic — sponsorship is wired in at the host layer (Audric web), not inside `@t2000/sdk`.
|
|
236
|
-
|
|
237
|
-
**Architecture:** Each protocol operation (NAVI, send) exposes both `buildXxxTx()` (standalone transaction) and `addXxxToTx()` (composable fragment) functions. Multi-step flows compose multiple protocol calls into a single atomic Payment Intent (a Sui Programmable Transaction Block under the hood). If any step within a Payment Intent fails, the entire transaction reverts — no funds left in intermediate states.
|
|
238
|
-
|
|
239
|
-
## Configuration
|
|
240
|
-
|
|
241
|
-
| Environment Variable | Description | Default |
|
|
242
|
-
|---------------------|-------------|---------|
|
|
243
|
-
| `T2000_API_URL` | t2000 API base URL | `https://api.t2000.ai` |
|
|
244
|
-
|
|
245
|
-
Options like `pin`, `keyPath`, and `rpcUrl` are passed directly to `T2000.create()` or `T2000.init()`. The CLI handles env vars like `T2000_PIN` — see the [CLI README](https://www.npmjs.com/package/@t2000/cli).
|
|
246
|
-
|
|
247
|
-
## Supported Assets
|
|
248
|
-
|
|
249
|
-
Token metadata and **tiers** live in `token-registry.ts` (`COIN_REGISTRY`). **17 tokens** total:
|
|
250
|
-
|
|
251
|
-
- **Tier 1 (saveable / borrowable):** USDC, USDsui — save, borrow, send, swap. USDsui is a strategic exception (v0.51.0+) because NAVI runs a separate USDsui pool that often quotes a different APY than USDC. Repay symmetry is enforced (USDsui debt → USDsui repay).
|
|
252
|
-
- **Tier 2 (15):** SUI, wBTC, ETH, GOLD, DEEP, WAL, NS, IKA, CETUS, NAVX, vSUI, haSUI, afSUI, LOFI, MANIFEST — send and swap only (not for new save/borrow deposits).
|
|
253
|
-
- **Legacy (no tier):** USDT, USDe, USDSUI — display and withdraw of existing positions; still send/swap where applicable.
|
|
254
|
-
|
|
255
|
-
Six tokens were removed from the registry (FDUSD, AUSD, BUCK, BLUB, SCA, TURBOS). `STABLE_ASSETS = ['USDC']` (the canonical USD unit for balance aggregation), but **`OPERATION_ASSETS.save` and `OPERATION_ASSETS.borrow` accept both `'USDC'` and `'USDsui'`** (v0.51.0+). Use `isAllowedAsset(op, asset)` / `assertAllowedAsset(op, asset)` to validate.
|
|
256
|
-
|
|
257
|
-
```typescript
|
|
258
|
-
import {
|
|
259
|
-
COIN_REGISTRY,
|
|
260
|
-
TOKEN_MAP,
|
|
261
|
-
isTier1,
|
|
262
|
-
isTier2,
|
|
263
|
-
isSupported,
|
|
264
|
-
getTier,
|
|
265
|
-
getDecimalsForCoinType,
|
|
266
|
-
resolveSymbol,
|
|
267
|
-
resolveTokenType,
|
|
268
|
-
SUI_TYPE,
|
|
269
|
-
USDC_TYPE,
|
|
270
|
-
USDT_TYPE,
|
|
271
|
-
IKA_TYPE,
|
|
272
|
-
LOFI_TYPE,
|
|
273
|
-
MANIFEST_TYPE,
|
|
274
|
-
} from '@t2000/sdk';
|
|
275
|
-
|
|
276
|
-
isTier1(USDC_TYPE); // true
|
|
277
|
-
isTier2(SUI_TYPE); // true
|
|
278
|
-
isSupported(USDT_TYPE); // false (legacy — no tier)
|
|
279
|
-
getTier(SUI_TYPE); // 2
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
Swap uses Cetus Aggregator V3. Per-call `overlayFee` is opt-in — the SDK and CLI never charge fees by default. Consumer apps that want to charge an overlay (e.g. Audric) pass `overlayFee: { rate: 10n, receiver: T2000_OVERLAY_FEE_WALLET }` to `findSwapRoute` / `buildSwapTx`. Use `COIN_REGISTRY`, `getDecimalsForCoinType()`, `resolveSymbol()`, and `resolveTokenType()` for token data.
|
|
283
|
-
|
|
284
|
-
## Error Handling
|
|
285
|
-
|
|
286
|
-
```typescript
|
|
287
|
-
import { T2000Error } from '@t2000/sdk';
|
|
288
|
-
|
|
289
|
-
try {
|
|
290
|
-
await agent.send({ to: 'alex.sui', amount: 1000 });
|
|
291
|
-
} catch (e) {
|
|
292
|
-
if (e instanceof T2000Error) {
|
|
293
|
-
console.log(e.code);
|
|
294
|
-
// 'INSUFFICIENT_BALANCE' | 'SUINS_NOT_REGISTERED' | 'CONTACT_NOT_FOUND' | …
|
|
295
|
-
console.log(e.message); // Human-readable message
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
Common error codes: `INSUFFICIENT_BALANCE` · `INVALID_ADDRESS` · `INVALID_AMOUNT` · `INVALID_ASSET` · `HEALTH_FACTOR_TOO_LOW` · `NO_COLLATERAL` · `WALLET_NOT_FOUND` · `WALLET_LOCKED` · `WALLET_EXISTS` · `SIMULATION_FAILED` · `TRANSACTION_FAILED` · `PROTOCOL_PAUSED` · `INSUFFICIENT_GAS` · `WITHDRAW_WOULD_LIQUIDATE` · `SWAP_NO_ROUTE` · `SWAP_FAILED`
|
|
301
|
-
|
|
302
|
-
## Protocol Integration
|
|
303
|
-
|
|
304
|
-
t2000 uses an MCP-first integration model: NAVI MCP for reads, thin transaction builders for writes. No protocol SDK dependencies needed.
|
|
305
|
-
|
|
306
|
-
| Protocol | Integration | Used for |
|
|
307
|
-
|----------|------------|----------|
|
|
308
|
-
| NAVI | MCP (reads) + thin tx builders (writes) | Lending positions, deposits, withdrawals, borrows, rewards |
|
|
309
|
-
| Cetus Aggregator V3 | `@cetusprotocol/aggregator-sdk` (isolated) | Multi-DEX swap routing — overlay fee on swaps (`cetus-swap.ts`) |
|
|
310
|
-
|
|
311
|
-
## Testing
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
# Run all SDK unit tests
|
|
315
|
-
pnpm --filter @t2000/sdk test
|
|
316
|
-
|
|
317
|
-
# Run smoke tests against mainnet RPC (read-only, no transactions)
|
|
318
|
-
SMOKE=1 pnpm --filter @t2000/sdk test -- src/__smoke__
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
## Protocol Fees
|
|
322
|
-
|
|
323
|
-
> **The SDK and CLI are fee-free by design (as of `@t2000/sdk@1.1.0`, B5 v2 / 2026-04-30).** Direct SDK / CLI calls — `t2000 save`, `t2000 borrow`, `t2000 swap`, plus `T2000.save()` / `T2000.borrow()` / `swapExecute()` from any third-party integrator — never charge a t2000 protocol fee. The CLI is dev-focused tooling and intentionally has no monetization.
|
|
324
|
-
|
|
325
|
-
Fees only apply when the **Audric** consumer app calls these primitives. Audric layers a fee transfer step (`addFeeTransfer`) inside the same PTB and routes the USDC to `T2000_OVERLAY_FEE_WALLET`.
|
|
326
|
-
|
|
327
|
-
| Operation | Audric fee | SDK / CLI fee | Notes |
|
|
328
|
-
|-----------|-----------|--------------|-------|
|
|
329
|
-
| Save (deposit) | 0.10% | Free | USDC only; USDsui save is free in Audric too |
|
|
330
|
-
| Borrow | 0.05% | Free | USDC only; USDsui borrow is free in Audric too |
|
|
331
|
-
| Swap | 0.10% | Free | Audric passes Cetus `overlayFee`. CLI omits it. Cetus Aggregator network fees still apply both ways. |
|
|
332
|
-
| Withdraw / Repay / Send / Receive / Pay (MPP) | Free | Free | No surcharge anywhere. |
|
|
333
|
-
|
|
334
|
-
How Audric collects fees: `prepare/route.ts` calls `addFeeTransfer(tx, paymentCoin, FEE_BPS, T2000_OVERLAY_FEE_WALLET, amount)` for save/borrow and passes `overlayFee.receiver = T2000_OVERLAY_FEE_WALLET` for swaps. Both flows produce a USDC transfer to the treasury wallet inside the same atomic Payment Intent. The t2000 server-side indexer detects the on-chain USDC inflow and records a `ProtocolFeeLedger` row — no off-chain submission is involved.
|
|
335
|
-
|
|
336
|
-
Need to charge an overlay fee in your own consumer app? Import `addFeeTransfer` and `T2000_OVERLAY_FEE_WALLET` from `@t2000/sdk` (or use your own receiver address — the SDK never assumes the t2000 treasury).
|
|
32
|
+
USDC + USDsui sends and MPP USDC payments are gasless (Sui foundation's `0x2::balance::send_funds` sponsor). SUI sends and Cetus swaps need gas — keep ~0.05 SUI on hand.
|
|
337
33
|
|
|
338
|
-
##
|
|
34
|
+
## Full reference
|
|
339
35
|
|
|
340
|
-
|
|
36
|
+
Factory methods, full API surface, supported assets, NAVI lending builders, error handling, architecture →
|
|
37
|
+
**[developers.t2000.ai/agent-sdk](https://developers.t2000.ai/agent-sdk)**
|
|
341
38
|
|
|
342
39
|
## License
|
|
343
40
|
|
|
344
|
-
MIT — see [LICENSE](https://github.com/mission69b/t2000/blob/main/LICENSE)
|
|
41
|
+
MIT — see [LICENSE](https://github.com/mission69b/t2000/blob/main/LICENSE).
|