Arka Paymaster
Pay for gas with ERC20 tokens using MultiTokenPaymaster
Using token paymasters we have the ability to pay for gas with whatever ERC20 tokens the paymaster supports. We can do this in two steps:
- Fetch the paymaster address and see if the MultiTokenPaymaster supports the particular token.
- Approve the tokens we wish to pay for gas with if exists and when estimating the transaction include the Arka and ERC20 parameters and send it to the bundler as a single batch transaction. We can do this like so:
From the above list of multiTokenPaymasters, check if your token is supported. If so, continue to the next step after taking the paymaster address associated with your token address. Note: ERC20_ABI is the ERC20 ABI for the token you want to pay for gas with. You can copy from here
Once the tokens are approved we can create whatever transactions we want, then estimate them before sending like this:
And send the estimated transactions in a batch once you are okay with the estimated gas fee
If you still face any issues, please reach out to us on Discord.