Permit2
Here’s the guideline of using Permit2 in OpenOcean Swap API
About Permit2
Using Permit2 with OpenOcean Swap API
1. Check the current allowance for permit2
import { ethers } from 'ethers';
async function allowance() {
const rpcUrl = 'https://base.llamarpc.com';
const token = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
const account = "";
const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
const provider = new ethers.JsonRpcProvider(rpcUrl);
const contract = new ethers.Contract(token, ERC20_ABI, provider);
const allowance = await contract.allowance(account, permit2Address);
console.log(`allowance: ${allowance.toString()}`)
}2. Approve Permit2 if needed (Optional)
3. Generate the Permit2 signature and data
4. Build the transaction body
**5. Send the transaction with the Permit2 signature **
Supported Chains
Chain Name
ChainId
Permit2 Address
Last updated