@metamask-previews/keyring-api 21.3.0-feb98c5 → 21.5.0-fd40efd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +43 -3
  2. package/dist/api/account-options.cjs +4 -0
  3. package/dist/api/account-options.cjs.map +1 -1
  4. package/dist/api/account-options.d.cts +4 -0
  5. package/dist/api/account-options.d.cts.map +1 -1
  6. package/dist/api/account-options.d.mts +4 -0
  7. package/dist/api/account-options.d.mts.map +1 -1
  8. package/dist/api/account-options.mjs +4 -0
  9. package/dist/api/account-options.mjs.map +1 -1
  10. package/dist/api/keyring.cjs.map +1 -1
  11. package/dist/api/keyring.d.cts +13 -0
  12. package/dist/api/keyring.d.cts.map +1 -1
  13. package/dist/api/keyring.d.mts +13 -0
  14. package/dist/api/keyring.d.mts.map +1 -1
  15. package/dist/api/keyring.mjs.map +1 -1
  16. package/dist/api/transaction.cjs +64 -1
  17. package/dist/api/transaction.cjs.map +1 -1
  18. package/dist/api/transaction.d.cts +135 -0
  19. package/dist/api/transaction.d.cts.map +1 -1
  20. package/dist/api/transaction.d.mts +135 -0
  21. package/dist/api/transaction.d.mts.map +1 -1
  22. package/dist/api/transaction.mjs +64 -1
  23. package/dist/api/transaction.mjs.map +1 -1
  24. package/dist/api/v2/create-account/bip44.cjs +27 -1
  25. package/dist/api/v2/create-account/bip44.cjs.map +1 -1
  26. package/dist/api/v2/create-account/bip44.d.cts +46 -0
  27. package/dist/api/v2/create-account/bip44.d.cts.map +1 -1
  28. package/dist/api/v2/create-account/bip44.d.mts +46 -0
  29. package/dist/api/v2/create-account/bip44.d.mts.map +1 -1
  30. package/dist/api/v2/create-account/bip44.mjs +26 -0
  31. package/dist/api/v2/create-account/bip44.mjs.map +1 -1
  32. package/dist/api/v2/create-account/index.cjs +44 -0
  33. package/dist/api/v2/create-account/index.cjs.map +1 -1
  34. package/dist/api/v2/create-account/index.d.cts +44 -0
  35. package/dist/api/v2/create-account/index.d.cts.map +1 -1
  36. package/dist/api/v2/create-account/index.d.mts +44 -0
  37. package/dist/api/v2/create-account/index.d.mts.map +1 -1
  38. package/dist/api/v2/create-account/index.mjs +44 -1
  39. package/dist/api/v2/create-account/index.mjs.map +1 -1
  40. package/dist/api/v2/keyring-capabilities.cjs +7 -3
  41. package/dist/api/v2/keyring-capabilities.cjs.map +1 -1
  42. package/dist/api/v2/keyring-capabilities.d.cts +16 -9
  43. package/dist/api/v2/keyring-capabilities.d.cts.map +1 -1
  44. package/dist/api/v2/keyring-capabilities.d.mts +16 -9
  45. package/dist/api/v2/keyring-capabilities.d.mts.map +1 -1
  46. package/dist/api/v2/keyring-capabilities.mjs +7 -3
  47. package/dist/api/v2/keyring-capabilities.mjs.map +1 -1
  48. package/dist/api/v2/wrapper/keyring-wrapper.cjs +21 -3
  49. package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +1 -1
  50. package/dist/api/v2/wrapper/keyring-wrapper.d.cts +9 -1
  51. package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +1 -1
  52. package/dist/api/v2/wrapper/keyring-wrapper.d.mts +9 -1
  53. package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +1 -1
  54. package/dist/api/v2/wrapper/keyring-wrapper.mjs +21 -3
  55. package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +1 -1
  56. package/dist/eth/erc4337/types.d.cts +4 -4
  57. package/dist/eth/erc4337/types.d.mts +4 -4
  58. package/dist/eth/rpc/params.cjs +1 -1
  59. package/dist/eth/rpc/params.cjs.map +1 -1
  60. package/dist/eth/rpc/params.d.cts +16 -16
  61. package/dist/eth/rpc/params.d.cts.map +1 -1
  62. package/dist/eth/rpc/params.d.mts +16 -16
  63. package/dist/eth/rpc/params.d.mts.map +1 -1
  64. package/dist/eth/rpc/params.mjs +2 -2
  65. package/dist/eth/rpc/params.mjs.map +1 -1
  66. package/dist/eth/types.cjs +5 -2
  67. package/dist/eth/types.cjs.map +1 -1
  68. package/dist/eth/types.d.cts +6 -5
  69. package/dist/eth/types.d.cts.map +1 -1
  70. package/dist/eth/types.d.mts +6 -5
  71. package/dist/eth/types.d.mts.map +1 -1
  72. package/dist/eth/types.mjs +4 -1
  73. package/dist/eth/types.mjs.map +1 -1
  74. package/dist/events.d.cts +12 -0
  75. package/dist/events.d.cts.map +1 -1
  76. package/dist/events.d.mts +12 -0
  77. package/dist/events.d.mts.map +1 -1
  78. package/dist/rpc.cjs +12 -1
  79. package/dist/rpc.cjs.map +1 -1
  80. package/dist/rpc.d.cts +189 -0
  81. package/dist/rpc.d.cts.map +1 -1
  82. package/dist/rpc.d.mts +189 -0
  83. package/dist/rpc.d.mts.map +1 -1
  84. package/dist/rpc.mjs +12 -1
  85. package/dist/rpc.mjs.map +1 -1
  86. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EAER,8BAA8B;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AACvB,OAAO,EAAE,iBAAiB,EAAE,oBAAgB;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,aAAa,CAClB,MAAM,CAAC;QACL;;WAEG;QACH,UAAU,EAAE,OAAO,EAAE;QACrB;;WAEG;QACH,WAAW,EAAE,OAAO,EAAE;QACtB;;WAEG;QACH,QAAQ,EAAE,OAAO,EAAE;KACpB,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,aAAa,CACvB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CACnB,OAAO,CACL,MAAM,CAAC;QACL,cAAc,EAAE,OAAO,EAAE;KAC1B,CAAC,CACH,CACF;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: boolean(),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: boolean(),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: boolean(),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which KeyringV2 methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
1
+ {"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/api/v2/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EAER,8BAA8B;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AACvB,OAAO,EAAE,iBAAiB,EAAE,oBAAgB;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,aAAa,CAClB,MAAM,CAAC;QACL;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,aAAa,CACvB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CACnB,OAAO,CACL,MAAM,CAAC;QACL,cAAc,EAAE,OAAO,EAAE;KAC1B,CAAC,CACH,CACF;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n type Infer,\n} from '@metamask/superstruct';\n\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\nimport { CaipChainIdStruct } from '../caip';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which KeyringV2 methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
2
8
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
9
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
12
  };
7
- var _KeyringWrapper_lock;
13
+ var _KeyringWrapper_capabilities, _KeyringWrapper_lock;
8
14
  Object.defineProperty(exports, "__esModule", { value: true });
9
15
  exports.KeyringWrapper = void 0;
10
16
  const async_mutex_1 = require("async-mutex");
@@ -21,6 +27,7 @@ const keyring_account_registry_1 = require("./keyring-account-registry.cjs");
21
27
  */
22
28
  class KeyringWrapper {
23
29
  constructor(options) {
30
+ _KeyringWrapper_capabilities.set(this, void 0);
24
31
  /**
25
32
  * Mutex to ensure exclusive access to the inner keyring during
26
33
  * operations that mutate its state.
@@ -36,7 +43,18 @@ class KeyringWrapper {
36
43
  this.registry = new keyring_account_registry_1.KeyringAccountRegistry();
37
44
  this.inner = options.inner;
38
45
  this.type = `${options.type}`;
39
- this.capabilities = options.capabilities;
46
+ __classPrivateFieldSet(this, _KeyringWrapper_capabilities, options.capabilities, "f");
47
+ }
48
+ /**
49
+ * Get the capabilities of this keyring.
50
+ *
51
+ * Subclasses can override this getter to return capabilities dynamically
52
+ * based on runtime state.
53
+ *
54
+ * @returns The keyring's capabilities.
55
+ */
56
+ get capabilities() {
57
+ return __classPrivateFieldGet(this, _KeyringWrapper_capabilities, "f");
40
58
  }
41
59
  /**
42
60
  * Execute an operation with exclusive access to the inner keyring.
@@ -112,5 +130,5 @@ class KeyringWrapper {
112
130
  }
113
131
  }
114
132
  exports.KeyringWrapper = KeyringWrapper;
115
- _KeyringWrapper_lock = new WeakMap();
133
+ _KeyringWrapper_capabilities = new WeakMap(), _KeyringWrapper_lock = new WeakMap();
116
134
  //# sourceMappingURL=keyring-wrapper.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-wrapper.cjs","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-wrapper.ts"],"names":[],"mappings":";;;;;;;;;AAEA,6CAAoC;AAEpC,6EAAoE;AAgCpE;;;;;;;;;GASG;AACH,MAAsB,cAAc;IA2BlC,YAAY,OAA4C;QAhBxD;;;WAGG;QACM,+BAAQ,IAAI,mBAAK,EAAE,EAAC;QAE7B;;;;;;WAMG;QACgB,aAAQ,GACzB,IAAI,iDAAsB,EAAsB,CAAC;QAGjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC9B,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AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\n\nimport { KeyringAccountRegistry } from './keyring-account-registry';\nimport type {\n CreateAccountOptions,\n ExportAccountOptions,\n ExportedAccount,\n} from '..';\nimport type { KeyringAccount } from '../../account';\nimport type { KeyringRequest } from '../../request';\nimport type { KeyringV2 } from '../keyring';\nimport type { KeyringCapabilities } from '../keyring-capabilities';\nimport type { KeyringType } from '../keyring-type';\n\n/**\n * Basic options for constructing a {@link KeyringWrapper}.\n */\nexport type KeyringWrapperOptions<InnerKeyring extends Keyring> = {\n /**\n * The underlying \"old\" keyring instance that this wrapper adapts.\n */\n inner: InnerKeyring;\n\n /**\n * The concrete keyring type exposed through the V2 interface.\n */\n type: KeyringType;\n\n /**\n * Capabilities of the underlying keyring.\n */\n capabilities: KeyringCapabilities;\n};\n\n/**\n * Generic adapter that turns an existing {@link Keyring} implementation into a\n * {@link KeyringV2} instance.\n *\n * Consumers are expected to provide concrete mappings between high-level V2\n * operations and the underlying keyring methods (for example BIP-44 account\n * creation, private-key import, and request handling). This class focuses on\n * the common mechanics required by all adapters: state serialization,\n * account-ID/address mapping and basic account management.\n */\nexport abstract class KeyringWrapper<\n InnerKeyring extends Keyring,\n KeyringAccountType extends KeyringAccount = KeyringAccount,\n> implements KeyringV2\n{\n readonly type: `${KeyringType}`;\n\n readonly capabilities: KeyringCapabilities;\n\n protected readonly inner: InnerKeyring;\n\n /**\n * Mutex to ensure exclusive access to the inner keyring during\n * operations that mutate its state.\n */\n readonly #lock = new Mutex();\n\n /**\n * Registry for KeyringAccount objects.\n * Provides O(1) lookups by AccountId or address.\n *\n * Subclasses should use this registry when creating accounts and\n * clear/update it when deleting accounts or deserializing state.\n */\n protected readonly registry =\n new KeyringAccountRegistry<KeyringAccountType>();\n\n constructor(options: KeyringWrapperOptions<InnerKeyring>) {\n this.inner = options.inner;\n this.type = `${options.type}`;\n this.capabilities = options.capabilities;\n }\n\n /**\n * Execute an operation with exclusive access to the inner keyring.\n *\n * This method ensures thread-safety for operations that read or mutate\n * the inner keyring state. All operations that modify the keyring\n * (createAccounts, deleteAccount, deserialize) should use this method\n * to prevent race conditions.\n *\n * Within the callback, use `this.inner` to access the inner keyring.\n *\n * @param callback - A function that performs the operation.\n * @returns The result of the callback.\n */\n protected async withLock<Result>(\n callback: () => Promise<Result>,\n ): Promise<Result> {\n return this.#lock.runExclusive(callback);\n }\n\n /**\n * Serialize the underlying keyring state to a JSON-serializable object.\n *\n * This simply delegates to the legacy keyring's {@link Keyring.serialize}\n * implementation.\n *\n * @returns The serialized keyring state.\n */\n async serialize(): Promise<Json> {\n return this.inner.serialize();\n }\n\n /**\n * Hydrate the underlying keyring from a previously serialized state.\n *\n * This clears the registry, delegates to the legacy keyring's\n * {@link Keyring.deserialize} implementation, and rebuilds the registry\n * by calling {@link getAccounts}.\n *\n * @param state - The serialized keyring state.\n */\n async deserialize(state: Json): Promise<void> {\n await this.withLock(async () => {\n // Clear the registry when deserializing\n this.registry.clear();\n\n // Deserialize the legacy keyring\n await this.inner.deserialize(state);\n\n // Rebuild the registry by calling getAccounts().\n // Subclass implementations of getAccounts() should populate the registry\n // as a side effect (see the abstract method's documentation).\n await this.getAccounts();\n });\n }\n\n /**\n * Return all accounts managed by this keyring.\n *\n * Concrete adapters are responsible for mapping the underlying keyring's\n * notion of accounts (typically addresses returned by\n * {@link Keyring.getAccounts}) into {@link KeyringAccount} objects.\n * Implementations should use the configured {@link KeyringAccountRegistry}\n * to establish the account ID/address mapping so that\n * {@link getAccount} works as expected.\n *\n * @returns The list of managed accounts.\n */\n abstract getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Look up a single account by its {@link AccountId}.\n *\n * This method first checks the registry for O(1) lookup.\n * If not found, it falls back to calling {@link getAccounts} which\n * should populate the registry as a side effect.\n *\n * @param accountId - The AccountId to look up.\n * @returns The matching KeyringAccount.\n */\n async getAccount(accountId: AccountId): Promise<KeyringAccount> {\n let cached = this.registry.get(accountId);\n if (cached) {\n return cached;\n }\n\n // Prime the registry by calling getAccounts\n await this.getAccounts();\n\n // Try registry again after priming\n cached = this.registry.get(accountId);\n if (!cached) {\n throw new Error(`Account not found for id: ${accountId}`);\n }\n\n return cached;\n }\n\n /**\n * Create one or more new accounts managed by this keyring.\n *\n * Implementations are responsible for interpreting the\n * {@link CreateAccountOptions} (for example BIP-44 derivation or\n * private-key import) and returning the resulting {@link KeyringAccount}\n * objects. Implementors should also ensure that the registry is updated so\n * that {@link getAccount} works for newly created accounts.\n */\n abstract createAccounts(\n options: CreateAccountOptions,\n ): Promise<KeyringAccount[]>;\n\n /**\n * Remove the account associated with the given {@link AccountId} from this\n * keyring.\n *\n * Implementations are expected to translate the ID to an underlying\n * address (typically via the registry) and then invoke the appropriate\n * removal mechanism on the legacy keyring.\n */\n abstract deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Export the secrets associated with the given account in a format\n * described by {@link ExportAccountOptions}.\n *\n * This method is optional, and concrete adapters should only\n * implement it if the underlying keyring supports exporting\n * accounts.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Handle a high-level {@link KeyringRequest} on behalf of this keyring.\n *\n * Concrete adapters are responsible for routing the request's method and\n * parameters to the appropriate legacy keyring APIs (for example signing\n * transactions or decrypting messages) and returning a JSON-serializable\n * result.\n */\n abstract submitRequest(request: KeyringRequest): Promise<Json>;\n}\n"]}
1
+ {"version":3,"file":"keyring-wrapper.cjs","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-wrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,6CAAoC;AAEpC,6EAAoE;AAgCpE;;;;;;;;;GASG;AACH,MAAsB,cAAc;IA2BlC,YAAY,OAA4C;QApB/C,+CAAmC;QAI5C;;;WAGG;QACM,+BAAQ,IAAI,mBAAK,EAAE,EAAC;QAE7B;;;;;;WAMG;QACgB,aAAQ,GACzB,IAAI,iDAA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AC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CA+CF;AA3LD,wCA2LC","sourcesContent":["import type { Keyring, AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\n\nimport { KeyringAccountRegistry } from './keyring-account-registry';\nimport type {\n CreateAccountOptions,\n ExportAccountOptions,\n ExportedAccount,\n} from '..';\nimport type { KeyringAccount } from '../../account';\nimport type { KeyringRequest } from '../../request';\nimport type { KeyringV2 } from '../keyring';\nimport type { KeyringCapabilities } from '../keyring-capabilities';\nimport type { KeyringType } from '../keyring-type';\n\n/**\n * Basic options for constructing a {@link KeyringWrapper}.\n */\nexport type KeyringWrapperOptions<InnerKeyring extends Keyring> = {\n /**\n * The underlying \"old\" keyring instance that this wrapper adapts.\n */\n inner: InnerKeyring;\n\n /**\n * The concrete keyring type exposed through the V2 interface.\n */\n type: KeyringType;\n\n /**\n * Capabilities of the underlying keyring.\n */\n capabilities: KeyringCapabilities;\n};\n\n/**\n * Generic adapter that turns an existing {@link Keyring} implementation into a\n * {@link KeyringV2} instance.\n *\n * Consumers are expected to provide concrete mappings between high-level V2\n * operations and the underlying keyring methods (for example BIP-44 account\n * creation, private-key import, and request handling). This class focuses on\n * the common mechanics required by all adapters: state serialization,\n * account-ID/address mapping and basic account management.\n */\nexport abstract class KeyringWrapper<\n InnerKeyring extends Keyring,\n KeyringAccountType extends KeyringAccount = KeyringAccount,\n> implements KeyringV2\n{\n readonly type: `${KeyringType}`;\n\n readonly #capabilities: KeyringCapabilities;\n\n protected readonly inner: InnerKeyring;\n\n /**\n * Mutex to ensure exclusive access to the inner keyring during\n * operations that mutate its state.\n */\n readonly #lock = new Mutex();\n\n /**\n * Registry for KeyringAccount objects.\n * Provides O(1) lookups by AccountId or address.\n *\n * Subclasses should use this registry when creating accounts and\n * clear/update it when deleting accounts or deserializing state.\n */\n protected readonly registry =\n new KeyringAccountRegistry<KeyringAccountType>();\n\n constructor(options: KeyringWrapperOptions<InnerKeyring>) {\n this.inner = options.inner;\n this.type = `${options.type}`;\n this.#capabilities = options.capabilities;\n }\n\n /**\n * Get the capabilities of this keyring.\n *\n * Subclasses can override this getter to return capabilities dynamically\n * based on runtime state.\n *\n * @returns The keyring's capabilities.\n */\n get capabilities(): KeyringCapabilities {\n return this.#capabilities;\n }\n\n /**\n * Execute an operation with exclusive access to the inner keyring.\n *\n * This method ensures thread-safety for operations that read or mutate\n * the inner keyring state. All operations that modify the keyring\n * (createAccounts, deleteAccount, deserialize) should use this method\n * to prevent race conditions.\n *\n * Within the callback, use `this.inner` to access the inner keyring.\n *\n * @param callback - A function that performs the operation.\n * @returns The result of the callback.\n */\n protected async withLock<Result>(\n callback: () => Promise<Result>,\n ): Promise<Result> {\n return this.#lock.runExclusive(callback);\n }\n\n /**\n * Serialize the underlying keyring state to a JSON-serializable object.\n *\n * This simply delegates to the legacy keyring's {@link Keyring.serialize}\n * implementation.\n *\n * @returns The serialized keyring state.\n */\n async serialize(): Promise<Json> {\n return this.inner.serialize();\n }\n\n /**\n * Hydrate the underlying keyring from a previously serialized state.\n *\n * This clears the registry, delegates to the legacy keyring's\n * {@link Keyring.deserialize} implementation, and rebuilds the registry\n * by calling {@link getAccounts}.\n *\n * @param state - The serialized keyring state.\n */\n async deserialize(state: Json): Promise<void> {\n await this.withLock(async () => {\n // Clear the registry when deserializing\n this.registry.clear();\n\n // Deserialize the legacy keyring\n await this.inner.deserialize(state);\n\n // Rebuild the registry by calling getAccounts().\n // Subclass implementations of getAccounts() should populate the registry\n // as a side effect (see the abstract method's documentation).\n await this.getAccounts();\n });\n }\n\n /**\n * Return all accounts managed by this keyring.\n *\n * Concrete adapters are responsible for mapping the underlying keyring's\n * notion of accounts (typically addresses returned by\n * {@link Keyring.getAccounts}) into {@link KeyringAccount} objects.\n * Implementations should use the configured {@link KeyringAccountRegistry}\n * to establish the account ID/address mapping so that\n * {@link getAccount} works as expected.\n *\n * @returns The list of managed accounts.\n */\n abstract getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Look up a single account by its {@link AccountId}.\n *\n * This method first checks the registry for O(1) lookup.\n * If not found, it falls back to calling {@link getAccounts} which\n * should populate the registry as a side effect.\n *\n * @param accountId - The AccountId to look up.\n * @returns The matching KeyringAccount.\n */\n async getAccount(accountId: AccountId): Promise<KeyringAccount> {\n let cached = this.registry.get(accountId);\n if (cached) {\n return cached;\n }\n\n // Prime the registry by calling getAccounts\n await this.getAccounts();\n\n // Try registry again after priming\n cached = this.registry.get(accountId);\n if (!cached) {\n throw new Error(`Account not found for id: ${accountId}`);\n }\n\n return cached;\n }\n\n /**\n * Create one or more new accounts managed by this keyring.\n *\n * Implementations are responsible for interpreting the\n * {@link CreateAccountOptions} (for example BIP-44 derivation or\n * private-key import) and returning the resulting {@link KeyringAccount}\n * objects. Implementors should also ensure that the registry is updated so\n * that {@link getAccount} works for newly created accounts.\n */\n abstract createAccounts(\n options: CreateAccountOptions,\n ): Promise<KeyringAccount[]>;\n\n /**\n * Remove the account associated with the given {@link AccountId} from this\n * keyring.\n *\n * Implementations are expected to translate the ID to an underlying\n * address (typically via the registry) and then invoke the appropriate\n * removal mechanism on the legacy keyring.\n */\n abstract deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Export the secrets associated with the given account in a format\n * described by {@link ExportAccountOptions}.\n *\n * This method is optional, and concrete adapters should only\n * implement it if the underlying keyring supports exporting\n * accounts.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Handle a high-level {@link KeyringRequest} on behalf of this keyring.\n *\n * Concrete adapters are responsible for routing the request's method and\n * parameters to the appropriate legacy keyring APIs (for example signing\n * transactions or decrypting messages) and returning a JSON-serializable\n * result.\n */\n abstract submitRequest(request: KeyringRequest): Promise<Json>;\n}\n"]}
@@ -37,7 +37,6 @@ export type KeyringWrapperOptions<InnerKeyring extends Keyring> = {
37
37
  export declare abstract class KeyringWrapper<InnerKeyring extends Keyring, KeyringAccountType extends KeyringAccount = KeyringAccount> implements KeyringV2 {
38
38
  #private;
39
39
  readonly type: `${KeyringType}`;
40
- readonly capabilities: KeyringCapabilities;
41
40
  protected readonly inner: InnerKeyring;
42
41
  /**
43
42
  * Registry for KeyringAccount objects.
@@ -48,6 +47,15 @@ export declare abstract class KeyringWrapper<InnerKeyring extends Keyring, Keyri
48
47
  */
49
48
  protected readonly registry: KeyringAccountRegistry<KeyringAccountType>;
50
49
  constructor(options: KeyringWrapperOptions<InnerKeyring>);
50
+ /**
51
+ * Get the capabilities of this keyring.
52
+ *
53
+ * Subclasses can override this getter to return capabilities dynamically
54
+ * based on runtime state.
55
+ *
56
+ * @returns The keyring's capabilities.
57
+ */
58
+ get capabilities(): KeyringCapabilities;
51
59
  /**
52
60
  * Execute an operation with exclusive access to the inner keyring.
53
61
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-wrapper.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,gCAAgC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AACpE,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,qBAAW;AACZ,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAsB;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAsB;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAmB;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAgC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAwB;AAEnD;;GAE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YAAY,CAAC;IAQvC;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,6CACwB;gBAEvC,OAAO,EAAE,qBAAqB,CAAC,YAAY,CAAC;IAMxD;;;;;;;OAOG;IACH,IAAI,YAAY,IAAI,mBAAmB,CAEtC;IAED;;;;;;;;;;;;OAYG;cACa,QAAQ,CAAC,MAAM,EAC7B,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAC9B,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;;;;OAQG;IACG,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAEjD;;;;;;;;;OASG;IACG,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;IAkB/D;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CACrB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,cAAc,EAAE,CAAC;IAE5B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3D;;;;;;;OAOG;IACH,aAAa,CAAC,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC;IAE3B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAC/D"}
@@ -37,7 +37,6 @@ export type KeyringWrapperOptions<InnerKeyring extends Keyring> = {
37
37
  export declare abstract class KeyringWrapper<InnerKeyring extends Keyring, KeyringAccountType extends KeyringAccount = KeyringAccount> implements KeyringV2 {
38
38
  #private;
39
39
  readonly type: `${KeyringType}`;
40
- readonly capabilities: KeyringCapabilities;
41
40
  protected readonly inner: InnerKeyring;
42
41
  /**
43
42
  * Registry for KeyringAccount objects.
@@ -48,6 +47,15 @@ export declare abstract class KeyringWrapper<InnerKeyring extends Keyring, Keyri
48
47
  */
49
48
  protected readonly registry: KeyringAccountRegistry<KeyringAccountType>;
50
49
  constructor(options: KeyringWrapperOptions<InnerKeyring>);
50
+ /**
51
+ * Get the capabilities of this keyring.
52
+ *
53
+ * Subclasses can override this getter to return capabilities dynamically
54
+ * based on runtime state.
55
+ *
56
+ * @returns The keyring's capabilities.
57
+ */
58
+ get capabilities(): KeyringCapabilities;
51
59
  /**
52
60
  * Execute an operation with exclusive access to the inner keyring.
53
61
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-wrapper.d.mts","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,gCAAgC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AACpE,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,qBAAW;AACZ,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAsB;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,0BAAsB;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAmB;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAgC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAwB;AAEnD;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,YAAY,SAAS,OAAO,IAAI;IAChE;;OAEG;IACH,KAAK,EAAE,YAAY,CAAC;IAEpB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAElB;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;CACnC,CAAC;AAEF;;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ACa,QAAQ,CAAC,MAAM,EAC7B,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAC9B,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;;;;OAQG;IACG,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAEjD;;;;;;;;;OASG;IACG,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;IAkB/D;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CACrB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,cAAc,EAAE,CAAC;IAE5B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3D;;;;;;;OAOG;IACH,aAAa,CAAC,CACZ,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC;IAE3B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAC/D"}
@@ -1,9 +1,15 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
1
7
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
8
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
11
  };
6
- var _KeyringWrapper_lock;
12
+ var _KeyringWrapper_capabilities, _KeyringWrapper_lock;
7
13
  import { Mutex } from "async-mutex";
8
14
  import { KeyringAccountRegistry } from "./keyring-account-registry.mjs";
9
15
  /**
@@ -18,6 +24,7 @@ import { KeyringAccountRegistry } from "./keyring-account-registry.mjs";
18
24
  */
19
25
  export class KeyringWrapper {
20
26
  constructor(options) {
27
+ _KeyringWrapper_capabilities.set(this, void 0);
21
28
  /**
22
29
  * Mutex to ensure exclusive access to the inner keyring during
23
30
  * operations that mutate its state.
@@ -33,7 +40,18 @@ export class KeyringWrapper {
33
40
  this.registry = new KeyringAccountRegistry();
34
41
  this.inner = options.inner;
35
42
  this.type = `${options.type}`;
36
- this.capabilities = options.capabilities;
43
+ __classPrivateFieldSet(this, _KeyringWrapper_capabilities, options.capabilities, "f");
44
+ }
45
+ /**
46
+ * Get the capabilities of this keyring.
47
+ *
48
+ * Subclasses can override this getter to return capabilities dynamically
49
+ * based on runtime state.
50
+ *
51
+ * @returns The keyring's capabilities.
52
+ */
53
+ get capabilities() {
54
+ return __classPrivateFieldGet(this, _KeyringWrapper_capabilities, "f");
37
55
  }
38
56
  /**
39
57
  * Execute an operation with exclusive access to the inner keyring.
@@ -108,5 +126,5 @@ export class KeyringWrapper {
108
126
  return cached;
109
127
  }
110
128
  }
111
- _KeyringWrapper_lock = new WeakMap();
129
+ _KeyringWrapper_capabilities = new WeakMap(), _KeyringWrapper_lock = new WeakMap();
112
130
  //# sourceMappingURL=keyring-wrapper.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-wrapper.mjs","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-wrapper.ts"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,SAAS,CAAC,CAAC;QAC1C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,4CAA4C;QAC5C,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAEzB,mCAAmC;QACnC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CA+CF","sourcesContent":["import type { Keyring, AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\n\nimport { KeyringAccountRegistry } from './keyring-account-registry';\nimport type {\n CreateAccountOptions,\n ExportAccountOptions,\n ExportedAccount,\n} from '..';\nimport type { KeyringAccount } from '../../account';\nimport type { KeyringRequest } from '../../request';\nimport type { KeyringV2 } from '../keyring';\nimport type { KeyringCapabilities } from '../keyring-capabilities';\nimport type { KeyringType } from '../keyring-type';\n\n/**\n * Basic options for constructing a {@link KeyringWrapper}.\n */\nexport type KeyringWrapperOptions<InnerKeyring extends Keyring> = {\n /**\n * The underlying \"old\" keyring instance that this wrapper adapts.\n */\n inner: InnerKeyring;\n\n /**\n * The concrete keyring type exposed through the V2 interface.\n */\n type: KeyringType;\n\n /**\n * Capabilities of the underlying keyring.\n */\n capabilities: KeyringCapabilities;\n};\n\n/**\n * Generic adapter that turns an existing {@link Keyring} implementation into a\n * {@link KeyringV2} instance.\n *\n * Consumers are expected to provide concrete mappings between high-level V2\n * operations and the underlying keyring methods (for example BIP-44 account\n * creation, private-key import, and request handling). This class focuses on\n * the common mechanics required by all adapters: state serialization,\n * account-ID/address mapping and basic account management.\n */\nexport abstract class KeyringWrapper<\n InnerKeyring extends Keyring,\n KeyringAccountType extends KeyringAccount = KeyringAccount,\n> implements KeyringV2\n{\n readonly type: `${KeyringType}`;\n\n readonly capabilities: KeyringCapabilities;\n\n protected readonly inner: InnerKeyring;\n\n /**\n * Mutex to ensure exclusive access to the inner keyring during\n * operations that mutate its state.\n */\n readonly #lock = new Mutex();\n\n /**\n * Registry for KeyringAccount objects.\n * Provides O(1) lookups by AccountId or address.\n *\n * Subclasses should use this registry when creating accounts and\n * clear/update it when deleting accounts or deserializing state.\n */\n protected readonly registry =\n new KeyringAccountRegistry<KeyringAccountType>();\n\n constructor(options: KeyringWrapperOptions<InnerKeyring>) {\n this.inner = options.inner;\n this.type = `${options.type}`;\n this.capabilities = options.capabilities;\n }\n\n /**\n * Execute an operation with exclusive access to the inner keyring.\n *\n * This method ensures thread-safety for operations that read or mutate\n * the inner keyring state. All operations that modify the keyring\n * (createAccounts, deleteAccount, deserialize) should use this method\n * to prevent race conditions.\n *\n * Within the callback, use `this.inner` to access the inner keyring.\n *\n * @param callback - A function that performs the operation.\n * @returns The result of the callback.\n */\n protected async withLock<Result>(\n callback: () => Promise<Result>,\n ): Promise<Result> {\n return this.#lock.runExclusive(callback);\n }\n\n /**\n * Serialize the underlying keyring state to a JSON-serializable object.\n *\n * This simply delegates to the legacy keyring's {@link Keyring.serialize}\n * implementation.\n *\n * @returns The serialized keyring state.\n */\n async serialize(): Promise<Json> {\n return this.inner.serialize();\n }\n\n /**\n * Hydrate the underlying keyring from a previously serialized state.\n *\n * This clears the registry, delegates to the legacy keyring's\n * {@link Keyring.deserialize} implementation, and rebuilds the registry\n * by calling {@link getAccounts}.\n *\n * @param state - The serialized keyring state.\n */\n async deserialize(state: Json): Promise<void> {\n await this.withLock(async () => {\n // Clear the registry when deserializing\n this.registry.clear();\n\n // Deserialize the legacy keyring\n await this.inner.deserialize(state);\n\n // Rebuild the registry by calling getAccounts().\n // Subclass implementations of getAccounts() should populate the registry\n // as a side effect (see the abstract method's documentation).\n await this.getAccounts();\n });\n }\n\n /**\n * Return all accounts managed by this keyring.\n *\n * Concrete adapters are responsible for mapping the underlying keyring's\n * notion of accounts (typically addresses returned by\n * {@link Keyring.getAccounts}) into {@link KeyringAccount} objects.\n * Implementations should use the configured {@link KeyringAccountRegistry}\n * to establish the account ID/address mapping so that\n * {@link getAccount} works as expected.\n *\n * @returns The list of managed accounts.\n */\n abstract getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Look up a single account by its {@link AccountId}.\n *\n * This method first checks the registry for O(1) lookup.\n * If not found, it falls back to calling {@link getAccounts} which\n * should populate the registry as a side effect.\n *\n * @param accountId - The AccountId to look up.\n * @returns The matching KeyringAccount.\n */\n async getAccount(accountId: AccountId): Promise<KeyringAccount> {\n let cached = this.registry.get(accountId);\n if (cached) {\n return cached;\n }\n\n // Prime the registry by calling getAccounts\n await this.getAccounts();\n\n // Try registry again after priming\n cached = this.registry.get(accountId);\n if (!cached) {\n throw new Error(`Account not found for id: ${accountId}`);\n }\n\n return cached;\n }\n\n /**\n * Create one or more new accounts managed by this keyring.\n *\n * Implementations are responsible for interpreting the\n * {@link CreateAccountOptions} (for example BIP-44 derivation or\n * private-key import) and returning the resulting {@link KeyringAccount}\n * objects. Implementors should also ensure that the registry is updated so\n * that {@link getAccount} works for newly created accounts.\n */\n abstract createAccounts(\n options: CreateAccountOptions,\n ): Promise<KeyringAccount[]>;\n\n /**\n * Remove the account associated with the given {@link AccountId} from this\n * keyring.\n *\n * Implementations are expected to translate the ID to an underlying\n * address (typically via the registry) and then invoke the appropriate\n * removal mechanism on the legacy keyring.\n */\n abstract deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Export the secrets associated with the given account in a format\n * described by {@link ExportAccountOptions}.\n *\n * This method is optional, and concrete adapters should only\n * implement it if the underlying keyring supports exporting\n * accounts.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Handle a high-level {@link KeyringRequest} on behalf of this keyring.\n *\n * Concrete adapters are responsible for routing the request's method and\n * parameters to the appropriate legacy keyring APIs (for example signing\n * transactions or decrypting messages) and returning a JSON-serializable\n * result.\n */\n abstract submitRequest(request: KeyringRequest): Promise<Json>;\n}\n"]}
1
+ {"version":3,"file":"keyring-wrapper.mjs","sourceRoot":"","sources":["../../../../src/api/v2/wrapper/keyring-wrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,oBAAoB;AAEpC,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AAgCpE;;;;;;;;;GASG;AACH,MAAM,OAAgB,cAAc;IA2BlC,YAAY,OAA4C;QApB/C,+CAAmC;QAI5C;;;WAGG;QACM,+BAAQ,IAAI,KAAK,EAAE,EAAC;QAE7B;;;;;;WAMG;QACgB,aAAQ,GACzB,IAAI,sBAAsB,EAAsB,CAAC;QAGjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC9B,uBAAA,IAAI,gCAAiB,OAAO,CAAC,YAAY,MAAA,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,YAAY;QACd,OAAO,uBAAA,IAAI,oCAAc,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,KAAK,CAAC,QAAQ,CACtB,QAA+B;QAE/B,OAAO,uBAAA,IAAI,4BAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,WAAW,CAAC,KAAW;QAC3B,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;YAC7B,wCAAwC;YACxC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YAEtB,iCAAiC;YACjC,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAEpC,iDAAiD;YACjD,yEAAyE;YACzE,8DAA8D;YAC9D,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAgBD;;;;;;;;;OASG;IACH,KAAK,CAAC,UAAU,CAAC,SAAoB;QACnC,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,4CAA4C;QAC5C,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAEzB,mCAAmC;QACnC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CA+CF","sourcesContent":["import type { Keyring, AccountId } from '@metamask/keyring-utils';\nimport type { Json } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\n\nimport { KeyringAccountRegistry } from './keyring-account-registry';\nimport type {\n CreateAccountOptions,\n ExportAccountOptions,\n ExportedAccount,\n} from '..';\nimport type { KeyringAccount } from '../../account';\nimport type { KeyringRequest } from '../../request';\nimport type { KeyringV2 } from '../keyring';\nimport type { KeyringCapabilities } from '../keyring-capabilities';\nimport type { KeyringType } from '../keyring-type';\n\n/**\n * Basic options for constructing a {@link KeyringWrapper}.\n */\nexport type KeyringWrapperOptions<InnerKeyring extends Keyring> = {\n /**\n * The underlying \"old\" keyring instance that this wrapper adapts.\n */\n inner: InnerKeyring;\n\n /**\n * The concrete keyring type exposed through the V2 interface.\n */\n type: KeyringType;\n\n /**\n * Capabilities of the underlying keyring.\n */\n capabilities: KeyringCapabilities;\n};\n\n/**\n * Generic adapter that turns an existing {@link Keyring} implementation into a\n * {@link KeyringV2} instance.\n *\n * Consumers are expected to provide concrete mappings between high-level V2\n * operations and the underlying keyring methods (for example BIP-44 account\n * creation, private-key import, and request handling). This class focuses on\n * the common mechanics required by all adapters: state serialization,\n * account-ID/address mapping and basic account management.\n */\nexport abstract class KeyringWrapper<\n InnerKeyring extends Keyring,\n KeyringAccountType extends KeyringAccount = KeyringAccount,\n> implements KeyringV2\n{\n readonly type: `${KeyringType}`;\n\n readonly #capabilities: KeyringCapabilities;\n\n protected readonly inner: InnerKeyring;\n\n /**\n * Mutex to ensure exclusive access to the inner keyring during\n * operations that mutate its state.\n */\n readonly #lock = new Mutex();\n\n /**\n * Registry for KeyringAccount objects.\n * Provides O(1) lookups by AccountId or address.\n *\n * Subclasses should use this registry when creating accounts and\n * clear/update it when deleting accounts or deserializing state.\n */\n protected readonly registry =\n new KeyringAccountRegistry<KeyringAccountType>();\n\n constructor(options: KeyringWrapperOptions<InnerKeyring>) {\n this.inner = options.inner;\n this.type = `${options.type}`;\n this.#capabilities = options.capabilities;\n }\n\n /**\n * Get the capabilities of this keyring.\n *\n * Subclasses can override this getter to return capabilities dynamically\n * based on runtime state.\n *\n * @returns The keyring's capabilities.\n */\n get capabilities(): KeyringCapabilities {\n return this.#capabilities;\n }\n\n /**\n * Execute an operation with exclusive access to the inner keyring.\n *\n * This method ensures thread-safety for operations that read or mutate\n * the inner keyring state. All operations that modify the keyring\n * (createAccounts, deleteAccount, deserialize) should use this method\n * to prevent race conditions.\n *\n * Within the callback, use `this.inner` to access the inner keyring.\n *\n * @param callback - A function that performs the operation.\n * @returns The result of the callback.\n */\n protected async withLock<Result>(\n callback: () => Promise<Result>,\n ): Promise<Result> {\n return this.#lock.runExclusive(callback);\n }\n\n /**\n * Serialize the underlying keyring state to a JSON-serializable object.\n *\n * This simply delegates to the legacy keyring's {@link Keyring.serialize}\n * implementation.\n *\n * @returns The serialized keyring state.\n */\n async serialize(): Promise<Json> {\n return this.inner.serialize();\n }\n\n /**\n * Hydrate the underlying keyring from a previously serialized state.\n *\n * This clears the registry, delegates to the legacy keyring's\n * {@link Keyring.deserialize} implementation, and rebuilds the registry\n * by calling {@link getAccounts}.\n *\n * @param state - The serialized keyring state.\n */\n async deserialize(state: Json): Promise<void> {\n await this.withLock(async () => {\n // Clear the registry when deserializing\n this.registry.clear();\n\n // Deserialize the legacy keyring\n await this.inner.deserialize(state);\n\n // Rebuild the registry by calling getAccounts().\n // Subclass implementations of getAccounts() should populate the registry\n // as a side effect (see the abstract method's documentation).\n await this.getAccounts();\n });\n }\n\n /**\n * Return all accounts managed by this keyring.\n *\n * Concrete adapters are responsible for mapping the underlying keyring's\n * notion of accounts (typically addresses returned by\n * {@link Keyring.getAccounts}) into {@link KeyringAccount} objects.\n * Implementations should use the configured {@link KeyringAccountRegistry}\n * to establish the account ID/address mapping so that\n * {@link getAccount} works as expected.\n *\n * @returns The list of managed accounts.\n */\n abstract getAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Look up a single account by its {@link AccountId}.\n *\n * This method first checks the registry for O(1) lookup.\n * If not found, it falls back to calling {@link getAccounts} which\n * should populate the registry as a side effect.\n *\n * @param accountId - The AccountId to look up.\n * @returns The matching KeyringAccount.\n */\n async getAccount(accountId: AccountId): Promise<KeyringAccount> {\n let cached = this.registry.get(accountId);\n if (cached) {\n return cached;\n }\n\n // Prime the registry by calling getAccounts\n await this.getAccounts();\n\n // Try registry again after priming\n cached = this.registry.get(accountId);\n if (!cached) {\n throw new Error(`Account not found for id: ${accountId}`);\n }\n\n return cached;\n }\n\n /**\n * Create one or more new accounts managed by this keyring.\n *\n * Implementations are responsible for interpreting the\n * {@link CreateAccountOptions} (for example BIP-44 derivation or\n * private-key import) and returning the resulting {@link KeyringAccount}\n * objects. Implementors should also ensure that the registry is updated so\n * that {@link getAccount} works for newly created accounts.\n */\n abstract createAccounts(\n options: CreateAccountOptions,\n ): Promise<KeyringAccount[]>;\n\n /**\n * Remove the account associated with the given {@link AccountId} from this\n * keyring.\n *\n * Implementations are expected to translate the ID to an underlying\n * address (typically via the registry) and then invoke the appropriate\n * removal mechanism on the legacy keyring.\n */\n abstract deleteAccount(accountId: AccountId): Promise<void>;\n\n /**\n * Export the secrets associated with the given account in a format\n * described by {@link ExportAccountOptions}.\n *\n * This method is optional, and concrete adapters should only\n * implement it if the underlying keyring supports exporting\n * accounts.\n */\n exportAccount?(\n accountId: AccountId,\n options?: ExportAccountOptions,\n ): Promise<ExportedAccount>;\n\n /**\n * Handle a high-level {@link KeyringRequest} on behalf of this keyring.\n *\n * Concrete adapters are responsible for routing the request's method and\n * parameters to the appropriate legacy keyring APIs (for example signing\n * transactions or decrypting messages) and returning a JSON-serializable\n * result.\n */\n abstract submitRequest(request: KeyringRequest): Promise<Json>;\n}\n"]}
@@ -6,7 +6,7 @@ import { type Infer } from "@metamask/superstruct";
6
6
  */
7
7
  export declare const EthUserOperationStruct: import("@metamask/superstruct").Struct<{
8
8
  nonce: string;
9
- sender: `0x${string}`;
9
+ sender: string;
10
10
  initCode: string;
11
11
  callData: string;
12
12
  callGasLimit: string;
@@ -17,7 +17,7 @@ export declare const EthUserOperationStruct: import("@metamask/superstruct").Str
17
17
  paymasterAndData: string;
18
18
  signature: string;
19
19
  }, {
20
- sender: import("@metamask/superstruct").Struct<`0x${string}`, null>;
20
+ sender: import("@metamask/superstruct").Struct<string, null>;
21
21
  nonce: import("@metamask/superstruct").Struct<string, null>;
22
22
  initCode: import("@metamask/superstruct").Struct<string, null>;
23
23
  callData: import("@metamask/superstruct").Struct<string, null>;
@@ -37,12 +37,12 @@ export type EthUserOperation = Infer<typeof EthUserOperationStruct>;
37
37
  export declare const EthBaseTransactionStruct: import("@metamask/superstruct").Struct<{
38
38
  value: string;
39
39
  data: string;
40
- to: `0x${string}`;
40
+ to: string;
41
41
  }, {
42
42
  /**
43
43
  * Address of the transaction recipient.
44
44
  */
45
- to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
45
+ to: import("@metamask/superstruct").Struct<string, null>;
46
46
  /**
47
47
  * Amount of wei to transfer to the recipient.
48
48
  */
@@ -6,7 +6,7 @@ import { type Infer } from "@metamask/superstruct";
6
6
  */
7
7
  export declare const EthUserOperationStruct: import("@metamask/superstruct").Struct<{
8
8
  nonce: string;
9
- sender: `0x${string}`;
9
+ sender: string;
10
10
  initCode: string;
11
11
  callData: string;
12
12
  callGasLimit: string;
@@ -17,7 +17,7 @@ export declare const EthUserOperationStruct: import("@metamask/superstruct").Str
17
17
  paymasterAndData: string;
18
18
  signature: string;
19
19
  }, {
20
- sender: import("@metamask/superstruct").Struct<`0x${string}`, null>;
20
+ sender: import("@metamask/superstruct").Struct<string, null>;
21
21
  nonce: import("@metamask/superstruct").Struct<string, null>;
22
22
  initCode: import("@metamask/superstruct").Struct<string, null>;
23
23
  callData: import("@metamask/superstruct").Struct<string, null>;
@@ -37,12 +37,12 @@ export type EthUserOperation = Infer<typeof EthUserOperationStruct>;
37
37
  export declare const EthBaseTransactionStruct: import("@metamask/superstruct").Struct<{
38
38
  value: string;
39
39
  data: string;
40
- to: `0x${string}`;
40
+ to: string;
41
41
  }, {
42
42
  /**
43
43
  * Address of the transaction recipient.
44
44
  */
45
- to: import("@metamask/superstruct").Struct<`0x${string}`, null>;
45
+ to: import("@metamask/superstruct").Struct<string, null>;
46
46
  /**
47
47
  * Amount of wei to transfer to the recipient.
48
48
  */
@@ -78,7 +78,7 @@ exports.EthEncryptedDataStruct = (0, keyring_utils_1.object)({
78
78
  */
79
79
  exports.EthEip7702AuthorizationStruct = (0, superstruct_1.tuple)([
80
80
  (0, superstruct_1.number)(), // chainId
81
- types_1.EthAddressStruct, // address (contract to delegate to)
81
+ types_1.EthAddressStrictStruct, // address (contract to delegate to)
82
82
  (0, superstruct_1.number)(), // nonce
83
83
  ]);
84
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"params.cjs","sourceRoot":"","sources":["../../../src/eth/rpc/params.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,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EG;AACU,QAAA,sBAAsB,GAAG,IAAA,mBAAK,EAAC,CAAC,8BAAsB,CAAC,CAAC,CAAC;AAItE;;GAEG;AACU,QAAA,+BAA+B,GAAG,IAAA,mBAAK,EAAC;IACnD,IAAA,oBAAM,GAAE,EAAE,aAAa;CACxB,CAAC,CAAC;AAMH;;;;;;;GAOG;AACU,QAAA,uCAAuC,GAAG,IAAA,mBAAK,EAAC;IAC3D,qCAA6B;CAC9B,CAAC,CAAC;AAMH;;GAEG;AACU,QAAA,qCAAqC,GAAG,IAAA,mBAAK,EAAC;IACzD,wBAAgB,EAAE,UAAU;IAC5B,IAAA,sBAAQ,EAAC,8CAAsC,CAAC,EAAE,UAAU;CAC7D,CAAC,CAAC","sourcesContent":["/**\n * Superstruct validation schemas for Ethereum JSON-RPC method parameters.\n *\n * These structs provide runtime validation for the parameters passed to various\n * Ethereum RPC methods. They can be used by keyring implementations to validate\n * incoming requests before processing.\n */\n\nimport { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n any,\n array,\n literal,\n nullable,\n number,\n optional,\n record,\n string,\n tuple,\n type,\n union,\n unknown,\n} from '@metamask/superstruct';\n\nimport { EthAddressStruct, EthBytesStruct } from '../types';\n\n/**\n * A struct for validating Ethereum transaction data.\n *\n * This uses `type()` instead of `object()` to allow extra properties,\n * since transaction formats can vary and include additional fields.\n * The actual transaction validation is performed by the transaction library.\n */\nexport const EthTransactionDataStruct = type({\n to: optional(nullable(EthAddressStruct)),\n from: optional(EthAddressStruct),\n nonce: optional(union([string(), number()])),\n value: optional(union([string(), number()])),\n data: optional(EthBytesStruct),\n gas: optional(union([string(), number()])),\n gasLimit: optional(union([string(), number()])),\n gasPrice: optional(union([string(), number()])),\n maxFeePerGas: optional(union([string(), number()])),\n maxPriorityFeePerGas: optional(union([string(), number()])),\n accessList: optional(\n array(\n type({\n address: EthAddressStruct,\n storageKeys: array(string()),\n }),\n ),\n ),\n type: optional(union([string(), number()])),\n chainId: optional(union([string(), number()])),\n});\n\nexport type EthTransactionData = Infer<typeof EthTransactionDataStruct>;\n\n/**\n * A struct for TypedDataV1 format (legacy typed data).\n * This is an array of { type, name, value } objects.\n */\nexport const EthTypedDataV1Struct = array(\n object({\n type: string(),\n name: string(),\n value: unknown(),\n }),\n);\n\nexport type EthTypedDataV1 = Infer<typeof EthTypedDataV1Struct>;\n\n/**\n * A struct for TypedData types definition.\n * Maps type names to arrays of { name, type } definitions.\n */\nexport const EthTypedDataTypesStruct = record(\n string(),\n array(\n object({\n name: string(),\n type: string(),\n }),\n ),\n);\n\nexport type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;\n\n/**\n * A struct for TypedMessage format (EIP-712 V3/V4).\n * Contains types, domain, primaryType, and message.\n */\nexport const EthTypedMessageStruct = object({\n types: EthTypedDataTypesStruct,\n primaryType: string(),\n domain: record(string(), any()),\n message: record(string(), any()),\n});\n\nexport type EthTypedMessage = Infer<typeof EthTypedMessageStruct>;\n\n/**\n * A struct for EIP-1024 encrypted data format (x25519-xsalsa20-poly1305).\n */\nexport const EthEncryptedDataStruct = object({\n version: literal('x25519-xsalsa20-poly1305'),\n nonce: string(),\n ephemPublicKey: string(),\n ciphertext: string(),\n});\n\nexport type EthEncryptedData = Infer<typeof EthEncryptedDataStruct>;\n\n/**\n * A struct for EIP-7702 authorization tuple.\n * Format: [chainId, address, nonce]\n */\nexport const EthEip7702AuthorizationStruct = tuple([\n number(), // chainId\n EthAddressStruct, // address (contract to delegate to)\n number(), // nonce\n]);\n\nexport type EthEip7702Authorization = Infer<\n typeof EthEip7702AuthorizationStruct\n>;\n\n/**\n * A struct for getEncryptionPublicKey options.\n */\nexport const EthGetEncryptionPublicKeyOptionsStruct = record(\n string(),\n unknown(),\n);\n\n// ============================================================================\n// RPC Method Parameter Structs\n// ============================================================================\n\n/**\n * Parameters for `eth_signTransaction`.\n */\nexport const EthSignTransactionParamsStruct = tuple([EthTransactionDataStruct]);\n\nexport type EthSignTransactionParams = Infer<\n typeof EthSignTransactionParamsStruct\n>;\n\n/**\n * Parameters for `eth_sign`.\n */\nexport const EthSignParamsStruct = tuple([\n EthAddressStruct, // address\n EthBytesStruct, // data (hex-encoded message hash)\n]);\n\nexport type EthSignParams = Infer<typeof EthSignParamsStruct>;\n\n/**\n * Parameters for `personal_sign`.\n */\nexport const EthPersonalSignParamsStruct = union([\n tuple([EthBytesStruct]), // [data]\n tuple([EthBytesStruct, EthAddressStruct]), // [data, address]\n]);\n\nexport type EthPersonalSignParams = Infer<typeof EthPersonalSignParamsStruct>;\n\n/**\n * Parameters for `eth_signTypedData_v1`.\n */\nexport const EthSignTypedDataV1ParamsStruct = tuple([\n EthAddressStruct, // address\n EthTypedDataV1Struct, // typed data array\n]);\n\nexport type EthSignTypedDataV1Params = Infer<\n typeof EthSignTypedDataV1ParamsStruct\n>;\n\n/**\n * Parameters for `eth_signTypedData_v3` and `eth_signTypedData_v4`.\n */\nexport const EthSignTypedDataParamsStruct = tuple([\n EthAddressStruct, // address\n EthTypedMessageStruct, // typed data object\n]);\n\nexport type EthSignTypedDataParams = Infer<typeof EthSignTypedDataParamsStruct>;\n\n/**\n * Parameters for `eth_decrypt`.\n */\nexport const EthDecryptParamsStruct = tuple([EthEncryptedDataStruct]);\n\nexport type EthDecryptParams = Infer<typeof EthDecryptParamsStruct>;\n\n/**\n * Parameters for `eth_getAppKeyAddress`.\n */\nexport const EthGetAppKeyAddressParamsStruct = tuple([\n string(), // origin URL\n]);\n\nexport type EthGetAppKeyAddressParams = Infer<\n typeof EthGetAppKeyAddressParamsStruct\n>;\n\n/**\n * Parameters for `eth_signEip7702Authorization`.\n *\n * @example\n * ```ts\n * const params = [[1, '0xContractAddress', 0]];\n * ```\n */\nexport const EthSignEip7702AuthorizationParamsStruct = tuple([\n EthEip7702AuthorizationStruct,\n]);\n\nexport type EthSignEip7702AuthorizationParams = Infer<\n typeof EthSignEip7702AuthorizationParamsStruct\n>;\n\n/**\n * Parameters for `eth_getEncryptionPublicKey`.\n */\nexport const EthGetEncryptionPublicKeyParamsStruct = tuple([\n EthAddressStruct, // address\n optional(EthGetEncryptionPublicKeyOptionsStruct), // options\n]);\n"]}
1
+ {"version":3,"file":"params.cjs","sourceRoot":"","sources":["../../../src/eth/rpc/params.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2DAAiD;AAEjD,uDAa+B;AAE/B,wCAIkB;AAElB;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAG,IAAA,kBAAI,EAAC;IAC3C,EAAE,EAAE,IAAA,sBAAQ,EAAC,IAAA,sBAAQ,EAAC,wBAAgB,CAAC,CAAC;IACxC,IAAI,EAAE,IAAA,sBAAQ,EAAC,wBAAgB,CAAC;IAChC,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;IAC5C,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;IAC5C,IAAI,EAAE,IAAA,sBAAQ,EAAC,sBAAc,CAAC;IAC9B,GAAG,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;IAC1C,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;IAC/C,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC;IAC/C,YAAY,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBA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EAAE,UAAU;IAC5B,4BAAoB,EAAE,mBAAmB;CAC1C,CAAC,CAAC;AAMH;;GAEG;AACU,QAAA,4BAA4B,GAAG,IAAA,mBAAK,EAAC;IAChD,wBAAgB,EAAE,UAAU;IAC5B,6BAAqB,EAAE,oBAAoB;CAC5C,CAAC,CAAC;AAIH;;GAEG;AACU,QAAA,sBAAsB,GAAG,IAAA,mBAAK,EAAC,CAAC,8BAAsB,CAAC,CAAC,CAAC;AAItE;;GAEG;AACU,QAAA,+BAA+B,GAAG,IAAA,mBAAK,EAAC;IACnD,IAAA,oBAAM,GAAE,EAAE,aAAa;CACxB,CAAC,CAAC;AAMH;;;;;;;GAOG;AACU,QAAA,uCAAuC,GAAG,IAAA,mBAAK,EAAC;IAC3D,qCAA6B;CAC9B,CAAC,CAAC;AAMH;;GAEG;AACU,QAAA,qCAAqC,GAAG,IAAA,mBAAK,EAAC;IACzD,wBAAgB,EAAE,UAAU;IAC5B,IAAA,sBAAQ,EAAC,8CAAsC,CAAC,EAAE,UAAU;CAC7D,CAAC,CAAC","sourcesContent":["/**\n * Superstruct validation schemas for Ethereum JSON-RPC method parameters.\n *\n * These structs provide runtime validation for the parameters passed to various\n * Ethereum RPC methods. They can be used by keyring implementations to validate\n * incoming requests before processing.\n */\n\nimport { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n any,\n array,\n literal,\n nullable,\n number,\n optional,\n record,\n string,\n tuple,\n type,\n union,\n unknown,\n} from '@metamask/superstruct';\n\nimport {\n EthAddressStrictStruct,\n EthAddressStruct,\n EthBytesStruct,\n} from '../types';\n\n/**\n * A struct for validating Ethereum transaction data.\n *\n * This uses `type()` instead of `object()` to allow extra properties,\n * since transaction formats can vary and include additional fields.\n * The actual transaction validation is performed by the transaction library.\n */\nexport const EthTransactionDataStruct = type({\n to: optional(nullable(EthAddressStruct)),\n from: optional(EthAddressStruct),\n nonce: optional(union([string(), number()])),\n value: optional(union([string(), number()])),\n data: optional(EthBytesStruct),\n gas: optional(union([string(), number()])),\n gasLimit: optional(union([string(), number()])),\n gasPrice: optional(union([string(), number()])),\n maxFeePerGas: optional(union([string(), number()])),\n maxPriorityFeePerGas: optional(union([string(), number()])),\n accessList: optional(\n array(\n type({\n address: EthAddressStruct,\n storageKeys: array(string()),\n }),\n ),\n ),\n type: optional(union([string(), number()])),\n chainId: optional(union([string(), number()])),\n});\n\nexport type EthTransactionData = Infer<typeof EthTransactionDataStruct>;\n\n/**\n * A struct for TypedDataV1 format (legacy typed data).\n * This is an array of { type, name, value } objects.\n */\nexport const EthTypedDataV1Struct = array(\n object({\n type: string(),\n name: string(),\n value: unknown(),\n }),\n);\n\nexport type EthTypedDataV1 = Infer<typeof EthTypedDataV1Struct>;\n\n/**\n * A struct for TypedData types definition.\n * Maps type names to arrays of { name, type } definitions.\n */\nexport const EthTypedDataTypesStruct = record(\n string(),\n array(\n object({\n name: string(),\n type: string(),\n }),\n ),\n);\n\nexport type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;\n\n/**\n * A struct for TypedMessage format (EIP-712 V3/V4).\n * Contains types, domain, primaryType, and message.\n */\nexport const EthTypedMessageStruct = object({\n types: EthTypedDataTypesStruct,\n primaryType: string(),\n domain: record(string(), any()),\n message: record(string(), any()),\n});\n\nexport type EthTypedMessage = Infer<typeof EthTypedMessageStruct>;\n\n/**\n * A struct for EIP-1024 encrypted data format (x25519-xsalsa20-poly1305).\n */\nexport const EthEncryptedDataStruct = object({\n version: literal('x25519-xsalsa20-poly1305'),\n nonce: string(),\n ephemPublicKey: string(),\n ciphertext: string(),\n});\n\nexport type EthEncryptedData = Infer<typeof EthEncryptedDataStruct>;\n\n/**\n * A struct for EIP-7702 authorization tuple.\n * Format: [chainId, address, nonce]\n */\nexport const EthEip7702AuthorizationStruct = tuple([\n number(), // chainId\n EthAddressStrictStruct, // address (contract to delegate to)\n number(), // nonce\n]);\n\nexport type EthEip7702Authorization = Infer<\n typeof EthEip7702AuthorizationStruct\n>;\n\n/**\n * A struct for getEncryptionPublicKey options.\n */\nexport const EthGetEncryptionPublicKeyOptionsStruct = record(\n string(),\n unknown(),\n);\n\n// ============================================================================\n// RPC Method Parameter Structs\n// ============================================================================\n\n/**\n * Parameters for `eth_signTransaction`.\n */\nexport const EthSignTransactionParamsStruct = tuple([EthTransactionDataStruct]);\n\nexport type EthSignTransactionParams = Infer<\n typeof EthSignTransactionParamsStruct\n>;\n\n/**\n * Parameters for `eth_sign`.\n */\nexport const EthSignParamsStruct = tuple([\n EthAddressStruct, // address\n EthBytesStruct, // data (hex-encoded message hash)\n]);\n\nexport type EthSignParams = Infer<typeof EthSignParamsStruct>;\n\n/**\n * Parameters for `personal_sign`.\n */\nexport const EthPersonalSignParamsStruct = union([\n tuple([EthBytesStruct]), // [data]\n tuple([EthBytesStruct, EthAddressStruct]), // [data, address]\n]);\n\nexport type EthPersonalSignParams = Infer<typeof EthPersonalSignParamsStruct>;\n\n/**\n * Parameters for `eth_signTypedData_v1`.\n */\nexport const EthSignTypedDataV1ParamsStruct = tuple([\n EthAddressStruct, // address\n EthTypedDataV1Struct, // typed data array\n]);\n\nexport type EthSignTypedDataV1Params = Infer<\n typeof EthSignTypedDataV1ParamsStruct\n>;\n\n/**\n * Parameters for `eth_signTypedData_v3` and `eth_signTypedData_v4`.\n */\nexport const EthSignTypedDataParamsStruct = tuple([\n EthAddressStruct, // address\n EthTypedMessageStruct, // typed data object\n]);\n\nexport type EthSignTypedDataParams = Infer<typeof EthSignTypedDataParamsStruct>;\n\n/**\n * Parameters for `eth_decrypt`.\n */\nexport const EthDecryptParamsStruct = tuple([EthEncryptedDataStruct]);\n\nexport type EthDecryptParams = Infer<typeof EthDecryptParamsStruct>;\n\n/**\n * Parameters for `eth_getAppKeyAddress`.\n */\nexport const EthGetAppKeyAddressParamsStruct = tuple([\n string(), // origin URL\n]);\n\nexport type EthGetAppKeyAddressParams = Infer<\n typeof EthGetAppKeyAddressParamsStruct\n>;\n\n/**\n * Parameters for `eth_signEip7702Authorization`.\n *\n * @example\n * ```ts\n * const params = [[1, '0xContractAddress', 0]];\n * ```\n */\nexport const EthSignEip7702AuthorizationParamsStruct = tuple([\n EthEip7702AuthorizationStruct,\n]);\n\nexport type EthSignEip7702AuthorizationParams = Infer<\n typeof EthSignEip7702AuthorizationParamsStruct\n>;\n\n/**\n * Parameters for `eth_getEncryptionPublicKey`.\n */\nexport const EthGetEncryptionPublicKeyParamsStruct = tuple([\n EthAddressStruct, // address\n optional(EthGetEncryptionPublicKeyOptionsStruct), // options\n]);\n"]}
@@ -17,22 +17,22 @@ export declare const EthTransactionDataStruct: import("@metamask/superstruct").S
17
17
  value?: string | number | undefined;
18
18
  type?: string | number | undefined;
19
19
  data?: string | undefined;
20
- from?: `0x${string}` | undefined;
20
+ from?: string | undefined;
21
21
  chainId?: string | number | undefined;
22
22
  accessList?: {
23
- address: `0x${string}`;
23
+ address: string;
24
24
  storageKeys: string[];
25
25
  }[] | undefined;
26
26
  nonce?: string | number | undefined;
27
- to?: `0x${string}` | null | undefined;
27
+ to?: string | null | undefined;
28
28
  maxFeePerGas?: string | number | undefined;
29
29
  maxPriorityFeePerGas?: string | number | undefined;
30
30
  gas?: string | number | undefined;
31
31
  gasLimit?: string | number | undefined;
32
32
  gasPrice?: string | number | undefined;
33
33
  }, {
34
- to: import("@metamask/superstruct").Struct<`0x${string}` | null | undefined, null>;
35
- from: import("@metamask/superstruct").Struct<`0x${string}` | undefined, null>;
34
+ to: import("@metamask/superstruct").Struct<string | null | undefined, null>;
35
+ from: import("@metamask/superstruct").Struct<string | undefined, null>;
36
36
  nonce: import("@metamask/superstruct").Struct<string | number | undefined, null>;
37
37
  value: import("@metamask/superstruct").Struct<string | number | undefined, null>;
38
38
  data: import("@metamask/superstruct").Struct<string | undefined, null>;
@@ -42,13 +42,13 @@ export declare const EthTransactionDataStruct: import("@metamask/superstruct").S
42
42
  maxFeePerGas: import("@metamask/superstruct").Struct<string | number | undefined, null>;
43
43
  maxPriorityFeePerGas: import("@metamask/superstruct").Struct<string | number | undefined, null>;
44
44
  accessList: import("@metamask/superstruct").Struct<{
45
- address: `0x${string}`;
45
+ address: string;
46
46
  storageKeys: string[];
47
47
  }[] | undefined, import("@metamask/superstruct").Struct<{
48
- address: `0x${string}`;
48
+ address: string;
49
49
  storageKeys: string[];
50
50
  }, {
51
- address: import("@metamask/superstruct").Struct<`0x${string}`, null>;
51
+ address: import("@metamask/superstruct").Struct<string, null>;
52
52
  storageKeys: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
53
53
  }>>;
54
54
  type: import("@metamask/superstruct").Struct<string | number | undefined, null>;
@@ -136,14 +136,14 @@ export declare const EthSignTransactionParamsStruct: import("@metamask/superstru
136
136
  value?: string | number | undefined;
137
137
  type?: string | number | undefined;
138
138
  data?: string | undefined;
139
- from?: `0x${string}` | undefined;
139
+ from?: string | undefined;
140
140
  chainId?: string | number | undefined;
141
141
  accessList?: {
142
- address: `0x${string}`;
142
+ address: string;
143
143
  storageKeys: string[];
144
144
  }[] | undefined;
145
145
  nonce?: string | number | undefined;
146
- to?: `0x${string}` | null | undefined;
146
+ to?: string | null | undefined;
147
147
  maxFeePerGas?: string | number | undefined;
148
148
  maxPriorityFeePerGas?: string | number | undefined;
149
149
  gas?: string | number | undefined;
@@ -154,17 +154,17 @@ export type EthSignTransactionParams = Infer<typeof EthSignTransactionParamsStru
154
154
  /**
155
155
  * Parameters for `eth_sign`.
156
156
  */
157
- export declare const EthSignParamsStruct: import("@metamask/superstruct").Struct<[`0x${string}`, string], null>;
157
+ export declare const EthSignParamsStruct: import("@metamask/superstruct").Struct<[string, string], null>;
158
158
  export type EthSignParams = Infer<typeof EthSignParamsStruct>;
159
159
  /**
160
160
  * Parameters for `personal_sign`.
161
161
  */
162
- export declare const EthPersonalSignParamsStruct: import("@metamask/superstruct").Struct<[string] | [string, `0x${string}`], null>;
162
+ export declare const EthPersonalSignParamsStruct: import("@metamask/superstruct").Struct<[string, string] | [string], null>;
163
163
  export type EthPersonalSignParams = Infer<typeof EthPersonalSignParamsStruct>;
164
164
  /**
165
165
  * Parameters for `eth_signTypedData_v1`.
166
166
  */
167
- export declare const EthSignTypedDataV1ParamsStruct: import("@metamask/superstruct").Struct<[`0x${string}`, {
167
+ export declare const EthSignTypedDataV1ParamsStruct: import("@metamask/superstruct").Struct<[string, {
168
168
  name: string;
169
169
  value: unknown;
170
170
  type: string;
@@ -173,7 +173,7 @@ export type EthSignTypedDataV1Params = Infer<typeof EthSignTypedDataV1ParamsStru
173
173
  /**
174
174
  * Parameters for `eth_signTypedData_v3` and `eth_signTypedData_v4`.
175
175
  */
176
- export declare const EthSignTypedDataParamsStruct: import("@metamask/superstruct").Struct<[`0x${string}`, {
176
+ export declare const EthSignTypedDataParamsStruct: import("@metamask/superstruct").Struct<[string, {
177
177
  message: Record<string, any>;
178
178
  domain: Record<string, any>;
179
179
  types: Record<string, {
@@ -211,5 +211,5 @@ export type EthSignEip7702AuthorizationParams = Infer<typeof EthSignEip7702Autho
211
211
  /**
212
212
  * Parameters for `eth_getEncryptionPublicKey`.
213
213
  */
214
- export declare const EthGetEncryptionPublicKeyParamsStruct: import("@metamask/superstruct").Struct<[`0x${string}`, Record<string, unknown> | undefined], null>;
214
+ export declare const EthGetEncryptionPublicKeyParamsStruct: import("@metamask/superstruct").Struct<[string, Record<string, unknown> | undefined], null>;
215
215
  //# sourceMappingURL=params.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"params.d.cts","sourceRoot":"","sources":["../../../src/eth/rpc/params.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAkBnD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,M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