@metamask-previews/keyring-api 22.0.0-d23a1b9 → 22.0.0-ea8175e
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 +11 -0
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +1 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +1 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/rpc.cjs +2 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +1 -1
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs +2 -1
- package/dist/rpc.mjs.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/bip44.cjs +1 -1
- package/dist/{api/v2/create-account/bip44.mjs.map → v2/api/create-account/bip44.cjs.map} +1 -1
- package/dist/{api/v2 → v2/api}/create-account/bip44.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/bip44.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/bip44.mjs +1 -1
- package/dist/v2/api/create-account/bip44.mjs.map +1 -0
- package/dist/{api/v2 → v2/api}/create-account/custom.cjs.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/custom.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/custom.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/custom.mjs.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/index.cjs.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/index.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/index.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/index.mjs.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/private-key.cjs +1 -1
- package/dist/v2/api/create-account/private-key.cjs.map +1 -0
- package/dist/{api/v2 → v2/api}/create-account/private-key.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/private-key.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/create-account/private-key.mjs +1 -1
- package/dist/v2/api/create-account/private-key.mjs.map +1 -0
- package/dist/{api/v2 → v2/api}/export-account/index.cjs.map +1 -1
- package/dist/{api/v2 → v2/api}/export-account/index.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/export-account/index.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/export-account/index.mjs.map +1 -1
- package/dist/{api/v2 → v2/api}/export-account/private-key.cjs.map +1 -1
- package/dist/{api/v2 → v2/api}/export-account/private-key.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/export-account/private-key.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/export-account/private-key.mjs.map +1 -1
- package/dist/{api/v2 → v2/api}/index.cjs +1 -0
- package/dist/v2/api/index.cjs.map +1 -0
- package/dist/{api/v2 → v2/api}/index.d.cts +1 -0
- package/dist/v2/api/index.d.cts.map +1 -0
- package/dist/{api/v2 → v2/api}/index.d.mts +1 -0
- package/dist/v2/api/index.d.mts.map +1 -0
- package/dist/{api/v2 → v2/api}/index.mjs +1 -0
- package/dist/v2/api/index.mjs.map +1 -0
- package/dist/{api/v2 → v2/api}/keyring-capabilities.cjs +2 -2
- package/dist/v2/api/keyring-capabilities.cjs.map +1 -0
- package/dist/{api/v2 → v2/api}/keyring-capabilities.d.cts +1 -1
- package/dist/{api/v2 → v2/api}/keyring-capabilities.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/keyring-capabilities.d.mts +1 -1
- package/dist/{api/v2 → v2/api}/keyring-capabilities.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/keyring-capabilities.mjs +2 -2
- package/dist/v2/api/keyring-capabilities.mjs.map +1 -0
- package/dist/v2/api/keyring-rpc.cjs +93 -0
- package/dist/v2/api/keyring-rpc.cjs.map +1 -0
- package/dist/v2/api/keyring-rpc.d.cts +440 -0
- package/dist/v2/api/keyring-rpc.d.cts.map +1 -0
- package/dist/v2/api/keyring-rpc.d.mts +440 -0
- package/dist/v2/api/keyring-rpc.d.mts.map +1 -0
- package/dist/v2/api/keyring-rpc.mjs +89 -0
- package/dist/v2/api/keyring-rpc.mjs.map +1 -0
- package/dist/{api/v2 → v2/api}/keyring-type.cjs.map +1 -1
- package/dist/{api/v2 → v2/api}/keyring-type.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/keyring-type.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/keyring-type.mjs.map +1 -1
- package/dist/v2/api/keyring.cjs.map +1 -0
- package/dist/{api/v2 → v2/api}/keyring.d.cts +4 -4
- package/dist/{api/v2 → v2/api}/keyring.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/keyring.d.mts +4 -4
- package/dist/{api/v2 → v2/api}/keyring.d.mts.map +1 -1
- package/dist/v2/api/keyring.mjs.map +1 -0
- package/dist/{api/v2 → v2/api}/private-key.cjs +1 -1
- package/dist/v2/api/private-key.cjs.map +1 -0
- package/dist/{api/v2 → v2/api}/private-key.d.cts.map +1 -1
- package/dist/{api/v2 → v2/api}/private-key.d.mts.map +1 -1
- package/dist/{api/v2 → v2/api}/private-key.mjs +1 -1
- package/dist/v2/api/private-key.mjs.map +1 -0
- package/dist/v2/index.cjs +18 -0
- package/dist/v2/index.cjs.map +1 -0
- package/dist/v2/index.d.cts +2 -0
- package/dist/v2/index.d.cts.map +1 -0
- package/dist/v2/index.d.mts +2 -0
- package/dist/v2/index.d.mts.map +1 -0
- package/dist/v2/index.mjs +2 -0
- package/dist/v2/index.mjs.map +1 -0
- package/package.json +11 -1
- package/dist/api/v2/create-account/bip44.cjs.map +0 -1
- package/dist/api/v2/create-account/private-key.cjs.map +0 -1
- package/dist/api/v2/create-account/private-key.mjs.map +0 -1
- package/dist/api/v2/index.cjs.map +0 -1
- package/dist/api/v2/index.d.cts.map +0 -1
- package/dist/api/v2/index.d.mts.map +0 -1
- package/dist/api/v2/index.mjs.map +0 -1
- package/dist/api/v2/keyring-capabilities.cjs.map +0 -1
- package/dist/api/v2/keyring-capabilities.mjs.map +0 -1
- package/dist/api/v2/keyring.cjs.map +0 -1
- package/dist/api/v2/keyring.mjs.map +0 -1
- package/dist/api/v2/private-key.cjs.map +0 -1
- package/dist/api/v2/private-key.mjs.map +0 -1
- /package/dist/{api/v2 → v2/api}/create-account/bip44.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/bip44.d.mts +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/custom.cjs +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/custom.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/custom.d.mts +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/custom.mjs +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/index.cjs +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/index.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/index.d.mts +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/index.mjs +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/private-key.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/create-account/private-key.d.mts +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/index.cjs +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/index.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/index.d.mts +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/index.mjs +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/private-key.cjs +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/private-key.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/private-key.d.mts +0 -0
- /package/dist/{api/v2 → v2/api}/export-account/private-key.mjs +0 -0
- /package/dist/{api/v2 → v2/api}/keyring-type.cjs +0 -0
- /package/dist/{api/v2 → v2/api}/keyring-type.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/keyring-type.d.mts +0 -0
- /package/dist/{api/v2 → v2/api}/keyring-type.mjs +0 -0
- /package/dist/{api/v2 → v2/api}/keyring.cjs +0 -0
- /package/dist/{api/v2 → v2/api}/keyring.mjs +0 -0
- /package/dist/{api/v2 → v2/api}/private-key.d.cts +0 -0
- /package/dist/{api/v2 → v2/api}/private-key.d.mts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bip44.d.mts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"bip44.d.mts","sourceRoot":"","sources":["../../../../src/v2/api/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,eAAO,MAAM,yCAAyC;;;;;IACpD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,KAAK,CACrD,OAAO,yCAAyC,CACjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;IACrD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uCAAuC;;;;;IAClD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,KAAK,CACnD,OAAO,uCAAuC,CAC/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+CAA+C;;;;;;;;IAC1D;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;QAED;;WAEG;;QAEH;;WAEG;;;EAGL,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,yCAAyC,GAAG,KAAK,CAC3D,OAAO,+CAA+C,CACvD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { literal, number, object, string } from "@metamask/superstruct";
|
|
2
|
-
import { DerivationPathStruct } from "
|
|
2
|
+
import { DerivationPathStruct } from "../../../api/derivation.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Struct for {@link CreateAccountBip44DerivePathOptions}.
|
|
5
5
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bip44.mjs","sourceRoot":"","sources":["../../../../src/v2/api/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EAEP,8BAA8B;AAE/B,OAAO,EAAE,oBAAoB,EAAE,oCAAgC;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,MAAM,CAAC;IAC9D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE;IACvB;;OAEG;IACH,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,MAAM,CAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,MAAM,CAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAC/B;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,+CAA+C,GAAG,MAAM,CAAC;IACpE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,0BAA0B,CAAC;IACzC;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;QACZ;;WAEG;QACH,IAAI,EAAE,MAAM,EAAE;QACd;;WAEG;QACH,EAAE,EAAE,MAAM,EAAE;KACb,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n literal,\n number,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { DerivationPathStruct } from '../../../api/derivation';\n\n/**\n * Struct for {@link CreateAccountBip44DerivePathOptions}.\n */\nexport const CreateAccountBip44DerivePathOptionsStruct = object({\n /**\n * Type of the options.\n */\n type: literal('bip44:derive-path'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * BIP-44 derivation path to be used to derive the account.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Options for creating an account using the given BIP-44 derivation path.\n */\nexport type CreateAccountBip44DerivePathOptions = Infer<\n typeof CreateAccountBip44DerivePathOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexOptions}.\n */\nexport const CreateAccountBip44DeriveIndexOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating an account using the given BIP-44 account group index.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexOptions = Infer<\n typeof CreateAccountBip44DeriveIndexOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DiscoverOptions}.\n */\nexport const CreateAccountBip44DiscoverOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:discover'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating accounts by performing a BIP-44 account discovery.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DiscoverOptions = Infer<\n typeof CreateAccountBip44DiscoverOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexRangeOptions}.\n */\nexport const CreateAccountBip44DeriveIndexRangeOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index-range'),\n /**\n * ID of the entropy source to be used to derive the accounts.\n */\n entropySource: string(),\n /**\n * The range of account group indices to derive (inclusive on both ends).\n */\n range: object({\n /**\n * The starting index of the account group range (inclusive).\n */\n from: number(),\n /**\n * The ending index of the account group range (inclusive).\n */\n to: number(),\n }),\n});\n\n/**\n * Options for creating accounts by deriving a range of BIP-44 account indices.\n *\n * The range is inclusive on both ends, meaning range.from=0 and range.to=5\n * will create accounts for group indices 0, 1, 2, 3, 4, and 5.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexRangeOptions = Infer<\n typeof CreateAccountBip44DeriveIndexRangeOptionsStruct\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.cjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"custom.cjs","sourceRoot":"","sources":["../../../../src/v2/api/create-account/custom.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAElE;;GAEG;AACU,QAAA,gCAAgC,GAAG,IAAA,kBAAI,EAAC;IACnD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { literal, type, type Infer } from '@metamask/superstruct';\n\n/**\n * Struct for {@link CreateAccountCustomOptions}.\n */\nexport const CreateAccountCustomOptionsStruct = type({\n /**\n * The type of the options.\n */\n type: literal('custom'),\n});\n\n/**\n * Options for creating an account using a custom, keyring-specific method.\n *\n * This is an opaque type that allows keyrings with non-standard account\n * creation flows to define their own options. Keyrings using this type\n * should declare `custom.createAccounts: true` in their capabilities.\n *\n * The actual options accepted by the keyring are implementation-specific\n * and not validated by this struct beyond the `type` field. Adaptors should\n * handle any additional options as needed and add type intersections as necessary.\n */\nexport type CreateAccountCustomOptions = Infer<\n typeof CreateAccountCustomOptionsStruct\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.cts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"custom.d.cts","sourceRoot":"","sources":["../../../../src/v2/api/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,8BAA8B;AAElE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;IAC3C;;OAEG;;EAEH,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.mts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"custom.d.mts","sourceRoot":"","sources":["../../../../src/v2/api/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,8BAA8B;AAElE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;IAC3C;;OAEG;;EAEH,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.mjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"custom.mjs","sourceRoot":"","sources":["../../../../src/v2/api/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAc,8BAA8B;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC;IACnD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { literal, type, type Infer } from '@metamask/superstruct';\n\n/**\n * Struct for {@link CreateAccountCustomOptions}.\n */\nexport const CreateAccountCustomOptionsStruct = type({\n /**\n * The type of the options.\n */\n type: literal('custom'),\n});\n\n/**\n * Options for creating an account using a custom, keyring-specific method.\n *\n * This is an opaque type that allows keyrings with non-standard account\n * creation flows to define their own options. Keyrings using this type\n * should declare `custom.createAccounts: true` in their capabilities.\n *\n * The actual options accepted by the keyring are implementation-specific\n * and not validated by this struct beyond the `type` field. Adaptors should\n * handle any additional options as needed and add type intersections as necessary.\n */\nexport type CreateAccountCustomOptions = Infer<\n typeof CreateAccountCustomOptionsStruct\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/v2/api/create-account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAyHA,oFAeC;AAxID,2DAAyD;AAGzD,uCAKiB;AACjB,yCAA4D;AAC5D,mDAAqE;AAErE,8CAAwB;AACxB,+CAAyB;AACzB,oDAA8B;AAE9B;;GAEG;AACH,IAAY,mBA6CX;AA7CD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,4DAAqC,CAAA;IAErC;;;;;;OAMG;IACH,8DAAuC,CAAA;IAEvC;;;;;;OAMG;IACH,yEAAkD,CAAA;IAElD;;;;;;OAMG;IACH,uDAAgC,CAAA;IAEhC;;OAEG;IACH,8DAAuC,CAAA;IAEvC;;;;;OAKG;IACH,wCAAiB,CAAA;AACnB,CAAC,EA7CW,mBAAmB,mCAAnB,mBAAmB,QA6C9B;AAED;;GAEG;AACU,QAAA,0BAA0B,GAAG,IAAA,8BAAc,EAAC,CAAC,KAAU,EAAE,EAAE;IACtE,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAA2B,CAAC;IAC/D,QAAQ,mBAAmB,EAAE,CAAC;QAC5B,KAAK,mBAAmB,CAAC,eAAe;YACtC,OAAO,iDAAyC,CAAC;QACnD,KAAK,mBAAmB,CAAC,gBAAgB;YACvC,OAAO,kDAA0C,CAAC;QACpD,KAAK,mBAAmB,CAAC,qBAAqB;YAC5C,OAAO,uDAA+C,CAAC;QACzD,KAAK,mBAAmB,CAAC,aAAa;YACpC,OAAO,+CAAuC,CAAC;QACjD,KAAK,mBAAmB,CAAC,gBAAgB;YACvC,OAAO,kDAAoC,CAAC;QAC9C,KAAK,mBAAmB,CAAC,MAAM;YAC7B,OAAO,yCAAgC,CAAC;QAC1C;YACE,wGAAwG;YACxG,OAAO,iDAAyC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC,CAAC;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,oCAAoC,CAKlD,OAAgB,EAChB,cAAoC;IAGpC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,KAAK,GAA4C,cAAc,CAAC;IAEtE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,2CAA2C,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC;AACH,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport { type Infer } from '@metamask/superstruct';\n\nimport {\n CreateAccountBip44DiscoverOptionsStruct,\n CreateAccountBip44DeriveIndexOptionsStruct,\n CreateAccountBip44DeriveIndexRangeOptionsStruct,\n CreateAccountBip44DerivePathOptionsStruct,\n} from './bip44';\nimport { CreateAccountCustomOptionsStruct } from './custom';\nimport { CreateAccountPrivateKeyOptionsStruct } from './private-key';\n\nexport * from './bip44';\nexport * from './custom';\nexport * from './private-key';\n\n/**\n * Enum representing the different ways an account can be created.\n */\nexport enum AccountCreationType {\n /**\n * Represents an account created using a BIP-44 derivation path.\n */\n Bip44DerivePath = 'bip44:derive-path',\n\n /**\n * Represents accounts created using a BIP-44 account index.\n *\n * More than one account can be created, for example, the keyring can create\n * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account\n * index.\n */\n Bip44DeriveIndex = 'bip44:derive-index',\n\n /**\n * Represents accounts created by deriving a range of BIP-44 account indices.\n *\n * More than one account can be created per index, for example, the keyring\n * can create multiple account types (e.g., P2PKH, P2TR, P2WPKH) for each\n * account index in the range.\n */\n Bip44DeriveIndexRange = 'bip44:derive-index-range',\n\n /**\n * Represents accounts created through BIP-44 account discovery.\n *\n * More than one account can be created, for example, the keyring can create\n * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account\n * index.\n */\n Bip44Discover = 'bip44:discover',\n\n /**\n * Represents an account imported from a private key.\n */\n PrivateKeyImport = 'private-key:import',\n\n /**\n * Represents an account created using a custom, keyring-specific method.\n *\n * This is used by keyrings that have non-standard account creation flows\n * and declare `custom.createAccounts: true` in their capabilities.\n */\n Custom = 'custom',\n}\n\n/**\n * Struct for {@link CreateAccountOptions}.\n */\nexport const CreateAccountOptionsStruct = selectiveUnion((value: any) => {\n const accountCreationType = value?.type as AccountCreationType;\n switch (accountCreationType) {\n case AccountCreationType.Bip44DerivePath:\n return CreateAccountBip44DerivePathOptionsStruct;\n case AccountCreationType.Bip44DeriveIndex:\n return CreateAccountBip44DeriveIndexOptionsStruct;\n case AccountCreationType.Bip44DeriveIndexRange:\n return CreateAccountBip44DeriveIndexRangeOptionsStruct;\n case AccountCreationType.Bip44Discover:\n return CreateAccountBip44DiscoverOptionsStruct;\n case AccountCreationType.PrivateKeyImport:\n return CreateAccountPrivateKeyOptionsStruct;\n case AccountCreationType.Custom:\n return CreateAccountCustomOptionsStruct;\n default:\n // Return first struct as fallback - validation will fail with proper error indicating the type mismatch\n return CreateAccountBip44DerivePathOptionsStruct;\n }\n});\n\n/**\n * Represents the available options for creating a new account.\n */\nexport type CreateAccountOptions = Infer<typeof CreateAccountOptionsStruct>;\n\n/**\n * Asserts that a given create account option type is supported by the keyring.\n *\n * @example\n * ```ts\n * createAccounts(options: CreateAccountOptions) {\n * assertCreateAccountOptionIsSupported(options, [\n * ${AccountCreationType.Bip44DeriveIndex},\n * ${AccountCreationType.Bip44DeriveIndexRange},\n * ] as const);\n *\n * // At this point, TypeScript knows that options.type is either Bip44DeriveIndex or Bip44DeriveIndexRange.\n * if (options.type === AccountCreationType.Bip44DeriveIndex) {\n * ... // Handle Bip44DeriveIndex case.\n * } else {\n * ... // Handle Bip44DeriveIndexRange case.\n * }\n * ...\n * return accounts;\n * }\n * ```\n *\n * @param options - The create account option object to check.\n * @param supportedTypes - The list of supported create account option types for this keyring.\n * @throws Will throw an error if the provided options are not supported.\n */\nexport function assertCreateAccountOptionIsSupported<\n Options extends CreateAccountOptions,\n // We use template literal types to enforce string-literal over strict enum values.\n Type extends `${CreateAccountOptions['type']}`,\n>(\n options: Options,\n supportedTypes: readonly `${Type}`[],\n // Use intersection to avoid widening `type` beyond `Options['type']`.\n): asserts options is Options & { type: `${Type}` & `${Options['type']}` } {\n const { type } = options;\n const types: readonly CreateAccountOptions['type'][] = supportedTypes;\n\n if (!types.includes(type)) {\n throw new Error(`Unsupported create account option type: ${type}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/v2/api/create-account/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AAWnD,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAE9B;;GAEG;AACH,oBAAY,mBAAmB;IAC7B;;OAEG;IACH,eAAe,sBAAsB;IAErC;;;;;;OAMG;IACH,gBAAgB,uBAAuB;IAEvC;;;;;;OAMG;IACH,qBAAqB,6BAA6B;IAElD;;;;;;OAMG;IACH,aAAa,mBAAmB;IAEhC;;OAEG;IACH,gBAAgB,uBAAuB;IAEvC;;;;;OAKG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;QAmBrC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,SAAS,oBAAoB,EAEpC,IAAI,SAAS,GAAG,oBAAoB,CAAC,MAAM,CAAC,EAAE,EAE9C,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,SAAS,GAAG,IAAI,EAAE,EAAE,GAEnC,OAAO,CAAC,OAAO,IAAI,OAAO,GAAG;IAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;CAAE,CAOzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/v2/api/create-account/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AAWnD,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAE9B;;GAEG;AACH,oBAAY,mBAAmB;IAC7B;;OAEG;IACH,eAAe,sBAAsB;IAErC;;;;;;OAMG;IACH,gBAAgB,uBAAuB;IAEvC;;;;;;OAMG;IACH,qBAAqB,6BAA6B;IAElD;;;;;;OAMG;IACH,aAAa,mBAAmB;IAEhC;;OAEG;IACH,gBAAgB,uBAAuB;IAEvC;;;;;OAKG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;QAmBrC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,SAAS,oBAAoB,EAEpC,IAAI,SAAS,GAAG,oBAAoB,CAAC,MAAM,CAAC,EAAE,EAE9C,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,SAAS,GAAG,IAAI,EAAE,EAAE,GAEnC,OAAO,CAAC,OAAO,IAAI,OAAO,GAAG;IAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;CAAE,CAOzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/v2/api/create-account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gCAAgC;AAGzD,OAAO,EACL,uCAAuC,EACvC,0CAA0C,EAC1C,+CAA+C,EAC/C,yCAAyC,EAC1C,oBAAgB;AACjB,OAAO,EAAE,gCAAgC,EAAE,qBAAiB;AAC5D,OAAO,EAAE,oCAAoC,EAAE,0BAAsB;AAErE,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAE9B;;GAEG;AACH,MAAM,CAAN,IAAY,mBA6CX;AA7CD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,4DAAqC,CAAA;IAErC;;;;;;OAMG;IACH,8DAAuC,CAAA;IAEvC;;;;;;OAMG;IACH,yEAAkD,CAAA;IAElD;;;;;;OAMG;IACH,uDAAgC,CAAA;IAEhC;;OAEG;IACH,8DAAuC,CAAA;IAEvC;;;;;OAKG;IACH,wCAAiB,CAAA;AACnB,CAAC,EA7CW,mBAAmB,KAAnB,mBAAmB,QA6C9B;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,cAAc,CAAC,CAAC,KAAU,EAAE,EAAE;IACtE,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAA2B,CAAC;IAC/D,QAAQ,mBAAmB,EAAE,CAAC;QAC5B,KAAK,mBAAmB,CAAC,eAAe;YACtC,OAAO,yCAAyC,CAAC;QACnD,KAAK,mBAAmB,CAAC,gBAAgB;YACvC,OAAO,0CAA0C,CAAC;QACpD,KAAK,mBAAmB,CAAC,qBAAqB;YAC5C,OAAO,+CAA+C,CAAC;QACzD,KAAK,mBAAmB,CAAC,aAAa;YACpC,OAAO,uCAAuC,CAAC;QACjD,KAAK,mBAAmB,CAAC,gBAAgB;YACvC,OAAO,oCAAoC,CAAC;QAC9C,KAAK,mBAAmB,CAAC,MAAM;YAC7B,OAAO,gCAAgC,CAAC;QAC1C;YACE,wGAAwG;YACxG,OAAO,yCAAyC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC,CAAC;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,oCAAoC,CAKlD,OAAgB,EAChB,cAAoC;IAGpC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,KAAK,GAA4C,cAAc,CAAC;IAEtE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,2CAA2C,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC;AACH,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport { type Infer } from '@metamask/superstruct';\n\nimport {\n CreateAccountBip44DiscoverOptionsStruct,\n CreateAccountBip44DeriveIndexOptionsStruct,\n CreateAccountBip44DeriveIndexRangeOptionsStruct,\n CreateAccountBip44DerivePathOptionsStruct,\n} from './bip44';\nimport { CreateAccountCustomOptionsStruct } from './custom';\nimport { CreateAccountPrivateKeyOptionsStruct } from './private-key';\n\nexport * from './bip44';\nexport * from './custom';\nexport * from './private-key';\n\n/**\n * Enum representing the different ways an account can be created.\n */\nexport enum AccountCreationType {\n /**\n * Represents an account created using a BIP-44 derivation path.\n */\n Bip44DerivePath = 'bip44:derive-path',\n\n /**\n * Represents accounts created using a BIP-44 account index.\n *\n * More than one account can be created, for example, the keyring can create\n * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account\n * index.\n */\n Bip44DeriveIndex = 'bip44:derive-index',\n\n /**\n * Represents accounts created by deriving a range of BIP-44 account indices.\n *\n * More than one account can be created per index, for example, the keyring\n * can create multiple account types (e.g., P2PKH, P2TR, P2WPKH) for each\n * account index in the range.\n */\n Bip44DeriveIndexRange = 'bip44:derive-index-range',\n\n /**\n * Represents accounts created through BIP-44 account discovery.\n *\n * More than one account can be created, for example, the keyring can create\n * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account\n * index.\n */\n Bip44Discover = 'bip44:discover',\n\n /**\n * Represents an account imported from a private key.\n */\n PrivateKeyImport = 'private-key:import',\n\n /**\n * Represents an account created using a custom, keyring-specific method.\n *\n * This is used by keyrings that have non-standard account creation flows\n * and declare `custom.createAccounts: true` in their capabilities.\n */\n Custom = 'custom',\n}\n\n/**\n * Struct for {@link CreateAccountOptions}.\n */\nexport const CreateAccountOptionsStruct = selectiveUnion((value: any) => {\n const accountCreationType = value?.type as AccountCreationType;\n switch (accountCreationType) {\n case AccountCreationType.Bip44DerivePath:\n return CreateAccountBip44DerivePathOptionsStruct;\n case AccountCreationType.Bip44DeriveIndex:\n return CreateAccountBip44DeriveIndexOptionsStruct;\n case AccountCreationType.Bip44DeriveIndexRange:\n return CreateAccountBip44DeriveIndexRangeOptionsStruct;\n case AccountCreationType.Bip44Discover:\n return CreateAccountBip44DiscoverOptionsStruct;\n case AccountCreationType.PrivateKeyImport:\n return CreateAccountPrivateKeyOptionsStruct;\n case AccountCreationType.Custom:\n return CreateAccountCustomOptionsStruct;\n default:\n // Return first struct as fallback - validation will fail with proper error indicating the type mismatch\n return CreateAccountBip44DerivePathOptionsStruct;\n }\n});\n\n/**\n * Represents the available options for creating a new account.\n */\nexport type CreateAccountOptions = Infer<typeof CreateAccountOptionsStruct>;\n\n/**\n * Asserts that a given create account option type is supported by the keyring.\n *\n * @example\n * ```ts\n * createAccounts(options: CreateAccountOptions) {\n * assertCreateAccountOptionIsSupported(options, [\n * ${AccountCreationType.Bip44DeriveIndex},\n * ${AccountCreationType.Bip44DeriveIndexRange},\n * ] as const);\n *\n * // At this point, TypeScript knows that options.type is either Bip44DeriveIndex or Bip44DeriveIndexRange.\n * if (options.type === AccountCreationType.Bip44DeriveIndex) {\n * ... // Handle Bip44DeriveIndex case.\n * } else {\n * ... // Handle Bip44DeriveIndexRange case.\n * }\n * ...\n * return accounts;\n * }\n * ```\n *\n * @param options - The create account option object to check.\n * @param supportedTypes - The list of supported create account option types for this keyring.\n * @throws Will throw an error if the provided options are not supported.\n */\nexport function assertCreateAccountOptionIsSupported<\n Options extends CreateAccountOptions,\n // We use template literal types to enforce string-literal over strict enum values.\n Type extends `${CreateAccountOptions['type']}`,\n>(\n options: Options,\n supportedTypes: readonly `${Type}`[],\n // Use intersection to avoid widening `type` beyond `Options['type']`.\n): asserts options is Options & { type: `${Type}` & `${Options['type']}` } {\n const { type } = options;\n const types: readonly CreateAccountOptions['type'][] = supportedTypes;\n\n if (!types.includes(type)) {\n throw new Error(`Unsupported create account option type: ${type}`);\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreateAccountPrivateKeyOptionsStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
-
const account_1 = require("
|
|
5
|
+
const account_1 = require("../../../api/account.cjs");
|
|
6
6
|
const private_key_1 = require("../private-key.cjs");
|
|
7
7
|
/**
|
|
8
8
|
* Struct for {@link CreateAccountPrivateKeyOptions}.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key.cjs","sourceRoot":"","sources":["../../../../src/v2/api/create-account/private-key.ts"],"names":[],"mappings":";;;AAAA,uDAM+B;AAE/B,sDAAgE;AAChE,oDAA0D;AAE1D;;GAEG;AACU,QAAA,oCAAoC,GAAG,IAAA,oBAAM,EAAC;IACzD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,sCAAwB;IAClC;;OAEG;IACH,WAAW,EAAE,IAAA,2BAAa,EAAC,kCAAwB,CAAC;CACrD,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n literal,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { KeyringAccountTypeStruct } from '../../../api/account';\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link CreateAccountPrivateKeyOptions}.\n */\nexport const CreateAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('private-key:import'),\n /**\n * The encoded private key to be imported.\n */\n privateKey: string(),\n /**\n * The encoding of the private key.\n */\n encoding: PrivateKeyEncodingStruct,\n /**\n * The account type of the imported account.\n */\n accountType: exactOptional(KeyringAccountTypeStruct),\n});\n\n/**\n * Options for importing an account from a private key.\n */\nexport type CreateAccountPrivateKeyOptions = Infer<\n typeof CreateAccountPrivateKeyOptionsStruct\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.d.cts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"private-key.d.cts","sourceRoot":"","sources":["../../../../src/v2/api/create-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAK/B;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;;;IAC/C;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;IAEH;;OAEG;;;;;;;;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,OAAO,oCAAoC,CAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.d.mts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"private-key.d.mts","sourceRoot":"","sources":["../../../../src/v2/api/create-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAK/B;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;;;IAC/C;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;IAEH;;OAEG;;;;;;;;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,OAAO,oCAAoC,CAC5C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { exactOptional, literal, object, string } from "@metamask/superstruct";
|
|
2
|
-
import { KeyringAccountTypeStruct } from "
|
|
2
|
+
import { KeyringAccountTypeStruct } from "../../../api/account.mjs";
|
|
3
3
|
import { PrivateKeyEncodingStruct } from "../private-key.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Struct for {@link CreateAccountPrivateKeyOptions}.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key.mjs","sourceRoot":"","sources":["../../../../src/v2/api/create-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,OAAO,EACP,MAAM,EACN,MAAM,EAEP,8BAA8B;AAE/B,OAAO,EAAE,wBAAwB,EAAE,iCAA6B;AAChE,OAAO,EAAE,wBAAwB,EAAE,2BAAuB;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC;IACzD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,wBAAwB;IAClC;;OAEG;IACH,WAAW,EAAE,aAAa,CAAC,wBAAwB,CAAC;CACrD,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n literal,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { KeyringAccountTypeStruct } from '../../../api/account';\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link CreateAccountPrivateKeyOptions}.\n */\nexport const CreateAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('private-key:import'),\n /**\n * The encoded private key to be imported.\n */\n privateKey: string(),\n /**\n * The encoding of the private key.\n */\n encoding: PrivateKeyEncodingStruct,\n /**\n * The account type of the imported account.\n */\n accountType: exactOptional(KeyringAccountTypeStruct),\n});\n\n/**\n * Options for importing an account from a private key.\n */\nexport type CreateAccountPrivateKeyOptions = Infer<\n typeof CreateAccountPrivateKeyOptionsStruct\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/v2/api/export-account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,mDAGuB;AAEvB,oDAA8B;AAE9B;;GAEG;AACH,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,+CAA0B,CAAA;AAC5B,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAED;;GAEG;AACU,QAAA,0BAA0B,GAAG,kDAAoC,CAAC;AAO/E;;GAEG;AACU,QAAA,qBAAqB,GAAG,6CAA+B,CAAC","sourcesContent":["import { type Infer } from '@metamask/superstruct';\n\nimport {\n ExportAccountPrivateKeyOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './private-key';\n\nexport * from './private-key';\n\n/**\n * Enum representing the different types of account export methods.\n */\nexport enum AccountExportType {\n /**\n * Export account as a private key.\n */\n PrivateKey = 'private-key',\n}\n\n/**\n * Struct for {@link ExportAccountOptions}.\n */\nexport const ExportAccountOptionsStruct = ExportAccountPrivateKeyOptionsStruct;\n\n/**\n * Represents the options for exporting an account.\n */\nexport type ExportAccountOptions = Infer<typeof ExportAccountOptionsStruct>;\n\n/**\n * Struct for {@link ExportedAccount}.\n */\nexport const ExportedAccountStruct = PrivateKeyExportedAccountStruct;\n\n/**\n * Represents an account that has been exported.\n */\nexport type ExportedAccount = Infer<typeof ExportedAccountStruct>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/v2/api/export-account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AAOnD,kCAA8B;AAE9B;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,UAAU,gBAAgB;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;EAAuC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;EAAkC,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/v2/api/export-account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AAOnD,kCAA8B;AAE9B;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,UAAU,gBAAgB;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;EAAuC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;EAAkC,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/v2/api/export-account/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oCAAoC,EACpC,+BAA+B,EAChC,0BAAsB;AAEvB,kCAA8B;AAE9B;;GAEG;AACH,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,+CAA0B,CAAA;AAC5B,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oCAAoC,CAAC;AAO/E;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,+BAA+B,CAAC","sourcesContent":["import { type Infer } from '@metamask/superstruct';\n\nimport {\n ExportAccountPrivateKeyOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './private-key';\n\nexport * from './private-key';\n\n/**\n * Enum representing the different types of account export methods.\n */\nexport enum AccountExportType {\n /**\n * Export account as a private key.\n */\n PrivateKey = 'private-key',\n}\n\n/**\n * Struct for {@link ExportAccountOptions}.\n */\nexport const ExportAccountOptionsStruct = ExportAccountPrivateKeyOptionsStruct;\n\n/**\n * Represents the options for exporting an account.\n */\nexport type ExportAccountOptions = Infer<typeof ExportAccountOptionsStruct>;\n\n/**\n * Struct for {@link ExportedAccount}.\n */\nexport const ExportedAccountStruct = PrivateKeyExportedAccountStruct;\n\n/**\n * Represents an account that has been exported.\n */\nexport type ExportedAccount = Infer<typeof ExportedAccountStruct>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.cjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"private-key.cjs","sourceRoot":"","sources":["../../../../src/v2/api/export-account/private-key.ts"],"names":[],"mappings":";;;AAAA,uDAA4E;AAE5E,oDAA0D;AAE1D;;GAEG;AACU,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EAAC;IACpD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,sCAAwB;CACnC,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,oCAAoC,GAAG,IAAA,oBAAM,EAAC;IACzD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,sCAAwB;CACnC,CAAC,CAAC","sourcesContent":["import { literal, object, string, type Infer } from '@metamask/superstruct';\n\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link PrivateKeyExportedAccount}.\n */\nexport const PrivateKeyExportedAccountStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The private key of the exported account.\n */\n privateKey: string(),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Represents an account that has been exported using a private key.\n */\nexport type PrivateKeyExportedAccount = Infer<\n typeof PrivateKeyExportedAccountStruct\n>;\n\n/**\n * Struct for {@link ExportAccountPrivateKeyOptions}.\n */\nexport const ExportAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Options for exporting an account's private key.\n */\nexport type ExportAccountPrivateKeyOptions = Infer<\n typeof ExportAccountPrivateKeyOptionsStruct\n>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.d.cts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"private-key.d.cts","sourceRoot":"","sources":["../../../../src/v2/api/export-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,8BAA8B;AAI5E;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;IAC1C;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;IAC/C;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,OAAO,oCAAoC,CAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.d.mts","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"private-key.d.mts","sourceRoot":"","sources":["../../../../src/v2/api/export-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,8BAA8B;AAI5E;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;IAC1C;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;IAC/C;;OAEG;;IAEH;;OAEG;;;;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAChD,OAAO,oCAAoC,CAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.mjs","sourceRoot":"","sources":["../../../../src/api/
|
|
1
|
+
{"version":3,"file":"private-key.mjs","sourceRoot":"","sources":["../../../../src/v2/api/export-account/private-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAc,8BAA8B;AAE5E,OAAO,EAAE,wBAAwB,EAAE,2BAAuB;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;IACpD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;IACpB;;OAEG;IACH,QAAQ,EAAE,wBAAwB;CACnC,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC;IACzD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,wBAAwB;CACnC,CAAC,CAAC","sourcesContent":["import { literal, object, string, type Infer } from '@metamask/superstruct';\n\nimport { PrivateKeyEncodingStruct } from '../private-key';\n\n/**\n * Struct for {@link PrivateKeyExportedAccount}.\n */\nexport const PrivateKeyExportedAccountStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The private key of the exported account.\n */\n privateKey: string(),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Represents an account that has been exported using a private key.\n */\nexport type PrivateKeyExportedAccount = Infer<\n typeof PrivateKeyExportedAccountStruct\n>;\n\n/**\n * Struct for {@link ExportAccountPrivateKeyOptions}.\n */\nexport const ExportAccountPrivateKeyOptionsStruct = object({\n /**\n * The type of the account export.\n */\n type: literal('private-key'),\n /**\n * The encoding of the exported private key.\n */\n encoding: PrivateKeyEncodingStruct,\n});\n\n/**\n * Options for exporting an account's private key.\n */\nexport type ExportAccountPrivateKeyOptions = Infer<\n typeof ExportAccountPrivateKeyOptionsStruct\n>;\n"]}
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./keyring-capabilities.cjs"), exports);
|
|
18
18
|
__exportStar(require("./keyring-type.cjs"), exports);
|
|
19
|
+
__exportStar(require("./keyring-rpc.cjs"), exports);
|
|
19
20
|
__exportStar(require("./create-account/index.cjs"), exports);
|
|
20
21
|
__exportStar(require("./export-account/index.cjs"), exports);
|
|
21
22
|
__exportStar(require("./private-key.cjs"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/v2/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,qDAA+B;AAC/B,oDAA8B;AAC9B,6DAAiC;AACjC,6DAAiC;AACjC,oDAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './keyring-rpc';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type * from "./keyring.cjs";
|
|
2
2
|
export * from "./keyring-capabilities.cjs";
|
|
3
3
|
export * from "./keyring-type.cjs";
|
|
4
|
+
export * from "./keyring-rpc.cjs";
|
|
4
5
|
export * from "./create-account/index.cjs";
|
|
5
6
|
export * from "./export-account/index.cjs";
|
|
6
7
|
export * from "./private-key.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/v2/api/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type * from "./keyring.mjs";
|
|
2
2
|
export * from "./keyring-capabilities.mjs";
|
|
3
3
|
export * from "./keyring-type.mjs";
|
|
4
|
+
export * from "./keyring-rpc.mjs";
|
|
4
5
|
export * from "./create-account/index.mjs";
|
|
5
6
|
export * from "./export-account/index.mjs";
|
|
6
7
|
export * from "./private-key.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/v2/api/index.ts"],"names":[],"mappings":"AAAA,mCAA+B;AAC/B,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/v2/api/index.ts"],"names":[],"mappings":"AACA,2CAAuC;AACvC,mCAA+B;AAC/B,kCAA8B;AAC9B,2CAAiC;AACjC,2CAAiC;AACjC,kCAA8B","sourcesContent":["export type * from './keyring';\nexport * from './keyring-capabilities';\nexport * from './keyring-type';\nexport * from './keyring-rpc';\nexport * from './create-account';\nexport * from './export-account';\nexport * from './private-key';\n"]}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.KeyringCapabilitiesStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
5
|
const private_key_1 = require("./private-key.cjs");
|
|
6
|
-
const caip_1 = require("
|
|
6
|
+
const caip_1 = require("../../api/caip.cjs");
|
|
7
7
|
/**
|
|
8
8
|
* Struct for {@link KeyringCapabilities}.
|
|
9
9
|
*/
|
|
@@ -47,7 +47,7 @@ exports.KeyringCapabilitiesStruct = (0, superstruct_1.object)({
|
|
|
47
47
|
exportFormats: (0, superstruct_1.exactOptional)((0, superstruct_1.array)(private_key_1.ExportPrivateKeyFormatStruct)),
|
|
48
48
|
})),
|
|
49
49
|
/**
|
|
50
|
-
* Indicates which
|
|
50
|
+
* Indicates which Keyring methods accept non-standard options.
|
|
51
51
|
*
|
|
52
52
|
* When a method is set to `true`, it signals that the keyring implementation
|
|
53
53
|
* accepts custom options for that method, different from the standard API.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":";;;AAAA,uDAQ+B;AAE/B,mDAGuB;AACvB,6CAAmD;AAEnD;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,wBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,IAAA,2BAAa,EAClB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,UAAU,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,IAAA,2BAAa,EACvB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,qBAAO,EACL,IAAA,oBAAM,EAAC;QACL,cAAc,EAAE,IAAA,qBAAO,GAAE;KAC1B,CAAC,CACH,CACF;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../../api/caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which Keyring methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
|
|
@@ -106,7 +106,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
|
|
|
106
106
|
}>>;
|
|
107
107
|
}>;
|
|
108
108
|
/**
|
|
109
|
-
* Indicates which
|
|
109
|
+
* Indicates which Keyring methods accept non-standard options.
|
|
110
110
|
*
|
|
111
111
|
* When a method is set to `true`, it signals that the keyring implementation
|
|
112
112
|
* accepts custom options for that method, different from the standard API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring-capabilities.d.cts","sourceRoot":"","sources":["../../../src/api/
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.d.cts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EACX,8BAA8B;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;EAQH,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -106,7 +106,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
|
|
|
106
106
|
}>>;
|
|
107
107
|
}>;
|
|
108
108
|
/**
|
|
109
|
-
* Indicates which
|
|
109
|
+
* Indicates which Keyring methods accept non-standard options.
|
|
110
110
|
*
|
|
111
111
|
* When a method is set to `true`, it signals that the keyring implementation
|
|
112
112
|
* accepts custom options for that method, different from the standard API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/api/
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,KAAK,EACX,8BAA8B;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;EAQH,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { array, boolean, exactOptional, nonempty, object, partial } from "@metamask/superstruct";
|
|
2
2
|
import { ExportPrivateKeyFormatStruct, ImportPrivateKeyFormatStruct } from "./private-key.mjs";
|
|
3
|
-
import { CaipChainIdStruct } from "
|
|
3
|
+
import { CaipChainIdStruct } from "../../api/caip.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Struct for {@link KeyringCapabilities}.
|
|
6
6
|
*/
|
|
@@ -44,7 +44,7 @@ export const KeyringCapabilitiesStruct = object({
|
|
|
44
44
|
exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),
|
|
45
45
|
})),
|
|
46
46
|
/**
|
|
47
|
-
* Indicates which
|
|
47
|
+
* Indicates which Keyring methods accept non-standard options.
|
|
48
48
|
*
|
|
49
49
|
* When a method is set to `true`, it signals that the keyring implementation
|
|
50
50
|
* accepts custom options for that method, different from the standard API.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EAER,8BAA8B;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AACvB,OAAO,EAAE,iBAAiB,EAAE,2BAAuB;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,aAAa,CAClB,MAAM,CAAC;QACL;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,aAAa,CACvB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CACnB,OAAO,CACL,MAAM,CAAC;QACL,cAAc,EAAE,OAAO,EAAE;KAC1B,CAAC,CACH,CACF;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../../api/caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which Keyring methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.CreateAccountsResponseStruct = exports.CreateAccountsRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.GetAccountsResponseStruct = exports.GetAccountsRequestStruct = exports.KeyringRpcMethod = void 0;
|
|
4
|
+
exports.isKeyringRpcMethod = isKeyringRpcMethod;
|
|
5
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
6
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
7
|
+
const utils_1 = require("@metamask/utils");
|
|
8
|
+
const create_account_1 = require("./create-account/index.cjs");
|
|
9
|
+
const export_account_1 = require("./export-account/index.cjs");
|
|
10
|
+
const account_1 = require("../../api/account.cjs");
|
|
11
|
+
const request_1 = require("../../api/request.cjs");
|
|
12
|
+
/**
|
|
13
|
+
* Keyring RPC methods used by the API.
|
|
14
|
+
*/
|
|
15
|
+
exports.KeyringRpcMethod = {
|
|
16
|
+
GetAccounts: 'keyring_getAccounts',
|
|
17
|
+
CreateAccounts: 'keyring_createAccounts',
|
|
18
|
+
// Inherited from v1 (but method signatures may differ...):
|
|
19
|
+
// NOTE: We use literals here to avoid circular dependencies.
|
|
20
|
+
GetAccount: 'keyring_getAccount',
|
|
21
|
+
DeleteAccount: 'keyring_deleteAccount',
|
|
22
|
+
ExportAccount: 'keyring_exportAccount',
|
|
23
|
+
SubmitRequest: 'keyring_submitRequest',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Check if a method is a keyring RPC method (v2).
|
|
27
|
+
*
|
|
28
|
+
* @param method - Method to check.
|
|
29
|
+
* @returns Whether the method is a keyring RPC method (v2).
|
|
30
|
+
*/
|
|
31
|
+
function isKeyringRpcMethod(method) {
|
|
32
|
+
return Object.values(exports.KeyringRpcMethod).includes(method);
|
|
33
|
+
}
|
|
34
|
+
// ----------------------------------------------------------------------------
|
|
35
|
+
const CommonHeader = {
|
|
36
|
+
jsonrpc: (0, superstruct_1.literal)('2.0'),
|
|
37
|
+
id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
|
|
38
|
+
};
|
|
39
|
+
// ----------------------------------------------------------------------------
|
|
40
|
+
// Get accounts
|
|
41
|
+
exports.GetAccountsRequestStruct = (0, keyring_utils_1.object)({
|
|
42
|
+
...CommonHeader,
|
|
43
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.GetAccounts}`),
|
|
44
|
+
});
|
|
45
|
+
exports.GetAccountsResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
|
|
46
|
+
// ----------------------------------------------------------------------------
|
|
47
|
+
// Get account
|
|
48
|
+
exports.GetAccountRequestStruct = (0, keyring_utils_1.object)({
|
|
49
|
+
...CommonHeader,
|
|
50
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.GetAccount}`),
|
|
51
|
+
params: (0, keyring_utils_1.object)({
|
|
52
|
+
id: keyring_utils_1.UuidStruct,
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
exports.GetAccountResponseStruct = account_1.KeyringAccountStruct;
|
|
56
|
+
// ----------------------------------------------------------------------------
|
|
57
|
+
// Create accounts
|
|
58
|
+
exports.CreateAccountsRequestStruct = (0, keyring_utils_1.object)({
|
|
59
|
+
...CommonHeader,
|
|
60
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.CreateAccounts}`),
|
|
61
|
+
params: create_account_1.CreateAccountOptionsStruct,
|
|
62
|
+
});
|
|
63
|
+
exports.CreateAccountsResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
|
|
64
|
+
// ----------------------------------------------------------------------------
|
|
65
|
+
// Delete account
|
|
66
|
+
exports.DeleteAccountRequestStruct = (0, keyring_utils_1.object)({
|
|
67
|
+
...CommonHeader,
|
|
68
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.DeleteAccount}`),
|
|
69
|
+
params: (0, keyring_utils_1.object)({
|
|
70
|
+
id: keyring_utils_1.UuidStruct,
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
|
|
74
|
+
// ----------------------------------------------------------------------------
|
|
75
|
+
// Export account
|
|
76
|
+
exports.ExportAccountRequestStruct = (0, keyring_utils_1.object)({
|
|
77
|
+
...CommonHeader,
|
|
78
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.ExportAccount}`),
|
|
79
|
+
params: (0, keyring_utils_1.object)({
|
|
80
|
+
id: keyring_utils_1.UuidStruct,
|
|
81
|
+
options: (0, keyring_utils_1.exactOptional)(export_account_1.ExportAccountOptionsStruct),
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
exports.ExportAccountResponseStruct = export_account_1.PrivateKeyExportedAccountStruct;
|
|
85
|
+
// ----------------------------------------------------------------------------
|
|
86
|
+
// Submit request
|
|
87
|
+
exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
|
|
88
|
+
...CommonHeader,
|
|
89
|
+
method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.SubmitRequest}`),
|
|
90
|
+
params: request_1.KeyringRequestStruct,
|
|
91
|
+
});
|
|
92
|
+
exports.SubmitRequestResponseStruct = utils_1.JsonStruct;
|
|
93
|
+
//# sourceMappingURL=keyring-rpc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":";;;AAqDA,gDAEC;AAvDD,2DAA4E;AAE5E,uDAA8E;AAC9E,2CAA6C;AAE7C,+DAA8D;AAC9D,+DAG0B;AAE1B,mDAAyD;AACzD,mDAAyD;AAezD;;GAEG;AACU,QAAA,gBAAgB,GAAG;IAC9B,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAQX;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,eAAe;AAEF,QAAA,wBAAwB,GAAG,IAAA,sBAAM,EAAC;IAC7C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,WAAW,EAAE,CAAC;CACnD,CAAC,CAAC;AAIU,QAAA,yBAAyB,GAAG,IAAA,mBAAK,EAAC,8BAAoB,CAAC,CAAC;AAIrE,+EAA+E;AAC/E,cAAc;AAED,QAAA,uBAAuB,GAAG,IAAA,sBAAM,EAAC;IAC5C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,UAAU,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,wBAAwB,GAAG,8BAAoB,CAAC;AAI7D,+EAA+E;AAC/E,kBAAkB;AAEL,QAAA,2BAA2B,GAAG,IAAA,sBAAM,EAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,cAAc,EAAE,CAAC;IACrD,MAAM,EAAE,2CAA0B;CACnC,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,mBAAK,EAAC,8BAAoB,CAAC,CAAC;AAIxE,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAIzD,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,OAAO,EAAE,IAAA,6BAAa,EAAC,2CAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,gDAA+B,CAAC;AAI3E,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,8BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,kBAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
|