@metamask/keyring-api 17.5.0 → 17.6.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 +8 -1
- package/dist/api/account.cjs +6 -0
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +10 -4
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +10 -4
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +6 -0
- package/dist/api/account.mjs.map +1 -1
- package/dist/btc/types.cjs +63 -14
- package/dist/btc/types.cjs.map +1 -1
- package/dist/btc/types.d.cts +95 -4
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +95 -4
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/btc/types.mjs +64 -15
- package/dist/btc/types.mjs.map +1 -1
- package/dist/events.d.cts +14 -8
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +14 -8
- package/dist/events.d.mts.map +1 -1
- package/dist/rpc.d.cts +23 -11
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +23 -11
- package/dist/rpc.d.mts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [17.6.0]
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Add support for Bitcoin account type: p2pkh, p2sh, p2tr ([#284](https://github.com/MetaMask/accounts/pull/284))
|
15
|
+
|
10
16
|
## [17.5.0]
|
11
17
|
|
12
18
|
### Added
|
@@ -569,7 +575,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
569
575
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
570
576
|
- Helper functions to create keyring handler in the snap.
|
571
577
|
|
572
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.
|
578
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.6.0...HEAD
|
579
|
+
[17.6.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.5.0...@metamask/keyring-api@17.6.0
|
573
580
|
[17.5.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.4.0...@metamask/keyring-api@17.5.0
|
574
581
|
[17.4.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.3.0...@metamask/keyring-api@17.4.0
|
575
582
|
[17.3.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.1...@metamask/keyring-api@17.3.0
|
package/dist/api/account.cjs
CHANGED
@@ -18,7 +18,10 @@ var EthAccountType;
|
|
18
18
|
*/
|
19
19
|
var BtcAccountType;
|
20
20
|
(function (BtcAccountType) {
|
21
|
+
BtcAccountType["P2pkh"] = "bip122:p2pkh";
|
22
|
+
BtcAccountType["P2sh"] = "bip122:p2sh";
|
21
23
|
BtcAccountType["P2wpkh"] = "bip122:p2wpkh";
|
24
|
+
BtcAccountType["P2tr"] = "bip122:p2tr";
|
22
25
|
})(BtcAccountType || (exports.BtcAccountType = BtcAccountType = {}));
|
23
26
|
/**
|
24
27
|
* Supported Solana account types.
|
@@ -45,7 +48,10 @@ exports.KeyringAccountStruct = (0, keyring_utils_1.object)({
|
|
45
48
|
type: (0, superstruct_1.enums)([
|
46
49
|
`${EthAccountType.Eoa}`,
|
47
50
|
`${EthAccountType.Erc4337}`,
|
51
|
+
`${BtcAccountType.P2pkh}`,
|
52
|
+
`${BtcAccountType.P2sh}`,
|
48
53
|
`${BtcAccountType.P2wpkh}`,
|
54
|
+
`${BtcAccountType.P2tr}`,
|
49
55
|
`${SolAccountType.DataAccount}`,
|
50
56
|
]),
|
51
57
|
/**
|
package/dist/api/account.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.cjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AAAA,2DAAkE;AAElE,uDAA+E;AAC/E,2CAA6C;AAE7C,qCAA2C;AAE3C;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED;;GAEG;AACH,IAAY,
|
1
|
+
{"version":3,"file":"account.cjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AAAA,2DAAkE;AAElE,uDAA+E;AAC/E,2CAA6C;AAE7C,qCAA2C;AAE3C;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED;;GAEG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,wCAAsB,CAAA;IACtB,sCAAoB,CAAA;IACpB,0CAAwB,CAAA;IACxB,sCAAoB,CAAA;AACtB,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,qDAAmC,CAAA;AACrC,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AAcD;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,+BAAe;IAEnB;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,KAAK,EAAE;QACzB,GAAG,cAAc,CAAC,IAAI,EAAE;QACxB,GAAG,cAAc,CAAC,MAAM,EAAE;QAC1B,GAAG,cAAc,CAAC,IAAI,EAAE;QACxB,GAAG,cAAc,CAAC,WAAW,EAAE;KAChC,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,GAAE;IAEjB;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,wBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { AccountIdStruct, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { CaipChainIdStruct } from './caip';\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\n/**\n * Supported Bitcoin account types.\n */\nexport enum BtcAccountType {\n P2pkh = 'bip122:p2pkh',\n P2sh = 'bip122:p2sh',\n P2wpkh = 'bip122:p2wpkh',\n P2tr = 'bip122:p2tr',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2pkh}`\n | `${BtcAccountType.P2sh}`\n | `${BtcAccountType.P2wpkh}`\n | `${BtcAccountType.P2tr}`\n | `${SolAccountType.DataAccount}`;\n\n/**\n * A struct which represents a Keyring account object. It is abstract enough to\n * be used with any blockchain. Specific blockchain account types should extend\n * this struct.\n *\n * See {@link KeyringAccount}.\n */\nexport const KeyringAccountStruct = object({\n /**\n * Account ID (UUIDv4).\n */\n id: AccountIdStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account options.\n */\n options: record(string(), JsonStruct),\n\n /**\n * Account supported methods.\n */\n methods: array(string()),\n});\n\n/**\n * Keyring Account type represents an account and its properties from the\n * point of view of the keyring.\n */\nexport type KeyringAccount = Infer<typeof KeyringAccountStruct>;\n"]}
|
package/dist/api/account.d.cts
CHANGED
@@ -10,7 +10,10 @@ export declare enum EthAccountType {
|
|
10
10
|
* Supported Bitcoin account types.
|
11
11
|
*/
|
12
12
|
export declare enum BtcAccountType {
|
13
|
-
|
13
|
+
P2pkh = "bip122:p2pkh",
|
14
|
+
P2sh = "bip122:p2sh",
|
15
|
+
P2wpkh = "bip122:p2wpkh",
|
16
|
+
P2tr = "bip122:p2tr"
|
14
17
|
}
|
15
18
|
/**
|
16
19
|
* Supported Solana account types.
|
@@ -21,7 +24,7 @@ export declare enum SolAccountType {
|
|
21
24
|
/**
|
22
25
|
* Supported account types.
|
23
26
|
*/
|
24
|
-
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2wpkh}` | `${SolAccountType.DataAccount}`;
|
27
|
+
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}`;
|
25
28
|
/**
|
26
29
|
* A struct which represents a Keyring account object. It is abstract enough to
|
27
30
|
* be used with any blockchain. Specific blockchain account types should extend
|
@@ -30,7 +33,7 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
|
|
30
33
|
* See {@link KeyringAccount}.
|
31
34
|
*/
|
32
35
|
export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
|
33
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
36
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
|
34
37
|
id: string;
|
35
38
|
options: Record<string, import("@metamask/utils").Json>;
|
36
39
|
address: string;
|
@@ -44,10 +47,13 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
44
47
|
/**
|
45
48
|
* Account type.
|
46
49
|
*/
|
47
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
50
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account", {
|
48
51
|
"eip155:eoa": "eip155:eoa";
|
49
52
|
"eip155:erc4337": "eip155:erc4337";
|
53
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
54
|
+
"bip122:p2sh": "bip122:p2sh";
|
50
55
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
56
|
+
"bip122:p2tr": "bip122:p2tr";
|
51
57
|
"solana:data-account": "solana:data-account";
|
52
58
|
}>;
|
53
59
|
/**
|
@@ -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,MAAM,kBAAkB;
|
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,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,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;IAWH;;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
@@ -10,7 +10,10 @@ export declare enum EthAccountType {
|
|
10
10
|
* Supported Bitcoin account types.
|
11
11
|
*/
|
12
12
|
export declare enum BtcAccountType {
|
13
|
-
|
13
|
+
P2pkh = "bip122:p2pkh",
|
14
|
+
P2sh = "bip122:p2sh",
|
15
|
+
P2wpkh = "bip122:p2wpkh",
|
16
|
+
P2tr = "bip122:p2tr"
|
14
17
|
}
|
15
18
|
/**
|
16
19
|
* Supported Solana account types.
|
@@ -21,7 +24,7 @@ export declare enum SolAccountType {
|
|
21
24
|
/**
|
22
25
|
* Supported account types.
|
23
26
|
*/
|
24
|
-
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2wpkh}` | `${SolAccountType.DataAccount}`;
|
27
|
+
export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc4337}` | `${BtcAccountType.P2pkh}` | `${BtcAccountType.P2sh}` | `${BtcAccountType.P2wpkh}` | `${BtcAccountType.P2tr}` | `${SolAccountType.DataAccount}`;
|
25
28
|
/**
|
26
29
|
* A struct which represents a Keyring account object. It is abstract enough to
|
27
30
|
* be used with any blockchain. Specific blockchain account types should extend
|
@@ -30,7 +33,7 @@ export type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccountType.Erc
|
|
30
33
|
* See {@link KeyringAccount}.
|
31
34
|
*/
|
32
35
|
export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
|
33
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
36
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
|
34
37
|
id: string;
|
35
38
|
options: Record<string, import("@metamask/utils").Json>;
|
36
39
|
address: string;
|
@@ -44,10 +47,13 @@ export declare const KeyringAccountStruct: import("@metamask/superstruct").Struc
|
|
44
47
|
/**
|
45
48
|
* Account type.
|
46
49
|
*/
|
47
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
50
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account", {
|
48
51
|
"eip155:eoa": "eip155:eoa";
|
49
52
|
"eip155:erc4337": "eip155:erc4337";
|
53
|
+
"bip122:p2pkh": "bip122:p2pkh";
|
54
|
+
"bip122:p2sh": "bip122:p2sh";
|
50
55
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
56
|
+
"bip122:p2tr": "bip122:p2tr";
|
51
57
|
"solana:data-account": "solana:data-account";
|
52
58
|
}>;
|
53
59
|
/**
|
@@ -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,MAAM,kBAAkB;
|
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,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,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;;;;;;;;;IAWH;;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.mjs
CHANGED
@@ -15,7 +15,10 @@ export var EthAccountType;
|
|
15
15
|
*/
|
16
16
|
export var BtcAccountType;
|
17
17
|
(function (BtcAccountType) {
|
18
|
+
BtcAccountType["P2pkh"] = "bip122:p2pkh";
|
19
|
+
BtcAccountType["P2sh"] = "bip122:p2sh";
|
18
20
|
BtcAccountType["P2wpkh"] = "bip122:p2wpkh";
|
21
|
+
BtcAccountType["P2tr"] = "bip122:p2tr";
|
19
22
|
})(BtcAccountType || (BtcAccountType = {}));
|
20
23
|
/**
|
21
24
|
* Supported Solana account types.
|
@@ -42,7 +45,10 @@ export const KeyringAccountStruct = object({
|
|
42
45
|
type: enums([
|
43
46
|
`${EthAccountType.Eoa}`,
|
44
47
|
`${EthAccountType.Erc4337}`,
|
48
|
+
`${BtcAccountType.P2pkh}`,
|
49
|
+
`${BtcAccountType.P2sh}`,
|
45
50
|
`${BtcAccountType.P2wpkh}`,
|
51
|
+
`${BtcAccountType.P2tr}`,
|
46
52
|
`${SolAccountType.DataAccount}`,
|
47
53
|
]),
|
48
54
|
/**
|
package/dist/api/account.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.mjs","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gCAAgC;AAElE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAC/E,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAE3C;;GAEG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AA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AEjB;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import { AccountIdStruct, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { CaipChainIdStruct } from './caip';\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\n/**\n * Supported Bitcoin account types.\n */\nexport enum BtcAccountType {\n P2pkh = 'bip122:p2pkh',\n P2sh = 'bip122:p2sh',\n P2wpkh = 'bip122:p2wpkh',\n P2tr = 'bip122:p2tr',\n}\n\n/**\n * Supported Solana account types.\n */\nexport enum SolAccountType {\n DataAccount = 'solana:data-account',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2pkh}`\n | `${BtcAccountType.P2sh}`\n | `${BtcAccountType.P2wpkh}`\n | `${BtcAccountType.P2tr}`\n | `${SolAccountType.DataAccount}`;\n\n/**\n * A struct which represents a Keyring account object. It is abstract enough to\n * be used with any blockchain. Specific blockchain account types should extend\n * this struct.\n *\n * See {@link KeyringAccount}.\n */\nexport const KeyringAccountStruct = object({\n /**\n * Account ID (UUIDv4).\n */\n id: AccountIdStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2pkh}`,\n `${BtcAccountType.P2sh}`,\n `${BtcAccountType.P2wpkh}`,\n `${BtcAccountType.P2tr}`,\n `${SolAccountType.DataAccount}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account options.\n */\n options: record(string(), JsonStruct),\n\n /**\n * Account supported methods.\n */\n methods: array(string()),\n});\n\n/**\n * Keyring Account type represents an account and its properties from the\n * point of view of the keyring.\n */\nexport type KeyringAccount = Infer<typeof KeyringAccountStruct>;\n"]}
|
package/dist/btc/types.cjs
CHANGED
@@ -1,18 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.BtcP2wpkhAccountStruct = exports.BtcMethod = exports.BtcP2wpkhAddressStruct = void 0;
|
3
|
+
exports.BtcP2trAccountStruct = exports.BtcP2wpkhAccountStruct = exports.BtcP2shAccountStruct = exports.BtcP2pkhAccountStruct = exports.BtcMethod = exports.BtcP2trAddressStruct = exports.BtcP2wpkhAddressStruct = exports.BtcP2shAddressStruct = exports.BtcP2pkhAddressStruct = void 0;
|
4
4
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
5
5
|
const superstruct_1 = require("@metamask/superstruct");
|
6
|
-
const
|
6
|
+
const bitcoin_address_validation_1 = require("bitcoin-address-validation");
|
7
7
|
const api_1 = require("../api/index.cjs");
|
8
|
-
|
8
|
+
const validateAddress = (address, type) => {
|
9
9
|
try {
|
10
|
-
|
10
|
+
const addressInfo = (0, bitcoin_address_validation_1.getAddressInfo)(address);
|
11
|
+
if (addressInfo.type === type) {
|
12
|
+
return true;
|
13
|
+
}
|
14
|
+
return new Error(`Invalid ${type} address`);
|
11
15
|
}
|
12
16
|
catch (error) {
|
13
|
-
return new Error(`
|
17
|
+
return new Error(`Failed to decode ${type} address: ${error.message}`);
|
14
18
|
}
|
15
|
-
|
19
|
+
};
|
20
|
+
exports.BtcP2pkhAddressStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'BtcP2pkhAddressStruct', (address) => {
|
21
|
+
return validateAddress(address, bitcoin_address_validation_1.AddressType.p2pkh);
|
22
|
+
});
|
23
|
+
exports.BtcP2shAddressStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'BtcP2shAddressStruct', (address) => {
|
24
|
+
return validateAddress(address, bitcoin_address_validation_1.AddressType.p2sh);
|
25
|
+
});
|
26
|
+
exports.BtcP2wpkhAddressStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'BtcP2wpkhAddressStruct', (address) => {
|
27
|
+
return validateAddress(address, bitcoin_address_validation_1.AddressType.p2wpkh);
|
28
|
+
});
|
29
|
+
exports.BtcP2trAddressStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'BtcP2trAddressStruct', (address) => {
|
30
|
+
return validateAddress(address, bitcoin_address_validation_1.AddressType.p2tr);
|
16
31
|
});
|
17
32
|
/**
|
18
33
|
* Supported Bitcoin methods.
|
@@ -22,25 +37,59 @@ var BtcMethod;
|
|
22
37
|
// General transaction methods
|
23
38
|
BtcMethod["SendBitcoin"] = "sendBitcoin";
|
24
39
|
})(BtcMethod || (exports.BtcMethod = BtcMethod = {}));
|
25
|
-
|
40
|
+
const BtcAccountStruct = (0, keyring_utils_1.object)({
|
26
41
|
...api_1.KeyringAccountStruct.schema,
|
27
42
|
/**
|
28
|
-
* Account
|
43
|
+
* Account supported scopes (CAIP-2 chain ID).
|
44
|
+
*/
|
45
|
+
scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)(api_1.CaipChainIdStruct)),
|
46
|
+
/**
|
47
|
+
* Account supported methods.
|
48
|
+
*/
|
49
|
+
methods: (0, superstruct_1.array)((0, superstruct_1.enums)([`${BtcMethod.SendBitcoin}`])),
|
50
|
+
});
|
51
|
+
exports.BtcP2pkhAccountStruct = (0, keyring_utils_1.object)({
|
52
|
+
...BtcAccountStruct.schema,
|
53
|
+
/**
|
54
|
+
* Account P2PKH address.
|
55
|
+
*/
|
56
|
+
address: exports.BtcP2pkhAddressStruct,
|
57
|
+
/**
|
58
|
+
* Account type.
|
59
|
+
*/
|
60
|
+
type: (0, superstruct_1.literal)(`${api_1.BtcAccountType.P2pkh}`),
|
61
|
+
});
|
62
|
+
exports.BtcP2shAccountStruct = (0, keyring_utils_1.object)({
|
63
|
+
...BtcAccountStruct.schema,
|
64
|
+
/**
|
65
|
+
* Account P2SH address.
|
66
|
+
*/
|
67
|
+
address: exports.BtcP2shAddressStruct,
|
68
|
+
/**
|
69
|
+
* Account type.
|
70
|
+
*/
|
71
|
+
type: (0, superstruct_1.literal)(`${api_1.BtcAccountType.P2sh}`),
|
72
|
+
});
|
73
|
+
exports.BtcP2wpkhAccountStruct = (0, keyring_utils_1.object)({
|
74
|
+
...BtcAccountStruct.schema,
|
75
|
+
/**
|
76
|
+
* Account P2WPKH address.
|
29
77
|
*/
|
30
78
|
address: exports.BtcP2wpkhAddressStruct,
|
31
79
|
/**
|
32
80
|
* Account type.
|
33
81
|
*/
|
34
82
|
type: (0, superstruct_1.literal)(`${api_1.BtcAccountType.P2wpkh}`),
|
83
|
+
});
|
84
|
+
exports.BtcP2trAccountStruct = (0, keyring_utils_1.object)({
|
85
|
+
...BtcAccountStruct.schema,
|
35
86
|
/**
|
36
|
-
* Account
|
37
|
-
*
|
38
|
-
* NOTE: We consider a Bitcoin address to be valid on only 1 network at time.
|
87
|
+
* Account P2TR address.
|
39
88
|
*/
|
40
|
-
|
89
|
+
address: exports.BtcP2trAddressStruct,
|
41
90
|
/**
|
42
|
-
* Account
|
91
|
+
* Account type.
|
43
92
|
*/
|
44
|
-
|
93
|
+
type: (0, superstruct_1.literal)(`${api_1.BtcAccountType.P2tr}`),
|
45
94
|
});
|
46
95
|
//# sourceMappingURL=types.cjs.map
|
package/dist/btc/types.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAO+B;AAC/B,
|
1
|
+
{"version":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1C,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,4BAAoB;IAE7B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,IAAI,EAAE,CAAC;CACxC,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n array,\n enums,\n refine,\n literal,\n nonempty,\n} from '@metamask/superstruct';\nimport { AddressType, getAddressInfo } from 'bitcoin-address-validation';\n\nimport {\n BtcAccountType,\n CaipChainIdStruct,\n KeyringAccountStruct,\n} from '../api';\n\nconst validateAddress = (\n address: string,\n type: AddressType,\n): boolean | Error => {\n try {\n const addressInfo = getAddressInfo(address);\n if (addressInfo.type === type) {\n return true;\n }\n return new Error(`Invalid ${type} address`);\n } catch (error) {\n return new Error(\n `Failed to decode ${type} address: ${(error as Error).message}`,\n );\n }\n};\n\nexport const BtcP2pkhAddressStruct = refine(\n string(),\n 'BtcP2pkhAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2pkh);\n },\n);\n\nexport const BtcP2shAddressStruct = refine(\n string(),\n 'BtcP2shAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2sh);\n },\n);\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2wpkh);\n },\n);\n\nexport const BtcP2trAddressStruct = refine(\n string(),\n 'BtcP2trAddressStruct',\n (address: string) => {\n return validateAddress(address, AddressType.p2tr);\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendBitcoin = 'sendBitcoin',\n}\n\nconst BtcAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account supported scopes (CAIP-2 chain ID).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendBitcoin}`])),\n});\n\nexport const BtcP2pkhAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2PKH address.\n */\n address: BtcP2pkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2pkh}`),\n});\n\nexport const BtcP2shAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2SH address.\n */\n address: BtcP2shAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2sh}`),\n});\n\nexport const BtcP2wpkhAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2WPKH address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n});\n\nexport const BtcP2trAccountStruct = object({\n ...BtcAccountStruct.schema,\n\n /**\n * Account P2TR address.\n */\n address: BtcP2trAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2tr}`),\n});\n\nexport type BtcP2pkhAccount = Infer<typeof BtcP2pkhAccountStruct>;\nexport type BtcP2shAccount = Infer<typeof BtcP2shAccountStruct>;\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\nexport type BtcP2trAccount = Infer<typeof BtcP2trAccountStruct>;\n"]}
|
package/dist/btc/types.d.cts
CHANGED
@@ -1,11 +1,72 @@
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
2
|
+
export declare const BtcP2pkhAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
3
|
+
export declare const BtcP2shAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
2
4
|
export declare const BtcP2wpkhAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
5
|
+
export declare const BtcP2trAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
3
6
|
/**
|
4
7
|
* Supported Bitcoin methods.
|
5
8
|
*/
|
6
9
|
export declare enum BtcMethod {
|
7
10
|
SendBitcoin = "sendBitcoin"
|
8
11
|
}
|
12
|
+
export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Struct<{
|
13
|
+
type: "bip122:p2pkh";
|
14
|
+
id: string;
|
15
|
+
options: Record<string, import("@metamask/utils").Json>;
|
16
|
+
address: string;
|
17
|
+
scopes: `${string}:${string}`[];
|
18
|
+
methods: "sendBitcoin"[];
|
19
|
+
}, {
|
20
|
+
/**
|
21
|
+
* Account P2PKH address.
|
22
|
+
*/
|
23
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
24
|
+
/**
|
25
|
+
* Account type.
|
26
|
+
*/
|
27
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2pkh", "bip122:p2pkh">;
|
28
|
+
/**
|
29
|
+
* Account supported scopes (CAIP-2 chain ID).
|
30
|
+
*/
|
31
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
32
|
+
/**
|
33
|
+
* Account supported methods.
|
34
|
+
*/
|
35
|
+
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
|
36
|
+
sendBitcoin: "sendBitcoin";
|
37
|
+
}>>;
|
38
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
39
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
40
|
+
}>;
|
41
|
+
export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struct<{
|
42
|
+
type: "bip122:p2sh";
|
43
|
+
id: string;
|
44
|
+
options: Record<string, import("@metamask/utils").Json>;
|
45
|
+
address: string;
|
46
|
+
scopes: `${string}:${string}`[];
|
47
|
+
methods: "sendBitcoin"[];
|
48
|
+
}, {
|
49
|
+
/**
|
50
|
+
* Account P2SH address.
|
51
|
+
*/
|
52
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
53
|
+
/**
|
54
|
+
* Account type.
|
55
|
+
*/
|
56
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2sh", "bip122:p2sh">;
|
57
|
+
/**
|
58
|
+
* Account supported scopes (CAIP-2 chain ID).
|
59
|
+
*/
|
60
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
61
|
+
/**
|
62
|
+
* Account supported methods.
|
63
|
+
*/
|
64
|
+
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
|
65
|
+
sendBitcoin: "sendBitcoin";
|
66
|
+
}>>;
|
67
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
68
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
69
|
+
}>;
|
9
70
|
export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Struct<{
|
10
71
|
type: "bip122:p2wpkh";
|
11
72
|
id: string;
|
@@ -15,7 +76,7 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
|
|
15
76
|
methods: "sendBitcoin"[];
|
16
77
|
}, {
|
17
78
|
/**
|
18
|
-
* Account address.
|
79
|
+
* Account P2WPKH address.
|
19
80
|
*/
|
20
81
|
address: import("@metamask/superstruct").Struct<string, null>;
|
21
82
|
/**
|
@@ -23,9 +84,36 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
|
|
23
84
|
*/
|
24
85
|
type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
|
25
86
|
/**
|
26
|
-
* Account supported
|
27
|
-
|
28
|
-
|
87
|
+
* Account supported scopes (CAIP-2 chain ID).
|
88
|
+
*/
|
89
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
90
|
+
/**
|
91
|
+
* Account supported methods.
|
92
|
+
*/
|
93
|
+
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
|
94
|
+
sendBitcoin: "sendBitcoin";
|
95
|
+
}>>;
|
96
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
97
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
98
|
+
}>;
|
99
|
+
export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struct<{
|
100
|
+
type: "bip122:p2tr";
|
101
|
+
id: string;
|
102
|
+
options: Record<string, import("@metamask/utils").Json>;
|
103
|
+
address: string;
|
104
|
+
scopes: `${string}:${string}`[];
|
105
|
+
methods: "sendBitcoin"[];
|
106
|
+
}, {
|
107
|
+
/**
|
108
|
+
* Account P2TR address.
|
109
|
+
*/
|
110
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
111
|
+
/**
|
112
|
+
* Account type.
|
113
|
+
*/
|
114
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2tr", "bip122:p2tr">;
|
115
|
+
/**
|
116
|
+
* Account supported scopes (CAIP-2 chain ID).
|
29
117
|
*/
|
30
118
|
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
31
119
|
/**
|
@@ -37,5 +125,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
|
|
37
125
|
id: import("@metamask/superstruct").Struct<string, null>;
|
38
126
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
39
127
|
}>;
|
128
|
+
export type BtcP2pkhAccount = Infer<typeof BtcP2pkhAccountStruct>;
|
129
|
+
export type BtcP2shAccount = Infer<typeof BtcP2shAccountStruct>;
|
40
130
|
export type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;
|
131
|
+
export type BtcP2trAccount = Infer<typeof BtcP2trAccountStruct>;
|
41
132
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/btc/types.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAkCnD,eAAO,MAAM,qBAAqB,sDAMjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,sDAMlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAgBD,eAAO,MAAM,qBAAqB;;;;;;;;IAGhC;;OAEG;;IAGH;;OAEG;;IArBH;;OAEG;;IAGH;;OAEG;;;;;;EAgBH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAnCH;;OAEG;;IAGH;;OAEG;;;;;;EA8BH,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAjDH;;OAEG;;IAGH;;OAEG;;;;;;EA4CH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IA/DH;;OAEG;;IAGH;;OAEG;;;;;;EA0DH,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/btc/types.d.mts
CHANGED
@@ -1,11 +1,72 @@
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
2
|
+
export declare const BtcP2pkhAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
3
|
+
export declare const BtcP2shAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
2
4
|
export declare const BtcP2wpkhAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
5
|
+
export declare const BtcP2trAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
3
6
|
/**
|
4
7
|
* Supported Bitcoin methods.
|
5
8
|
*/
|
6
9
|
export declare enum BtcMethod {
|
7
10
|
SendBitcoin = "sendBitcoin"
|
8
11
|
}
|
12
|
+
export declare const BtcP2pkhAccountStruct: import("@metamask/superstruct").Struct<{
|
13
|
+
type: "bip122:p2pkh";
|
14
|
+
id: string;
|
15
|
+
options: Record<string, import("@metamask/utils").Json>;
|
16
|
+
address: string;
|
17
|
+
scopes: `${string}:${string}`[];
|
18
|
+
methods: "sendBitcoin"[];
|
19
|
+
}, {
|
20
|
+
/**
|
21
|
+
* Account P2PKH address.
|
22
|
+
*/
|
23
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
24
|
+
/**
|
25
|
+
* Account type.
|
26
|
+
*/
|
27
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2pkh", "bip122:p2pkh">;
|
28
|
+
/**
|
29
|
+
* Account supported scopes (CAIP-2 chain ID).
|
30
|
+
*/
|
31
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
32
|
+
/**
|
33
|
+
* Account supported methods.
|
34
|
+
*/
|
35
|
+
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
|
36
|
+
sendBitcoin: "sendBitcoin";
|
37
|
+
}>>;
|
38
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
39
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
40
|
+
}>;
|
41
|
+
export declare const BtcP2shAccountStruct: import("@metamask/superstruct").Struct<{
|
42
|
+
type: "bip122:p2sh";
|
43
|
+
id: string;
|
44
|
+
options: Record<string, import("@metamask/utils").Json>;
|
45
|
+
address: string;
|
46
|
+
scopes: `${string}:${string}`[];
|
47
|
+
methods: "sendBitcoin"[];
|
48
|
+
}, {
|
49
|
+
/**
|
50
|
+
* Account P2SH address.
|
51
|
+
*/
|
52
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
53
|
+
/**
|
54
|
+
* Account type.
|
55
|
+
*/
|
56
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2sh", "bip122:p2sh">;
|
57
|
+
/**
|
58
|
+
* Account supported scopes (CAIP-2 chain ID).
|
59
|
+
*/
|
60
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
61
|
+
/**
|
62
|
+
* Account supported methods.
|
63
|
+
*/
|
64
|
+
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
|
65
|
+
sendBitcoin: "sendBitcoin";
|
66
|
+
}>>;
|
67
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
68
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
69
|
+
}>;
|
9
70
|
export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Struct<{
|
10
71
|
type: "bip122:p2wpkh";
|
11
72
|
id: string;
|
@@ -15,7 +76,7 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
|
|
15
76
|
methods: "sendBitcoin"[];
|
16
77
|
}, {
|
17
78
|
/**
|
18
|
-
* Account address.
|
79
|
+
* Account P2WPKH address.
|
19
80
|
*/
|
20
81
|
address: import("@metamask/superstruct").Struct<string, null>;
|
21
82
|
/**
|
@@ -23,9 +84,36 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
|
|
23
84
|
*/
|
24
85
|
type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
|
25
86
|
/**
|
26
|
-
* Account supported
|
27
|
-
|
28
|
-
|
87
|
+
* Account supported scopes (CAIP-2 chain ID).
|
88
|
+
*/
|
89
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
90
|
+
/**
|
91
|
+
* Account supported methods.
|
92
|
+
*/
|
93
|
+
methods: import("@metamask/superstruct").Struct<"sendBitcoin"[], import("@metamask/superstruct").Struct<"sendBitcoin", {
|
94
|
+
sendBitcoin: "sendBitcoin";
|
95
|
+
}>>;
|
96
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
97
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
98
|
+
}>;
|
99
|
+
export declare const BtcP2trAccountStruct: import("@metamask/superstruct").Struct<{
|
100
|
+
type: "bip122:p2tr";
|
101
|
+
id: string;
|
102
|
+
options: Record<string, import("@metamask/utils").Json>;
|
103
|
+
address: string;
|
104
|
+
scopes: `${string}:${string}`[];
|
105
|
+
methods: "sendBitcoin"[];
|
106
|
+
}, {
|
107
|
+
/**
|
108
|
+
* Account P2TR address.
|
109
|
+
*/
|
110
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
111
|
+
/**
|
112
|
+
* Account type.
|
113
|
+
*/
|
114
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2tr", "bip122:p2tr">;
|
115
|
+
/**
|
116
|
+
* Account supported scopes (CAIP-2 chain ID).
|
29
117
|
*/
|
30
118
|
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
31
119
|
/**
|
@@ -37,5 +125,8 @@ export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Str
|
|
37
125
|
id: import("@metamask/superstruct").Struct<string, null>;
|
38
126
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
39
127
|
}>;
|
128
|
+
export type BtcP2pkhAccount = Infer<typeof BtcP2pkhAccountStruct>;
|
129
|
+
export type BtcP2shAccount = Infer<typeof BtcP2shAccountStruct>;
|
40
130
|
export type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;
|
131
|
+
export type BtcP2trAccount = Infer<typeof BtcP2trAccountStruct>;
|
41
132
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/btc/types.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAkCnD,eAAO,MAAM,qBAAqB,sDAMjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,sDAMlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,sDAMhC,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,WAAW,gBAAgB;CAC5B;AAgBD,eAAO,MAAM,qBAAqB;;;;;;;;IAGhC;;OAEG;;IAGH;;OAEG;;IArBH;;OAEG;;IAGH;;OAEG;;;;;;EAgBH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAnCH;;OAEG;;IAGH;;OAEG;;;;;;EA8BH,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;IAGjC;;OAEG;;IAGH;;OAEG;;IAjDH;;OAEG;;IAGH;;OAEG;;;;;;EA4CH,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IA/DH;;OAEG;;IAGH;;OAEG;;;;;;EA0DH,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|