Example with the Execution API
This is a hands-on tutorial that walks through building a simple refuel automation using a JS script. Perfect for getting familiar with core API types and execution flows.
A Simple Cross Chain Refuel BOT
Creating the Automation
// Define the EIP-712 message parameters
const msgParams = {
domain: {
chainId: 42161
},
message: {
timestamp: 1,
executor: "0xAE75B29ADe678372D77A8B41225654138a7E6ff1",
inputTokens: ["0x0000000000000000000000000000000000000000"],
hopAddresses: ["0x3a23F943181408EAC424116Af7b7790c94Cb97a5"],
feeInBPS: 0,
feeToken: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
feeReceiver: "0xAE75B29ADe678372D77A8B41225654138a7E6ff1",
limitPerExecution: true,
clientId: "auto-refuel"
},
primaryType: "RegisterExecutor",
types: {
EIP712Domain: [
{ name: "chainId", type: "uint256" },
{ name: "name", type: "string" },
{ name: "version", type: "string" },
{ name: "verifyingContract", type: "address" }
],
RegisterExecutor: [
{ name: "timestamp", type: "uint256" },
{ name: "executor", type: "address" },
{ name: "inputTokens", type: "address[]" },
{ name: "hopAddresses", type: "address[]" },
{ name: "feeInBPS", type: "uint256" },
{ name: "feeToken", type: "address" },
{ name: "feeReceiver", type: "address" },
{ name: "limitPerExecution", type: "bool" },
{ name: "clientId", type: "string" }
]
}
};Fetching subscribers of automation
Checking if the automation should be executed for a subscriber
Executing calldata to bridge funds to refuelAddress on required chains from subscriber
refuelAddress on required chains from subscriberAutomation Demo
Wrapping up
Last updated