Skip to content

Conversation

@Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Feb 20, 2021

A schema has been added to the new BaseController class as a required constructor parameter. The schema describes which pieces of state should be persisted, and how to get an 'anonymized' snapshot of the controller state.

This is part of the controller redesign (#337).

@Gudahtt
Copy link
Member Author

Gudahtt commented Feb 20, 2021

This depends upon #358

@Gudahtt Gudahtt force-pushed the add-base-controller-schema branch from 6955b3d to 4ed5295 Compare February 20, 2021 03:02
Base automatically changed from base-controller-v2 to develop February 23, 2021 19:14
@Gudahtt Gudahtt closed this Feb 23, 2021
@Gudahtt Gudahtt force-pushed the add-base-controller-schema branch from 4ed5295 to ded054c Compare February 23, 2021 19:14
@Gudahtt
Copy link
Member Author

Gudahtt commented Feb 23, 2021

Replaced by #362

Mrtenz pushed a commit that referenced this pull request Oct 16, 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"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants