@t2000/sdk 0.11.0 → 0.11.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 CHANGED
@@ -5,7 +5,7 @@ The complete TypeScript SDK for AI agent bank accounts on Sui. Send USDC, earn y
5
5
  [![npm](https://img.shields.io/npm/v/@t2000/sdk)](https://www.npmjs.com/package/@t2000/sdk)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- **[Website](https://t2000.ai)** · **[GitHub](https://github.com/mission69b/t2000)** · **[CLI](https://www.npmjs.com/package/@t2000/cli)** · **[x402](https://www.npmjs.com/package/@t2000/x402)**
8
+ **[Website](https://t2000.ai)** · **[GitHub](https://github.com/mission69b/t2000)** · **[CLI](https://www.npmjs.com/package/@t2000/cli)** · **[x402](https://www.npmjs.com/package/@t2000/x402)** · **[MCP](https://www.npmjs.com/package/@t2000/mcp)**
9
9
 
10
10
  ## Installation
11
11
 
@@ -335,6 +335,10 @@ pnpm --filter @t2000/sdk test
335
335
 
336
336
  Fees are collected by the t2000 protocol treasury on-chain.
337
337
 
338
+ ## MCP Server
339
+
340
+ The SDK powers the [`@t2000/mcp`](https://www.npmjs.com/package/@t2000/mcp) server — 16 tools and 3 prompts for Claude Desktop, Cursor, and any MCP-compatible AI platform. Run `t2000 mcp` to start.
341
+
338
342
  ## License
339
343
 
340
344
  MIT — see [LICENSE](https://github.com/mission69b/t2000/blob/main/LICENSE)
@@ -1,4 +1,4 @@
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';
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-BwHcYli9.cjs';
2
2
  import '@mysten/sui/transactions';
3
3
  import '@mysten/sui/jsonRpc';
4
4
  import '@mysten/sui/keypairs/ed25519';
@@ -1,4 +1,4 @@
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';
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-BwHcYli9.js';
2
2
  import '@mysten/sui/transactions';
3
3
  import '@mysten/sui/jsonRpc';
4
4
  import '@mysten/sui/keypairs/ed25519';
@@ -148,6 +148,7 @@ interface GasReserve {
148
148
  interface BalanceResponse {
149
149
  available: number;
150
150
  savings: number;
151
+ debt: number;
151
152
  gasReserve: GasReserve;
152
153
  total: number;
153
154
  assets: Record<string, number>;
@@ -148,6 +148,7 @@ interface GasReserve {
148
148
  interface BalanceResponse {
149
149
  available: number;
150
150
  savings: number;
151
+ debt: number;
151
152
  gasReserve: GasReserve;
152
153
  total: number;
153
154
  assets: Record<string, number>;
package/dist/index.cjs CHANGED
@@ -405,6 +405,7 @@ async function queryBalance(client, address) {
405
405
  return {
406
406
  available: totalStables,
407
407
  savings,
408
+ debt: 0,
408
409
  gasReserve: {
409
410
  sui: suiAmount,
410
411
  usdEquiv
@@ -2607,12 +2608,16 @@ var SafeguardEnforcer = class {
2607
2608
  }
2608
2609
  }
2609
2610
  assertNotLocked() {
2611
+ this.load();
2610
2612
  if (this.config.locked) {
2611
2613
  throw new SafeguardError("locked", {});
2612
2614
  }
2613
2615
  }
2614
2616
  check(metadata) {
2615
- this.assertNotLocked();
2617
+ this.load();
2618
+ if (this.config.locked) {
2619
+ throw new SafeguardError("locked", {});
2620
+ }
2616
2621
  if (!OUTBOUND_OPS.has(metadata.operation)) return;
2617
2622
  const amount = metadata.amount ?? 0;
2618
2623
  if (this.config.maxPerTx > 0 && amount > this.config.maxPerTx) {
@@ -2654,6 +2659,7 @@ var SafeguardEnforcer = class {
2654
2659
  this.save();
2655
2660
  }
2656
2661
  getConfig() {
2662
+ this.load();
2657
2663
  this.resetDailyIfNewDay();
2658
2664
  return { ...this.config };
2659
2665
  }
@@ -2814,8 +2820,10 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
2814
2820
  try {
2815
2821
  const positions = await this.positions();
2816
2822
  const savings = positions.positions.filter((p) => p.type === "save").reduce((sum, p) => sum + p.amount, 0);
2823
+ const debt = positions.positions.filter((p) => p.type === "borrow").reduce((sum, p) => sum + p.amount, 0);
2817
2824
  bal.savings = savings;
2818
- bal.total = bal.available + savings + bal.gasReserve.usdEquiv;
2825
+ bal.debt = debt;
2826
+ bal.total = bal.available + savings - debt + bal.gasReserve.usdEquiv;
2819
2827
  } catch {
2820
2828
  }
2821
2829
  return bal;