@metamask/keyring-api 15.0.0 → 16.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 +17 -1
- package/dist/api/account.cjs +2 -2
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +3 -3
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +3 -3
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +4 -4
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/address.cjs +14 -0
- package/dist/api/address.cjs.map +1 -0
- package/dist/api/address.d.cts +19 -0
- package/dist/api/address.d.cts.map +1 -0
- package/dist/api/address.d.mts +19 -0
- package/dist/api/address.d.mts.map +1 -0
- package/dist/api/address.mjs +11 -0
- package/dist/api/address.mjs.map +1 -0
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +16 -2
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +16 -2
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/btc/constants.cjs +9 -10
- package/dist/btc/constants.cjs.map +1 -1
- package/dist/btc/constants.d.cts +1 -2
- package/dist/btc/constants.d.cts.map +1 -1
- package/dist/btc/constants.d.mts +1 -2
- package/dist/btc/constants.d.mts.map +1 -1
- package/dist/btc/constants.mjs +8 -9
- package/dist/btc/constants.mjs.map +1 -1
- package/dist/eth/constants.cjs +7 -7
- package/dist/eth/constants.cjs.map +1 -1
- package/dist/eth/constants.d.cts +2 -2
- package/dist/eth/constants.d.cts.map +1 -1
- package/dist/eth/constants.d.mts +2 -2
- package/dist/eth/constants.d.mts.map +1 -1
- package/dist/eth/constants.mjs +6 -6
- package/dist/eth/constants.mjs.map +1 -1
- package/dist/eth/types.cjs +2 -2
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +4 -4
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +4 -4
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +3 -3
- package/dist/eth/types.mjs.map +1 -1
- package/dist/events.cjs +2 -2
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +8 -8
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +8 -8
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +2 -2
- package/dist/events.mjs.map +1 -1
- package/dist/rpc.cjs +18 -4
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +59 -11
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +59 -11
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs +18 -4
- package/dist/rpc.mjs.map +1 -1
- package/dist/sol/constants.cjs +7 -8
- package/dist/sol/constants.cjs.map +1 -1
- package/dist/sol/constants.d.cts +1 -2
- package/dist/sol/constants.d.cts.map +1 -1
- package/dist/sol/constants.d.mts +1 -2
- package/dist/sol/constants.d.mts.map +1 -1
- package/dist/sol/constants.mjs +6 -7
- package/dist/sol/constants.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/api/caip.cjs +0 -21
- package/dist/api/caip.cjs.map +0 -1
- package/dist/api/caip.d.cts +0 -21
- package/dist/api/caip.d.cts.map +0 -1
- package/dist/api/caip.d.mts +0 -21
- package/dist/api/caip.d.mts.map +0 -1
- package/dist/api/caip.mjs +0 -18
- package/dist/api/caip.mjs.map +0 -1
package/dist/eth/constants.cjs
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
/* istanbul ignore file */
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.
|
4
|
+
exports.EthScope = void 0;
|
5
5
|
/**
|
6
6
|
* Scopes for EVM account type. See {@link KeyringAccount.scopes}.
|
7
7
|
*/
|
8
|
-
var
|
9
|
-
(function (
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
})(
|
8
|
+
var EthScope;
|
9
|
+
(function (EthScope) {
|
10
|
+
EthScope["Eoa"] = "eip155:0";
|
11
|
+
EthScope["Mainnet"] = "eip155:1";
|
12
|
+
EthScope["Testnet"] = "eip155:11155111";
|
13
|
+
})(EthScope || (exports.EthScope = EthScope = {}));
|
14
14
|
//# sourceMappingURL=constants.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B;;GAEG;AACH,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,4BAAgB,CAAA;IAChB,gCAAoB,CAAA;IACpB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for EVM account type. See {@link KeyringAccount.scopes}.\n */\nexport enum EthScope {\n Eoa = 'eip155:0',\n Mainnet = 'eip155:1',\n Testnet = 'eip155:11155111',\n}\n"]}
|
package/dist/eth/constants.d.cts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,GAAG,aAAa;IAChB,OAAO,aAAa;IACpB,OAAO,oBAAoB;CAC5B"}
|
package/dist/eth/constants.d.mts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,GAAG,aAAa;IAChB,OAAO,aAAa;IACpB,OAAO,oBAAoB;CAC5B"}
|
package/dist/eth/constants.mjs
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
/**
|
3
3
|
* Scopes for EVM account type. See {@link KeyringAccount.scopes}.
|
4
4
|
*/
|
5
|
-
export var
|
6
|
-
(function (
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
})(
|
5
|
+
export var EthScope;
|
6
|
+
(function (EthScope) {
|
7
|
+
EthScope["Eoa"] = "eip155:0";
|
8
|
+
EthScope["Mainnet"] = "eip155:1";
|
9
|
+
EthScope["Testnet"] = "eip155:11155111";
|
10
|
+
})(EthScope || (EthScope = {}));
|
11
11
|
//# sourceMappingURL=constants.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/eth/constants.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,4BAAgB,CAAA;IAChB,gCAAoB,CAAA;IACpB,uCAA2B,CAAA;AAC7B,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB","sourcesContent":["/* istanbul ignore file */\n\n/**\n * Scopes for EVM account type. See {@link KeyringAccount.scopes}.\n */\nexport enum EthScope {\n Eoa = 'eip155:0',\n Mainnet = 'eip155:1',\n Testnet = 'eip155:11155111',\n}\n"]}
|
package/dist/eth/types.cjs
CHANGED
@@ -37,9 +37,9 @@ exports.EthEoaAccountStruct = (0, keyring_utils_1.object)({
|
|
37
37
|
*/
|
38
38
|
type: (0, superstruct_1.literal)(`${api_1.EthAccountType.Eoa}`),
|
39
39
|
/**
|
40
|
-
* Account scopes (must be ['eip155']).
|
40
|
+
* Account scopes (must be ['eip155:0']).
|
41
41
|
*/
|
42
|
-
scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)((0, superstruct_1.literal)(_1.
|
42
|
+
scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)((0, superstruct_1.literal)(_1.EthScope.Eoa))),
|
43
43
|
/**
|
44
44
|
* Account supported methods.
|
45
45
|
*/
|
package/dist/eth/types.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAAwE;AACxE,2CAAoD;AAEpD,
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAAwE;AACxE,2CAAoD;AAEpD,kCAA6B;AAC7B,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,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AY,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 { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { EthScope } from '.';\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 scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.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 scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\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
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
2
|
-
import {
|
2
|
+
import { EthScope } from "./index.cjs";
|
3
3
|
export declare const EthBytesStruct: import("@metamask/superstruct").Struct<string, null>;
|
4
4
|
export declare const EthAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
5
5
|
export declare const EthUint256Struct: import("@metamask/superstruct").Struct<string, null>;
|
@@ -22,7 +22,7 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
|
|
22
22
|
id: string;
|
23
23
|
options: Record<string, import("@metamask/utils").Json>;
|
24
24
|
address: string;
|
25
|
-
scopes:
|
25
|
+
scopes: EthScope.Eoa[];
|
26
26
|
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
27
27
|
}, {
|
28
28
|
/**
|
@@ -34,9 +34,9 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
|
|
34
34
|
*/
|
35
35
|
type: import("@metamask/superstruct").Struct<"eip155:eoa", "eip155:eoa">;
|
36
36
|
/**
|
37
|
-
* Account scopes (must be ['eip155']).
|
37
|
+
* Account scopes (must be ['eip155:0']).
|
38
38
|
*/
|
39
|
-
scopes: import("@metamask/superstruct").Struct<
|
39
|
+
scopes: import("@metamask/superstruct").Struct<EthScope.Eoa[], import("@metamask/superstruct").Struct<EthScope.Eoa, EthScope.Eoa>>;
|
40
40
|
/**
|
41
41
|
* Account supported methods.
|
42
42
|
*/
|
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":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAG7B,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;;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;;IAGH;;OAEG;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
package/dist/eth/types.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
2
|
-
import {
|
2
|
+
import { EthScope } from "./index.mjs";
|
3
3
|
export declare const EthBytesStruct: import("@metamask/superstruct").Struct<string, null>;
|
4
4
|
export declare const EthAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
5
5
|
export declare const EthUint256Struct: import("@metamask/superstruct").Struct<string, null>;
|
@@ -22,7 +22,7 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
|
|
22
22
|
id: string;
|
23
23
|
options: Record<string, import("@metamask/utils").Json>;
|
24
24
|
address: string;
|
25
|
-
scopes:
|
25
|
+
scopes: EthScope.Eoa[];
|
26
26
|
methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
|
27
27
|
}, {
|
28
28
|
/**
|
@@ -34,9 +34,9 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
|
|
34
34
|
*/
|
35
35
|
type: import("@metamask/superstruct").Struct<"eip155:eoa", "eip155:eoa">;
|
36
36
|
/**
|
37
|
-
* Account scopes (must be ['eip155']).
|
37
|
+
* Account scopes (must be ['eip155:0']).
|
38
38
|
*/
|
39
|
-
scopes: import("@metamask/superstruct").Struct<
|
39
|
+
scopes: import("@metamask/superstruct").Struct<EthScope.Eoa[], import("@metamask/superstruct").Struct<EthScope.Eoa, EthScope.Eoa>>;
|
40
40
|
/**
|
41
41
|
* Account supported methods.
|
42
42
|
*/
|
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":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAG7B,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;;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;;IAGH;;OAEG;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
package/dist/eth/types.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { object, definePattern } from "@metamask/keyring-utils";
|
2
2
|
import { nonempty, array, enums, literal } from "@metamask/superstruct";
|
3
3
|
import { CaipChainIdStruct } from "@metamask/utils";
|
4
|
-
import {
|
4
|
+
import { EthScope } from "./index.mjs";
|
5
5
|
import { EthAccountType, KeyringAccountStruct } from "../api/index.mjs";
|
6
6
|
export const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);
|
7
7
|
export const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);
|
@@ -34,9 +34,9 @@ export const EthEoaAccountStruct = object({
|
|
34
34
|
*/
|
35
35
|
type: literal(`${EthAccountType.Eoa}`),
|
36
36
|
/**
|
37
|
-
* Account scopes (must be ['eip155']).
|
37
|
+
* Account scopes (must be ['eip155:0']).
|
38
38
|
*/
|
39
|
-
scopes: nonempty(array(literal(
|
39
|
+
scopes: nonempty(array(literal(EthScope.Eoa))),
|
40
40
|
/**
|
41
41
|
* Account supported methods.
|
42
42
|
*/
|
package/dist/eth/types.mjs.map
CHANGED
@@ -1 +1 @@
|
|
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,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AAEpD,OAAO,EAAE,
|
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,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AAEpD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAC7B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,yBAAe;AAE9D,MAAM,CAAC,MAAM,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BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAE1C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,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 { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { EthScope } from '.';\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 scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.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 scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\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/events.cjs
CHANGED
@@ -146,11 +146,11 @@ exports.AccountAssetListUpdatedEventStruct = (0, keyring_utils_1.object)({
|
|
146
146
|
/**
|
147
147
|
* New assets detected.
|
148
148
|
*/
|
149
|
-
added: (0, superstruct_1.array)(
|
149
|
+
added: (0, superstruct_1.array)(utils_1.CaipAssetTypeOrIdStruct),
|
150
150
|
/**
|
151
151
|
* Assets no longer available on that account.
|
152
152
|
*/
|
153
|
-
removed: (0, superstruct_1.array)(
|
153
|
+
removed: (0, superstruct_1.array)(utils_1.CaipAssetTypeOrIdStruct),
|
154
154
|
})),
|
155
155
|
}),
|
156
156
|
});
|
package/dist/events.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AAEjC,uDAAgF;AAChF,
|
1
|
+
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AAEjC,uDAAgF;AAChF,2CAIyB;AAEzB,yCAIe;AAEf;;GAEG;AACH,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,0EAA0D,CAAA;IAC1D,gFAAgE,CAAA;AAClE,CAAC,EAdW,YAAY,4BAAZ,YAAY,QAcvB;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,GAA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qCAAqC,GAAG,IAAA,sBAAM,EAAC;IAC1D,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,YAAY,EAAE,IAAA,oBAAM;QAClB;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,mBAAK,EAAC,uBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAgBU,QAAA,kCAAkC,GAAG,IAAA,sBAAM,EAAC;IACvD,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,MAAM,EAAE,IAAA,oBAAM;QACZ;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,sBAAM,EAAC;YACL;;eAEG;YACH,KAAK,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n} 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 // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\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\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n"]}
|
package/dist/events.d.cts
CHANGED
@@ -20,7 +20,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
20
20
|
id: string;
|
21
21
|
options: Record<string, import("@metamask/utils").Json>;
|
22
22
|
address: string;
|
23
|
-
scopes: string[];
|
23
|
+
scopes: `${string}:${string}`[];
|
24
24
|
methods: string[];
|
25
25
|
};
|
26
26
|
accountNameSuggestion?: string;
|
@@ -34,7 +34,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
34
34
|
id: string;
|
35
35
|
options: Record<string, import("@metamask/utils").Json>;
|
36
36
|
address: string;
|
37
|
-
scopes: string[];
|
37
|
+
scopes: `${string}:${string}`[];
|
38
38
|
methods: string[];
|
39
39
|
};
|
40
40
|
accountNameSuggestion?: string;
|
@@ -48,7 +48,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
48
48
|
id: string;
|
49
49
|
options: Record<string, import("@metamask/utils").Json>;
|
50
50
|
address: string;
|
51
|
-
scopes: string[];
|
51
|
+
scopes: `${string}:${string}`[];
|
52
52
|
methods: string[];
|
53
53
|
}, {
|
54
54
|
id: import("@metamask/superstruct").Struct<string, null>;
|
@@ -59,7 +59,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
59
59
|
"solana:data-account": "solana:data-account";
|
60
60
|
}>;
|
61
61
|
address: import("@metamask/superstruct").Struct<string, null>;
|
62
|
-
scopes: import("@metamask/superstruct").Struct
|
62
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
63
63
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
64
64
|
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
65
65
|
}>;
|
@@ -86,7 +86,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
86
86
|
id: string;
|
87
87
|
options: Record<string, import("@metamask/utils").Json>;
|
88
88
|
address: string;
|
89
|
-
scopes: string[];
|
89
|
+
scopes: `${string}:${string}`[];
|
90
90
|
methods: string[];
|
91
91
|
};
|
92
92
|
};
|
@@ -98,7 +98,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
98
98
|
id: string;
|
99
99
|
options: Record<string, import("@metamask/utils").Json>;
|
100
100
|
address: string;
|
101
|
-
scopes: string[];
|
101
|
+
scopes: `${string}:${string}`[];
|
102
102
|
methods: string[];
|
103
103
|
};
|
104
104
|
}, {
|
@@ -110,7 +110,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
110
110
|
id: string;
|
111
111
|
options: Record<string, import("@metamask/utils").Json>;
|
112
112
|
address: string;
|
113
|
-
scopes: string[];
|
113
|
+
scopes: `${string}:${string}`[];
|
114
114
|
methods: string[];
|
115
115
|
}, {
|
116
116
|
id: import("@metamask/superstruct").Struct<string, null>;
|
@@ -121,7 +121,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
121
121
|
"solana:data-account": "solana:data-account";
|
122
122
|
}>;
|
123
123
|
address: import("@metamask/superstruct").Struct<string, null>;
|
124
|
-
scopes: import("@metamask/superstruct").Struct
|
124
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
125
125
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
126
126
|
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
127
127
|
}>;
|
package/dist/events.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"events.d.cts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0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CAAC;AAE5C,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/events.d.mts
CHANGED
@@ -20,7 +20,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
20
20
|
id: string;
|
21
21
|
options: Record<string, import("@metamask/utils").Json>;
|
22
22
|
address: string;
|
23
|
-
scopes: string[];
|
23
|
+
scopes: `${string}:${string}`[];
|
24
24
|
methods: string[];
|
25
25
|
};
|
26
26
|
accountNameSuggestion?: string;
|
@@ -34,7 +34,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
34
34
|
id: string;
|
35
35
|
options: Record<string, import("@metamask/utils").Json>;
|
36
36
|
address: string;
|
37
|
-
scopes: string[];
|
37
|
+
scopes: `${string}:${string}`[];
|
38
38
|
methods: string[];
|
39
39
|
};
|
40
40
|
accountNameSuggestion?: string;
|
@@ -48,7 +48,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
48
48
|
id: string;
|
49
49
|
options: Record<string, import("@metamask/utils").Json>;
|
50
50
|
address: string;
|
51
|
-
scopes: string[];
|
51
|
+
scopes: `${string}:${string}`[];
|
52
52
|
methods: string[];
|
53
53
|
}, {
|
54
54
|
id: import("@metamask/superstruct").Struct<string, null>;
|
@@ -59,7 +59,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
59
59
|
"solana:data-account": "solana:data-account";
|
60
60
|
}>;
|
61
61
|
address: import("@metamask/superstruct").Struct<string, null>;
|
62
|
-
scopes: import("@metamask/superstruct").Struct
|
62
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
63
63
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
64
64
|
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
65
65
|
}>;
|
@@ -86,7 +86,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
86
86
|
id: string;
|
87
87
|
options: Record<string, import("@metamask/utils").Json>;
|
88
88
|
address: string;
|
89
|
-
scopes: string[];
|
89
|
+
scopes: `${string}:${string}`[];
|
90
90
|
methods: string[];
|
91
91
|
};
|
92
92
|
};
|
@@ -98,7 +98,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
98
98
|
id: string;
|
99
99
|
options: Record<string, import("@metamask/utils").Json>;
|
100
100
|
address: string;
|
101
|
-
scopes: string[];
|
101
|
+
scopes: `${string}:${string}`[];
|
102
102
|
methods: string[];
|
103
103
|
};
|
104
104
|
}, {
|
@@ -110,7 +110,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
110
110
|
id: string;
|
111
111
|
options: Record<string, import("@metamask/utils").Json>;
|
112
112
|
address: string;
|
113
|
-
scopes: string[];
|
113
|
+
scopes: `${string}:${string}`[];
|
114
114
|
methods: string[];
|
115
115
|
}, {
|
116
116
|
id: import("@metamask/superstruct").Struct<string, null>;
|
@@ -121,7 +121,7 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
121
121
|
"solana:data-account": "solana:data-account";
|
122
122
|
}>;
|
123
123
|
address: import("@metamask/superstruct").Struct<string, null>;
|
124
|
-
scopes: import("@metamask/superstruct").Struct
|
124
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
125
125
|
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
126
126
|
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
127
127
|
}>;
|
package/dist/events.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;IAG1C,sBAAsB,kCAAkC;IACxD,uBAAuB,mCAAmC;IAC1D,0BAA0B,sCAAsC;CACjE;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;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;AAKH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;QAG1C;;WAEG;;;;;;EAuBL,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG,KAAK,CAC7C,OAAO,iCAAiC,CACzC,CAAC;AACF,MAAM,MAAM,kCAAkC,GAC5C,2BAA2B,CAAC,QAAQ,CAAC,CAAC;AAExC,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAG9C;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaL,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AACF,MAAM,MAAM,sCAAsC,GAChD,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAE5C,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/events.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { exactOptional, object, UuidStruct, AccountIdStruct } from "@metamask/keyring-utils";
|
2
2
|
import { array, boolean, literal, record, string } from "@metamask/superstruct";
|
3
|
-
import { CaipAssetTypeStruct, JsonStruct } from "@metamask/utils";
|
4
|
-
import {
|
3
|
+
import { CaipAssetTypeStruct, CaipAssetTypeOrIdStruct, JsonStruct } from "@metamask/utils";
|
4
|
+
import { FungibleAssetAmountStruct, KeyringAccountStruct, TransactionStruct } from "./api/index.mjs";
|
5
5
|
/**
|
6
6
|
* Supported keyring events.
|
7
7
|
*/
|
package/dist/events.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,eAAe,EAChB,gCAAgC;AAEjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,E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AAE,MAAM;QAClB;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,KAAK,CAAC,iBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAgBH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,MAAM,EAAE,MAAM;QACZ;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,MAAM,CAAC;YACL;;eAEG;YACH,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n} 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 // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\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\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n"]}
|
package/dist/rpc.cjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountAssetsResponseStruct = exports.ListAccountAssetsRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = exports.KeyringRpcMethod = void 0;
|
3
|
+
exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.ResolveAccountAddressResponseStruct = exports.ResolveAccountAddressRequestStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountAssetsResponseStruct = exports.ListAccountAssetsRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = exports.KeyringRpcMethod = void 0;
|
4
4
|
exports.isKeyringRpcMethod = isKeyringRpcMethod;
|
5
5
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
6
6
|
const superstruct_1 = require("@metamask/superstruct");
|
@@ -17,6 +17,7 @@ var KeyringRpcMethod;
|
|
17
17
|
KeyringRpcMethod["ListAccountAssets"] = "keyring_listAccountAssets";
|
18
18
|
KeyringRpcMethod["ListAccountTransactions"] = "keyring_listAccountTransactions";
|
19
19
|
KeyringRpcMethod["GetAccountBalances"] = "keyring_getAccountBalances";
|
20
|
+
KeyringRpcMethod["ResolveAccountAddress"] = "keyring_resolveAccountAddress";
|
20
21
|
KeyringRpcMethod["FilterAccountChains"] = "keyring_filterAccountChains";
|
21
22
|
KeyringRpcMethod["UpdateAccount"] = "keyring_updateAccount";
|
22
23
|
KeyringRpcMethod["DeleteAccount"] = "keyring_deleteAccount";
|
@@ -88,7 +89,7 @@ exports.ListAccountAssetsRequestStruct = (0, keyring_utils_1.object)({
|
|
88
89
|
id: keyring_utils_1.UuidStruct,
|
89
90
|
}),
|
90
91
|
});
|
91
|
-
exports.ListAccountAssetsResponseStruct = (0, superstruct_1.array)(
|
92
|
+
exports.ListAccountAssetsResponseStruct = (0, superstruct_1.array)(utils_1.CaipAssetTypeOrIdStruct);
|
92
93
|
// ----------------------------------------------------------------------------
|
93
94
|
// Get account balances
|
94
95
|
exports.GetAccountBalancesRequestStruct = (0, keyring_utils_1.object)({
|
@@ -96,10 +97,23 @@ exports.GetAccountBalancesRequestStruct = (0, keyring_utils_1.object)({
|
|
96
97
|
method: (0, superstruct_1.literal)(`${KeyringRpcMethod.GetAccountBalances}`),
|
97
98
|
params: (0, keyring_utils_1.object)({
|
98
99
|
id: keyring_utils_1.UuidStruct,
|
99
|
-
assets: (0, superstruct_1.array)(
|
100
|
+
assets: (0, superstruct_1.array)(utils_1.CaipAssetTypeStruct),
|
100
101
|
}),
|
101
102
|
});
|
102
|
-
exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(
|
103
|
+
exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(utils_1.CaipAssetTypeStruct, api_1.BalanceStruct);
|
104
|
+
// ----------------------------------------------------------------------------
|
105
|
+
// Resolve account address
|
106
|
+
exports.ResolveAccountAddressRequestStruct = (0, keyring_utils_1.object)({
|
107
|
+
...CommonHeader,
|
108
|
+
method: (0, superstruct_1.literal)('keyring_resolveAccountAddress'),
|
109
|
+
params: (0, keyring_utils_1.object)({
|
110
|
+
scope: utils_1.CaipChainIdStruct,
|
111
|
+
request: keyring_utils_1.JsonRpcRequestStruct,
|
112
|
+
}),
|
113
|
+
});
|
114
|
+
exports.ResolveAccountAddressResponseStruct = (0, superstruct_1.nullable)((0, keyring_utils_1.object)({
|
115
|
+
address: (0, superstruct_1.string)(),
|
116
|
+
}));
|
103
117
|
// ----------------------------------------------------------------------------
|
104
118
|
// Filter account chains
|
105
119
|
exports.FilterAccountChainsStruct = (0, keyring_utils_1.object)({
|