@metamask-previews/keyring-controller 25.2.0-preview-8fff4f2dc → 25.2.0-preview-a37be9342
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 +0 -4
- package/dist/KeyringController-method-action-types.cjs +7 -0
- package/dist/KeyringController-method-action-types.cjs.map +1 -0
- package/dist/KeyringController-method-action-types.d.cts +282 -0
- package/dist/KeyringController-method-action-types.d.cts.map +1 -0
- package/dist/KeyringController-method-action-types.d.mts +282 -0
- package/dist/KeyringController-method-action-types.d.mts.map +1 -0
- package/dist/KeyringController-method-action-types.mjs +6 -0
- package/dist/KeyringController-method-action-types.mjs.map +1 -0
- package/dist/KeyringController.cjs +23 -26
- package/dist/KeyringController.cjs.map +1 -1
- package/dist/KeyringController.d.cts +2 -86
- package/dist/KeyringController.d.cts.map +1 -1
- package/dist/KeyringController.d.mts +2 -86
- package/dist/KeyringController.d.mts.map +1 -1
- package/dist/KeyringController.mjs +23 -26
- package/dist/KeyringController.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
- Add `accountSupports7702` method and `KeyringController:accountSupports7702` messenger action to check whether an account's keyring supports EIP-7702 authorization signing ([#8388](https://github.com/MetaMask/core/pull/8388))
|
|
13
|
-
|
|
14
10
|
### Changed
|
|
15
11
|
|
|
16
12
|
- Bump `@metamask/messenger` from `^1.0.0` to `^1.1.1` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyringController-method-action-types.cjs","sourceRoot":"","sources":["../src/KeyringController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { KeyringController } from './KeyringController';\n\n/**\n * Adds a new account to the default (first) HD seed phrase keyring.\n *\n * @param accountCount - Number of accounts before adding a new one, used to\n * make the method idempotent.\n * @returns Promise resolving to the added account address.\n */\nexport type KeyringControllerAddNewAccountAction = {\n type: `KeyringController:addNewAccount`;\n handler: KeyringController['addNewAccount'];\n};\n\n/**\n * Effectively the same as creating a new keychain then populating it\n * using the given seed phrase.\n *\n * @param password - Password to unlock keychain.\n * @param seed - A BIP39-compliant seed phrase as Uint8Array,\n * either as a string or an array of UTF-8 bytes that represent the string.\n * @returns Promise resolving when the operation ends successfully.\n */\nexport type KeyringControllerCreateNewVaultAndRestoreAction = {\n type: `KeyringController:createNewVaultAndRestore`;\n handler: KeyringController['createNewVaultAndRestore'];\n};\n\n/**\n * Create a new vault and primary keyring.\n *\n * This only works if keyrings are empty. If there is a pre-existing unlocked vault, calling this will have no effect.\n * If there is a pre-existing locked vault, it will be replaced.\n *\n * @param password - Password to unlock the new vault.\n * @returns Promise resolving when the operation ends successfully.\n */\nexport type KeyringControllerCreateNewVaultAndKeychainAction = {\n type: `KeyringController:createNewVaultAndKeychain`;\n handler: KeyringController['createNewVaultAndKeychain'];\n};\n\n/**\n * Adds a new keyring of the given `type`.\n *\n * @param type - Keyring type name.\n * @param opts - Keyring options.\n * @throws If a builder for the given `type` does not exist.\n * @returns Promise resolving to the new keyring metadata.\n */\nexport type KeyringControllerAddNewKeyringAction = {\n type: `KeyringController:addNewKeyring`;\n handler: KeyringController['addNewKeyring'];\n};\n\n/**\n * Returns the public addresses of all accounts from every keyring.\n *\n * @returns A promise resolving to an array of addresses.\n */\nexport type KeyringControllerGetAccountsAction = {\n type: `KeyringController:getAccounts`;\n handler: KeyringController['getAccounts'];\n};\n\n/**\n * Get encryption public key.\n *\n * @param account - An account address.\n * @param opts - Additional encryption options.\n * @throws If the `account` does not exist or does not support the `getEncryptionPublicKey` method\n * @returns Promise resolving to encyption public key of the `account` if one exists.\n */\nexport type KeyringControllerGetEncryptionPublicKeyAction = {\n type: `KeyringController:getEncryptionPublicKey`;\n handler: KeyringController['getEncryptionPublicKey'];\n};\n\n/**\n * Attempts to decrypt the provided message parameters.\n *\n * @param messageParams - The decryption message parameters.\n * @param messageParams.from - The address of the account you want to use to decrypt the message.\n * @param messageParams.data - The encrypted data that you want to decrypt.\n * @returns The raw decryption result.\n */\nexport type KeyringControllerDecryptMessageAction = {\n type: `KeyringController:decryptMessage`;\n handler: KeyringController['decryptMessage'];\n};\n\n/**\n * Returns the currently initialized keyring that manages\n * the specified `address` if one exists.\n *\n * @deprecated Use of this method is discouraged as actions executed directly on\n * keyrings are not being reflected in the KeyringController state and not\n * persisted in the vault. Use `withKeyring` instead.\n * @param account - An account address.\n * @returns Promise resolving to keyring of the `account` if one exists.\n */\nexport type KeyringControllerGetKeyringForAccountAction = {\n type: `KeyringController:getKeyringForAccount`;\n handler: KeyringController['getKeyringForAccount'];\n};\n\n/**\n * Returns all keyrings of the given type.\n *\n * @deprecated Use of this method is discouraged as actions executed directly on\n * keyrings are not being reflected in the KeyringController state and not\n * persisted in the vault. Use `withKeyring` instead.\n * @param type - Keyring type name.\n * @returns An array of keyrings of the given type.\n */\nexport type KeyringControllerGetKeyringsByTypeAction = {\n type: `KeyringController:getKeyringsByType`;\n handler: KeyringController['getKeyringsByType'];\n};\n\n/**\n * Persist all serialized keyrings in the vault.\n *\n * @deprecated This method is being phased out in favor of `withKeyring`.\n * @returns Promise resolving with `true` value when the\n * operation completes.\n */\nexport type KeyringControllerPersistAllKeyringsAction = {\n type: `KeyringController:persistAllKeyrings`;\n handler: KeyringController['persistAllKeyrings'];\n};\n\n/**\n * Removes an account from keyring state.\n *\n * @param address - Address of the account to remove.\n * @fires KeyringController:accountRemoved\n * @returns Promise resolving when the account is removed.\n */\nexport type KeyringControllerRemoveAccountAction = {\n type: `KeyringController:removeAccount`;\n handler: KeyringController['removeAccount'];\n};\n\n/**\n * Signs message by calling down into a specific keyring.\n *\n * @param messageParams - PersonalMessageParams object to sign.\n * @returns Promise resolving to a signed message string.\n */\nexport type KeyringControllerSignMessageAction = {\n type: `KeyringController:signMessage`;\n handler: KeyringController['signMessage'];\n};\n\n/**\n * Signs EIP-7702 Authorization message by calling down into a specific keyring.\n *\n * @param params - EIP7702AuthorizationParams object to sign.\n * @returns Promise resolving to an EIP-7702 Authorization signature.\n * @throws Will throw UnsupportedSignEIP7702Authorization if the keyring does not support signing EIP-7702 Authorization messages.\n */\nexport type KeyringControllerSignEip7702AuthorizationAction = {\n type: `KeyringController:signEip7702Authorization`;\n handler: KeyringController['signEip7702Authorization'];\n};\n\n/**\n * Signs personal message by calling down into a specific keyring.\n *\n * @param messageParams - PersonalMessageParams object to sign.\n * @returns Promise resolving to a signed message string.\n */\nexport type KeyringControllerSignPersonalMessageAction = {\n type: `KeyringController:signPersonalMessage`;\n handler: KeyringController['signPersonalMessage'];\n};\n\n/**\n * Signs typed message by calling down into a specific keyring.\n *\n * @param messageParams - TypedMessageParams object to sign.\n * @param version - Compatibility version EIP712.\n * @throws Will throw when passed an unrecognized version.\n * @returns Promise resolving to a signed message string or an error if any.\n */\nexport type KeyringControllerSignTypedMessageAction = {\n type: `KeyringController:signTypedMessage`;\n handler: KeyringController['signTypedMessage'];\n};\n\n/**\n * Convert a base transaction to a base UserOperation.\n *\n * @param from - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @param executionContext - The execution context to use for the UserOperation.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\nexport type KeyringControllerPrepareUserOperationAction = {\n type: `KeyringController:prepareUserOperation`;\n handler: KeyringController['prepareUserOperation'];\n};\n\n/**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param from - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @param executionContext - The execution context to use for the UserOperation.\n * @returns A patch to apply to the UserOperation.\n */\nexport type KeyringControllerPatchUserOperationAction = {\n type: `KeyringController:patchUserOperation`;\n handler: KeyringController['patchUserOperation'];\n};\n\n/**\n * Signs an UserOperation.\n *\n * @param from - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @param executionContext - The execution context to use for the UserOperation.\n * @returns The signature of the UserOperation.\n */\nexport type KeyringControllerSignUserOperationAction = {\n type: `KeyringController:signUserOperation`;\n handler: KeyringController['signUserOperation'];\n};\n\n/**\n * Select a keyring and execute the given operation with\n * the selected keyring, as a mutually exclusive atomic\n * operation.\n *\n * The method automatically persists changes at the end of the\n * function execution, or rolls back the changes if an error\n * is thrown.\n *\n * @param selector - Keyring selector object.\n * @param operation - Function to execute with the selected keyring.\n * @param options - Additional options.\n * @param options.createIfMissing - Whether to create a new keyring if the selected one is missing.\n * @param options.createWithData - Optional data to use when creating a new keyring.\n * @returns Promise resolving to the result of the function execution.\n * @template SelectedKeyring - The type of the selected keyring.\n * @template CallbackResult - The type of the value resolved by the callback function.\n * @deprecated This method overload is deprecated. Use `withKeyring` without options instead.\n */\nexport type KeyringControllerWithKeyringAction = {\n type: `KeyringController:withKeyring`;\n handler: KeyringController['withKeyring'];\n};\n\n/**\n * Select a keyring and execute the given operation with the selected\n * keyring, **without** acquiring the controller's mutual exclusion lock.\n *\n * ## When to use this method\n *\n * This method is an escape hatch for read-only access to keyring data that\n * is immutable once the keyring is initialized. A typical safe use case is\n * reading the `mnemonic` from an `HdKeyring`: the mnemonic is set during\n * `deserialize()` and never mutated afterwards, so it can safely be read\n * without holding the lock.\n *\n * ## Why it is \"unsafe\"\n *\n * The \"unsafe\" designation mirrors the semantics of `unsafe { }` blocks in\n * Rust: the method itself does not enforce thread-safety guarantees. By\n * calling this method the **caller** explicitly takes responsibility for\n * ensuring that:\n *\n * - The operation is **read-only** — no state is mutated.\n * - The data being read is **immutable** after the keyring is initialized,\n * so concurrent locked operations cannot alter it while this callback\n * runs.\n *\n * Do **not** use this method to:\n * - Mutate keyring state (add accounts, sign, etc.) — use `withKeyring`.\n * - Read mutable fields that could change during concurrent operations.\n *\n * @param selector - Keyring selector object.\n * @param operation - Read-only function to execute with the selected keyring.\n * @returns Promise resolving to the result of the function execution.\n * @template SelectedKeyring - The type of the selected keyring.\n * @template CallbackResult - The type of the value resolved by the callback function.\n */\nexport type KeyringControllerWithKeyringUnsafeAction = {\n type: `KeyringController:withKeyringUnsafe`;\n handler: KeyringController['withKeyringUnsafe'];\n};\n\n/**\n * Union of all KeyringController action types.\n */\nexport type KeyringControllerMethodActions =\n | KeyringControllerAddNewAccountAction\n | KeyringControllerCreateNewVaultAndRestoreAction\n | KeyringControllerCreateNewVaultAndKeychainAction\n | KeyringControllerAddNewKeyringAction\n | KeyringControllerGetAccountsAction\n | KeyringControllerGetEncryptionPublicKeyAction\n | KeyringControllerDecryptMessageAction\n | KeyringControllerGetKeyringForAccountAction\n | KeyringControllerGetKeyringsByTypeAction\n | KeyringControllerPersistAllKeyringsAction\n | KeyringControllerRemoveAccountAction\n | KeyringControllerSignMessageAction\n | KeyringControllerSignEip7702AuthorizationAction\n | KeyringControllerSignPersonalMessageAction\n | KeyringControllerSignTypedMessageAction\n | KeyringControllerPrepareUserOperationAction\n | KeyringControllerPatchUserOperationAction\n | KeyringControllerSignUserOperationAction\n | KeyringControllerWithKeyringAction\n | KeyringControllerWithKeyringUnsafeAction;\n"]}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { KeyringController } from "./KeyringController.cjs";
|
|
6
|
+
/**
|
|
7
|
+
* Adds a new account to the default (first) HD seed phrase keyring.
|
|
8
|
+
*
|
|
9
|
+
* @param accountCount - Number of accounts before adding a new one, used to
|
|
10
|
+
* make the method idempotent.
|
|
11
|
+
* @returns Promise resolving to the added account address.
|
|
12
|
+
*/
|
|
13
|
+
export type KeyringControllerAddNewAccountAction = {
|
|
14
|
+
type: `KeyringController:addNewAccount`;
|
|
15
|
+
handler: KeyringController['addNewAccount'];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Effectively the same as creating a new keychain then populating it
|
|
19
|
+
* using the given seed phrase.
|
|
20
|
+
*
|
|
21
|
+
* @param password - Password to unlock keychain.
|
|
22
|
+
* @param seed - A BIP39-compliant seed phrase as Uint8Array,
|
|
23
|
+
* either as a string or an array of UTF-8 bytes that represent the string.
|
|
24
|
+
* @returns Promise resolving when the operation ends successfully.
|
|
25
|
+
*/
|
|
26
|
+
export type KeyringControllerCreateNewVaultAndRestoreAction = {
|
|
27
|
+
type: `KeyringController:createNewVaultAndRestore`;
|
|
28
|
+
handler: KeyringController['createNewVaultAndRestore'];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Create a new vault and primary keyring.
|
|
32
|
+
*
|
|
33
|
+
* This only works if keyrings are empty. If there is a pre-existing unlocked vault, calling this will have no effect.
|
|
34
|
+
* If there is a pre-existing locked vault, it will be replaced.
|
|
35
|
+
*
|
|
36
|
+
* @param password - Password to unlock the new vault.
|
|
37
|
+
* @returns Promise resolving when the operation ends successfully.
|
|
38
|
+
*/
|
|
39
|
+
export type KeyringControllerCreateNewVaultAndKeychainAction = {
|
|
40
|
+
type: `KeyringController:createNewVaultAndKeychain`;
|
|
41
|
+
handler: KeyringController['createNewVaultAndKeychain'];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Adds a new keyring of the given `type`.
|
|
45
|
+
*
|
|
46
|
+
* @param type - Keyring type name.
|
|
47
|
+
* @param opts - Keyring options.
|
|
48
|
+
* @throws If a builder for the given `type` does not exist.
|
|
49
|
+
* @returns Promise resolving to the new keyring metadata.
|
|
50
|
+
*/
|
|
51
|
+
export type KeyringControllerAddNewKeyringAction = {
|
|
52
|
+
type: `KeyringController:addNewKeyring`;
|
|
53
|
+
handler: KeyringController['addNewKeyring'];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Returns the public addresses of all accounts from every keyring.
|
|
57
|
+
*
|
|
58
|
+
* @returns A promise resolving to an array of addresses.
|
|
59
|
+
*/
|
|
60
|
+
export type KeyringControllerGetAccountsAction = {
|
|
61
|
+
type: `KeyringController:getAccounts`;
|
|
62
|
+
handler: KeyringController['getAccounts'];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Get encryption public key.
|
|
66
|
+
*
|
|
67
|
+
* @param account - An account address.
|
|
68
|
+
* @param opts - Additional encryption options.
|
|
69
|
+
* @throws If the `account` does not exist or does not support the `getEncryptionPublicKey` method
|
|
70
|
+
* @returns Promise resolving to encyption public key of the `account` if one exists.
|
|
71
|
+
*/
|
|
72
|
+
export type KeyringControllerGetEncryptionPublicKeyAction = {
|
|
73
|
+
type: `KeyringController:getEncryptionPublicKey`;
|
|
74
|
+
handler: KeyringController['getEncryptionPublicKey'];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Attempts to decrypt the provided message parameters.
|
|
78
|
+
*
|
|
79
|
+
* @param messageParams - The decryption message parameters.
|
|
80
|
+
* @param messageParams.from - The address of the account you want to use to decrypt the message.
|
|
81
|
+
* @param messageParams.data - The encrypted data that you want to decrypt.
|
|
82
|
+
* @returns The raw decryption result.
|
|
83
|
+
*/
|
|
84
|
+
export type KeyringControllerDecryptMessageAction = {
|
|
85
|
+
type: `KeyringController:decryptMessage`;
|
|
86
|
+
handler: KeyringController['decryptMessage'];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Returns the currently initialized keyring that manages
|
|
90
|
+
* the specified `address` if one exists.
|
|
91
|
+
*
|
|
92
|
+
* @deprecated Use of this method is discouraged as actions executed directly on
|
|
93
|
+
* keyrings are not being reflected in the KeyringController state and not
|
|
94
|
+
* persisted in the vault. Use `withKeyring` instead.
|
|
95
|
+
* @param account - An account address.
|
|
96
|
+
* @returns Promise resolving to keyring of the `account` if one exists.
|
|
97
|
+
*/
|
|
98
|
+
export type KeyringControllerGetKeyringForAccountAction = {
|
|
99
|
+
type: `KeyringController:getKeyringForAccount`;
|
|
100
|
+
handler: KeyringController['getKeyringForAccount'];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Returns all keyrings of the given type.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated Use of this method is discouraged as actions executed directly on
|
|
106
|
+
* keyrings are not being reflected in the KeyringController state and not
|
|
107
|
+
* persisted in the vault. Use `withKeyring` instead.
|
|
108
|
+
* @param type - Keyring type name.
|
|
109
|
+
* @returns An array of keyrings of the given type.
|
|
110
|
+
*/
|
|
111
|
+
export type KeyringControllerGetKeyringsByTypeAction = {
|
|
112
|
+
type: `KeyringController:getKeyringsByType`;
|
|
113
|
+
handler: KeyringController['getKeyringsByType'];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Persist all serialized keyrings in the vault.
|
|
117
|
+
*
|
|
118
|
+
* @deprecated This method is being phased out in favor of `withKeyring`.
|
|
119
|
+
* @returns Promise resolving with `true` value when the
|
|
120
|
+
* operation completes.
|
|
121
|
+
*/
|
|
122
|
+
export type KeyringControllerPersistAllKeyringsAction = {
|
|
123
|
+
type: `KeyringController:persistAllKeyrings`;
|
|
124
|
+
handler: KeyringController['persistAllKeyrings'];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Removes an account from keyring state.
|
|
128
|
+
*
|
|
129
|
+
* @param address - Address of the account to remove.
|
|
130
|
+
* @fires KeyringController:accountRemoved
|
|
131
|
+
* @returns Promise resolving when the account is removed.
|
|
132
|
+
*/
|
|
133
|
+
export type KeyringControllerRemoveAccountAction = {
|
|
134
|
+
type: `KeyringController:removeAccount`;
|
|
135
|
+
handler: KeyringController['removeAccount'];
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Signs message by calling down into a specific keyring.
|
|
139
|
+
*
|
|
140
|
+
* @param messageParams - PersonalMessageParams object to sign.
|
|
141
|
+
* @returns Promise resolving to a signed message string.
|
|
142
|
+
*/
|
|
143
|
+
export type KeyringControllerSignMessageAction = {
|
|
144
|
+
type: `KeyringController:signMessage`;
|
|
145
|
+
handler: KeyringController['signMessage'];
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Signs EIP-7702 Authorization message by calling down into a specific keyring.
|
|
149
|
+
*
|
|
150
|
+
* @param params - EIP7702AuthorizationParams object to sign.
|
|
151
|
+
* @returns Promise resolving to an EIP-7702 Authorization signature.
|
|
152
|
+
* @throws Will throw UnsupportedSignEIP7702Authorization if the keyring does not support signing EIP-7702 Authorization messages.
|
|
153
|
+
*/
|
|
154
|
+
export type KeyringControllerSignEip7702AuthorizationAction = {
|
|
155
|
+
type: `KeyringController:signEip7702Authorization`;
|
|
156
|
+
handler: KeyringController['signEip7702Authorization'];
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Signs personal message by calling down into a specific keyring.
|
|
160
|
+
*
|
|
161
|
+
* @param messageParams - PersonalMessageParams object to sign.
|
|
162
|
+
* @returns Promise resolving to a signed message string.
|
|
163
|
+
*/
|
|
164
|
+
export type KeyringControllerSignPersonalMessageAction = {
|
|
165
|
+
type: `KeyringController:signPersonalMessage`;
|
|
166
|
+
handler: KeyringController['signPersonalMessage'];
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Signs typed message by calling down into a specific keyring.
|
|
170
|
+
*
|
|
171
|
+
* @param messageParams - TypedMessageParams object to sign.
|
|
172
|
+
* @param version - Compatibility version EIP712.
|
|
173
|
+
* @throws Will throw when passed an unrecognized version.
|
|
174
|
+
* @returns Promise resolving to a signed message string or an error if any.
|
|
175
|
+
*/
|
|
176
|
+
export type KeyringControllerSignTypedMessageAction = {
|
|
177
|
+
type: `KeyringController:signTypedMessage`;
|
|
178
|
+
handler: KeyringController['signTypedMessage'];
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Convert a base transaction to a base UserOperation.
|
|
182
|
+
*
|
|
183
|
+
* @param from - Address of the sender.
|
|
184
|
+
* @param transactions - Base transactions to include in the UserOperation.
|
|
185
|
+
* @param executionContext - The execution context to use for the UserOperation.
|
|
186
|
+
* @returns A pseudo-UserOperation that can be used to construct a real.
|
|
187
|
+
*/
|
|
188
|
+
export type KeyringControllerPrepareUserOperationAction = {
|
|
189
|
+
type: `KeyringController:prepareUserOperation`;
|
|
190
|
+
handler: KeyringController['prepareUserOperation'];
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Patches properties of a UserOperation. Currently, only the
|
|
194
|
+
* `paymasterAndData` can be patched.
|
|
195
|
+
*
|
|
196
|
+
* @param from - Address of the sender.
|
|
197
|
+
* @param userOp - UserOperation to patch.
|
|
198
|
+
* @param executionContext - The execution context to use for the UserOperation.
|
|
199
|
+
* @returns A patch to apply to the UserOperation.
|
|
200
|
+
*/
|
|
201
|
+
export type KeyringControllerPatchUserOperationAction = {
|
|
202
|
+
type: `KeyringController:patchUserOperation`;
|
|
203
|
+
handler: KeyringController['patchUserOperation'];
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Signs an UserOperation.
|
|
207
|
+
*
|
|
208
|
+
* @param from - Address of the sender.
|
|
209
|
+
* @param userOp - UserOperation to sign.
|
|
210
|
+
* @param executionContext - The execution context to use for the UserOperation.
|
|
211
|
+
* @returns The signature of the UserOperation.
|
|
212
|
+
*/
|
|
213
|
+
export type KeyringControllerSignUserOperationAction = {
|
|
214
|
+
type: `KeyringController:signUserOperation`;
|
|
215
|
+
handler: KeyringController['signUserOperation'];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Select a keyring and execute the given operation with
|
|
219
|
+
* the selected keyring, as a mutually exclusive atomic
|
|
220
|
+
* operation.
|
|
221
|
+
*
|
|
222
|
+
* The method automatically persists changes at the end of the
|
|
223
|
+
* function execution, or rolls back the changes if an error
|
|
224
|
+
* is thrown.
|
|
225
|
+
*
|
|
226
|
+
* @param selector - Keyring selector object.
|
|
227
|
+
* @param operation - Function to execute with the selected keyring.
|
|
228
|
+
* @param options - Additional options.
|
|
229
|
+
* @param options.createIfMissing - Whether to create a new keyring if the selected one is missing.
|
|
230
|
+
* @param options.createWithData - Optional data to use when creating a new keyring.
|
|
231
|
+
* @returns Promise resolving to the result of the function execution.
|
|
232
|
+
* @template SelectedKeyring - The type of the selected keyring.
|
|
233
|
+
* @template CallbackResult - The type of the value resolved by the callback function.
|
|
234
|
+
* @deprecated This method overload is deprecated. Use `withKeyring` without options instead.
|
|
235
|
+
*/
|
|
236
|
+
export type KeyringControllerWithKeyringAction = {
|
|
237
|
+
type: `KeyringController:withKeyring`;
|
|
238
|
+
handler: KeyringController['withKeyring'];
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Select a keyring and execute the given operation with the selected
|
|
242
|
+
* keyring, **without** acquiring the controller's mutual exclusion lock.
|
|
243
|
+
*
|
|
244
|
+
* ## When to use this method
|
|
245
|
+
*
|
|
246
|
+
* This method is an escape hatch for read-only access to keyring data that
|
|
247
|
+
* is immutable once the keyring is initialized. A typical safe use case is
|
|
248
|
+
* reading the `mnemonic` from an `HdKeyring`: the mnemonic is set during
|
|
249
|
+
* `deserialize()` and never mutated afterwards, so it can safely be read
|
|
250
|
+
* without holding the lock.
|
|
251
|
+
*
|
|
252
|
+
* ## Why it is "unsafe"
|
|
253
|
+
*
|
|
254
|
+
* The "unsafe" designation mirrors the semantics of `unsafe { }` blocks in
|
|
255
|
+
* Rust: the method itself does not enforce thread-safety guarantees. By
|
|
256
|
+
* calling this method the **caller** explicitly takes responsibility for
|
|
257
|
+
* ensuring that:
|
|
258
|
+
*
|
|
259
|
+
* - The operation is **read-only** — no state is mutated.
|
|
260
|
+
* - The data being read is **immutable** after the keyring is initialized,
|
|
261
|
+
* so concurrent locked operations cannot alter it while this callback
|
|
262
|
+
* runs.
|
|
263
|
+
*
|
|
264
|
+
* Do **not** use this method to:
|
|
265
|
+
* - Mutate keyring state (add accounts, sign, etc.) — use `withKeyring`.
|
|
266
|
+
* - Read mutable fields that could change during concurrent operations.
|
|
267
|
+
*
|
|
268
|
+
* @param selector - Keyring selector object.
|
|
269
|
+
* @param operation - Read-only function to execute with the selected keyring.
|
|
270
|
+
* @returns Promise resolving to the result of the function execution.
|
|
271
|
+
* @template SelectedKeyring - The type of the selected keyring.
|
|
272
|
+
* @template CallbackResult - The type of the value resolved by the callback function.
|
|
273
|
+
*/
|
|
274
|
+
export type KeyringControllerWithKeyringUnsafeAction = {
|
|
275
|
+
type: `KeyringController:withKeyringUnsafe`;
|
|
276
|
+
handler: KeyringController['withKeyringUnsafe'];
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Union of all KeyringController action types.
|
|
280
|
+
*/
|
|
281
|
+
export type KeyringControllerMethodActions = KeyringControllerAddNewAccountAction | KeyringControllerCreateNewVaultAndRestoreAction | KeyringControllerCreateNewVaultAndKeychainAction | KeyringControllerAddNewKeyringAction | KeyringControllerGetAccountsAction | KeyringControllerGetEncryptionPublicKeyAction | KeyringControllerDecryptMessageAction | KeyringControllerGetKeyringForAccountAction | KeyringControllerGetKeyringsByTypeAction | KeyringControllerPersistAllKeyringsAction | KeyringControllerRemoveAccountAction | KeyringControllerSignMessageAction | KeyringControllerSignEip7702AuthorizationAction | KeyringControllerSignPersonalMessageAction | KeyringControllerSignTypedMessageAction | KeyringControllerPrepareUserOperationAction | KeyringControllerPatchUserOperationAction | KeyringControllerSignUserOperationAction | KeyringControllerWithKeyringAction | KeyringControllerWithKeyringUnsafeAction;
|
|
282
|
+
//# sourceMappingURL=KeyringController-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyringController-method-action-types.d.cts","sourceRoot":"","sources":["../src/KeyringController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,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AC7C,OAAO,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;CAClD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,oCAAoC,GACpC,+CAA+C,GAC/C,gDAAgD,GAChD,oCAAoC,GACpC,kCAAkC,GAClC,6CAA6C,GAC7C,qCAAqC,GACrC,2CAA2C,GAC3C,wCAAwC,GACxC,yCAAyC,GACzC,oCAAoC,GACpC,kCAAkC,GAClC,+CAA+C,GAC/C,0CAA0C,GAC1C,uCAAuC,GACvC,2CAA2C,GAC3C,yCAAyC,GACzC,wCAAwC,GACxC,kCAAkC,GAClC,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { KeyringController } from "./KeyringController.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Adds a new account to the default (first) HD seed phrase keyring.
|
|
8
|
+
*
|
|
9
|
+
* @param accountCount - Number of accounts before adding a new one, used to
|
|
10
|
+
* make the method idempotent.
|
|
11
|
+
* @returns Promise resolving to the added account address.
|
|
12
|
+
*/
|
|
13
|
+
export type KeyringControllerAddNewAccountAction = {
|
|
14
|
+
type: `KeyringController:addNewAccount`;
|
|
15
|
+
handler: KeyringController['addNewAccount'];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Effectively the same as creating a new keychain then populating it
|
|
19
|
+
* using the given seed phrase.
|
|
20
|
+
*
|
|
21
|
+
* @param password - Password to unlock keychain.
|
|
22
|
+
* @param seed - A BIP39-compliant seed phrase as Uint8Array,
|
|
23
|
+
* either as a string or an array of UTF-8 bytes that represent the string.
|
|
24
|
+
* @returns Promise resolving when the operation ends successfully.
|
|
25
|
+
*/
|
|
26
|
+
export type KeyringControllerCreateNewVaultAndRestoreAction = {
|
|
27
|
+
type: `KeyringController:createNewVaultAndRestore`;
|
|
28
|
+
handler: KeyringController['createNewVaultAndRestore'];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Create a new vault and primary keyring.
|
|
32
|
+
*
|
|
33
|
+
* This only works if keyrings are empty. If there is a pre-existing unlocked vault, calling this will have no effect.
|
|
34
|
+
* If there is a pre-existing locked vault, it will be replaced.
|
|
35
|
+
*
|
|
36
|
+
* @param password - Password to unlock the new vault.
|
|
37
|
+
* @returns Promise resolving when the operation ends successfully.
|
|
38
|
+
*/
|
|
39
|
+
export type KeyringControllerCreateNewVaultAndKeychainAction = {
|
|
40
|
+
type: `KeyringController:createNewVaultAndKeychain`;
|
|
41
|
+
handler: KeyringController['createNewVaultAndKeychain'];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Adds a new keyring of the given `type`.
|
|
45
|
+
*
|
|
46
|
+
* @param type - Keyring type name.
|
|
47
|
+
* @param opts - Keyring options.
|
|
48
|
+
* @throws If a builder for the given `type` does not exist.
|
|
49
|
+
* @returns Promise resolving to the new keyring metadata.
|
|
50
|
+
*/
|
|
51
|
+
export type KeyringControllerAddNewKeyringAction = {
|
|
52
|
+
type: `KeyringController:addNewKeyring`;
|
|
53
|
+
handler: KeyringController['addNewKeyring'];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Returns the public addresses of all accounts from every keyring.
|
|
57
|
+
*
|
|
58
|
+
* @returns A promise resolving to an array of addresses.
|
|
59
|
+
*/
|
|
60
|
+
export type KeyringControllerGetAccountsAction = {
|
|
61
|
+
type: `KeyringController:getAccounts`;
|
|
62
|
+
handler: KeyringController['getAccounts'];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Get encryption public key.
|
|
66
|
+
*
|
|
67
|
+
* @param account - An account address.
|
|
68
|
+
* @param opts - Additional encryption options.
|
|
69
|
+
* @throws If the `account` does not exist or does not support the `getEncryptionPublicKey` method
|
|
70
|
+
* @returns Promise resolving to encyption public key of the `account` if one exists.
|
|
71
|
+
*/
|
|
72
|
+
export type KeyringControllerGetEncryptionPublicKeyAction = {
|
|
73
|
+
type: `KeyringController:getEncryptionPublicKey`;
|
|
74
|
+
handler: KeyringController['getEncryptionPublicKey'];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Attempts to decrypt the provided message parameters.
|
|
78
|
+
*
|
|
79
|
+
* @param messageParams - The decryption message parameters.
|
|
80
|
+
* @param messageParams.from - The address of the account you want to use to decrypt the message.
|
|
81
|
+
* @param messageParams.data - The encrypted data that you want to decrypt.
|
|
82
|
+
* @returns The raw decryption result.
|
|
83
|
+
*/
|
|
84
|
+
export type KeyringControllerDecryptMessageAction = {
|
|
85
|
+
type: `KeyringController:decryptMessage`;
|
|
86
|
+
handler: KeyringController['decryptMessage'];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Returns the currently initialized keyring that manages
|
|
90
|
+
* the specified `address` if one exists.
|
|
91
|
+
*
|
|
92
|
+
* @deprecated Use of this method is discouraged as actions executed directly on
|
|
93
|
+
* keyrings are not being reflected in the KeyringController state and not
|
|
94
|
+
* persisted in the vault. Use `withKeyring` instead.
|
|
95
|
+
* @param account - An account address.
|
|
96
|
+
* @returns Promise resolving to keyring of the `account` if one exists.
|
|
97
|
+
*/
|
|
98
|
+
export type KeyringControllerGetKeyringForAccountAction = {
|
|
99
|
+
type: `KeyringController:getKeyringForAccount`;
|
|
100
|
+
handler: KeyringController['getKeyringForAccount'];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Returns all keyrings of the given type.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated Use of this method is discouraged as actions executed directly on
|
|
106
|
+
* keyrings are not being reflected in the KeyringController state and not
|
|
107
|
+
* persisted in the vault. Use `withKeyring` instead.
|
|
108
|
+
* @param type - Keyring type name.
|
|
109
|
+
* @returns An array of keyrings of the given type.
|
|
110
|
+
*/
|
|
111
|
+
export type KeyringControllerGetKeyringsByTypeAction = {
|
|
112
|
+
type: `KeyringController:getKeyringsByType`;
|
|
113
|
+
handler: KeyringController['getKeyringsByType'];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Persist all serialized keyrings in the vault.
|
|
117
|
+
*
|
|
118
|
+
* @deprecated This method is being phased out in favor of `withKeyring`.
|
|
119
|
+
* @returns Promise resolving with `true` value when the
|
|
120
|
+
* operation completes.
|
|
121
|
+
*/
|
|
122
|
+
export type KeyringControllerPersistAllKeyringsAction = {
|
|
123
|
+
type: `KeyringController:persistAllKeyrings`;
|
|
124
|
+
handler: KeyringController['persistAllKeyrings'];
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Removes an account from keyring state.
|
|
128
|
+
*
|
|
129
|
+
* @param address - Address of the account to remove.
|
|
130
|
+
* @fires KeyringController:accountRemoved
|
|
131
|
+
* @returns Promise resolving when the account is removed.
|
|
132
|
+
*/
|
|
133
|
+
export type KeyringControllerRemoveAccountAction = {
|
|
134
|
+
type: `KeyringController:removeAccount`;
|
|
135
|
+
handler: KeyringController['removeAccount'];
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Signs message by calling down into a specific keyring.
|
|
139
|
+
*
|
|
140
|
+
* @param messageParams - PersonalMessageParams object to sign.
|
|
141
|
+
* @returns Promise resolving to a signed message string.
|
|
142
|
+
*/
|
|
143
|
+
export type KeyringControllerSignMessageAction = {
|
|
144
|
+
type: `KeyringController:signMessage`;
|
|
145
|
+
handler: KeyringController['signMessage'];
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Signs EIP-7702 Authorization message by calling down into a specific keyring.
|
|
149
|
+
*
|
|
150
|
+
* @param params - EIP7702AuthorizationParams object to sign.
|
|
151
|
+
* @returns Promise resolving to an EIP-7702 Authorization signature.
|
|
152
|
+
* @throws Will throw UnsupportedSignEIP7702Authorization if the keyring does not support signing EIP-7702 Authorization messages.
|
|
153
|
+
*/
|
|
154
|
+
export type KeyringControllerSignEip7702AuthorizationAction = {
|
|
155
|
+
type: `KeyringController:signEip7702Authorization`;
|
|
156
|
+
handler: KeyringController['signEip7702Authorization'];
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Signs personal message by calling down into a specific keyring.
|
|
160
|
+
*
|
|
161
|
+
* @param messageParams - PersonalMessageParams object to sign.
|
|
162
|
+
* @returns Promise resolving to a signed message string.
|
|
163
|
+
*/
|
|
164
|
+
export type KeyringControllerSignPersonalMessageAction = {
|
|
165
|
+
type: `KeyringController:signPersonalMessage`;
|
|
166
|
+
handler: KeyringController['signPersonalMessage'];
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Signs typed message by calling down into a specific keyring.
|
|
170
|
+
*
|
|
171
|
+
* @param messageParams - TypedMessageParams object to sign.
|
|
172
|
+
* @param version - Compatibility version EIP712.
|
|
173
|
+
* @throws Will throw when passed an unrecognized version.
|
|
174
|
+
* @returns Promise resolving to a signed message string or an error if any.
|
|
175
|
+
*/
|
|
176
|
+
export type KeyringControllerSignTypedMessageAction = {
|
|
177
|
+
type: `KeyringController:signTypedMessage`;
|
|
178
|
+
handler: KeyringController['signTypedMessage'];
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Convert a base transaction to a base UserOperation.
|
|
182
|
+
*
|
|
183
|
+
* @param from - Address of the sender.
|
|
184
|
+
* @param transactions - Base transactions to include in the UserOperation.
|
|
185
|
+
* @param executionContext - The execution context to use for the UserOperation.
|
|
186
|
+
* @returns A pseudo-UserOperation that can be used to construct a real.
|
|
187
|
+
*/
|
|
188
|
+
export type KeyringControllerPrepareUserOperationAction = {
|
|
189
|
+
type: `KeyringController:prepareUserOperation`;
|
|
190
|
+
handler: KeyringController['prepareUserOperation'];
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Patches properties of a UserOperation. Currently, only the
|
|
194
|
+
* `paymasterAndData` can be patched.
|
|
195
|
+
*
|
|
196
|
+
* @param from - Address of the sender.
|
|
197
|
+
* @param userOp - UserOperation to patch.
|
|
198
|
+
* @param executionContext - The execution context to use for the UserOperation.
|
|
199
|
+
* @returns A patch to apply to the UserOperation.
|
|
200
|
+
*/
|
|
201
|
+
export type KeyringControllerPatchUserOperationAction = {
|
|
202
|
+
type: `KeyringController:patchUserOperation`;
|
|
203
|
+
handler: KeyringController['patchUserOperation'];
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Signs an UserOperation.
|
|
207
|
+
*
|
|
208
|
+
* @param from - Address of the sender.
|
|
209
|
+
* @param userOp - UserOperation to sign.
|
|
210
|
+
* @param executionContext - The execution context to use for the UserOperation.
|
|
211
|
+
* @returns The signature of the UserOperation.
|
|
212
|
+
*/
|
|
213
|
+
export type KeyringControllerSignUserOperationAction = {
|
|
214
|
+
type: `KeyringController:signUserOperation`;
|
|
215
|
+
handler: KeyringController['signUserOperation'];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Select a keyring and execute the given operation with
|
|
219
|
+
* the selected keyring, as a mutually exclusive atomic
|
|
220
|
+
* operation.
|
|
221
|
+
*
|
|
222
|
+
* The method automatically persists changes at the end of the
|
|
223
|
+
* function execution, or rolls back the changes if an error
|
|
224
|
+
* is thrown.
|
|
225
|
+
*
|
|
226
|
+
* @param selector - Keyring selector object.
|
|
227
|
+
* @param operation - Function to execute with the selected keyring.
|
|
228
|
+
* @param options - Additional options.
|
|
229
|
+
* @param options.createIfMissing - Whether to create a new keyring if the selected one is missing.
|
|
230
|
+
* @param options.createWithData - Optional data to use when creating a new keyring.
|
|
231
|
+
* @returns Promise resolving to the result of the function execution.
|
|
232
|
+
* @template SelectedKeyring - The type of the selected keyring.
|
|
233
|
+
* @template CallbackResult - The type of the value resolved by the callback function.
|
|
234
|
+
* @deprecated This method overload is deprecated. Use `withKeyring` without options instead.
|
|
235
|
+
*/
|
|
236
|
+
export type KeyringControllerWithKeyringAction = {
|
|
237
|
+
type: `KeyringController:withKeyring`;
|
|
238
|
+
handler: KeyringController['withKeyring'];
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Select a keyring and execute the given operation with the selected
|
|
242
|
+
* keyring, **without** acquiring the controller's mutual exclusion lock.
|
|
243
|
+
*
|
|
244
|
+
* ## When to use this method
|
|
245
|
+
*
|
|
246
|
+
* This method is an escape hatch for read-only access to keyring data that
|
|
247
|
+
* is immutable once the keyring is initialized. A typical safe use case is
|
|
248
|
+
* reading the `mnemonic` from an `HdKeyring`: the mnemonic is set during
|
|
249
|
+
* `deserialize()` and never mutated afterwards, so it can safely be read
|
|
250
|
+
* without holding the lock.
|
|
251
|
+
*
|
|
252
|
+
* ## Why it is "unsafe"
|
|
253
|
+
*
|
|
254
|
+
* The "unsafe" designation mirrors the semantics of `unsafe { }` blocks in
|
|
255
|
+
* Rust: the method itself does not enforce thread-safety guarantees. By
|
|
256
|
+
* calling this method the **caller** explicitly takes responsibility for
|
|
257
|
+
* ensuring that:
|
|
258
|
+
*
|
|
259
|
+
* - The operation is **read-only** — no state is mutated.
|
|
260
|
+
* - The data being read is **immutable** after the keyring is initialized,
|
|
261
|
+
* so concurrent locked operations cannot alter it while this callback
|
|
262
|
+
* runs.
|
|
263
|
+
*
|
|
264
|
+
* Do **not** use this method to:
|
|
265
|
+
* - Mutate keyring state (add accounts, sign, etc.) — use `withKeyring`.
|
|
266
|
+
* - Read mutable fields that could change during concurrent operations.
|
|
267
|
+
*
|
|
268
|
+
* @param selector - Keyring selector object.
|
|
269
|
+
* @param operation - Read-only function to execute with the selected keyring.
|
|
270
|
+
* @returns Promise resolving to the result of the function execution.
|
|
271
|
+
* @template SelectedKeyring - The type of the selected keyring.
|
|
272
|
+
* @template CallbackResult - The type of the value resolved by the callback function.
|
|
273
|
+
*/
|
|
274
|
+
export type KeyringControllerWithKeyringUnsafeAction = {
|
|
275
|
+
type: `KeyringController:withKeyringUnsafe`;
|
|
276
|
+
handler: KeyringController['withKeyringUnsafe'];
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Union of all KeyringController action types.
|
|
280
|
+
*/
|
|
281
|
+
export type KeyringControllerMethodActions = KeyringControllerAddNewAccountAction | KeyringControllerCreateNewVaultAndRestoreAction | KeyringControllerCreateNewVaultAndKeychainAction | KeyringControllerAddNewKeyringAction | KeyringControllerGetAccountsAction | KeyringControllerGetEncryptionPublicKeyAction | KeyringControllerDecryptMessageAction | KeyringControllerGetKeyringForAccountAction | KeyringControllerGetKeyringsByTypeAction | KeyringControllerPersistAllKeyringsAction | KeyringControllerRemoveAccountAction | KeyringControllerSignMessageAction | KeyringControllerSignEip7702AuthorizationAction | KeyringControllerSignPersonalMessageAction | KeyringControllerSignTypedMessageAction | KeyringControllerPrepareUserOperationAction | KeyringControllerPatchUserOperationAction | KeyringControllerSignUserOperationAction | KeyringControllerWithKeyringAction | KeyringControllerWithKeyringUnsafeAction;
|
|
282
|
+
//# sourceMappingURL=KeyringController-method-action-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyringController-method-action-types.d.mts","sourceRoot":"","sources":["../src/KeyringController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA4B;AAE7D;;;;;;GAMG;AACH,MAAM,MAAM,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