GaslessSponsor

Allow FunWallets to transact without paying for gas

Overview

GaslessSponsor allows FunWallets to transact without paying for gas. This works by having an external funder account (EOA, FunWallet or other) stake the native gas token (e.g. ETH, MATIC, AVAX, etc) in a smart contract called a Paymaster.

This stake is then drained to cover the gas requirements for authorized FunWallets as they execute Transactions.

The GaslessSponsor class allows Paymaster external funders to configure their Paymaster, with the following capabilities:

  • Toggle between address whitelist & blacklist mode

  • Add & remove users from whitelists & blacklists


Constructor


const gaslessSponsor = new GaslessSponsor()

Methods


addWalletToWhitelist

Add a FunWallet to a GaslessSponsor whitelist
const actionFunc = gaslessSponsor.addWalletToWhitelist(walletAddress)

Parameters

walletAddress
address
Required

The address of a FunWallet to add to the whitelist

Returns

transaction
actionFunc

actionFunc ready to be signed & executed/deployed


removeWalletFromWhitelist

Remove a FunWallet from a GaslessSponsor whitelist
const actionFunc = gaslessSponsor.removeWalletFromWhitelist(walletAddress)

Parameters

walletAddress
address
Required

The address of a FunWallet to remove from the whitelist

Returns

transaction
Transaction

actionFunc ready to be signed & executed/deployed


addWalletToBlacklist

Add a FunWallet to a GaslessSponsor blacklist
const actionFunc = gaslessSponsor.addWalletToBlacklist(walletAddress)

Parameters

walletAddress
address
Required

The address of a FunWallet to add to the blacklist

Returns

transaction
Transaction

actionFunc ready to be signed & executed/deployed


removeWalletFromBlacklist

Remove a FunWallet from a GaslessSponsor blacklist
const actionFunc = gaslessSponsor.removeWalletFromBlacklist(walletAddress)

Parameters

walletAddress
address
Required

The address of a FunWallet to remove from the blacklist

Returns

transaction
actionFunc

setWhitelistMode

Set a GaslessSponsor to whitelist mode
const actionFunc = gaslessSponsor.setWhitelistMode()

Returns

transaction
actionFunc

actionFunc ready to be signed & executed/deployed


setBlacklistMode

Set a GaslessSponsor to blacklist mode
const actionFunc = gaslessSponsor.setBlacklistMode()

Returns

transaction
actionFunc

actionFunc ready to be signed & executed/deployed


stake

Stake some native gas tokens in the GaslessSponsor
const actionFunc = gaslessSponsor.stake(walletAddress, amount)

Parameters

walletAddress
address
Required

The address of a FunWallet to add native gas token stake for

amount
float
Required

Amount of native gas token to stake

Returns

transaction
actionFunc

actionFunc ready to be signed & executed/deployed


unstake

Unstake some native gas tokens from the GaslessSponsor
const actionFunc = gaslessSponsor.unstake(walletAddress, amount)

Parameters

walletAddress
address
Required

The address of a FunWallet to remove native gas token stake for

amount
float
Required

Amount of native gas token to unstake

Returns

transaction
actionFunc

actionFunc ready to be signed & executed/deployed