Docs

Integration recipes

Browser wallet, React, Node, Python, Kotlin, Java, and Swift starting points.

All recipes use customer-owned signing. Torq returns typed intents and tracks canonical completion; it never receives a private key or relays a production transaction.

Browser wallet and React

const signer = eip1193Signer(window.ethereum, account);
const prepare = usePrepareTorqWorkflow(torq);
const execute = useExecuteTorqWorkflow(torq, signer);

const prepared = await prepare.mutateAsync({
  workflowType: "deposit",
  chainId: 11155111,
  input: { vaultAddress, assets: "1000000" },
});
await execute.mutateAsync(prepared);

Use a publishable, origin-bound test key and a wallet session in the browser.

Node backend or HSM/MPC

const torq = new TorqClient({
  secretKey: process.env.TORQ_SECRET_KEY,
  walletSession,
});
const prepared = await torq.workflows.prepare(request);
const completed = await torq.workflows.execute(prepared, {
  getChainId: () => hsm.chainId(),
  simulate: (intent) => hsm.simulate(intent),
  sendTransaction: (intent) => hsm.signAndBroadcast(intent),
});

The callback boundary passes transaction intents only; signer credentials remain inside the customer-controlled service.

Python neobank service

from torq_sdk import TorqClient, TorqClientConfig

torq = TorqClient(TorqClientConfig(
    secret_key=os.environ["TORQ_SECRET_KEY"],
    wallet_session=os.environ["TORQ_WALLET_SESSION"],
))
markets = torq.list_resource("markets", chainId=11155111)
prepared = torq.prepare_workflow(workflow_request)
completed = torq.execute_workflow(prepared, customer_signer)

Java and Kotlin

Java uses finance.torq.TorqClient; Kotlin uses finance.torq.TorqKotlinClient. Both attach the Developer credential and idempotency key for API reads and workflow preparation. Their legacy raw-intent execution methods throw before they can call a signer. Keep signing behind your customer-controlled service and use the documented canonical executor only when that native client adds one.

Swift wallet

let torq = TorqClient(
    config: TorqClientConfig(publishableKey: previewKey, walletSession: walletSession)
)
let prepared = try await torq.prepareWorkflow(workflowJSON)

Decode returned intents into wallet-native transaction objects, simulate them, submit through the wallet, register each transaction hash, and poll the workflow until final_success. The current Swift SDK refuses its legacy raw-intent signer method, so an approved integration must not treat it as an execution helper.

On this page