TS - TokenPaymasters: pay for gas with Lisk LSK, Base USDC or Celo CUSD

Firekeeper

Added the ability to pay for gas with ERC20 tokens when using Smart Wallet.

  • Currently supports Base USDC, Celo CUSD, and Lisk LSK tokens.
  • Simply select a TokenPaymaster when creating a SmartWallet and all transactions will be paid for with the corresponding ERC20 from the user's Smart Wallet.
  • Useful on L2s where the native token is ETH and you want to enshrine another coin or onramp your users directly to that coin.
  • These TokenPaymasters entirely operate onchain, leveraging popular DEXes and decentralized price feeds from Uniswap & Chainlink.
  • This product is in beta, and only compatible with EntryPoint v0.7.0, which we auto select for you if not overriden when configurin your wallet.

Example:

import { base, lisk, celo } from "thirdweb/chains";
import { TokenPaymaster, smartWallet } from "thirdweb/wallets";
// Have users pay for gas in Base USDC
const usdcWallet = smartWallet({
chain: base,
sponsorGas: true,
overrides: {
tokenPaymaster: TokenPaymaster.BASE_USDC,
},
});
// Have users pay for gas in Lisk LSK
const lskWallet = smartWallet({
chain: lisk,
sponsorGas: true,
overrides: {
tokenPaymaster: TokenPaymaster.LISK_LSK,
},
});
// Have users pay for gas in Celo CUSD
const cusdWallet = smartWallet({
chain: celo,
sponsorGas: true,
overrides: {
tokenPaymaster: TokenPaymaster.CELO_CUSD,
},
});