@metamask/keyring-api 24.0.0 → 24.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -1
- package/dist/api/account-options.cjs +34 -3
- package/dist/api/account-options.cjs.map +1 -1
- package/dist/api/account-options.d.cts +42 -3
- package/dist/api/account-options.d.cts.map +1 -1
- package/dist/api/account-options.d.mts +42 -3
- package/dist/api/account-options.d.mts.map +1 -1
- package/dist/api/account-options.mjs +33 -2
- package/dist/api/account-options.mjs.map +1 -1
- package/dist/api/account.d.cts +4 -0
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +4 -0
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/request.cjs +9 -1
- package/dist/api/request.cjs.map +1 -1
- package/dist/api/request.d.cts +22 -0
- package/dist/api/request.d.cts.map +1 -1
- package/dist/api/request.d.mts +22 -0
- package/dist/api/request.d.mts.map +1 -1
- package/dist/api/request.mjs +9 -1
- package/dist/api/request.mjs.map +1 -1
- package/dist/btc/types.d.cts +16 -0
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +16 -0
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/eth/types.d.cts +8 -0
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +8 -0
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/events.d.cts +16 -0
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +16 -0
- package/dist/events.d.mts.map +1 -1
- package/dist/rpc.d.cts +84 -0
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +84 -0
- package/dist/rpc.d.mts.map +1 -1
- package/dist/sol/types.d.cts +4 -0
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +4 -0
- package/dist/sol/types.d.mts.map +1 -1
- package/dist/trx/types.d.cts +4 -0
- package/dist/trx/types.d.cts.map +1 -1
- package/dist/trx/types.d.mts +4 -0
- package/dist/trx/types.d.mts.map +1 -1
- package/dist/v2/api/create-account/address-import.cjs +39 -0
- package/dist/v2/api/create-account/address-import.cjs.map +1 -0
- package/dist/v2/api/create-account/address-import.d.cts +54 -0
- package/dist/v2/api/create-account/address-import.d.cts.map +1 -0
- package/dist/v2/api/create-account/address-import.d.mts +54 -0
- package/dist/v2/api/create-account/address-import.d.mts.map +1 -0
- package/dist/v2/api/create-account/address-import.mjs +36 -0
- package/dist/v2/api/create-account/address-import.mjs.map +1 -0
- package/dist/v2/api/create-account/index.cjs +8 -0
- package/dist/v2/api/create-account/index.cjs.map +1 -1
- package/dist/v2/api/create-account/index.d.cts +10 -0
- package/dist/v2/api/create-account/index.d.cts.map +1 -1
- package/dist/v2/api/create-account/index.d.mts +10 -0
- package/dist/v2/api/create-account/index.d.mts.map +1 -1
- package/dist/v2/api/create-account/index.mjs +8 -0
- package/dist/v2/api/create-account/index.mjs.map +1 -1
- package/dist/v2/api/keyring-capabilities.cjs +10 -0
- package/dist/v2/api/keyring-capabilities.cjs.map +1 -1
- package/dist/v2/api/keyring-capabilities.d.cts +15 -0
- package/dist/v2/api/keyring-capabilities.d.cts.map +1 -1
- package/dist/v2/api/keyring-capabilities.d.mts +15 -0
- package/dist/v2/api/keyring-capabilities.d.mts.map +1 -1
- package/dist/v2/api/keyring-capabilities.mjs +10 -0
- package/dist/v2/api/keyring-capabilities.mjs.map +1 -1
- package/dist/v2/api/keyring-rpc.d.cts +41 -0
- package/dist/v2/api/keyring-rpc.d.cts.map +1 -1
- package/dist/v2/api/keyring-rpc.d.mts +41 -0
- package/dist/v2/api/keyring-rpc.d.mts.map +1 -1
- package/dist/v2/api/keyring-type.cjs +10 -0
- package/dist/v2/api/keyring-type.cjs.map +1 -1
- package/dist/v2/api/keyring-type.d.cts +11 -1
- package/dist/v2/api/keyring-type.d.cts.map +1 -1
- package/dist/v2/api/keyring-type.d.mts +11 -1
- package/dist/v2/api/keyring-type.d.mts.map +1 -1
- package/dist/v2/api/keyring-type.mjs +10 -0
- package/dist/v2/api/keyring-type.mjs.map +1 -1
- package/dist/xlm/types.d.cts +4 -0
- package/dist/xlm/types.d.cts.map +1 -1
- package/dist/xlm/types.d.mts +4 -0
- package/dist/xlm/types.d.mts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [24.2.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `AccountCreationType.AddressImport` (`address:import`) create account option for importing watch-only accounts by address ([#643](https://github.com/MetaMask/accounts/pull/643))
|
|
15
|
+
- Includes an optional `accountType` field, matching `private-key:import`, since the account type cannot always be detected from the address alone.
|
|
16
|
+
- Includes an optional `scopes` field, since the scope cannot always be detected from the address alone (e.g. an EVM address is valid on every EVM chain). When omitted, the keyring decides the scopes.
|
|
17
|
+
- Add `address` capability to `KeyringCapabilities`, declaring whether a keyring supports importing watch-only accounts by address ([#643](https://github.com/MetaMask/accounts/pull/643))
|
|
18
|
+
- Add `KeyringType.WatchOnly` keyring type ([#644](https://github.com/MetaMask/accounts/pull/644))
|
|
19
|
+
- Add `KeyringType.Mpc` keyring type ([#641](https://github.com/MetaMask/accounts/pull/641))
|
|
20
|
+
- Add `KeyringAccountEntropyTypeOption.Mpc` (`'mpc'`) entropy option, and the related `KeyringAccountEntropyMpcOptions` type, for accounts derived from an MPC key share ([#653](https://github.com/MetaMask/accounts/pull/653))
|
|
21
|
+
|
|
22
|
+
## [24.1.0]
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Add `OriginMetadata` type and `originMetadata` field to `KeyringRequest` ([#615](https://github.com/MetaMask/accounts/pull/615))
|
|
27
|
+
- `KeyringRequest.originMetadata` is an optional nullable field that carries metadata about the request origin.
|
|
28
|
+
|
|
10
29
|
## [24.0.0]
|
|
11
30
|
|
|
12
31
|
### Changed
|
|
@@ -821,7 +840,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
821
840
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
|
822
841
|
- Helper functions to create keyring handler in the snap.
|
|
823
842
|
|
|
824
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.
|
|
843
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.2.0...HEAD
|
|
844
|
+
[24.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.1.0...@metamask/keyring-api@24.2.0
|
|
845
|
+
[24.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@24.0.0...@metamask/keyring-api@24.1.0
|
|
825
846
|
[24.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.7.0...@metamask/keyring-api@24.0.0
|
|
826
847
|
[23.7.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.6.0...@metamask/keyring-api@23.7.0
|
|
827
848
|
[23.6.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.5.0...@metamask/keyring-api@23.6.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KeyringAccountOptionsStruct = exports.KeyringAccountEntropyOptionsStruct = exports.KeyringAccountEntropyCustomOptionsStruct = exports.KeyringAccountEntropyPrivateKeyOptionsStruct = exports.KeyringAccountEntropyMnemonicOptionsStruct = exports.KeyringAccountEntropyTypeOption = void 0;
|
|
3
|
+
exports.KeyringAccountOptionsStruct = exports.KeyringAccountEntropyOptionsStruct = exports.KeyringAccountEntropyMpcOptionsStruct = exports.KeyringAccountEntropyCustomOptionsStruct = exports.KeyringAccountEntropyPrivateKeyOptionsStruct = exports.KeyringAccountEntropyMnemonicOptionsStruct = exports.KeyringAccountEntropyTypeOption = void 0;
|
|
4
4
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
5
5
|
const superstruct_1 = require("@metamask/superstruct");
|
|
6
6
|
const utils_1 = require("@metamask/utils");
|
|
@@ -22,6 +22,12 @@ var KeyringAccountEntropyTypeOption;
|
|
|
22
22
|
* This is an opaque type where the entropy source is managed internally by the keyring.
|
|
23
23
|
*/
|
|
24
24
|
KeyringAccountEntropyTypeOption["Custom"] = "custom";
|
|
25
|
+
/**
|
|
26
|
+
* Indicates that the account was created from an MPC (multi-party
|
|
27
|
+
* computation) key share. This is an opaque type where the entropy source
|
|
28
|
+
* is managed internally by the keyring.
|
|
29
|
+
*/
|
|
30
|
+
KeyringAccountEntropyTypeOption["Mpc"] = "mpc";
|
|
25
31
|
})(KeyringAccountEntropyTypeOption || (exports.KeyringAccountEntropyTypeOption = KeyringAccountEntropyTypeOption = {}));
|
|
26
32
|
/**
|
|
27
33
|
* Keyring account options struct for mnemonics (BIP-44).
|
|
@@ -69,6 +75,19 @@ exports.KeyringAccountEntropyCustomOptionsStruct = (0, superstruct_1.object)({
|
|
|
69
75
|
*/
|
|
70
76
|
type: (0, superstruct_1.literal)(`${KeyringAccountEntropyTypeOption.Custom}`),
|
|
71
77
|
});
|
|
78
|
+
/**
|
|
79
|
+
* Keyring account options struct for MPC (multi-party computation) entropy.
|
|
80
|
+
*
|
|
81
|
+
* This is an opaque type where the entropy source is managed internally by the
|
|
82
|
+
* keyring. The account is derived from an MPC key share, and no additional
|
|
83
|
+
* entropy metadata is exposed.
|
|
84
|
+
*/
|
|
85
|
+
exports.KeyringAccountEntropyMpcOptionsStruct = (0, superstruct_1.object)({
|
|
86
|
+
/**
|
|
87
|
+
* Indicates that the account was created from an MPC key share.
|
|
88
|
+
*/
|
|
89
|
+
type: (0, superstruct_1.literal)(`${KeyringAccountEntropyTypeOption.Mpc}`),
|
|
90
|
+
});
|
|
72
91
|
/**
|
|
73
92
|
* Keyring account entropy options struct.
|
|
74
93
|
*/
|
|
@@ -81,6 +100,8 @@ exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)
|
|
|
81
100
|
return exports.KeyringAccountEntropyPrivateKeyOptionsStruct;
|
|
82
101
|
case KeyringAccountEntropyTypeOption.Custom:
|
|
83
102
|
return exports.KeyringAccountEntropyCustomOptionsStruct;
|
|
103
|
+
case KeyringAccountEntropyTypeOption.Mpc:
|
|
104
|
+
return exports.KeyringAccountEntropyMpcOptionsStruct;
|
|
84
105
|
case KeyringAccountEntropyTypeOption.Mnemonic:
|
|
85
106
|
return exports.KeyringAccountEntropyMnemonicOptionsStruct;
|
|
86
107
|
default:
|
|
@@ -91,8 +112,9 @@ exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)
|
|
|
91
112
|
* Keyring options struct. This represents various options for a Keyring account object.
|
|
92
113
|
*
|
|
93
114
|
* See {@link KeyringAccountEntropyMnemonicOptionsStruct},
|
|
94
|
-
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
95
|
-
* {@link KeyringAccountEntropyCustomOptionsStruct}
|
|
115
|
+
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
116
|
+
* {@link KeyringAccountEntropyCustomOptionsStruct}, and
|
|
117
|
+
* {@link KeyringAccountEntropyMpcOptionsStruct}.
|
|
96
118
|
*
|
|
97
119
|
* @example
|
|
98
120
|
* ```ts
|
|
@@ -128,6 +150,15 @@ exports.KeyringAccountEntropyOptionsStruct = (0, keyring_utils_1.selectiveUnion)
|
|
|
128
150
|
* @example
|
|
129
151
|
* ```ts
|
|
130
152
|
* {
|
|
153
|
+
* entropy: {
|
|
154
|
+
* type: 'mpc',
|
|
155
|
+
* },
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* {
|
|
131
162
|
* some: {
|
|
132
163
|
* untyped: 'options',
|
|
133
164
|
* something: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-options.cjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAEzD,uDAU+B;AAC/B,2CAA4D;AAE5D;;GAEG;AACH,IAAY,+
|
|
1
|
+
{"version":3,"file":"account-options.cjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAEzD,uDAU+B;AAC/B,2CAA4D;AAE5D;;GAEG;AACH,IAAY,+BAuBX;AAvBD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;IAE1B;;;OAGG;IACH,oDAAiB,CAAA;IAEjB;;;;OAIG;IACH,8CAAW,CAAA;AACb,CAAC,EAvBW,+BAA+B,+CAA/B,+BAA+B,QAuB1C;AAED;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,QAAQ,EAAE,CAAC;IAE5D;;OAEG;IACH,EAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,4CAA4C;IAE1D;;OAEG;IACH,cAAc,EAAE,IAAA,oBAAM,GAAE;IAExB;;;;;OAKG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,4CAA4C,GAAG,IAAA,oBAAM,EAAC;IACjE;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,UAAU,EAAE,CAAC;CAC/D,CAAC,CAAC;AASH;;;;;;GAMG;AACU,QAAA,wCAAwC,GAAG,IAAA,oBAAM,EAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,MAAM,EAAE,CAAC;CAC3D,CAAC,CAAC;AASH;;;;;;GAMG;AACU,QAAA,qCAAqC,GAAG,IAAA,oBAAM,EAAC;IAC1D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,+BAA+B,CAAC,GAAG,EAAE,CAAC;CACxD,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,kCAAkC,GAAG,IAAA,8BAAc,EAC9D,CAAC,KAAU,EAAE,EAAE;IACb,IAAI,CAAC,IAAA,qBAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,kDAA0C,CAAC;IACpD,CAAC;IAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,+BAA+B,CAAC,UAAU;YAC7C,OAAO,oDAA4C,CAAC;QACtD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,gDAAwC,CAAC;QAClD,KAAK,+BAA+B,CAAC,GAAG;YACtC,OAAO,6CAAqC,CAAC;QAC/C,KAAK,+BAA+B,CAAC,QAAQ;YAC3C,OAAO,kDAA0C,CAAC;QACpD;YACE,OAAO,kDAA0C,CAAC;IACtD,CAAC;AACH,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACU,QAAA,2BAA2B,GAAG,IAAA,0BAAY,EAAC;IACtD,2CAA2C;IAC3C,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IAE5B,kEAAkE;IAClE,oEAAoE;IACpE,oEAAoE;IACpE,EAAE;IACF,uBAAuB;IACvB,uEAAuE;IACvE,oCAAoC;IACpC,IAAA,kBAAI,EAAC;QACH;;WAEG;QACH,OAAO,EAAE,IAAA,2BAAa,EAAC,0CAAkC,CAAC;QAE1D;;WAEG;QACH,UAAU,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KACrC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n exactOptional,\n intersection,\n literal,\n number,\n object,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport { isPlainObject, JsonStruct } from '@metamask/utils';\n\n/**\n * Keyring account entropy valid types.\n */\nexport enum KeyringAccountEntropyTypeOption {\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n Mnemonic = 'mnemonic',\n\n /**\n * Indicates that the account was imported from a private key.\n */\n PrivateKey = 'private-key',\n\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n * This is an opaque type where the entropy source is managed internally by the keyring.\n */\n Custom = 'custom',\n\n /**\n * Indicates that the account was created from an MPC (multi-party\n * computation) key share. This is an opaque type where the entropy source\n * is managed internally by the keyring.\n */\n Mpc = 'mpc',\n}\n\n/**\n * Keyring account options struct for mnemonics (BIP-44).\n */\nexport const KeyringAccountEntropyMnemonicOptionsStruct = object({\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mnemonic}`),\n\n /**\n * The ID of the entropy source.\n */\n id: string(), // TODO: Define a struct for entropy source.\n\n /**\n * The BIP-44 derivation path used to derive the account.\n */\n derivationPath: string(),\n\n /**\n * Index used to group accounts in the UI.\n *\n * Accounts sharing the same `groupIndex` are displayed together as a\n * multichain account group.\n */\n groupIndex: number(),\n});\n\n/**\n * Keyring account options for mnemonics (BIP-44) {@link KeyringAccountEntropyMnemonicOptionsStruct}.\n */\nexport type KeyringAccountEntropyMnemonicOptions = Infer<\n typeof KeyringAccountEntropyMnemonicOptionsStruct\n>;\n\n/**\n * Keyring account options struct for private keys.\n */\nexport const KeyringAccountEntropyPrivateKeyOptionsStruct = object({\n /**\n * Indicates that the account was imported from a private key.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.PrivateKey}`),\n});\n\n/**\n * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\n */\nexport type KeyringAccountEntropyPrivateKeyOptions = Infer<\n typeof KeyringAccountEntropyPrivateKeyOptionsStruct\n>;\n\n/**\n * Keyring account options struct for custom entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the keyring.\n * It behaves similarly to a private key import but allows keyrings to define their own\n * entropy management strategy.\n */\nexport const KeyringAccountEntropyCustomOptionsStruct = object({\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),\n});\n\n/**\n * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.\n */\nexport type KeyringAccountEntropyCustomOptions = Infer<\n typeof KeyringAccountEntropyCustomOptionsStruct\n>;\n\n/**\n * Keyring account options struct for MPC (multi-party computation) entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the\n * keyring. The account is derived from an MPC key share, and no additional\n * entropy metadata is exposed.\n */\nexport const KeyringAccountEntropyMpcOptionsStruct = object({\n /**\n * Indicates that the account was created from an MPC key share.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mpc}`),\n});\n\n/**\n * Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.\n */\nexport type KeyringAccountEntropyMpcOptions = Infer<\n typeof KeyringAccountEntropyMpcOptionsStruct\n>;\n\n/**\n * Keyring account entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n if (!isPlainObject(value)) {\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n\n switch (value.type) {\n case KeyringAccountEntropyTypeOption.PrivateKey:\n return KeyringAccountEntropyPrivateKeyOptionsStruct;\n case KeyringAccountEntropyTypeOption.Custom:\n return KeyringAccountEntropyCustomOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mpc:\n return KeyringAccountEntropyMpcOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mnemonic:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n default:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n },\n);\n\n/**\n * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.\n */\nexport type KeyringAccountEntropyOptions = Infer<\n typeof KeyringAccountEntropyOptionsStruct\n>;\n\n/**\n * Keyring options struct. This represents various options for a Keyring account object.\n *\n * See {@link KeyringAccountEntropyMnemonicOptionsStruct},\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},\n * {@link KeyringAccountEntropyCustomOptionsStruct}, and\n * {@link KeyringAccountEntropyMpcOptionsStruct}.\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mnemonic',\n * id: '01K0BX6VDR5DPDPGGNA8PZVBVB',\n * derivationPath: \"m/44'/60'/0'/0/0\",\n * groupIndex: 0,\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'private-key',\n * },\n * exportable: true,\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'custom',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mpc',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * some: {\n * untyped: 'options',\n * something: true,\n * },\n * }\n * ```\n */\nexport const KeyringAccountOptionsStruct = intersection([\n // Non-Typed options (retro-compatibility):\n record(string(), JsonStruct),\n\n // Typed options. We use `type` instead of `object` here, to allow\n // extra properties. Also, since we use `record` + `intersection` we\n // are guaranteed that all field values will match the `JsonStruct`.\n //\n // READ THIS CAREFULLY:\n // Previous options that can be matched by this struct will be breaking\n // existing keyring account options.\n type({\n /**\n * Entropy options.\n */\n entropy: exactOptional(KeyringAccountEntropyOptionsStruct),\n\n /**\n * Indicates whether the account can be exported.\n */\n exportable: exactOptional(boolean()),\n }),\n]);\n\n/**\n * Keyring account options {@link KeyringAccountOptionsStruct}.\n */\nexport type KeyringAccountOptions = Infer<typeof KeyringAccountOptionsStruct>;\n"]}
|
|
@@ -15,7 +15,13 @@ export declare enum KeyringAccountEntropyTypeOption {
|
|
|
15
15
|
* Indicates that the account was created with custom, keyring-specific entropy.
|
|
16
16
|
* This is an opaque type where the entropy source is managed internally by the keyring.
|
|
17
17
|
*/
|
|
18
|
-
Custom = "custom"
|
|
18
|
+
Custom = "custom",
|
|
19
|
+
/**
|
|
20
|
+
* Indicates that the account was created from an MPC (multi-party
|
|
21
|
+
* computation) key share. This is an opaque type where the entropy source
|
|
22
|
+
* is managed internally by the keyring.
|
|
23
|
+
*/
|
|
24
|
+
Mpc = "mpc"
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Keyring account options struct for mnemonics (BIP-44).
|
|
@@ -84,6 +90,25 @@ export declare const KeyringAccountEntropyCustomOptionsStruct: import("@metamask
|
|
|
84
90
|
* Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.
|
|
85
91
|
*/
|
|
86
92
|
export type KeyringAccountEntropyCustomOptions = Infer<typeof KeyringAccountEntropyCustomOptionsStruct>;
|
|
93
|
+
/**
|
|
94
|
+
* Keyring account options struct for MPC (multi-party computation) entropy.
|
|
95
|
+
*
|
|
96
|
+
* This is an opaque type where the entropy source is managed internally by the
|
|
97
|
+
* keyring. The account is derived from an MPC key share, and no additional
|
|
98
|
+
* entropy metadata is exposed.
|
|
99
|
+
*/
|
|
100
|
+
export declare const KeyringAccountEntropyMpcOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
101
|
+
type: "mpc";
|
|
102
|
+
}, {
|
|
103
|
+
/**
|
|
104
|
+
* Indicates that the account was created from an MPC key share.
|
|
105
|
+
*/
|
|
106
|
+
type: import("@metamask/superstruct").Struct<"mpc", "mpc">;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.
|
|
110
|
+
*/
|
|
111
|
+
export type KeyringAccountEntropyMpcOptions = Infer<typeof KeyringAccountEntropyMpcOptionsStruct>;
|
|
87
112
|
/**
|
|
88
113
|
* Keyring account entropy options struct.
|
|
89
114
|
*/
|
|
@@ -96,6 +121,8 @@ export declare const KeyringAccountEntropyOptionsStruct: import("@metamask/super
|
|
|
96
121
|
type: "private-key";
|
|
97
122
|
} | {
|
|
98
123
|
type: "custom";
|
|
124
|
+
} | {
|
|
125
|
+
type: "mpc";
|
|
99
126
|
}, null>;
|
|
100
127
|
/**
|
|
101
128
|
* Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.
|
|
@@ -105,8 +132,9 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
|
|
|
105
132
|
* Keyring options struct. This represents various options for a Keyring account object.
|
|
106
133
|
*
|
|
107
134
|
* See {@link KeyringAccountEntropyMnemonicOptionsStruct},
|
|
108
|
-
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
109
|
-
* {@link KeyringAccountEntropyCustomOptionsStruct}
|
|
135
|
+
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
136
|
+
* {@link KeyringAccountEntropyCustomOptionsStruct}, and
|
|
137
|
+
* {@link KeyringAccountEntropyMpcOptionsStruct}.
|
|
110
138
|
*
|
|
111
139
|
* @example
|
|
112
140
|
* ```ts
|
|
@@ -142,6 +170,15 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
|
|
|
142
170
|
* @example
|
|
143
171
|
* ```ts
|
|
144
172
|
* {
|
|
173
|
+
* entropy: {
|
|
174
|
+
* type: 'mpc',
|
|
175
|
+
* },
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* {
|
|
145
182
|
* some: {
|
|
146
183
|
* untyped: 'options',
|
|
147
184
|
* something: true,
|
|
@@ -159,6 +196,8 @@ export declare const KeyringAccountOptionsStruct: import("@metamask/superstruct"
|
|
|
159
196
|
type: "private-key";
|
|
160
197
|
} | {
|
|
161
198
|
type: "custom";
|
|
199
|
+
} | {
|
|
200
|
+
type: "mpc";
|
|
162
201
|
};
|
|
163
202
|
exportable?: boolean;
|
|
164
203
|
}, null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-options.d.cts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"account-options.d.cts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,MAAM,WAAW;IAEjB;;;;OAIG;IACH,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;IACrD;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4CAA4C;;;IACvD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,KAAK,CACxD,OAAO,4CAA4C,CACpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC;;;IACnD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,KAAK,CACpD,OAAO,wCAAwC,CAChD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC;;;IAChD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;QAmB9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;QAsBtC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -15,7 +15,13 @@ export declare enum KeyringAccountEntropyTypeOption {
|
|
|
15
15
|
* Indicates that the account was created with custom, keyring-specific entropy.
|
|
16
16
|
* This is an opaque type where the entropy source is managed internally by the keyring.
|
|
17
17
|
*/
|
|
18
|
-
Custom = "custom"
|
|
18
|
+
Custom = "custom",
|
|
19
|
+
/**
|
|
20
|
+
* Indicates that the account was created from an MPC (multi-party
|
|
21
|
+
* computation) key share. This is an opaque type where the entropy source
|
|
22
|
+
* is managed internally by the keyring.
|
|
23
|
+
*/
|
|
24
|
+
Mpc = "mpc"
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Keyring account options struct for mnemonics (BIP-44).
|
|
@@ -84,6 +90,25 @@ export declare const KeyringAccountEntropyCustomOptionsStruct: import("@metamask
|
|
|
84
90
|
* Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.
|
|
85
91
|
*/
|
|
86
92
|
export type KeyringAccountEntropyCustomOptions = Infer<typeof KeyringAccountEntropyCustomOptionsStruct>;
|
|
93
|
+
/**
|
|
94
|
+
* Keyring account options struct for MPC (multi-party computation) entropy.
|
|
95
|
+
*
|
|
96
|
+
* This is an opaque type where the entropy source is managed internally by the
|
|
97
|
+
* keyring. The account is derived from an MPC key share, and no additional
|
|
98
|
+
* entropy metadata is exposed.
|
|
99
|
+
*/
|
|
100
|
+
export declare const KeyringAccountEntropyMpcOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
101
|
+
type: "mpc";
|
|
102
|
+
}, {
|
|
103
|
+
/**
|
|
104
|
+
* Indicates that the account was created from an MPC key share.
|
|
105
|
+
*/
|
|
106
|
+
type: import("@metamask/superstruct").Struct<"mpc", "mpc">;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.
|
|
110
|
+
*/
|
|
111
|
+
export type KeyringAccountEntropyMpcOptions = Infer<typeof KeyringAccountEntropyMpcOptionsStruct>;
|
|
87
112
|
/**
|
|
88
113
|
* Keyring account entropy options struct.
|
|
89
114
|
*/
|
|
@@ -96,6 +121,8 @@ export declare const KeyringAccountEntropyOptionsStruct: import("@metamask/super
|
|
|
96
121
|
type: "private-key";
|
|
97
122
|
} | {
|
|
98
123
|
type: "custom";
|
|
124
|
+
} | {
|
|
125
|
+
type: "mpc";
|
|
99
126
|
}, null>;
|
|
100
127
|
/**
|
|
101
128
|
* Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.
|
|
@@ -105,8 +132,9 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
|
|
|
105
132
|
* Keyring options struct. This represents various options for a Keyring account object.
|
|
106
133
|
*
|
|
107
134
|
* See {@link KeyringAccountEntropyMnemonicOptionsStruct},
|
|
108
|
-
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
109
|
-
* {@link KeyringAccountEntropyCustomOptionsStruct}
|
|
135
|
+
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
136
|
+
* {@link KeyringAccountEntropyCustomOptionsStruct}, and
|
|
137
|
+
* {@link KeyringAccountEntropyMpcOptionsStruct}.
|
|
110
138
|
*
|
|
111
139
|
* @example
|
|
112
140
|
* ```ts
|
|
@@ -142,6 +170,15 @@ export type KeyringAccountEntropyOptions = Infer<typeof KeyringAccountEntropyOpt
|
|
|
142
170
|
* @example
|
|
143
171
|
* ```ts
|
|
144
172
|
* {
|
|
173
|
+
* entropy: {
|
|
174
|
+
* type: 'mpc',
|
|
175
|
+
* },
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* {
|
|
145
182
|
* some: {
|
|
146
183
|
* untyped: 'options',
|
|
147
184
|
* something: true,
|
|
@@ -159,6 +196,8 @@ export declare const KeyringAccountOptionsStruct: import("@metamask/superstruct"
|
|
|
159
196
|
type: "private-key";
|
|
160
197
|
} | {
|
|
161
198
|
type: "custom";
|
|
199
|
+
} | {
|
|
200
|
+
type: "mpc";
|
|
162
201
|
};
|
|
163
202
|
exportable?: boolean;
|
|
164
203
|
}, null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-options.d.mts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"account-options.d.mts","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,+BAA+B;IACzC;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,MAAM,WAAW;IAEjB;;;;OAIG;IACH,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;IACrD;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4CAA4C;;;IACvD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,KAAK,CACxD,OAAO,4CAA4C,CACpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wCAAwC;;;IACnD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,KAAK,CACpD,OAAO,wCAAwC,CAChD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC;;;IAChD;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;QAmB9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;QAsBtC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -19,6 +19,12 @@ export var KeyringAccountEntropyTypeOption;
|
|
|
19
19
|
* This is an opaque type where the entropy source is managed internally by the keyring.
|
|
20
20
|
*/
|
|
21
21
|
KeyringAccountEntropyTypeOption["Custom"] = "custom";
|
|
22
|
+
/**
|
|
23
|
+
* Indicates that the account was created from an MPC (multi-party
|
|
24
|
+
* computation) key share. This is an opaque type where the entropy source
|
|
25
|
+
* is managed internally by the keyring.
|
|
26
|
+
*/
|
|
27
|
+
KeyringAccountEntropyTypeOption["Mpc"] = "mpc";
|
|
22
28
|
})(KeyringAccountEntropyTypeOption || (KeyringAccountEntropyTypeOption = {}));
|
|
23
29
|
/**
|
|
24
30
|
* Keyring account options struct for mnemonics (BIP-44).
|
|
@@ -66,6 +72,19 @@ export const KeyringAccountEntropyCustomOptionsStruct = object({
|
|
|
66
72
|
*/
|
|
67
73
|
type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),
|
|
68
74
|
});
|
|
75
|
+
/**
|
|
76
|
+
* Keyring account options struct for MPC (multi-party computation) entropy.
|
|
77
|
+
*
|
|
78
|
+
* This is an opaque type where the entropy source is managed internally by the
|
|
79
|
+
* keyring. The account is derived from an MPC key share, and no additional
|
|
80
|
+
* entropy metadata is exposed.
|
|
81
|
+
*/
|
|
82
|
+
export const KeyringAccountEntropyMpcOptionsStruct = object({
|
|
83
|
+
/**
|
|
84
|
+
* Indicates that the account was created from an MPC key share.
|
|
85
|
+
*/
|
|
86
|
+
type: literal(`${KeyringAccountEntropyTypeOption.Mpc}`),
|
|
87
|
+
});
|
|
69
88
|
/**
|
|
70
89
|
* Keyring account entropy options struct.
|
|
71
90
|
*/
|
|
@@ -78,6 +97,8 @@ export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
|
|
|
78
97
|
return KeyringAccountEntropyPrivateKeyOptionsStruct;
|
|
79
98
|
case KeyringAccountEntropyTypeOption.Custom:
|
|
80
99
|
return KeyringAccountEntropyCustomOptionsStruct;
|
|
100
|
+
case KeyringAccountEntropyTypeOption.Mpc:
|
|
101
|
+
return KeyringAccountEntropyMpcOptionsStruct;
|
|
81
102
|
case KeyringAccountEntropyTypeOption.Mnemonic:
|
|
82
103
|
return KeyringAccountEntropyMnemonicOptionsStruct;
|
|
83
104
|
default:
|
|
@@ -88,8 +109,9 @@ export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
|
|
|
88
109
|
* Keyring options struct. This represents various options for a Keyring account object.
|
|
89
110
|
*
|
|
90
111
|
* See {@link KeyringAccountEntropyMnemonicOptionsStruct},
|
|
91
|
-
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
92
|
-
* {@link KeyringAccountEntropyCustomOptionsStruct}
|
|
112
|
+
* {@link KeyringAccountEntropyPrivateKeyOptionsStruct},
|
|
113
|
+
* {@link KeyringAccountEntropyCustomOptionsStruct}, and
|
|
114
|
+
* {@link KeyringAccountEntropyMpcOptionsStruct}.
|
|
93
115
|
*
|
|
94
116
|
* @example
|
|
95
117
|
* ```ts
|
|
@@ -125,6 +147,15 @@ export const KeyringAccountEntropyOptionsStruct = selectiveUnion((value) => {
|
|
|
125
147
|
* @example
|
|
126
148
|
* ```ts
|
|
127
149
|
* {
|
|
150
|
+
* entropy: {
|
|
151
|
+
* type: 'mpc',
|
|
152
|
+
* },
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* {
|
|
128
159
|
* some: {
|
|
129
160
|
* untyped: 'options',
|
|
130
161
|
* something: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-options.mjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gCAAgC;AAEzD,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACL,8BAA8B;AAC/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,wBAAwB;AAE5D;;GAEG;AACH,MAAM,CAAN,IAAY,+
|
|
1
|
+
{"version":3,"file":"account-options.mjs","sourceRoot":"","sources":["../../src/api/account-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gCAAgC;AAEzD,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,IAAI,EACL,8BAA8B;AAC/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,wBAAwB;AAE5D;;GAEG;AACH,MAAM,CAAN,IAAY,+BAuBX;AAvBD,WAAY,+BAA+B;IACzC;;OAEG;IACH,wDAAqB,CAAA;IAErB;;OAEG;IACH,6DAA0B,CAAA;IAE1B;;;OAGG;IACH,oDAAiB,CAAA;IAEjB;;;;OAIG;IACH,8CAAW,CAAA;AACb,CAAC,EAvBW,+BAA+B,KAA/B,+BAA+B,QAuB1C;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,MAAM,CAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,QAAQ,EAAE,CAAC;IAE5D;;OAEG;IACH,EAAE,EAAE,MAAM,EAAE,EAAE,4CAA4C;IAE1D;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE;IAExB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,EAAE;CACrB,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,MAAM,CAAC;IACjE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,UAAU,EAAE,CAAC;CAC/D,CAAC,CAAC;AASH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,MAAM,CAAC;IAC7D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,MAAM,EAAE,CAAC;CAC3D,CAAC,CAAC;AASH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,MAAM,CAAC;IAC1D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,+BAA+B,CAAC,GAAG,EAAE,CAAC;CACxD,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,cAAc,CAC9D,CAAC,KAAU,EAAE,EAAE;IACb,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,0CAA0C,CAAC;IACpD,CAAC;IAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,+BAA+B,CAAC,UAAU;YAC7C,OAAO,4CAA4C,CAAC;QACtD,KAAK,+BAA+B,CAAC,MAAM;YACzC,OAAO,wCAAwC,CAAC;QAClD,KAAK,+BAA+B,CAAC,GAAG;YACtC,OAAO,qCAAqC,CAAC;QAC/C,KAAK,+BAA+B,CAAC,QAAQ;YAC3C,OAAO,0CAA0C,CAAC;QACpD;YACE,OAAO,0CAA0C,CAAC;IACtD,CAAC;AACH,CAAC,CACF,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,YAAY,CAAC;IACtD,2CAA2C;IAC3C,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IAE5B,kEAAkE;IAClE,oEAAoE;IACpE,oEAAoE;IACpE,EAAE;IACF,uBAAuB;IACvB,uEAAuE;IACvE,oCAAoC;IACpC,IAAI,CAAC;QACH;;WAEG;QACH,OAAO,EAAE,aAAa,CAAC,kCAAkC,CAAC;QAE1D;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACrC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n boolean,\n exactOptional,\n intersection,\n literal,\n number,\n object,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport { isPlainObject, JsonStruct } from '@metamask/utils';\n\n/**\n * Keyring account entropy valid types.\n */\nexport enum KeyringAccountEntropyTypeOption {\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n Mnemonic = 'mnemonic',\n\n /**\n * Indicates that the account was imported from a private key.\n */\n PrivateKey = 'private-key',\n\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n * This is an opaque type where the entropy source is managed internally by the keyring.\n */\n Custom = 'custom',\n\n /**\n * Indicates that the account was created from an MPC (multi-party\n * computation) key share. This is an opaque type where the entropy source\n * is managed internally by the keyring.\n */\n Mpc = 'mpc',\n}\n\n/**\n * Keyring account options struct for mnemonics (BIP-44).\n */\nexport const KeyringAccountEntropyMnemonicOptionsStruct = object({\n /**\n * Indicates that the account was created from a mnemonic phrase.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mnemonic}`),\n\n /**\n * The ID of the entropy source.\n */\n id: string(), // TODO: Define a struct for entropy source.\n\n /**\n * The BIP-44 derivation path used to derive the account.\n */\n derivationPath: string(),\n\n /**\n * Index used to group accounts in the UI.\n *\n * Accounts sharing the same `groupIndex` are displayed together as a\n * multichain account group.\n */\n groupIndex: number(),\n});\n\n/**\n * Keyring account options for mnemonics (BIP-44) {@link KeyringAccountEntropyMnemonicOptionsStruct}.\n */\nexport type KeyringAccountEntropyMnemonicOptions = Infer<\n typeof KeyringAccountEntropyMnemonicOptionsStruct\n>;\n\n/**\n * Keyring account options struct for private keys.\n */\nexport const KeyringAccountEntropyPrivateKeyOptionsStruct = object({\n /**\n * Indicates that the account was imported from a private key.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.PrivateKey}`),\n});\n\n/**\n * Keyring account options for private keys {@link KeyringAccountEntropyPrivateKeyOptionsStruct}.\n */\nexport type KeyringAccountEntropyPrivateKeyOptions = Infer<\n typeof KeyringAccountEntropyPrivateKeyOptionsStruct\n>;\n\n/**\n * Keyring account options struct for custom entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the keyring.\n * It behaves similarly to a private key import but allows keyrings to define their own\n * entropy management strategy.\n */\nexport const KeyringAccountEntropyCustomOptionsStruct = object({\n /**\n * Indicates that the account was created with custom, keyring-specific entropy.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Custom}`),\n});\n\n/**\n * Keyring account options for custom entropy {@link KeyringAccountEntropyCustomOptionsStruct}.\n */\nexport type KeyringAccountEntropyCustomOptions = Infer<\n typeof KeyringAccountEntropyCustomOptionsStruct\n>;\n\n/**\n * Keyring account options struct for MPC (multi-party computation) entropy.\n *\n * This is an opaque type where the entropy source is managed internally by the\n * keyring. The account is derived from an MPC key share, and no additional\n * entropy metadata is exposed.\n */\nexport const KeyringAccountEntropyMpcOptionsStruct = object({\n /**\n * Indicates that the account was created from an MPC key share.\n */\n type: literal(`${KeyringAccountEntropyTypeOption.Mpc}`),\n});\n\n/**\n * Keyring account options for MPC entropy {@link KeyringAccountEntropyMpcOptionsStruct}.\n */\nexport type KeyringAccountEntropyMpcOptions = Infer<\n typeof KeyringAccountEntropyMpcOptionsStruct\n>;\n\n/**\n * Keyring account entropy options struct.\n */\nexport const KeyringAccountEntropyOptionsStruct = selectiveUnion(\n (value: any) => {\n if (!isPlainObject(value)) {\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n\n switch (value.type) {\n case KeyringAccountEntropyTypeOption.PrivateKey:\n return KeyringAccountEntropyPrivateKeyOptionsStruct;\n case KeyringAccountEntropyTypeOption.Custom:\n return KeyringAccountEntropyCustomOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mpc:\n return KeyringAccountEntropyMpcOptionsStruct;\n case KeyringAccountEntropyTypeOption.Mnemonic:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n default:\n return KeyringAccountEntropyMnemonicOptionsStruct;\n }\n },\n);\n\n/**\n * Keyring account entropy options {@link KeyringAccountEntropyOptionsStruct}.\n */\nexport type KeyringAccountEntropyOptions = Infer<\n typeof KeyringAccountEntropyOptionsStruct\n>;\n\n/**\n * Keyring options struct. This represents various options for a Keyring account object.\n *\n * See {@link KeyringAccountEntropyMnemonicOptionsStruct},\n * {@link KeyringAccountEntropyPrivateKeyOptionsStruct},\n * {@link KeyringAccountEntropyCustomOptionsStruct}, and\n * {@link KeyringAccountEntropyMpcOptionsStruct}.\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mnemonic',\n * id: '01K0BX6VDR5DPDPGGNA8PZVBVB',\n * derivationPath: \"m/44'/60'/0'/0/0\",\n * groupIndex: 0,\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'private-key',\n * },\n * exportable: true,\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'custom',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * entropy: {\n * type: 'mpc',\n * },\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * some: {\n * untyped: 'options',\n * something: true,\n * },\n * }\n * ```\n */\nexport const KeyringAccountOptionsStruct = intersection([\n // Non-Typed options (retro-compatibility):\n record(string(), JsonStruct),\n\n // Typed options. We use `type` instead of `object` here, to allow\n // extra properties. Also, since we use `record` + `intersection` we\n // are guaranteed that all field values will match the `JsonStruct`.\n //\n // READ THIS CAREFULLY:\n // Previous options that can be matched by this struct will be breaking\n // existing keyring account options.\n type({\n /**\n * Entropy options.\n */\n entropy: exactOptional(KeyringAccountEntropyOptionsStruct),\n\n /**\n * Indicates whether the account can be exported.\n */\n exportable: exactOptional(boolean()),\n }),\n]);\n\n/**\n * Keyring account options {@link KeyringAccountOptionsStruct}.\n */\nexport type KeyringAccountOptions = Infer<typeof KeyringAccountOptionsStruct>;\n"]}
|
package/dist/api/account.d.cts
CHANGED
|
@@ -84,6 +84,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
|
84
84
|
type: "private-key";
|
|
85
85
|
} | {
|
|
86
86
|
type: "custom";
|
|
87
|
+
} | {
|
|
88
|
+
type: "mpc";
|
|
87
89
|
};
|
|
88
90
|
exportable?: boolean;
|
|
89
91
|
};
|
|
@@ -131,6 +133,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
|
131
133
|
type: "private-key";
|
|
132
134
|
} | {
|
|
133
135
|
type: "custom";
|
|
136
|
+
} | {
|
|
137
|
+
type: "mpc";
|
|
134
138
|
};
|
|
135
139
|
exportable?: boolean;
|
|
136
140
|
}, null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;;;;;GAOG;AACH,oBAAY,cAAc;IACxB,OAAO,oBAAoB;CAC5B;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"account.d.cts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;;;;;GAOG;AACH,oBAAY,cAAc;IACxB,OAAO,oBAAoB;CAC5B;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;IAcH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/api/account.d.mts
CHANGED
|
@@ -84,6 +84,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
|
84
84
|
type: "private-key";
|
|
85
85
|
} | {
|
|
86
86
|
type: "custom";
|
|
87
|
+
} | {
|
|
88
|
+
type: "mpc";
|
|
87
89
|
};
|
|
88
90
|
exportable?: boolean;
|
|
89
91
|
};
|
|
@@ -131,6 +133,8 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
|
131
133
|
type: "private-key";
|
|
132
134
|
} | {
|
|
133
135
|
type: "custom";
|
|
136
|
+
} | {
|
|
137
|
+
type: "mpc";
|
|
134
138
|
};
|
|
135
139
|
exportable?: boolean;
|
|
136
140
|
}, null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;;;;;GAOG;AACH,oBAAY,cAAc;IACxB,OAAO,oBAAoB;CAC5B;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"account.d.mts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,eAAe;IAClB,OAAO,mBAAmB;CAC3B;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,KAAK,iBAAiB;IACtB,IAAI,gBAAgB;IACpB,MAAM,kBAAkB;IACxB,IAAI,gBAAgB;CACrB;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,WAAW,wBAAwB;CACpC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,GAAG,aAAa;CACjB;AAED;;;;;;;GAOG;AACH,oBAAY,cAAc;IACxB,OAAO,oBAAoB;CAC5B;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,gBAAgB;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,KAAK,EAAE,GACzB,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,MAAM,EAAE,GAC1B,GAAG,cAAc,CAAC,IAAI,EAAE,GACxB,GAAG,cAAc,CAAC,WAAW,EAAE,GAC/B,GAAG,cAAc,CAAC,GAAG,EAAE,GACvB,GAAG,cAAc,CAAC,OAAO,EAAE,GAC3B,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;IAcH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;IAGH;;OAEG;;EAEH,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/api/request.cjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KeyringRequestStruct = void 0;
|
|
3
|
+
exports.KeyringRequestStruct = exports.OriginMetadataStruct = void 0;
|
|
4
4
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
5
5
|
const superstruct_1 = require("@metamask/superstruct");
|
|
6
6
|
const utils_1 = require("@metamask/utils");
|
|
7
|
+
exports.OriginMetadataStruct = (0, superstruct_1.object)({
|
|
8
|
+
transport: (0, superstruct_1.string)(),
|
|
9
|
+
selfReportedOrigin: (0, superstruct_1.string)(),
|
|
10
|
+
});
|
|
7
11
|
exports.KeyringRequestStruct = (0, superstruct_1.object)({
|
|
8
12
|
/**
|
|
9
13
|
* Keyring request ID (UUIDv4).
|
|
@@ -21,6 +25,10 @@ exports.KeyringRequestStruct = (0, superstruct_1.object)({
|
|
|
21
25
|
* Origin of the sender.
|
|
22
26
|
*/
|
|
23
27
|
origin: (0, superstruct_1.string)(),
|
|
28
|
+
/**
|
|
29
|
+
* Origin metadata of the sender.
|
|
30
|
+
*/
|
|
31
|
+
originMetadata: (0, superstruct_1.exactOptional)((0, superstruct_1.nullable)(exports.OriginMetadataStruct)),
|
|
24
32
|
/**
|
|
25
33
|
* Inner request sent by the client application.
|
|
26
34
|
*/
|
package/dist/api/request.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.cjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,
|
|
1
|
+
{"version":3,"file":"request.cjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,uDAQ+B;AAC/B,2CAA6C;AAKhC,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,SAAS,EAAE,IAAA,oBAAM,GAAE;IACnB,kBAAkB,EAAE,IAAA,oBAAM,GAAE;CAC7B,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,0BAAU;IAEd;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,OAAO,EAAE,0BAAU;IAEnB;;OAEG;IACH,MAAM,EAAE,IAAA,oBAAM,GAAE;IAEhB;;OAEG;IACH,cAAc,EAAE,IAAA,2BAAa,EAAC,IAAA,sBAAQ,EAAC,4BAAoB,CAAC,CAAC;IAE7D;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC;QACd,MAAM,EAAE,IAAA,oBAAM,GAAE;QAChB,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n exactOptional,\n nullable,\n object,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\n// These should mirror the types in the Snaps SDK.\nexport type OriginMetadata = Infer<typeof OriginMetadataStruct>;\n\nexport const OriginMetadataStruct = object({\n transport: string(),\n selfReportedOrigin: string(),\n});\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Origin of the sender.\n */\n origin: string(),\n\n /**\n * Origin metadata of the sender.\n */\n originMetadata: exactOptional(nullable(OriginMetadataStruct)),\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
|
package/dist/api/request.d.cts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
export type OriginMetadata = Infer<typeof OriginMetadataStruct>;
|
|
3
|
+
export declare const OriginMetadataStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
+
transport: string;
|
|
5
|
+
selfReportedOrigin: string;
|
|
6
|
+
}, {
|
|
7
|
+
transport: import("@metamask/superstruct").Struct<string, null>;
|
|
8
|
+
selfReportedOrigin: import("@metamask/superstruct").Struct<string, null>;
|
|
9
|
+
}>;
|
|
2
10
|
export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
|
|
3
11
|
id: string;
|
|
4
12
|
origin: string;
|
|
@@ -8,6 +16,10 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
|
|
|
8
16
|
};
|
|
9
17
|
scope: string;
|
|
10
18
|
account: string;
|
|
19
|
+
originMetadata?: {
|
|
20
|
+
transport: string;
|
|
21
|
+
selfReportedOrigin: string;
|
|
22
|
+
} | null;
|
|
11
23
|
}, {
|
|
12
24
|
/**
|
|
13
25
|
* Keyring request ID (UUIDv4).
|
|
@@ -25,6 +37,16 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
|
|
|
25
37
|
* Origin of the sender.
|
|
26
38
|
*/
|
|
27
39
|
origin: import("@metamask/superstruct").Struct<string, null>;
|
|
40
|
+
/**
|
|
41
|
+
* Origin metadata of the sender.
|
|
42
|
+
*/
|
|
43
|
+
originMetadata: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
44
|
+
transport: string;
|
|
45
|
+
selfReportedOrigin: string;
|
|
46
|
+
} | null, {
|
|
47
|
+
transport: import("@metamask/superstruct").Struct<string, null>;
|
|
48
|
+
selfReportedOrigin: import("@metamask/superstruct").Struct<string, null>;
|
|
49
|
+
}>;
|
|
28
50
|
/**
|
|
29
51
|
* Inner request sent by the client application.
|
|
30
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.cts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"request.d.cts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;IAGH;;OAEG;;;;;;;;EAOH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/api/request.d.mts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
export type OriginMetadata = Infer<typeof OriginMetadataStruct>;
|
|
3
|
+
export declare const OriginMetadataStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
+
transport: string;
|
|
5
|
+
selfReportedOrigin: string;
|
|
6
|
+
}, {
|
|
7
|
+
transport: import("@metamask/superstruct").Struct<string, null>;
|
|
8
|
+
selfReportedOrigin: import("@metamask/superstruct").Struct<string, null>;
|
|
9
|
+
}>;
|
|
2
10
|
export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
|
|
3
11
|
id: string;
|
|
4
12
|
origin: string;
|
|
@@ -8,6 +16,10 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
|
|
|
8
16
|
};
|
|
9
17
|
scope: string;
|
|
10
18
|
account: string;
|
|
19
|
+
originMetadata?: {
|
|
20
|
+
transport: string;
|
|
21
|
+
selfReportedOrigin: string;
|
|
22
|
+
} | null;
|
|
11
23
|
}, {
|
|
12
24
|
/**
|
|
13
25
|
* Keyring request ID (UUIDv4).
|
|
@@ -25,6 +37,16 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
|
|
|
25
37
|
* Origin of the sender.
|
|
26
38
|
*/
|
|
27
39
|
origin: import("@metamask/superstruct").Struct<string, null>;
|
|
40
|
+
/**
|
|
41
|
+
* Origin metadata of the sender.
|
|
42
|
+
*/
|
|
43
|
+
originMetadata: import("@metamask/superstruct").ExactOptionalStruct<{
|
|
44
|
+
transport: string;
|
|
45
|
+
selfReportedOrigin: string;
|
|
46
|
+
} | null, {
|
|
47
|
+
transport: import("@metamask/superstruct").Struct<string, null>;
|
|
48
|
+
selfReportedOrigin: import("@metamask/superstruct").Struct<string, null>;
|
|
49
|
+
}>;
|
|
28
50
|
/**
|
|
29
51
|
* Inner request sent by the client application.
|
|
30
52
|
*/
|