@metamask/keyring-api 11.1.0 → 12.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.
- package/CHANGELOG.md +14 -1
- package/dist/api/account.cjs +3 -4
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +1 -1
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +1 -1
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +1 -2
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/asset.cjs +5 -6
- package/dist/api/asset.cjs.map +1 -1
- package/dist/api/asset.d.cts +2 -2
- package/dist/api/asset.d.cts.map +1 -1
- package/dist/api/asset.d.mts +2 -2
- package/dist/api/asset.d.mts.map +1 -1
- package/dist/api/asset.mjs +1 -2
- package/dist/api/asset.mjs.map +1 -1
- package/dist/api/balance.cjs +3 -4
- package/dist/api/balance.cjs.map +1 -1
- package/dist/api/balance.d.cts.map +1 -1
- package/dist/api/balance.d.mts.map +1 -1
- package/dist/api/balance.mjs +1 -2
- package/dist/api/balance.mjs.map +1 -1
- package/dist/api/caip.cjs +3 -3
- package/dist/api/caip.cjs.map +1 -1
- package/dist/api/caip.d.cts.map +1 -1
- package/dist/api/caip.d.mts.map +1 -1
- package/dist/api/caip.mjs +1 -1
- package/dist/api/caip.mjs.map +1 -1
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -0
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs +2 -0
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +1 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +1 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs +2 -0
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/{utils → api}/pagination.cjs +3 -3
- package/dist/api/pagination.cjs.map +1 -0
- package/dist/{utils → api}/pagination.d.cts +1 -1
- package/dist/api/pagination.d.cts.map +1 -0
- package/dist/{utils → api}/pagination.d.mts +1 -1
- package/dist/api/pagination.d.mts.map +1 -0
- package/dist/{utils → api}/pagination.mjs +1 -1
- package/dist/api/pagination.mjs.map +1 -0
- package/dist/api/request.cjs +6 -7
- package/dist/api/request.cjs.map +1 -1
- package/dist/api/request.d.cts +5 -5
- package/dist/api/request.d.cts.map +1 -1
- package/dist/api/request.d.mts +5 -5
- package/dist/api/request.d.mts.map +1 -1
- package/dist/api/request.mjs +1 -2
- package/dist/api/request.mjs.map +1 -1
- package/dist/api/response.cjs +6 -6
- package/dist/api/response.cjs.map +1 -1
- package/dist/api/response.d.cts +1 -1
- package/dist/api/response.d.cts.map +1 -1
- package/dist/api/response.d.mts +1 -1
- package/dist/api/response.d.mts.map +1 -1
- package/dist/api/response.mjs +1 -1
- package/dist/api/response.mjs.map +1 -1
- package/dist/api/transaction.cjs +7 -8
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +65 -65
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +65 -65
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +1 -2
- package/dist/api/transaction.mjs.map +1 -1
- package/dist/btc/types.cjs +2 -2
- package/dist/btc/types.cjs.map +1 -1
- package/dist/btc/types.d.cts +1 -1
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +1 -1
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/btc/types.mjs +2 -2
- package/dist/btc/types.mjs.map +1 -1
- package/dist/eth/erc4337/types.cjs +10 -11
- package/dist/eth/erc4337/types.cjs.map +1 -1
- package/dist/eth/erc4337/types.d.cts +5 -5
- package/dist/eth/erc4337/types.d.cts.map +1 -1
- package/dist/eth/erc4337/types.d.mts +5 -5
- package/dist/eth/erc4337/types.d.mts.map +1 -1
- package/dist/eth/erc4337/types.mjs +1 -2
- package/dist/eth/erc4337/types.mjs.map +1 -1
- package/dist/eth/types.cjs +6 -6
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +2 -2
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +2 -2
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +1 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/eth/utils.cjs.map +1 -1
- package/dist/eth/utils.d.cts.map +1 -1
- package/dist/eth/utils.d.mts.map +1 -1
- package/dist/eth/utils.mjs.map +1 -1
- package/dist/events.cjs +67 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +161 -0
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +161 -0
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +66 -0
- package/dist/events.mjs.map +1 -1
- package/dist/index.cjs +2 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{internal/api.cjs → rpc.cjs} +71 -42
- package/dist/rpc.cjs.map +1 -0
- package/dist/{internal/api.d.cts → rpc.d.cts} +130 -104
- package/dist/rpc.d.cts.map +1 -0
- package/dist/{internal/api.d.mts → rpc.d.mts} +130 -104
- package/dist/rpc.d.mts.map +1 -0
- package/dist/{internal/api.mjs → rpc.mjs} +33 -5
- package/dist/rpc.mjs.map +1 -0
- package/dist/sol/types.cjs +3 -3
- package/dist/sol/types.cjs.map +1 -1
- package/dist/sol/types.d.cts +1 -1
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +1 -1
- package/dist/sol/types.d.mts.map +1 -1
- package/dist/sol/types.mjs +1 -1
- package/dist/sol/types.mjs.map +1 -1
- package/package.json +10 -13
- package/dist/JsonRpcRequest.cjs +0 -13
- package/dist/JsonRpcRequest.cjs.map +0 -1
- package/dist/JsonRpcRequest.d.cts +0 -17
- package/dist/JsonRpcRequest.d.cts.map +0 -1
- package/dist/JsonRpcRequest.d.mts +0 -17
- package/dist/JsonRpcRequest.d.mts.map +0 -1
- package/dist/JsonRpcRequest.mjs +0 -10
- package/dist/JsonRpcRequest.mjs.map +0 -1
- package/dist/KeyringClient.cjs +0 -130
- package/dist/KeyringClient.cjs.map +0 -1
- package/dist/KeyringClient.d.cts +0 -31
- package/dist/KeyringClient.d.cts.map +0 -1
- package/dist/KeyringClient.d.mts +0 -31
- package/dist/KeyringClient.d.mts.map +0 -1
- package/dist/KeyringClient.mjs +0 -126
- package/dist/KeyringClient.mjs.map +0 -1
- package/dist/KeyringSnapRpcClient.cjs +0 -68
- package/dist/KeyringSnapRpcClient.cjs.map +0 -1
- package/dist/KeyringSnapRpcClient.d.cts +0 -40
- package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
- package/dist/KeyringSnapRpcClient.d.mts +0 -40
- package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
- package/dist/KeyringSnapRpcClient.mjs +0 -63
- package/dist/KeyringSnapRpcClient.mjs.map +0 -1
- package/dist/internal/api.cjs.map +0 -1
- package/dist/internal/api.d.cts.map +0 -1
- package/dist/internal/api.d.mts.map +0 -1
- package/dist/internal/api.mjs.map +0 -1
- package/dist/internal/eth/EthKeyring.cjs +0 -3
- package/dist/internal/eth/EthKeyring.cjs.map +0 -1
- package/dist/internal/eth/EthKeyring.d.cts +0 -34
- package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
- package/dist/internal/eth/EthKeyring.d.mts +0 -34
- package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
- package/dist/internal/eth/EthKeyring.mjs +0 -2
- package/dist/internal/eth/EthKeyring.mjs.map +0 -1
- package/dist/internal/eth/index.cjs +0 -3
- package/dist/internal/eth/index.cjs.map +0 -1
- package/dist/internal/eth/index.d.cts +0 -2
- package/dist/internal/eth/index.d.cts.map +0 -1
- package/dist/internal/eth/index.d.mts +0 -2
- package/dist/internal/eth/index.d.mts.map +0 -1
- package/dist/internal/eth/index.mjs +0 -2
- package/dist/internal/eth/index.mjs.map +0 -1
- package/dist/internal/events.cjs +0 -72
- package/dist/internal/events.cjs.map +0 -1
- package/dist/internal/events.d.cts +0 -162
- package/dist/internal/events.d.cts.map +0 -1
- package/dist/internal/events.d.mts +0 -162
- package/dist/internal/events.d.mts.map +0 -1
- package/dist/internal/events.mjs +0 -69
- package/dist/internal/events.mjs.map +0 -1
- package/dist/internal/index.cjs +0 -21
- package/dist/internal/index.cjs.map +0 -1
- package/dist/internal/index.d.cts +0 -6
- package/dist/internal/index.d.cts.map +0 -1
- package/dist/internal/index.d.mts +0 -6
- package/dist/internal/index.d.mts.map +0 -1
- package/dist/internal/index.mjs +0 -5
- package/dist/internal/index.mjs.map +0 -1
- package/dist/internal/rpc.cjs +0 -34
- package/dist/internal/rpc.cjs.map +0 -1
- package/dist/internal/rpc.d.cts +0 -27
- package/dist/internal/rpc.d.cts.map +0 -1
- package/dist/internal/rpc.d.mts +0 -27
- package/dist/internal/rpc.d.mts.map +0 -1
- package/dist/internal/rpc.mjs +0 -30
- package/dist/internal/rpc.mjs.map +0 -1
- package/dist/internal/types.cjs +0 -52
- package/dist/internal/types.cjs.map +0 -1
- package/dist/internal/types.d.cts +0 -392
- package/dist/internal/types.d.cts.map +0 -1
- package/dist/internal/types.d.mts +0 -392
- package/dist/internal/types.d.mts.map +0 -1
- package/dist/internal/types.mjs +0 -49
- package/dist/internal/types.mjs.map +0 -1
- package/dist/rpc-handler.cjs +0 -143
- package/dist/rpc-handler.cjs.map +0 -1
- package/dist/rpc-handler.d.cts +0 -30
- package/dist/rpc-handler.d.cts.map +0 -1
- package/dist/rpc-handler.d.mts +0 -30
- package/dist/rpc-handler.d.mts.map +0 -1
- package/dist/rpc-handler.mjs +0 -138
- package/dist/rpc-handler.mjs.map +0 -1
- package/dist/snap-utils.cjs +0 -20
- package/dist/snap-utils.cjs.map +0 -1
- package/dist/snap-utils.d.cts +0 -12
- package/dist/snap-utils.d.cts.map +0 -1
- package/dist/snap-utils.d.mts +0 -12
- package/dist/snap-utils.d.mts.map +0 -1
- package/dist/snap-utils.mjs +0 -17
- package/dist/snap-utils.mjs.map +0 -1
- package/dist/superstruct.cjs +0 -109
- package/dist/superstruct.cjs.map +0 -1
- package/dist/superstruct.d.cts +0 -102
- package/dist/superstruct.d.cts.map +0 -1
- package/dist/superstruct.d.mts +0 -102
- package/dist/superstruct.d.mts.map +0 -1
- package/dist/superstruct.mjs +0 -102
- package/dist/superstruct.mjs.map +0 -1
- package/dist/utils/index.cjs +0 -20
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.d.cts +0 -4
- package/dist/utils/index.d.cts.map +0 -1
- package/dist/utils/index.d.mts +0 -4
- package/dist/utils/index.d.mts.map +0 -1
- package/dist/utils/index.mjs +0 -4
- package/dist/utils/index.mjs.map +0 -1
- package/dist/utils/pagination.cjs.map +0 -1
- package/dist/utils/pagination.d.cts.map +0 -1
- package/dist/utils/pagination.d.mts.map +0 -1
- package/dist/utils/pagination.mjs.map +0 -1
- package/dist/utils/types.cjs +0 -29
- package/dist/utils/types.cjs.map +0 -1
- package/dist/utils/types.d.cts +0 -42
- package/dist/utils/types.d.cts.map +0 -1
- package/dist/utils/types.d.mts +0 -42
- package/dist/utils/types.d.mts.map +0 -1
- package/dist/utils/types.mjs +0 -26
- package/dist/utils/types.mjs.map +0 -1
- package/dist/utils/typing.cjs +0 -20
- package/dist/utils/typing.cjs.map +0 -1
- package/dist/utils/typing.d.cts +0 -33
- package/dist/utils/typing.d.cts.map +0 -1
- package/dist/utils/typing.d.mts +0 -33
- package/dist/utils/typing.d.mts.map +0 -1
- package/dist/utils/typing.mjs +0 -17
- package/dist/utils/typing.mjs.map +0 -1
@@ -1,15 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.EthUserOperationPatchStruct = exports.EthBaseUserOperationStruct = exports.EthBaseTransactionStruct = exports.EthUserOperationStruct = void 0;
|
4
|
-
const
|
5
|
-
const utils_1 = require("../../utils/index.cjs");
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
6
5
|
const types_1 = require("../types.cjs");
|
7
6
|
/**
|
8
7
|
* Struct of a UserOperation as defined by ERC-4337.
|
9
8
|
*
|
10
9
|
* @see https://eips.ethereum.org/EIPS/eip-4337#definitions
|
11
10
|
*/
|
12
|
-
exports.EthUserOperationStruct = (0,
|
11
|
+
exports.EthUserOperationStruct = (0, keyring_utils_1.object)({
|
13
12
|
sender: types_1.EthAddressStruct,
|
14
13
|
nonce: types_1.EthUint256Struct,
|
15
14
|
initCode: types_1.EthBytesStruct,
|
@@ -26,7 +25,7 @@ exports.EthUserOperationStruct = (0, superstruct_1.object)({
|
|
26
25
|
* Struct containing the most basic transaction information required to
|
27
26
|
* construct a UserOperation.
|
28
27
|
*/
|
29
|
-
exports.EthBaseTransactionStruct = (0,
|
28
|
+
exports.EthBaseTransactionStruct = (0, keyring_utils_1.object)({
|
30
29
|
/**
|
31
30
|
* Address of the transaction recipient.
|
32
31
|
*/
|
@@ -40,23 +39,23 @@ exports.EthBaseTransactionStruct = (0, superstruct_1.object)({
|
|
40
39
|
*/
|
41
40
|
data: types_1.EthBytesStruct,
|
42
41
|
});
|
43
|
-
exports.EthBaseUserOperationStruct = (0,
|
42
|
+
exports.EthBaseUserOperationStruct = (0, keyring_utils_1.object)({
|
44
43
|
nonce: types_1.EthUint256Struct,
|
45
44
|
initCode: types_1.EthBytesStruct,
|
46
45
|
callData: types_1.EthBytesStruct,
|
47
|
-
gasLimits: (0,
|
46
|
+
gasLimits: (0, keyring_utils_1.exactOptional)((0, keyring_utils_1.object)({
|
48
47
|
callGasLimit: types_1.EthUint256Struct,
|
49
48
|
verificationGasLimit: types_1.EthUint256Struct,
|
50
49
|
preVerificationGas: types_1.EthUint256Struct,
|
51
50
|
})),
|
52
51
|
dummyPaymasterAndData: types_1.EthBytesStruct,
|
53
52
|
dummySignature: types_1.EthBytesStruct,
|
54
|
-
bundlerUrl:
|
53
|
+
bundlerUrl: keyring_utils_1.UrlStruct,
|
55
54
|
});
|
56
|
-
exports.EthUserOperationPatchStruct = (0,
|
55
|
+
exports.EthUserOperationPatchStruct = (0, keyring_utils_1.object)({
|
57
56
|
paymasterAndData: types_1.EthBytesStruct,
|
58
|
-
callGasLimit: (0,
|
59
|
-
verificationGasLimit: (0,
|
60
|
-
preVerificationGas: (0,
|
57
|
+
callGasLimit: (0, keyring_utils_1.exactOptional)(types_1.EthUint256Struct),
|
58
|
+
verificationGasLimit: (0, keyring_utils_1.exactOptional)(types_1.EthUint256Struct),
|
59
|
+
preVerificationGas: (0, keyring_utils_1.exactOptional)(types_1.EthUint256Struct),
|
61
60
|
});
|
62
61
|
//# sourceMappingURL=types.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":";;;AAAA,2DAA2E;AAG3E,wCAA8E;AAE9E;;;;GAIG;AACU,QAAA,sBAAsB,GAAG,IAAA,sBAAM,EAAC;IAC3C,MAAM,EAAE,wBAAgB;IACxB,KAAK,EAAE,wBAAgB;IACvB,QAAQ,EAAE,sBAAc;IACxB,QAAQ,EAAE,sBAAc;IACxB,YAAY,EAAE,wBAAgB;IAC9B,oBAAoB,EAAE,wBAAgB;IACtC,kBAAkB,EAAE,wBAAgB;IACpC,YAAY,EAAE,wBAAgB;IAC9B,oBAAoB,EAAE,wBAAgB;IACtC,gBAAgB,EAAE,sBAAc;IAChC,SAAS,EAAE,sBAAc;CAC1B,CAAC,CAAC;AAIH;;;GAGG;AACU,QAAA,wBAAwB,GAAG,IAAA,sBAAM,EAAC;IAC7C;;OAEG;IACH,EAAE,EAAE,wBAAgB;IAEpB;;OAEG;IACH,KAAK,EAAE,wBAAgB;IAEvB;;OAEG;IACH,IAAI,EAAE,sBAAc;CACrB,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,KAAK,EAAE,wBAAgB;IACvB,QAAQ,EAAE,sBAAc;IACxB,QAAQ,EAAE,sBAAc;IACxB,SAAS,EAAE,IAAA,6BAAa,EACtB,IAAA,sBAAM,EAAC;QACL,YAAY,EAAE,wBAAgB;QAC9B,oBAAoB,EAAE,wBAAgB;QACtC,kBAAkB,EAAE,wBAAgB;KACrC,CAAC,CACH;IACD,qBAAqB,EAAE,sBAAc;IACrC,cAAc,EAAE,sBAAc;IAC9B,UAAU,EAAE,yBAAS;CACtB,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,sBAAM,EAAC;IAChD,gBAAgB,EAAE,sBAAc;IAChC,YAAY,EAAE,IAAA,6BAAa,EAAC,wBAAgB,CAAC;IAC7C,oBAAoB,EAAE,IAAA,6BAAa,EAAC,wBAAgB,CAAC;IACrD,kBAAkB,EAAE,IAAA,6BAAa,EAAC,wBAAgB,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UrlStruct } from '@metamask/keyring-utils';\nimport { type Infer } from '@metamask/superstruct';\n\nimport { EthAddressStruct, EthBytesStruct, EthUint256Struct } from '../types';\n\n/**\n * Struct of a UserOperation as defined by ERC-4337.\n *\n * @see https://eips.ethereum.org/EIPS/eip-4337#definitions\n */\nexport const EthUserOperationStruct = object({\n sender: EthAddressStruct,\n nonce: EthUint256Struct,\n initCode: EthBytesStruct,\n callData: EthBytesStruct,\n callGasLimit: EthUint256Struct,\n verificationGasLimit: EthUint256Struct,\n preVerificationGas: EthUint256Struct,\n maxFeePerGas: EthUint256Struct,\n maxPriorityFeePerGas: EthUint256Struct,\n paymasterAndData: EthBytesStruct,\n signature: EthBytesStruct,\n});\n\nexport type EthUserOperation = Infer<typeof EthUserOperationStruct>;\n\n/**\n * Struct containing the most basic transaction information required to\n * construct a UserOperation.\n */\nexport const EthBaseTransactionStruct = object({\n /**\n * Address of the transaction recipient.\n */\n to: EthAddressStruct,\n\n /**\n * Amount of wei to transfer to the recipient.\n */\n value: EthUint256Struct,\n\n /**\n * Data to pass to the recipient.\n */\n data: EthBytesStruct,\n});\n\nexport type EthBaseTransaction = Infer<typeof EthBaseTransactionStruct>;\n\nexport const EthBaseUserOperationStruct = object({\n nonce: EthUint256Struct,\n initCode: EthBytesStruct,\n callData: EthBytesStruct,\n gasLimits: exactOptional(\n object({\n callGasLimit: EthUint256Struct,\n verificationGasLimit: EthUint256Struct,\n preVerificationGas: EthUint256Struct,\n }),\n ),\n dummyPaymasterAndData: EthBytesStruct,\n dummySignature: EthBytesStruct,\n bundlerUrl: UrlStruct,\n});\n\nexport type EthBaseUserOperation = Infer<typeof EthBaseUserOperationStruct>;\n\nexport const EthUserOperationPatchStruct = object({\n paymasterAndData: EthBytesStruct,\n callGasLimit: exactOptional(EthUint256Struct),\n verificationGasLimit: exactOptional(EthUint256Struct),\n preVerificationGas: exactOptional(EthUint256Struct),\n});\n\nexport type EthUserOperationPatch = Infer<typeof EthUserOperationPatchStruct>;\n"]}
|
@@ -36,8 +36,8 @@ export type EthUserOperation = Infer<typeof EthUserOperationStruct>;
|
|
36
36
|
*/
|
37
37
|
export declare const EthBaseTransactionStruct: import("@metamask/superstruct").Struct<{
|
38
38
|
value: string;
|
39
|
-
to: string;
|
40
39
|
data: string;
|
40
|
+
to: string;
|
41
41
|
}, {
|
42
42
|
/**
|
43
43
|
* Address of the transaction recipient.
|
@@ -69,7 +69,7 @@ export declare const EthBaseUserOperationStruct: import("@metamask/superstruct")
|
|
69
69
|
nonce: import("@metamask/superstruct").Struct<string, null>;
|
70
70
|
initCode: import("@metamask/superstruct").Struct<string, null>;
|
71
71
|
callData: import("@metamask/superstruct").Struct<string, null>;
|
72
|
-
gasLimits: import("@metamask/superstruct").Struct<import("
|
72
|
+
gasLimits: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
73
73
|
callGasLimit: string;
|
74
74
|
verificationGasLimit: string;
|
75
75
|
preVerificationGas: string;
|
@@ -90,9 +90,9 @@ export declare const EthUserOperationPatchStruct: import("@metamask/superstruct"
|
|
90
90
|
preVerificationGas?: string;
|
91
91
|
}, {
|
92
92
|
paymasterAndData: import("@metamask/superstruct").Struct<string, null>;
|
93
|
-
callGasLimit: import("@metamask/superstruct").Struct<string | import("
|
94
|
-
verificationGasLimit: import("@metamask/superstruct").Struct<string | import("
|
95
|
-
preVerificationGas: import("@metamask/superstruct").Struct<string | import("
|
93
|
+
callGasLimit: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
94
|
+
verificationGasLimit: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
95
|
+
preVerificationGas: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
96
96
|
}>;
|
97
97
|
export type EthUserOperationPatch = Infer<typeof EthUserOperationPatchStruct>;
|
98
98
|
//# sourceMappingURL=types.d.cts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AAInD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;EAYjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;IACnC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;EAKtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
@@ -36,8 +36,8 @@ export type EthUserOperation = Infer<typeof EthUserOperationStruct>;
|
|
36
36
|
*/
|
37
37
|
export declare const EthBaseTransactionStruct: import("@metamask/superstruct").Struct<{
|
38
38
|
value: string;
|
39
|
-
to: string;
|
40
39
|
data: string;
|
40
|
+
to: string;
|
41
41
|
}, {
|
42
42
|
/**
|
43
43
|
* Address of the transaction recipient.
|
@@ -69,7 +69,7 @@ export declare const EthBaseUserOperationStruct: import("@metamask/superstruct")
|
|
69
69
|
nonce: import("@metamask/superstruct").Struct<string, null>;
|
70
70
|
initCode: import("@metamask/superstruct").Struct<string, null>;
|
71
71
|
callData: import("@metamask/superstruct").Struct<string, null>;
|
72
|
-
gasLimits: import("@metamask/superstruct").Struct<import("
|
72
|
+
gasLimits: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
73
73
|
callGasLimit: string;
|
74
74
|
verificationGasLimit: string;
|
75
75
|
preVerificationGas: string;
|
@@ -90,9 +90,9 @@ export declare const EthUserOperationPatchStruct: import("@metamask/superstruct"
|
|
90
90
|
preVerificationGas?: string;
|
91
91
|
}, {
|
92
92
|
paymasterAndData: import("@metamask/superstruct").Struct<string, null>;
|
93
|
-
callGasLimit: import("@metamask/superstruct").Struct<string | import("
|
94
|
-
verificationGasLimit: import("@metamask/superstruct").Struct<string | import("
|
95
|
-
preVerificationGas: import("@metamask/superstruct").Struct<string | import("
|
93
|
+
callGasLimit: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
94
|
+
verificationGasLimit: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
95
|
+
preVerificationGas: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
96
96
|
}>;
|
97
97
|
export type EthUserOperationPatch = Infer<typeof EthUserOperationPatchStruct>;
|
98
98
|
//# sourceMappingURL=types.d.mts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AAInD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;EAYjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;IACnC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEH,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;EAKtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { exactOptional, object } from "
|
2
|
-
import { UrlStruct } from "../../utils/index.mjs";
|
1
|
+
import { exactOptional, object, UrlStruct } from "@metamask/keyring-utils";
|
3
2
|
import { EthAddressStruct, EthBytesStruct, EthUint256Struct } from "../types.mjs";
|
4
3
|
/**
|
5
4
|
* Struct of a UserOperation as defined by ERC-4337.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/eth/erc4337/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,gCAAgC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,qBAAiB;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,gBAAgB;IACvB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,YAAY,EAAE,gBAAgB;IAC9B,oBAAoB,EAAE,gBAAgB;IACtC,kBAAkB,EAAE,gBAAgB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,oBAAoB,EAAE,gBAAgB;IACtC,gBAAgB,EAAE,cAAc;IAChC,SAAS,EAAE,cAAc;CAC1B,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;IAC7C;;OAEG;IACH,EAAE,EAAE,gBAAgB;IAEpB;;OAEG;IACH,KAAK,EAAE,gBAAgB;IAEvB;;OAEG;IACH,IAAI,EAAE,cAAc;CACrB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,KAAK,EAAE,gBAAgB;IACvB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,SAAS,EAAE,aAAa,CACtB,MAAM,CAAC;QACL,YAAY,EAAE,gBAAgB;QAC9B,oBAAoB,EAAE,gBAAgB;QACtC,kBAAkB,EAAE,gBAAgB;KACrC,CAAC,CACH;IACD,qBAAqB,EAAE,cAAc;IACrC,cAAc,EAAE,cAAc;IAC9B,UAAU,EAAE,SAAS;CACtB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;IAChD,gBAAgB,EAAE,cAAc;IAChC,YAAY,EAAE,aAAa,CAAC,gBAAgB,CAAC;IAC7C,oBAAoB,EAAE,aAAa,CAAC,gBAAgB,CAAC;IACrD,kBAAkB,EAAE,aAAa,CAAC,gBAAgB,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UrlStruct } from '@metamask/keyring-utils';\nimport { type Infer } from '@metamask/superstruct';\n\nimport { EthAddressStruct, EthBytesStruct, EthUint256Struct } from '../types';\n\n/**\n * Struct of a UserOperation as defined by ERC-4337.\n *\n * @see https://eips.ethereum.org/EIPS/eip-4337#definitions\n */\nexport const EthUserOperationStruct = object({\n sender: EthAddressStruct,\n nonce: EthUint256Struct,\n initCode: EthBytesStruct,\n callData: EthBytesStruct,\n callGasLimit: EthUint256Struct,\n verificationGasLimit: EthUint256Struct,\n preVerificationGas: EthUint256Struct,\n maxFeePerGas: EthUint256Struct,\n maxPriorityFeePerGas: EthUint256Struct,\n paymasterAndData: EthBytesStruct,\n signature: EthBytesStruct,\n});\n\nexport type EthUserOperation = Infer<typeof EthUserOperationStruct>;\n\n/**\n * Struct containing the most basic transaction information required to\n * construct a UserOperation.\n */\nexport const EthBaseTransactionStruct = object({\n /**\n * Address of the transaction recipient.\n */\n to: EthAddressStruct,\n\n /**\n * Amount of wei to transfer to the recipient.\n */\n value: EthUint256Struct,\n\n /**\n * Data to pass to the recipient.\n */\n data: EthBytesStruct,\n});\n\nexport type EthBaseTransaction = Infer<typeof EthBaseTransactionStruct>;\n\nexport const EthBaseUserOperationStruct = object({\n nonce: EthUint256Struct,\n initCode: EthBytesStruct,\n callData: EthBytesStruct,\n gasLimits: exactOptional(\n object({\n callGasLimit: EthUint256Struct,\n verificationGasLimit: EthUint256Struct,\n preVerificationGas: EthUint256Struct,\n }),\n ),\n dummyPaymasterAndData: EthBytesStruct,\n dummySignature: EthBytesStruct,\n bundlerUrl: UrlStruct,\n});\n\nexport type EthBaseUserOperation = Infer<typeof EthBaseUserOperationStruct>;\n\nexport const EthUserOperationPatchStruct = object({\n paymasterAndData: EthBytesStruct,\n callGasLimit: exactOptional(EthUint256Struct),\n verificationGasLimit: exactOptional(EthUint256Struct),\n preVerificationGas: exactOptional(EthUint256Struct),\n});\n\nexport type EthUserOperationPatch = Infer<typeof EthUserOperationPatchStruct>;\n"]}
|
package/dist/eth/types.cjs
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.EthErc4337AccountStruct = exports.EthEoaAccountStruct = exports.EthMethod = exports.EthUint256Struct = exports.EthAddressStruct = exports.EthBytesStruct = void 0;
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
4
5
|
const superstruct_1 = require("@metamask/superstruct");
|
5
6
|
const api_1 = require("../api/index.cjs");
|
6
|
-
|
7
|
-
exports.
|
8
|
-
exports.
|
9
|
-
exports.EthUint256Struct = (0, superstruct_2.definePattern)('EthUint256', /^0x([1-9a-f][0-9a-f]*|0)$/iu);
|
7
|
+
exports.EthBytesStruct = (0, keyring_utils_1.definePattern)('EthBytes', /^0x[0-9a-f]*$/iu);
|
8
|
+
exports.EthAddressStruct = (0, keyring_utils_1.definePattern)('EthAddress', /^0x[0-9a-f]{40}$/iu);
|
9
|
+
exports.EthUint256Struct = (0, keyring_utils_1.definePattern)('EthUint256', /^0x([1-9a-f][0-9a-f]*|0)$/iu);
|
10
10
|
/**
|
11
11
|
* Supported Ethereum methods.
|
12
12
|
*/
|
@@ -24,7 +24,7 @@ var EthMethod;
|
|
24
24
|
EthMethod["PatchUserOperation"] = "eth_patchUserOperation";
|
25
25
|
EthMethod["SignUserOperation"] = "eth_signUserOperation";
|
26
26
|
})(EthMethod || (exports.EthMethod = EthMethod = {}));
|
27
|
-
exports.EthEoaAccountStruct = (0,
|
27
|
+
exports.EthEoaAccountStruct = (0, keyring_utils_1.object)({
|
28
28
|
...api_1.KeyringAccountStruct.schema,
|
29
29
|
/**
|
30
30
|
* Account address.
|
@@ -46,7 +46,7 @@ exports.EthEoaAccountStruct = (0, superstruct_2.object)({
|
|
46
46
|
`${EthMethod.SignTypedDataV4}`,
|
47
47
|
])),
|
48
48
|
});
|
49
|
-
exports.EthErc4337AccountStruct = (0,
|
49
|
+
exports.EthErc4337AccountStruct = (0, keyring_utils_1.object)({
|
50
50
|
...api_1.KeyringAccountStruct.schema,
|
51
51
|
/**
|
52
52
|
* Account address.
|
package/dist/eth/types.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAA8D;AAE9D,0CAA8D;AAEjD,QAAA,cAAc,GAAG,IAAA,6BAAa,EAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE9D,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,oBAAoB,CACrB,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,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,yBAAT,SAAS,QAYpB;AAEY,QAAA,mBAAmB,GAAG,IAAA,sBAAM,EAAC;IACxC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,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,sBAAM,EAAC;IAC5C,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,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,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { EthAccountType, KeyringAccountStruct } from '../api';\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"]}
|
package/dist/eth/types.d.cts
CHANGED
@@ -19,8 +19,8 @@ export declare enum EthMethod {
|
|
19
19
|
export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct<{
|
20
20
|
type: "eip155:eoa";
|
21
21
|
id: string;
|
22
|
-
address: string;
|
23
22
|
options: Record<string, import("@metamask/utils").Json>;
|
23
|
+
address: string;
|
24
24
|
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
25
25
|
}, {
|
26
26
|
/**
|
@@ -49,8 +49,8 @@ export type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;
|
|
49
49
|
export declare const EthErc4337AccountStruct: import("@metamask/superstruct").Struct<{
|
50
50
|
type: "eip155:erc4337";
|
51
51
|
id: string;
|
52
|
-
address: string;
|
53
52
|
options: Record<string, import("@metamask/utils").Json>;
|
53
|
+
address: string;
|
54
54
|
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
55
55
|
}, {
|
56
56
|
/**
|
package/dist/eth/types.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,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"}
|
package/dist/eth/types.d.mts
CHANGED
@@ -19,8 +19,8 @@ export declare enum EthMethod {
|
|
19
19
|
export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct<{
|
20
20
|
type: "eip155:eoa";
|
21
21
|
id: string;
|
22
|
-
address: string;
|
23
22
|
options: Record<string, import("@metamask/utils").Json>;
|
23
|
+
address: string;
|
24
24
|
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
25
25
|
}, {
|
26
26
|
/**
|
@@ -49,8 +49,8 @@ export type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;
|
|
49
49
|
export declare const EthErc4337AccountStruct: import("@metamask/superstruct").Struct<{
|
50
50
|
type: "eip155:erc4337";
|
51
51
|
id: string;
|
52
|
-
address: string;
|
53
52
|
options: Record<string, import("@metamask/utils").Json>;
|
53
|
+
address: string;
|
54
54
|
methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
|
55
55
|
}, {
|
56
56
|
/**
|
package/dist/eth/types.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,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"}
|
package/dist/eth/types.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
import { object, definePattern } from "@metamask/keyring-utils";
|
1
2
|
import { array, enums, literal } from "@metamask/superstruct";
|
2
3
|
import { EthAccountType, KeyringAccountStruct } from "../api/index.mjs";
|
3
|
-
import { object, definePattern } from "../superstruct.mjs";
|
4
4
|
export const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);
|
5
5
|
export const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);
|
6
6
|
export const EthUint256Struct = definePattern('EthUint256', /^0x([1-9a-f][0-9a-f]*|0)$/iu);
|
package/dist/eth/types.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;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 { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { EthAccountType, KeyringAccountStruct } from '../api';\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"]}
|
package/dist/eth/utils.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;AASA,4CAEC;
|
1
|
+
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":";;AASA,4CAEC;AAXD,0CAAwC;AAGxC;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAwB;IACvD,OAAO,IAAI,KAAK,oBAAc,CAAC,GAAG,IAAI,IAAI,KAAK,oBAAc,CAAC,OAAO,CAAC;AACxE,CAAC","sourcesContent":["import { EthAccountType } from '../api';\nimport type { KeyringAccountType } from '../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"]}
|
package/dist/eth/utils.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAe;AAEjD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
|
package/dist/eth/utils.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAe;AAEjD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAElE"}
|
package/dist/eth/utils.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/eth/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,yBAAe;AAGxC;;;;;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 { EthAccountType } from '../api';\nimport type { KeyringAccountType } from '../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"]}
|
package/dist/events.cjs
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.KeyringEvent = void 0;
|
3
|
+
exports.RequestRejectedEventStruct = exports.RequestApprovedEventStruct = exports.AccountDeletedEventStruct = exports.AccountUpdatedEventStruct = exports.AccountCreatedEventStruct = exports.KeyringEvent = void 0;
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
5
|
+
const superstruct_1 = require("@metamask/superstruct");
|
6
|
+
const utils_1 = require("@metamask/utils");
|
7
|
+
const api_1 = require("./api/index.cjs");
|
4
8
|
/**
|
5
9
|
* Supported keyring events.
|
6
10
|
*/
|
@@ -14,4 +18,66 @@ var KeyringEvent;
|
|
14
18
|
KeyringEvent["RequestApproved"] = "notify:requestApproved";
|
15
19
|
KeyringEvent["RequestRejected"] = "notify:requestRejected";
|
16
20
|
})(KeyringEvent || (exports.KeyringEvent = KeyringEvent = {}));
|
21
|
+
exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
|
22
|
+
method: (0, superstruct_1.literal)(`${KeyringEvent.AccountCreated}`),
|
23
|
+
params: (0, keyring_utils_1.object)({
|
24
|
+
/**
|
25
|
+
* New account object.
|
26
|
+
*/
|
27
|
+
account: api_1.KeyringAccountStruct,
|
28
|
+
/**
|
29
|
+
* Account name suggestion provided to the MetaMask client.
|
30
|
+
*
|
31
|
+
* The keyring can suggest a name for the account, but it's up to the
|
32
|
+
* client to decide whether to use it. The keyring won't be informed if the
|
33
|
+
* client decides to use a different name.
|
34
|
+
*/
|
35
|
+
accountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
|
36
|
+
/**
|
37
|
+
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
38
|
+
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
39
|
+
*/
|
40
|
+
displayConfirmation: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
|
41
|
+
}),
|
42
|
+
});
|
43
|
+
exports.AccountUpdatedEventStruct = (0, keyring_utils_1.object)({
|
44
|
+
method: (0, superstruct_1.literal)(`${KeyringEvent.AccountUpdated}`),
|
45
|
+
params: (0, keyring_utils_1.object)({
|
46
|
+
/**
|
47
|
+
* Updated account object.
|
48
|
+
*/
|
49
|
+
account: api_1.KeyringAccountStruct,
|
50
|
+
}),
|
51
|
+
});
|
52
|
+
exports.AccountDeletedEventStruct = (0, keyring_utils_1.object)({
|
53
|
+
method: (0, superstruct_1.literal)(`${KeyringEvent.AccountDeleted}`),
|
54
|
+
params: (0, keyring_utils_1.object)({
|
55
|
+
/**
|
56
|
+
* Deleted account ID.
|
57
|
+
*/
|
58
|
+
id: keyring_utils_1.UuidStruct,
|
59
|
+
}),
|
60
|
+
});
|
61
|
+
exports.RequestApprovedEventStruct = (0, keyring_utils_1.object)({
|
62
|
+
method: (0, superstruct_1.literal)(`${KeyringEvent.RequestApproved}`),
|
63
|
+
params: (0, keyring_utils_1.object)({
|
64
|
+
/**
|
65
|
+
* Request ID.
|
66
|
+
*/
|
67
|
+
id: keyring_utils_1.UuidStruct,
|
68
|
+
/**
|
69
|
+
* Request result.
|
70
|
+
*/
|
71
|
+
result: utils_1.JsonStruct,
|
72
|
+
}),
|
73
|
+
});
|
74
|
+
exports.RequestRejectedEventStruct = (0, keyring_utils_1.object)({
|
75
|
+
method: (0, superstruct_1.literal)(`${KeyringEvent.RequestRejected}`),
|
76
|
+
params: (0, keyring_utils_1.object)({
|
77
|
+
/**
|
78
|
+
* Request ID.
|
79
|
+
*/
|
80
|
+
id: keyring_utils_1.UuidStruct,
|
81
|
+
}),
|
82
|
+
});
|
17
83
|
//# sourceMappingURL=events.cjs.map
|
package/dist/events.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA;;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","sourcesContent":["/**\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"]}
|
1
|
+
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAC5E,uDAAiE;AACjE,2CAA6C;AAE7C,yCAA6C;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,0BAAoB;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,0BAAoB;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 { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from './api';\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"]}
|
package/dist/events.d.cts
CHANGED
@@ -8,4 +8,165 @@ export declare enum KeyringEvent {
|
|
8
8
|
RequestApproved = "notify:requestApproved",
|
9
9
|
RequestRejected = "notify:requestRejected"
|
10
10
|
}
|
11
|
+
export declare const AccountCreatedEventStruct: import("@metamask/superstruct").Struct<{
|
12
|
+
method: "notify:accountCreated";
|
13
|
+
params: {
|
14
|
+
account: {
|
15
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
16
|
+
id: string;
|
17
|
+
options: Record<string, import("@metamask/utils").Json>;
|
18
|
+
address: string;
|
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
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
29
|
+
id: string;
|
30
|
+
options: Record<string, import("@metamask/utils").Json>;
|
31
|
+
address: string;
|
32
|
+
methods: string[];
|
33
|
+
};
|
34
|
+
accountNameSuggestion?: string;
|
35
|
+
displayConfirmation?: boolean;
|
36
|
+
}, {
|
37
|
+
/**
|
38
|
+
* New account object.
|
39
|
+
*/
|
40
|
+
account: import("@metamask/superstruct").Struct<{
|
41
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
42
|
+
id: string;
|
43
|
+
options: Record<string, import("@metamask/utils").Json>;
|
44
|
+
address: string;
|
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
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
78
|
+
id: string;
|
79
|
+
options: Record<string, import("@metamask/utils").Json>;
|
80
|
+
address: string;
|
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
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
89
|
+
id: string;
|
90
|
+
options: Record<string, import("@metamask/utils").Json>;
|
91
|
+
address: string;
|
92
|
+
methods: string[];
|
93
|
+
};
|
94
|
+
}, {
|
95
|
+
/**
|
96
|
+
* Updated account object.
|
97
|
+
*/
|
98
|
+
account: import("@metamask/superstruct").Struct<{
|
99
|
+
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account";
|
100
|
+
id: string;
|
101
|
+
options: Record<string, import("@metamask/utils").Json>;
|
102
|
+
address: string;
|
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
|
+
result: import("@metamask/utils").Json;
|
138
|
+
id: string;
|
139
|
+
};
|
140
|
+
}, {
|
141
|
+
method: import("@metamask/superstruct").Struct<"notify:requestApproved", "notify:requestApproved">;
|
142
|
+
params: import("@metamask/superstruct").Struct<{
|
143
|
+
result: import("@metamask/utils").Json;
|
144
|
+
id: string;
|
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
|
+
}>;
|
11
172
|
//# sourceMappingURL=events.d.cts.map
|
package/dist/events.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA;;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"}
|