torchsdk 3.6.7 → 3.6.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +48 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "torchsdk",
3
- "version": "3.6.7",
3
+ "version": "3.6.8",
4
4
  "description": "Torch Market SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -16,22 +16,38 @@ for sdk audit, refer to [audit.md](./audit.md).
16
16
 
17
17
  SDK version tracks the on-chain program IDL version.
18
18
 
19
- ### v3.3.0
19
+ ### v3.6.8
20
20
 
21
- - **Tiered Bonding Curves (V23)** — Creators choose a graduation target at token creation: Spark (50 SOL), Flame (100 SOL), or Torch (200 SOL, default). Same formula, same virtual reserves, different graduation points. New optional `sol_target` parameter on `buildCreateTokenTransaction`.
22
- - **Security: `harvest_fees` hardened (V3.2.1)** — Fixed critical vulnerability where `treasury_token_account` was unconstrained. Added Anchor `associated_token` constraints. Independent auditor verified the fix.
23
- - **Raydium pool validation confirmed** — Oracle manipulation report reviewed and dismissed; `validate_pool_accounts()` already validates pool ownership, vaults, and mints. Auditor gave green flag.
24
- - **Kani proofs updated** — Treasury rate proofs now formally verify for all tier targets (50/100/200 SOL). 20/20 harnesses passing.
21
+ - **Permissionless DEX Migration (V26)** — New `buildMigrateTransaction` builds the two-step migration (fund WSOL + migrate to Raydium) in a single transaction. Anyone can trigger migration for bonding-complete tokens payer covers rent (~0.02 SOL), treasury pays 0.15 SOL Raydium pool fee.
22
+ - **Pool Account Validation (V27)** — Tightened Raydium pool validation: AMM config constrained to known program constant, pool state ownership verified against Raydium CPMM program ID. Closes account substitution vector.
23
+ - **Update Authority (V28)** — New `update_authority` admin instruction for transferring protocol authority. Immediate, authority-only.
24
+ - **Lending `sol_balance` Bug Fix** — Treasury `sol_balance` now correctly decremented on borrow and incremented on repay/liquidation. Critical accounting fix.
25
+ - **Lending Utilization Cap** — `getLendingInfo` now returns actual borrowable amount: `(sol_balance * 50%) - total_sol_lent`, matching on-chain enforcement.
26
+ - **Live Raydium Pool Price** — `getToken()` fetches live pool vault balances for migrated tokens instead of frozen bonding curve virtual reserves.
27
+ - **Dynamic Network Detection** — SDK evaluates network at call time via `globalThis.__TORCH_NETWORK__` (browser runtime) or `process.env.TORCH_NETWORK` (Node.js). Raydium addresses switch automatically between mainnet and devnet.
28
+ - **Pre-migration Buyback Removed** — Simplified protocol: only post-migration DEX buyback remains.
29
+ - **35 Kani Proof Harnesses** — Including V25 supply conservation, V26 SOL wrapping conservation, lending lifecycle with interest.
30
+ - **IDL updated to v3.6.0** (35 instructions).
25
31
 
26
- ### v3.2.4
32
+ ### v3.5.1
33
+
34
+ - **V25 Pump-Style Token Distribution** — New virtual reserve model: IVS = bonding_target/8 (6.25-25 SOL), IVT = 900M tokens, ~81x multiplier across all tiers. Reverted V24 per-tier treasury fees to flat 20%→5% for all tiers.
27
35
 
28
- - **Metadata fetch timeout** — `fetchWithFallback` now enforces a 10s timeout via AbortController (prevents DoS from slow creator-controlled metadata URIs)
29
- - **Explicit slippage validation** — `slippage_bps` outside 10–1000 now throws instead of silently clamping
30
- - **IDL-derived discriminator** — LoanPosition discriminator derived from Anchor IDL instead of hardcoded bytes
36
+ ### v3.4.0
31
37
 
32
- ### v3.2.3
38
+ - **Tiered Fee Structure (V24)** — Dynamic treasury SOL rate per-tier. Legacy tokens get Torch rates. `calculateTokensOut` accepts optional `bondingTarget` parameter.
39
+
40
+ ### v3.3.0
33
41
 
34
- Documentation-only (whitepaper, audit, ClawHub spec compliance). No code changes from v3.2.0.
42
+ - **Tiered Bonding Curves (V23)** — Creators choose a graduation target at token creation: Spark (50 SOL), Flame (100 SOL), or Torch (200 SOL, default). New optional `sol_target` parameter on `buildCreateTokenTransaction`.
43
+ - **Security: `harvest_fees` hardened (V3.2.1)** — Fixed critical vulnerability where `treasury_token_account` was unconstrained. Independent auditor verified.
44
+ - **Kani proofs updated** — 20/20 harnesses passing for all tiers.
45
+
46
+ ### v3.2.4
47
+
48
+ - **Metadata fetch timeout** — 10s AbortController in `fetchWithFallback`
49
+ - **Explicit slippage validation** — throws on out-of-range instead of silent clamping
50
+ - **IDL-derived discriminator** — LoanPosition discriminator from Anchor IDL
35
51
 
36
52
  ## What's New in v3.2.0
37
53
 
@@ -102,6 +118,7 @@ All builders return `{ transaction: Transaction, message: string }`. You sign an
102
118
  | `buildDirectBuyTransaction(connection, params)` | Buy tokens (buyer pays directly, no vault) |
103
119
  | `buildSellTransaction(connection, params)` | Sell tokens back to the bonding curve (vault-routed) |
104
120
  | `buildVaultSwapTransaction(connection, params)` | Buy/sell migrated tokens on Raydium DEX (vault-routed) |
121
+ | `buildMigrateTransaction(connection, params)` | Migrate bonding-complete token to Raydium DEX (permissionless) |
105
122
  | `buildCreateTokenTransaction(connection, params)` | Launch a new token |
106
123
  | `buildStarTransaction(connection, params)` | Star a token (0.05 SOL, vault-routed) |
107
124
 
@@ -275,10 +292,27 @@ const { transaction } = await buildDirectBuyTransaction(connection, {
275
292
  { mint: string, borrower: string, sol_amount: number, vault?: string }
276
293
  { mint: string, liquidator: string, borrower: string, vault?: string }
277
294
 
295
+ // Migrate (permissionless — anyone can trigger for bonding-complete tokens)
296
+ { mint: string, payer: string }
297
+
278
298
  // Rewards (optional vault routing)
279
299
  { user: string, vault?: string } // claim protocol rewards
280
300
  ```
281
301
 
302
+ ## Network Configuration
303
+
304
+ The SDK detects the network at runtime. No rebuild needed to switch between mainnet and devnet.
305
+
306
+ ```typescript
307
+ // Browser: set before SDK calls (e.g., in a network switcher)
308
+ (globalThis as any).__TORCH_NETWORK__ = 'devnet'
309
+
310
+ // Node.js: set via environment variable
311
+ // TORCH_NETWORK=devnet npx tsx your-script.ts
312
+ ```
313
+
314
+ The SDK checks `globalThis.__TORCH_NETWORK__` first (for browser runtime switching), then falls back to `process.env.TORCH_NETWORK`. When set to `'devnet'`, all Raydium addresses automatically switch to devnet versions.
315
+
282
316
  ## Vault Safety Model
283
317
 
284
318
  The Torch Vault provides protocol-level full custody for AI agent interaction:
@@ -307,7 +341,9 @@ npx tsx tests/test_e2e.ts
307
341
 
308
342
  Expected output: `RESULTS: 32 passed, 0 failed`
309
343
 
310
- Test coverage: create token, vault lifecycle (create/deposit/query/withdraw/withdraw tokens), buy (direct + vault), link/unlink wallet, sell, star, messages, confirm, full bonding to graduation (50/100/200 SOL tiers), Raydium migration, borrow, repay, vault swap (buy + sell on Raydium DEX), vault-routed liquidation, protocol reward claims (epoch volume + vault-routed claim).
344
+ Test coverage: create token, vault lifecycle (create/deposit/query/withdraw/withdraw tokens), buy (direct + vault), link/unlink wallet, sell, star, messages, confirm, full bonding to graduation (50/100/200 SOL tiers), permissionless Raydium migration (V26 two-step), borrow, repay, vault swap (buy + sell on Raydium DEX), vault-routed liquidation, protocol reward claims (epoch volume + vault-routed claim).
345
+
346
+ A separate devnet E2E test (`tests/test_devnet_e2e.ts`) validates the full lifecycle against Solana devnet with `TORCH_NETWORK=devnet`.
311
347
 
312
348
  ## License
313
349