@metamask/keyring-api 17.2.1 → 17.4.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/dist/api/derivation.cjs +6 -0
  3. package/dist/api/derivation.cjs.map +1 -0
  4. package/dist/api/derivation.d.cts +4 -0
  5. package/dist/api/derivation.d.cts.map +1 -0
  6. package/dist/api/derivation.d.mts +4 -0
  7. package/dist/api/derivation.d.mts.map +1 -0
  8. package/dist/api/derivation.mjs +3 -0
  9. package/dist/api/derivation.mjs.map +1 -0
  10. package/dist/api/discovery.cjs +40 -0
  11. package/dist/api/discovery.cjs.map +1 -0
  12. package/dist/api/discovery.d.cts +65 -0
  13. package/dist/api/discovery.d.cts.map +1 -0
  14. package/dist/api/discovery.d.mts +65 -0
  15. package/dist/api/discovery.d.mts.map +1 -0
  16. package/dist/api/discovery.mjs +37 -0
  17. package/dist/api/discovery.mjs.map +1 -0
  18. package/dist/api/entropy.cjs +3 -0
  19. package/dist/api/entropy.cjs.map +1 -0
  20. package/dist/api/entropy.d.cts +5 -0
  21. package/dist/api/entropy.d.cts.map +1 -0
  22. package/dist/api/entropy.d.mts +5 -0
  23. package/dist/api/entropy.d.mts.map +1 -0
  24. package/dist/api/entropy.mjs +2 -0
  25. package/dist/api/entropy.mjs.map +1 -0
  26. package/dist/api/index.cjs +2 -0
  27. package/dist/api/index.cjs.map +1 -1
  28. package/dist/api/index.d.cts +3 -0
  29. package/dist/api/index.d.cts.map +1 -1
  30. package/dist/api/index.d.mts +3 -0
  31. package/dist/api/index.d.mts.map +1 -1
  32. package/dist/api/index.mjs +2 -0
  33. package/dist/api/index.mjs.map +1 -1
  34. package/dist/api/keyring.cjs.map +1 -1
  35. package/dist/api/keyring.d.cts +25 -2
  36. package/dist/api/keyring.d.cts.map +1 -1
  37. package/dist/api/keyring.d.mts +25 -2
  38. package/dist/api/keyring.d.mts.map +1 -1
  39. package/dist/api/keyring.mjs.map +1 -1
  40. package/dist/api/options.cjs +17 -0
  41. package/dist/api/options.cjs.map +1 -0
  42. package/dist/api/options.d.cts +21 -0
  43. package/dist/api/options.d.cts.map +1 -0
  44. package/dist/api/options.d.mts +21 -0
  45. package/dist/api/options.d.mts.map +1 -0
  46. package/dist/api/options.mjs +14 -0
  47. package/dist/api/options.mjs.map +1 -0
  48. package/dist/api/transaction.d.cts +4 -4
  49. package/dist/api/transaction.d.mts +4 -4
  50. package/dist/eth/erc4337/types.d.cts +1 -1
  51. package/dist/eth/erc4337/types.d.mts +1 -1
  52. package/dist/events.cjs +29 -0
  53. package/dist/events.cjs.map +1 -1
  54. package/dist/events.d.cts +50 -17
  55. package/dist/events.d.cts.map +1 -1
  56. package/dist/events.d.mts +50 -17
  57. package/dist/events.d.mts.map +1 -1
  58. package/dist/events.mjs +30 -1
  59. package/dist/events.mjs.map +1 -1
  60. package/dist/rpc.cjs +14 -1
  61. package/dist/rpc.cjs.map +1 -1
  62. package/dist/rpc.d.cts +42 -3
  63. package/dist/rpc.d.cts.map +1 -1
  64. package/dist/rpc.d.mts +42 -3
  65. package/dist/rpc.d.mts.map +1 -1
  66. package/dist/rpc.mjs +14 -1
  67. package/dist/rpc.mjs.map +1 -1
  68. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
1
+ {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { DiscoveredAccount } from './discovery';\nimport type { EntropySourceId } from './entropy';\nimport type { KeyringAccountData } from './export';\nimport type { MetaMaskOptions } from './options';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional). The\n * 'metamask' internal options needs to be re-emitted during `notify:*` events.\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(\n options?: Record<string, Json> & MetaMaskOptions,\n ): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Discover accounts.\n *\n * This method is called by the client to allow the keyring to discover\n * existing accounts based on the provided scopes and entropy source ID. Are\n * considered existing accounts, accounts that have at least one transaction,\n * as per BIP-44.\n *\n * The `groupIndex` is used to group accounts with the same value. In\n * strictly BIP-44 wallets, it matches `account_index`, but in wallets that\n * deviate from BIP-44 recommendations, it may align with a different path\n * level for compatibility.\n *\n * @param scopes - The list of scopes for account discovery.\n * @param entropySource - The ID of the entropy source used to derive the accounts.\n * @param groupIndex - The group index that should be used to derive the accounts.\n * @returns A promise resolving to a list of discovered accounts.\n */\n discoverAccounts?(\n scopes: CaipChainId[],\n entropySource: EntropySourceId,\n groupIndex: number,\n ): Promise<DiscoveredAccount[]>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetaMaskOptionsStruct = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
5
+ exports.MetaMaskOptionsStruct = (0, keyring_utils_1.object)({
6
+ /**
7
+ * MetaMask internal options. The 'metamask' field will only be set when
8
+ * the keyring API is being used by a MetaMask client.
9
+ */
10
+ metamask: (0, keyring_utils_1.exactOptional)((0, keyring_utils_1.object)({
11
+ /**
12
+ * Correlation ID that can be passed by MetaMask.
13
+ */
14
+ correlationId: keyring_utils_1.UuidStruct,
15
+ })),
16
+ });
17
+ //# sourceMappingURL=options.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.cjs","sourceRoot":"","sources":["../../src/api/options.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAG/D,QAAA,qBAAqB,GAAG,IAAA,sBAAM,EAAC;IAC1C;;;OAGG;IACH,QAAQ,EAAE,IAAA,6BAAa,EACrB,IAAA,sBAAM,EAAC;QACL;;WAEG;QACH,aAAa,EAAE,0BAAU;KAC1B,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\n\nexport const MetaMaskOptionsStruct = object({\n /**\n * MetaMask internal options. The 'metamask' field will only be set when\n * the keyring API is being used by a MetaMask client.\n */\n metamask: exactOptional(\n object({\n /**\n * Correlation ID that can be passed by MetaMask.\n */\n correlationId: UuidStruct,\n }),\n ),\n});\n\nexport type MetaMaskOptions = Infer<typeof MetaMaskOptionsStruct>;\n"]}
@@ -0,0 +1,21 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ export declare const MetaMaskOptionsStruct: import("@metamask/superstruct").Struct<{
3
+ metamask?: {
4
+ correlationId: string;
5
+ };
6
+ }, {
7
+ /**
8
+ * MetaMask internal options. The 'metamask' field will only be set when
9
+ * the keyring API is being used by a MetaMask client.
10
+ */
11
+ metamask: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
12
+ correlationId: string;
13
+ }, {
14
+ /**
15
+ * Correlation ID that can be passed by MetaMask.
16
+ */
17
+ correlationId: import("@metamask/superstruct").Struct<string, null>;
18
+ }>;
19
+ }>;
20
+ export type MetaMaskOptions = Infer<typeof MetaMaskOptionsStruct>;
21
+ //# sourceMappingURL=options.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.cts","sourceRoot":"","sources":["../../src/api/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAEnD,eAAO,MAAM,qBAAqB;;;;;IAChC;;;OAGG;;;;QAGC;;WAEG;;;EAIP,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ export declare const MetaMaskOptionsStruct: import("@metamask/superstruct").Struct<{
3
+ metamask?: {
4
+ correlationId: string;
5
+ };
6
+ }, {
7
+ /**
8
+ * MetaMask internal options. The 'metamask' field will only be set when
9
+ * the keyring API is being used by a MetaMask client.
10
+ */
11
+ metamask: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
12
+ correlationId: string;
13
+ }, {
14
+ /**
15
+ * Correlation ID that can be passed by MetaMask.
16
+ */
17
+ correlationId: import("@metamask/superstruct").Struct<string, null>;
18
+ }>;
19
+ }>;
20
+ export type MetaMaskOptions = Infer<typeof MetaMaskOptionsStruct>;
21
+ //# sourceMappingURL=options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["../../src/api/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAEnD,eAAO,MAAM,qBAAqB;;;;;IAChC;;;OAGG;;;;QAGC;;WAEG;;;EAIP,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { exactOptional, object, UuidStruct } from "@metamask/keyring-utils";
2
+ export const MetaMaskOptionsStruct = object({
3
+ /**
4
+ * MetaMask internal options. The 'metamask' field will only be set when
5
+ * the keyring API is being used by a MetaMask client.
6
+ */
7
+ metamask: exactOptional(object({
8
+ /**
9
+ * Correlation ID that can be passed by MetaMask.
10
+ */
11
+ correlationId: UuidStruct,
12
+ })),
13
+ });
14
+ //# sourceMappingURL=options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.mjs","sourceRoot":"","sources":["../../src/api/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAG5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;IAC1C;;;OAGG;IACH,QAAQ,EAAE,aAAa,CACrB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,UAAU;KAC1B,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\n\nexport const MetaMaskOptionsStruct = object({\n /**\n * MetaMask internal options. The 'metamask' field will only be set when\n * the keyring API is being used by a MetaMask client.\n */\n metamask: exactOptional(\n object({\n /**\n * Correlation ID that can be passed by MetaMask.\n */\n correlationId: UuidStruct,\n }),\n ),\n});\n\nexport type MetaMaskOptions = Infer<typeof MetaMaskOptionsStruct>;\n"]}
@@ -165,8 +165,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
165
165
  timestamp: number | null;
166
166
  }[];
167
167
  chain: `${string}:${string}`;
168
- account: string;
169
168
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
169
+ account: string;
170
170
  timestamp: number | null;
171
171
  to: {
172
172
  address: string;
@@ -443,8 +443,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
443
443
  timestamp: number | null;
444
444
  }[];
445
445
  chain: `${string}:${string}`;
446
- account: string;
447
446
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
447
+ account: string;
448
448
  timestamp: number | null;
449
449
  to: {
450
450
  address: string;
@@ -496,8 +496,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
496
496
  timestamp: number | null;
497
497
  }[];
498
498
  chain: `${string}:${string}`;
499
- account: string;
500
499
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
500
+ account: string;
501
501
  timestamp: number | null;
502
502
  to: {
503
503
  address: string;
@@ -543,8 +543,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
543
543
  timestamp: number | null;
544
544
  }[];
545
545
  chain: `${string}:${string}`;
546
- account: string;
547
546
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
547
+ account: string;
548
548
  timestamp: number | null;
549
549
  to: {
550
550
  address: string;
@@ -165,8 +165,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
165
165
  timestamp: number | null;
166
166
  }[];
167
167
  chain: `${string}:${string}`;
168
- account: string;
169
168
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
169
+ account: string;
170
170
  timestamp: number | null;
171
171
  to: {
172
172
  address: string;
@@ -443,8 +443,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
443
443
  timestamp: number | null;
444
444
  }[];
445
445
  chain: `${string}:${string}`;
446
- account: string;
447
446
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
447
+ account: string;
448
448
  timestamp: number | null;
449
449
  to: {
450
450
  address: string;
@@ -496,8 +496,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
496
496
  timestamp: number | null;
497
497
  }[];
498
498
  chain: `${string}:${string}`;
499
- account: string;
500
499
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
500
+ account: string;
501
501
  timestamp: number | null;
502
502
  to: {
503
503
  address: string;
@@ -543,8 +543,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
543
543
  timestamp: number | null;
544
544
  }[];
545
545
  chain: `${string}:${string}`;
546
- account: string;
547
546
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
547
+ account: string;
548
548
  timestamp: number | null;
549
549
  to: {
550
550
  address: string;
@@ -5,8 +5,8 @@ import { type Infer } from "@metamask/superstruct";
5
5
  * @see https://eips.ethereum.org/EIPS/eip-4337#definitions
6
6
  */
7
7
  export declare const EthUserOperationStruct: import("@metamask/superstruct").Struct<{
8
- sender: string;
9
8
  nonce: string;
9
+ sender: string;
10
10
  initCode: string;
11
11
  callData: string;
12
12
  callGasLimit: string;
@@ -5,8 +5,8 @@ import { type Infer } from "@metamask/superstruct";
5
5
  * @see https://eips.ethereum.org/EIPS/eip-4337#definitions
6
6
  */
7
7
  export declare const EthUserOperationStruct: import("@metamask/superstruct").Struct<{
8
- sender: string;
9
8
  nonce: string;
9
+ sender: string;
10
10
  initCode: string;
11
11
  callData: string;
12
12
  callGasLimit: string;
package/dist/events.cjs CHANGED
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
3
+ // FIXME: This rule seems to be triggering a false positive on the `KeyringEvents`.
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  exports.AccountAssetListUpdatedEventStruct = exports.AccountTransactionsUpdatedEventStruct = exports.AccountBalancesUpdatedEventStruct = exports.RequestRejectedEventStruct = exports.RequestApprovedEventStruct = exports.AccountDeletedEventStruct = exports.AccountUpdatedEventStruct = exports.AccountCreatedEventStruct = exports.KeyringEvent = void 0;
4
6
  const keyring_utils_1 = require("@metamask/keyring-utils");
@@ -39,6 +41,7 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
39
41
  accountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
40
42
  /**
41
43
  * Instructs MetaMask to display the add account confirmation dialog in the UI.
44
+ *
42
45
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
43
46
  */
44
47
  displayConfirmation: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
@@ -51,6 +54,10 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
51
54
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
52
55
  */
53
56
  displayAccountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
57
+ /**
58
+ * Metamask internal options.
59
+ */
60
+ ...api_1.MetaMaskOptionsStruct.schema,
54
61
  }),
55
62
  });
56
63
  exports.AccountUpdatedEventStruct = (0, keyring_utils_1.object)({
@@ -95,6 +102,13 @@ exports.RequestRejectedEventStruct = (0, keyring_utils_1.object)({
95
102
  });
96
103
  // Assets related events:
97
104
  // -----------------------------------------------------------------------------------------------
105
+ /**
106
+ * Event emitted when the balances of an account are updated.
107
+ *
108
+ * Only changes are reported.
109
+ *
110
+ * The Snap can choose to emit this event for multiple accounts at once.
111
+ */
98
112
  exports.AccountBalancesUpdatedEventStruct = (0, keyring_utils_1.object)({
99
113
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountBalancesUpdated}`),
100
114
  params: (0, keyring_utils_1.object)({
@@ -120,6 +134,14 @@ exports.AccountBalancesUpdatedEventStruct = (0, keyring_utils_1.object)({
120
134
  api_1.FungibleAssetAmountStruct)),
121
135
  }),
122
136
  });
137
+ /**
138
+ * Event emitted when the transactions of an account are updated (added or
139
+ * changed).
140
+ *
141
+ * Only changes are reported.
142
+ *
143
+ * The Snap can choose to emit this event for multiple accounts at once.
144
+ */
123
145
  exports.AccountTransactionsUpdatedEventStruct = (0, keyring_utils_1.object)({
124
146
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountTransactionsUpdated}`),
125
147
  params: (0, keyring_utils_1.object)({
@@ -137,6 +159,13 @@ exports.AccountTransactionsUpdatedEventStruct = (0, keyring_utils_1.object)({
137
159
  (0, superstruct_1.array)(api_1.TransactionStruct)),
138
160
  }),
139
161
  });
162
+ /**
163
+ * Event emitted when the assets of an account are updated.
164
+ *
165
+ * Only changes are reported.
166
+ *
167
+ * The Snap can choose to emit this event for multiple accounts at once.
168
+ */
140
169
  exports.AccountAssetListUpdatedEventStruct = (0, keyring_utils_1.object)({
141
170
  method: (0, superstruct_1.literal)(`${KeyringEvent.AccountAssetListUpdated}`),
142
171
  params: (0, keyring_utils_1.object)({
@@ -1 +1 @@
1
-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AAC,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 * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: 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"]}
1
+ {"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,mFAAmF;;;AAEnF,2DAKiC;AAEjC,uDAAgF;AAChF,2CAIyB;AAEzB,yCAKe;AAEf;;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,CAAC;AAOH;;;;;;GAMG;AACU,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":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// FIXME: This rule seems to be triggering a false positive on the `KeyringEvents`.\n\nimport {\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 MetaMaskOptionsStruct,\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 *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n\n /**\n * Metamask internal options.\n */\n ...MetaMaskOptionsStruct.schema,\n }),\n});\nexport type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;\nexport type AccountCreatedEventPayload = AccountCreatedEvent['params'];\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\nexport type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;\nexport type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\nexport type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;\nexport type AccountDeletedEventPayload = AccountDeletedEvent['params'];\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});\nexport type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;\nexport type RequestApprovedEventPayload = RequestApprovedEvent['params'];\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\nexport type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;\nexport type RequestRejectedEventPayload = RequestRejectedEvent['params'];\n\n// Assets related events:\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 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});\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\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 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});\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\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 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});\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n\n/**\n * Keyring events.\n */\n// For some reason, eslint sometimes infer one of those members as `any`...\ntype KeyringEvents =\n | AccountCreatedEvent\n | AccountUpdatedEvent\n | AccountDeletedEvent\n | AccountAssetListUpdatedEvent\n | AccountBalancesUpdatedEvent\n | AccountTransactionsUpdatedEvent\n | RequestApprovedEvent\n | RequestRejectedEvent;\n\n/**\n * Extract the payload for a given `KeyringEvent` event.\n */\nexport type KeyringEventPayload<Event extends KeyringEvent> = Extract<\n KeyringEvents,\n // We need to use a literal string here, since that is what `KeyringEvents`\n // is using (probably because of `superstruct`.\n { method: `${Event}` }\n>['params'];\n"]}
package/dist/events.d.cts CHANGED
@@ -23,6 +23,9 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
23
23
  scopes: `${string}:${string}`[];
24
24
  methods: string[];
25
25
  };
26
+ metamask?: {
27
+ correlationId: string;
28
+ };
26
29
  accountNameSuggestion?: string;
27
30
  displayConfirmation?: boolean;
28
31
  displayAccountNameSuggestion?: boolean;
@@ -38,10 +41,18 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
38
41
  scopes: `${string}:${string}`[];
39
42
  methods: string[];
40
43
  };
44
+ metamask?: {
45
+ correlationId: string;
46
+ };
41
47
  accountNameSuggestion?: string;
42
48
  displayConfirmation?: boolean;
43
49
  displayAccountNameSuggestion?: boolean;
44
50
  }, {
51
+ metamask: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
52
+ correlationId: string;
53
+ }, {
54
+ correlationId: import("@metamask/superstruct").Struct<string, null>;
55
+ }>;
45
56
  /**
46
57
  * New account object.
47
58
  */
@@ -75,6 +86,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
75
86
  accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
76
87
  /**
77
88
  * Instructs MetaMask to display the add account confirmation dialog in the UI.
89
+ *
78
90
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
79
91
  */
80
92
  displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
@@ -89,6 +101,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
89
101
  displayAccountNameSuggestion: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
90
102
  }>;
91
103
  }>;
104
+ export type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;
105
+ export type AccountCreatedEventPayload = AccountCreatedEvent['params'];
92
106
  export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
93
107
  method: "notify:accountUpdated";
94
108
  params: {
@@ -138,6 +152,8 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
138
152
  }>;
139
153
  }>;
140
154
  }>;
155
+ export type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;
156
+ export type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];
141
157
  export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
142
158
  method: "notify:accountDeleted";
143
159
  params: {
@@ -154,6 +170,8 @@ export declare const AccountDeletedEventStruct: import("@metamask/superstruct").
154
170
  id: import("@metamask/superstruct").Struct<string, null>;
155
171
  }>;
156
172
  }>;
173
+ export type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;
174
+ export type AccountDeletedEventPayload = AccountDeletedEvent['params'];
157
175
  export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
158
176
  method: "notify:requestApproved";
159
177
  params: {
@@ -176,6 +194,8 @@ export declare const RequestApprovedEventStruct: import("@metamask/superstruct")
176
194
  result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
177
195
  }>;
178
196
  }>;
197
+ export type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;
198
+ export type RequestApprovedEventPayload = RequestApprovedEvent['params'];
179
199
  export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
180
200
  method: "notify:requestRejected";
181
201
  params: {
@@ -192,6 +212,15 @@ export declare const RequestRejectedEventStruct: import("@metamask/superstruct")
192
212
  id: import("@metamask/superstruct").Struct<string, null>;
193
213
  }>;
194
214
  }>;
215
+ export type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;
216
+ export type RequestRejectedEventPayload = RequestRejectedEvent['params'];
217
+ /**
218
+ * Event emitted when the balances of an account are updated.
219
+ *
220
+ * Only changes are reported.
221
+ *
222
+ * The Snap can choose to emit this event for multiple accounts at once.
223
+ */
195
224
  export declare const AccountBalancesUpdatedEventStruct: import("@metamask/superstruct").Struct<{
196
225
  method: "notify:accountBalancesUpdated";
197
226
  params: {
@@ -217,15 +246,16 @@ export declare const AccountBalancesUpdatedEventStruct: import("@metamask/supers
217
246
  }>>, null>;
218
247
  }>;
219
248
  }>;
249
+ export type AccountBalancesUpdatedEvent = Infer<typeof AccountBalancesUpdatedEventStruct>;
250
+ export type AccountBalancesUpdatedEventPayload = AccountBalancesUpdatedEvent['params'];
220
251
  /**
221
- * Event emitted when the balances of an account are updated.
252
+ * Event emitted when the transactions of an account are updated (added or
253
+ * changed).
222
254
  *
223
255
  * Only changes are reported.
224
256
  *
225
257
  * The Snap can choose to emit this event for multiple accounts at once.
226
258
  */
227
- export type AccountBalancesUpdatedEvent = Infer<typeof AccountBalancesUpdatedEventStruct>;
228
- export type AccountBalancesUpdatedEventPayload = AccountBalancesUpdatedEvent['params'];
229
259
  export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/superstruct").Struct<{
230
260
  method: "notify:accountTransactionsUpdated";
231
261
  params: {
@@ -249,8 +279,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
249
279
  timestamp: number | null;
250
280
  }[];
251
281
  chain: `${string}:${string}`;
252
- account: string;
253
282
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
283
+ account: string;
254
284
  timestamp: number | null;
255
285
  to: {
256
286
  address: string;
@@ -301,8 +331,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
301
331
  timestamp: number | null;
302
332
  }[];
303
333
  chain: `${string}:${string}`;
304
- account: string;
305
334
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
335
+ account: string;
306
336
  timestamp: number | null;
307
337
  to: {
308
338
  address: string;
@@ -353,8 +383,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
353
383
  timestamp: number | null;
354
384
  }[];
355
385
  chain: `${string}:${string}`;
356
- account: string;
357
386
  status: "submitted" | "unconfirmed" | "confirmed" | "failed";
387
+ account: string;
358
388
  timestamp: number | null;
359
389
  to: {
360
390
  address: string;
@@ -383,16 +413,15 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
383
413
  }[]>, null>;
384
414
  }>;
385
415
  }>;
416
+ export type AccountTransactionsUpdatedEvent = Infer<typeof AccountTransactionsUpdatedEventStruct>;
417
+ export type AccountTransactionsUpdatedEventPayload = AccountTransactionsUpdatedEvent['params'];
386
418
  /**
387
- * Event emitted when the transactions of an account are updated (added or
388
- * changed).
419
+ * Event emitted when the assets of an account are updated.
389
420
  *
390
421
  * Only changes are reported.
391
422
  *
392
423
  * The Snap can choose to emit this event for multiple accounts at once.
393
424
  */
394
- export type AccountTransactionsUpdatedEvent = Infer<typeof AccountTransactionsUpdatedEventStruct>;
395
- export type AccountTransactionsUpdatedEventPayload = AccountTransactionsUpdatedEvent['params'];
396
425
  export declare const AccountAssetListUpdatedEventStruct: import("@metamask/superstruct").Struct<{
397
426
  method: "notify:accountAssetListUpdated";
398
427
  params: {
@@ -418,13 +447,17 @@ export declare const AccountAssetListUpdatedEventStruct: import("@metamask/super
418
447
  }>, null>;
419
448
  }>;
420
449
  }>;
421
- /**
422
- * Event emitted when the assets of an account are updated.
423
- *
424
- * Only changes are reported.
425
- *
426
- * The Snap can choose to emit this event for multiple accounts at once.
427
- */
428
450
  export type AccountAssetListUpdatedEvent = Infer<typeof AccountAssetListUpdatedEventStruct>;
429
451
  export type AccountAssetListUpdatedEventPayload = AccountAssetListUpdatedEvent['params'];
452
+ /**
453
+ * Keyring events.
454
+ */
455
+ type KeyringEvents = AccountCreatedEvent | AccountUpdatedEvent | AccountDeletedEvent | AccountAssetListUpdatedEvent | AccountBalancesUpdatedEvent | AccountTransactionsUpdatedEvent | RequestApprovedEvent | RequestRejectedEvent;
456
+ /**
457
+ * Extract the payload for a given `KeyringEvent` event.
458
+ */
459
+ export type KeyringEventPayload<Event extends KeyringEvent> = Extract<KeyringEvents, {
460
+ method: `${Event}`;
461
+ }>['params'];
462
+ export {};
430
463
  //# sourceMappingURL=events.d.cts.map
@@ -1 +1 @@
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,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;;QAGH;;;;;;;WAOG;;;E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