Metamask WalletConnect Issue: Pre-Transaction Confirmation Error
As a developer, you’re likely no stranger to Metamask and its role in wallet management. In this article, we’ll delve into an issue that may arise when connecting your DAAP (Delegated Access Application Provider) 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 properly validated, resulting in errors like the one you’re experiencing with internal JSON-RPC error.
Error Message:
The error message provided indicates that there was a problem 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 troubleshoot and fix the problem:
1. Verify Wallet Connect Configuration
Ensure that your DAAP configuration is correctly set up in Wallet Connect settings:
- Confirm that you’ve enabled Wallet Connect on your DAAP.
- Review the
walletconnect.json
file to ensure it matches your DAAP’s configuration.
2. Check Event Validation**
Verify that event validation is working as expected:
- In Metamask, go to
Settings>
Wallets & Accessors.
- Select the DAAP you’re using for Wallet Connect.
- In the
Event Handling section, check the
Validation Rules.
- If necessary, adjust or add validation rules to ensure only valid events are received.
3. Inspect Event Responses
When inspecting event responses, look for any clues about the issue:
- Check the
events
response in the browser’s DevTools under theevents
tab.
- Verify that the event is properly formatted and contains all required properties (e.g.,
type
,transactionId
, etc.).
4. Validate API Calls
To ensure that events are being sent correctly, verify your API calls:
- Check the DAAP’s RPC server logs to identify any issues with event validation.
- If using a local dev test node, run your API tests in a separate environment to isolate this issue.
Additional Tips:
- Keep your Metamask and DAAP versions 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 problem.
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.