@metamask/keyring-api 11.0.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/dist/api/account.cjs +3 -4
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +1 -1
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +1 -1
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +1 -2
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/asset.cjs +82 -0
- package/dist/api/asset.cjs.map +1 -0
- package/dist/api/asset.d.cts +93 -0
- package/dist/api/asset.d.cts.map +1 -0
- package/dist/api/asset.d.mts +93 -0
- package/dist/api/asset.d.mts.map +1 -0
- package/dist/api/asset.mjs +79 -0
- package/dist/api/asset.mjs.map +1 -0
- package/dist/api/balance.cjs +3 -4
- package/dist/api/balance.cjs.map +1 -1
- package/dist/api/balance.d.cts +1 -1
- package/dist/api/balance.d.cts.map +1 -1
- package/dist/api/balance.d.mts +1 -1
- package/dist/api/balance.d.mts.map +1 -1
- package/dist/api/balance.mjs +1 -2
- package/dist/api/balance.mjs.map +1 -1
- package/dist/api/caip.cjs +3 -3
- package/dist/api/caip.cjs.map +1 -1
- package/dist/api/caip.d.cts.map +1 -1
- package/dist/api/caip.d.mts.map +1 -1
- package/dist/api/caip.mjs +1 -1
- package/dist/api/caip.mjs.map +1 -1
- package/dist/api/index.cjs +3 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +4 -1
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +4 -1
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +3 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs +2 -0
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +14 -0
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +14 -0
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs +2 -0
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/pagination.cjs +28 -0
- package/dist/api/pagination.cjs.map +1 -0
- package/dist/api/pagination.d.cts +59 -0
- package/dist/api/pagination.d.cts.map +1 -0
- package/dist/api/pagination.d.mts +59 -0
- package/dist/api/pagination.d.mts.map +1 -0
- package/dist/api/pagination.mjs +25 -0
- package/dist/api/pagination.mjs.map +1 -0
- package/dist/api/request.cjs +6 -7
- package/dist/api/request.cjs.map +1 -1
- package/dist/api/request.d.cts +5 -5
- package/dist/api/request.d.cts.map +1 -1
- package/dist/api/request.d.mts +5 -5
- package/dist/api/request.d.mts.map +1 -1
- package/dist/api/request.mjs +1 -2
- package/dist/api/request.mjs.map +1 -1
- package/dist/api/response.cjs +6 -6
- package/dist/api/response.cjs.map +1 -1
- package/dist/api/response.d.cts +1 -1
- package/dist/api/response.d.cts.map +1 -1
- package/dist/api/response.d.mts +1 -1
- package/dist/api/response.d.mts.map +1 -1
- package/dist/api/response.mjs +1 -1
- package/dist/api/response.mjs.map +1 -1
- package/dist/api/transaction.cjs +294 -0
- package/dist/api/transaction.cjs.map +1 -0
- package/dist/api/transaction.d.cts +773 -0
- package/dist/api/transaction.d.cts.map +1 -0
- package/dist/api/transaction.d.mts +773 -0
- package/dist/api/transaction.d.mts.map +1 -0
- package/dist/api/transaction.mjs +291 -0
- package/dist/api/transaction.mjs.map +1 -0
- package/dist/btc/types.cjs +2 -2
- package/dist/btc/types.cjs.map +1 -1
- package/dist/btc/types.d.cts +1 -1
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +1 -1
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/btc/types.mjs +2 -2
- package/dist/btc/types.mjs.map +1 -1
- package/dist/eth/erc4337/types.cjs +10 -11
- package/dist/eth/erc4337/types.cjs.map +1 -1
- package/dist/eth/erc4337/types.d.cts +4 -4
- package/dist/eth/erc4337/types.d.cts.map +1 -1
- package/dist/eth/erc4337/types.d.mts +4 -4
- package/dist/eth/erc4337/types.d.mts.map +1 -1
- package/dist/eth/erc4337/types.mjs +1 -2
- package/dist/eth/erc4337/types.mjs.map +1 -1
- package/dist/eth/types.cjs +6 -6
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +2 -2
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +2 -2
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +1 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/eth/utils.cjs.map +1 -1
- package/dist/eth/utils.d.cts.map +1 -1
- package/dist/eth/utils.d.mts.map +1 -1
- package/dist/eth/utils.mjs.map +1 -1
- package/dist/events.cjs +67 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +161 -0
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +161 -0
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +66 -0
- package/dist/events.mjs.map +1 -1
- package/dist/index.cjs +2 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{internal/api.cjs → rpc.cjs} +78 -38
- package/dist/rpc.cjs.map +1 -0
- package/dist/{internal/api.d.cts → rpc.d.cts} +402 -59
- package/dist/rpc.d.cts.map +1 -0
- package/dist/{internal/api.d.mts → rpc.d.mts} +402 -59
- package/dist/rpc.d.mts.map +1 -0
- package/dist/{internal/api.mjs → rpc.mjs} +44 -5
- package/dist/rpc.mjs.map +1 -0
- package/dist/sol/types.cjs +3 -3
- package/dist/sol/types.cjs.map +1 -1
- package/dist/sol/types.d.cts +1 -1
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +1 -1
- package/dist/sol/types.d.mts.map +1 -1
- package/dist/sol/types.mjs +1 -1
- package/dist/sol/types.mjs.map +1 -1
- package/package.json +11 -14
- package/dist/JsonRpcRequest.cjs +0 -13
- package/dist/JsonRpcRequest.cjs.map +0 -1
- package/dist/JsonRpcRequest.d.cts +0 -17
- package/dist/JsonRpcRequest.d.cts.map +0 -1
- package/dist/JsonRpcRequest.d.mts +0 -17
- package/dist/JsonRpcRequest.d.mts.map +0 -1
- package/dist/JsonRpcRequest.mjs +0 -10
- package/dist/JsonRpcRequest.mjs.map +0 -1
- package/dist/KeyringClient.cjs +0 -124
- package/dist/KeyringClient.cjs.map +0 -1
- package/dist/KeyringClient.d.cts +0 -29
- package/dist/KeyringClient.d.cts.map +0 -1
- package/dist/KeyringClient.d.mts +0 -29
- package/dist/KeyringClient.d.mts.map +0 -1
- package/dist/KeyringClient.mjs +0 -120
- package/dist/KeyringClient.mjs.map +0 -1
- package/dist/KeyringSnapRpcClient.cjs +0 -68
- package/dist/KeyringSnapRpcClient.cjs.map +0 -1
- package/dist/KeyringSnapRpcClient.d.cts +0 -40
- package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
- package/dist/KeyringSnapRpcClient.d.mts +0 -40
- package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
- package/dist/KeyringSnapRpcClient.mjs +0 -63
- package/dist/KeyringSnapRpcClient.mjs.map +0 -1
- package/dist/internal/api.cjs.map +0 -1
- package/dist/internal/api.d.cts.map +0 -1
- package/dist/internal/api.d.mts.map +0 -1
- package/dist/internal/api.mjs.map +0 -1
- package/dist/internal/eth/EthKeyring.cjs +0 -3
- package/dist/internal/eth/EthKeyring.cjs.map +0 -1
- package/dist/internal/eth/EthKeyring.d.cts +0 -34
- package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
- package/dist/internal/eth/EthKeyring.d.mts +0 -34
- package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
- package/dist/internal/eth/EthKeyring.mjs +0 -2
- package/dist/internal/eth/EthKeyring.mjs.map +0 -1
- package/dist/internal/eth/index.cjs +0 -3
- package/dist/internal/eth/index.cjs.map +0 -1
- package/dist/internal/eth/index.d.cts +0 -2
- package/dist/internal/eth/index.d.cts.map +0 -1
- package/dist/internal/eth/index.d.mts +0 -2
- package/dist/internal/eth/index.d.mts.map +0 -1
- package/dist/internal/eth/index.mjs +0 -2
- package/dist/internal/eth/index.mjs.map +0 -1
- package/dist/internal/events.cjs +0 -72
- package/dist/internal/events.cjs.map +0 -1
- package/dist/internal/events.d.cts +0 -162
- package/dist/internal/events.d.cts.map +0 -1
- package/dist/internal/events.d.mts +0 -162
- package/dist/internal/events.d.mts.map +0 -1
- package/dist/internal/events.mjs +0 -69
- package/dist/internal/events.mjs.map +0 -1
- package/dist/internal/index.cjs +0 -21
- package/dist/internal/index.cjs.map +0 -1
- package/dist/internal/index.d.cts +0 -6
- package/dist/internal/index.d.cts.map +0 -1
- package/dist/internal/index.d.mts +0 -6
- package/dist/internal/index.d.mts.map +0 -1
- package/dist/internal/index.mjs +0 -5
- package/dist/internal/index.mjs.map +0 -1
- package/dist/internal/rpc.cjs +0 -33
- package/dist/internal/rpc.cjs.map +0 -1
- package/dist/internal/rpc.d.cts +0 -26
- package/dist/internal/rpc.d.cts.map +0 -1
- package/dist/internal/rpc.d.mts +0 -26
- package/dist/internal/rpc.d.mts.map +0 -1
- package/dist/internal/rpc.mjs +0 -29
- package/dist/internal/rpc.mjs.map +0 -1
- package/dist/internal/types.cjs +0 -52
- package/dist/internal/types.cjs.map +0 -1
- package/dist/internal/types.d.cts +0 -392
- package/dist/internal/types.d.cts.map +0 -1
- package/dist/internal/types.d.mts +0 -392
- package/dist/internal/types.d.mts.map +0 -1
- package/dist/internal/types.mjs +0 -49
- package/dist/internal/types.mjs.map +0 -1
- package/dist/rpc-handler.cjs +0 -136
- package/dist/rpc-handler.cjs.map +0 -1
- package/dist/rpc-handler.d.cts +0 -30
- package/dist/rpc-handler.d.cts.map +0 -1
- package/dist/rpc-handler.d.mts +0 -30
- package/dist/rpc-handler.d.mts.map +0 -1
- package/dist/rpc-handler.mjs +0 -131
- package/dist/rpc-handler.mjs.map +0 -1
- package/dist/snap-utils.cjs +0 -20
- package/dist/snap-utils.cjs.map +0 -1
- package/dist/snap-utils.d.cts +0 -12
- package/dist/snap-utils.d.cts.map +0 -1
- package/dist/snap-utils.d.mts +0 -12
- package/dist/snap-utils.d.mts.map +0 -1
- package/dist/snap-utils.mjs +0 -17
- package/dist/snap-utils.mjs.map +0 -1
- package/dist/superstruct.cjs +0 -80
- package/dist/superstruct.cjs.map +0 -1
- package/dist/superstruct.d.cts +0 -84
- package/dist/superstruct.d.cts.map +0 -1
- package/dist/superstruct.d.mts +0 -84
- package/dist/superstruct.d.mts.map +0 -1
- package/dist/superstruct.mjs +0 -74
- package/dist/superstruct.mjs.map +0 -1
- package/dist/utils/index.cjs +0 -19
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.d.cts +0 -3
- package/dist/utils/index.d.cts.map +0 -1
- package/dist/utils/index.d.mts +0 -3
- package/dist/utils/index.d.mts.map +0 -1
- package/dist/utils/index.mjs +0 -3
- package/dist/utils/index.mjs.map +0 -1
- package/dist/utils/types.cjs +0 -29
- package/dist/utils/types.cjs.map +0 -1
- package/dist/utils/types.d.cts +0 -18
- package/dist/utils/types.d.cts.map +0 -1
- package/dist/utils/types.d.mts +0 -18
- package/dist/utils/types.d.mts.map +0 -1
- package/dist/utils/types.mjs +0 -26
- package/dist/utils/types.mjs.map +0 -1
- package/dist/utils/typing.cjs +0 -20
- package/dist/utils/typing.cjs.map +0 -1
- package/dist/utils/typing.d.cts +0 -33
- package/dist/utils/typing.d.cts.map +0 -1
- package/dist/utils/typing.d.mts +0 -33
- package/dist/utils/typing.d.mts.map +0 -1
- package/dist/utils/typing.mjs +0 -17
- package/dist/utils/typing.mjs.map +0 -1
package/dist/api/response.cjs
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.KeyringResponseStruct = void 0;
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
4
5
|
const superstruct_1 = require("@metamask/superstruct");
|
5
6
|
const utils_1 = require("@metamask/utils");
|
6
|
-
const superstruct_2 = require("../superstruct.cjs");
|
7
7
|
exports.KeyringResponseStruct = (0, superstruct_1.union)([
|
8
|
-
(0,
|
8
|
+
(0, keyring_utils_1.object)({
|
9
9
|
/**
|
10
10
|
* Pending flag.
|
11
11
|
*
|
@@ -21,12 +21,12 @@ exports.KeyringResponseStruct = (0, superstruct_1.union)([
|
|
21
21
|
* with a link to the redirect URL. The user can choose to follow the link
|
22
22
|
* or cancel the request.
|
23
23
|
*/
|
24
|
-
redirect: (0,
|
25
|
-
message: (0,
|
26
|
-
url: (0,
|
24
|
+
redirect: (0, keyring_utils_1.exactOptional)((0, keyring_utils_1.object)({
|
25
|
+
message: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
|
26
|
+
url: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
|
27
27
|
})),
|
28
28
|
}),
|
29
|
-
(0,
|
29
|
+
(0, keyring_utils_1.object)({
|
30
30
|
/**
|
31
31
|
* Pending flag.
|
32
32
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"response.cjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"response.cjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAA+D;AAC/D,2CAA6C;AAEhC,QAAA,qBAAqB,GAAG,IAAA,mBAAK,EAAC;IACzC,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,IAAA,6BAAa,EACrB,IAAA,sBAAM,EAAC;YACL,OAAO,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,GAAG,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\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/api/response.d.cts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"response.d.cts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"response.d.cts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,qBAAqB;;;;;;;;;QAwChC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/api/response.d.mts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"response.d.mts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"response.d.mts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,qBAAqB;;;;;;;;;QAwChC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/api/response.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
import { exactOptional, object } from "@metamask/keyring-utils";
|
1
2
|
import { literal, string, union } from "@metamask/superstruct";
|
2
3
|
import { JsonStruct } from "@metamask/utils";
|
3
|
-
import { exactOptional, object } from "../superstruct.mjs";
|
4
4
|
export const KeyringResponseStruct = union([
|
5
5
|
object({
|
6
6
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"response.mjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"response.mjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,gCAAgC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAC/D,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;IACzC,MAAM,CAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,aAAa,CACrB,MAAM,CAAC;YACL,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;YAChC,GAAG,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,MAAM,CAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\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"]}
|
@@ -0,0 +1,294 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TransactionsPageStruct = exports.TransactionStruct = exports.TransactionEventStruct = exports.TransactionType = exports.TransactionStatus = exports.FeeType = void 0;
|
4
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
5
|
+
const superstruct_1 = require("@metamask/superstruct");
|
6
|
+
const utils_1 = require("@metamask/utils");
|
7
|
+
const asset_1 = require("./asset.cjs");
|
8
|
+
/**
|
9
|
+
* This struct represents a participant in a transaction.
|
10
|
+
*
|
11
|
+
* @example
|
12
|
+
* ```ts
|
13
|
+
* {
|
14
|
+
* address: '0x1234...',
|
15
|
+
* asset: {
|
16
|
+
* fungible: true,
|
17
|
+
* type: 'eip155:1/slip44:60',
|
18
|
+
* unit: 'ETH',
|
19
|
+
* amount: '0.01',
|
20
|
+
* },
|
21
|
+
* },
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* @example
|
25
|
+
* ```ts
|
26
|
+
* {
|
27
|
+
* address: '0x1234...',
|
28
|
+
* asset: {
|
29
|
+
* fungible: false,
|
30
|
+
* id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',
|
31
|
+
* },
|
32
|
+
* },
|
33
|
+
* ```
|
34
|
+
*
|
35
|
+
* @example
|
36
|
+
* ```ts
|
37
|
+
* {
|
38
|
+
* address: '0x1234...',
|
39
|
+
* asset: null,
|
40
|
+
* },
|
41
|
+
* ```
|
42
|
+
*/
|
43
|
+
const ParticipantStruct = (0, keyring_utils_1.object)({
|
44
|
+
/**
|
45
|
+
* Participant address.
|
46
|
+
*/
|
47
|
+
address: (0, superstruct_1.string)(),
|
48
|
+
/**
|
49
|
+
* Asset being transferred.
|
50
|
+
*/
|
51
|
+
asset: (0, superstruct_1.nullable)(asset_1.AssetStruct),
|
52
|
+
});
|
53
|
+
/**
|
54
|
+
* Fee types.
|
55
|
+
*/
|
56
|
+
var FeeType;
|
57
|
+
(function (FeeType) {
|
58
|
+
/**
|
59
|
+
* Base fee. It is the minimum fee required to include a transaction in the
|
60
|
+
* blockchain.
|
61
|
+
*
|
62
|
+
* For non-confirmed transactions, it must be the maximum base fee. For
|
63
|
+
* confirmed transactions, it must be the actual base fee paid.
|
64
|
+
*/
|
65
|
+
FeeType["Base"] = "base";
|
66
|
+
/**
|
67
|
+
* Priority fee. It is an optional fee used to prioritize the transaction.
|
68
|
+
*
|
69
|
+
* For non-confirmed transactions, it must be the maximum priority fee. For
|
70
|
+
* confirmed transactions, it must be the actual priority fee paid.
|
71
|
+
*/
|
72
|
+
FeeType["Priority"] = "priority";
|
73
|
+
})(FeeType || (exports.FeeType = FeeType = {}));
|
74
|
+
/**
|
75
|
+
* This struct represents a transaction fee.
|
76
|
+
*/
|
77
|
+
const FeeStruct = (0, keyring_utils_1.object)({
|
78
|
+
/**
|
79
|
+
* Fee type {@see FeeType}.
|
80
|
+
*/
|
81
|
+
type: (0, superstruct_1.enums)([`${FeeType.Base}`, `${FeeType.Priority}`]),
|
82
|
+
/**
|
83
|
+
* Asset used to pay for the fee.
|
84
|
+
*/
|
85
|
+
asset: asset_1.AssetStruct,
|
86
|
+
});
|
87
|
+
/**
|
88
|
+
* Transaction statuses.
|
89
|
+
*/
|
90
|
+
var TransactionStatus;
|
91
|
+
(function (TransactionStatus) {
|
92
|
+
/**
|
93
|
+
* The transaction has been submitted but is not yet in the
|
94
|
+
* blockchain. For example, it can be in the mempool.
|
95
|
+
*/
|
96
|
+
TransactionStatus["Submitted"] = "submitted";
|
97
|
+
/**
|
98
|
+
* The transaction is in the blockchain but has not been
|
99
|
+
* confirmed yet.
|
100
|
+
*/
|
101
|
+
TransactionStatus["Unconfirmed"] = "unconfirmed";
|
102
|
+
/**
|
103
|
+
* The transaction has been confirmed.
|
104
|
+
*/
|
105
|
+
TransactionStatus["Confirmed"] = "confirmed";
|
106
|
+
/**
|
107
|
+
* The transaction has failed. For example, it has been reverted.
|
108
|
+
*/
|
109
|
+
TransactionStatus["Failed"] = "failed";
|
110
|
+
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
111
|
+
/**
|
112
|
+
* Transaction types.
|
113
|
+
*/
|
114
|
+
var TransactionType;
|
115
|
+
(function (TransactionType) {
|
116
|
+
/**
|
117
|
+
* The transaction was originated by the account. If the transaction
|
118
|
+
* has a change output that goes back to the same account, it must be tagged
|
119
|
+
* as a send transaction.
|
120
|
+
*/
|
121
|
+
TransactionType["Send"] = "send";
|
122
|
+
/**
|
123
|
+
* The transaction was received by the account, but originated by
|
124
|
+
* another account.
|
125
|
+
*/
|
126
|
+
TransactionType["Receive"] = "receive";
|
127
|
+
})(TransactionType || (exports.TransactionType = TransactionType = {}));
|
128
|
+
/**
|
129
|
+
* This struct represents a transaction event.
|
130
|
+
*/
|
131
|
+
exports.TransactionEventStruct = (0, keyring_utils_1.object)({
|
132
|
+
/**
|
133
|
+
* New status of the transaction.
|
134
|
+
*/
|
135
|
+
status: (0, superstruct_1.enums)([
|
136
|
+
`${TransactionStatus.Submitted}`,
|
137
|
+
`${TransactionStatus.Unconfirmed}`,
|
138
|
+
`${TransactionStatus.Confirmed}`,
|
139
|
+
`${TransactionStatus.Failed}`,
|
140
|
+
]),
|
141
|
+
/**
|
142
|
+
* UNIX timestamp of when the event occurred.
|
143
|
+
*/
|
144
|
+
timestamp: (0, superstruct_1.nullable)((0, superstruct_1.number)()),
|
145
|
+
});
|
146
|
+
/**
|
147
|
+
* This struct represents a blockchain transaction.
|
148
|
+
*
|
149
|
+
* @example
|
150
|
+
* ```ts
|
151
|
+
* const tx = {
|
152
|
+
* id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',
|
153
|
+
* chain: 'bip122:000000000019d6689c085ae165831e93',
|
154
|
+
* account: 'b9beb861-9761-4b97-89ce-d992be5f34da',
|
155
|
+
* status: 'confirmed',
|
156
|
+
* timestamp: 1716367781,
|
157
|
+
* type: 'send',
|
158
|
+
* from: [
|
159
|
+
* {
|
160
|
+
* address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',
|
161
|
+
* asset: {
|
162
|
+
* fungible: true,
|
163
|
+
* type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
|
164
|
+
* unit: 'BTC',
|
165
|
+
* amount: '0.1',
|
166
|
+
* },
|
167
|
+
* },
|
168
|
+
* ],
|
169
|
+
* to: [
|
170
|
+
* {
|
171
|
+
* address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',
|
172
|
+
* asset: {
|
173
|
+
* fungible: true,
|
174
|
+
* type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
|
175
|
+
* unit: 'BTC',
|
176
|
+
* amount: '0.1',
|
177
|
+
* },
|
178
|
+
* },
|
179
|
+
* {
|
180
|
+
* address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',
|
181
|
+
* asset: {
|
182
|
+
* fungible: true,
|
183
|
+
* type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
|
184
|
+
* unit: 'BTC',
|
185
|
+
* amount: '0.1',
|
186
|
+
* },
|
187
|
+
* },
|
188
|
+
* ],
|
189
|
+
* fees: [
|
190
|
+
* {
|
191
|
+
* type: 'priority',
|
192
|
+
* asset: {
|
193
|
+
* fungible: true,
|
194
|
+
* type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
|
195
|
+
* unit: 'BTC',
|
196
|
+
* amount: '0.1',
|
197
|
+
* },
|
198
|
+
* },
|
199
|
+
* ],
|
200
|
+
* };
|
201
|
+
* ```
|
202
|
+
*/
|
203
|
+
exports.TransactionStruct = (0, keyring_utils_1.object)({
|
204
|
+
/**
|
205
|
+
* Chain-specific transaction ID.
|
206
|
+
*/
|
207
|
+
id: (0, superstruct_1.string)(),
|
208
|
+
/**
|
209
|
+
* Chain ID (CAIP-2).
|
210
|
+
*/
|
211
|
+
chain: utils_1.CaipChainIdStruct,
|
212
|
+
/**
|
213
|
+
* Account ID (UUIDv4).
|
214
|
+
*/
|
215
|
+
account: keyring_utils_1.UuidStruct,
|
216
|
+
/**
|
217
|
+
* Transaction status {@see TransactionStatus}.
|
218
|
+
*/
|
219
|
+
status: (0, superstruct_1.enums)([
|
220
|
+
`${TransactionStatus.Submitted}`,
|
221
|
+
`${TransactionStatus.Unconfirmed}`,
|
222
|
+
`${TransactionStatus.Confirmed}`,
|
223
|
+
`${TransactionStatus.Failed}`,
|
224
|
+
]),
|
225
|
+
/**
|
226
|
+
* UNIX timestamp of when the transaction was added to the blockchain. The
|
227
|
+
* timestamp can be null if the transaction has not been included in the
|
228
|
+
* blockchain yet.
|
229
|
+
*/
|
230
|
+
timestamp: (0, superstruct_1.nullable)((0, superstruct_1.number)()),
|
231
|
+
/**
|
232
|
+
* Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
|
233
|
+
* details on the UI.
|
234
|
+
*/
|
235
|
+
type: (0, superstruct_1.enums)([`${TransactionType.Send}`, `${TransactionType.Receive}`]),
|
236
|
+
/**
|
237
|
+
* Transaction sender addresses and amounts.
|
238
|
+
*/
|
239
|
+
from: (0, superstruct_1.array)(ParticipantStruct),
|
240
|
+
/**
|
241
|
+
* Transaction receiver addresses and amounts.
|
242
|
+
*/
|
243
|
+
to: (0, superstruct_1.array)(ParticipantStruct),
|
244
|
+
/**
|
245
|
+
* Total transaction fee.
|
246
|
+
*/
|
247
|
+
fees: (0, superstruct_1.array)(FeeStruct),
|
248
|
+
/**
|
249
|
+
* List of events related to the transaction {@see TransactionEventStruct}.
|
250
|
+
*
|
251
|
+
* The events are tracked in a best-effort basis and may not be available for
|
252
|
+
* all transactions.
|
253
|
+
*/
|
254
|
+
events: (0, superstruct_1.array)(exports.TransactionEventStruct),
|
255
|
+
});
|
256
|
+
/**
|
257
|
+
* This struct represents a page of transactions.
|
258
|
+
*
|
259
|
+
* @example
|
260
|
+
* ```ts
|
261
|
+
* {
|
262
|
+
* data: [
|
263
|
+
* {
|
264
|
+
* // Transaction object
|
265
|
+
* }
|
266
|
+
* ],
|
267
|
+
* next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
|
268
|
+
* }
|
269
|
+
* ```
|
270
|
+
*
|
271
|
+
* @example
|
272
|
+
* ```ts
|
273
|
+
* {
|
274
|
+
* data: [
|
275
|
+
* {
|
276
|
+
* // Transaction object
|
277
|
+
* }
|
278
|
+
* ],
|
279
|
+
* next: null, // No more results
|
280
|
+
* }**
|
281
|
+
* ```
|
282
|
+
*/
|
283
|
+
exports.TransactionsPageStruct = (0, keyring_utils_1.object)({
|
284
|
+
/**
|
285
|
+
* List of transactions.
|
286
|
+
*/
|
287
|
+
data: (0, superstruct_1.array)(exports.TransactionStruct),
|
288
|
+
/**
|
289
|
+
* Next cursor to iterate over the results. If null, there are no more
|
290
|
+
* results.
|
291
|
+
*/
|
292
|
+
next: (0, superstruct_1.nullable)((0, superstruct_1.string)()),
|
293
|
+
});
|
294
|
+
//# sourceMappingURL=transaction.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"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","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { AssetStruct } from './asset';\nimport type { Paginated } from './pagination';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([`${TransactionType.Send}`, `${TransactionType.Receive}`]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|