Check out our simple PoC repository that demonstrates how to use Viem and Wagmi together with the Paymaster .
Using Viem
with a Paymaster
When building dApps on Sophon, it’s important to correctly integrate our Paymaster to sponsor transactions, especially before SOPH is distributed.
This guide provides a working pattern, using Viem
and Wagmi
, for sending contract calls with Paymaster support on Sophon.
✅ Working Code Snippet
⚠️ Key Gotchas to Watch Out For
1. Missing paymasterInput or incorrect format
paymasterInput
must be passed, even if it’s an empty 0x
using:
Manually hardcoding
paymasterInput = "0x"
will not work.2. Use ZKsync wallet extensions
Extend your wallet client witheip712WalletActions()
to support sendTransaction
with Paymasters.
3. Pre-calculating the nonce is possible, but optional
Based on your personal use-cases, you can pre-calculate nonces, but this is also handled internally by Wagmi’spublicClient
provider wrapper.