Skip to main content

Overview

Use this cookbook when you want 1tx to handle:
  • instrument discovery,
  • quote generation,
  • source-chain selection,
  • calldata generation,
  • and cross-chain relay tracking.
This is the recommended integration path for most apps.

Prerequisites

  • an API key for discovery and monitoring endpoints,
  • a bearer token for transaction-building endpoints,
  • a wallet connection in your frontend,
  • a way to send EVM transactions, such as viem or wagmi.

Recipe 1: Build and Execute a Same-Chain Buy

Step 1: Fetch the instrument

Step 2: Build the transaction bundle

Step 3: Execute the returned transactions in order

The bundle may contain either:
  • a single router transaction, or
  • an approval followed by the router transaction.
An approval is only included when current allowance is insufficient. If it is present, it must be mined before the deposit transaction is sent.

Recipe 2: Build and Monitor a Cross-Chain Buy

For cross-chain buys, the source-chain router transaction is still built through POST /transactions/buy, but completion is tracked through the CCTP API.

Step 1: Build the bundle

Step 2: Execute the source-chain transactions

The final transaction in the bundle is the router buy() transaction. Use that hash as the source transaction hash to monitor.

Step 3: Poll relay status by source tx hash

Step 4: Show destination completion

A brief 404 Job not found immediately after source-chain confirmation is expected. The relay job is created asynchronously when the bridge event webhook is ingested.

Recipe 3: Estimate CCTP Fees Before Building

If you want to display cross-chain transfer mode estimates before submitting a buy, use the CCTP fee endpoint.
Use GET /cctp/config to map chain IDs to Circle domains.

Common Pitfalls

  • Missing bearer auth on POST /transactions/buy or POST /transactions/sell
  • Sending transactions out of order
  • Treating an early 404 from /cctp/relay/tx/:sourceTxHash as a permanent failure
  • Reusing an expired bundle after expiresAt
  • Formatting human-readable amounts incorrectly before calling the API

Next Steps

Transactions API

Full request and response shapes for transaction bundles

CCTP API

Relay monitoring and fee estimation endpoints