@t2000/sdk 2.18.1 → 2.19.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 CHANGED
@@ -36,8 +36,11 @@ const agent = await T2000.create({ pin: 'my-secret' });
36
36
  const balance = await agent.balance();
37
37
  console.log(`$${balance.available} USDC available`);
38
38
 
39
- // Send USDC
39
+ // Send USDC — recipient can be a 0x address, a SuiNS name, or a saved contact alias
40
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.
41
44
 
42
45
  // Save (earn yield — auto-selects best rate via NAVI)
43
46
  await agent.save({ amount: 50 });
@@ -88,7 +91,8 @@ const agent = T2000.fromPrivateKey('suiprivkey1q...');
88
91
  |--------|-------------|---------|
89
92
  | `agent.address()` | Wallet Sui address | `string` |
90
93
  | `agent.balance()` | Available USDC + savings + gas reserve | `BalanceResponse` |
91
- | `agent.send({ to, amount, asset? })` | Transfer USDC to any Sui address | `SendResult` |
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? }` |
92
96
  | `agent.receive({ amount?, currency?, memo?, label? })` | Generate payment request with Payment Kit URI (`sui:pay?...`), nonce for duplicate prevention | `PaymentRequest` |
93
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` |
94
98
  | `agent.withdraw({ amount, asset? })` | Withdraw from savings. `amount` can be `'all'`. Optional `asset` (default: USDC; also supports USDsui plus legacy USDe / SUI). | `WithdrawResult` |
@@ -285,10 +289,11 @@ Swap uses Cetus Aggregator V3. Per-call `overlayFee` is opt-in — the SDK and C
285
289
  import { T2000Error } from '@t2000/sdk';
286
290
 
287
291
  try {
288
- await agent.send({ to: '0x...', amount: 1000 });
292
+ await agent.send({ to: 'alex.sui', amount: 1000 });
289
293
  } catch (e) {
290
294
  if (e instanceof T2000Error) {
291
- console.log(e.code); // 'INSUFFICIENT_BALANCE'
295
+ console.log(e.code);
296
+ // 'INSUFFICIENT_BALANCE' | 'SUINS_NOT_REGISTERED' | 'CONTACT_NOT_FOUND' | …
292
297
  console.log(e.message); // Human-readable message
293
298
  }
294
299
  }