Typescript Integration
π¨π»βπ» Integrate Circulator with TypeScript
Circulator Documentation
Basic Setup
We recommend using viem to integrate with the contract:
import { createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { baseSepolia } from 'viem/chains';
const privateKey = '0x...';
const rpc = 'Put in your RPC';
// create viem account
const account = privateKeyToAccount(privateKey);
const user = createWalletClient({
account,
chain: baseSepolia,
transport: http(rpc),
});Standard Mode
Link to Deployed Addresses
Gasless Mode
Gasless mode requires the user to sign 2 signatures, and then interact with our API server to relay the transaction.
Getting Permit Signature
Getting DelegateCirculate Signature
API Endpoint
URL: /api/delegate
Method: POST
Content-Type: application/json
Request Body
sender
string
The address of the sender (e.g., "0x...")
recipient
string
The address of the recipient (e.g., "0x...")
sourceChain
string
The key identifier of the source chain
destinationDomain
number
The numerical identifier of the destination domain (must be a valid CCTP chain ID)
amount
string
The amount of tokens to be circulated
deadline
string
The deadline for the permit signature
fillDeadline
string
The deadline for filling the circulate request
circulateType
number
The type of circulation (0 for CCTP, 1 for AcrossV3)
permitV
number
The v component of the permit signature
permitR
string
The r component of the permit signature
permitS
string
The s component of the permit signature
delegateV
number
The v component of the delegate signature
delegateR
string
The r component of the delegate signature
delegateS
string
The s component of the delegate signature
Note: All fields are required. The destinationDomain must be a valid CCTP chain ID.
Response
Success Response:
Code: 200
Content:
{ "txHash": "0x..." }
Error Response:
Code: 400
Content:
{ "error": "Missing fields" }
Usage Example
Full Example: Sending Delegate request to our API
Last updated