fix: an unsupported method is reported to the page with no EIP-1193 code (4200) #279
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while carrying error codes through to the page for #274. Deliberately not fixed there: that unit is confined to what
src/content/inpage.jssurfaces, and this is in what the background produces.handleRpc()insrc/background/index.jsends with:No code. EIP-1193 defines
4200("Unsupported Method") for exactly this, and the same handler already attaches4001,4100and4902elsewhere, so the omission reads as an oversight rather than a choice.With #274 landed the provider passes any code through verbatim, so adding
code: 4200at that one site is the whole fix — nothing insrc/content/inpage.jsneeds to change for it to reach the page.Why it matters: a dApp probing for an optional method (a
wallet_*capability check, a fallback chain) gets an uncoded error it cannot classify, so it cannot tell "this wallet does not implement that" from "that call failed" and cannot fall back cleanly.Other code-less error paths in the same handler are a separate question and are not in scope here: "No accounts available", a failed proxy RPC, a failed transaction population, and an address that changed mid-preparation are all internal failures with no obvious EIP-1193 code, whereas
4200is defined for precisely this case.Definition of done
handleRpc()returnscode: 4200for a method it does not implement, with the message unchanged.make checkpasses.