@metamask-previews/keyring-internal-api 0.0.1-67f3b77 → 0.0.1-b85bfaa
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/dist/{internal/api.js → api.cjs} +2 -2
- package/dist/api.cjs.map +1 -0
- package/dist/{internal/api.d.ts → api.d.cts} +46 -41
- package/dist/api.d.cts.map +1 -0
- package/dist/api.d.mts +420 -0
- package/dist/api.d.mts.map +1 -0
- package/dist/api.mjs +135 -0
- package/dist/api.mjs.map +1 -0
- package/dist/btc/{index.js → index.cjs} +2 -2
- package/dist/btc/index.cjs.map +1 -0
- package/dist/btc/index.d.cts +2 -0
- package/dist/btc/index.d.cts.map +1 -0
- package/dist/btc/index.d.mts +2 -0
- package/dist/btc/index.d.mts.map +1 -0
- package/dist/btc/index.mjs +2 -0
- package/dist/btc/index.mjs.map +1 -0
- package/dist/btc/{types.js → types.cjs} +4 -4
- package/dist/btc/types.cjs.map +1 -0
- package/dist/btc/{types.d.ts → types.d.cts} +8 -7
- package/dist/btc/types.d.cts.map +1 -0
- package/dist/btc/types.d.mts +34 -0
- package/dist/btc/types.d.mts.map +1 -0
- package/dist/btc/types.mjs +37 -0
- package/dist/btc/types.mjs.map +1 -0
- package/dist/{internal/eth/EthKeyring.js → eth/EthKeyring.cjs} +1 -1
- package/dist/eth/EthKeyring.cjs.map +1 -0
- package/dist/{internal/eth/EthKeyring.d.ts → eth/EthKeyring.d.cts} +5 -4
- package/dist/eth/EthKeyring.d.cts.map +1 -0
- package/dist/eth/EthKeyring.d.mts +34 -0
- package/dist/eth/EthKeyring.d.mts.map +1 -0
- package/dist/eth/EthKeyring.mjs +2 -0
- package/dist/eth/EthKeyring.mjs.map +1 -0
- package/dist/eth/erc4337/{index.js → index.cjs} +2 -2
- package/dist/eth/erc4337/index.cjs.map +1 -0
- package/dist/eth/erc4337/index.d.cts +2 -0
- package/dist/eth/erc4337/index.d.cts.map +1 -0
- package/dist/eth/erc4337/index.d.mts +2 -0
- package/dist/eth/erc4337/index.d.mts.map +1 -0
- package/dist/eth/erc4337/index.mjs +2 -0
- package/dist/eth/erc4337/index.mjs.map +1 -0
- package/dist/eth/erc4337/{types.js → types.cjs} +2 -2
- package/dist/eth/erc4337/types.cjs.map +1 -0
- package/dist/eth/erc4337/{types.d.ts → types.d.cts} +7 -6
- package/dist/eth/erc4337/types.d.cts.map +1 -0
- package/dist/eth/erc4337/types.d.mts +98 -0
- package/dist/eth/erc4337/types.d.mts.map +1 -0
- package/dist/eth/erc4337/types.mjs +58 -0
- package/dist/eth/erc4337/types.mjs.map +1 -0
- package/dist/{index.js → eth/index.cjs} +4 -4
- package/dist/eth/index.cjs.map +1 -0
- package/dist/eth/index.d.cts +5 -0
- package/dist/eth/index.d.cts.map +1 -0
- package/dist/eth/index.d.mts +5 -0
- package/dist/eth/index.d.mts.map +1 -0
- package/dist/eth/index.mjs +4 -0
- package/dist/eth/index.mjs.map +1 -0
- package/dist/eth/{types.js → types.cjs} +2 -2
- package/dist/eth/types.cjs.map +1 -0
- package/dist/eth/{types.d.ts → types.d.cts} +6 -5
- package/dist/eth/types.d.cts.map +1 -0
- package/dist/eth/types.d.mts +81 -0
- package/dist/eth/types.d.mts.map +1 -0
- package/dist/eth/types.mjs +70 -0
- package/dist/eth/types.mjs.map +1 -0
- package/dist/eth/{utils.js → utils.cjs} +2 -3
- package/dist/eth/{utils.js.map → utils.cjs.map} +1 -1
- package/dist/eth/{utils.d.ts → utils.d.cts} +2 -1
- package/dist/eth/utils.d.cts.map +1 -0
- package/dist/eth/utils.d.mts +9 -0
- package/dist/eth/utils.d.mts.map +1 -0
- package/dist/eth/utils.mjs +11 -0
- package/dist/eth/utils.mjs.map +1 -0
- package/dist/{internal/events.js → events.cjs} +2 -2
- package/dist/events.cjs.map +1 -0
- package/dist/{internal/events.d.ts → events.d.cts} +11 -8
- package/dist/events.d.cts.map +1 -0
- package/dist/events.d.mts +172 -0
- package/dist/events.d.mts.map +1 -0
- package/dist/events.mjs +80 -0
- package/dist/events.mjs.map +1 -0
- package/dist/{eth/index.js → index.cjs} +8 -4
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{internal/rpc.js → rpc.cjs} +4 -4
- package/dist/rpc.cjs.map +1 -0
- package/dist/{internal/rpc.d.ts → rpc.d.cts} +1 -0
- package/dist/rpc.d.cts.map +1 -0
- package/dist/rpc.d.mts +26 -0
- package/dist/rpc.d.mts.map +1 -0
- package/dist/rpc.mjs +29 -0
- package/dist/rpc.mjs.map +1 -0
- package/dist/{internal/eth/index.js → sol/index.cjs} +2 -2
- package/dist/sol/index.cjs.map +1 -0
- package/dist/sol/index.d.cts +2 -0
- package/dist/sol/index.d.cts.map +1 -0
- package/dist/sol/index.d.mts +2 -0
- package/dist/sol/index.d.mts.map +1 -0
- package/dist/sol/index.mjs +2 -0
- package/dist/sol/index.mjs.map +1 -0
- package/dist/sol/types.cjs +36 -0
- package/dist/sol/types.cjs.map +1 -0
- package/dist/sol/types.d.cts +39 -0
- package/dist/sol/types.d.cts.map +1 -0
- package/dist/sol/types.d.mts +39 -0
- package/dist/sol/types.d.mts.map +1 -0
- package/dist/sol/types.mjs +33 -0
- package/dist/sol/types.mjs.map +1 -0
- package/dist/{internal/types.js → types.cjs} +26 -19
- package/dist/types.cjs.map +1 -0
- package/dist/{internal/types.d.ts → types.d.cts} +106 -44
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +392 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +53 -0
- package/dist/types.mjs.map +1 -0
- package/package.json +30 -18
- package/dist/btc/index.d.ts +0 -1
- package/dist/btc/index.js.map +0 -1
- package/dist/btc/types.js.map +0 -1
- package/dist/eth/erc4337/index.d.ts +0 -1
- package/dist/eth/erc4337/index.js.map +0 -1
- package/dist/eth/erc4337/types.js.map +0 -1
- package/dist/eth/index.d.ts +0 -3
- package/dist/eth/index.js.map +0 -1
- package/dist/eth/types.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js.map +0 -1
- package/dist/internal/api.js.map +0 -1
- package/dist/internal/eth/EthKeyring.js.map +0 -1
- package/dist/internal/eth/index.d.ts +0 -1
- package/dist/internal/eth/index.js.map +0 -1
- package/dist/internal/events.js.map +0 -1
- package/dist/internal/index.d.ts +0 -5
- package/dist/internal/index.js +0 -22
- package/dist/internal/index.js.map +0 -1
- package/dist/internal/rpc.js.map +0 -1
- package/dist/internal/types.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
export declare const EthBytesStruct: import("@metamask/superstruct").Struct<string, null>;
|
|
3
|
+
export declare const EthAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
|
4
|
+
export declare const EthUint256Struct: import("@metamask/superstruct").Struct<string, null>;
|
|
5
|
+
/**
|
|
6
|
+
* Supported Ethereum methods.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum EthMethod {
|
|
9
|
+
PersonalSign = "personal_sign",
|
|
10
|
+
Sign = "eth_sign",
|
|
11
|
+
SignTransaction = "eth_signTransaction",
|
|
12
|
+
SignTypedDataV1 = "eth_signTypedData_v1",
|
|
13
|
+
SignTypedDataV3 = "eth_signTypedData_v3",
|
|
14
|
+
SignTypedDataV4 = "eth_signTypedData_v4",
|
|
15
|
+
PrepareUserOperation = "eth_prepareUserOperation",
|
|
16
|
+
PatchUserOperation = "eth_patchUserOperation",
|
|
17
|
+
SignUserOperation = "eth_signUserOperation"
|
|
18
|
+
}
|
|
19
|
+
export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct<{
|
|
20
|
+
id: string;
|
|
21
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
22
|
+
type: "eip155:eoa";
|
|
23
|
+
address: string;
|
|
24
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
|
25
|
+
}, {
|
|
26
|
+
/**
|
|
27
|
+
* Account address.
|
|
28
|
+
*/
|
|
29
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
30
|
+
/**
|
|
31
|
+
* Account type.
|
|
32
|
+
*/
|
|
33
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa", "eip155:eoa">;
|
|
34
|
+
/**
|
|
35
|
+
* Account supported methods.
|
|
36
|
+
*/
|
|
37
|
+
methods: import("@metamask/superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("@metamask/superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
|
|
38
|
+
personal_sign: "personal_sign";
|
|
39
|
+
eth_sign: "eth_sign";
|
|
40
|
+
eth_signTransaction: "eth_signTransaction";
|
|
41
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
|
42
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
|
43
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
|
44
|
+
}>>;
|
|
45
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
46
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
47
|
+
}>;
|
|
48
|
+
export type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;
|
|
49
|
+
export declare const EthErc4337AccountStruct: import("@metamask/superstruct").Struct<{
|
|
50
|
+
id: string;
|
|
51
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
52
|
+
type: "eip155:erc4337";
|
|
53
|
+
address: string;
|
|
54
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
|
55
|
+
}, {
|
|
56
|
+
/**
|
|
57
|
+
* Account address.
|
|
58
|
+
*/
|
|
59
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
60
|
+
/**
|
|
61
|
+
* Account type.
|
|
62
|
+
*/
|
|
63
|
+
type: import("@metamask/superstruct").Struct<"eip155:erc4337", "eip155:erc4337">;
|
|
64
|
+
/**
|
|
65
|
+
* Account supported methods.
|
|
66
|
+
*/
|
|
67
|
+
methods: import("@metamask/superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[], import("@metamask/superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation", {
|
|
68
|
+
personal_sign: "personal_sign";
|
|
69
|
+
eth_sign: "eth_sign";
|
|
70
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
|
71
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
|
72
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
|
73
|
+
eth_prepareUserOperation: "eth_prepareUserOperation";
|
|
74
|
+
eth_patchUserOperation: "eth_patchUserOperation";
|
|
75
|
+
eth_signUserOperation: "eth_signUserOperation";
|
|
76
|
+
}>>;
|
|
77
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
78
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
79
|
+
}>;
|
|
80
|
+
export type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;
|
|
81
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAGnD,eAAO,MAAM,cAAc,sDAA+C,CAAC;AAE3E,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,kBAAkB;IAC9B,IAAI,aAAa;IACjB,eAAe,wBAAwB;IACvC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IAExC,oBAAoB,6BAA6B;IACjD,kBAAkB,2BAA2B;IAC7C,iBAAiB,0BAA0B;CAC5C;AAED,eAAO,MAAM,mBAAmB;;;;;;;IAG9B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;EAWH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;;;;;;IAGlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { EthAccountType, KeyringAccountStruct } from "@metamask/keyring-api";
|
|
2
|
+
import { object, definePattern } from "@metamask/keyring-utils";
|
|
3
|
+
import { array, enums, literal } from "@metamask/superstruct";
|
|
4
|
+
export const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);
|
|
5
|
+
export const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);
|
|
6
|
+
export const EthUint256Struct = definePattern('EthUint256', /^0x([1-9a-f][0-9a-f]*|0)$/iu);
|
|
7
|
+
/**
|
|
8
|
+
* Supported Ethereum methods.
|
|
9
|
+
*/
|
|
10
|
+
export var EthMethod;
|
|
11
|
+
(function (EthMethod) {
|
|
12
|
+
// General signing methods
|
|
13
|
+
EthMethod["PersonalSign"] = "personal_sign";
|
|
14
|
+
EthMethod["Sign"] = "eth_sign";
|
|
15
|
+
EthMethod["SignTransaction"] = "eth_signTransaction";
|
|
16
|
+
EthMethod["SignTypedDataV1"] = "eth_signTypedData_v1";
|
|
17
|
+
EthMethod["SignTypedDataV3"] = "eth_signTypedData_v3";
|
|
18
|
+
EthMethod["SignTypedDataV4"] = "eth_signTypedData_v4";
|
|
19
|
+
// ERC-4337 methods
|
|
20
|
+
EthMethod["PrepareUserOperation"] = "eth_prepareUserOperation";
|
|
21
|
+
EthMethod["PatchUserOperation"] = "eth_patchUserOperation";
|
|
22
|
+
EthMethod["SignUserOperation"] = "eth_signUserOperation";
|
|
23
|
+
})(EthMethod || (EthMethod = {}));
|
|
24
|
+
export const EthEoaAccountStruct = object({
|
|
25
|
+
...KeyringAccountStruct.schema,
|
|
26
|
+
/**
|
|
27
|
+
* Account address.
|
|
28
|
+
*/
|
|
29
|
+
address: EthAddressStruct,
|
|
30
|
+
/**
|
|
31
|
+
* Account type.
|
|
32
|
+
*/
|
|
33
|
+
type: literal(`${EthAccountType.Eoa}`),
|
|
34
|
+
/**
|
|
35
|
+
* Account supported methods.
|
|
36
|
+
*/
|
|
37
|
+
methods: array(enums([
|
|
38
|
+
`${EthMethod.PersonalSign}`,
|
|
39
|
+
`${EthMethod.Sign}`,
|
|
40
|
+
`${EthMethod.SignTransaction}`,
|
|
41
|
+
`${EthMethod.SignTypedDataV1}`,
|
|
42
|
+
`${EthMethod.SignTypedDataV3}`,
|
|
43
|
+
`${EthMethod.SignTypedDataV4}`,
|
|
44
|
+
])),
|
|
45
|
+
});
|
|
46
|
+
export const EthErc4337AccountStruct = object({
|
|
47
|
+
...KeyringAccountStruct.schema,
|
|
48
|
+
/**
|
|
49
|
+
* Account address.
|
|
50
|
+
*/
|
|
51
|
+
address: EthAddressStruct,
|
|
52
|
+
/**
|
|
53
|
+
* Account type.
|
|
54
|
+
*/
|
|
55
|
+
type: literal(`${EthAccountType.Erc4337}`),
|
|
56
|
+
/**
|
|
57
|
+
* Account supported methods.
|
|
58
|
+
*/
|
|
59
|
+
methods: array(enums([
|
|
60
|
+
`${EthMethod.PersonalSign}`,
|
|
61
|
+
`${EthMethod.Sign}`,
|
|
62
|
+
`${EthMethod.SignTypedDataV1}`,
|
|
63
|
+
`${EthMethod.SignTypedDataV3}`,
|
|
64
|
+
`${EthMethod.SignTypedDataV4}`,
|
|
65
|
+
`${EthMethod.PrepareUserOperation}`,
|
|
66
|
+
`${EthMethod.PatchUserOperation}`,
|
|
67
|
+
`${EthMethod.SignUserOperation}`,
|
|
68
|
+
])),
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,8BAA8B;AAC7E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,mBAAmB;IACnB,8DAAiD,CAAA;IACjD,0DAA6C,CAAA;IAC7C,wDAA2C,CAAA;AAC7C,CAAC,EAZW,SAAS,KAAT,SAAS,QAYpB;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;IACxC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC;IAEtC;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;KAC/B,CAAC,CACH;CACF,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;IAC5C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { EthAccountType, KeyringAccountStruct } from '@metamask/keyring-api';\nimport { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nexport const EthAddressStruct = definePattern(\n 'EthAddress',\n /^0x[0-9a-f]{40}$/iu,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isEvmAccountType =
|
|
3
|
+
exports.isEvmAccountType = isEvmAccountType;
|
|
4
4
|
const keyring_api_1 = require("@metamask/keyring-api");
|
|
5
5
|
/**
|
|
6
6
|
* Checks if the given type is an EVM account type.
|
|
@@ -11,5 +11,4 @@ const keyring_api_1 = require("@metamask/keyring-api");
|
|
|
11
11
|
function isEvmAccountType(type) {
|
|
12
12
|
return type === keyring_api_1.EthAccountType.Eoa || type === keyring_api_1.EthAccountType.Erc4337;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=utils.js.map
|
|
14
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.
|
|
1
|
+
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;AASA,4CAEC;AAVD,uDAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAwB;IACvD,OAAO,IAAI,KAAK,4BAAc,CAAC,GAAG,IAAI,IAAI,KAAK,4BAAc,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import type { KeyringAccountType } from '@metamask/keyring-api';\nimport { EthAccountType } from '@metamask/keyring-api';\n\n/**\n * Checks if the given type is an EVM account type.\n *\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: KeyringAccountType): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KeyringAccountType } from
|
|
1
|
+
import type { KeyringAccountType } from "@metamask/keyring-api";
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the given type is an EVM account type.
|
|
4
4
|
*
|
|
@@ -6,3 +6,4 @@ import type { KeyringAccountType } from '@metamask/keyring-api';
|
|
|
6
6
|
* @returns Returns true if the type is an EVM account type, false otherwise.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isEvmAccountType(type: KeyringAccountType): boolean;
|
|
9
|
+
//# sourceMappingURL=utils.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAA8B;AAGhE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KeyringAccountType } from "@metamask/keyring-api";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the given type is an EVM account type.
|
|
4
|
+
*
|
|
5
|
+
* @param type - The type to check.
|
|
6
|
+
* @returns Returns true if the type is an EVM account type, false otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isEvmAccountType(type: KeyringAccountType): boolean;
|
|
9
|
+
//# sourceMappingURL=utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAA8B;AAGhE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EthAccountType } from "@metamask/keyring-api";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the given type is an EVM account type.
|
|
4
|
+
*
|
|
5
|
+
* @param type - The type to check.
|
|
6
|
+
* @returns Returns true if the type is an EVM account type, false otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export function isEvmAccountType(type) {
|
|
9
|
+
return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,8BAA8B;AAEvD;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAwB;IACvD,OAAO,IAAI,KAAK,cAAc,CAAC,GAAG,IAAI,IAAI,KAAK,cAAc,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import type { KeyringAccountType } from '@metamask/keyring-api';\nimport { EthAccountType } from '@metamask/keyring-api';\n\n/**\n * Checks if the given type is an EVM account type.\n *\n * @param type - The type to check.\n * @returns Returns true if the type is an EVM account type, false otherwise.\n */\nexport function isEvmAccountType(type: KeyringAccountType): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
|
|
@@ -17,7 +17,7 @@ var KeyringEvent;
|
|
|
17
17
|
// Request events
|
|
18
18
|
KeyringEvent["RequestApproved"] = "notify:requestApproved";
|
|
19
19
|
KeyringEvent["RequestRejected"] = "notify:requestRejected";
|
|
20
|
-
})(KeyringEvent
|
|
20
|
+
})(KeyringEvent || (exports.KeyringEvent = KeyringEvent = {}));
|
|
21
21
|
exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
|
|
22
22
|
method: (0, superstruct_1.literal)(`${KeyringEvent.AccountCreated}`),
|
|
23
23
|
params: (0, keyring_utils_1.object)({
|
|
@@ -80,4 +80,4 @@ exports.RequestRejectedEventStruct = (0, keyring_utils_1.object)({
|
|
|
80
80
|
id: keyring_utils_1.UuidStruct,
|
|
81
81
|
}),
|
|
82
82
|
});
|
|
83
|
-
//# sourceMappingURL=events.
|
|
83
|
+
//# sourceMappingURL=events.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,uDAA6D;AAC7D,2DAA4E;AAC5E,uDAAiE;AACjE,2CAA6C;AAE7C;;GAEG;AACH,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,4BAAZ,YAAY,QASvB;AAEY,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,kCAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,IAAA,6BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,kCAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,0BAAU;QAEd;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { KeyringAccountStruct } from '@metamask/keyring-api';\nimport { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
|
|
@@ -13,7 +13,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
|
13
13
|
params: {
|
|
14
14
|
account: {
|
|
15
15
|
id: string;
|
|
16
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
16
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
17
17
|
address: string;
|
|
18
18
|
options: Record<string, import("@metamask/utils").Json>;
|
|
19
19
|
methods: string[];
|
|
@@ -26,7 +26,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
|
26
26
|
params: import("@metamask/superstruct").Struct<{
|
|
27
27
|
account: {
|
|
28
28
|
id: string;
|
|
29
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
29
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
30
30
|
address: string;
|
|
31
31
|
options: Record<string, import("@metamask/utils").Json>;
|
|
32
32
|
methods: string[];
|
|
@@ -39,16 +39,17 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
|
39
39
|
*/
|
|
40
40
|
account: import("@metamask/superstruct").Struct<{
|
|
41
41
|
id: string;
|
|
42
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
42
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
43
43
|
address: string;
|
|
44
44
|
options: Record<string, import("@metamask/utils").Json>;
|
|
45
45
|
methods: string[];
|
|
46
46
|
}, {
|
|
47
47
|
id: import("@metamask/superstruct").Struct<string, null>;
|
|
48
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
|
48
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
49
49
|
"eip155:eoa": "eip155:eoa";
|
|
50
50
|
"eip155:erc4337": "eip155:erc4337";
|
|
51
51
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
52
|
+
"solana:data-account": "solana:data-account";
|
|
52
53
|
}>;
|
|
53
54
|
address: import("@metamask/superstruct").Struct<string, null>;
|
|
54
55
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
@@ -74,7 +75,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
|
74
75
|
params: {
|
|
75
76
|
account: {
|
|
76
77
|
id: string;
|
|
77
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
78
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
78
79
|
address: string;
|
|
79
80
|
options: Record<string, import("@metamask/utils").Json>;
|
|
80
81
|
methods: string[];
|
|
@@ -85,7 +86,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
|
85
86
|
params: import("@metamask/superstruct").Struct<{
|
|
86
87
|
account: {
|
|
87
88
|
id: string;
|
|
88
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
89
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
89
90
|
address: string;
|
|
90
91
|
options: Record<string, import("@metamask/utils").Json>;
|
|
91
92
|
methods: string[];
|
|
@@ -96,16 +97,17 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
|
96
97
|
*/
|
|
97
98
|
account: import("@metamask/superstruct").Struct<{
|
|
98
99
|
id: string;
|
|
99
|
-
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
|
100
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
100
101
|
address: string;
|
|
101
102
|
options: Record<string, import("@metamask/utils").Json>;
|
|
102
103
|
methods: string[];
|
|
103
104
|
}, {
|
|
104
105
|
id: import("@metamask/superstruct").Struct<string, null>;
|
|
105
|
-
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
|
106
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
106
107
|
"eip155:eoa": "eip155:eoa";
|
|
107
108
|
"eip155:erc4337": "eip155:erc4337";
|
|
108
109
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
110
|
+
"solana:data-account": "solana:data-account";
|
|
109
111
|
}>;
|
|
110
112
|
address: import("@metamask/superstruct").Struct<string, null>;
|
|
111
113
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
@@ -167,3 +169,4 @@ export declare const RequestRejectedEventStruct: import("@metamask/superstruct")
|
|
|
167
169
|
id: import("@metamask/superstruct").Struct<string, null>;
|
|
168
170
|
}>;
|
|
169
171
|
}>;
|
|
172
|
+
//# sourceMappingURL=events.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;WAGG;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAGnC;;WAEG;;QAGH;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;QAGnC;;WAEG;;;EAGL,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported keyring events.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum KeyringEvent {
|
|
5
|
+
AccountCreated = "notify:accountCreated",
|
|
6
|
+
AccountUpdated = "notify:accountUpdated",
|
|
7
|
+
AccountDeleted = "notify:accountDeleted",
|
|
8
|
+
RequestApproved = "notify:requestApproved",
|
|
9
|
+
RequestRejected = "notify:requestRejected"
|
|
10
|
+
}
|
|
11
|
+
export declare const AccountCreatedEventStruct: import("@metamask/superstruct").Struct<{
|
|
12
|
+
method: "notify:accountCreated";
|
|
13
|
+
params: {
|
|
14
|
+
account: {
|
|
15
|
+
id: string;
|
|
16
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
17
|
+
address: string;
|
|
18
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
19
|
+
methods: string[];
|
|
20
|
+
};
|
|
21
|
+
accountNameSuggestion?: string;
|
|
22
|
+
displayConfirmation?: boolean;
|
|
23
|
+
};
|
|
24
|
+
}, {
|
|
25
|
+
method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
|
|
26
|
+
params: import("@metamask/superstruct").Struct<{
|
|
27
|
+
account: {
|
|
28
|
+
id: string;
|
|
29
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
30
|
+
address: string;
|
|
31
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
32
|
+
methods: string[];
|
|
33
|
+
};
|
|
34
|
+
accountNameSuggestion?: string;
|
|
35
|
+
displayConfirmation?: boolean;
|
|
36
|
+
}, {
|
|
37
|
+
/**
|
|
38
|
+
* New account object.
|
|
39
|
+
*/
|
|
40
|
+
account: import("@metamask/superstruct").Struct<{
|
|
41
|
+
id: string;
|
|
42
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
43
|
+
address: string;
|
|
44
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
45
|
+
methods: string[];
|
|
46
|
+
}, {
|
|
47
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
48
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
49
|
+
"eip155:eoa": "eip155:eoa";
|
|
50
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
51
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
52
|
+
"solana:data-account": "solana:data-account";
|
|
53
|
+
}>;
|
|
54
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
55
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
56
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Account name suggestion provided to the MetaMask client.
|
|
60
|
+
*
|
|
61
|
+
* The keyring can suggest a name for the account, but it's up to the
|
|
62
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
|
63
|
+
* client decides to use a different name.
|
|
64
|
+
*/
|
|
65
|
+
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
66
|
+
/**
|
|
67
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
68
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
69
|
+
*/
|
|
70
|
+
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
71
|
+
}>;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
|
74
|
+
method: "notify:accountUpdated";
|
|
75
|
+
params: {
|
|
76
|
+
account: {
|
|
77
|
+
id: string;
|
|
78
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
79
|
+
address: string;
|
|
80
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
81
|
+
methods: string[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
|
|
86
|
+
params: import("@metamask/superstruct").Struct<{
|
|
87
|
+
account: {
|
|
88
|
+
id: string;
|
|
89
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
90
|
+
address: string;
|
|
91
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
92
|
+
methods: string[];
|
|
93
|
+
};
|
|
94
|
+
}, {
|
|
95
|
+
/**
|
|
96
|
+
* Updated account object.
|
|
97
|
+
*/
|
|
98
|
+
account: import("@metamask/superstruct").Struct<{
|
|
99
|
+
id: string;
|
|
100
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
|
101
|
+
address: string;
|
|
102
|
+
options: Record<string, import("@metamask/utils").Json>;
|
|
103
|
+
methods: string[];
|
|
104
|
+
}, {
|
|
105
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
106
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account", {
|
|
107
|
+
"eip155:eoa": "eip155:eoa";
|
|
108
|
+
"eip155:erc4337": "eip155:erc4337";
|
|
109
|
+
"bip122:p2wpkh": "bip122:p2wpkh";
|
|
110
|
+
"solana:data-account": "solana:data-account";
|
|
111
|
+
}>;
|
|
112
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
|
113
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
114
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
115
|
+
}>;
|
|
116
|
+
}>;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
|
|
119
|
+
method: "notify:accountDeleted";
|
|
120
|
+
params: {
|
|
121
|
+
id: string;
|
|
122
|
+
};
|
|
123
|
+
}, {
|
|
124
|
+
method: import("@metamask/superstruct").Struct<"notify:accountDeleted", "notify:accountDeleted">;
|
|
125
|
+
params: import("@metamask/superstruct").Struct<{
|
|
126
|
+
id: string;
|
|
127
|
+
}, {
|
|
128
|
+
/**
|
|
129
|
+
* Deleted account ID.
|
|
130
|
+
*/
|
|
131
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
132
|
+
}>;
|
|
133
|
+
}>;
|
|
134
|
+
export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
|
|
135
|
+
method: "notify:requestApproved";
|
|
136
|
+
params: {
|
|
137
|
+
id: string;
|
|
138
|
+
result: import("@metamask/utils").Json;
|
|
139
|
+
};
|
|
140
|
+
}, {
|
|
141
|
+
method: import("@metamask/superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
|
|
142
|
+
params: import("@metamask/superstruct").Struct<{
|
|
143
|
+
id: string;
|
|
144
|
+
result: import("@metamask/utils").Json;
|
|
145
|
+
}, {
|
|
146
|
+
/**
|
|
147
|
+
* Request ID.
|
|
148
|
+
*/
|
|
149
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
150
|
+
/**
|
|
151
|
+
* Request result.
|
|
152
|
+
*/
|
|
153
|
+
result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
|
154
|
+
}>;
|
|
155
|
+
}>;
|
|
156
|
+
export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
|
|
157
|
+
method: "notify:requestRejected";
|
|
158
|
+
params: {
|
|
159
|
+
id: string;
|
|
160
|
+
};
|
|
161
|
+
}, {
|
|
162
|
+
method: import("@metamask/superstruct").Struct<"notify:requestRejected", "notify:requestRejected">;
|
|
163
|
+
params: import("@metamask/superstruct").Struct<{
|
|
164
|
+
id: string;
|
|
165
|
+
}, {
|
|
166
|
+
/**
|
|
167
|
+
* Request ID.
|
|
168
|
+
*/
|
|
169
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
|
170
|
+
}>;
|
|
171
|
+
}>;
|
|
172
|
+
//# sourceMappingURL=events.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;WAGG;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAGnC;;WAEG;;QAGH;;WAEG;;;EAGL,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;QAGnC;;WAEG;;;EAGL,CAAC"}
|
package/dist/events.mjs
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { KeyringAccountStruct } from "@metamask/keyring-api";
|
|
2
|
+
import { exactOptional, object, UuidStruct } from "@metamask/keyring-utils";
|
|
3
|
+
import { boolean, literal, string } from "@metamask/superstruct";
|
|
4
|
+
import { JsonStruct } from "@metamask/utils";
|
|
5
|
+
/**
|
|
6
|
+
* Supported keyring events.
|
|
7
|
+
*/
|
|
8
|
+
export var KeyringEvent;
|
|
9
|
+
(function (KeyringEvent) {
|
|
10
|
+
// Account events
|
|
11
|
+
KeyringEvent["AccountCreated"] = "notify:accountCreated";
|
|
12
|
+
KeyringEvent["AccountUpdated"] = "notify:accountUpdated";
|
|
13
|
+
KeyringEvent["AccountDeleted"] = "notify:accountDeleted";
|
|
14
|
+
// Request events
|
|
15
|
+
KeyringEvent["RequestApproved"] = "notify:requestApproved";
|
|
16
|
+
KeyringEvent["RequestRejected"] = "notify:requestRejected";
|
|
17
|
+
})(KeyringEvent || (KeyringEvent = {}));
|
|
18
|
+
export const AccountCreatedEventStruct = object({
|
|
19
|
+
method: literal(`${KeyringEvent.AccountCreated}`),
|
|
20
|
+
params: object({
|
|
21
|
+
/**
|
|
22
|
+
* New account object.
|
|
23
|
+
*/
|
|
24
|
+
account: KeyringAccountStruct,
|
|
25
|
+
/**
|
|
26
|
+
* Account name suggestion provided to the MetaMask client.
|
|
27
|
+
*
|
|
28
|
+
* The keyring can suggest a name for the account, but it's up to the
|
|
29
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
|
30
|
+
* client decides to use a different name.
|
|
31
|
+
*/
|
|
32
|
+
accountNameSuggestion: exactOptional(string()),
|
|
33
|
+
/**
|
|
34
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
|
35
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
|
36
|
+
*/
|
|
37
|
+
displayConfirmation: exactOptional(boolean()),
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
export const AccountUpdatedEventStruct = object({
|
|
41
|
+
method: literal(`${KeyringEvent.AccountUpdated}`),
|
|
42
|
+
params: object({
|
|
43
|
+
/**
|
|
44
|
+
* Updated account object.
|
|
45
|
+
*/
|
|
46
|
+
account: KeyringAccountStruct,
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
export const AccountDeletedEventStruct = object({
|
|
50
|
+
method: literal(`${KeyringEvent.AccountDeleted}`),
|
|
51
|
+
params: object({
|
|
52
|
+
/**
|
|
53
|
+
* Deleted account ID.
|
|
54
|
+
*/
|
|
55
|
+
id: UuidStruct,
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
export const RequestApprovedEventStruct = object({
|
|
59
|
+
method: literal(`${KeyringEvent.RequestApproved}`),
|
|
60
|
+
params: object({
|
|
61
|
+
/**
|
|
62
|
+
* Request ID.
|
|
63
|
+
*/
|
|
64
|
+
id: UuidStruct,
|
|
65
|
+
/**
|
|
66
|
+
* Request result.
|
|
67
|
+
*/
|
|
68
|
+
result: JsonStruct,
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
export const RequestRejectedEventStruct = object({
|
|
72
|
+
method: literal(`${KeyringEvent.RequestRejected}`),
|
|
73
|
+
params: object({
|
|
74
|
+
/**
|
|
75
|
+
* Request ID.
|
|
76
|
+
*/
|
|
77
|
+
id: UuidStruct,
|
|
78
|
+
}),
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=events.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,8BAA8B;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAC5E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AACjE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KAC9C,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;QAEd;;WAEG;QACH,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { KeyringAccountStruct } from '@metamask/keyring-api';\nimport { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n"]}
|
|
@@ -14,7 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
|
|
17
|
+
__exportStar(require("./btc/index.cjs"), exports);
|
|
18
|
+
__exportStar(require("./eth/index.cjs"), exports);
|
|
19
|
+
__exportStar(require("./sol/index.cjs"), exports);
|
|
20
|
+
__exportStar(require("./api.cjs"), exports);
|
|
21
|
+
__exportStar(require("./events.cjs"), exports);
|
|
22
|
+
__exportStar(require("./rpc.cjs"), exports);
|
|
23
|
+
__exportStar(require("./types.cjs"), exports);
|
|
24
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,kDAAsB;AACtB,kDAAsB;AACtB,4CAAsB;AACtB,+CAAyB;AACzB,4CAAsB;AACtB,8CAAwB","sourcesContent":["export * from './btc';\nexport * from './eth';\nexport * from './sol';\nexport * from './api';\nexport * from './events';\nexport * from './rpc';\nexport * from './types';\n"]}
|