@metamask/keyring-api 17.5.0 → 18.0.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.
@@ -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 scope (CAIP-2 chain ID).
27
- *
28
- * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.
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
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAiBnD,e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,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,15 +1,30 @@
1
1
  import { object } from "@metamask/keyring-utils";
2
- import { string, array, enums, refine, literal, size } from "@metamask/superstruct";
3
- import { bech32 } from "bech32";
4
- import { BtcAccountType, KeyringAccountStruct, CaipChainIdStruct } from "../api/index.mjs";
5
- export const BtcP2wpkhAddressStruct = refine(string(), 'BtcP2wpkhAddressStruct', (address) => {
2
+ import { string, array, enums, refine, literal, nonempty } from "@metamask/superstruct";
3
+ import { AddressType, getAddressInfo } from "bitcoin-address-validation";
4
+ import { BtcAccountType, CaipChainIdStruct, KeyringAccountStruct } from "../api/index.mjs";
5
+ const validateAddress = (address, type) => {
6
6
  try {
7
- bech32.decode(address);
7
+ const addressInfo = getAddressInfo(address);
8
+ if (addressInfo.type === type) {
9
+ return true;
10
+ }
11
+ return new Error(`Invalid ${type} address`);
8
12
  }
9
13
  catch (error) {
10
- return new Error(`Could not decode P2WPKH address: ${error.message}`);
14
+ return new Error(`Failed to decode ${type} address: ${error.message}`);
11
15
  }
12
- return true;
16
+ };
17
+ export const BtcP2pkhAddressStruct = refine(string(), 'BtcP2pkhAddressStruct', (address) => {
18
+ return validateAddress(address, AddressType.p2pkh);
19
+ });
20
+ export const BtcP2shAddressStruct = refine(string(), 'BtcP2shAddressStruct', (address) => {
21
+ return validateAddress(address, AddressType.p2sh);
22
+ });
23
+ export const BtcP2wpkhAddressStruct = refine(string(), 'BtcP2wpkhAddressStruct', (address) => {
24
+ return validateAddress(address, AddressType.p2wpkh);
25
+ });
26
+ export const BtcP2trAddressStruct = refine(string(), 'BtcP2trAddressStruct', (address) => {
27
+ return validateAddress(address, AddressType.p2tr);
13
28
  });
14
29
  /**
15
30
  * Supported Bitcoin methods.
@@ -19,25 +34,59 @@ export var BtcMethod;
19
34
  // General transaction methods
20
35
  BtcMethod["SendBitcoin"] = "sendBitcoin";
21
36
  })(BtcMethod || (BtcMethod = {}));
22
- export const BtcP2wpkhAccountStruct = object({
37
+ const BtcAccountStruct = object({
23
38
  ...KeyringAccountStruct.schema,
24
39
  /**
25
- * Account address.
40
+ * Account supported scopes (CAIP-2 chain ID).
41
+ */
42
+ scopes: nonempty(array(CaipChainIdStruct)),
43
+ /**
44
+ * Account supported methods.
45
+ */
46
+ methods: array(enums([`${BtcMethod.SendBitcoin}`])),
47
+ });
48
+ export const BtcP2pkhAccountStruct = object({
49
+ ...BtcAccountStruct.schema,
50
+ /**
51
+ * Account P2PKH address.
52
+ */
53
+ address: BtcP2pkhAddressStruct,
54
+ /**
55
+ * Account type.
56
+ */
57
+ type: literal(`${BtcAccountType.P2pkh}`),
58
+ });
59
+ export const BtcP2shAccountStruct = object({
60
+ ...BtcAccountStruct.schema,
61
+ /**
62
+ * Account P2SH address.
63
+ */
64
+ address: BtcP2shAddressStruct,
65
+ /**
66
+ * Account type.
67
+ */
68
+ type: literal(`${BtcAccountType.P2sh}`),
69
+ });
70
+ export const BtcP2wpkhAccountStruct = object({
71
+ ...BtcAccountStruct.schema,
72
+ /**
73
+ * Account P2WPKH address.
26
74
  */
27
75
  address: BtcP2wpkhAddressStruct,
28
76
  /**
29
77
  * Account type.
30
78
  */
31
79
  type: literal(`${BtcAccountType.P2wpkh}`),
80
+ });
81
+ export const BtcP2trAccountStruct = object({
82
+ ...BtcAccountStruct.schema,
32
83
  /**
33
- * Account supported scope (CAIP-2 chain ID).
34
- *
35
- * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.
84
+ * Account P2TR address.
36
85
  */
37
- scopes: size(array(CaipChainIdStruct), 1),
86
+ address: BtcP2trAddressStruct,
38
87
  /**
39
- * Account supported methods.
88
+ * Account type.
40
89
  */
41
- methods: array(enums([`${BtcMethod.SendBitcoin}`])),
90
+ type: literal(`${BtcAccountType.P2tr}`),
42
91
  });
43
92
  //# sourceMappingURL=types.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACL,8BAA8B;AAC/B,OAAO,EAAE,MAAM,EAAE,eAAe;AAEhC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EAClB,yBAAe;AAEhB,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,MAAM,EAAE,EACR,wBAAwB,EACxB,CAAC,OAAe,EAAE,EAAE;IAClB,IAAI,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAI,KAAK,CACd,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,wCAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,sBAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;IAEzC;;;;OAIG;IACH,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;CACpD,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 size,\n} from '@metamask/superstruct';\nimport { bech32 } from 'bech32';\n\nimport {\n BtcAccountType,\n KeyringAccountStruct,\n CaipChainIdStruct,\n} from '../api';\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n try {\n bech32.decode(address);\n } catch (error) {\n return new Error(\n `Could not decode P2WPKH address: ${(error as Error).message}`,\n );\n }\n return true;\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendBitcoin = 'sendBitcoin',\n}\n\nexport const BtcP2wpkhAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n\n /**\n * Account supported scope (CAIP-2 chain ID).\n *\n * NOTE: We consider a Bitcoin address to be valid on only 1 network at time.\n */\n scopes: size(array(CaipChainIdStruct), 1),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendBitcoin}`])),\n});\n\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACT,8BAA8B;AAC/B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mCAAmC;AAEzE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACrB,yBAAe;AAEhB,MAAM,eAAe,GAAG,CACtB,OAAe,EACf,IAAiB,EACA,EAAE;IACnB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CA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AAED,MAAM,gBAAgB,GAAG,MAAM,CAAC;IAC9B,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;CACpD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;IAC1C,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,qBAAqB;IAE9B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,oBAAoB;IAE7B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,sBAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;CAC1C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,GAAG,gBAAgB,CAAC,MAAM;IAE1B;;OAEG;IACH,OAAO,EAAE,oBAAoB;IAE7B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,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/events.d.cts CHANGED
@@ -16,7 +16,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
16
16
  method: "notify:accountCreated";
17
17
  params: {
18
18
  account: {
19
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
19
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
20
20
  id: string;
21
21
  options: Record<string, import("@metamask/utils").Json>;
22
22
  address: string;
@@ -34,7 +34,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
34
34
  method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
35
35
  params: import("@metamask/superstruct").Struct<{
36
36
  account: {
37
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
37
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
38
38
  id: string;
39
39
  options: Record<string, import("@metamask/utils").Json>;
40
40
  address: string;
@@ -57,7 +57,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
57
57
  * New account object.
58
58
  */
59
59
  account: import("@metamask/superstruct").Struct<{
60
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
60
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
61
61
  id: string;
62
62
  options: Record<string, import("@metamask/utils").Json>;
63
63
  address: string;
@@ -65,10 +65,13 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
65
65
  methods: string[];
66
66
  }, {
67
67
  id: import("@metamask/superstruct").Struct<string, null>;
68
- type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
68
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account", {
69
69
  "eip155:eoa": "eip155:eoa";
70
70
  "eip155:erc4337": "eip155:erc4337";
71
+ "bip122:p2pkh": "bip122:p2pkh";
72
+ "bip122:p2sh": "bip122:p2sh";
71
73
  "bip122:p2wpkh": "bip122:p2wpkh";
74
+ "bip122:p2tr": "bip122:p2tr";
72
75
  "solana:data-account": "solana:data-account";
73
76
  }>;
74
77
  address: import("@metamask/superstruct").Struct<string, null>;
@@ -107,7 +110,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
107
110
  method: "notify:accountUpdated";
108
111
  params: {
109
112
  account: {
110
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
113
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
111
114
  id: string;
112
115
  options: Record<string, import("@metamask/utils").Json>;
113
116
  address: string;
@@ -119,7 +122,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
119
122
  method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
120
123
  params: import("@metamask/superstruct").Struct<{
121
124
  account: {
122
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
125
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
123
126
  id: string;
124
127
  options: Record<string, import("@metamask/utils").Json>;
125
128
  address: string;
@@ -131,7 +134,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
131
134
  * Updated account object.
132
135
  */
133
136
  account: import("@metamask/superstruct").Struct<{
134
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
137
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
135
138
  id: string;
136
139
  options: Record<string, import("@metamask/utils").Json>;
137
140
  address: string;
@@ -139,10 +142,13 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
139
142
  methods: string[];
140
143
  }, {
141
144
  id: import("@metamask/superstruct").Struct<string, null>;
142
- type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
145
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account", {
143
146
  "eip155:eoa": "eip155:eoa";
144
147
  "eip155:erc4337": "eip155:erc4337";
148
+ "bip122:p2pkh": "bip122:p2pkh";
149
+ "bip122:p2sh": "bip122:p2sh";
145
150
  "bip122:p2wpkh": "bip122:p2wpkh";
151
+ "bip122:p2tr": "bip122:p2tr";
146
152
  "solana:data-account": "solana:data-account";
147
153
  }>;
148
154
  address: import("@metamask/superstruct").Struct<string, null>;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;IAG1C,sBAAsB,kCAAkC;IACxD,uBAAuB,mCAAmC;IAC1D,0BAA0B,sCAAsC;CACjE;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;;WAIG;;QAGH;;;;;;;WAOG;;;EAQL,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAGnC;;WAEG;;QAGH;;WAEG;;;EAGL,CAAC;AACH,MAAM,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,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC;AAEzC;;GAEG;AAEH,KAAK,aAAa,GACd,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,4BAA4B,GAC5B,2BAA2B,GAC3B,+BAA+B,GAC/B,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,YAAY,IAAI,OAAO,CACnE,aAAa,EAGb;IAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;CAAE,CACvB,CAAC,QAAQ,CAAC,CAAC"}
package/dist/events.d.mts CHANGED
@@ -16,7 +16,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
16
16
  method: "notify:accountCreated";
17
17
  params: {
18
18
  account: {
19
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
19
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
20
20
  id: string;
21
21
  options: Record<string, import("@metamask/utils").Json>;
22
22
  address: string;
@@ -34,7 +34,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
34
34
  method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
35
35
  params: import("@metamask/superstruct").Struct<{
36
36
  account: {
37
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
37
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
38
38
  id: string;
39
39
  options: Record<string, import("@metamask/utils").Json>;
40
40
  address: string;
@@ -57,7 +57,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
57
57
  * New account object.
58
58
  */
59
59
  account: import("@metamask/superstruct").Struct<{
60
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
60
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
61
61
  id: string;
62
62
  options: Record<string, import("@metamask/utils").Json>;
63
63
  address: string;
@@ -65,10 +65,13 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
65
65
  methods: string[];
66
66
  }, {
67
67
  id: import("@metamask/superstruct").Struct<string, null>;
68
- type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
68
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account", {
69
69
  "eip155:eoa": "eip155:eoa";
70
70
  "eip155:erc4337": "eip155:erc4337";
71
+ "bip122:p2pkh": "bip122:p2pkh";
72
+ "bip122:p2sh": "bip122:p2sh";
71
73
  "bip122:p2wpkh": "bip122:p2wpkh";
74
+ "bip122:p2tr": "bip122:p2tr";
72
75
  "solana:data-account": "solana:data-account";
73
76
  }>;
74
77
  address: import("@metamask/superstruct").Struct<string, null>;
@@ -107,7 +110,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
107
110
  method: "notify:accountUpdated";
108
111
  params: {
109
112
  account: {
110
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
113
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
111
114
  id: string;
112
115
  options: Record<string, import("@metamask/utils").Json>;
113
116
  address: string;
@@ -119,7 +122,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
119
122
  method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
120
123
  params: import("@metamask/superstruct").Struct<{
121
124
  account: {
122
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
125
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
123
126
  id: string;
124
127
  options: Record<string, import("@metamask/utils").Json>;
125
128
  address: string;
@@ -131,7 +134,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
131
134
  * Updated account object.
132
135
  */
133
136
  account: import("@metamask/superstruct").Struct<{
134
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
137
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account";
135
138
  id: string;
136
139
  options: Record<string, import("@metamask/utils").Json>;
137
140
  address: string;
@@ -139,10 +142,13 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
139
142
  methods: string[];
140
143
  }, {
141
144
  id: import("@metamask/superstruct").Struct<string, null>;
142
- type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
145
+ type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account", {
143
146
  "eip155:eoa": "eip155:eoa";
144
147
  "eip155:erc4337": "eip155:erc4337";
148
+ "bip122:p2pkh": "bip122:p2pkh";
149
+ "bip122:p2sh": "bip122:p2sh";
145
150
  "bip122:p2wpkh": "bip122:p2wpkh";
151
+ "bip122:p2tr": "bip122:p2tr";
146
152
  "solana:data-account": "solana:data-account";
147
153
  }>;
148
154
  address: import("@metam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