Metamask WalletConnect Issue: Confirmation Error Before Transaction
As a developer, you are probably familiar with Metamask and its role in wallet management. In this article, we will look at an issue that can occur when connecting your Delegated Access Application Provider (DAAP) via Wallet Connect on mobile devices.
The Issue:
When a user initiates a transaction on their mobile device using Wallet Connect, the browser sends an “events” request to Metamask’s RPC server. Unfortunately, this event is not always validated properly, resulting in errors like the one you are seeing with the Internal JSON-RPC error.
Error Message:
The error message provided indicates that there was an issue with the transaction confirmation process. The exact wording may vary depending on your specific experience:
“Internal JSON-RPC error”
or
“Event validation failed”
Troubleshooting Steps:
To resolve this issue, follow these steps to resolve it:
1. Check Wallet Connect configuration
Make sure your DAAP configuration is configured correctly in Wallet Connect settings:
- Confirm that you have enabled Wallet Connect on your DAAP.
- Check the
walletconnect.json
file to make sure it matches your DAAP configuration.
2. Check event validation**
Verify that event validation is working as expected:
- In Metamask, navigate to
Settings>
Wallets & Accessors.
- Select the DAAP you are using for Wallet Connect.
- In the
Event Handling section, check the
Validation Rules.
- If necessary, adjust or add validation rules to ensure that only valid events are received.
3. Inspect Event Responses
When inspecting event responses, look for clues to the problem:
- Check the “events” response in the browser’s developer tools under the “events” tab.
- Check that the event is correctly formatted and contains all required properties (e.g. “type”, “transactionId”, etc.).
4. Validate API Calls
To ensure that events are being sent correctly, check your API calls:
- Check the DAAP RPC server logs for possible event validation issues.
- If you are using a local development test node, run your API tests in a separate environment to isolate this issue.
Additional Tips:
- Keep your versions of Metamask and DAAP up to date, as newer versions may introduce fixes for this specific issue.
- Consider implementing additional logging or monitoring tools to help identify the root cause of the issue.
By following these steps, you should be able to resolve the internal JSON-RPC error and ensure a smooth Wallet Connect experience on your mobile device.