Skip to content

Latest commit

 

History

History
 
 

sponsor-gas-using-policies

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Setup a Safe Account and sponsor its Gas

Viem, permissionless and Candide

This is example showcase how to deploy a Safe account while sponsoring its transactions gas fees using a private gas policy with Candide Paymaster.

Getting Started

Setup

  • Create an API key and setup a Gas Policy on Candide's Dashboard
  • Create a .env file from .env.example
cp .env.example .env

Running

npm install
npm start

Note on Gas Price Estimate

Note: Viem tend to overestimate gas prices for AA User Operations. To get a more accurate estimate, we use the estimateFeesPerGas method to fetch the current gas prices and add them to the overrides when sending the user operation. This approach ensures you pay a fair block price for gas.

import { estimateFeesPerGas } from "viem/actions"

const {
    maxFeePerGas,
    maxPriorityFeePerGas
} = await estimateFeesPerGas(client);