Docs

Launch Torq Earn in a few lines

Connect a customer wallet, load the institutional Earn catalogue, and complete a reviewed deposit with canonical finality.

The shortest secure path

Install the checked-in Developer Preview packages supplied with your approved application:

npm install @torq-finance/sdk @torq-finance/react

Then connect the wallet, load every Earn product surface, and deposit:

import { connectTorqEarn } from "@torq-finance/sdk";
import { eip1193Wallet } from "@torq-finance/react";
const earn = await connectTorqEarn({
  publishableKey: process.env.NEXT_PUBLIC_TORQ_PUBLISHABLE_KEY!,
  deploymentNamespace: "hosted-sepolia",
  wallet: eip1193Wallet(window.ethereum, account),
  review: showPreparedTransactionReview,
});
const products = await earn.catalogue();
const completed = await earn.deposit({ wrapperAddress, assetAddress, assets: "1000000" });

That is the default wallet, exchange, bank, neobank, and fintech integration path. products contains canonical assets, markets, vaults, tranches, partner wrappers, recovery funds, fees, and partner programs. completed.status is final_success; Torq does not return a receipt as product completion.

The packages remain Private Preview until public registry installation and protected public CI are proven. Use the package version, publishable key, origin, chain, and deployment namespace supplied to your approved application.

What the connector handles

connectTorqEarn performs the repetitive security work once:

  1. Reads the connected wallet's current chain.
  2. Creates a short-lived, origin-bound Torq challenge.
  3. Requests a message signature from the connected wallet and exchanges it for an opaque session.
  4. Requests only the wallet, product, fund, investor-workflow, and canonical-tracking scopes used by the Earn lifecycle.
  5. Loads product-visible state from Torq's canonical API instead of reconstructing it from RPC.

The connector never asks for a private key, seed phrase, reusable wallet proof, arbitrary target, or arbitrary calldata.

The review callback is mandatory

showPreparedTransactionReview is your explicit review screen. It receives the exact Torq PreparedWorkflow before a transaction reaches the customer wallet. Show at least:

  • network and deployment namespace;
  • action, amount, asset, wrapper or vault, and receiver;
  • every prepared target, value, and human-readable transaction label;
  • whether an ERC-20 approval is included;
  • freshness, preflight status, expiry, and blocked reasons.

Return true only after the customer approves that exact payload. Returning false stops before simulation, signing, submission, or registration. Torq re-reads the prepared workflow and rejects changed targets, calldata, value, order, chain, or snapshot before invoking the signer.

Read the complete customer lifecycle

Use one call for the customer's current position, eligibility, activity, impairment/recovery state, and available distressed recovery funds:

const lifecycle = await earn.lifecycle();

This lets an Earn product continue beyond deposit and redemption. A customer experience can surface current positions, affected exposures, recovery status, and separately available fund participation without implying that an affected position automatically creates eligibility, compensation, or a claim.

Redeem with the same boundary

const completed = await earn.redeem({ wrapperAddress, shares: "500000" });

The connected wallet is the default receiver for deposit and redemption. Torq prepares the typed investor wrapper workflow, your review callback approves the exact payload, the customer wallet simulates and signs, and the SDK waits for canonical final_success.

Launch a credit product with the same connection

Load canonical credit assets, markets, facilities, and oracle context, then execute a reviewed borrower action:

const creditProducts = await earn.credit.catalogue();
const completed = await earn.credit.borrow({ marketAddress, amount: "250000" });

The same client exposes depositCollateral, withdrawCollateral, borrow, and repay. Each method prepares the production Agent Credit workflow from canonical market state, requires the same explicit review, submits only through the connected customer wallet, and waits for final_success. Current borrower eligibility, facility authority, collateral policy, oracle freshness, liquidity, and risk-regime controls still decide whether preparation succeeds.

Use the lower-level client when you need control

earn.client is the complete TorqClient. Use its typed deep-resource methods, all governed workflow methods, events, pagination, idempotency, and transaction tracking when building a custom credit product. The high-level connector is convenience orchestration over those same governed primitives; it does not create a second API or weaken the signer boundary.

const vault = await earn.client.resources.vaults.retrieve(vaultId);
const liquidity = await earn.client.resources.vaults.liquidity(vaultId);
const allocations = await earn.client.resources.vaults.allocations(vaultId);

See SDK reference, complete platform coverage, and the complete credit lifecycle for the full surface.

On this page