Announcing our $20m venture round co-led by cyber•Fund and Blockchain Capital. Read more.
Production-ready examples for common DeFi, NFT, and gaming use cases
{ "account": { "sessionAddress": "0x1cBFbFd62a276BF6D79d504eA4CA75a7baDcf5b1", "adminAddress": "0xc162a3cE45ad151eeCd0a5532D6E489D034aB3B8", "accountAddress": "0xE20295ec513DEf805D9c3083b0C8EaB64692D764" }, "targetChain": "eip155:8453", "calls": [ { "to": "0x2626664c2603336E57B271c5C0b26F421741e481", "data": "0x414bf389000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000004200000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000e20295ec513def805d9c3083b0c8eab64692d764000000000000000000000000000000000000000000000000000000006748d28800000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000", "value": "0x0" } ], "allowanceRequirements": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "1000000", "spender": "0x2626664c2603336E57B271c5C0b26F421741e481" } ], "tokensRequired": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "1000000" } ] }
{ "account": { "sessionAddress": "0x1cBFbFd62a276BF6D79d504eA4CA75a7baDcf5b1", "adminAddress": "0xc162a3cE45ad151eeCd0a5532D6E489D034aB3B8", "accountAddress": "0xE20295ec513DEf805D9c3083b0C8EaB64692D764" }, "targetChain": "eip155:8453", "calls": [ { "to": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", "data": "0x617ba037000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000000000000000000000000000000000000098968000000000000000000000000e20295ec513def805d9c3083b0c8eab64692d7640000000000000000000000000000000000000000000000000000000000000000", "value": "0x0" } ], "allowanceRequirements": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "10000000", "spender": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5" } ], "tokensRequired": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "10000000" } ] }
{ "account": { "sessionAddress": "0x1cBFbFd62a276BF6D79d504eA4CA75a7baDcf5b1", "adminAddress": "0xc162a3cE45ad151eeCd0a5532D6E489D034aB3B8", "accountAddress": "0xE20295ec513DEf805D9c3083b0C8EaB64692D764" }, "targetChain": "eip155:8453", "calls": [ { "to": "0x1234567890123456789012345678901234567890", "data": "0xa0712d680000000000000000000000000000000000000000000000000000000000000002", "value": "0x1bc16d674ec80000" } ], "allowanceRequirements": [], "tokensRequired": [ { "assetType": "eip155:8453/slip44:60", "amount": "2000000000000000000" } ] }
{ "account": { "sessionAddress": "0x1cBFbFd62a276BF6D79d504eA4CA75a7baDcf5b1", "adminAddress": "0xc162a3cE45ad151eeCd0a5532D6E489D034aB3B8", "accountAddress": "0xE20295ec513DEf805D9c3083b0C8EaB64692D764" }, "targetChain": "eip155:8453", "calls": [ { "to": "0x1234567890123456789012345678901234567890", "data": "0x96a81f59000000000000000000000000000000000000000000000000000000000000000100000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000000000000000000000000000000000000098968", "value": "0x0" } ], "allowanceRequirements": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "10000000", "spender": "0x1234567890123456789012345678901234567890" } ], "tokensRequired": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "10000000" } ] }
{ "account": { "type": "kernel-v3.1-ecdsa", "signerAddress": "0x5d6fb4eb211a6a2e406a1111b54d26c534753c8e", "accountAddress": "0xb7bc0d7baf6761c302ff6772dfd8f9e22ec706e7" }, "targetChain": "eip155:8453", "calls": [ { "to": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e0000000000000000000000000000000000000000000000000000000000989680", "value": "0x0" } ], "allowanceRequirements": [], "tokensRequired": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "10000000" } ] }
{ "account": { "sessionAddress": "0x1cBFbFd62a276BF6D79d504eA4CA75a7baDcf5b1", "adminAddress": "0xc162a3cE45ad151eeCd0a5532D6E489D034aB3B8", "accountAddress": "0xE20295ec513DEf805D9c3083b0C8EaB64692D764" }, "targetChain": "eip155:8453", "calls": [ { "to": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e0000000000000000000000000000000000000000000000000000000000989680", "value": "0x0" }, { "to": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "data": "0xa9059cbb000000000000000000000000456d35cc6634c0532925a3b844bc454e4438f44e0000000000000000000000000000000000000000000000000000000000989680", "value": "0x0" }, { "to": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "data": "0xa9059cbb000000000000000000000000789d35cc6634c0532925a3b844bc454e4438f44e0000000000000000000000000000000000000000000000000000000000989680", "value": "0x0" } ], "allowanceRequirements": [], "tokensRequired": [ { "assetType": "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "amount": "30000000" } ] }
import { encodeFunctionData, parseAbi } from 'viem'; // Generate transfer call data export function createTransferCall( tokenAddress: string, recipient: string, amount: bigint ) { return { to: tokenAddress, data: encodeFunctionData({ abi: parseAbi(['function transfer(address to, uint256 amount)']), functionName: 'transfer', args: [recipient, amount] }), value: '0x0' }; } // Generate approve call data export function createApprovalRequirement( tokenAddress: string, spender: string, amount: bigint, chainId: number ) { return { assetType: `eip155:${chainId}/erc20:${tokenAddress}`, amount: amount.toString(), spender }; } // Generate Uniswap V3 swap call data export function createUniswapV3Swap( tokenIn: string, tokenOut: string, fee: number, recipient: string, amountIn: bigint, amountOutMinimum: bigint, deadline: number ) { const swapRouter = '0x2626664c2603336E57B271c5C0b26F421741e481'; return { to: swapRouter, data: encodeFunctionData({ abi: parseAbi([ 'function exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160)) returns (uint256)' ]), functionName: 'exactInputSingle', args: [{ tokenIn, tokenOut, fee, recipient, deadline, amountIn, amountOutMinimum, sqrtPriceLimitX96: 0n }] }), value: '0x0' }; }
Was this page helpful?