Skip to content

Check if an external account supports paymasters

If you have added support to sponsor transactions for external accounts using @permissionless/wagmi, you can use this guide to check if the external account supports ERC-7677 paymasters and display custom UI for your users.

Steps

Import useCapabilities

import { useCapabilities } from 'wagmi/experimental'

Fetch the available capabilities

import { useCapabilities } from 'wagmi/experimental'
 
function App() {
  const capabilities = useCapabilities()
}

Parse the capabilities for the currect chain

import { useCapabilities } from 'wagmi/experimental'
 
function App() {
  const capabilities = useCapabilities()
  
  const account = useAccount() 
  const capabilitiesForChain = capabilities[account.chainId] 
 
}

Check if the paymaster service is supported

import { useCapabilities } from 'wagmi/experimental'
 
function App() {
  const capabilities = useCapabilities()
  const account = useAccount()
 
  const capabilitiesForChain = capabilities[account.chainId]
  const paymasterServiceSupported = capabilitiesForChain?.paymasterService?.supported 
}