walletconnect-monorepo: [@walletconnect/ethereum-provider V2] Intermittent `Error: No matching key.` on `eth_sendTransaction` requests

Describe the bug When sending an eth_sendTransaction request, seeing intermittent Error: No matching key. errors on both the history and keychain keys, both locally and in a hosted environment. Sometimes they work, sometimes not. For example, I’ve gotten it to work twice in a row and then on the 3rd time we’ll get the error. The result is that we never get a response from the request - it just hangs. Additional info at the bottom.

SDK Version (if relevant)

  • Client: @walletconnect/ethereum-provider
  • Version: 2.7.2

To Reproduce Steps to reproduce the behavior:

  1. Initialize a provider using @walletconnect/ethereum-provider init
  2. Connect an account using the provider
  3. Fire a send tx request:
provider.request<string>({
    method: "eth_sendTransaction",
    params: [{...}],
});
  1. See error
  2. NEVER get a response back from the request.

Expected behavior The eth_sendTransaction requests succeed every time.

Screenshots

image

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Version: 112.0.5615.121

Additional context

Here’s the WalletConnect local storage history entry for the error you see in the screenshot:

{
    "id": 1683064859400268,
    "topic": "36ec8902c543226afaa2c6c9978b7517576718a6339bf389275d18a779e4b335",
    "request": {
        "method": "wc_sessionRequest",
        "params": {
            "request": {
                "method": "eth_sendTransaction",
                "params": [
                    {
                        "from": REDACTED,
                        "to": REDACTED,
                        "value": "0x1bc16d674ec800000",
                        "data":  REDACTED
                    }
                ]
            },
            "chainId": "eip155:5"
        }
    },
    "chainId": null
}

As you can see, there’s no response key in that entry like there is for requests that get a response.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 23 (4 by maintainers)

Most upvoted comments

Hey @ganchoradkov thanks for taking a look at this. I do have some logic to clear something out of the local storage, but it’s the WALLETCONNECT_DEEPLINK_CHOICE, not the wc@2:core:0.3//history (there’s actually another issue for that here: https://github.com/WalletConnect/walletconnect-monorepo/issues/2303#issuecomment-1539185204). I don’t touch the wc@2:core:0.3//history at all.

I’ve gone ahead and upgraded @walletconnect/ethereum-provider to latest (2.8.0), but now I’m getting some other errors:

  • When connecting (after approving the connection in the wallet), I’ll get: Error: No matching key. pairing: undefined But the connection looks to still work, there’s just no entry in wc@2:core:0.3//pairing. Is that okay?
  • When sending a transaction, but then receiving a thrown error from the wallet (expected, such as when canceling a transaction), I’ll get: Error: No matching key. keychain: 5c432db6f7e4c08b3137b1fa9038988a8217dad60564266cc18ad59c6221a57c Error: No matching key. history: 1686332171383594

Here’s a full example of the history one:

Uncaught (in promise) Error: No matching key. history: 1686333621898358
    at Ut.getRecord (webpack-internal:///(app-client)/../../node_modules/.pnpm/@walletconnect+core@2.8.0_2adebc2xdjqbcvbjxkodkhadp4/node_modules/@walletconnect/core/dist/index.es.js:82:58216)
    at Ut.get (webpack-internal:///(app-client)/../../node_modules/.pnpm/@walletconnect+core@2.8.0_2adebc2xdjqbcvbjxkodkhadp4/node_modules/@walletconnect/core/dist/index.es.js:82:56588)
    at Nt.onRelayEventResponse (webpack-internal:///(app-client)/../../node_modules/.pnpm/@walletconnect+core@2.8.0_2adebc2xdjqbcvbjxkodkhadp4/node_modules/@walletconnect/core/dist/index.es.js:82:50376)
    at EventEmitter.eval (webpack-internal:///(app-client)/../../node_modules/.pnpm/@walletconnect+core@2.8.0_2adebc2xdjqbcvbjxkodkhadp4/node_modules/@walletconnect/core/dist/index.es.js:82:54801)

Interestingly enough, both the keychain and history referenced appear in local storage. Could it be that there’s some race condition in the SDK that checks for the key before the entry exists?