Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Conversation

@matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Feb 11, 2025

Support the EIP-5792 methods:

  • wallet_sendCalls
  • wallet_getCallsStatus
  • wallet_getCapabilities

Specifically:

  • Modularise new method support into separate files under src/methods.
    • As opposed to continually extending src/wallet.ts.
  • Use @metamask/superstruct to easily validate request parameters against a schema / struct.
  • Move common validation functions to new src/validation.ts.
  • Export new types inferred from structs.
    • Specifically as opposed to * for easier API diffs.

An additional benefit of using @metamask/superstruct is including multiple validation errors within a single RPC error:

Error: Invalid params

0 > from - Expected a string matching \`/^0x[0-9a-fA-F]{40}$/\` but received "123"
0 > chainId - Expected a string, but received: 123
0 > calls - Expected an array value, but received: "123"

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review February 11, 2025 14:15
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner February 11, 2025 14:15
@matthewwalsh0 matthewwalsh0 requested a review from jiexi February 11, 2025 22:38
Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I left a tiny typo fix comment

@matthewwalsh0 matthewwalsh0 merged commit f212564 into main Feb 14, 2025
20 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/eip-5792 branch February 14, 2025 12:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants