@metamask/keyring-api 17.2.1 → 17.3.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 +9 -1
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -0
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +4 -2
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +4 -2
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/options.cjs +17 -0
- package/dist/api/options.cjs.map +1 -0
- package/dist/api/options.d.cts +21 -0
- package/dist/api/options.d.cts.map +1 -0
- package/dist/api/options.d.mts +21 -0
- package/dist/api/options.d.mts.map +1 -0
- package/dist/api/options.mjs +14 -0
- package/dist/api/options.mjs.map +1 -0
- package/dist/api/transaction.d.cts +4 -4
- package/dist/api/transaction.d.mts +4 -4
- package/dist/eth/erc4337/types.d.cts +1 -1
- package/dist/eth/erc4337/types.d.mts +1 -1
- package/dist/events.cjs +5 -0
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +15 -3
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +15 -3
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +6 -1
- package/dist/events.mjs.map +1 -1
- package/dist/rpc.d.cts +3 -3
- package/dist/rpc.d.mts +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [17.3.0]
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Add new `MetaMaskOptions` in `createAccount` ([#252](https://github.com/MetaMask/accounts/pull/252))
|
15
|
+
- This options object might contain a new `correlationId` that MUST BE forwarded during the `notify:accountCreated` event.
|
16
|
+
|
10
17
|
## [17.2.1]
|
11
18
|
|
12
19
|
### Changed
|
@@ -546,7 +553,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
546
553
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
547
554
|
- Helper functions to create keyring handler in the snap.
|
548
555
|
|
549
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.
|
556
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.3.0...HEAD
|
557
|
+
[17.3.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.1...@metamask/keyring-api@17.3.0
|
550
558
|
[17.2.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.2.0...@metamask/keyring-api@17.2.1
|
551
559
|
[17.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.1.0...@metamask/keyring-api@17.2.0
|
552
560
|
[17.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@17.0.0...@metamask/keyring-api@17.1.0
|
package/dist/api/index.cjs
CHANGED
@@ -24,4 +24,5 @@ __exportStar(require("./request.cjs"), exports);
|
|
24
24
|
__exportStar(require("./response.cjs"), exports);
|
25
25
|
__exportStar(require("./transaction.cjs"), exports);
|
26
26
|
__exportStar(require("./pagination.cjs"), exports);
|
27
|
+
__exportStar(require("./options.cjs"), exports);
|
27
28
|
//# sourceMappingURL=index.cjs.map
|
package/dist/api/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,+CAAyB;AACzB,gDAA0B;AAC1B,iDAA2B;AAC3B,oDAA8B;AAC9B,mDAA6B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport type * from './keyring';\n"]}
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,gDAA0B;AAC1B,8CAAwB;AACxB,gDAA0B;AAC1B,6CAAuB;AACvB,+CAAyB;AACzB,gDAA0B;AAC1B,iDAA2B;AAC3B,oDAA8B;AAC9B,mDAA6B;AAC7B,gDAA0B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
|
package/dist/api/index.d.cts
CHANGED
package/dist/api/index.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,mCAA+B"}
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
|
package/dist/api/index.d.mts
CHANGED
package/dist/api/index.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,mCAA+B"}
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B;AAC1B,mCAA+B"}
|
package/dist/api/index.mjs
CHANGED
package/dist/api/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport type * from './keyring';\n"]}
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,8BAA0B;AAC1B,8BAA0B;AAC1B,4BAAwB;AACxB,8BAA0B;AAC1B,2BAAuB;AACvB,6BAAyB;AACzB,8BAA0B;AAC1B,+BAA2B;AAC3B,kCAA8B;AAC9B,iCAA6B;AAC7B,8BAA0B","sourcesContent":["export * from './account';\nexport * from './address';\nexport * from './asset';\nexport * from './balance';\nexport * from './caip';\nexport * from './export';\nexport * from './request';\nexport * from './response';\nexport * from './transaction';\nexport * from './pagination';\nexport * from './options';\nexport type * from './keyring';\n"]}
|
package/dist/api/keyring.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyring.cjs","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.cjs","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 { 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 * 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"]}
|
package/dist/api/keyring.d.cts
CHANGED
@@ -5,6 +5,7 @@ import type { ResolvedAccountAddress } from "./address.cjs";
|
|
5
5
|
import type { Balance } from "./balance.cjs";
|
6
6
|
import type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from "./caip.cjs";
|
7
7
|
import type { KeyringAccountData } from "./export.cjs";
|
8
|
+
import type { MetaMaskOptions } from "./options.cjs";
|
8
9
|
import type { Paginated, Pagination } from "./pagination.cjs";
|
9
10
|
import type { KeyringRequest } from "./request.cjs";
|
10
11
|
import type { KeyringResponse } from "./response.cjs";
|
@@ -40,11 +41,12 @@ export type Keyring = {
|
|
40
41
|
*
|
41
42
|
* Creates a new account with optional, keyring-defined, account options.
|
42
43
|
*
|
43
|
-
* @param options - Keyring-defined options for the account (optional).
|
44
|
+
* @param options - Keyring-defined options for the account (optional). The
|
45
|
+
* 'metamask' internal options needs to be re-emitted during `notify:*` events.
|
44
46
|
* @returns A promise that resolves to the newly created KeyringAccount
|
45
47
|
* object without any private information.
|
46
48
|
*/
|
47
|
-
createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
|
49
|
+
createAccount(options?: Record<string, Json> & MetaMaskOptions): Promise<KeyringAccount>;
|
48
50
|
/**
|
49
51
|
* Lists the assets of an account (fungibles and non-fungibles) represented
|
50
52
|
* by their respective CAIP-19:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAgC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAqB;AAC1D,OAAO,KAAK,EAAE,cAAc,E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AC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
|
package/dist/api/keyring.d.mts
CHANGED
@@ -5,6 +5,7 @@ import type { ResolvedAccountAddress } from "./address.mjs";
|
|
5
5
|
import type { Balance } from "./balance.mjs";
|
6
6
|
import type { CaipChainId, CaipAssetType, CaipAssetTypeOrId } from "./caip.mjs";
|
7
7
|
import type { KeyringAccountData } from "./export.mjs";
|
8
|
+
import type { MetaMaskOptions } from "./options.mjs";
|
8
9
|
import type { Paginated, Pagination } from "./pagination.mjs";
|
9
10
|
import type { KeyringRequest } from "./request.mjs";
|
10
11
|
import type { KeyringResponse } from "./response.mjs";
|
@@ -40,11 +41,12 @@ export type Keyring = {
|
|
40
41
|
*
|
41
42
|
* Creates a new account with optional, keyring-defined, account options.
|
42
43
|
*
|
43
|
-
* @param options - Keyring-defined options for the account (optional).
|
44
|
+
* @param options - Keyring-defined options for the account (optional). The
|
45
|
+
* 'metamask' internal options needs to be re-emitted during `notify:*` events.
|
44
46
|
* @returns A promise that resolves to the newly created KeyringAccount
|
45
47
|
* object without any private information.
|
46
48
|
*/
|
47
|
-
createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
|
49
|
+
createAccount(options?: Record<string, Json> & MetaMaskOptions): Promise<KeyringAccount>;
|
48
50
|
/**
|
49
51
|
* Lists the assets of an account (fungibles and non-fungibles) represented
|
50
52
|
* by their respective CAIP-19:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAgC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAqB;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D
|
1
|
+
{"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAgC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAkB;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,WAAW,EA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,sBAAsB,GAAG,IAAI,CAAC,CAAC;IAE1C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErE;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
|
package/dist/api/keyring.mjs.map
CHANGED
@@ -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 { 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 * 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
@@ -39,6 +39,7 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
|
|
39
39
|
accountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
|
40
40
|
/**
|
41
41
|
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
42
|
+
*
|
42
43
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
43
44
|
*/
|
44
45
|
displayConfirmation: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
|
@@ -51,6 +52,10 @@ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
|
|
51
52
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
52
53
|
*/
|
53
54
|
displayAccountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
|
55
|
+
/**
|
56
|
+
* Metamask internal options.
|
57
|
+
*/
|
58
|
+
...api_1.MetaMaskOptionsStruct.schema,
|
54
59
|
}),
|
55
60
|
});
|
56
61
|
exports.AccountUpdatedEventStruct = (0, keyring_utils_1.object)({
|
package/dist/events.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AAEjC,uDAAgF;AAChF,2CAIyB;AAEzB,
|
1
|
+
{"version":3,"file":"events.cjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AAEjC,uDAAgF;AAChF,2CAIyB;AAEzB,yCAKe;AAEf;;GAEG;AACH,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,0EAA0D,CAAA;IAC1D,gFAAgE,CAAA;AAClE,CAAC,EAdW,YAAY,4BAAZ,YAAY,QAcvB;AAEY,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,OAAO,EAAE,0BAAoB;QAE7B;;;;;;WAMG;QACH,qBAA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yB;AACzB,kGAAkG;AAErF,QAAA,iCAAiC,GAAG,IAAA,sBAAM,EAAC;IACtD,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,sBAAsB,EAAE,CAAC;IACzD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,QAAQ,EAAE,IAAA,oBAAM;QACd;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,oBAAM;QACJ;;WAEG;QACH,2BAAmB;QAEnB;;WAEG;QACH,+BAAyB,CAC1B,CACF;KACF,CAAC;CACH,CAAC,CAAC;AAeU,QAAA,qCAAqC,GAAG,IAAA,sBAAM,EAAC;IAC1D,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,YAAY,EAAE,IAAA,oBAAM;QAClB;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,mBAAK,EAAC,uBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAgBU,QAAA,kCAAkC,GAAG,IAAA,sBAAM,EAAC;IACvD,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,MAAM,EAAE,IAAA,oBAAM;QACZ;;WAEG;QACH,+BAAe;QAEf;;WAEG;QACH,IAAA,sBAAM,EAAC;YACL;;eAEG;YACH,KAAK,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,IAAA,mBAAK,EAAC,+BAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n 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});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n"]}
|
package/dist/events.d.cts
CHANGED
@@ -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>;
|
@@ -249,8 +261,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
249
261
|
timestamp: number | null;
|
250
262
|
}[];
|
251
263
|
chain: `${string}:${string}`;
|
252
|
-
account: string;
|
253
264
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
265
|
+
account: string;
|
254
266
|
timestamp: number | null;
|
255
267
|
to: {
|
256
268
|
address: string;
|
@@ -301,8 +313,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
301
313
|
timestamp: number | null;
|
302
314
|
}[];
|
303
315
|
chain: `${string}:${string}`;
|
304
|
-
account: string;
|
305
316
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
317
|
+
account: string;
|
306
318
|
timestamp: number | null;
|
307
319
|
to: {
|
308
320
|
address: string;
|
@@ -353,8 +365,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
353
365
|
timestamp: number | null;
|
354
366
|
}[];
|
355
367
|
chain: `${string}:${string}`;
|
356
|
-
account: string;
|
357
368
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
369
|
+
account: string;
|
358
370
|
timestamp: number | null;
|
359
371
|
to: {
|
360
372
|
address: string;
|
package/dist/events.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.cts","sourceRoot":"","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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAG9C;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaL,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AACF,MAAM,MAAM,sCAAsC,GAChD,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAE5C,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/events.d.mts
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>;
|
@@ -249,8 +261,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
249
261
|
timestamp: number | null;
|
250
262
|
}[];
|
251
263
|
chain: `${string}:${string}`;
|
252
|
-
account: string;
|
253
264
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
265
|
+
account: string;
|
254
266
|
timestamp: number | null;
|
255
267
|
to: {
|
256
268
|
address: string;
|
@@ -301,8 +313,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
301
313
|
timestamp: number | null;
|
302
314
|
}[];
|
303
315
|
chain: `${string}:${string}`;
|
304
|
-
account: string;
|
305
316
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
317
|
+
account: string;
|
306
318
|
timestamp: number | null;
|
307
319
|
to: {
|
308
320
|
address: string;
|
@@ -353,8 +365,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
353
365
|
timestamp: number | null;
|
354
366
|
}[];
|
355
367
|
chain: `${string}:${string}`;
|
356
|
-
account: string;
|
357
368
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
369
|
+
account: string;
|
358
370
|
timestamp: number | null;
|
359
371
|
to: {
|
360
372
|
address: string;
|
package/dist/events.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAG9C;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaL,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG,KAAK,CACjD,OAAO,qCAAqC,CAC7C,CAAC;AACF,MAAM,MAAM,sCAAsC,GAChD,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAE5C,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;QAG3C;;WAEG;;;;;;EAuBL,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/events.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { exactOptional, object, UuidStruct, AccountIdStruct } from "@metamask/keyring-utils";
|
2
2
|
import { array, boolean, literal, record, string } from "@metamask/superstruct";
|
3
3
|
import { CaipAssetTypeStruct, CaipAssetTypeOrIdStruct, JsonStruct } from "@metamask/utils";
|
4
|
-
import { FungibleAssetAmountStruct, KeyringAccountStruct, TransactionStruct } from "./api/index.mjs";
|
4
|
+
import { FungibleAssetAmountStruct, KeyringAccountStruct, TransactionStruct, MetaMaskOptionsStruct } from "./api/index.mjs";
|
5
5
|
/**
|
6
6
|
* Supported keyring events.
|
7
7
|
*/
|
@@ -36,6 +36,7 @@ export const AccountCreatedEventStruct = object({
|
|
36
36
|
accountNameSuggestion: exactOptional(string()),
|
37
37
|
/**
|
38
38
|
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
39
|
+
*
|
39
40
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
40
41
|
*/
|
41
42
|
displayConfirmation: exactOptional(boolean()),
|
@@ -48,6 +49,10 @@ export const AccountCreatedEventStruct = object({
|
|
48
49
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
49
50
|
*/
|
50
51
|
displayAccountNameSuggestion: exactOptional(boolean()),
|
52
|
+
/**
|
53
|
+
* Metamask internal options.
|
54
|
+
*/
|
55
|
+
...MetaMaskOptionsStruct.schema,
|
51
56
|
}),
|
52
57
|
});
|
53
58
|
export const AccountUpdatedEventStruct = object({
|
package/dist/events.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,eAAe,EAChB,gCAAgC;AAEjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAChF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACX,wBAAwB;AAEzB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,
|
1
|
+
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,eAAe,EAChB,gCAAgC;AAEjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAChF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACX,wBAAwB;AAEzB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACtB,wBAAc;AAEf;;GAEG;AACH,MAAM,CAAN,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,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AAC","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 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});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n"]}
|
package/dist/rpc.d.cts
CHANGED
@@ -197,8 +197,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
197
197
|
timestamp: number | null;
|
198
198
|
}[];
|
199
199
|
chain: `${string}:${string}`;
|
200
|
-
account: string;
|
201
200
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
201
|
+
account: string;
|
202
202
|
timestamp: number | null;
|
203
203
|
to: {
|
204
204
|
address: string;
|
@@ -247,8 +247,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
247
247
|
timestamp: number | null;
|
248
248
|
}[];
|
249
249
|
chain: `${string}:${string}`;
|
250
|
-
account: string;
|
251
250
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
251
|
+
account: string;
|
252
252
|
timestamp: number | null;
|
253
253
|
to: {
|
254
254
|
address: string;
|
@@ -294,8 +294,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
294
294
|
timestamp: number | null;
|
295
295
|
}[];
|
296
296
|
chain: `${string}:${string}`;
|
297
|
-
account: string;
|
298
297
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
298
|
+
account: string;
|
299
299
|
timestamp: number | null;
|
300
300
|
to: {
|
301
301
|
address: string;
|
package/dist/rpc.d.mts
CHANGED
@@ -197,8 +197,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
197
197
|
timestamp: number | null;
|
198
198
|
}[];
|
199
199
|
chain: `${string}:${string}`;
|
200
|
-
account: string;
|
201
200
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
201
|
+
account: string;
|
202
202
|
timestamp: number | null;
|
203
203
|
to: {
|
204
204
|
address: string;
|
@@ -247,8 +247,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
247
247
|
timestamp: number | null;
|
248
248
|
}[];
|
249
249
|
chain: `${string}:${string}`;
|
250
|
-
account: string;
|
251
250
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
251
|
+
account: string;
|
252
252
|
timestamp: number | null;
|
253
253
|
to: {
|
254
254
|
address: string;
|
@@ -294,8 +294,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
294
294
|
timestamp: number | null;
|
295
295
|
}[];
|
296
296
|
chain: `${string}:${string}`;
|
297
|
-
account: string;
|
298
297
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
298
|
+
account: string;
|
299
299
|
timestamp: number | null;
|
300
300
|
to: {
|
301
301
|
address: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@metamask/keyring-api",
|
3
|
-
"version": "17.
|
3
|
+
"version": "17.3.0",
|
4
4
|
"description": "MetaMask Keyring API",
|
5
5
|
"keywords": [
|
6
6
|
"metamask",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"test:watch": "jest --watch"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@metamask/keyring-utils": "^
|
49
|
+
"@metamask/keyring-utils": "^3.0.0",
|
50
50
|
"@metamask/superstruct": "^3.1.0",
|
51
51
|
"@metamask/utils": "^11.1.0",
|
52
52
|
"bech32": "^2.0.0"
|
@@ -55,7 +55,7 @@
|
|
55
55
|
"@lavamoat/allow-scripts": "^3.2.1",
|
56
56
|
"@lavamoat/preinstall-always-fail": "^2.1.0",
|
57
57
|
"@metamask/auto-changelog": "^3.4.4",
|
58
|
-
"@metamask/keyring-utils": "^
|
58
|
+
"@metamask/keyring-utils": "^3.0.0",
|
59
59
|
"@ts-bridge/cli": "^0.6.3",
|
60
60
|
"@types/jest": "^29.5.12",
|
61
61
|
"@types/node": "^20.12.12",
|