Transact gas-free

Transact gas-free with a 3rd party sponsor.

For a FunWallet to transact gas-free, the native gas token must be staked in a Gasless Paymaster contract.

Quick start


Configure environment

Configure the options.gasSponsor environment variable to contain the address of the gas sponsor. To learn more about gas sponsors for transacting gas-free, visit the gasless sponsor section.

await configureEnvironment({
gasSponsor: {
sponsorAddress: "0x07Ac5A221e5b3263ad0E04aBa6076B795A91aef9" // Our test sponsor address on Göerli

Fun offers a publicly-available gasless sponsor on the Göerli testnet for developers testing purposes. Once Fun has completed smart contract audits, a production-ready gasless paymaster will be available for use on all supported networks.

const ethers = require("ethers")
const { FunWallet, configureEnvironment } = require("fun-wallet")
const { Eoa } = require("fun-wallet/auth")
const fetch = require('node-fetch')
const API_KEY = "MYny3w7xJh6PRlRgkJ9604sHouY2MTke6lCPpSHq"
const PRIVATE_KEY = "0x98e9cfb323863bc4bfc094482703f3d4ac0cd407e3af2351c00dde1a6732756a"
const DEST_ADDR = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
const main = async () => {
// Configure environment
await configureEnvironment({
gasSponsor: {
sponsorAddress: "0x07Ac5A221e5b3263ad0E04aBa6076B795A91aef9" // Our paymaster address
const auth = new Eoa({ privateKey:PRIVATE_KEY })
const uniqueId = await auth.getUniqueId()
const funWallet = new FunWallet( { uniqueId } )
console.log(await funWallet.getAddress())
const receipt = await funWallet.transfer(auth, {
amount: .001,
token: "eth"