@metamask/keyring-api 6.0.0 → 6.1.1
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 +24 -1
- package/dist/api.d.ts +49 -61
- package/dist/api.js +34 -50
- package/dist/api.js.map +1 -1
- package/dist/base-types.d.ts +62 -0
- package/dist/base-types.js +32 -0
- package/dist/base-types.js.map +1 -0
- package/dist/btc/index.d.ts +1 -0
- package/dist/btc/index.js +18 -0
- package/dist/btc/index.js.map +1 -0
- package/dist/btc/types.d.ts +36 -0
- package/dist/btc/types.js +42 -0
- package/dist/btc/types.js.map +1 -0
- package/dist/eth/erc4337/types.d.ts +1 -1
- package/dist/eth/index.d.ts +1 -0
- package/dist/eth/index.js +1 -0
- package/dist/eth/index.js.map +1 -1
- package/dist/eth/types.d.ts +83 -0
- package/dist/eth/types.js +76 -5
- package/dist/eth/types.js.map +1 -1
- package/dist/eth/utils.d.ts +7 -0
- package/dist/eth/utils.js +14 -0
- package/dist/eth/utils.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/api.d.ts +109 -101
- package/dist/internal/events.d.ts +92 -62
- package/dist/internal/types.d.ts +203 -25
- package/dist/internal/types.js +30 -3
- package/dist/internal/types.js.map +1 -1
- package/package.json +3 -2
package/dist/eth/types.d.ts
CHANGED
@@ -1,3 +1,86 @@
|
|
1
|
+
import type { Infer } from 'superstruct';
|
1
2
|
export declare const EthBytesStruct: import("superstruct").Struct<string, null>;
|
2
3
|
export declare const EthAddressStruct: import("superstruct").Struct<string, null>;
|
3
4
|
export declare const EthUint256Struct: import("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
|
+
}
|
16
|
+
/**
|
17
|
+
* Supported Ethereum methods for ERC-4337 (Account Abstraction) accounts.
|
18
|
+
*/
|
19
|
+
export declare enum EthErc4337Method {
|
20
|
+
PrepareUserOperation = "eth_prepareUserOperation",
|
21
|
+
PatchUserOperation = "eth_patchUserOperation",
|
22
|
+
SignUserOperation = "eth_signUserOperation"
|
23
|
+
}
|
24
|
+
/**
|
25
|
+
* Supported Ethereum account types.
|
26
|
+
*/
|
27
|
+
export declare enum EthAccountType {
|
28
|
+
Eoa = "eip155:eoa",
|
29
|
+
Erc4337 = "eip155:erc4337"
|
30
|
+
}
|
31
|
+
export declare const EthEoaAccountStruct: import("superstruct").Struct<{
|
32
|
+
type: "eip155:eoa";
|
33
|
+
id: string;
|
34
|
+
address: string;
|
35
|
+
options: Record<string, import("@metamask/utils").Json>;
|
36
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
37
|
+
}, {
|
38
|
+
/**
|
39
|
+
* Account type.
|
40
|
+
*/
|
41
|
+
type: import("superstruct").Struct<"eip155:eoa", "eip155:eoa">;
|
42
|
+
/**
|
43
|
+
* Account supported methods.
|
44
|
+
*/
|
45
|
+
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
|
46
|
+
personal_sign: "personal_sign";
|
47
|
+
eth_sign: "eth_sign";
|
48
|
+
eth_signTransaction: "eth_signTransaction";
|
49
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
50
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
51
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
52
|
+
}>>;
|
53
|
+
id: import("superstruct").Struct<string, null>;
|
54
|
+
address: import("superstruct").Struct<string, null>;
|
55
|
+
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
56
|
+
}>;
|
57
|
+
export declare type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;
|
58
|
+
export declare const EthErc4337AccountStruct: import("superstruct").Struct<{
|
59
|
+
type: "eip155:erc4337";
|
60
|
+
id: string;
|
61
|
+
address: string;
|
62
|
+
options: Record<string, import("@metamask/utils").Json>;
|
63
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
64
|
+
}, {
|
65
|
+
/**
|
66
|
+
* Account type.
|
67
|
+
*/
|
68
|
+
type: import("superstruct").Struct<"eip155:erc4337", "eip155:erc4337">;
|
69
|
+
/**
|
70
|
+
* Account supported methods.
|
71
|
+
*/
|
72
|
+
methods: import("superstruct").Struct<("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[], import("superstruct").Struct<"personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation", {
|
73
|
+
personal_sign: "personal_sign";
|
74
|
+
eth_sign: "eth_sign";
|
75
|
+
eth_signTypedData_v1: "eth_signTypedData_v1";
|
76
|
+
eth_signTypedData_v3: "eth_signTypedData_v3";
|
77
|
+
eth_signTypedData_v4: "eth_signTypedData_v4";
|
78
|
+
eth_prepareUserOperation: "eth_prepareUserOperation";
|
79
|
+
eth_patchUserOperation: "eth_patchUserOperation";
|
80
|
+
eth_signUserOperation: "eth_signUserOperation";
|
81
|
+
}>>;
|
82
|
+
id: import("superstruct").Struct<string, null>;
|
83
|
+
address: import("superstruct").Struct<string, null>;
|
84
|
+
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
85
|
+
}>;
|
86
|
+
export declare type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;
|
package/dist/eth/types.js
CHANGED
@@ -1,8 +1,79 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.EthUint256Struct = exports.EthAddressStruct = exports.EthBytesStruct = void 0;
|
4
|
-
const superstruct_1 = require("
|
5
|
-
|
6
|
-
|
7
|
-
exports.
|
3
|
+
exports.EthErc4337AccountStruct = exports.EthEoaAccountStruct = exports.EthAccountType = exports.EthErc4337Method = exports.EthMethod = exports.EthUint256Struct = exports.EthAddressStruct = exports.EthBytesStruct = void 0;
|
4
|
+
const superstruct_1 = require("superstruct");
|
5
|
+
const base_types_1 = require("../base-types");
|
6
|
+
const superstruct_2 = require("../superstruct");
|
7
|
+
exports.EthBytesStruct = (0, superstruct_2.definePattern)('EthBytes', /^0x[0-9a-f]*$/iu);
|
8
|
+
exports.EthAddressStruct = (0, superstruct_2.definePattern)('EthAddress', /^0x[0-9a-f]{40}$/iu);
|
9
|
+
exports.EthUint256Struct = (0, superstruct_2.definePattern)('EthUint256', /^0x([1-9a-f][0-9a-f]*|0)$/iu);
|
10
|
+
/**
|
11
|
+
* Supported Ethereum methods.
|
12
|
+
*/
|
13
|
+
var EthMethod;
|
14
|
+
(function (EthMethod) {
|
15
|
+
// General signing methods
|
16
|
+
EthMethod["PersonalSign"] = "personal_sign";
|
17
|
+
EthMethod["Sign"] = "eth_sign";
|
18
|
+
EthMethod["SignTransaction"] = "eth_signTransaction";
|
19
|
+
EthMethod["SignTypedDataV1"] = "eth_signTypedData_v1";
|
20
|
+
EthMethod["SignTypedDataV3"] = "eth_signTypedData_v3";
|
21
|
+
EthMethod["SignTypedDataV4"] = "eth_signTypedData_v4";
|
22
|
+
})(EthMethod = exports.EthMethod || (exports.EthMethod = {}));
|
23
|
+
/**
|
24
|
+
* Supported Ethereum methods for ERC-4337 (Account Abstraction) accounts.
|
25
|
+
*/
|
26
|
+
var EthErc4337Method;
|
27
|
+
(function (EthErc4337Method) {
|
28
|
+
// ERC-4337 methods
|
29
|
+
EthErc4337Method["PrepareUserOperation"] = "eth_prepareUserOperation";
|
30
|
+
EthErc4337Method["PatchUserOperation"] = "eth_patchUserOperation";
|
31
|
+
EthErc4337Method["SignUserOperation"] = "eth_signUserOperation";
|
32
|
+
})(EthErc4337Method = exports.EthErc4337Method || (exports.EthErc4337Method = {}));
|
33
|
+
/**
|
34
|
+
* Supported Ethereum account types.
|
35
|
+
*/
|
36
|
+
var EthAccountType;
|
37
|
+
(function (EthAccountType) {
|
38
|
+
EthAccountType["Eoa"] = "eip155:eoa";
|
39
|
+
EthAccountType["Erc4337"] = "eip155:erc4337";
|
40
|
+
})(EthAccountType = exports.EthAccountType || (exports.EthAccountType = {}));
|
41
|
+
exports.EthEoaAccountStruct = (0, superstruct_1.object)({
|
42
|
+
...base_types_1.BaseAccount,
|
43
|
+
/**
|
44
|
+
* Account type.
|
45
|
+
*/
|
46
|
+
type: (0, superstruct_1.literal)(`${EthAccountType.Eoa}`),
|
47
|
+
/**
|
48
|
+
* Account supported methods.
|
49
|
+
*/
|
50
|
+
methods: (0, superstruct_1.array)((0, superstruct_1.enums)([
|
51
|
+
`${EthMethod.PersonalSign}`,
|
52
|
+
`${EthMethod.Sign}`,
|
53
|
+
`${EthMethod.SignTransaction}`,
|
54
|
+
`${EthMethod.SignTypedDataV1}`,
|
55
|
+
`${EthMethod.SignTypedDataV3}`,
|
56
|
+
`${EthMethod.SignTypedDataV4}`,
|
57
|
+
])),
|
58
|
+
});
|
59
|
+
exports.EthErc4337AccountStruct = (0, superstruct_1.object)({
|
60
|
+
...base_types_1.BaseAccount,
|
61
|
+
/**
|
62
|
+
* Account type.
|
63
|
+
*/
|
64
|
+
type: (0, superstruct_1.literal)(`${EthAccountType.Erc4337}`),
|
65
|
+
/**
|
66
|
+
* Account supported methods.
|
67
|
+
*/
|
68
|
+
methods: (0, superstruct_1.array)((0, superstruct_1.enums)([
|
69
|
+
`${EthMethod.PersonalSign}`,
|
70
|
+
`${EthMethod.Sign}`,
|
71
|
+
`${EthMethod.SignTypedDataV1}`,
|
72
|
+
`${EthMethod.SignTypedDataV3}`,
|
73
|
+
`${EthMethod.SignTypedDataV4}`,
|
74
|
+
`${EthErc4337Method.PrepareUserOperation}`,
|
75
|
+
`${EthErc4337Method.PatchUserOperation}`,
|
76
|
+
`${EthErc4337Method.SignUserOperation}`,
|
77
|
+
])),
|
78
|
+
});
|
8
79
|
//# sourceMappingURL=types.js.map
|
package/dist/eth/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AACA,6CAA4D;AAE5D,8CAA4C;AAC5C,gDAA+C;AAElC,QAAA,cAAc,GAAG,IAAA,2BAAa,EAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE9D,QAAA,gBAAgB,GAAG,IAAA,2BAAa,EAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,2BAAa,EAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;AAC1C,CAAC,EARW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAQpB;AAED;;GAEG;AACH,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mBAAmB;IACnB,qEAAiD,CAAA;IACjD,iEAA6C,CAAA;IAC7C,+DAA2C,CAAA;AAC7C,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B;AAED;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAEY,QAAA,mBAAmB,GAAG,IAAA,oBAAM,EAAC;IACxC,GAAG,wBAAW;IAEd;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC;IAEtC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EACZ,IAAA,mBAAK,EAAC;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;AAIU,QAAA,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IAC5C,GAAG,wBAAW;IAEd;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EACZ,IAAA,mBAAK,EAAC;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,gBAAgB,CAAC,oBAAoB,EAAE;QAC1C,GAAG,gBAAgB,CAAC,kBAAkB,EAAE;QACxC,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;KACxC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import type { Infer } from 'superstruct';\nimport { object, array, enums, literal } from 'superstruct';\n\nimport { BaseAccount } from '../base-types';\nimport { definePattern } from '../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}\n\n/**\n * Supported Ethereum methods for ERC-4337 (Account Abstraction) accounts.\n */\nexport enum EthErc4337Method {\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\nexport const EthEoaAccountStruct = object({\n ...BaseAccount,\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 ...BaseAccount,\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 `${EthErc4337Method.PrepareUserOperation}`,\n `${EthErc4337Method.PatchUserOperation}`,\n `${EthErc4337Method.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { InternalAccountType } from '../internal';
|
2
|
+
/**
|
3
|
+
* Checks if the given type is an EVM account type.
|
4
|
+
* @param type - The type to check.
|
5
|
+
* @returns Returns true if the type is an EVM account type, false otherwise.
|
6
|
+
*/
|
7
|
+
export declare function isEvmAccountType(type: InternalAccountType | string): boolean;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isEvmAccountType = void 0;
|
4
|
+
const types_1 = require("./types");
|
5
|
+
/**
|
6
|
+
* Checks if the given type is an EVM account type.
|
7
|
+
* @param type - The type to check.
|
8
|
+
* @returns Returns true if the type is an EVM account type, false otherwise.
|
9
|
+
*/
|
10
|
+
function isEvmAccountType(type) {
|
11
|
+
return type === types_1.EthAccountType.Eoa || type === types_1.EthAccountType.Erc4337;
|
12
|
+
}
|
13
|
+
exports.isEvmAccountType = isEvmAccountType;
|
14
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;;AACA,mCAAyC;AAEzC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAkC;IACjE,OAAO,IAAI,KAAK,sBAAc,CAAC,GAAG,IAAI,IAAI,KAAK,sBAAc,CAAC,OAAO,CAAC;AACxE,CAAC;AAFD,4CAEC","sourcesContent":["import type { InternalAccountType } from '../internal';\nimport { EthAccountType } from './types';\n\n/**\n * Checks if the given type is an EVM account type.\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: InternalAccountType | string): boolean {\n return type === EthAccountType.Eoa || type === EthAccountType.Erc4337;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./api"), exports);
|
18
|
+
__exportStar(require("./btc"), exports);
|
18
19
|
__exportStar(require("./contexts"), exports);
|
19
20
|
__exportStar(require("./eth"), exports);
|
20
21
|
__exportStar(require("./events"), exports);
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,yDAAuC;AACvC,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B","sourcesContent":["export * from './api';\nexport * from './contexts';\nexport * from './eth';\nexport * from './events';\nexport * from './internal';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,yDAAuC;AACvC,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport * from './contexts';\nexport * from './eth';\nexport * from './events';\nexport * from './internal';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
|
package/dist/internal/api.d.ts
CHANGED
@@ -9,38 +9,43 @@ export declare const ListAccountsRequestStruct: import("superstruct").Struct<{
|
|
9
9
|
id: import("superstruct").Struct<string | number | null, null>;
|
10
10
|
}>;
|
11
11
|
export declare type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;
|
12
|
-
export declare const ListAccountsResponseStruct: import("superstruct").Struct<{
|
13
|
-
type: "
|
12
|
+
export declare const ListAccountsResponseStruct: import("superstruct").Struct<({
|
13
|
+
type: "bip122:p2wpkh";
|
14
14
|
id: string;
|
15
15
|
address: string;
|
16
16
|
options: Record<string, import("@metamask/utils").Json>;
|
17
|
-
methods:
|
18
|
-
}
|
19
|
-
type: "eip155:eoa"
|
17
|
+
methods: "btc_sendmany"[];
|
18
|
+
} | {
|
19
|
+
type: "eip155:eoa";
|
20
20
|
id: string;
|
21
21
|
address: string;
|
22
22
|
options: Record<string, import("@metamask/utils").Json>;
|
23
|
-
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4"
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
23
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
24
|
+
} | {
|
25
|
+
type: "eip155:erc4337";
|
26
|
+
id: string;
|
27
|
+
address: string;
|
28
|
+
options: Record<string, import("@metamask/utils").Json>;
|
29
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
30
|
+
})[], import("superstruct").Struct<{
|
31
|
+
type: "bip122:p2wpkh";
|
32
|
+
id: string;
|
33
|
+
address: string;
|
34
|
+
options: Record<string, import("@metamask/utils").Json>;
|
35
|
+
methods: "btc_sendmany"[];
|
36
|
+
} | {
|
37
|
+
type: "eip155:eoa";
|
38
|
+
id: string;
|
39
|
+
address: string;
|
40
|
+
options: Record<string, import("@metamask/utils").Json>;
|
41
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
42
|
+
} | {
|
43
|
+
type: "eip155:erc4337";
|
44
|
+
id: string;
|
45
|
+
address: string;
|
46
|
+
options: Record<string, import("@metamask/utils").Json>;
|
47
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
48
|
+
}, null>>;
|
44
49
|
export declare type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;
|
45
50
|
export declare const GetAccountRequestStruct: import("superstruct").Struct<{
|
46
51
|
jsonrpc: "2.0";
|
@@ -61,31 +66,24 @@ export declare const GetAccountRequestStruct: import("superstruct").Struct<{
|
|
61
66
|
}>;
|
62
67
|
export declare type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;
|
63
68
|
export declare const GetAccountResponseStruct: import("superstruct").Struct<{
|
64
|
-
type: "
|
69
|
+
type: "bip122:p2wpkh";
|
65
70
|
id: string;
|
66
71
|
address: string;
|
67
72
|
options: Record<string, import("@metamask/utils").Json>;
|
68
|
-
methods:
|
69
|
-
}
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
eth_signUserOperation: "eth_signUserOperation";
|
83
|
-
}>>;
|
84
|
-
type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337", {
|
85
|
-
"eip155:eoa": "eip155:eoa";
|
86
|
-
"eip155:erc4337": "eip155:erc4337";
|
87
|
-
}>;
|
88
|
-
}>;
|
73
|
+
methods: "btc_sendmany"[];
|
74
|
+
} | {
|
75
|
+
type: "eip155:eoa";
|
76
|
+
id: string;
|
77
|
+
address: string;
|
78
|
+
options: Record<string, import("@metamask/utils").Json>;
|
79
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
80
|
+
} | {
|
81
|
+
type: "eip155:erc4337";
|
82
|
+
id: string;
|
83
|
+
address: string;
|
84
|
+
options: Record<string, import("@metamask/utils").Json>;
|
85
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
86
|
+
}, null>;
|
89
87
|
export declare type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;
|
90
88
|
export declare const CreateAccountRequestStruct: import("superstruct").Struct<{
|
91
89
|
jsonrpc: "2.0";
|
@@ -106,31 +104,24 @@ export declare const CreateAccountRequestStruct: import("superstruct").Struct<{
|
|
106
104
|
}>;
|
107
105
|
export declare type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;
|
108
106
|
export declare const CreateAccountResponseStruct: import("superstruct").Struct<{
|
109
|
-
type: "
|
107
|
+
type: "bip122:p2wpkh";
|
110
108
|
id: string;
|
111
109
|
address: string;
|
112
110
|
options: Record<string, import("@metamask/utils").Json>;
|
113
|
-
methods:
|
114
|
-
}
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
eth_signUserOperation: "eth_signUserOperation";
|
128
|
-
}>>;
|
129
|
-
type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337", {
|
130
|
-
"eip155:eoa": "eip155:eoa";
|
131
|
-
"eip155:erc4337": "eip155:erc4337";
|
132
|
-
}>;
|
133
|
-
}>;
|
111
|
+
methods: "btc_sendmany"[];
|
112
|
+
} | {
|
113
|
+
type: "eip155:eoa";
|
114
|
+
id: string;
|
115
|
+
address: string;
|
116
|
+
options: Record<string, import("@metamask/utils").Json>;
|
117
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
118
|
+
} | {
|
119
|
+
type: "eip155:erc4337";
|
120
|
+
id: string;
|
121
|
+
address: string;
|
122
|
+
options: Record<string, import("@metamask/utils").Json>;
|
123
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
124
|
+
}, null>;
|
134
125
|
export declare type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;
|
135
126
|
export declare const FilterAccountChainsStruct: import("superstruct").Struct<{
|
136
127
|
jsonrpc: "2.0";
|
@@ -161,50 +152,67 @@ export declare const UpdateAccountRequestStruct: import("superstruct").Struct<{
|
|
161
152
|
method: "keyring_updateAccount";
|
162
153
|
params: {
|
163
154
|
account: {
|
164
|
-
type: "
|
155
|
+
type: "bip122:p2wpkh";
|
165
156
|
id: string;
|
166
157
|
address: string;
|
167
158
|
options: Record<string, import("@metamask/utils").Json>;
|
168
|
-
methods:
|
159
|
+
methods: "btc_sendmany"[];
|
160
|
+
} | {
|
161
|
+
type: "eip155:eoa";
|
162
|
+
id: string;
|
163
|
+
address: string;
|
164
|
+
options: Record<string, import("@metamask/utils").Json>;
|
165
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
166
|
+
} | {
|
167
|
+
type: "eip155:erc4337";
|
168
|
+
id: string;
|
169
|
+
address: string;
|
170
|
+
options: Record<string, import("@metamask/utils").Json>;
|
171
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
169
172
|
};
|
170
173
|
};
|
171
174
|
}, {
|
172
175
|
method: import("superstruct").Struct<"keyring_updateAccount", "keyring_updateAccount">;
|
173
176
|
params: import("superstruct").Struct<{
|
174
177
|
account: {
|
175
|
-
type: "
|
178
|
+
type: "bip122:p2wpkh";
|
179
|
+
id: string;
|
180
|
+
address: string;
|
181
|
+
options: Record<string, import("@metamask/utils").Json>;
|
182
|
+
methods: "btc_sendmany"[];
|
183
|
+
} | {
|
184
|
+
type: "eip155:eoa";
|
185
|
+
id: string;
|
186
|
+
address: string;
|
187
|
+
options: Record<string, import("@metamask/utils").Json>;
|
188
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
189
|
+
} | {
|
190
|
+
type: "eip155:erc4337";
|
176
191
|
id: string;
|
177
192
|
address: string;
|
178
193
|
options: Record<string, import("@metamask/utils").Json>;
|
179
|
-
methods: ("personal_sign" | "eth_sign" | "
|
194
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
180
195
|
};
|
181
196
|
}, {
|
182
197
|
account: import("superstruct").Struct<{
|
183
|
-
type: "
|
198
|
+
type: "bip122:p2wpkh";
|
184
199
|
id: string;
|
185
200
|
address: string;
|
186
201
|
options: Record<string, import("@metamask/utils").Json>;
|
187
|
-
methods:
|
188
|
-
}
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
eth_signUserOperation: "eth_signUserOperation";
|
202
|
-
}>>;
|
203
|
-
type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337", {
|
204
|
-
"eip155:eoa": "eip155:eoa";
|
205
|
-
"eip155:erc4337": "eip155:erc4337";
|
206
|
-
}>;
|
207
|
-
}>;
|
202
|
+
methods: "btc_sendmany"[];
|
203
|
+
} | {
|
204
|
+
type: "eip155:eoa";
|
205
|
+
id: string;
|
206
|
+
address: string;
|
207
|
+
options: Record<string, import("@metamask/utils").Json>;
|
208
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
209
|
+
} | {
|
210
|
+
type: "eip155:erc4337";
|
211
|
+
id: string;
|
212
|
+
address: string;
|
213
|
+
options: Record<string, import("@metamask/utils").Json>;
|
214
|
+
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
215
|
+
}, null>;
|
208
216
|
}>;
|
209
217
|
jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
|
210
218
|
id: import("superstruct").Struct<string | number | null, null>;
|
@@ -264,16 +272,16 @@ export declare const ListRequestsRequestStruct: import("superstruct").Struct<{
|
|
264
272
|
export declare type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;
|
265
273
|
export declare const ListRequestsResponseStruct: import("superstruct").Struct<{
|
266
274
|
id: string;
|
267
|
-
scope: string;
|
268
275
|
account: string;
|
276
|
+
scope: string;
|
269
277
|
request: {
|
270
278
|
method: string;
|
271
279
|
params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
|
272
280
|
};
|
273
281
|
}[], import("superstruct").Struct<{
|
274
282
|
id: string;
|
275
|
-
scope: string;
|
276
283
|
account: string;
|
284
|
+
scope: string;
|
277
285
|
request: {
|
278
286
|
method: string;
|
279
287
|
params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
|
@@ -311,8 +319,8 @@ export declare const GetRequestRequestStruct: import("superstruct").Struct<{
|
|
311
319
|
export declare type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;
|
312
320
|
export declare const GetRequestResponseStruct: import("superstruct").Struct<{
|
313
321
|
id: string;
|
314
|
-
scope: string;
|
315
322
|
account: string;
|
323
|
+
scope: string;
|
316
324
|
request: {
|
317
325
|
method: string;
|
318
326
|
params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
|
@@ -336,8 +344,8 @@ export declare const SubmitRequestRequestStruct: import("superstruct").Struct<{
|
|
336
344
|
method: "keyring_submitRequest";
|
337
345
|
params: {
|
338
346
|
id: string;
|
339
|
-
scope: string;
|
340
347
|
account: string;
|
348
|
+
scope: string;
|
341
349
|
request: {
|
342
350
|
method: string;
|
343
351
|
params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
|
@@ -347,8 +355,8 @@ export declare const SubmitRequestRequestStruct: import("superstruct").Struct<{
|
|
347
355
|
method: import("superstruct").Struct<"keyring_submitRequest", "keyring_submitRequest">;
|
348
356
|
params: import("superstruct").Struct<{
|
349
357
|
id: string;
|
350
|
-
scope: string;
|
351
358
|
account: string;
|
359
|
+
scope: string;
|
352
360
|
request: {
|
353
361
|
method: string;
|
354
362
|
params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
|