torque-intelligence
v0.1.2
Published
Official Torque Intelligence SDK — read-only feed client for Platform API v1
Maintainers
Readme
torque-intelligence
Official read-only client for Torque Intelligence (Platform API v1).
Uses the same business API key as Checkout (sk_live_…). No wallet JWT required.
Install
yarn add torque-intelligence @torquefi/typesQuick start
import { createTorqueIntelligenceFromEnv } from 'torque-intelligence'
const ti = createTorqueIntelligenceFromEnv()
const feed = await ti.getFeed({
walletAddress: '0x…', // optional — personalization
chainId: 8453,
lanes: ['timely', 'desk'],
includeBrief: true,
})
const angles = await ti.getTradeAngles({ walletAddress: '0x…' })
const now = await ti.getHappeningNow({ chainId: 8453 })
const caps = await ti.getCapabilities()
ti.assertManifestCompatibility(caps.manifestVersion)Configuration
import { createTorqueIntelligence } from 'torque-intelligence'
const ti = createTorqueIntelligence({
apiKey: process.env.TORQUE_API_KEY!,
baseUrl: 'https://app.torque.fi', // optional
timeout: 30_000, // optional
cooldownRetries: 1, // retry once on 429 COOLDOWN
})Environment variables: TORQUE_API_KEY, optional TORQUE_BASE_URL.
Endpoints
| Method | SDK | HTTP |
|--------|-----|------|
| getFeed | Primary feed | GET /api/v1/intelligence/feed |
| getTradeAngles | Desk angles | GET /api/v1/intelligence/trade-angles |
| getHappeningNow | Timely signals | GET /api/v1/intelligence/happening-now |
| getYieldOpportunities | Yield Spotlight + idle-cash ideas | GET /api/v1/opportunities/yield |
| getLendingOpportunities | Lend/Borrow catalog APY + APR | GET /api/v1/opportunities/lending |
| getFundingRadarWidget | Funding radar (Home widget) | GET /api/v1/widgets/funding-radar |
| getEarningsSpotlightWidget | Earnings spotlight (Home widget) | GET /api/v1/widgets/earnings-spotlight |
| getCapabilities | Manifest probe | GET /api/v1/capabilities |
Errors
v1 JSON errors map to TorqueIntelligenceError with code, statusCode, and optional details.
On 429 COOLDOWN, the client waits retryAfterMs from error.details and retries up to cooldownRetries (default 1).
import { TorqueIntelligenceError } from 'torque-intelligence'
try {
await ti.getFeed({ force: true })
} catch (e) {
if (e instanceof TorqueIntelligenceError && e.code === 'COOLDOWN') {
console.log('Retry after', e.retryAfterMs, 'ms')
}
}Docs
License
MIT
