Server SDKs
SDKs map to lifecycle phases. torque-node: READ + DECIDE. torque-checkout: Actions EXECUTE (merchant channel). @torquefi/react: UI hooks for READ + DECIDE. For browser UI, see React SDK. For merchants, see Actions: merchant channel, Checkout SDK, & Webhooks.
Install
# Recommended: one client for READ + DECIDE surfaces
yarn add torque-node@^0.1.7 @torquefi/types@^0.1.5
# Or split packages
yarn add torque-intelligence@^0.1.4 torque-assistant@^0.1.0
# .env (server only: never in browser bundles)
TORQUE_API_KEY=sk_live_…
TORQUE_BASE_URL=https://app.torque.fi/api/v1 # optionalScoped @torquefi/types & @torquefi/react are required on npm. torque-node@0.1.7 adds torque.wallets plus torque.read.* aligned with Assistant TI read families.
Hero paths (≤6 lines)
Three integration surfaces — wallets, intelligence, checkout — each in six lines or fewer.
Wallets
import { createTorqueFromEnv } from 'torque-node'
const torque = createTorqueFromEnv()
const wallet = await torque.wallets.ensure({
externalUserId: 'user_48291',
email: 'user@example.com',
})Intelligence
import { createTorqueFromEnv } from 'torque-node'
const torque = createTorqueFromEnv()
const feed = await torque.read.intelligence.getFeed({
walletAddress: '0x…',
})Payments / checkout
import { checkout, redirectToCheckout } from 'torque-checkout'
const url = await checkout({ productId: 'prod_123', email: 'a@b.com' })
redirectToCheckout(url)API → SDK Coverage
| Domain | HTTP Guide | npm |
|---|---|---|
| Wallets (provision) | /integrate/wallets | torque.wallets.ensure(), get() |
| READ: Intelligence | /integrate/intelligence | torque.read.intelligence.* |
| READ: Portfolio | /authentication#third-party | torque.read.portfolio.getPortfolio() |
| READ: Market / rates / tape / … | /integrate/assistant | torque.read.market | rates | tape | research | plan | commerce |
| DECIDE: Assistant | /integrate/assistant | torque.decide.assistant.chat(), chatStream() |
| Connect: Hosted execute | /integrate/execute#cash-out-execute | torque-connect createConfirmSession() |
| Connect: OAuth | /integrate/execute#cash-out-execute | torque-connect createAuthorizeSession(), exchangeToken() |
| EXECUTE: Actions (on_chain) | /integrate/execute#onchain-channel | torque-actions + wallet/delegated JWT |
| EXECUTE: Actions (merchant) | /integrate/execute#merchant-channel | checkout() / torque-checkout |
| @torquefi/types | 0.1.5 |
| torque-intelligence | 0.1.4 |
| torque-node | 0.1.7 |
| torque-assistant | 0.1.0 |
| torque-connect | 0.1.0 |
| torque-actions | 0.1.2 |
| @torquefi/react | 0.1.3 |
| torque-webhooks | 0.1.0 |
| torque-checkout | 3.x |
torque-node
Unified server client: one API key, one facade for READ and DECIDE surfaces.
import { createTorqueFromEnv } from 'torque-node'
const torque = createTorqueFromEnv()
const feed = await torque.read.intelligence.getFeed({
walletAddress: '0x…',
chainId: 8453,
includeBrief: true,
})
const yieldOps = await torque.read.rates.getYieldOpportunities({ walletAddress: '0x…' })
const portfolio = await torque.read.portfolio.getPortfolio({ walletAddress: '0x…' })
const chat = await torque.decide.assistant.chat({
messages: [{ role: 'user', content: 'What moved today?' }],
context: { walletAddress: '0x…', chainId: 8453 },
})TI read families on 0.1.7+: torque.read.portfoliotorque.read.markettorque.read.ratestorque.read.tapetorque.read.researchtorque.read.intelligencetorque.read.plantorque.read.commerce. Subpaths: torque-node/wallets, torque-node/intelligence, torque-node/assistant. Assistant streaming via chatStream(): see Assistant API.
torque-intelligence
Read-only Intelligence READ lane: feed, datasets, & markets. No Assistant chat.
| getFeed() | GET /api/v1/intelligence/feed |
| getTradeAngles() / getView('trade-angles') | GET /api/v1/intelligence/views/trade-angles |
| getHappeningNow() / getView('happening-now') | GET /api/v1/intelligence/views/happening-now |
| getView('brief' | 'market-outlook') | GET /api/v1/intelligence/views/brief | market-outlook |
| getYieldOpportunities() | GET /api/v1/intelligence/markets/yield |
| getLendingOpportunities() | GET /api/v1/intelligence/markets/lending |
| getDataset('earnings-spotlight') | GET /api/v1/intelligence/datasets/earnings-spotlight |
| getDataset('events', { days }) | GET /api/v1/intelligence/datasets/events |
torque-assistant
| chat() | POST /api/v1/assistant/chat |
| chatStream() | POST /api/v1/assistant/chat?stream=true |
@torquefi/types
Types only: no runtime.
import type { IntelligenceItemV1 } from '@torquefi/types/intelligence'
import type { YieldOpportunitiesResponseV1 } from '@torquefi/types/opportunities'
import type { FundingRadarWidgetResponseV1 } from '@torquefi/types/widgets'
import type { AssistantChatPostBody } from '@torquefi/types/assistant'
import type { PartnerWalletV1 } from '@torquefi/types/wallets'torque-connect
Server-only; see Authentication.
import { TorqueConnect } from 'torque-connect'
const connect = new TorqueConnect({ apiKey: process.env.TORQUE_API_KEY! })
await connect.createConfirmSession({ functionResults, returnUrl, webhookUrl })
await connect.createAuthorizeSession({ redirectUri, scopes })
await connect.exchangeToken({ code, codeVerifier, redirectUri })torque-actions
Profile C: parse signable functionResults and call execute routes with a delegated JWT.
import { TorqueActions } from 'torque-actions'
const actions = new TorqueActions({ accessToken: delegatedJwt })
const signable = actions.parseFunctionResults(functionResults)Authentication
Server SDKs use sk_live_… server-side. React hooks call your BFF: never embed the key in the browser. Full table: Authentication.
Client SDKs
Questions or corrections? hello@torque.fi