@metamask/keyring-api 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/dist/JsonRpcRequest.d.ts +6 -6
- package/dist/JsonRpcRequest.js +1 -1
- package/dist/JsonRpcRequest.js.map +1 -1
- package/dist/KeyringClient.js +1 -1
- package/dist/KeyringClient.js.map +1 -1
- package/dist/api/account.d.ts +7 -7
- package/dist/api/account.js +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/balance.d.ts +4 -4
- package/dist/api/balance.js +1 -1
- package/dist/api/balance.js.map +1 -1
- package/dist/api/caip.d.ts +3 -3
- package/dist/api/caip.js +1 -1
- package/dist/api/caip.js.map +1 -1
- package/dist/api/export.d.ts +2 -2
- package/dist/api/export.js +1 -1
- package/dist/api/export.js.map +1 -1
- package/dist/api/request.d.ts +8 -8
- package/dist/api/request.js +1 -1
- package/dist/api/request.js.map +1 -1
- package/dist/api/response.d.ts +2 -2
- package/dist/api/response.js +1 -1
- package/dist/api/response.js.map +1 -1
- package/dist/btc/types.d.ts +8 -8
- package/dist/btc/types.js +1 -1
- package/dist/btc/types.js.map +1 -1
- package/dist/eth/erc4337/types.d.ts +33 -33
- package/dist/eth/erc4337/types.js.map +1 -1
- package/dist/eth/types.d.ts +16 -16
- package/dist/eth/types.js +1 -1
- package/dist/eth/types.js.map +1 -1
- package/dist/internal/api.d.ts +130 -130
- package/dist/internal/api.js +1 -1
- package/dist/internal/api.js.map +1 -1
- package/dist/internal/events.d.ts +33 -33
- package/dist/internal/events.js +1 -1
- package/dist/internal/events.js.map +1 -1
- package/dist/internal/types.d.ts +1 -1
- package/dist/internal/types.js +1 -1
- package/dist/internal/types.js.map +1 -1
- package/dist/rpc-handler.js +1 -1
- package/dist/rpc-handler.js.map +1 -1
- package/dist/superstruct.d.ts +2 -3
- package/dist/superstruct.js +1 -1
- package/dist/superstruct.js.map +1 -1
- package/dist/utils/types.d.ts +4 -4
- package/dist/utils/types.js +1 -1
- package/dist/utils/types.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [8.0.1]
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- Migrate to @metamask/superstruct and update required dependencies ([#355](https://github.com/MetaMask/keyring-api/pull/355)).
|
15
|
+
- Bump @metamask/providers from 17.1.0 to 17.1.1 ([#354](https://github.com/MetaMask/keyring-api/pull/354)).
|
16
|
+
- Bump @metamask/key-tree from 9.1.1 to 9.1.2 ([#351](https://github.com/MetaMask/keyring-api/pull/351)).
|
17
|
+
- Bump @metamask/rpc-errors from 6.3.0 to 6.3.1 ([#350](https://github.com/MetaMask/keyring-api/pull/350)).
|
18
|
+
- Bump @metamask/providers from 17.0.0 to 17.1.0 ([#348](https://github.com/MetaMask/keyring-api/pull/348)).
|
19
|
+
- Bump @metamask/snaps-sdk from 4.4.2 to 6.0.0 ([#347](https://github.com/MetaMask/keyring-api/pull/347)).
|
20
|
+
- Bump braces from 3.0.2 to 3.0.3 ([#345](https://github.com/MetaMask/keyring-api/pull/345)).
|
21
|
+
|
10
22
|
## [8.0.0]
|
11
23
|
|
12
24
|
### Changed
|
@@ -361,7 +373,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
361
373
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
362
374
|
- Helper functions to create keyring handler in the snap.
|
363
375
|
|
364
|
-
[Unreleased]: https://github.com/MetaMask/keyring-api/compare/v8.0.
|
376
|
+
[Unreleased]: https://github.com/MetaMask/keyring-api/compare/v8.0.1...HEAD
|
377
|
+
[8.0.1]: https://github.com/MetaMask/keyring-api/compare/v8.0.0...v8.0.1
|
365
378
|
[8.0.0]: https://github.com/MetaMask/keyring-api/compare/v7.0.0...v8.0.0
|
366
379
|
[7.0.0]: https://github.com/MetaMask/keyring-api/compare/v6.4.0...v7.0.0
|
367
380
|
[6.4.0]: https://github.com/MetaMask/keyring-api/compare/v6.3.1...v6.4.0
|
package/dist/JsonRpcRequest.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
import type { Infer } from 'superstruct';
|
2
|
-
export declare const JsonRpcRequestStruct: import("superstruct").Struct<{
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
|
+
export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struct<{
|
3
3
|
jsonrpc: "2.0";
|
4
4
|
id: string | number | null;
|
5
5
|
method: string;
|
6
6
|
params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
|
7
7
|
}, {
|
8
|
-
jsonrpc: import("superstruct").Struct<"2.0", "2.0">;
|
9
|
-
id: import("superstruct").Struct<string | number | null, null>;
|
10
|
-
method: import("superstruct").Struct<string, null>;
|
11
|
-
params: import("superstruct").Struct<import("./superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
|
8
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
9
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
10
|
+
method: import("@metamask/superstruct").Struct<string, null>;
|
11
|
+
params: import("@metamask/superstruct").Struct<import("./superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
|
12
12
|
}>;
|
13
13
|
/**
|
14
14
|
* JSON-RPC request type.
|
package/dist/JsonRpcRequest.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.JsonRpcRequestStruct = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
4
5
|
const utils_1 = require("@metamask/utils");
|
5
|
-
const superstruct_1 = require("superstruct");
|
6
6
|
const superstruct_2 = require("./superstruct");
|
7
7
|
exports.JsonRpcRequestStruct = (0, superstruct_2.object)({
|
8
8
|
jsonrpc: (0, superstruct_1.literal)('2.0'),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"JsonRpcRequest.js","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C
|
1
|
+
{"version":3,"file":"JsonRpcRequest.js","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAE/B,2CAA6C;AAE7C,+CAAsD;AAEzC,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from './superstruct';\n\nexport const JsonRpcRequestStruct = object({\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n});\n\n/**\n * JSON-RPC request type.\n */\nexport type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;\n"]}
|
package/dist/KeyringClient.js
CHANGED
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
13
13
|
var _KeyringClient_instances, _KeyringClient_sender, _KeyringClient_send;
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.KeyringClient = void 0;
|
16
|
-
const superstruct_1 = require("superstruct");
|
16
|
+
const superstruct_1 = require("@metamask/superstruct");
|
17
17
|
const uuid_1 = require("uuid");
|
18
18
|
const api_1 = require("./internal/api");
|
19
19
|
const rpc_1 = require("./internal/rpc");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"KeyringClient.js","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"KeyringClient.js","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"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","sourcesContent":["import { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type {\n Keyring,\n KeyringAccount,\n KeyringRequest,\n KeyringAccountData,\n KeyringResponse,\n CaipAssetType,\n Balance,\n} from './api';\nimport {\n ApproveRequestResponseStruct,\n CreateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n FilterAccountChainsResponseStruct,\n GetAccountBalancesResponseStruct,\n GetAccountResponseStruct,\n GetRequestResponseStruct,\n ListAccountsResponseStruct,\n ListRequestsResponseStruct,\n RejectRequestResponseStruct,\n SubmitRequestResponseStruct,\n UpdateAccountResponseStruct,\n} from './internal/api';\nimport { KeyringRpcMethod } from './internal/rpc';\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { strictMask } from './superstruct';\n\nexport type Sender = {\n send(request: JsonRpcRequest): Promise<Json>;\n};\n\nexport class KeyringClient implements Keyring {\n #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param partial - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n async #send(partial: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>): Promise<Json> {\n return this.#sender.send({\n jsonrpc: '2.0',\n id: uuid(),\n ...partial,\n });\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListAccounts,\n }),\n ListAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async getAccountBalances(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccountBalances,\n params: { id, assets },\n }),\n GetAccountBalancesResponseStruct,\n );\n }\n\n async createAccount(\n options: Record<string, Json> = {},\n ): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.CreateAccount,\n params: { options },\n }),\n CreateAccountResponseStruct,\n );\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.FilterAccountChains,\n params: { id, chains },\n }),\n FilterAccountChainsResponseStruct,\n );\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.UpdateAccount,\n params: { account },\n }),\n UpdateAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ExportAccount,\n params: { id },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListRequests,\n }),\n ListRequestsResponseStruct,\n );\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetRequest,\n params: { id },\n }),\n GetRequestResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<KeyringResponse> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n\n async approveRequest(\n id: string,\n data: Record<string, Json> = {},\n ): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.ApproveRequest,\n params: { id, data },\n }),\n ApproveRequestResponseStruct,\n );\n }\n\n async rejectRequest(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.RejectRequest,\n params: { id },\n }),\n RejectRequestResponseStruct,\n );\n }\n}\n"]}
|
package/dist/api/account.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Infer } from 'superstruct';
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
2
|
/**
|
3
3
|
* Supported Ethereum account types.
|
4
4
|
*/
|
@@ -23,7 +23,7 @@ export declare type KeyringAccountType = `${EthAccountType.Eoa}` | `${EthAccount
|
|
23
23
|
*
|
24
24
|
* See {@link KeyringAccount}.
|
25
25
|
*/
|
26
|
-
export declare const KeyringAccountStruct: import("superstruct").Struct<{
|
26
|
+
export declare const KeyringAccountStruct: import("@metamask/superstruct").Struct<{
|
27
27
|
type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
|
28
28
|
id: string;
|
29
29
|
address: string;
|
@@ -33,11 +33,11 @@ export declare const KeyringAccountStruct: import("superstruct").Struct<{
|
|
33
33
|
/**
|
34
34
|
* Account ID (UUIDv4).
|
35
35
|
*/
|
36
|
-
id: import("superstruct").Struct<string, null>;
|
36
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
37
37
|
/**
|
38
38
|
* Account type.
|
39
39
|
*/
|
40
|
-
type: import("superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
40
|
+
type: import("@metamask/superstruct").Struct<"eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh", {
|
41
41
|
"eip155:eoa": "eip155:eoa";
|
42
42
|
"eip155:erc4337": "eip155:erc4337";
|
43
43
|
"bip122:p2wpkh": "bip122:p2wpkh";
|
@@ -45,15 +45,15 @@ export declare const KeyringAccountStruct: import("superstruct").Struct<{
|
|
45
45
|
/**
|
46
46
|
* Account main address.
|
47
47
|
*/
|
48
|
-
address: import("superstruct").Struct<string, null>;
|
48
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
49
49
|
/**
|
50
50
|
* Account options.
|
51
51
|
*/
|
52
|
-
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
52
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
53
53
|
/**
|
54
54
|
* Account supported methods.
|
55
55
|
*/
|
56
|
-
methods: import("superstruct").Struct<string[], import("superstruct").Struct<string, null>>;
|
56
|
+
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
57
57
|
}>;
|
58
58
|
/**
|
59
59
|
* Keyring Account type represents an account and its properties from the
|
package/dist/api/account.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.KeyringAccountStruct = exports.BtcAccountType = exports.EthAccountType = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
4
5
|
const utils_1 = require("@metamask/utils");
|
5
|
-
const superstruct_1 = require("superstruct");
|
6
6
|
const superstruct_2 = require("../superstruct");
|
7
7
|
const utils_2 = require("../utils");
|
8
8
|
/**
|
package/dist/api/account.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,gDAAwC;AACxC,oCAAsC;AAEtC;;GAEG;AACH,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,oCAAkB,CAAA;IAClB,4CAA0B,CAAA;AAC5B,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAED;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,0CAAwB,CAAA;AAC1B,CAAC,EAFW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAEzB;AAUD;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,kBAAU;IAEd;;OAEG;IACH,IAAI,EAAE,IAAA,mBAAK,EAAC;QACV,GAAG,cAAc,CAAC,GAAG,EAAE;QACvB,GAAG,cAAc,CAAC,OAAO,EAAE;QAC3B,GAAG,cAAc,CAAC,MAAM,EAAE;KAC3B,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,GAAE;IAEjB;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;IAErC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\n/**\n * Supported Ethereum account types.\n */\nexport enum EthAccountType {\n Eoa = 'eip155:eoa',\n Erc4337 = 'eip155:erc4337',\n}\n\n/**\n * Supported Bitcoin account types.\n */\nexport enum BtcAccountType {\n P2wpkh = 'bip122:p2wpkh',\n}\n\n/**\n * Supported account types.\n */\nexport type KeyringAccountType =\n | `${EthAccountType.Eoa}`\n | `${EthAccountType.Erc4337}`\n | `${BtcAccountType.P2wpkh}`;\n\n/**\n * A struct which represents a Keyring account object. It is abstract enough to\n * be used with any blockchain. Specific blockchain account types should extend\n * this struct.\n *\n * See {@link KeyringAccount}.\n */\nexport const KeyringAccountStruct = object({\n /**\n * Account ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Account type.\n */\n type: enums([\n `${EthAccountType.Eoa}`,\n `${EthAccountType.Erc4337}`,\n `${BtcAccountType.P2wpkh}`,\n ]),\n\n /**\n * Account main address.\n */\n address: string(),\n\n /**\n * Account options.\n */\n options: record(string(), JsonStruct),\n\n /**\n * Account supported methods.\n */\n methods: array(string()),\n});\n\n/**\n * Keyring Account type represents an account and its properties from the\n * point of view of the keyring.\n */\nexport type KeyringAccount = Infer<typeof KeyringAccountStruct>;\n"]}
|
package/dist/api/balance.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import type { Infer } from 'superstruct';
|
2
|
-
export declare const BalanceStruct: import("superstruct").Struct<{
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
|
+
export declare const BalanceStruct: import("@metamask/superstruct").Struct<{
|
3
3
|
amount: string;
|
4
4
|
unit: string;
|
5
5
|
}, {
|
6
|
-
amount: import("superstruct").Struct<string, null>;
|
7
|
-
unit: import("superstruct").Struct<string, null>;
|
6
|
+
amount: import("@metamask/superstruct").Struct<string, null>;
|
7
|
+
unit: import("@metamask/superstruct").Struct<string, null>;
|
8
8
|
}>;
|
9
9
|
export declare type Balance = Infer<typeof BalanceStruct>;
|
package/dist/api/balance.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.BalanceStruct = void 0;
|
4
|
-
const superstruct_1 = require("superstruct");
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
5
5
|
const superstruct_2 = require("../superstruct");
|
6
6
|
const utils_1 = require("../utils");
|
7
7
|
exports.BalanceStruct = (0, superstruct_2.object)({
|
package/dist/api/balance.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/api/balance.ts"],"names":[],"mappings":";;;AACA,
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/api/balance.ts"],"names":[],"mappings":";;;AACA,uDAA+C;AAE/C,gDAAwC;AACxC,oCAA8C;AAEjC,QAAA,aAAa,GAAG,IAAA,oBAAM,EAAC;IAClC,MAAM,EAAE,0BAAkB;IAC1B,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { string } from '@metamask/superstruct';\n\nimport { object } from '../superstruct';\nimport { StringNumberStruct } from '../utils';\n\nexport const BalanceStruct = object({\n amount: StringNumberStruct,\n unit: string(),\n});\n\nexport type Balance = Infer<typeof BalanceStruct>;\n"]}
|
package/dist/api/caip.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import { type Infer } from 'superstruct';
|
1
|
+
import { type Infer } from '@metamask/superstruct';
|
2
2
|
/**
|
3
3
|
* A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.
|
4
4
|
*/
|
5
|
-
export declare const CaipAssetTypeStruct: import("superstruct").Struct<string, null>;
|
5
|
+
export declare const CaipAssetTypeStruct: import("@metamask/superstruct").Struct<string, null>;
|
6
6
|
export declare type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;
|
7
7
|
/**
|
8
8
|
* A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.
|
9
9
|
*/
|
10
|
-
export declare const CaipAssetIdStruct: import("superstruct").Struct<string, null>;
|
10
|
+
export declare const CaipAssetIdStruct: import("@metamask/superstruct").Struct<string, null>;
|
11
11
|
export declare type CaipAssetId = Infer<typeof CaipAssetIdStruct>;
|
12
12
|
/**
|
13
13
|
* Check if the given value is a {@link CaipAssetType}.
|
package/dist/api/caip.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.isCaipAssetId = exports.isCaipAssetType = exports.CaipAssetIdStruct = exports.CaipAssetTypeStruct = void 0;
|
4
|
-
const superstruct_1 = require("superstruct");
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
5
5
|
const superstruct_2 = require("../superstruct");
|
6
6
|
const CAIP_ASSET_TYPE_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;
|
7
7
|
const CAIP_ASSET_ID_REGEX = /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;
|
package/dist/api/caip.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"caip.js","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"caip.js","sourceRoot":"","sources":["../../src/api/caip.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAEvD,gDAA+C;AAE/C,MAAM,qBAAqB,GACzB,2JAA2J,CAAC;AAE9J,MAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAEhM;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAA,2BAAa,EAC9C,eAAe,EACf,qBAAqB,CACtB,CAAC;AAGF;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,2BAAa,EAC5C,aAAa,EACb,mBAAmB,CACpB,CAAC;AAGF;;;;;;;;;;;GAWG;AACH,SAAgB,eAAe,CAAC,KAAc;IAC5C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,2BAAmB,CAAC,CAAC;AACxC,CAAC;AAFD,0CAEC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,yBAAiB,CAAC,CAAC;AACtC,CAAC;AAFD,sCAEC","sourcesContent":["import { is, type Infer } from '@metamask/superstruct';\n\nimport { definePattern } from '../superstruct';\n\nconst CAIP_ASSET_TYPE_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u;\n\nconst CAIP_ASSET_ID_REGEX =\n /^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u;\n\n/**\n * A CAIP-19 asset type identifier, i.e., a human-readable type of asset identifier.\n */\nexport const CaipAssetTypeStruct = definePattern(\n 'CaipAssetType',\n CAIP_ASSET_TYPE_REGEX,\n);\nexport type CaipAssetType = Infer<typeof CaipAssetTypeStruct>;\n\n/**\n * A CAIP-19 asset ID identifier, i.e., a human-readable type of asset ID.\n */\nexport const CaipAssetIdStruct = definePattern(\n 'CaipAssetId',\n CAIP_ASSET_ID_REGEX,\n);\nexport type CaipAssetId = Infer<typeof CaipAssetIdStruct>;\n\n/**\n * Check if the given value is a {@link CaipAssetType}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetType}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // true\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // true\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // false\n * ```\n */\nexport function isCaipAssetType(value: unknown): value is CaipAssetType {\n return is(value, CaipAssetTypeStruct);\n}\n\n/**\n * Check if the given value is a {@link CaipAssetId}.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link CaipAssetId}.\n * @example\n * ```ts\n * isCaipAssetType('eip155:1/slip44:60'); // false\n * isCaipAssetType('cosmos:cosmoshub-3/slip44:118'); // false\n * isCaipAssetType('hedera:mainnet/nft:0.0.55492/12'); // true\n * ```\n */\nexport function isCaipAssetId(value: unknown): value is CaipAssetId {\n return is(value, CaipAssetIdStruct);\n}\n"]}
|
package/dist/api/export.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Infer } from 'superstruct';
|
2
|
-
export declare const KeyringAccountDataStruct: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
|
+
export declare const KeyringAccountDataStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
3
3
|
/**
|
4
4
|
* Response to a call to `exportAccount`.
|
5
5
|
*
|
package/dist/api/export.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.KeyringAccountDataStruct = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
4
5
|
const utils_1 = require("@metamask/utils");
|
5
|
-
const superstruct_1 = require("superstruct");
|
6
6
|
exports.KeyringAccountDataStruct = (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct);
|
7
7
|
//# sourceMappingURL=export.js.map
|
package/dist/api/export.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/api/export.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/api/export.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AACvD,2CAA6C;AAEhC,QAAA,wBAAwB,GAAG,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { record, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringAccountDataStruct = record(string(), JsonStruct);\n\n/**\n * Response to a call to `exportAccount`.\n *\n * The exact response depends on the keyring implementation.\n */\nexport type KeyringAccountData = Infer<typeof KeyringAccountDataStruct>;\n"]}
|
package/dist/api/request.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Infer } from 'superstruct';
|
2
|
-
export declare const KeyringRequestStruct: import("superstruct").Struct<{
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
|
+
export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
|
3
3
|
id: string;
|
4
4
|
scope: string;
|
5
5
|
account: string;
|
@@ -11,24 +11,24 @@ export declare const KeyringRequestStruct: import("superstruct").Struct<{
|
|
11
11
|
/**
|
12
12
|
* Keyring request ID (UUIDv4).
|
13
13
|
*/
|
14
|
-
id: import("superstruct").Struct<string, null>;
|
14
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
15
15
|
/**
|
16
16
|
* Request's scope (CAIP-2 chain ID).
|
17
17
|
*/
|
18
|
-
scope: import("superstruct").Struct<string, null>;
|
18
|
+
scope: import("@metamask/superstruct").Struct<string, null>;
|
19
19
|
/**
|
20
20
|
* Account ID (UUIDv4).
|
21
21
|
*/
|
22
|
-
account: import("superstruct").Struct<string, null>;
|
22
|
+
account: import("@metamask/superstruct").Struct<string, null>;
|
23
23
|
/**
|
24
24
|
* Inner request sent by the client application.
|
25
25
|
*/
|
26
|
-
request: import("superstruct").Struct<{
|
26
|
+
request: import("@metamask/superstruct").Struct<{
|
27
27
|
method: string;
|
28
28
|
params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
|
29
29
|
}, {
|
30
|
-
method: import("superstruct").Struct<string, null>;
|
31
|
-
params: import("superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
|
30
|
+
method: import("@metamask/superstruct").Struct<string, null>;
|
31
|
+
params: import("@metamask/superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
|
32
32
|
}>;
|
33
33
|
}>;
|
34
34
|
/**
|
package/dist/api/request.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.KeyringRequestStruct = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
4
5
|
const utils_1 = require("@metamask/utils");
|
5
|
-
const superstruct_1 = require("superstruct");
|
6
6
|
const superstruct_2 = require("../superstruct");
|
7
7
|
const utils_2 = require("../utils");
|
8
8
|
exports.KeyringRequestStruct = (0, superstruct_2.object)({
|
package/dist/api/request.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,gDAAuD;AACvD,oCAAsC;AAEzB,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,kBAAU;IAEd;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,OAAO,EAAE,kBAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC;QACd,MAAM,EAAE,IAAA,oBAAM,GAAE;QAChB,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
|
package/dist/api/response.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Infer } from 'superstruct';
|
2
|
-
export declare const KeyringResponseStruct: import("superstruct").Struct<{
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
|
+
export declare const KeyringResponseStruct: import("@metamask/superstruct").Struct<{
|
3
3
|
pending: true;
|
4
4
|
redirect?: {
|
5
5
|
message?: string;
|
package/dist/api/response.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.KeyringResponseStruct = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
4
5
|
const utils_1 = require("@metamask/utils");
|
5
|
-
const superstruct_1 = require("superstruct");
|
6
6
|
const superstruct_2 = require("../superstruct");
|
7
7
|
exports.KeyringResponseStruct = (0, superstruct_1.union)([
|
8
8
|
(0, superstruct_2.object)({
|
package/dist/api/response.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAC/D,2CAA6C;AAE7C,gDAAuD;AAE1C,QAAA,qBAAqB,GAAG,IAAA,mBAAK,EAAC;IACzC,IAAA,oBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,IAAA,2BAAa,EACrB,IAAA,oBAAM,EAAC;YACL,OAAO,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,GAAG,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,IAAA,oBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
|
package/dist/btc/types.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import type { Infer } from 'superstruct';
|
2
|
-
export declare const BtcP2wpkhAddressStruct: import("superstruct").Struct<string, null>;
|
1
|
+
import type { Infer } from '@metamask/superstruct';
|
2
|
+
export declare const BtcP2wpkhAddressStruct: import("@metamask/superstruct").Struct<string, null>;
|
3
3
|
/**
|
4
4
|
* Supported Bitcoin methods.
|
5
5
|
*/
|
6
6
|
export declare enum BtcMethod {
|
7
7
|
SendMany = "btc_sendmany"
|
8
8
|
}
|
9
|
-
export declare const BtcP2wpkhAccountStruct: import("superstruct").Struct<{
|
9
|
+
export declare const BtcP2wpkhAccountStruct: import("@metamask/superstruct").Struct<{
|
10
10
|
type: "bip122:p2wpkh";
|
11
11
|
id: string;
|
12
12
|
address: string;
|
@@ -16,18 +16,18 @@ export declare const BtcP2wpkhAccountStruct: import("superstruct").Struct<{
|
|
16
16
|
/**
|
17
17
|
* Account address.
|
18
18
|
*/
|
19
|
-
address: import("superstruct").Struct<string, null>;
|
19
|
+
address: import("@metamask/superstruct").Struct<string, null>;
|
20
20
|
/**
|
21
21
|
* Account type.
|
22
22
|
*/
|
23
|
-
type: import("superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
|
23
|
+
type: import("@metamask/superstruct").Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
|
24
24
|
/**
|
25
25
|
* Account supported methods.
|
26
26
|
*/
|
27
|
-
methods: import("superstruct").Struct<"btc_sendmany"[], import("superstruct").Struct<"btc_sendmany", {
|
27
|
+
methods: import("@metamask/superstruct").Struct<"btc_sendmany"[], import("@metamask/superstruct").Struct<"btc_sendmany", {
|
28
28
|
btc_sendmany: "btc_sendmany";
|
29
29
|
}>>;
|
30
|
-
id: import("superstruct").Struct<string, null>;
|
31
|
-
options: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
30
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
31
|
+
options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
32
32
|
}>;
|
33
33
|
export declare type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;
|
package/dist/btc/types.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.BtcP2wpkhAccountStruct = exports.BtcMethod = exports.BtcP2wpkhAddressStruct = void 0;
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
4
5
|
const bech32_1 = require("bech32");
|
5
|
-
const superstruct_1 = require("superstruct");
|
6
6
|
const api_1 = require("../api");
|
7
7
|
const superstruct_2 = require("../superstruct");
|
8
8
|
exports.BtcP2wpkhAddressStruct = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'BtcP2wpkhAddressStruct', (address) => {
|
package/dist/btc/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/btc/types.ts"],"names":[],"mappings":";;;AACA,uDAA8E;AAC9E,mCAAgC;AAEhC,gCAA8D;AAC9D,gDAAwC;AAE3B,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAC1C,IAAA,oBAAM,GAAE,EACR,wBAAwB,EACxB,CAAC,OAAe,EAAE,EAAE;IAClB,IAAI;QACF,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KACxB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,IAAI,KAAK,CACd,oCAAqC,KAAe,CAAC,OAAO,EAAE,CAC/D,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,sCAAyB,CAAA;AAC3B,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB;AAEY,QAAA,sBAAsB,GAAG,IAAA,oBAAM,EAAC;IAC3C,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,8BAAsB;IAE/B;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC;IAEzC;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;CACjD,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { string, array, enums, refine, literal } from '@metamask/superstruct';\nimport { bech32 } from 'bech32';\n\nimport { KeyringAccountStruct, BtcAccountType } from '../api';\nimport { object } from '../superstruct';\n\nexport const BtcP2wpkhAddressStruct = refine(\n string(),\n 'BtcP2wpkhAddressStruct',\n (address: string) => {\n try {\n bech32.decode(address);\n } catch (error) {\n return new Error(\n `Could not decode P2WPKH address: ${(error as Error).message}`,\n );\n }\n return true;\n },\n);\n\n/**\n * Supported Bitcoin methods.\n */\nexport enum BtcMethod {\n // General transaction methods\n SendMany = 'btc_sendmany',\n}\n\nexport const BtcP2wpkhAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: BtcP2wpkhAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${BtcAccountType.P2wpkh}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${BtcMethod.SendMany}`])),\n});\n\nexport type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;\n"]}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { type Infer } from 'superstruct';
|
1
|
+
import { type Infer } from '@metamask/superstruct';
|
2
2
|
/**
|
3
3
|
* Struct of a UserOperation as defined by ERC-4337.
|
4
4
|
* @see https://eips.ethereum.org/EIPS/eip-4337#definitions
|
5
5
|
*/
|
6
|
-
export declare const EthUserOperationStruct: import("superstruct").Struct<{
|
6
|
+
export declare const EthUserOperationStruct: import("@metamask/superstruct").Struct<{
|
7
7
|
sender: string;
|
8
8
|
nonce: string;
|
9
9
|
initCode: string;
|
@@ -16,24 +16,24 @@ export declare const EthUserOperationStruct: import("superstruct").Struct<{
|
|
16
16
|
paymasterAndData: string;
|
17
17
|
signature: string;
|
18
18
|
}, {
|
19
|
-
sender: import("superstruct").Struct<string, null>;
|
20
|
-
nonce: import("superstruct").Struct<string, null>;
|
21
|
-
initCode: import("superstruct").Struct<string, null>;
|
22
|
-
callData: import("superstruct").Struct<string, null>;
|
23
|
-
callGasLimit: import("superstruct").Struct<string, null>;
|
24
|
-
verificationGasLimit: import("superstruct").Struct<string, null>;
|
25
|
-
preVerificationGas: import("superstruct").Struct<string, null>;
|
26
|
-
maxFeePerGas: import("superstruct").Struct<string, null>;
|
27
|
-
maxPriorityFeePerGas: import("superstruct").Struct<string, null>;
|
28
|
-
paymasterAndData: import("superstruct").Struct<string, null>;
|
29
|
-
signature: import("superstruct").Struct<string, null>;
|
19
|
+
sender: import("@metamask/superstruct").Struct<string, null>;
|
20
|
+
nonce: import("@metamask/superstruct").Struct<string, null>;
|
21
|
+
initCode: import("@metamask/superstruct").Struct<string, null>;
|
22
|
+
callData: import("@metamask/superstruct").Struct<string, null>;
|
23
|
+
callGasLimit: import("@metamask/superstruct").Struct<string, null>;
|
24
|
+
verificationGasLimit: import("@metamask/superstruct").Struct<string, null>;
|
25
|
+
preVerificationGas: import("@metamask/superstruct").Struct<string, null>;
|
26
|
+
maxFeePerGas: import("@metamask/superstruct").Struct<string, null>;
|
27
|
+
maxPriorityFeePerGas: import("@metamask/superstruct").Struct<string, null>;
|
28
|
+
paymasterAndData: import("@metamask/superstruct").Struct<string, null>;
|
29
|
+
signature: import("@metamask/superstruct").Struct<string, null>;
|
30
30
|
}>;
|
31
31
|
export declare type EthUserOperation = Infer<typeof EthUserOperationStruct>;
|
32
32
|
/**
|
33
33
|
* Struct containing the most basic transaction information required to
|
34
34
|
* construct a UserOperation.
|
35
35
|
*/
|
36
|
-
export declare const EthBaseTransactionStruct: import("superstruct").Struct<{
|
36
|
+
export declare const EthBaseTransactionStruct: import("@metamask/superstruct").Struct<{
|
37
37
|
value: string;
|
38
38
|
data: string;
|
39
39
|
to: string;
|
@@ -41,18 +41,18 @@ export declare const EthBaseTransactionStruct: import("superstruct").Struct<{
|
|
41
41
|
/**
|
42
42
|
* Address of the transaction recipient.
|
43
43
|
*/
|
44
|
-
to: import("superstruct").Struct<string, null>;
|
44
|
+
to: import("@metamask/superstruct").Struct<string, null>;
|
45
45
|
/**
|
46
46
|
* Amount of wei to transfer to the recipient.
|
47
47
|
*/
|
48
|
-
value: import("superstruct").Struct<string, null>;
|
48
|
+
value: import("@metamask/superstruct").Struct<string, null>;
|
49
49
|
/**
|
50
50
|
* Data to pass to the recipient.
|
51
51
|
*/
|
52
|
-
data: import("superstruct").Struct<string, null>;
|
52
|
+
data: import("@metamask/superstruct").Struct<string, null>;
|
53
53
|
}>;
|
54
54
|
export declare type EthBaseTransaction = Infer<typeof EthBaseTransactionStruct>;
|
55
|
-
export declare const EthBaseUserOperationStruct: import("superstruct").Struct<{
|
55
|
+
export declare const EthBaseUserOperationStruct: import("@metamask/superstruct").Struct<{
|
56
56
|
nonce: string;
|
57
57
|
initCode: string;
|
58
58
|
callData: string;
|
@@ -65,32 +65,32 @@ export declare const EthBaseUserOperationStruct: import("superstruct").Struct<{
|
|
65
65
|
preVerificationGas: string;
|
66
66
|
};
|
67
67
|
}, {
|
68
|
-
nonce: import("superstruct").Struct<string, null>;
|
69
|
-
initCode: import("superstruct").Struct<string, null>;
|
70
|
-
callData: import("superstruct").Struct<string, null>;
|
71
|
-
gasLimits: import("superstruct").Struct<import("../../superstruct").ExactOptionalTag | {
|
68
|
+
nonce: import("@metamask/superstruct").Struct<string, null>;
|
69
|
+
initCode: import("@metamask/superstruct").Struct<string, null>;
|
70
|
+
callData: import("@metamask/superstruct").Struct<string, null>;
|
71
|
+
gasLimits: import("@metamask/superstruct").Struct<import("../../superstruct").ExactOptionalTag | {
|
72
72
|
callGasLimit: string;
|
73
73
|
verificationGasLimit: string;
|
74
74
|
preVerificationGas: string;
|
75
75
|
}, {
|
76
|
-
callGasLimit: import("superstruct").Struct<string, null>;
|
77
|
-
verificationGasLimit: import("superstruct").Struct<string, null>;
|
78
|
-
preVerificationGas: import("superstruct").Struct<string, null>;
|
76
|
+
callGasLimit: import("@metamask/superstruct").Struct<string, null>;
|
77
|
+
verificationGasLimit: import("@metamask/superstruct").Struct<string, null>;
|
78
|
+
preVerificationGas: import("@metamask/superstruct").Struct<string, null>;
|
79
79
|
}>;
|
80
|
-
dummyPaymasterAndData: import("superstruct").Struct<string, null>;
|
81
|
-
dummySignature: import("superstruct").Struct<string, null>;
|
82
|
-
bundlerUrl: import("superstruct").Struct<string, null>;
|
80
|
+
dummyPaymasterAndData: import("@metamask/superstruct").Struct<string, null>;
|
81
|
+
dummySignature: import("@metamask/superstruct").Struct<string, null>;
|
82
|
+
bundlerUrl: import("@metamask/superstruct").Struct<string, null>;
|
83
83
|
}>;
|
84
84
|
export declare type EthBaseUserOperation = Infer<typeof EthBaseUserOperationStruct>;
|
85
|
-
export declare const EthUserOperationPatchStruct: import("superstruct").Struct<{
|
85
|
+
export declare const EthUserOperationPatchStruct: import("@metamask/superstruct").Struct<{
|
86
86
|
paymasterAndData: string;
|
87
87
|
callGasLimit?: string;
|
88
88
|
verificationGasLimit?: string;
|
89
89
|
preVerificationGas?: string;
|
90
90
|
}, {
|
91
|
-
paymasterAndData: import("superstruct").Struct<string, null>;
|
92
|
-
callGasLimit: import("superstruct").Struct<string | import("../../superstruct").ExactOptionalTag, null>;
|
93
|
-
verificationGasLimit: import("superstruct").Struct<string | import("../../superstruct").ExactOptionalTag, null>;
|
94
|
-
preVerificationGas: import("superstruct").Struct<string | import("../../superstruct").ExactOptionalTag, null>;
|
91
|
+
paymasterAndData: import("@metamask/superstruct").Struct<string, null>;
|
92
|
+
callGasLimit: import("@metamask/superstruct").Struct<string | import("../../superstruct").ExactOptionalTag, null>;
|
93
|
+
verificationGasLimit: import("@metamask/superstruct").Struct<string | import("../../superstruct").ExactOptionalTag, null>;
|
94
|
+
preVerificationGas: import("@metamask/superstruct").Struct<string | import("../../superstruct").ExactOptionalTag, null>;
|
95
95
|
}>;
|
96
96
|
export declare type EthUserOperationPatch = Infer<typeof EthUserOperationPatchStruct>;
|