diff --git a/external/keyring-api b/external/keyring-api deleted file mode 160000 index 1c8eeb9beef..00000000000 --- a/external/keyring-api +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1c8eeb9beef7f21ca0bd394b6fe06fea856e3520 diff --git a/snaps/how-to/use-environment-variables.md b/snaps/how-to/use-environment-variables.md index fa7491abc3f..8233dbc8049 100644 --- a/snaps/how-to/use-environment-variables.md +++ b/snaps/how-to/use-environment-variables.md @@ -13,6 +13,15 @@ your Snap. You can use environment variables [on the command line](#use-environment-variables-on-the-command-line) or [in a `.env` file](#use-environment-variables-in-a-env-file). +:::note +In addition to the environment variables you set, the following environment variables are set by the +Snaps CLI: + +- `NODE_ENV="production"` +- `NODE_DEBUG=false` +- `DEBUG=false` +::: + ## Use environment variables on the command line 1. Specify environment variables on the command line. diff --git a/snaps/learn/about-snaps/files.md b/snaps/learn/about-snaps/files.md index e5596ad3e78..512ca6ab89a 100644 --- a/snaps/learn/about-snaps/files.md +++ b/snaps/learn/about-snaps/files.md @@ -3,6 +3,9 @@ description: Learn about the Snap project files. sidebar_position: 2 --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + # Snaps files If you look at the directory structure of the Snaps monorepo project generated in the @@ -92,29 +95,50 @@ For example, running [`yarn mm-snap build`](../../reference/cli/subcommands.md#b ## Configuration file -The Snap configuration file, `snap.config.ts`, should be placed in the project root directory. -You can override the default values of the [Snaps CLI options](../../reference/cli/options.md) by specifying -them in the `config` object of the configuration file. +The Snap configuration file, `snap.config.js` or `snap.config.ts`, must be placed in the project +root directory. +You can override the default values of the +[Snaps configuration options](../../reference/cli/options.md) by specifying them in the +configuration file. For example: -```ts -import { resolve } from 'path'; -import type { SnapConfig } from '@metamask/snaps-cli'; + + + +```javascript title="snap.config.js" +module.exports = { + input: "src/index.js", + output: { + path: "dist", + }, + server: { + port: 9000, + }, +}; +``` + + + + +```typescript title="snap.config.ts" +import type { SnapConfig } from "@metamask/snaps-cli"; const config: SnapConfig = { - bundler: 'webpack', - input: resolve(__dirname, 'src/index.ts'), - server: { - port: 8080, - }, - polyfills: { - buffer: true, - }, + input: "src/index.js", + output: { + path: "dist", + }, + server: { + port: 9000, + }, }; export default config; ``` + + + :::note You should not publish the configuration file to npm, since it's only used for development and building. diff --git a/snaps/reference/cli/options.md b/snaps/reference/cli/options.md index b2d348ac602..83142b8d838 100644 --- a/snaps/reference/cli/options.md +++ b/snaps/reference/cli/options.md @@ -7,542 +7,564 @@ description: See the Snaps CLI options reference. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# Snaps command line options +# Snaps configuration options -This reference describes the syntax of the Snaps command line interface (CLI) options. +This reference describes the syntax of the Snaps command line interface (CLI) configuration options. +You can specify these options in the +[configuration file](../../learn/about-snaps/files.md#configuration-file). -## Specify options +## `bundler` -You can specify options: + + + +```javascript +bundler: , +``` -- In the [configuration file](../../learn/about-snaps/files.md#configuration-file). + + + +```javascript +bundler: "webpack", +``` -- On the command line using the `yarn mm-snap` command. + + - ```bash - yarn mm-snap [SUBCOMMAND] [OPTIONS] - ``` +The bundler to use. +The options are `"webpack"` and `"browserify"`. +The default is `"webpack"`. -## Options +:::caution important +We recommend using the Webpack bundler. +The Browserify-based configuration is deprecated and will be removed in the future. +This reference describes the configuration options for Webpack. +For Browserify, see the +[legacy options](https://github.com/MetaMask/snaps/tree/455366f19281801ed4220431100e45237dd5cf1e/packages/snaps-cli#legacy-options). +::: -### b, bundle +## `customizeWebpackConfig` -```bash ---bundle +```typescript +customizeWebpackConfig: , ``` -```bash --b out/bundle.js -``` - - - - -```js -bundle: 'out/bundle.js' +```typescript +customizeWebpackConfig: (config) => + merge(config, { + plugins: [ + // Add a plugin. + ], + module: { + rules: [ + // Add a loader. + ], + }, + }), ``` -Path to the Snap [bundle file](../../learn/about-snaps/files.md#bundle-file). -The default is `dist/bundle.js`. - -You can use this option with the [`eval`](subcommands.md#e-eval) subcommand. +A function that customizes the Webpack configuration. +For example, you can use this option to add a Webpack plugin, provide a polyfill, or add a loader. -`-b` is an alias for `--bundle`. +The function should receive the Webpack configuration object and return the modified configuration object. +For convenience, the Snaps CLI exports a `merge` function that you can use to merge the +configuration object with the +[default Webpack configuration](https://github.com/MetaMask/snaps/blob/main/packages/snaps-cli/src/webpack/config.ts). -### d, dist +## `environment` -```bash ---dist +```javascript +environment: , ``` -```bash --d out -``` - - - - -```js -dist: 'out' +```javascript +environment: { + SNAP_ENV: process.env.SNAP_ENV, + PUBLIC_KEY: process.env.PUBLIC_KEY, +}, ``` -Path to the output directory. -The default is `dist`. - -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. +The environment configuration. +You can use this to [set environment variables for the Snap](../../how-to/use-environment-variables.md), +which can be accessed using `process.env`. -`-d` is an alias for `--dist`. - -### depsToTranspile +## `evaluate` -```bash ---depsToTranspile +```javascript +evaluate: , ``` -```bash ---depsToTranspile dep1,dep2 +```javascript +evaluate: true, ``` - + -```js -depsToTranspile: ['dep1','dep2'] -``` +Enables or disables evaluating the bundle. +When set to `true`, the bundle is checked for compatibility issues with the Snaps runtime. +If there are any issues, the CLI exits with an error. - - +## `experimental` -List of dependencies to transpile, if [`--transpilationMode`](#transpilationmode) is set to -`localAndDeps`. +Experimental features. -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. +:::caution +These features are not stable, and might change in the future. +::: -### e, eval +### `experimental.wasm` -```bash ---eval +```javascript +experimental: { + wasm: , +}, ``` -```bash --e false -``` - - - - -```js -eval: false +```javascript +experimental: { + wasm: true, +}, ``` -Indicates whether to attempt to evaluate the Snap bundle in SES. -The default is `true`. +Enables or disables WebAssembly support. +When set to `true`, WebAssembly files can be imported in the Snap. +For example: -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. +```typescript +import program from './program.wasm'; -`-e` is an alias for `--eval`. +// Program is initialized synchronously. +// ... +``` -### fix, writeManifest +## `input` -```bash ---fix +```javascript +input: , ``` -```bash ---fix false +```javascript +input: "src/index.js", ``` - + -```js -fix: false -``` +The entry point of the Snap. +This is the file that will be bundled. +The default is `"src/index.js"`. - - +## `manifest` -When validating the Snap [manifest file](../../learn/about-snaps/files.md#manifest-file) using the -[`manifest`](subcommands.md#m-manifest) subcommand, indicates whether to make necessary changes to -the manifest file. -The default is `true`. +The Snap [manifest file](../../learn/about-snaps/files.md#manifest-file) configuration. -`--fix` is an alias for `--writeManifest`. +### `manifest.path` -### h, help + + + +```javascript +manifest: { + path: , +}, +``` + + + -```bash --h, --help +```javascript +manifest: { + path: "snap.manifest.json", +}, ``` -Displays the help message and exits. -You can use this option with `mm-snap` or any [subcommand](subcommands.md). + + -`-h` is an alias for `--help`. +Path to the Snap manifest file. +The default is `"snap.manifest.json"`. -### m, manifest +### `manifest.update` -```bash ---manifest +```javascript +manifest: { + update: , +}, ``` -```bash --m false -``` - - - - -```js -manifest: false +```javascript +manifest: { + update: false, +}, ``` -Indicates whether to validate the Snap [manifest file](../../learn/about-snaps/files.md#manifest-file). +Enables or disables updating the manifest file with the bundle shasum, and making any other possible updates. +If set to `false`, the manifest is not updated, and an error is thrown if the manifest is not up-to-date. The default is `true`. -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. +## `output` -`-m` is an alias for `--manifest`. +The output configuration. -### n, outfileName +### `output.clean` -```bash ---outfileName +```javascript +output: { + clean: , +}, ``` -```bash --n snap.js -``` - - - - -```js -outfileName: 'snap.js' +```javascript +output: { + clean: true, +}, ``` -Output file name when building a Snap from source. -The default is `bundle.js`. - -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. - -`-n` is an alias for `--outfileName`. +Enables or disables cleaning the output directory before building. +The default is `false`. -### p, port +### `output.filename` -```bash ---port +```javascript +output: { + filename: , +}, ``` -```bash --p 9000 +```javascript +output: { + filename: "bundle.js", +}, ``` - + + +The output filename. +The default is `"bundle.js"`. -```js -port: 9000 +### `output.minimize` + + + + +```javascript +output: { + minimize: , +}, ``` - + -Local server port for testing. -The default is `8081`. +```javascript +output: { + minimize: false, +}, +``` -You can use this option with the [`serve`](subcommands.md#s-serve) and -[`watch`](subcommands.md#w-watch) subcommands. + + -`-p` is an alias for `--port`. +Enables or disables minimizing the bundle. +Minimizing the bundle removes comments and whitespace, mangles variable names, and performs other optimizations. +The default is `true`. -### r, root +### `output.path` -```bash ---root +```javascript +output: { + path: , +}, ``` -```bash --r out -``` - - - - -```js -root: 'out' +```javascript +output: { + path: "dist", +}, ``` -Server root directory. -The default is the current working directory (`.`). +Path to the output directory. +The default is `"dist"`. -You can use this option with the [`serve`](subcommands.md#s-serve) and -[`watch`](subcommands.md#w-watch) subcommands. +## `server` -`-r` is an alias for `--root`. +The development server configuration. +The development server is used to test the Snap during development, using the +[`watch`](subcommands.md#w-watch) and [`serve`](subcommands.md#s-serve) subcommands. -### s, src +### `server.enabled` -```bash ---src +```javascript +server: { + enabled: , +}, ``` -```bash --s lib/index.js +```javascript +server: { + enabled: false, +}, ``` - + + +Enables or disables the development server. + +### `server.port` -```js -src: 'lib/index.js' + + + +```javascript +server: { + port: , +}, ``` - + -Path to the Snap source file. -The default is `src/index.js`. +```javascript +server: { + port: 9000, +}, +``` -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. + + -`-s` is an alias for `--src`. +The port to run the development server on. +If set to `0`, a random port is used. +The default is `8081`. -### sourceMaps +### `server.root` -```bash ---sourceMaps +```javascript +server: { + root: , +}, ``` -```bash ---sourceMaps true -``` - - - - -```js -sourceMaps: true +```javascript +server: { + root: "snap", +}, ``` -Indicates whether builds should include source maps. -The default is `false`. - -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. +The root directory of the development server. +This is the directory that is served by the development server. +The default is the current working directory. -### strip, stripComments +## `sourceMap` -```bash ---strip +```javascript +sourceMap: , ``` -```bash ---strip false -``` - - - - -```js -strip: false +```javascript +sourceMap: "inline", ``` -Indicates whether to remove code comments from the build output. +Enables or disables generating a source map. +If set to `"inline"`, the source map is inlined in the bundle. +If set to `true` or not specified, it is written to a separate file. The default is `true`. -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. +## `stats` -`--strip` is an alias for `--stripComments`. +The stats configuration, which controls the log output of the CLI. -### suppressWarnings +### `stats.buffer` -```bash ---suppressWarnings +```javascript +stats: { + buffer: , +}, ``` -```bash ---suppressWarnings true -``` - - - - -```js -suppressWarnings: true +```javascript +stats: { + buffer: false, +}, ``` -Indicates whether to suppress warnings. -The default is `false`. +Enables or disables showing a warning if the `Buffer` global is used but not provided. +The `Buffer` global is not available in the Snaps runtime by default, and must be provided using the +[`customizeWebpackConfig`](#customizewebpackconfig) option. -You can use this option with any [subcommand](subcommands.md). +The default is `true`. -### transpilationMode +### `stats.builtIns` -```bash ---transpilationMode +```javascript +stats: { + builtIns: , +}, ``` -```bash ---transpilationMode localAndDeps -``` - - - - -```js -transpilationMode: 'localAndDeps' +```javascript +stats: { + builtIns: { + ignore: [ + // Built-in modules to ignore. + ] + }, +}, ``` -[Babel](https://babeljs.io/) transpilation mode. -Specify `localAndDeps` to transpile all source code including dependencies, `localOnly` to transpile -local source code only, and `none` to transpile nothing. +Enables or disables checking for missing built-in modules. -The default is `localOnly`. +Not specifying this option, or specifying an ignore list, enables checking for missing built-in modules. +When enabled, the CLI shows a warning if a built-in is used but not provided. +The Snaps CLI does not support Node.js built-ins out of the box, and any used built-ins must be +provided using the [`customizeWebpackConfig`](#customizewebpackconfig) option. -You can use this option with the [`build`](subcommands.md#b-build) and -[`watch`](subcommands.md#w-watch) subcommands. +You can specify a list of built-ins to ignore when checking for missing built-ins. +This is useful if the built-in is not actually used in the Snap, but is added by a dependency. -:::note -For TypeScript Snaps, `--transpilationMode` must be set to either `localOnly` or `localAndDeps`. -::: +The default is an empty ignore list. -### verboseErrors +### `stats.verbose` -```bash ---verboseErrors +```javascript +stats: { + verbose: , +}, ``` -```bash ---verboseErrors false -``` - - - - -```js -verboseErrors: false +```javascript +stats: { + verbose: true, +}, ``` -Indicates whether to display original errors. -The default is `true`. - -You can use this option with any [subcommand](subcommands.md). - -### version - -```bash ---version -``` - -Displays the version number and exits. +Enables or disables verbose logging. +If set to `true`, the CLI logs more information. +The default is `false`. diff --git a/snaps/reference/cli/subcommands.md b/snaps/reference/cli/subcommands.md index 1f3ce5c4fc2..f1d6632ee6e 100644 --- a/snaps/reference/cli/subcommands.md +++ b/snaps/reference/cli/subcommands.md @@ -9,160 +9,176 @@ import TabItem from '@theme/TabItem'; # Snaps subcommands -This reference describes the syntax of the Snaps command line interface (CLI) subcommands. +This reference describes the syntax of the Snaps command line interface (CLI) subcommands and +subcommand options. -You can specify subcommands and options using the `yarn mm-snap` command: +You can specify subcommands and their options using the `yarn mm-snap` command: ```bash -yarn mm-snap [SUBCOMMAND] [OPTIONS] +yarn mm-snap [SUBCOMMAND] [SUBCOMMAND OPTIONS] ``` -## b, build +## `b`, `build` + +```bash +yarn mm-snap build +``` + +Builds a Snap from source. + +`b` is an alias for `build`. + +### `c`, `config` ```bash -yarn mm-snap build [options] +yarn mm-snap build --config ``` ```bash -yarn mm-snap b -s lib/index.js -d out -n snap.js +yarn mm-snap build --config ./snap.config.build.ts ``` -Builds a Snap from source. +Path to the [configuration file](../../learn/about-snaps/files.md#configuration-file). -`b` is an alias for `build`. +`-c` is an alias for `--config`. -## e, eval - - - +## `e`, `eval` ```bash -yarn mm-snap eval [options] +yarn mm-snap eval ``` - - +Attempts to evaluate the Snap bundle in +[Secure ECMAScript (SES)](../../learn/about-snaps/execution-environment.md#secure-ecmascript-ses). + +`e` is an alias for `eval`. + +## `m`, `manifest` ```bash -yarn mm-snap e -b out/snap.js +yarn mm-snap manifest ``` - - - -Attempts to evaluate the Snap bundle in SES. +Validates the Snap [manifest file](../../learn/about-snaps/files.md#manifest-file). -`e` is an alias for `eval`. +`m` is an alias for `manifest`. -## i, init +### `fix` ```bash -yarn mm-snap init [directory] +yarn mm-snap manifest --fix ``` ```bash -yarn mm-snap i my-snap +yarn mm-snap manifest --fix false ``` -Initializes a Snap project in the specified directory. -If no directory is specified, the Snap project is initialized in the current directory. +Enables or disables making any changes to fix the manifest file. +The default is `true`. + +## `s`, `serve` + +```bash +yarn mm-snap serve +``` + +Locally serves Snap files for testing. -`i` is an alias for `init`. +`s` is an alias for `serve`. -## m, manifest +### `p`, `port` ```bash -yarn mm-snap manifest [options] +yarn mm-snap serve --port ``` ```bash -yarn mm-snap m --fix false +yarn mm-snap serve --port 9000 ``` -Validates the Snap [manifest file](../../learn/about-snaps/files.md#manifest-file). +The local server port for testing. +The default is `8081`. -`m` is an alias for `manifest`. +`-p` is an alias for `--port`. + +## `w`, `watch` -## s, serve +```bash +yarn mm-snap watch +``` + +Rebuilds a Snap from source upon changes. + +`w` is an alias for `watch`. + +### `p`, `port` ```bash -yarn mm-snap serve [options] +yarn mm-snap watch --port ``` ```bash -yarn mm-snap s -r out -p 9000 +yarn mm-snap watch --port 9000 ``` -Locally serves Snap files for testing. +The local server port for testing. +The default is `8081`. -`s` is an alias for `serve`. +`-p` is an alias for `--port`. -## w, watch +## Global options - - +### `h`, `help` ```bash -yarn mm-snap watch [options] +-h, --help ``` - - +Displays the help message and exits. +You can use this option with `mm-snap` or any subcommand. -```bash -yarn mm-snap w -s lib/index.js -d out -``` +`-h` is an alias for `--help`. - - - -Rebuilds a Snap from source upon changes to the files in the parent and child directories of the -source directory. +### `version` -:::note -All files in the parent and child directories of sthe source directory are watched for changes, except: +```bash +--version +``` -- Files in the `node_modules` directory. -- Files in the `test` or `tests` directories. -- Any files named `test.js` or `test.ts`. -- Files in the `dist` directory, or the directory specified using [`--dist`](options.md#d-dist). -- Dotfiles. -::: - -`w` is an alias for `watch`. +Displays the version number and exits. diff --git a/snaps/reference/keyring-api/.nojekyll b/snaps/reference/keyring-api/.nojekyll deleted file mode 100644 index e2ac6616add..00000000000 --- a/snaps/reference/keyring-api/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/snaps/reference/keyring-api/classes/KeyringClient.md b/snaps/reference/keyring-api/classes/KeyringClient.md deleted file mode 100644 index 59d2cdaae55..00000000000 --- a/snaps/reference/keyring-api/classes/KeyringClient.md +++ /dev/null @@ -1,421 +0,0 @@ -# Class: KeyringClient - -## Extended By - -- [`KeyringSnapControllerClient`](KeyringSnapControllerClient.md) -- [`KeyringSnapRpcClient`](KeyringSnapRpcClient.md) - -## Implements - -- [`Keyring`](../type-aliases/Keyring.md) - -## Constructors - -### new KeyringClient(sender) - -```ts -new KeyringClient(sender): KeyringClient -``` - -Create a new instance of `KeyringClient`. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `sender` | [`Sender`](../type-aliases/Sender.md) | The `Sender` instance to use to send requests to the snap. | - -#### Source - -[external/keyring-api/src/keyring-client.ts:40](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L40) - -## Properties - -### #sender - -```ts -private #sender: Sender; -``` - -#### Source - -[external/keyring-api/src/keyring-client.ts:33](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L33) - -## Methods - -### #send() - -```ts -private #send(partial): Promise< - | null - | string[] - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - } - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - } - | { - pending: true; - } - | { - pending: false; - result: Json; - } - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }[] - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}[]> -``` - -Send a request to the snap and return the response. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `partial` | \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listAccounts"`; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getAccount"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_createAccount"`; `params`: \{ name: string; options: Record \| null; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_filterAccountChains"`; `params`: \{ id: string; chains: string[]; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_updateAccount"`; `params`: \{ account: \{ id: string; name: string; address: string; options: Record \| null; supportedMethods: ("personal\_sign" \| "eth\_sendTransaction" \| "eth\_sign" \| "eth\_signTransaction" \| "eth\_signTypedData" \| "eth\_signTypedData\_v1" \| "eth\_signTypedData\_v2" \| "eth\_signTypedData\_v3" \| "eth\_signTypedData\_v4")[]; type: "eip155:eoa" \| "eip155:erc4337"; }; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_deleteAccount"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listRequests"`; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_submitRequest"`; `params`: \{ account: string; scope: string; request: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_approveRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_rejectRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> | Partial internal request (method and params). | - -#### Returns - -A promise that resolves to the response to the request. - -#### Source - -[external/keyring-api/src/keyring-client.ts:50](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L50) - -*** - -### approveRequest() - -```ts -approveRequest(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Implementation of - -Keyring.approveRequest - -#### Source - -[external/keyring-api/src/keyring-client.ts:151](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L151) - -*** - -### createAccount() - -```ts -createAccount(name, options): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}> -``` - -#### Parameters - -| Parameter | Type | Default value | -| :------ | :------ | :------ | -| `name` | `string` | `undefined` | -| `options` | `null` \| `Record`<`string`, `Json`\> | `null` | - -#### Implementation of - -Keyring.createAccount - -#### Source - -[external/keyring-api/src/keyring-client.ts:79](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L79) - -*** - -### deleteAccount() - -```ts -deleteAccount(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Implementation of - -Keyring.deleteAccount - -#### Source - -[external/keyring-api/src/keyring-client.ts:112](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L112) - -*** - -### filterAccountChains() - -```ts -filterAccountChains(id, chains): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | -| `chains` | `string`[] | - -#### Implementation of - -Keyring.filterAccountChains - -#### Source - -[external/keyring-api/src/keyring-client.ts:92](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L92) - -*** - -### getAccount() - -```ts -getAccount(id): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}> -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Implementation of - -Keyring.getAccount - -#### Source - -[external/keyring-api/src/keyring-client.ts:69](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L69) - -*** - -### getRequest() - -```ts -getRequest(id): Promise<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}> -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Implementation of - -Keyring.getRequest - -#### Source - -[external/keyring-api/src/keyring-client.ts:131](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L131) - -*** - -### listAccounts() - -```ts -listAccounts(): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}[]> -``` - -#### Implementation of - -Keyring.listAccounts - -#### Source - -[external/keyring-api/src/keyring-client.ts:60](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L60) - -*** - -### listRequests() - -```ts -listRequests(): Promise<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}[]> -``` - -#### Implementation of - -Keyring.listRequests - -#### Source - -[external/keyring-api/src/keyring-client.ts:122](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L122) - -*** - -### rejectRequest() - -```ts -rejectRequest(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Implementation of - -Keyring.rejectRequest - -#### Source - -[external/keyring-api/src/keyring-client.ts:161](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L161) - -*** - -### submitRequest() - -```ts -submitRequest(request): Promise<{ - pending: true; - } | { - pending: false; - result: Json; -}> -``` - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `request` | \{ `account`: `string`; `request`: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; `scope`: `string`; } | - | -| `request.account` | `string` | Account ID (UUIDv4). | -| `request.request` | \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; } | JSON-RPC request sent by the client application.

Note: The request ID must be a string. | -| `request.scope` | `string` | Request's scope (CAIP-2 chain ID). | - -#### Implementation of - -Keyring.submitRequest - -#### Source - -[external/keyring-api/src/keyring-client.ts:141](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L141) - -*** - -### updateAccount() - -```ts -updateAccount(account): Promise -``` - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `account` | \{ `address`: `string`; `id`: `string`; `name`: `string`; `options`: `null` \| `Record`<`string`, `Json`\>; `supportedMethods`: ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[]; `type`: `"eip155:eoa"` \| `"eip155:erc4337"`; } | - | -| `account.address` | `string` | Account address or next receive address (UTXO). | -| `account.id` | `string` | Account ID (UUIDv4). | -| `account.name` | `string` | User-chosen account name. | -| `account.options` | `null` \| `Record`<`string`, `Json`\> | Keyring-dependent account options. | -| `account.supportedMethods` | ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[] | Account supported methods. | -| `account.type` | `"eip155:eoa"` \| `"eip155:erc4337"` | Account type. | - -#### Implementation of - -Keyring.updateAccount - -#### Source - -[external/keyring-api/src/keyring-client.ts:102](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L102) diff --git a/snaps/reference/keyring-api/classes/KeyringSnapControllerClient.md b/snaps/reference/keyring-api/classes/KeyringSnapControllerClient.md deleted file mode 100644 index d9140f88ac6..00000000000 --- a/snaps/reference/keyring-api/classes/KeyringSnapControllerClient.md +++ /dev/null @@ -1,477 +0,0 @@ -# Class: KeyringSnapControllerClient - -A `KeyringClient` that allows the communication with a snap through the -`SnapController`. - -## Extends - -- [`KeyringClient`](KeyringClient.md) - -## Constructors - -### new KeyringSnapControllerClient(args) - -```ts -new KeyringSnapControllerClient(args): KeyringSnapControllerClient -``` - -Create a new instance of `KeyringSnapControllerClient`. - -The `handlerType` argument has a hard-coded default `string` value instead -of a `HandlerType` value to prevent the `@metamask/snaps-utils` module -from being required at runtime. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `args` | \{ `controller`: `SnapController`; `handler`: `HandlerType`; `origin`: `string`; `snapId`: `string`; } | Constructor arguments. | -| `args.controller` | `SnapController` | The `SnapController` instance to use. | -| `args.handler`? | `HandlerType` | The handler type (default: `'onRpcRequest'`). | -| `args.origin`? | `string` | The sender's origin (default: `'metamask'`). | -| `args.snapId`? | `string` | The ID of the snap to use (default: `'undefined'`). | - -#### Overrides - -[`KeyringClient`](KeyringClient.md).[`constructor`](KeyringClient.md#constructors) - -#### Source - -[external/keyring-api/src/keyring-snap-controller-client.ts:84](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-controller-client.ts#L84) - -## Properties - -### #controller - -```ts -private #controller: SnapController; -``` - -#### Source - -[external/keyring-api/src/keyring-snap-controller-client.ts:69](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-controller-client.ts#L69) - -*** - -### #sender - -```ts -private #sender: Sender; -``` - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`#sender`](KeyringClient.md#sender) - -#### Source - -[external/keyring-api/src/keyring-client.ts:33](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L33) - -## Methods - -### #send() - -```ts -private #send(partial): Promise< - | null - | string[] - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - } - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - } - | { - pending: true; - } - | { - pending: false; - result: Json; - } - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }[] - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}[]> -``` - -Send a request to the snap and return the response. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `partial` | \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listAccounts"`; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getAccount"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_createAccount"`; `params`: \{ name: string; options: Record \| null; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_filterAccountChains"`; `params`: \{ id: string; chains: string[]; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_updateAccount"`; `params`: \{ account: \{ id: string; name: string; address: string; options: Record \| null; supportedMethods: ("personal\_sign" \| "eth\_sendTransaction" \| "eth\_sign" \| "eth\_signTransaction" \| "eth\_signTypedData" \| "eth\_signTypedData\_v1" \| "eth\_signTypedData\_v2" \| "eth\_signTypedData\_v3" \| "eth\_signTypedData\_v4")[]; type: "eip155:eoa" \| "eip155:erc4337"; }; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_deleteAccount"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listRequests"`; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_submitRequest"`; `params`: \{ account: string; scope: string; request: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_approveRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_rejectRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> | Partial internal request (method and params). | - -#### Returns - -A promise that resolves to the response to the request. - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`#send`](KeyringClient.md#send) - -#### Source - -[external/keyring-api/src/keyring-client.ts:50](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L50) - -*** - -### approveRequest() - -```ts -approveRequest(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`approveRequest`](KeyringClient.md#approverequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:151](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L151) - -*** - -### createAccount() - -```ts -createAccount(name, options): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}> -``` - -#### Parameters - -| Parameter | Type | Default value | -| :------ | :------ | :------ | -| `name` | `string` | `undefined` | -| `options` | `null` \| `Record`<`string`, `Json`\> | `null` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`createAccount`](KeyringClient.md#createaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:79](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L79) - -*** - -### deleteAccount() - -```ts -deleteAccount(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`deleteAccount`](KeyringClient.md#deleteaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:112](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L112) - -*** - -### filterAccountChains() - -```ts -filterAccountChains(id, chains): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | -| `chains` | `string`[] | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`filterAccountChains`](KeyringClient.md#filteraccountchains) - -#### Source - -[external/keyring-api/src/keyring-client.ts:92](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L92) - -*** - -### getAccount() - -```ts -getAccount(id): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}> -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`getAccount`](KeyringClient.md#getaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:69](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L69) - -*** - -### getRequest() - -```ts -getRequest(id): Promise<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}> -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`getRequest`](KeyringClient.md#getrequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:131](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L131) - -*** - -### listAccounts() - -```ts -listAccounts(): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}[]> -``` - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`listAccounts`](KeyringClient.md#listaccounts) - -#### Source - -[external/keyring-api/src/keyring-client.ts:60](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L60) - -*** - -### listRequests() - -```ts -listRequests(): Promise<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}[]> -``` - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`listRequests`](KeyringClient.md#listrequests) - -#### Source - -[external/keyring-api/src/keyring-client.ts:122](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L122) - -*** - -### rejectRequest() - -```ts -rejectRequest(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`rejectRequest`](KeyringClient.md#rejectrequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:161](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L161) - -*** - -### submitRequest() - -```ts -submitRequest(request): Promise<{ - pending: true; - } | { - pending: false; - result: Json; -}> -``` - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `request` | \{ `account`: `string`; `request`: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; `scope`: `string`; } | - | -| `request.account` | `string` | Account ID (UUIDv4). | -| `request.request` | \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; } | JSON-RPC request sent by the client application.

Note: The request ID must be a string. | -| `request.scope` | `string` | Request's scope (CAIP-2 chain ID). | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`submitRequest`](KeyringClient.md#submitrequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:141](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L141) - -*** - -### updateAccount() - -```ts -updateAccount(account): Promise -``` - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `account` | \{ `address`: `string`; `id`: `string`; `name`: `string`; `options`: `null` \| `Record`<`string`, `Json`\>; `supportedMethods`: ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[]; `type`: `"eip155:eoa"` \| `"eip155:erc4337"`; } | - | -| `account.address` | `string` | Account address or next receive address (UTXO). | -| `account.id` | `string` | Account ID (UUIDv4). | -| `account.name` | `string` | User-chosen account name. | -| `account.options` | `null` \| `Record`<`string`, `Json`\> | Keyring-dependent account options. | -| `account.supportedMethods` | ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[] | Account supported methods. | -| `account.type` | `"eip155:eoa"` \| `"eip155:erc4337"` | Account type. | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`updateAccount`](KeyringClient.md#updateaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:102](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L102) - -*** - -### withSnapId() - -```ts -withSnapId(snapId): KeyringSnapControllerClient -``` - -Create a new instance of `KeyringSnapControllerClient` with the specified -`snapId`. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `snapId` | `string` | The ID of the snap to use in the new instance. | - -#### Returns - -A new instance of `KeyringSnapControllerClient` with the -specified snap ID. - -#### Source - -[external/keyring-api/src/keyring-snap-controller-client.ts:107](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-controller-client.ts#L107) diff --git a/snaps/reference/keyring-api/classes/KeyringSnapRpcClient.md b/snaps/reference/keyring-api/classes/KeyringSnapRpcClient.md deleted file mode 100644 index d9b88200462..00000000000 --- a/snaps/reference/keyring-api/classes/KeyringSnapRpcClient.md +++ /dev/null @@ -1,432 +0,0 @@ -# Class: KeyringSnapRpcClient - -A `KeyringClient` that allows the communication with a snap through the snap -JSON-RPC API. - -## Extends - -- [`KeyringClient`](KeyringClient.md) - -## Constructors - -### new KeyringSnapRpcClient(origin, provider) - -```ts -new KeyringSnapRpcClient(origin, provider): KeyringSnapRpcClient -``` - -Create a new instance of `KeyringSnapRpcClient`. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `origin` | `string` | Caller's origin. | -| `provider` | `MetaMaskInpageProvider` | The `MetaMaskInpageProvider` instance to use. | - -#### Overrides - -[`KeyringClient`](KeyringClient.md).[`constructor`](KeyringClient.md#constructors) - -#### Source - -[external/keyring-api/src/keyring-snap-rpc-client.ts:62](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-rpc-client.ts#L62) - -## Properties - -### #sender - -```ts -private #sender: Sender; -``` - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`#sender`](KeyringClient.md#sender) - -#### Source - -[external/keyring-api/src/keyring-client.ts:33](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L33) - -## Methods - -### #send() - -```ts -private #send(partial): Promise< - | null - | string[] - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - } - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - } - | { - pending: true; - } - | { - pending: false; - result: Json; - } - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }[] - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}[]> -``` - -Send a request to the snap and return the response. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `partial` | \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listAccounts"`; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getAccount"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_createAccount"`; `params`: \{ name: string; options: Record \| null; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_filterAccountChains"`; `params`: \{ id: string; chains: string[]; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_updateAccount"`; `params`: \{ account: \{ id: string; name: string; address: string; options: Record \| null; supportedMethods: ("personal\_sign" \| "eth\_sendTransaction" \| "eth\_sign" \| "eth\_signTransaction" \| "eth\_signTypedData" \| "eth\_signTypedData\_v1" \| "eth\_signTypedData\_v2" \| "eth\_signTypedData\_v3" \| "eth\_signTypedData\_v4")[]; type: "eip155:eoa" \| "eip155:erc4337"; }; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_deleteAccount"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listRequests"`; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_submitRequest"`; `params`: \{ account: string; scope: string; request: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_approveRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> \| `Omit`<\{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_rejectRequest"`; `params`: \{ id: string; }; }, `"id"` \| `"jsonrpc"`\> | Partial internal request (method and params). | - -#### Returns - -A promise that resolves to the response to the request. - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`#send`](KeyringClient.md#send) - -#### Source - -[external/keyring-api/src/keyring-client.ts:50](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L50) - -*** - -### approveRequest() - -```ts -approveRequest(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`approveRequest`](KeyringClient.md#approverequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:151](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L151) - -*** - -### createAccount() - -```ts -createAccount(name, options): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}> -``` - -#### Parameters - -| Parameter | Type | Default value | -| :------ | :------ | :------ | -| `name` | `string` | `undefined` | -| `options` | `null` \| `Record`<`string`, `Json`\> | `null` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`createAccount`](KeyringClient.md#createaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:79](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L79) - -*** - -### deleteAccount() - -```ts -deleteAccount(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`deleteAccount`](KeyringClient.md#deleteaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:112](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L112) - -*** - -### filterAccountChains() - -```ts -filterAccountChains(id, chains): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | -| `chains` | `string`[] | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`filterAccountChains`](KeyringClient.md#filteraccountchains) - -#### Source - -[external/keyring-api/src/keyring-client.ts:92](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L92) - -*** - -### getAccount() - -```ts -getAccount(id): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}> -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`getAccount`](KeyringClient.md#getaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:69](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L69) - -*** - -### getRequest() - -```ts -getRequest(id): Promise<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}> -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`getRequest`](KeyringClient.md#getrequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:131](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L131) - -*** - -### listAccounts() - -```ts -listAccounts(): Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; -}[]> -``` - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`listAccounts`](KeyringClient.md#listaccounts) - -#### Source - -[external/keyring-api/src/keyring-client.ts:60](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L60) - -*** - -### listRequests() - -```ts -listRequests(): Promise<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}[]> -``` - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`listRequests`](KeyringClient.md#listrequests) - -#### Source - -[external/keyring-api/src/keyring-client.ts:122](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L122) - -*** - -### rejectRequest() - -```ts -rejectRequest(id): Promise -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `id` | `string` | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`rejectRequest`](KeyringClient.md#rejectrequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:161](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L161) - -*** - -### submitRequest() - -```ts -submitRequest(request): Promise<{ - pending: true; - } | { - pending: false; - result: Json; -}> -``` - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `request` | \{ `account`: `string`; `request`: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; `scope`: `string`; } | - | -| `request.account` | `string` | Account ID (UUIDv4). | -| `request.request` | \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; } | JSON-RPC request sent by the client application.

Note: The request ID must be a string. | -| `request.scope` | `string` | Request's scope (CAIP-2 chain ID). | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`submitRequest`](KeyringClient.md#submitrequest) - -#### Source - -[external/keyring-api/src/keyring-client.ts:141](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L141) - -*** - -### updateAccount() - -```ts -updateAccount(account): Promise -``` - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `account` | \{ `address`: `string`; `id`: `string`; `name`: `string`; `options`: `null` \| `Record`<`string`, `Json`\>; `supportedMethods`: ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[]; `type`: `"eip155:eoa"` \| `"eip155:erc4337"`; } | - | -| `account.address` | `string` | Account address or next receive address (UTXO). | -| `account.id` | `string` | Account ID (UUIDv4). | -| `account.name` | `string` | User-chosen account name. | -| `account.options` | `null` \| `Record`<`string`, `Json`\> | Keyring-dependent account options. | -| `account.supportedMethods` | ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[] | Account supported methods. | -| `account.type` | `"eip155:eoa"` \| `"eip155:erc4337"` | Account type. | - -#### Inherited from - -[`KeyringClient`](KeyringClient.md).[`updateAccount`](KeyringClient.md#updateaccount) - -#### Source - -[external/keyring-api/src/keyring-client.ts:102](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L102) diff --git a/snaps/reference/keyring-api/classes/MethodNotSupportedError.md b/snaps/reference/keyring-api/classes/MethodNotSupportedError.md deleted file mode 100644 index 8428252a573..00000000000 --- a/snaps/reference/keyring-api/classes/MethodNotSupportedError.md +++ /dev/null @@ -1,149 +0,0 @@ -# Class: MethodNotSupportedError - -Error thrown when a keyring JSON-RPC method is not supported. - -## Extends - -- `Error` - -## Constructors - -### new MethodNotSupportedError(method) - -```ts -new MethodNotSupportedError(method): MethodNotSupportedError -``` - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `method` | `string` | - -#### Overrides - -Error.constructor - -#### Source - -[external/keyring-api/src/keyring-rpc-dispatcher.ts:28](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-rpc-dispatcher.ts#L28) - -## Properties - -### message - -```ts -message: string; -``` - -#### Inherited from - -Error.message - -#### Source - -node\_modules/typescript/lib/lib.es5.d.ts:1054 - -*** - -### name - -```ts -name: string; -``` - -#### Inherited from - -Error.name - -#### Source - -node\_modules/typescript/lib/lib.es5.d.ts:1053 - -*** - -### stack - -```ts -stack?: string; -``` - -#### Inherited from - -Error.stack - -#### Source - -node\_modules/typescript/lib/lib.es5.d.ts:1055 - -*** - -### prepareStackTrace - -```ts -static prepareStackTrace?: (err, stackTraces) => any; -``` - -Optional override for formatting stack traces - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `err` | `Error` | -| `stackTraces` | `CallSite`[] | - -#### Returns - -#### See - -https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -#### Inherited from - -Error.prepareStackTrace - -#### Source - -external/keyring-api/node\_modules/@types/node/globals.d.ts:11 - -*** - -### stackTraceLimit - -```ts -static stackTraceLimit: number; -``` - -#### Inherited from - -Error.stackTraceLimit - -#### Source - -external/keyring-api/node\_modules/@types/node/globals.d.ts:13 - -## Methods - -### captureStackTrace() - -```ts -static captureStackTrace(targetObject, constructorOpt?): void -``` - -Create .stack property on a target object - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `targetObject` | `object` | -| `constructorOpt`? | `Function` | - -#### Inherited from - -Error.captureStackTrace - -#### Source - -external/keyring-api/node\_modules/@types/node/globals.d.ts:4 diff --git a/snaps/reference/keyring-api/classes/SnapRpcSender.md b/snaps/reference/keyring-api/classes/SnapRpcSender.md deleted file mode 100644 index 98cc138b625..00000000000 --- a/snaps/reference/keyring-api/classes/SnapRpcSender.md +++ /dev/null @@ -1,134 +0,0 @@ -# Class: SnapRpcSender - -Implementation of the `Sender` interface that can be used to send requests -to a snap through the snap JSON-RPC API. - -## Implements - -- [`Sender`](../type-aliases/Sender.md) - -## Constructors - -### new SnapRpcSender(origin, provider) - -```ts -new SnapRpcSender(origin, provider): SnapRpcSender -``` - -Create a new instance of `SnapRpcSender`. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `origin` | `string` | The caller's origin. | -| `provider` | `MetaMaskInpageProvider` | The `MetaMaskInpageProvider` instance to use. | - -#### Source - -[external/keyring-api/src/keyring-snap-rpc-client.ts:26](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-rpc-client.ts#L26) - -## Properties - -### #origin - -```ts -private #origin: string; -``` - -#### Source - -[external/keyring-api/src/keyring-snap-rpc-client.ts:16](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-rpc-client.ts#L16) - -*** - -### #provider - -```ts -private #provider: MetaMaskInpageProvider; -``` - -#### Source - -[external/keyring-api/src/keyring-snap-rpc-client.ts:18](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-rpc-client.ts#L18) - -## Methods - -### send() - -```ts -send(request): Promise< - | null - | string[] - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - } - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - } - | { - pending: true; - } - | { - pending: false; - result: Json; - } - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }[] - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; -}[]> -``` - -Send a request to the snap and return the response. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `request` | \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listAccounts"`; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getAccount"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_createAccount"`; `params`: \{ name: string; options: Record \| null; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_filterAccountChains"`; `params`: \{ id: string; chains: string[]; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_updateAccount"`; `params`: \{ account: \{ id: string; name: string; address: string; options: Record \| null; supportedMethods: ("personal\_sign" \| "eth\_sendTransaction" \| "eth\_sign" \| "eth\_signTransaction" \| "eth\_signTypedData" \| "eth\_signTypedData\_v1" \| "eth\_signTypedData\_v2" \| "eth\_signTypedData\_v3" \| "eth\_signTypedData\_v4")[]; type: "eip155:eoa" \| "eip155:erc4337"; }; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_deleteAccount"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listRequests"`; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getRequest"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_submitRequest"`; `params`: \{ account: string; scope: string; request: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_approveRequest"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_rejectRequest"`; `params`: \{ id: string; }; } | The JSON-RPC request to send to the snap. | - -#### Returns - -A promise that resolves to the response of the request. - -#### Implementation of - -Sender.send - -#### Source - -[external/keyring-api/src/keyring-snap-rpc-client.ts:37](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-snap-rpc-client.ts#L37) diff --git a/snaps/reference/keyring-api/exports.md b/snaps/reference/keyring-api/exports.md deleted file mode 100644 index 782e3a62d09..00000000000 --- a/snaps/reference/keyring-api/exports.md +++ /dev/null @@ -1,32 +0,0 @@ -# API - -## Exports - -### Classes - -- [KeyringClient](classes/KeyringClient.md) -- [KeyringSnapControllerClient](classes/KeyringSnapControllerClient.md) -- [KeyringSnapRpcClient](classes/KeyringSnapRpcClient.md) -- [MethodNotSupportedError](classes/MethodNotSupportedError.md) -- [SnapRpcSender](classes/SnapRpcSender.md) - -### Type Aliases - -- [Keyring](type-aliases/Keyring.md) -- [KeyringAccount](type-aliases/KeyringAccount.md) -- [KeyringJsonRpcRequest](type-aliases/KeyringJsonRpcRequest.md) -- [KeyringRequest](type-aliases/KeyringRequest.md) -- [Sender](type-aliases/Sender.md) -- [SubmitRequestResponse](type-aliases/SubmitRequestResponse.md) - -### Variables - -- [KeyringAccountStruct](variables/KeyringAccountStruct.md) -- [KeyringJsonRpcRequestStruct](variables/KeyringJsonRpcRequestStruct.md) -- [KeyringRequestStruct](variables/KeyringRequestStruct.md) -- [SubmitRequestResponseStruct](variables/SubmitRequestResponseStruct.md) - -### Functions - -- [buildHandlersChain](functions/buildHandlersChain.md) -- [handleKeyringRequest](functions/handleKeyringRequest.md) diff --git a/snaps/reference/keyring-api/functions/buildHandlersChain.md b/snaps/reference/keyring-api/functions/buildHandlersChain.md deleted file mode 100644 index 893c98e03d0..00000000000 --- a/snaps/reference/keyring-api/functions/buildHandlersChain.md +++ /dev/null @@ -1,27 +0,0 @@ -# Function: buildHandlersChain() - -```ts -buildHandlersChain(...handlers): OnRpcRequestHandler -``` - -Build a chain of handlers for a JSON-RPC request. - -If a handler throws a MethodNotSupportedError, the next handler in the chain -is called. If all handlers throw a MethodNotSupportedError, the error is re- -thrown. - -Any other error thrown by a handler is re-thrown. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| ...`handlers` | `OnRpcRequestHandler`<`undefined` \| `Record`<`string`, `Json`\> \| `Json`[]\>[] | Handlers to chain. | - -## Returns - -A handler that chains the given handlers. - -## Source - -[external/keyring-api/src/keyring-rpc-dispatcher.ts:45](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-rpc-dispatcher.ts#L45) diff --git a/snaps/reference/keyring-api/functions/handleKeyringRequest.md b/snaps/reference/keyring-api/functions/handleKeyringRequest.md deleted file mode 100644 index ce10fc80eb9..00000000000 --- a/snaps/reference/keyring-api/functions/handleKeyringRequest.md +++ /dev/null @@ -1,22 +0,0 @@ -# Function: handleKeyringRequest() - -```ts -handleKeyringRequest(keyring, request): Promise -``` - -Handles a keyring JSON-RPC request. - -## Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `keyring` | [`Keyring`](../type-aliases/Keyring.md) | Keyring instance. | -| `request` | `JsonRpcRequest`<`undefined` \| `Record`<`string`, `Json`\> \| `Json`[]\> | Keyring JSON-RPC request. | - -## Returns - -A promise that resolves to the keyring response. - -## Source - -[external/keyring-api/src/keyring-rpc-dispatcher.ts:71](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-rpc-dispatcher.ts#L71) diff --git a/snaps/reference/keyring-api/type-aliases/Keyring.md b/snaps/reference/keyring-api/type-aliases/Keyring.md deleted file mode 100644 index cd25ef51d52..00000000000 --- a/snaps/reference/keyring-api/type-aliases/Keyring.md +++ /dev/null @@ -1,273 +0,0 @@ -# Type alias: Keyring - -```ts -type Keyring: { - approveRequest: Promise; - createAccount: Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }>; - deleteAccount: Promise; - filterAccountChains: Promise; - getAccount: Promise; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }>; - getRequest: Promise | Json[]; }; - scope: string; - }>; - listAccounts: Promise<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }[]>; - listRequests: Promise<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - }[]>; - rejectRequest: Promise; - submitRequest: Promise<{ - pending: true; - } | { - pending: false; - result: Json; - }>; - updateAccount: Promise; -}; -``` - -Keyring interface. - -Represents the functionality and operations related to managing accounts and -handling requests. - -## Type declaration - -### approveRequest() - -Approve a request. - -Approves the request with the given ID and sets the response if provided. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the request to approve. | -| `result`? | `Json` | The response to the request (optional). | - -#### Returns - -A promise that resolves when the request is successfully -approved. - -### createAccount() - -Create an account. - -Creates a new account with the given name, supported chains, and optional -account options. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `name` | `string` | The name of the account. | -| `options`? | `null` \| `Record`<`string`, `Json`\> | Keyring-defined options for the account (optional). | - -#### Returns - -A promise that resolves to the newly created KeyringAccount -object without any private information. - -### deleteAccount() - -Delete an account from the keyring. - -Deletes the account with the given ID from the keyring. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the account to delete. | - -#### Returns - -A promise that resolves when the account is successfully deleted. - -### filterAccountChains() - -Filter supported chains for a given account. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | ID of the account to be checked. | -| `chains` | `string`[] | List of chains (CAIP-2) to be checked. | - -#### Returns - -A Promise that resolves to a filtered list of CAIP-2 IDs -representing the supported chains. - -### getAccount() - -Get an account. - -Retrieves the KeyringAccount object for the given account ID. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the account to retrieve. | - -#### Returns - -A promise that resolves to the KeyringAccount object if found, or -undefined otherwise. - -### getRequest() - -Get a request. - -Retrieves the KeyringRequest object for the given request ID. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the request to retrieve. | - -#### Returns - -A promise that resolves to the KeyringRequest object if found, or -undefined otherwise. - -### listAccounts() - -List accounts. - -Retrieves an array of KeyringAccount objects representing the available -accounts. - -#### Returns - -A promise that resolves to an array of KeyringAccount objects. - -### listRequests() - -List all submitted requests. - -Retrieves an array of KeyringRequest objects representing the submitted -requests. - -#### Returns - -A promise that resolves to an array of KeyringRequest objects. - -### rejectRequest() - -Reject a request. - -Rejects the request with the given ID. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the request to reject. | - -#### Returns - -A promise that resolves when the request is successfully -rejected. - -### submitRequest() - -Submit a request. - -Submits the given KeyringRequest object. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `request` | \{ `account`: `string`; `request`: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; `scope`: `string`; } | The KeyringRequest object to submit. | -| `request.account` | `string` | Account ID (UUIDv4). | -| `request.request` | \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; } | JSON-RPC request sent by the client application.

Note: The request ID must be a string. | -| `request.scope` | `string` | Request's scope (CAIP-2 chain ID). | - -#### Returns - -A promise that resolves to the request response. - -### updateAccount() - -Update an account. - -Updates the account with the given account object. Does nothing if the -account does not exist. - -#### Parameters - -| Parameter | Type | Description | -| :------ | :------ | :------ | -| `account` | \{ `address`: `string`; `id`: `string`; `name`: `string`; `options`: `null` \| `Record`<`string`, `Json`\>; `supportedMethods`: ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[]; `type`: `"eip155:eoa"` \| `"eip155:erc4337"`; } | The updated account object. | -| `account.address` | `string` | Account address or next receive address (UTXO). | -| `account.id` | `string` | Account ID (UUIDv4). | -| `account.name` | `string` | User-chosen account name. | -| `account.options` | `null` \| `Record`<`string`, `Json`\> | Keyring-dependent account options. | -| `account.supportedMethods` | ( \| `"personal_sign"` \| `"eth_sendTransaction"` \| `"eth_sign"` \| `"eth_signTransaction"` \| `"eth_signTypedData"` \| `"eth_signTypedData_v1"` \| `"eth_signTypedData_v2"` \| `"eth_signTypedData_v3"` \| `"eth_signTypedData_v4"`)[] | Account supported methods. | -| `account.type` | `"eip155:eoa"` \| `"eip155:erc4337"` | Account type. | - -#### Returns - -A promise that resolves when the account is successfully updated. - -## Source - -[external/keyring-api/src/keyring-api.ts:136](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L136) diff --git a/snaps/reference/keyring-api/type-aliases/KeyringAccount.md b/snaps/reference/keyring-api/type-aliases/KeyringAccount.md deleted file mode 100644 index 6782a47de6b..00000000000 --- a/snaps/reference/keyring-api/type-aliases/KeyringAccount.md +++ /dev/null @@ -1,13 +0,0 @@ -# Type alias: KeyringAccount - -```ts -type KeyringAccount: Infer<*typeof* KeyringAccountStruct>; -``` - -Account object. - -Represents an account with its properties and capabilities. - -## Source - -[external/keyring-api/src/keyring-api.ts:65](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L65) diff --git a/snaps/reference/keyring-api/type-aliases/KeyringJsonRpcRequest.md b/snaps/reference/keyring-api/type-aliases/KeyringJsonRpcRequest.md deleted file mode 100644 index 2a7838d882f..00000000000 --- a/snaps/reference/keyring-api/type-aliases/KeyringJsonRpcRequest.md +++ /dev/null @@ -1,14 +0,0 @@ -# Type alias: KeyringJsonRpcRequest - -```ts -type KeyringJsonRpcRequest: Infer<*typeof* KeyringJsonRpcRequestStruct>; -``` - -JSON-RPC request type. - -Represents a JSON-RPC request sent by a dApp. The request ID must be a -string and the params field cannot be undefined. - -## Source - -[external/keyring-api/src/keyring-api.ts:87](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L87) diff --git a/snaps/reference/keyring-api/type-aliases/KeyringRequest.md b/snaps/reference/keyring-api/type-aliases/KeyringRequest.md deleted file mode 100644 index a1b3799a8a9..00000000000 --- a/snaps/reference/keyring-api/type-aliases/KeyringRequest.md +++ /dev/null @@ -1,13 +0,0 @@ -# Type alias: KeyringRequest - -```ts -type KeyringRequest: Infer<*typeof* KeyringRequestStruct>; -``` - -Keyring request. - -Represents a request made to the keyring for account-related operations. - -## Source - -[external/keyring-api/src/keyring-api.ts:113](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L113) diff --git a/snaps/reference/keyring-api/type-aliases/Sender.md b/snaps/reference/keyring-api/type-aliases/Sender.md deleted file mode 100644 index af71339b200..00000000000 --- a/snaps/reference/keyring-api/type-aliases/Sender.md +++ /dev/null @@ -1,74 +0,0 @@ -# Type alias: Sender - -```ts -type Sender: { - send: Promise< - | null - | string[] - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - } - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - } - | { - pending: true; - } - | { - pending: false; - result: Json; - } - | { - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }[] - | { - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - }[]>; -}; -``` - -## Type declaration - -### send() - -#### Parameters - -| Parameter | Type | -| :------ | :------ | -| `request` | \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listAccounts"`; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getAccount"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_createAccount"`; `params`: \{ name: string; options: Record \| null; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_filterAccountChains"`; `params`: \{ id: string; chains: string[]; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_updateAccount"`; `params`: \{ account: \{ id: string; name: string; address: string; options: Record \| null; supportedMethods: ("personal\_sign" \| "eth\_sendTransaction" \| "eth\_sign" \| "eth\_signTransaction" \| "eth\_signTypedData" \| "eth\_signTypedData\_v1" \| "eth\_signTypedData\_v2" \| "eth\_signTypedData\_v3" \| "eth\_signTypedData\_v4")[]; type: "eip155:eoa" \| "eip155:erc4337"; }; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_deleteAccount"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_listRequests"`; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_getRequest"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_submitRequest"`; `params`: \{ account: string; scope: string; request: \{ id: string; jsonrpc: "2.0"; method: string; } \| \{ id: string; jsonrpc: "2.0"; method: string; params: Record \| Json[]; }; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_approveRequest"`; `params`: \{ id: string; }; } \| \{ `id`: `string`; `jsonrpc`: `"2.0"`; `method`: `"keyring_rejectRequest"`; `params`: \{ id: string; }; } | - -## Source - -[external/keyring-api/src/keyring-client.ts:28](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-client.ts#L28) diff --git a/snaps/reference/keyring-api/type-aliases/SubmitRequestResponse.md b/snaps/reference/keyring-api/type-aliases/SubmitRequestResponse.md deleted file mode 100644 index 6ac1bf7057a..00000000000 --- a/snaps/reference/keyring-api/type-aliases/SubmitRequestResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# Type alias: SubmitRequestResponse - -```ts -type SubmitRequestResponse: Infer<*typeof* SubmitRequestResponseStruct>; -``` - -Response returned when submitting a request to the Keyring. - -## Source - -[external/keyring-api/src/keyring-api.ts:128](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L128) diff --git a/snaps/reference/keyring-api/typedoc-sidebar.cjs b/snaps/reference/keyring-api/typedoc-sidebar.cjs deleted file mode 100644 index 02e5b9bfff8..00000000000 --- a/snaps/reference/keyring-api/typedoc-sidebar.cjs +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-check -/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const typedocSidebar = { items: [{"type":"doc","id":"reference/keyring-api/exports","label":"API"},{"type":"category","label":"Classes","items":[{"type":"doc","id":"reference/keyring-api/classes/KeyringClient","label":"KeyringClient"},{"type":"doc","id":"reference/keyring-api/classes/KeyringSnapControllerClient","label":"KeyringSnapControllerClient"},{"type":"doc","id":"reference/keyring-api/classes/KeyringSnapRpcClient","label":"KeyringSnapRpcClient"},{"type":"doc","id":"reference/keyring-api/classes/MethodNotSupportedError","label":"MethodNotSupportedError"},{"type":"doc","id":"reference/keyring-api/classes/SnapRpcSender","label":"SnapRpcSender"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"reference/keyring-api/type-aliases/Keyring","label":"Keyring"},{"type":"doc","id":"reference/keyring-api/type-aliases/KeyringAccount","label":"KeyringAccount"},{"type":"doc","id":"reference/keyring-api/type-aliases/KeyringJsonRpcRequest","label":"KeyringJsonRpcRequest"},{"type":"doc","id":"reference/keyring-api/type-aliases/KeyringRequest","label":"KeyringRequest"},{"type":"doc","id":"reference/keyring-api/type-aliases/Sender","label":"Sender"},{"type":"doc","id":"reference/keyring-api/type-aliases/SubmitRequestResponse","label":"SubmitRequestResponse"}]},{"type":"category","label":"Variables","items":[{"type":"doc","id":"reference/keyring-api/variables/KeyringAccountStruct","label":"KeyringAccountStruct"},{"type":"doc","id":"reference/keyring-api/variables/KeyringJsonRpcRequestStruct","label":"KeyringJsonRpcRequestStruct"},{"type":"doc","id":"reference/keyring-api/variables/KeyringRequestStruct","label":"KeyringRequestStruct"},{"type":"doc","id":"reference/keyring-api/variables/SubmitRequestResponseStruct","label":"SubmitRequestResponseStruct"}]},{"type":"category","label":"Functions","items":[{"type":"doc","id":"reference/keyring-api/functions/buildHandlersChain","label":"buildHandlersChain"},{"type":"doc","id":"reference/keyring-api/functions/handleKeyringRequest","label":"handleKeyringRequest"}]}]}; -module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/snaps/reference/keyring-api/variables/KeyringAccountStruct.md b/snaps/reference/keyring-api/variables/KeyringAccountStruct.md deleted file mode 100644 index e3281ec6e4d..00000000000 --- a/snaps/reference/keyring-api/variables/KeyringAccountStruct.md +++ /dev/null @@ -1,63 +0,0 @@ -# Variable: KeyringAccountStruct - -```ts -const KeyringAccountStruct: Struct<{ - address: string; - id: string; - name: string; - options: null | Record; - supportedMethods: ( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[]; - type: "eip155:eoa" | "eip155:erc4337"; - }, { - address: Struct; - id: Struct; - name: Struct; - options: Struct, null>; - supportedMethods: Struct<( - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4")[], Struct< - | "personal_sign" - | "eth_sendTransaction" - | "eth_sign" - | "eth_signTransaction" - | "eth_signTypedData" - | "eth_signTypedData_v1" - | "eth_signTypedData_v2" - | "eth_signTypedData_v3" - | "eth_signTypedData_v4", { - eth_sendTransaction: "eth_sendTransaction"; - eth_sign: "eth_sign"; - eth_signTransaction: "eth_signTransaction"; - eth_signTypedData: "eth_signTypedData"; - eth_signTypedData_v1: "eth_signTypedData_v1"; - eth_signTypedData_v2: "eth_signTypedData_v2"; - eth_signTypedData_v3: "eth_signTypedData_v3"; - eth_signTypedData_v4: "eth_signTypedData_v4"; - personal_sign: "personal_sign"; - }>>; - type: Struct<"eip155:eoa" | "eip155:erc4337", { - eip155:eoa: "eip155:eoa"; - eip155:erc4337: "eip155:erc4337"; - }>; - }>; -``` - -## Source - -[external/keyring-api/src/keyring-api.ts:16](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L16) diff --git a/snaps/reference/keyring-api/variables/KeyringJsonRpcRequestStruct.md b/snaps/reference/keyring-api/variables/KeyringJsonRpcRequestStruct.md deleted file mode 100644 index 612d1b63ef6..00000000000 --- a/snaps/reference/keyring-api/variables/KeyringJsonRpcRequestStruct.md +++ /dev/null @@ -1,18 +0,0 @@ -# Variable: KeyringJsonRpcRequestStruct - -```ts -const KeyringJsonRpcRequestStruct: Struct<{ - id: string; - jsonrpc: "2.0"; - method: string; - } | { - id: string; - jsonrpc: "2.0"; - method: string; - params: Record | Json[]; - }, null>; -``` - -## Source - -[external/keyring-api/src/keyring-api.ts:67](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L67) diff --git a/snaps/reference/keyring-api/variables/KeyringRequestStruct.md b/snaps/reference/keyring-api/variables/KeyringRequestStruct.md deleted file mode 100644 index 25fa1b59eb6..00000000000 --- a/snaps/reference/keyring-api/variables/KeyringRequestStruct.md +++ /dev/null @@ -1,26 +0,0 @@ -# Variable: KeyringRequestStruct - -```ts -const KeyringRequestStruct: Struct<{ - account: string; - request: { id: string; jsonrpc: "2.0"; method: string; } | { id: string; jsonrpc: "2.0"; method: string; params: Record | Json[]; }; - scope: string; - }, { - account: Struct; - request: Struct<{ - id: string; - jsonrpc: "2.0"; - method: string; - } | { - id: string; - jsonrpc: "2.0"; - method: string; - params: Record | Json[]; - }, null>; - scope: Struct; - }>; -``` - -## Source - -[external/keyring-api/src/keyring-api.ts:89](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L89) diff --git a/snaps/reference/keyring-api/variables/SubmitRequestResponseStruct.md b/snaps/reference/keyring-api/variables/SubmitRequestResponseStruct.md deleted file mode 100644 index 951fe35dedb..00000000000 --- a/snaps/reference/keyring-api/variables/SubmitRequestResponseStruct.md +++ /dev/null @@ -1,14 +0,0 @@ -# Variable: SubmitRequestResponseStruct - -```ts -const SubmitRequestResponseStruct: Struct<{ - pending: true; - } | { - pending: false; - result: Json; - }, null>; -``` - -## Source - -[external/keyring-api/src/keyring-api.ts:115](https://github.com/MetaMask/keyring-api/blob/1c8eeb9/src/keyring-api.ts#L115)