Skip to main content
This guide is retained only for maintaining an existing Sophon v1 integration. Do not start a new production integration on the chain.
The popular Viem + Wagmi frontend setup can be used with Sophon. This section will provide a working PoC repository, relevant code snippets, and some cool gotchas that will help you working with this stack.
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 with eip712WalletActions() 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’s publicClient provider wrapper.