Executing a transaction
Step 1 — Build ERC‑20 Transfer Transaction Calldata
import { erc20Abi, encodeFunctionData, parseUnits } from 'viem';
const chainId = 137;
const usdc = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174';
const recipient = '0x1111111111111111111111111111111111111111';
// 1. Convert 1.0 USDC to base units (6 decimals)
const amount = parseUnits('1.0', 6);
// 2. Encode transfer(to, amount) calldata
const encodedData = encodeFunctionData({
abi: erc20Abi,
functionName: 'transfer',
args: [recipient, amount],
});import { Interface, parseUnits } from 'ethers';
const chainId = 137;
const usdc = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174';
const recipient = '0x1111111111111111111111111111111111111111';
const erc20 = new Interface([
'function transfer(address to, uint256 amount) returns (bool)'
]);
const amount = parseUnits('1.0', 6); // 1 USDC -> 1_000_000
const encodedData = erc20.encodeFunctionData('transfer', [recipient, amount]);Step 2 — Build the chain abstracted transaction (with quote type + token addresses)
Token
Identifier
Supported Networks
Step 3 - Initialize turnkey and sign the user operation and authorizations
Step 4 — Sign EIP‑7702 authorization(s)
Step 5 - Submitting the transaction
Step 6 - Checking the status of the transaction
Status Code
Description
Last updated