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.4 @torquefi/types@^0.1.2
# Or split packages
yarn add torque-intelligence@^0.1.3 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. Note: torque-node@0.1.4 adds torque.read.* namespaces aligned with Assistant TI read families; publish from the monorepo before npm reflects the version.
API → SDK Coverage
| Domain | HTTP Guide | npm |
|---|---|---|
| READ: Intelligence | /api/intelligence | torque.read.intelligence.* |
| READ: Portfolio | /authentication#third-party | torque.read.portfolio.getPortfolio() |
| READ: Market / rates / tape / … | /api/assistant | torque.read.market | rates | tape | research | plan | commerce |
| DECIDE: Assistant | /api/assistant | torque.decide.assistant.chat(), chatStream() |
| Connect: Hosted execute | /api/actions#third-party-handoff | torque-connect createConfirmSession() |
| Connect: OAuth | /api/actions#third-party-handoff | torque-connect createAuthorizeSession(), exchangeToken() |
| EXECUTE: Actions (on_chain) | /api/actions#onchain-channel | torque-actions + wallet/delegated JWT |
| EXECUTE: Actions (merchant) | /api/actions#merchant-channel | torque-checkout |
| @torquefi/types | 0.1.3 |
| torque-intelligence | 0.1.3 |
| torque-node | 0.1.4 |
| torque-assistant | 0.1.0 |
| torque-connect | 0.1.0 |
| torque-actions | 0.1.0 |
| @torquefi/react | 0.1.1 |
| 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.4+: torque.read.portfoliotorque.read.markettorque.read.ratestorque.read.tapetorque.read.researchtorque.read.intelligencetorque.read.plantorque.read.commerce. Subpaths: 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('funding-radar') | GET /api/v1/intelligence/datasets/funding-radar |
| 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'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.