Comment on page
Meta-transactions and gas sponsorship
When relaying gasless meta-transactions, you will have to make sure that your relayer account is funded with ETH (or other native tokens) for gas money. Your API key and secret correspond to a given relayer account.
Supercool meta-transaction relayer can:
- let your users transact gaslessly
- let your users users pay for transactions with ERC-20 coins
- bundle transactions together for gas savings
- pre-sign transactions to be executed later when certain conditions are met; for example, allow your users to create NFT limit orders
Here's a little code snippet to demo meta-transactions:
// Heads up: this NPM module is not published yet
import {supercool} from '@supercoolxyz/relayer-client'
import {ethers} from 'ethers'
// define these
const contractAddress = '0x...'
const abi = '{...}'
// replace this with whatever function creates your EOA signer
const eoaSigner = getEOASigner()
const provider = new supercool.RelayerProvider({apiKey: ..., apiSecret: ...})
const signer = supercool.GaslessForwarderSigner.fromEOASigner(
provider,
eoaSigner,
// meta-transactions must be routed through a forwarder for
// signature verification and nonce-based deduplication
supercool.getForwarderAddress()
)
const contract = new ethers.Contract(contractAddress, abi, signer)
// Making smart contract calls with this `GaslessForwarderSigner` will
// create gasless meta-transactions for the underlying end-user.
await contract.buyToken(...)
Note that the
@supercoolxyz/relayer-client
package is not published yet, but you can reach out to us at [email protected] for early access.Traditional meta-transactions work with any type of wallet: EOAs, ERC-4337 wallets, and old-school smart contract wallets. The downside, is that dapps and protocols must be meta-tx aware.
In summary:
- Traditional meta-txs:
- Pros: user can keep using their normal EOA (Privy wallet, Metamask, etc.)
- Cons: requires dapps and protocols to support meta-txs
- ERC-4337:
- Pros: gasless transactions, bundling, etc. work with all other smart contracts
- Cons: extra setup cost and an extra wallet address to manage
Last modified 7mo ago