@metamask/wallet 7.0.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/Wallet.cjs +2 -2
  3. package/dist/Wallet.cjs.map +1 -1
  4. package/dist/Wallet.d.cts.map +1 -1
  5. package/dist/Wallet.d.mts.map +1 -1
  6. package/dist/Wallet.mjs.map +1 -1
  7. package/dist/index.cjs +6 -6
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts.map +1 -1
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/initialization/defaults.cjs.map +1 -1
  13. package/dist/initialization/defaults.d.cts.map +1 -1
  14. package/dist/initialization/defaults.d.mts.map +1 -1
  15. package/dist/initialization/defaults.mjs.map +1 -1
  16. package/dist/initialization/initialization.cjs +2 -2
  17. package/dist/initialization/initialization.cjs.map +1 -1
  18. package/dist/initialization/initialization.d.cts.map +1 -1
  19. package/dist/initialization/initialization.d.mts.map +1 -1
  20. package/dist/initialization/initialization.mjs.map +1 -1
  21. package/dist/initialization/instances/accounts-controller/accounts-controller.cjs.map +1 -1
  22. package/dist/initialization/instances/accounts-controller/accounts-controller.d.cts.map +1 -1
  23. package/dist/initialization/instances/accounts-controller/accounts-controller.d.mts.map +1 -1
  24. package/dist/initialization/instances/accounts-controller/accounts-controller.mjs.map +1 -1
  25. package/dist/initialization/instances/address-book-controller/address-book-controller.cjs.map +1 -1
  26. package/dist/initialization/instances/address-book-controller/address-book-controller.d.cts.map +1 -1
  27. package/dist/initialization/instances/address-book-controller/address-book-controller.d.mts.map +1 -1
  28. package/dist/initialization/instances/address-book-controller/address-book-controller.mjs.map +1 -1
  29. package/dist/initialization/instances/approval-controller/approval-controller.cjs.map +1 -1
  30. package/dist/initialization/instances/approval-controller/approval-controller.d.cts.map +1 -1
  31. package/dist/initialization/instances/approval-controller/approval-controller.d.mts.map +1 -1
  32. package/dist/initialization/instances/approval-controller/approval-controller.mjs.map +1 -1
  33. package/dist/initialization/instances/connectivity-controller/connectivity-controller.cjs.map +1 -1
  34. package/dist/initialization/instances/connectivity-controller/connectivity-controller.d.cts.map +1 -1
  35. package/dist/initialization/instances/connectivity-controller/connectivity-controller.d.mts.map +1 -1
  36. package/dist/initialization/instances/connectivity-controller/connectivity-controller.mjs.map +1 -1
  37. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.cjs +51 -0
  38. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.cjs.map +1 -0
  39. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.d.cts +6 -0
  40. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.d.cts.map +1 -0
  41. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.d.mts +6 -0
  42. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.d.mts.map +1 -0
  43. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.mjs +48 -0
  44. package/dist/initialization/instances/gas-fee-controller/gas-fee-controller.mjs.map +1 -0
  45. package/dist/initialization/instances/gas-fee-controller/types.cjs +3 -0
  46. package/dist/initialization/instances/gas-fee-controller/types.cjs.map +1 -0
  47. package/dist/initialization/instances/gas-fee-controller/types.d.cts +27 -0
  48. package/dist/initialization/instances/gas-fee-controller/types.d.cts.map +1 -0
  49. package/dist/initialization/instances/gas-fee-controller/types.d.mts +27 -0
  50. package/dist/initialization/instances/gas-fee-controller/types.d.mts.map +1 -0
  51. package/dist/initialization/instances/gas-fee-controller/types.mjs +2 -0
  52. package/dist/initialization/instances/gas-fee-controller/types.mjs.map +1 -0
  53. package/dist/initialization/instances/index.cjs +25 -19
  54. package/dist/initialization/instances/index.cjs.map +1 -1
  55. package/dist/initialization/instances/index.d.cts +3 -0
  56. package/dist/initialization/instances/index.d.cts.map +1 -1
  57. package/dist/initialization/instances/index.d.mts +3 -0
  58. package/dist/initialization/instances/index.d.mts.map +1 -1
  59. package/dist/initialization/instances/index.mjs +3 -0
  60. package/dist/initialization/instances/index.mjs.map +1 -1
  61. package/dist/initialization/instances/keyring-controller/keyring-controller.cjs +2 -2
  62. package/dist/initialization/instances/keyring-controller/keyring-controller.cjs.map +1 -1
  63. package/dist/initialization/instances/keyring-controller/keyring-controller.d.cts.map +1 -1
  64. package/dist/initialization/instances/keyring-controller/keyring-controller.d.mts.map +1 -1
  65. package/dist/initialization/instances/keyring-controller/keyring-controller.mjs.map +1 -1
  66. package/dist/initialization/instances/keyring-controller/types.cjs.map +1 -1
  67. package/dist/initialization/instances/keyring-controller/types.d.cts.map +1 -1
  68. package/dist/initialization/instances/keyring-controller/types.d.mts.map +1 -1
  69. package/dist/initialization/instances/keyring-controller/types.mjs.map +1 -1
  70. package/dist/initialization/instances/network-controller/network-controller.cjs.map +1 -1
  71. package/dist/initialization/instances/network-controller/network-controller.d.cts.map +1 -1
  72. package/dist/initialization/instances/network-controller/network-controller.d.mts.map +1 -1
  73. package/dist/initialization/instances/network-controller/network-controller.mjs.map +1 -1
  74. package/dist/initialization/instances/passkey-controller/passkey-controller.cjs +33 -0
  75. package/dist/initialization/instances/passkey-controller/passkey-controller.cjs.map +1 -0
  76. package/dist/initialization/instances/passkey-controller/passkey-controller.d.cts +4 -0
  77. package/dist/initialization/instances/passkey-controller/passkey-controller.d.cts.map +1 -0
  78. package/dist/initialization/instances/passkey-controller/passkey-controller.d.mts +4 -0
  79. package/dist/initialization/instances/passkey-controller/passkey-controller.d.mts.map +1 -0
  80. package/dist/initialization/instances/passkey-controller/passkey-controller.mjs +30 -0
  81. package/dist/initialization/instances/passkey-controller/passkey-controller.mjs.map +1 -0
  82. package/dist/initialization/instances/passkey-controller/types.cjs +3 -0
  83. package/dist/initialization/instances/passkey-controller/types.cjs.map +1 -0
  84. package/dist/initialization/instances/passkey-controller/types.d.cts +3 -0
  85. package/dist/initialization/instances/passkey-controller/types.d.cts.map +1 -0
  86. package/dist/initialization/instances/passkey-controller/types.d.mts +3 -0
  87. package/dist/initialization/instances/passkey-controller/types.d.mts.map +1 -0
  88. package/dist/initialization/instances/passkey-controller/types.mjs +2 -0
  89. package/dist/initialization/instances/passkey-controller/types.mjs.map +1 -0
  90. package/dist/initialization/instances/remote-feature-flag-controller/remote-feature-flag-controller.cjs.map +1 -1
  91. package/dist/initialization/instances/remote-feature-flag-controller/remote-feature-flag-controller.d.cts.map +1 -1
  92. package/dist/initialization/instances/remote-feature-flag-controller/remote-feature-flag-controller.d.mts.map +1 -1
  93. package/dist/initialization/instances/remote-feature-flag-controller/remote-feature-flag-controller.mjs.map +1 -1
  94. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.cjs +20 -0
  95. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.cjs.map +1 -0
  96. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.d.cts +4 -0
  97. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.d.cts.map +1 -0
  98. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.d.mts +4 -0
  99. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.d.mts.map +1 -0
  100. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.mjs +17 -0
  101. package/dist/initialization/instances/seedless-onboarding-controller/seedless-onboarding-controller.mjs.map +1 -0
  102. package/dist/initialization/instances/seedless-onboarding-controller/types.cjs +3 -0
  103. package/dist/initialization/instances/seedless-onboarding-controller/types.cjs.map +1 -0
  104. package/dist/initialization/instances/seedless-onboarding-controller/types.d.cts +3 -0
  105. package/dist/initialization/instances/seedless-onboarding-controller/types.d.cts.map +1 -0
  106. package/dist/initialization/instances/seedless-onboarding-controller/types.d.mts +3 -0
  107. package/dist/initialization/instances/seedless-onboarding-controller/types.d.mts.map +1 -0
  108. package/dist/initialization/instances/seedless-onboarding-controller/types.mjs +2 -0
  109. package/dist/initialization/instances/seedless-onboarding-controller/types.mjs.map +1 -0
  110. package/dist/initialization/instances/storage-service/storage-service.cjs.map +1 -1
  111. package/dist/initialization/instances/storage-service/storage-service.d.cts.map +1 -1
  112. package/dist/initialization/instances/storage-service/storage-service.d.mts.map +1 -1
  113. package/dist/initialization/instances/storage-service/storage-service.mjs.map +1 -1
  114. package/dist/initialization/instances/transaction-controller/transaction-controller.cjs.map +1 -1
  115. package/dist/initialization/instances/transaction-controller/transaction-controller.d.cts.map +1 -1
  116. package/dist/initialization/instances/transaction-controller/transaction-controller.d.mts.map +1 -1
  117. package/dist/initialization/instances/transaction-controller/transaction-controller.mjs.map +1 -1
  118. package/dist/initialization/types.cjs.map +1 -1
  119. package/dist/initialization/types.d.cts.map +1 -1
  120. package/dist/initialization/types.d.mts.map +1 -1
  121. package/dist/initialization/types.mjs.map +1 -1
  122. package/dist/types.cjs.map +1 -1
  123. package/dist/types.d.cts +6 -0
  124. package/dist/types.d.cts.map +1 -1
  125. package/dist/types.d.mts +6 -0
  126. package/dist/types.d.mts.map +1 -1
  127. package/dist/types.mjs.map +1 -1
  128. package/dist/utilities.cjs +1 -1
  129. package/dist/utilities.cjs.map +1 -1
  130. package/dist/utilities.d.cts.map +1 -1
  131. package/dist/utilities.d.mts.map +1 -1
  132. package/dist/utilities.mjs.map +1 -1
  133. package/package.json +10 -5
package/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [8.0.0]
11
+
12
+ ### Added
13
+
14
+ - **BREAKING:** Wire `GasFeeController` into the default wallet initialization ([#9527](https://github.com/MetaMask/core/pull/9527))
15
+ - Adds a required `instanceOptions.gasFeeController` option whose `clientId` (sent as `X-Client-Id` to the gas API) is required, so every client identifies itself; all other fields are optional and fall back to platform-agnostic defaults.
16
+ - **BREAKING** Wire `SeedlessOnboardingController` and `PasskeyController` into the default wallet initialization ([#9533](https://github.com/MetaMask/core/pull/9533))
17
+
18
+ ### Changed
19
+
20
+ - Bump `@metamask/transaction-controller` from `^69.0.0` to `^69.2.1` ([#9568](https://github.com/MetaMask/core/pull/9568), [#9589](https://github.com/MetaMask/core/pull/9589), [#9593](https://github.com/MetaMask/core/pull/9593))
21
+ - Bump `@metamask/seedless-onboarding-controller` from `^10.0.3` to `^10.1.0` ([#9600](https://github.com/MetaMask/core/pull/9600))
22
+
10
23
  ## [7.0.1]
11
24
 
12
25
  ### Changed
@@ -102,7 +115,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
102
115
 
103
116
  - Initial release ([#8838](https://github.com/MetaMask/core/pull/8838))
104
117
 
105
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/wallet@7.0.1...HEAD
118
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/wallet@8.0.0...HEAD
119
+ [8.0.0]: https://github.com/MetaMask/core/compare/@metamask/wallet@7.0.1...@metamask/wallet@8.0.0
106
120
  [7.0.1]: https://github.com/MetaMask/core/compare/@metamask/wallet@7.0.0...@metamask/wallet@7.0.1
107
121
  [7.0.0]: https://github.com/MetaMask/core/compare/@metamask/wallet@6.0.0...@metamask/wallet@7.0.0
108
122
  [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/wallet@5.0.0...@metamask/wallet@6.0.0
package/dist/Wallet.cjs CHANGED
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Wallet = void 0;
16
16
  const messenger_1 = require("@metamask/messenger");
17
17
  const utils_1 = require("@metamask/utils");
18
- const initialization_1 = require("./initialization/initialization.cjs");
18
+ const initialization_js_1 = require("./initialization/initialization.cjs");
19
19
  class Wallet {
20
20
  /**
21
21
  * Creates a `Wallet` instance, initializing all instances as specified by the passed options.
@@ -38,7 +38,7 @@ class Wallet {
38
38
  new messenger_1.Messenger({
39
39
  namespace: 'Root',
40
40
  }), "f");
41
- __classPrivateFieldSet(this, _Wallet_instances, (0, initialization_1.initialize)({
41
+ __classPrivateFieldSet(this, _Wallet_instances, (0, initialization_js_1.initialize)({
42
42
  ...options,
43
43
  messenger: __classPrivateFieldGet(this, _Wallet_messenger, "f"),
44
44
  }), "f");
@@ -1 +1 @@
1
- {"version":3,"file":"Wallet.cjs","sourceRoot":"","sources":["../src/Wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mDAAgD;AAChD,2CAA8C;AAS9C,wEAA6D;AAG7D,MAAa,MAAM;IAYjB;;;;;;;;;;OAUG;IACH,YAAY,OAAsB;QAtBlC,oEAAoE;QAC3D,oCAAyD;QAEzD,oCAA6B;QAE7B,6CAEP;QAEF,8BAAe,KAAK,EAAC;QAcnB,uBAAA,IAAI,qBACF,OAAO,CAAC,SAAS;YACjB,IAAI,qBAAS,CAAC;gBACZ,SAAS,EAAE,MAAM;aAClB,CAAC,MAAA,CAAC;QAEL,uBAAA,IAAI,qBAAc,IAAA,2BAAU,EAAC;YAC3B,GAAG,OAAO;YACV,SAAS,EAAE,uBAAA,IAAI,yBAAW;SAC3B,CAAC,MAAA,CAAC;QAEH,uBAAA,IAAI,8BAAuB,MAAM,CAAC,WAAW,CAC3C,MAAM,CAAC,OAAO,CAAC,uBAAA,IAAI,yBAAW,CAAC;aAC5B,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;aAC5D,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC;YACzB,IAAI;YACH,QAAkD,CAAC,QAAQ;SAC7D,CAAC,CACL,MAAA,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,uBAAA,IAAI,yBAAW,CAAC;IACzB,CAAC;IAED,IAAI,SAAS,CAAC,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OA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ED,uBAAA,IAAI,uBAAgB,IAAI,MAAA,CAAC;QAEzB,MAAM,OAAO,CAAC,UAAU,CACtB,MAAM,CAAC,MAAM,CAAC,uBAAA,IAAI,yBAAW,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACpD,iDAAiD;YACjD,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC3C,iDAAiD;gBACjD,OAAO,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,CAAC;YACD,0BAA0B;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AAvJD,wBAuJC","sourcesContent":["import type { StateMetadataConstraint } from '@metamask/base-controller';\nimport { Messenger } from '@metamask/messenger';\nimport { hasProperty } from '@metamask/utils';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults';\nimport { initialize } from './initialization/initialization';\nimport { WalletOptions } from './types';\n\nexport class Wallet {\n // TODO: Expand default types when passing additionalConfigurations.\n readonly #messenger: RootMessenger<DefaultActions, DefaultEvents>;\n\n readonly #instances: DefaultInstances;\n\n readonly #controllerMetadata: Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n >;\n\n #isDestroyed = false;\n\n /**\n * Creates a `Wallet` instance, initializing all instances as specified by the passed options.\n *\n * @param options - Options bag.\n * @param options.messenger - An optional messenger to override the default one.\n * @param options.state - An optional state blob.\n * @param options.initializationConfigurations - An optional list of additional initialization configurations\n * required beyond the ones included by default.\n * @param options.instanceOptions - An optional object containing options that should be passed\n * to specific instances for additional customization.\n */\n constructor(options: WalletOptions) {\n this.#messenger =\n options.messenger ??\n new Messenger({\n namespace: 'Root',\n });\n\n this.#instances = initialize({\n ...options,\n messenger: this.#messenger,\n });\n\n this.#controllerMetadata = Object.fromEntries(\n Object.entries(this.#instances)\n .filter(([_, instance]) => hasProperty(instance, 'metadata'))\n .map(([name, instance]) => [\n name,\n (instance as { metadata: StateMetadataConstraint }).metadata,\n ]),\n );\n }\n\n /**\n * @returns The root messenger of the wallet.\n */\n get messenger(): Readonly<RootMessenger<DefaultActions, DefaultEvents>> {\n return this.#messenger;\n }\n\n set messenger(_) {\n throw new Error('The messenger cannot be directly mutated.');\n }\n\n /**\n * @returns The combined state of the wallet.\n */\n get state(): DefaultState {\n return Object.entries(this.#instances).reduce<Record<string, unknown>>(\n (totalState, [name, instance]) => {\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n if ('state' in instance && instance.state) {\n totalState[name] = instance.state;\n }\n return totalState;\n },\n {},\n ) as DefaultState;\n }\n\n set state(_) {\n throw new Error('Wallet state cannot be directly mutated.');\n }\n\n /**\n * @returns The controller metadata; containing per-controller information about what properties to persist etc.\n */\n get controllerMetadata(): Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n > {\n return this.#controllerMetadata;\n }\n\n set controllerMetadata(_) {\n throw new Error('The controller metadata cannot be directly mutated.');\n }\n\n getInstance<Name extends keyof DefaultInstances>(\n name: Name,\n ): DefaultInstances[Name];\n\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined;\n\n /**\n * Get an instantiated controller or service.\n *\n * @param name - The name.\n * @returns The instance, if it exists.\n * @deprecated - Please use the messenger instead of direct access.\n */\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined {\n return this.#instances[name as keyof DefaultInstances];\n }\n\n /**\n * Complete additional initialization of instantiated controllers or services after instantiating `Wallet`.\n *\n * @returns The results of all initialization calls.\n */\n init(): Promise<PromiseSettledResult<unknown>[]> {\n return Promise.allSettled(\n Object.values(this.#instances)\n .filter(\n (instance): instance is Extract<typeof instance, { init: unknown }> =>\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n 'init' in instance && typeof instance.init === 'function',\n )\n .map(async (instance) => instance.init()),\n );\n }\n\n /**\n * Destroy the wallet instance.\n */\n async destroy(): Promise<void> {\n if (this.#isDestroyed) {\n return;\n }\n\n this.#isDestroyed = true;\n\n await Promise.allSettled(\n Object.values(this.#instances).map(async (instance) => {\n // @ts-expect-error Accessing protected property.\n if (typeof instance.destroy === 'function') {\n // @ts-expect-error Accessing protected property.\n return await instance.destroy();\n }\n /* istanbul ignore next */\n return undefined;\n }),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"Wallet.cjs","sourceRoot":"","sources":["../src/Wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mDAAgD;AAChD,2CAA8C;AAS9C,2EAAgE;AAGhE,MAAa,MAAM;IAYjB;;;;;;;;;;OAUG;IACH,YAAY,OAAsB;QAtBlC,oEAAoE;QAC3D,oCAAyD;QAEzD,oCAA6B;QAE7B,6CAEP;QAEF,8BAAe,KAAK,EAAC;QAcnB,uBAAA,IAAI,qBACF,OAAO,CAAC,SAAS;YACjB,IAAI,qBAAS,CAAC;gBACZ,SAAS,EAAE,MAAM;aAClB,CAAC,MAAA,CAAC;QAEL,uBAAA,IAAI,qBAAc,IAAA,8BAAU,EAAC;YAC3B,GAAG,OAAO;YACV,SAAS,EAAE,uBAAA,IAAI,yBAAW;SAC3B,CAAC,MAAA,CAAC;QAEH,uBAAA,IAAI,8BAAuB,MAAM,CAAC,WAAW,CAC3C,MAAM,CAAC,OAAO,CAAC,uBAAA,IAAI,yBAAW,CAAC;aAC5B,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAW,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;aAC5D,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC;YACzB,IAAI;YACH,QAAkD,CAAC,QAAQ;SAC7D,CAAC,CACL,MAAA,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,uBAAA,IAAI,yBAAW,CAAC;IACzB,CAAC;IA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5C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,uBAAA,IAAI,2BAAa,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,uBAAA,IAAI,uBAAgB,IAAI,MAAA,CAAC;QAEzB,MAAM,OAAO,CAAC,UAAU,CACtB,MAAM,CAAC,MAAM,CAAC,uBAAA,IAAI,yBAAW,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACpD,iDAAiD;YACjD,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC3C,iDAAiD;gBACjD,OAAO,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,CAAC;YACD,0BAA0B;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AAvJD,wBAuJC","sourcesContent":["import type { StateMetadataConstraint } from '@metamask/base-controller';\nimport { Messenger } from '@metamask/messenger';\nimport { hasProperty } from '@metamask/utils';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults.js';\nimport { initialize } from './initialization/initialization.js';\nimport { WalletOptions } from './types.js';\n\nexport class Wallet {\n // TODO: Expand default types when passing additionalConfigurations.\n readonly #messenger: RootMessenger<DefaultActions, DefaultEvents>;\n\n readonly #instances: DefaultInstances;\n\n readonly #controllerMetadata: Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n >;\n\n #isDestroyed = false;\n\n /**\n * Creates a `Wallet` instance, initializing all instances as specified by the passed options.\n *\n * @param options - Options bag.\n * @param options.messenger - An optional messenger to override the default one.\n * @param options.state - An optional state blob.\n * @param options.initializationConfigurations - An optional list of additional initialization configurations\n * required beyond the ones included by default.\n * @param options.instanceOptions - An optional object containing options that should be passed\n * to specific instances for additional customization.\n */\n constructor(options: WalletOptions) {\n this.#messenger =\n options.messenger ??\n new Messenger({\n namespace: 'Root',\n });\n\n this.#instances = initialize({\n ...options,\n messenger: this.#messenger,\n });\n\n this.#controllerMetadata = Object.fromEntries(\n Object.entries(this.#instances)\n .filter(([_, instance]) => hasProperty(instance, 'metadata'))\n .map(([name, instance]) => [\n name,\n (instance as { metadata: StateMetadataConstraint }).metadata,\n ]),\n );\n }\n\n /**\n * @returns The root messenger of the wallet.\n */\n get messenger(): Readonly<RootMessenger<DefaultActions, DefaultEvents>> {\n return this.#messenger;\n }\n\n set messenger(_) {\n throw new Error('The messenger cannot be directly mutated.');\n }\n\n /**\n * @returns The combined state of the wallet.\n */\n get state(): DefaultState {\n return Object.entries(this.#instances).reduce<Record<string, unknown>>(\n (totalState, [name, instance]) => {\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n if ('state' in instance && instance.state) {\n totalState[name] = instance.state;\n }\n return totalState;\n },\n {},\n ) as DefaultState;\n }\n\n set state(_) {\n throw new Error('Wallet state cannot be directly mutated.');\n }\n\n /**\n * @returns The controller metadata; containing per-controller information about what properties to persist etc.\n */\n get controllerMetadata(): Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n > {\n return this.#controllerMetadata;\n }\n\n set controllerMetadata(_) {\n throw new Error('The controller metadata cannot be directly mutated.');\n }\n\n getInstance<Name extends keyof DefaultInstances>(\n name: Name,\n ): DefaultInstances[Name];\n\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined;\n\n /**\n * Get an instantiated controller or service.\n *\n * @param name - The name.\n * @returns The instance, if it exists.\n * @deprecated - Please use the messenger instead of direct access.\n */\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined {\n return this.#instances[name as keyof DefaultInstances];\n }\n\n /**\n * Complete additional initialization of instantiated controllers or services after instantiating `Wallet`.\n *\n * @returns The results of all initialization calls.\n */\n init(): Promise<PromiseSettledResult<unknown>[]> {\n return Promise.allSettled(\n Object.values(this.#instances)\n .filter(\n (instance): instance is Extract<typeof instance, { init: unknown }> =>\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n 'init' in instance && typeof instance.init === 'function',\n )\n .map(async (instance) => instance.init()),\n );\n }\n\n /**\n * Destroy the wallet instance.\n */\n async destroy(): Promise<void> {\n if (this.#isDestroyed) {\n return;\n }\n\n this.#isDestroyed = true;\n\n await Promise.allSettled(\n Object.values(this.#instances).map(async (instance) => {\n // @ts-expect-error Accessing protected property.\n if (typeof instance.destroy === 'function') {\n // @ts-expect-error Accessing protected property.\n return await instance.destroy();\n }\n /* istanbul ignore next */\n return undefined;\n }),\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Wallet.d.cts","sourceRoot":"","sources":["../src/Wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kCAAkC;AAIzE,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACd,sCAAkC;AAEnC,OAAO,EAAE,aAAa,EAAE,oBAAgB;AAExC,qBAAa,MAAM;;IAYjB;;;;;;;;;;OAUG;gBACS,OAAO,EAAE,aAAa;IAsBlC;;OAEG;IACH,IAAI,SAAS,IAAI,QAAQ,CAAC,aAAa,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,CAEtE;IAED,IAAI,SAAS,CAAC,CAAC,EAJE,QAAQ,CAAC,aAAa,CAAC,cAAc,EAAE,aAAa,CAAC,CAIvD,EAEd;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,YAAY,CAYxB;IAED,IAAI,KAAK,CAAC,CAAC,EAdE,YAcF,EAEV;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,QAAQ,CAChC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAClD,CAEA;IAED,IAAI,kBAAkB,CAAC,CAAC,EANE,QAAQ,CAChC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAK3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AAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAC5C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,uBAAA,IAAI,2BAAa,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,uBAAA,IAAI,uBAAgB,IAAI,MAAA,CAAC;QAEzB,MAAM,OAAO,CAAC,UAAU,CACtB,MAAM,CAAC,MAAM,CAAC,uBAAA,IAAI,yBAAW,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACpD,iDAAiD;YACjD,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC3C,iDAAiD;gBACjD,OAAO,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,CAAC;YACD,0BAA0B;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { StateMetadataConstraint } from '@metamask/base-controller';\nimport { Messenger } from '@metamask/messenger';\nimport { hasProperty } from '@metamask/utils';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults';\nimport { initialize } from './initialization/initialization';\nimport { WalletOptions } from './types';\n\nexport class Wallet {\n // TODO: Expand default types when passing additionalConfigurations.\n readonly #messenger: RootMessenger<DefaultActions, DefaultEvents>;\n\n readonly #instances: DefaultInstances;\n\n readonly #controllerMetadata: Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n >;\n\n #isDestroyed = false;\n\n /**\n * Creates a `Wallet` instance, initializing all instances as specified by the passed options.\n *\n * @param options - Options bag.\n * @param options.messenger - An optional messenger to override the default one.\n * @param options.state - An optional state blob.\n * @param options.initializationConfigurations - An optional list of additional initialization configurations\n * required beyond the ones included by default.\n * @param options.instanceOptions - An optional object containing options that should be passed\n * to specific instances for additional customization.\n */\n constructor(options: WalletOptions) {\n this.#messenger =\n options.messenger ??\n new Messenger({\n namespace: 'Root',\n });\n\n this.#instances = initialize({\n ...options,\n messenger: this.#messenger,\n });\n\n this.#controllerMetadata = Object.fromEntries(\n Object.entries(this.#instances)\n .filter(([_, instance]) => hasProperty(instance, 'metadata'))\n .map(([name, instance]) => [\n name,\n (instance as { metadata: StateMetadataConstraint }).metadata,\n ]),\n );\n }\n\n /**\n * @returns The root messenger of the wallet.\n */\n get messenger(): Readonly<RootMessenger<DefaultActions, DefaultEvents>> {\n return this.#messenger;\n }\n\n set messenger(_) {\n throw new Error('The messenger cannot be directly mutated.');\n }\n\n /**\n * @returns The combined state of the wallet.\n */\n get state(): DefaultState {\n return Object.entries(this.#instances).reduce<Record<string, unknown>>(\n (totalState, [name, instance]) => {\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n if ('state' in instance && instance.state) {\n totalState[name] = instance.state;\n }\n return totalState;\n },\n {},\n ) as DefaultState;\n }\n\n set state(_) {\n throw new Error('Wallet state cannot be directly mutated.');\n }\n\n /**\n * @returns The controller metadata; containing per-controller information about what properties to persist etc.\n */\n get controllerMetadata(): Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n > {\n return this.#controllerMetadata;\n }\n\n set controllerMetadata(_) {\n throw new Error('The controller metadata cannot be directly mutated.');\n }\n\n getInstance<Name extends keyof DefaultInstances>(\n name: Name,\n ): DefaultInstances[Name];\n\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined;\n\n /**\n * Get an instantiated controller or service.\n *\n * @param name - The name.\n * @returns The instance, if it exists.\n * @deprecated - Please use the messenger instead of direct access.\n */\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined {\n return this.#instances[name as keyof DefaultInstances];\n }\n\n /**\n * Complete additional initialization of instantiated controllers or services after instantiating `Wallet`.\n *\n * @returns The results of all initialization calls.\n */\n init(): Promise<PromiseSettledResult<unknown>[]> {\n return Promise.allSettled(\n Object.values(this.#instances)\n .filter(\n (instance): instance is Extract<typeof instance, { init: unknown }> =>\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n 'init' in instance && typeof instance.init === 'function',\n )\n .map(async (instance) => instance.init()),\n );\n }\n\n /**\n * Destroy the wallet instance.\n */\n async destroy(): Promise<void> {\n if (this.#isDestroyed) {\n return;\n }\n\n this.#isDestroyed = true;\n\n await Promise.allSettled(\n Object.values(this.#instances).map(async (instance) => {\n // @ts-expect-error Accessing protected property.\n if (typeof instance.destroy === 'function') {\n // @ts-expect-error Accessing protected property.\n return await instance.destroy();\n }\n /* istanbul ignore next */\n return undefined;\n }),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"Wallet.mjs","sourceRoot":"","sources":["../src/Wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAChD,OAAO,EAAE,WAAW,EAAE,wBAAwB;AAS9C,OAAO,EAAE,UAAU,EAAE,4CAA2C;AAGhE,MAAM,OAAO,MAAM;IAYjB;;;;;;;;;;OAUG;IACH,YAAY,OAAsB;QAtBlC,oEAAoE;QAC3D,oCAAyD;QAEzD,oCAA6B;QAE7B,6CAEP;QAEF,8BAAe,KAAK,EAAC;QAcnB,uBAAA,IAAI,qBACF,OAAO,CAAC,SAAS;YACjB,IAAI,SAAS,CAAC;gBACZ,SAAS,EAAE,MAAM;aAClB,CAAC,MAAA,CAAC;QAEL,uBAAA,IAAI,qBAAc,UAAU,CAAC;YAC3B,GAAG,OAAO;YACV,SAAS,EAAE,uBAAA,IAAI,yBAAW;SAC3B,CAAC,MAAA,CAAC;QAEH,uBAAA,IAAI,8BAAuB,MAAM,CAAC,WAAW,CAC3C,MAAM,CAAC,OAAO,CAAC,uBAAA,IAAI,yBAAW,CAAC;aAC5B,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;a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B,MAAM,CACL,CAAC,QAAQ,EAA2D,EAAE;QACpE,mDAAmD;QACnD,gDAAgD;QAChD,MAAM,IAAI,QAAQ,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU,CAC5D;aACA,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAC5C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,uBAAA,IAAI,2BAAa,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,uBAAA,IAAI,uBAAgB,IAAI,MAAA,CAAC;QAEzB,MAAM,OAAO,CAAC,UAAU,CACtB,MAAM,CAAC,MAAM,CAAC,uBAAA,IAAI,yBAAW,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACpD,iDAAiD;YACjD,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC3C,iDAAiD;gBACjD,OAAO,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClC,CAAC;YACD,0BAA0B;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { StateMetadataConstraint } from '@metamask/base-controller';\nimport { Messenger } from '@metamask/messenger';\nimport { hasProperty } from '@metamask/utils';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults.js';\nimport { initialize } from './initialization/initialization.js';\nimport { WalletOptions } from './types.js';\n\nexport class Wallet {\n // TODO: Expand default types when passing additionalConfigurations.\n readonly #messenger: RootMessenger<DefaultActions, DefaultEvents>;\n\n readonly #instances: DefaultInstances;\n\n readonly #controllerMetadata: Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n >;\n\n #isDestroyed = false;\n\n /**\n * Creates a `Wallet` instance, initializing all instances as specified by the passed options.\n *\n * @param options - Options bag.\n * @param options.messenger - An optional messenger to override the default one.\n * @param options.state - An optional state blob.\n * @param options.initializationConfigurations - An optional list of additional initialization configurations\n * required beyond the ones included by default.\n * @param options.instanceOptions - An optional object containing options that should be passed\n * to specific instances for additional customization.\n */\n constructor(options: WalletOptions) {\n this.#messenger =\n options.messenger ??\n new Messenger({\n namespace: 'Root',\n });\n\n this.#instances = initialize({\n ...options,\n messenger: this.#messenger,\n });\n\n this.#controllerMetadata = Object.fromEntries(\n Object.entries(this.#instances)\n .filter(([_, instance]) => hasProperty(instance, 'metadata'))\n .map(([name, instance]) => [\n name,\n (instance as { metadata: StateMetadataConstraint }).metadata,\n ]),\n );\n }\n\n /**\n * @returns The root messenger of the wallet.\n */\n get messenger(): Readonly<RootMessenger<DefaultActions, DefaultEvents>> {\n return this.#messenger;\n }\n\n set messenger(_) {\n throw new Error('The messenger cannot be directly mutated.');\n }\n\n /**\n * @returns The combined state of the wallet.\n */\n get state(): DefaultState {\n return Object.entries(this.#instances).reduce<Record<string, unknown>>(\n (totalState, [name, instance]) => {\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n if ('state' in instance && instance.state) {\n totalState[name] = instance.state;\n }\n return totalState;\n },\n {},\n ) as DefaultState;\n }\n\n set state(_) {\n throw new Error('Wallet state cannot be directly mutated.');\n }\n\n /**\n * @returns The controller metadata; containing per-controller information about what properties to persist etc.\n */\n get controllerMetadata(): Readonly<\n Record<string, Readonly<StateMetadataConstraint>>\n > {\n return this.#controllerMetadata;\n }\n\n set controllerMetadata(_) {\n throw new Error('The controller metadata cannot be directly mutated.');\n }\n\n getInstance<Name extends keyof DefaultInstances>(\n name: Name,\n ): DefaultInstances[Name];\n\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined;\n\n /**\n * Get an instantiated controller or service.\n *\n * @param name - The name.\n * @returns The instance, if it exists.\n * @deprecated - Please use the messenger instead of direct access.\n */\n getInstance(\n name: string,\n ): DefaultInstances[keyof DefaultInstances] | undefined {\n return this.#instances[name as keyof DefaultInstances];\n }\n\n /**\n * Complete additional initialization of instantiated controllers or services after instantiating `Wallet`.\n *\n * @returns The results of all initialization calls.\n */\n init(): Promise<PromiseSettledResult<unknown>[]> {\n return Promise.allSettled(\n Object.values(this.#instances)\n .filter(\n (instance): instance is Extract<typeof instance, { init: unknown }> =>\n // We do actually want to check the prototype here.\n // eslint-disable-next-line no-restricted-syntax\n 'init' in instance && typeof instance.init === 'function',\n )\n .map(async (instance) => instance.init()),\n );\n }\n\n /**\n * Destroy the wallet instance.\n */\n async destroy(): Promise<void> {\n if (this.#isDestroyed) {\n return;\n }\n\n this.#isDestroyed = true;\n\n await Promise.allSettled(\n Object.values(this.#instances).map(async (instance) => {\n // @ts-expect-error Accessing protected property.\n if (typeof instance.destroy === 'function') {\n // @ts-expect-error Accessing protected property.\n return await instance.destroy();\n }\n /* istanbul ignore next */\n return undefined;\n }),\n );\n }\n}\n"]}
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.importSecretRecoveryPhrase = exports.AlwaysOnlineAdapter = exports.Wallet = void 0;
4
- var Wallet_1 = require("./Wallet.cjs");
5
- Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return Wallet_1.Wallet; } });
6
- var always_online_adapter_1 = require("./initialization/instances/connectivity-controller/always-online-adapter.cjs");
7
- Object.defineProperty(exports, "AlwaysOnlineAdapter", { enumerable: true, get: function () { return always_online_adapter_1.AlwaysOnlineAdapter; } });
8
- var utilities_1 = require("./utilities.cjs");
9
- Object.defineProperty(exports, "importSecretRecoveryPhrase", { enumerable: true, get: function () { return utilities_1.importSecretRecoveryPhrase; } });
4
+ var Wallet_js_1 = require("./Wallet.cjs");
5
+ Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return Wallet_js_1.Wallet; } });
6
+ var always_online_adapter_js_1 = require("./initialization/instances/connectivity-controller/always-online-adapter.cjs");
7
+ Object.defineProperty(exports, "AlwaysOnlineAdapter", { enumerable: true, get: function () { return always_online_adapter_js_1.AlwaysOnlineAdapter; } });
8
+ var utilities_js_1 = require("./utilities.cjs");
9
+ Object.defineProperty(exports, "importSecretRecoveryPhrase", { enumerable: true, get: function () { return utilities_js_1.importSecretRecoveryPhrase; } });
10
10
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,sHAA+G;AAAtG,4HAAA,mBAAmB,OAAA;AAC5B,6CAAyD;AAAhD,uHAAA,0BAA0B,OAAA","sourcesContent":["export { Wallet } from './Wallet';\nexport { AlwaysOnlineAdapter } from './initialization/instances/connectivity-controller/always-online-adapter';\nexport { importSecretRecoveryPhrase } from './utilities';\nexport type { WalletOptions } from './types';\nexport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AAA5B,mGAAA,MAAM,OAAA;AACf,yHAAkH;AAAzG,+HAAA,mBAAmB,OAAA;AAC5B,gDAA4D;AAAnD,0HAAA,0BAA0B,OAAA","sourcesContent":["export { Wallet } from './Wallet.js';\nexport { AlwaysOnlineAdapter } from './initialization/instances/connectivity-controller/always-online-adapter.js';\nexport { importSecretRecoveryPhrase } from './utilities.js';\nexport type { WalletOptions } from './types.js';\nexport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAiB;AAClC,OAAO,EAAE,mBAAmB,EAAE,qFAAiF;AAC/G,OAAO,EAAE,0BAA0B,EAAE,wBAAoB;AACzD,YAAY,EAAE,aAAa,EAAE,oBAAgB;AAC7C,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,sCAAkC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAoB;AACrC,OAAO,EAAE,mBAAmB,EAAE,qFAAoF;AAClH,OAAO,EAAE,0BAA0B,EAAE,wBAAuB;AAC5D,YAAY,EAAE,aAAa,EAAE,oBAAmB;AAChD,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,sCAAqC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAiB;AAClC,OAAO,EAAE,mBAAmB,EAAE,qFAAiF;AAC/G,OAAO,EAAE,0BAA0B,EAAE,wBAAoB;AACzD,YAAY,EAAE,aAAa,EAAE,oBAAgB;AAC7C,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,sCAAkC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAoB;AACrC,OAAO,EAAE,mBAAmB,EAAE,qFAAoF;AAClH,OAAO,EAAE,0BAA0B,EAAE,wBAAuB;AAC5D,YAAY,EAAE,aAAa,EAAE,oBAAmB;AAChD,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,sCAAqC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAiB;AAClC,OAAO,EAAE,mBAAmB,EAAE,qFAAiF;AAC/G,OAAO,EAAE,0BAA0B,EAAE,wBAAoB","sourcesContent":["export { Wallet } from './Wallet';\nexport { AlwaysOnlineAdapter } from './initialization/instances/connectivity-controller/always-online-adapter';\nexport { importSecretRecoveryPhrase } from './utilities';\nexport type { WalletOptions } from './types';\nexport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAoB;AACrC,OAAO,EAAE,mBAAmB,EAAE,qFAAoF;AAClH,OAAO,EAAE,0BAA0B,EAAE,wBAAuB","sourcesContent":["export { Wallet } from './Wallet.js';\nexport { AlwaysOnlineAdapter } from './initialization/instances/connectivity-controller/always-online-adapter.js';\nexport { importSecretRecoveryPhrase } from './utilities.js';\nexport type { WalletOptions } from './types.js';\nexport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n DefaultState,\n RootMessenger,\n} from './initialization/defaults.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.cjs","sourceRoot":"","sources":["../../src/initialization/defaults.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,6EAAqD;AAG5C,sDAAqB","sourcesContent":["import type {\n ActionConstraint,\n EventConstraint,\n Messenger,\n MessengerActions,\n MessengerEvents,\n} from '@metamask/messenger';\n\nimport * as defaultConfigurations from './instances';\nimport type { InitializationConfiguration, InstanceState } from './types';\n\nexport { defaultConfigurations };\n\n/**\n * Utility type for inferring and extracting an instance type from an initialization configuration.\n */\ntype ExtractInstance<Config> =\n Config extends InitializationConfiguration<\n infer Instance,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Messenger\n >\n ? Instance\n : never;\n\n/**\n * Utility type for inferring and extracting an instance messenger type from an initialization configuration.\n */\ntype ExtractInstanceMessenger<Config> =\n Config extends InitializationConfiguration<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Instance,\n infer InferredMessenger\n >\n ? InferredMessenger\n : never;\n\n/**\n * Utility type for inferring and extracting the name of an instance from an initialization configuration.\n */\ntype ExtractName<Config> =\n ExtractInstance<Config> extends { name: infer Name extends string }\n ? Name\n : never;\n\ntype DefaultConfigs = typeof defaultConfigurations;\n\ntype AllDefaultMessengers = ExtractInstanceMessenger<\n DefaultConfigs[keyof DefaultConfigs]\n>;\n\nexport type DefaultInstances = {\n [Key in keyof DefaultConfigs as ExtractName<\n DefaultConfigs[Key]\n >]: ExtractInstance<DefaultConfigs[Key]>;\n};\n\nexport type DefaultActions = MessengerActions<AllDefaultMessengers>;\n\nexport type DefaultEvents = MessengerEvents<AllDefaultMessengers>;\n\nexport type RootMessenger<\n AllowedActions extends ActionConstraint,\n AllowedEvents extends EventConstraint,\n> = Messenger<'Root', AllowedActions, AllowedEvents>;\n\nexport type DefaultState = {\n [Key in keyof DefaultInstances]: InstanceState<DefaultInstances[Key]>;\n};\n"]}
1
+ {"version":3,"file":"defaults.cjs","sourceRoot":"","sources":["../../src/initialization/defaults.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,6EAA8D;AAGrD,sDAAqB","sourcesContent":["import type {\n ActionConstraint,\n EventConstraint,\n Messenger,\n MessengerActions,\n MessengerEvents,\n} from '@metamask/messenger';\n\nimport * as defaultConfigurations from './instances/index.js';\nimport type { InitializationConfiguration, InstanceState } from './types.js';\n\nexport { defaultConfigurations };\n\n/**\n * Utility type for inferring and extracting an instance type from an initialization configuration.\n */\ntype ExtractInstance<Config> =\n Config extends InitializationConfiguration<\n infer Instance,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Messenger\n >\n ? Instance\n : never;\n\n/**\n * Utility type for inferring and extracting an instance messenger type from an initialization configuration.\n */\ntype ExtractInstanceMessenger<Config> =\n Config extends InitializationConfiguration<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Instance,\n infer InferredMessenger\n >\n ? InferredMessenger\n : never;\n\n/**\n * Utility type for inferring and extracting the name of an instance from an initialization configuration.\n */\ntype ExtractName<Config> =\n ExtractInstance<Config> extends { name: infer Name extends string }\n ? Name\n : never;\n\ntype DefaultConfigs = typeof defaultConfigurations;\n\ntype AllDefaultMessengers = ExtractInstanceMessenger<\n DefaultConfigs[keyof DefaultConfigs]\n>;\n\nexport type DefaultInstances = {\n [Key in keyof DefaultConfigs as ExtractName<\n DefaultConfigs[Key]\n >]: ExtractInstance<DefaultConfigs[Key]>;\n};\n\nexport type DefaultActions = MessengerActions<AllDefaultMessengers>;\n\nexport type DefaultEvents = MessengerEvents<AllDefaultMessengers>;\n\nexport type RootMessenger<\n AllowedActions extends ActionConstraint,\n AllowedEvents extends EventConstraint,\n> = Messenger<'Root', AllowedActions, AllowedEvents>;\n\nexport type DefaultState = {\n [Key in keyof DefaultInstances]: InstanceState<DefaultInstances[Key]>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.cts","sourceRoot":"","sources":["../../src/initialization/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,4BAA4B;AAE7B,OAAO,KAAK,qBAAqB,8BAAoB;AACrD,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,oBAAgB;AAE1E,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC;;GAEG;AACH,KAAK,eAAe,CAAC,MAAM,IACzB,MAAM,SAAS,2BAA2B,CACxC,MAAM,QAAQ,EAEd,MAAM,UAAU,CACjB,GACG,QAAQ,GACR,KAAK,CAAC;AAEZ;;GAEG;AACH,KAAK,wBAAwB,CAAC,MAAM,IAClC,MAAM,SAAS,2BAA2B,CAExC,MAAM,SAAS,EACf,MAAM,iBAAiB,CACxB,GACG,iBAAiB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AAM,MAAM,aAAa,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;AAElE,MAAM,MAAM,aAAa,CACvB,cAAc,SAAS,gBAAgB,EACvC,aAAa,SAAS,eAAe,IACnC,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG;KACxB,GAAG,IAAI,MAAM,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;CACtE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.mjs","sourceRoot":"","sources":["../../src/initialization/defaults.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,qBAAqB,8BAAoB;AAGrD,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type {\n ActionConstraint,\n EventConstraint,\n Messenger,\n MessengerActions,\n MessengerEvents,\n} from '@metamask/messenger';\n\nimport * as defaultConfigurations from './instances';\nimport type { InitializationConfiguration, InstanceState } from './types';\n\nexport { defaultConfigurations };\n\n/**\n * Utility type for inferring and extracting an instance type from an initialization configuration.\n */\ntype ExtractInstance<Config> =\n Config extends InitializationConfiguration<\n infer Instance,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Messenger\n >\n ? Instance\n : never;\n\n/**\n * Utility type for inferring and extracting an instance messenger type from an initialization configuration.\n */\ntype ExtractInstanceMessenger<Config> =\n Config extends InitializationConfiguration<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Instance,\n infer InferredMessenger\n >\n ? InferredMessenger\n : never;\n\n/**\n * Utility type for inferring and extracting the name of an instance from an initialization configuration.\n */\ntype ExtractName<Config> =\n ExtractInstance<Config> extends { name: infer Name extends string }\n ? Name\n : never;\n\ntype DefaultConfigs = typeof defaultConfigurations;\n\ntype AllDefaultMessengers = ExtractInstanceMessenger<\n DefaultConfigs[keyof DefaultConfigs]\n>;\n\nexport type DefaultInstances = {\n [Key in keyof DefaultConfigs as ExtractName<\n DefaultConfigs[Key]\n >]: ExtractInstance<DefaultConfigs[Key]>;\n};\n\nexport type DefaultActions = MessengerActions<AllDefaultMessengers>;\n\nexport type DefaultEvents = MessengerEvents<AllDefaultMessengers>;\n\nexport type RootMessenger<\n AllowedActions extends ActionConstraint,\n AllowedEvents extends EventConstraint,\n> = Messenger<'Root', AllowedActions, AllowedEvents>;\n\nexport type DefaultState = {\n [Key in keyof DefaultInstances]: InstanceState<DefaultInstances[Key]>;\n};\n"]}
1
+ {"version":3,"file":"defaults.mjs","sourceRoot":"","sources":["../../src/initialization/defaults.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,qBAAqB,8BAA6B;AAG9D,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type {\n ActionConstraint,\n EventConstraint,\n Messenger,\n MessengerActions,\n MessengerEvents,\n} from '@metamask/messenger';\n\nimport * as defaultConfigurations from './instances/index.js';\nimport type { InitializationConfiguration, InstanceState } from './types.js';\n\nexport { defaultConfigurations };\n\n/**\n * Utility type for inferring and extracting an instance type from an initialization configuration.\n */\ntype ExtractInstance<Config> =\n Config extends InitializationConfiguration<\n infer Instance,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Messenger\n >\n ? Instance\n : never;\n\n/**\n * Utility type for inferring and extracting an instance messenger type from an initialization configuration.\n */\ntype ExtractInstanceMessenger<Config> =\n Config extends InitializationConfiguration<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n infer _Instance,\n infer InferredMessenger\n >\n ? InferredMessenger\n : never;\n\n/**\n * Utility type for inferring and extracting the name of an instance from an initialization configuration.\n */\ntype ExtractName<Config> =\n ExtractInstance<Config> extends { name: infer Name extends string }\n ? Name\n : never;\n\ntype DefaultConfigs = typeof defaultConfigurations;\n\ntype AllDefaultMessengers = ExtractInstanceMessenger<\n DefaultConfigs[keyof DefaultConfigs]\n>;\n\nexport type DefaultInstances = {\n [Key in keyof DefaultConfigs as ExtractName<\n DefaultConfigs[Key]\n >]: ExtractInstance<DefaultConfigs[Key]>;\n};\n\nexport type DefaultActions = MessengerActions<AllDefaultMessengers>;\n\nexport type DefaultEvents = MessengerEvents<AllDefaultMessengers>;\n\nexport type RootMessenger<\n AllowedActions extends ActionConstraint,\n AllowedEvents extends EventConstraint,\n> = Messenger<'Root', AllowedActions, AllowedEvents>;\n\nexport type DefaultState = {\n [Key in keyof DefaultInstances]: InstanceState<DefaultInstances[Key]>;\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initialize = void 0;
4
- const defaults_1 = require("./defaults.cjs");
4
+ const defaults_js_1 = require("./defaults.cjs");
5
5
  /**
6
6
  * Initialize all instances based on th default configurations and any additional configurations specified in `options`.
7
7
  *
@@ -11,7 +11,7 @@ const defaults_1 = require("./defaults.cjs");
11
11
  function initialize(options) {
12
12
  const { messenger, state = {}, initializationConfigurations = [], instanceOptions, } = options;
13
13
  const overriddenConfiguration = initializationConfigurations.map((config) => config.name);
14
- const configurationEntries = initializationConfigurations.concat(Object.values(defaults_1.defaultConfigurations).filter((config) => !overriddenConfiguration.includes(config.name)));
14
+ const configurationEntries = initializationConfigurations.concat(Object.values(defaults_js_1.defaultConfigurations).filter((config) => !overriddenConfiguration.includes(config.name)));
15
15
  const instances = {};
16
16
  for (const config of configurationEntries) {
17
17
  const { name } = config;
@@ -1 +1 @@
1
- {"version":3,"file":"initialization.cjs","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":";;;AAMA,6CAAkE;AAOlE;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,OAA0B;IACnD,MAAM,EACJ,SAAS,EACT,KAAK,GAAG,EAAE,EACV,4BAA4B,GAAG,EAAE,EACjC,eAAe,GAChB,GAAG,OAAO,CAAC;IAEZ,MAAM,uBAAuB,GAAG,4BAA4B,CAAC,GAAG,CAC9D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CACxB,CAAC;IAEF,MAAM,oBAAoB,GAAG,4BAA4B,CAAC,MAAM,CAC9D,MAAM,CAAC,MAAM,CAAC,gCAAqB,CAAC,CAAC,MAAM,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CACR,CACrD,CAAC;IAEF,MAAM,SAAS,GAA4B,EAAE,CAAC;IAE9C,KAAK,MAAM,MAAM,IAAI,oBAAoB,EAAE,CAAC;QAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAEzD,MAAM,aAAa,GACjB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAmC,CAAC;QAErF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;YAC3B,8CAA8C;YAC9C,KAAK,EAAE,aAAsB;YAC7B,SAAS,EAAE,iBAAiB;YAC5B,OAAO,EAAE,eAAe,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE;SAChD,CAAC,CAAC;QAEH,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,OAAO,SAA6B,CAAC;AACvC,CAAC;AAzCD,gCAyCC","sourcesContent":["import type { InstanceSpecificOptions, WalletOptions } from '../types';\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n} from './defaults';\nimport { defaultConfigurations, RootMessenger } from './defaults';\nimport { InitializationConfiguration } from './types';\n\ntype InitializeOptions = WalletOptions & {\n messenger: RootMessenger<DefaultActions, DefaultEvents>;\n};\n\n/**\n * Initialize all instances based on th default configurations and any additional configurations specified in `options`.\n *\n * @param options - The wallet options.\n * @returns A map containing the instances.\n */\nexport function initialize(options: InitializeOptions): DefaultInstances {\n const {\n messenger,\n state = {},\n initializationConfigurations = [],\n instanceOptions,\n } = options;\n\n const overriddenConfiguration = initializationConfigurations.map(\n (config) => config.name,\n );\n\n const configurationEntries = initializationConfigurations.concat(\n Object.values(defaultConfigurations).filter(\n (config) => !overriddenConfiguration.includes(config.name),\n ) as InitializationConfiguration<unknown, unknown>[],\n );\n\n const instances: Record<string, unknown> = {};\n\n for (const config of configurationEntries) {\n const { name } = config;\n\n const instanceState = state[name];\n\n const instanceMessenger = config.getMessenger(messenger);\n\n const camelCaseName =\n `${name.charAt(0).toLowerCase()}${name.slice(1)}` as keyof InstanceSpecificOptions;\n\n const instance = config.init({\n // TODO: Consider whether this can be improved\n state: instanceState as never,\n messenger: instanceMessenger,\n options: instanceOptions?.[camelCaseName] ?? {},\n });\n\n instances[name] = instance;\n }\n\n return instances as DefaultInstances;\n}\n"]}
1
+ {"version":3,"file":"initialization.cjs","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":";;;AAMA,gDAAqE;AAOrE;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,OAA0B;IACnD,MAAM,EACJ,SAAS,EACT,KAAK,GAAG,EAAE,EACV,4BAA4B,GAAG,EAAE,EACjC,eAAe,GAChB,GAAG,OAAO,CAAC;IAEZ,MAAM,uBAAuB,GAAG,4BAA4B,CAAC,GAAG,CAC9D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CACxB,CAAC;IAEF,MAAM,oBAAoB,GAAG,4BAA4B,CAAC,MAAM,CAC9D,MAAM,CAAC,MAAM,CAAC,mCAAqB,CAAC,CAAC,MAAM,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CACR,CACrD,CAAC;IAEF,MAAM,SAAS,GAA4B,EAAE,CAAC;IAE9C,KAAK,MAAM,MAAM,IAAI,oBAAoB,EAAE,CAAC;QAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAEzD,MAAM,aAAa,GACjB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAmC,CAAC;QAErF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;YAC3B,8CAA8C;YAC9C,KAAK,EAAE,aAAsB;YAC7B,SAAS,EAAE,iBAAiB;YAC5B,OAAO,EAAE,eAAe,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE;SAChD,CAAC,CAAC;QAEH,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,OAAO,SAA6B,CAAC;AACvC,CAAC;AAzCD,gCAyCC","sourcesContent":["import type { InstanceSpecificOptions, WalletOptions } from '../types.js';\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n} from './defaults.js';\nimport { defaultConfigurations, RootMessenger } from './defaults.js';\nimport { InitializationConfiguration } from './types.js';\n\ntype InitializeOptions = WalletOptions & {\n messenger: RootMessenger<DefaultActions, DefaultEvents>;\n};\n\n/**\n * Initialize all instances based on th default configurations and any additional configurations specified in `options`.\n *\n * @param options - The wallet options.\n * @returns A map containing the instances.\n */\nexport function initialize(options: InitializeOptions): DefaultInstances {\n const {\n messenger,\n state = {},\n initializationConfigurations = [],\n instanceOptions,\n } = options;\n\n const overriddenConfiguration = initializationConfigurations.map(\n (config) => config.name,\n );\n\n const configurationEntries = initializationConfigurations.concat(\n Object.values(defaultConfigurations).filter(\n (config) => !overriddenConfiguration.includes(config.name),\n ) as InitializationConfiguration<unknown, unknown>[],\n );\n\n const instances: Record<string, unknown> = {};\n\n for (const config of configurationEntries) {\n const { name } = config;\n\n const instanceState = state[name];\n\n const instanceMessenger = config.getMessenger(messenger);\n\n const camelCaseName =\n `${name.charAt(0).toLowerCase()}${name.slice(1)}` as keyof InstanceSpecificOptions;\n\n const instance = config.init({\n // TODO: Consider whether this can be improved\n state: instanceState as never,\n messenger: instanceMessenger,\n options: instanceOptions?.[camelCaseName] ?? {},\n });\n\n instances[name] = instance;\n }\n\n return instances as DefaultInstances;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initialization.d.cts","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,aAAa,EAAE,qBAAiB;AACvE,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,uBAAmB;AACpB,OAAO,EAAyB,aAAa,EAAE,uBAAmB;AAGlE,KAAK,iBAAiB,GAAG,aAAa,GAAG;IACvC,SAAS,EAAE,aAAa,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAyCvE"}
1
+ {"version":3,"file":"initialization.d.cts","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,aAAa,EAAE,qBAAoB;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,uBAAsB;AACvB,OAAO,EAAyB,aAAa,EAAE,uBAAsB;AAGrE,KAAK,iBAAiB,GAAG,aAAa,GAAG;IACvC,SAAS,EAAE,aAAa,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAyCvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"initialization.d.mts","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,aAAa,EAAE,qBAAiB;AACvE,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,uBAAmB;AACpB,OAAO,EAAyB,aAAa,EAAE,uBAAmB;AAGlE,KAAK,iBAAiB,GAAG,aAAa,GAAG;IACvC,SAAS,EAAE,aAAa,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAyCvE"}
1
+ {"version":3,"file":"initialization.d.mts","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,aAAa,EAAE,qBAAoB;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,uBAAsB;AACvB,OAAO,EAAyB,aAAa,EAAE,uBAAsB;AAGrE,KAAK,iBAAiB,GAAG,aAAa,GAAG;IACvC,SAAS,EAAE,aAAa,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAyCvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"initialization.mjs","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAiB,uBAAmB;AAOlE;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAA0B;IACnD,MAAM,EACJ,SAAS,EACT,KAAK,GAAG,EAAE,EACV,4BAA4B,GAAG,EAAE,EACjC,eAAe,GAChB,GAAG,OAAO,CAAC;IAEZ,MAAM,uBAAuB,GAAG,4BAA4B,CAAC,GAAG,CAC9D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CACxB,CAAC;IAEF,MAAM,oBAAoB,GAAG,4BAA4B,CAAC,MAAM,CAC9D,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,MAAM,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CACR,CACrD,CAAC;IAEF,MAAM,SAAS,GAA4B,EAAE,CAAC;IAE9C,KAAK,MAAM,MAAM,IAAI,oBAAoB,EAAE,CAAC;QAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAEzD,MAAM,aAAa,GACjB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAmC,CAAC;QAErF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;YAC3B,8CAA8C;YAC9C,KAAK,EAAE,aAAsB;YAC7B,SAAS,EAAE,iBAAiB;YAC5B,OAAO,EAAE,eAAe,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE;SAChD,CAAC,CAAC;QAEH,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,OAAO,SAA6B,CAAC;AACvC,CAAC","sourcesContent":["import type { InstanceSpecificOptions, WalletOptions } from '../types';\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n} from './defaults';\nimport { defaultConfigurations, RootMessenger } from './defaults';\nimport { InitializationConfiguration } from './types';\n\ntype InitializeOptions = WalletOptions & {\n messenger: RootMessenger<DefaultActions, DefaultEvents>;\n};\n\n/**\n * Initialize all instances based on th default configurations and any additional configurations specified in `options`.\n *\n * @param options - The wallet options.\n * @returns A map containing the instances.\n */\nexport function initialize(options: InitializeOptions): DefaultInstances {\n const {\n messenger,\n state = {},\n initializationConfigurations = [],\n instanceOptions,\n } = options;\n\n const overriddenConfiguration = initializationConfigurations.map(\n (config) => config.name,\n );\n\n const configurationEntries = initializationConfigurations.concat(\n Object.values(defaultConfigurations).filter(\n (config) => !overriddenConfiguration.includes(config.name),\n ) as InitializationConfiguration<unknown, unknown>[],\n );\n\n const instances: Record<string, unknown> = {};\n\n for (const config of configurationEntries) {\n const { name } = config;\n\n const instanceState = state[name];\n\n const instanceMessenger = config.getMessenger(messenger);\n\n const camelCaseName =\n `${name.charAt(0).toLowerCase()}${name.slice(1)}` as keyof InstanceSpecificOptions;\n\n const instance = config.init({\n // TODO: Consider whether this can be improved\n state: instanceState as never,\n messenger: instanceMessenger,\n options: instanceOptions?.[camelCaseName] ?? {},\n });\n\n instances[name] = instance;\n }\n\n return instances as DefaultInstances;\n}\n"]}
1
+ {"version":3,"file":"initialization.mjs","sourceRoot":"","sources":["../../src/initialization/initialization.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAiB,uBAAsB;AAOrE;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAA0B;IACnD,MAAM,EACJ,SAAS,EACT,KAAK,GAAG,EAAE,EACV,4BAA4B,GAAG,EAAE,EACjC,eAAe,GAChB,GAAG,OAAO,CAAC;IAEZ,MAAM,uBAAuB,GAAG,4BAA4B,CAAC,GAAG,CAC9D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CACxB,CAAC;IAEF,MAAM,oBAAoB,GAAG,4BAA4B,CAAC,MAAM,CAC9D,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,MAAM,CACzC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CACR,CACrD,CAAC;IAEF,MAAM,SAAS,GAA4B,EAAE,CAAC;IAE9C,KAAK,MAAM,MAAM,IAAI,oBAAoB,EAAE,CAAC;QAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAEzD,MAAM,aAAa,GACjB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAmC,CAAC;QAErF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;YAC3B,8CAA8C;YAC9C,KAAK,EAAE,aAAsB;YAC7B,SAAS,EAAE,iBAAiB;YAC5B,OAAO,EAAE,eAAe,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE;SAChD,CAAC,CAAC;QAEH,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,OAAO,SAA6B,CAAC;AACvC,CAAC","sourcesContent":["import type { InstanceSpecificOptions, WalletOptions } from '../types.js';\nimport type {\n DefaultActions,\n DefaultEvents,\n DefaultInstances,\n} from './defaults.js';\nimport { defaultConfigurations, RootMessenger } from './defaults.js';\nimport { InitializationConfiguration } from './types.js';\n\ntype InitializeOptions = WalletOptions & {\n messenger: RootMessenger<DefaultActions, DefaultEvents>;\n};\n\n/**\n * Initialize all instances based on th default configurations and any additional configurations specified in `options`.\n *\n * @param options - The wallet options.\n * @returns A map containing the instances.\n */\nexport function initialize(options: InitializeOptions): DefaultInstances {\n const {\n messenger,\n state = {},\n initializationConfigurations = [],\n instanceOptions,\n } = options;\n\n const overriddenConfiguration = initializationConfigurations.map(\n (config) => config.name,\n );\n\n const configurationEntries = initializationConfigurations.concat(\n Object.values(defaultConfigurations).filter(\n (config) => !overriddenConfiguration.includes(config.name),\n ) as InitializationConfiguration<unknown, unknown>[],\n );\n\n const instances: Record<string, unknown> = {};\n\n for (const config of configurationEntries) {\n const { name } = config;\n\n const instanceState = state[name];\n\n const instanceMessenger = config.getMessenger(messenger);\n\n const camelCaseName =\n `${name.charAt(0).toLowerCase()}${name.slice(1)}` as keyof InstanceSpecificOptions;\n\n const instance = config.init({\n // TODO: Consider whether this can be improved\n state: instanceState as never,\n messenger: instanceMessenger,\n options: instanceOptions?.[camelCaseName] ?? {},\n });\n\n instances[name] = instance;\n }\n\n return instances as DefaultInstances;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"accounts-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":";;;AAAA,uEAGuC;AACvC,mDAAgD;AASnC,QAAA,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,wCAAkB,CAAC;QACrB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE;QACrE,MAAM,2BAA2B,GAC/B,IAAI,qBAAS,CAAC;YACZ,SAAS,EAAE,oBAAoB;YAC/B,MAAM;SACP,CAAC,CAAC;QAEL,MAAM,CAAC,QAAQ,CAAC;YACd,SAAS,EAAE,2BAA2B;YACtC,OAAO,EAAE;gBACP,4BAA4B;gBAC5B,qCAAqC;aACtC;YACD,MAAM,EAAE;gBACN,gEAAgE;gBAChE,sEAAsE;gBACtE,gDAAgD;gBAChD,+BAA+B;gBAC/B,4CAA4C;gBAC5C,2CAA2C;gBAC3C,+CAA+C;gBAC/C,8CAA8C;aAC/C;SACF,CAAC,CAAC;QAEH,OAAO,2BAA2B,CAAC;IACrC,CAAC;CACF,CAAC","sourcesContent":["import {\n AccountsController,\n AccountsControllerMessenger,\n} from '@metamask/accounts-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults';\nimport type { InitializationConfiguration } from '../../types';\n\nexport const accountsController: InitializationConfiguration<\n AccountsController,\n AccountsControllerMessenger\n> = {\n name: 'AccountsController',\n init: ({ state, messenger }) =>\n new AccountsController({\n state,\n messenger,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) => {\n const accountsControllerMessenger: AccountsControllerMessenger =\n new Messenger({\n namespace: 'AccountsController',\n parent,\n });\n\n parent.delegate({\n messenger: accountsControllerMessenger,\n actions: [\n 'KeyringController:getState',\n 'KeyringController:getKeyringsByType',\n ],\n events: [\n // AccountsController subscribes to :stateChange internally; the\n // delegation must match until that package migrates to :stateChanged.\n // eslint-disable-next-line no-restricted-syntax\n 'KeyringController:stateChange',\n 'SnapAccountService:accountAssetListUpdated',\n 'SnapAccountService:accountBalancesUpdated',\n 'SnapAccountService:accountTransactionsUpdated',\n 'MultichainNetworkController:networkDidChange',\n ],\n });\n\n return accountsControllerMessenger;\n },\n};\n"]}
1
+ {"version":3,"file":"accounts-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":";;;AAAA,uEAGuC;AACvC,mDAAgD;AASnC,QAAA,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,wCAAkB,CAAC;QACrB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE;QACrE,MAAM,2BAA2B,GAC/B,IAAI,qBAAS,CAAC;YACZ,SAAS,EAAE,oBAAoB;YAC/B,MAAM;SACP,CAAC,CAAC;QAEL,MAAM,CAAC,QAAQ,CAAC;YACd,SAAS,EAAE,2BAA2B;YACtC,OAAO,EAAE;gBACP,4BAA4B;gBAC5B,qCAAqC;aACtC;YACD,MAAM,EAAE;gBACN,gEAAgE;gBAChE,sEAAsE;gBACtE,gDAAgD;gBAChD,+BAA+B;gBAC/B,4CAA4C;gBAC5C,2CAA2C;gBAC3C,+CAA+C;gBAC/C,8CAA8C;aAC/C;SACF,CAAC,CAAC;QAEH,OAAO,2BAA2B,CAAC;IACrC,CAAC;CACF,CAAC","sourcesContent":["import {\n AccountsController,\n AccountsControllerMessenger,\n} from '@metamask/accounts-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults.js';\nimport type { InitializationConfiguration } from '../../types.js';\n\nexport const accountsController: InitializationConfiguration<\n AccountsController,\n AccountsControllerMessenger\n> = {\n name: 'AccountsController',\n init: ({ state, messenger }) =>\n new AccountsController({\n state,\n messenger,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) => {\n const accountsControllerMessenger: AccountsControllerMessenger =\n new Messenger({\n namespace: 'AccountsController',\n parent,\n });\n\n parent.delegate({\n messenger: accountsControllerMessenger,\n actions: [\n 'KeyringController:getState',\n 'KeyringController:getKeyringsByType',\n ],\n events: [\n // AccountsController subscribes to :stateChange internally; the\n // delegation must match until that package migrates to :stateChanged.\n // eslint-disable-next-line no-restricted-syntax\n 'KeyringController:stateChange',\n 'SnapAccountService:accountAssetListUpdated',\n 'SnapAccountService:accountBalancesUpdated',\n 'SnapAccountService:accountTransactionsUpdated',\n 'MultichainNetworkController:networkDidChange',\n ],\n });\n\n return accountsControllerMessenger;\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"accounts-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAQvC,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAoB;AAE/D,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAmC5B,CAAC"}
1
+ {"version":3,"file":"accounts-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAQvC,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAmC5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"accounts-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAQvC,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAoB;AAE/D,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAmC5B,CAAC"}
1
+ {"version":3,"file":"accounts-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAQvC,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAmC5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"accounts-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,sCAAsC;AACvC,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAShD,MAAM,CAAC,MAAM,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,kBAAkB,CAAC;QACrB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE;QACrE,MAAM,2BAA2B,GAC/B,IAAI,SAAS,CAAC;YACZ,SAAS,EAAE,oBAAoB;YAC/B,MAAM;SACP,CAAC,CAAC;QAEL,MAAM,CAAC,QAAQ,CAAC;YACd,SAAS,EAAE,2BAA2B;YACtC,OAAO,EAAE;gBACP,4BAA4B;gBAC5B,qCAAqC;aACtC;YACD,MAAM,EAAE;gBACN,gEAAgE;gBAChE,sEAAsE;gBACtE,gDAAgD;gBAChD,+BAA+B;gBAC/B,4CAA4C;gBAC5C,2CAA2C;gBAC3C,+CAA+C;gBAC/C,8CAA8C;aAC/C;SACF,CAAC,CAAC;QAEH,OAAO,2BAA2B,CAAC;IACrC,CAAC;CACF,CAAC","sourcesContent":["import {\n AccountsController,\n AccountsControllerMessenger,\n} from '@metamask/accounts-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults';\nimport type { InitializationConfiguration } from '../../types';\n\nexport const accountsController: InitializationConfiguration<\n AccountsController,\n AccountsControllerMessenger\n> = {\n name: 'AccountsController',\n init: ({ state, messenger }) =>\n new AccountsController({\n state,\n messenger,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) => {\n const accountsControllerMessenger: AccountsControllerMessenger =\n new Messenger({\n namespace: 'AccountsController',\n parent,\n });\n\n parent.delegate({\n messenger: accountsControllerMessenger,\n actions: [\n 'KeyringController:getState',\n 'KeyringController:getKeyringsByType',\n ],\n events: [\n // AccountsController subscribes to :stateChange internally; the\n // delegation must match until that package migrates to :stateChanged.\n // eslint-disable-next-line no-restricted-syntax\n 'KeyringController:stateChange',\n 'SnapAccountService:accountAssetListUpdated',\n 'SnapAccountService:accountBalancesUpdated',\n 'SnapAccountService:accountTransactionsUpdated',\n 'MultichainNetworkController:networkDidChange',\n ],\n });\n\n return accountsControllerMessenger;\n },\n};\n"]}
1
+ {"version":3,"file":"accounts-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/accounts-controller/accounts-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,sCAAsC;AACvC,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAShD,MAAM,CAAC,MAAM,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,kBAAkB,CAAC;QACrB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE;QACrE,MAAM,2BAA2B,GAC/B,IAAI,SAAS,CAAC;YACZ,SAAS,EAAE,oBAAoB;YAC/B,MAAM;SACP,CAAC,CAAC;QAEL,MAAM,CAAC,QAAQ,CAAC;YACd,SAAS,EAAE,2BAA2B;YACtC,OAAO,EAAE;gBACP,4BAA4B;gBAC5B,qCAAqC;aACtC;YACD,MAAM,EAAE;gBACN,gEAAgE;gBAChE,sEAAsE;gBACtE,gDAAgD;gBAChD,+BAA+B;gBAC/B,4CAA4C;gBAC5C,2CAA2C;gBAC3C,+CAA+C;gBAC/C,8CAA8C;aAC/C;SACF,CAAC,CAAC;QAEH,OAAO,2BAA2B,CAAC;IACrC,CAAC;CACF,CAAC","sourcesContent":["import {\n AccountsController,\n AccountsControllerMessenger,\n} from '@metamask/accounts-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults.js';\nimport type { InitializationConfiguration } from '../../types.js';\n\nexport const accountsController: InitializationConfiguration<\n AccountsController,\n AccountsControllerMessenger\n> = {\n name: 'AccountsController',\n init: ({ state, messenger }) =>\n new AccountsController({\n state,\n messenger,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) => {\n const accountsControllerMessenger: AccountsControllerMessenger =\n new Messenger({\n namespace: 'AccountsController',\n parent,\n });\n\n parent.delegate({\n messenger: accountsControllerMessenger,\n actions: [\n 'KeyringController:getState',\n 'KeyringController:getKeyringsByType',\n ],\n events: [\n // AccountsController subscribes to :stateChange internally; the\n // delegation must match until that package migrates to :stateChanged.\n // eslint-disable-next-line no-restricted-syntax\n 'KeyringController:stateChange',\n 'SnapAccountService:accountAssetListUpdated',\n 'SnapAccountService:accountBalancesUpdated',\n 'SnapAccountService:accountTransactionsUpdated',\n 'MultichainNetworkController:networkDidChange',\n ],\n });\n\n return accountsControllerMessenger;\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"address-book-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":";;;AAAA,+EAG2C;AAC3C,mDAAgD;AAInC,QAAA,qBAAqB,GAG9B;IACF,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,+CAAqB,CAAC;QACxB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,qBAAS,CAAC;QACZ,SAAS,EAAE,uBAAuB;QAClC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n AddressBookController,\n AddressBookControllerMessenger,\n} from '@metamask/address-book-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type { InitializationConfiguration } from '../../types';\n\nexport const addressBookController: InitializationConfiguration<\n AddressBookController,\n AddressBookControllerMessenger\n> = {\n name: 'AddressBookController',\n init: ({ state, messenger }) =>\n new AddressBookController({\n state,\n messenger,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'AddressBookController',\n parent,\n }),\n};\n"]}
1
+ {"version":3,"file":"address-book-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":";;;AAAA,+EAG2C;AAC3C,mDAAgD;AAInC,QAAA,qBAAqB,GAG9B;IACF,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,+CAAqB,CAAC;QACxB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,qBAAS,CAAC;QACZ,SAAS,EAAE,uBAAuB;QAClC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n AddressBookController,\n AddressBookControllerMessenger,\n} from '@metamask/address-book-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type { InitializationConfiguration } from '../../types.js';\n\nexport const addressBookController: InitializationConfiguration<\n AddressBookController,\n AddressBookControllerMessenger\n> = {\n name: 'AddressBookController',\n init: ({ state, messenger }) =>\n new AddressBookController({\n state,\n messenger,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'AddressBookController',\n parent,\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"address-book-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC/B,0CAA0C;AAG3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAoB;AAE/D,eAAO,MAAM,qBAAqB,EAAE,2BAA2B,CAC7D,qBAAqB,EACrB,8BAA8B,CAa/B,CAAC"}
1
+ {"version":3,"file":"address-book-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC/B,0CAA0C;AAG3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,eAAO,MAAM,qBAAqB,EAAE,2BAA2B,CAC7D,qBAAqB,EACrB,8BAA8B,CAa/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"address-book-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC/B,0CAA0C;AAG3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAoB;AAE/D,eAAO,MAAM,qBAAqB,EAAE,2BAA2B,CAC7D,qBAAqB,EACrB,8BAA8B,CAa/B,CAAC"}
1
+ {"version":3,"file":"address-book-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC/B,0CAA0C;AAG3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,eAAO,MAAM,qBAAqB,EAAE,2BAA2B,CAC7D,qBAAqB,EACrB,8BAA8B,CAa/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"address-book-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,0CAA0C;AAC3C,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAIhD,MAAM,CAAC,MAAM,qBAAqB,GAG9B;IACF,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,qBAAqB,CAAC;QACxB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,SAAS,CAAC;QACZ,SAAS,EAAE,uBAAuB;QAClC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n AddressBookController,\n AddressBookControllerMessenger,\n} from '@metamask/address-book-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type { InitializationConfiguration } from '../../types';\n\nexport const addressBookController: InitializationConfiguration<\n AddressBookController,\n AddressBookControllerMessenger\n> = {\n name: 'AddressBookController',\n init: ({ state, messenger }) =>\n new AddressBookController({\n state,\n messenger,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'AddressBookController',\n parent,\n }),\n};\n"]}
1
+ {"version":3,"file":"address-book-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/address-book-controller/address-book-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,0CAA0C;AAC3C,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAIhD,MAAM,CAAC,MAAM,qBAAqB,GAG9B;IACF,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAC7B,IAAI,qBAAqB,CAAC;QACxB,KAAK;QACL,SAAS;KACV,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,SAAS,CAAC;QACZ,SAAS,EAAE,uBAAuB;QAClC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n AddressBookController,\n AddressBookControllerMessenger,\n} from '@metamask/address-book-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type { InitializationConfiguration } from '../../types.js';\n\nexport const addressBookController: InitializationConfiguration<\n AddressBookController,\n AddressBookControllerMessenger\n> = {\n name: 'AddressBookController',\n init: ({ state, messenger }) =>\n new AddressBookController({\n state,\n messenger,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'AddressBookController',\n parent,\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"approval-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":";;;AAAA,uEAGuC;AACvC,iEAA0D;AAC1D,mDAAgD;AAIhD;;;;;;;;;GASG;AACH,MAAM,yCAAyC,GAAG;IAChD,+BAAY,CAAC,YAAY;IACzB,+BAAY,CAAC,gBAAgB;IAC7B,+BAAY,CAAC,WAAW;IACxB,+BAAY,CAAC,UAAU;IACvB,+BAAY,CAAC,yBAAyB;IACtC,+BAAY,CAAC,UAAU;CACxB,CAAC;AAEW,QAAA,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CACtC,IAAI,wCAAkB,CAAC;QACrB,KAAK;QACL,SAAS;QACT,mBAAmB,EACjB,OAAO,CAAC,mBAAmB,IAAI,CAAC,GAAS,EAAE,CAAC,SAAS,CAAC;QACxD,6BAA6B,EAC3B,OAAO,CAAC,6BAA6B;YACrC,yCAAyC;KAC5C,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,qBAAS,CAAC;QACZ,SAAS,EAAE,oBAAoB;QAC/B,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ApprovalController,\n ApprovalControllerMessenger,\n} from '@metamask/approval-controller';\nimport { ApprovalType } from '@metamask/controller-utils';\nimport { Messenger } from '@metamask/messenger';\n\nimport { InitializationConfiguration } from '../../types';\n\n/**\n * Approval types that are exempt from per-origin rate limiting, so more than one\n * request of the same type can be pending at once. These are the common EVM\n * types: signing, transactions, watch-asset, and encryption.\n *\n * Clients can replace this list via\n * `instanceOptions.approvalController.typesExcludedFromRateLimiting` — the\n * extension and mobile pass their own. `snap_dialog` will be added here once the\n * wallet wires `SnapController`.\n */\nconst DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING = [\n ApprovalType.PersonalSign,\n ApprovalType.EthSignTypedData,\n ApprovalType.Transaction,\n ApprovalType.WatchAsset,\n ApprovalType.EthGetEncryptionPublicKey,\n ApprovalType.EthDecrypt,\n];\n\nexport const approvalController: InitializationConfiguration<\n ApprovalController,\n ApprovalControllerMessenger\n> = {\n name: 'ApprovalController',\n init: ({ state, messenger, options }) =>\n new ApprovalController({\n state,\n messenger,\n showApprovalRequest:\n options.showApprovalRequest ?? ((): void => undefined),\n typesExcludedFromRateLimiting:\n options.typesExcludedFromRateLimiting ??\n DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'ApprovalController',\n parent,\n }),\n};\n"]}
1
+ {"version":3,"file":"approval-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":";;;AAAA,uEAGuC;AACvC,iEAA0D;AAC1D,mDAAgD;AAIhD;;;;;;;;;GASG;AACH,MAAM,yCAAyC,GAAG;IAChD,+BAAY,CAAC,YAAY;IACzB,+BAAY,CAAC,gBAAgB;IAC7B,+BAAY,CAAC,WAAW;IACxB,+BAAY,CAAC,UAAU;IACvB,+BAAY,CAAC,yBAAyB;IACtC,+BAAY,CAAC,UAAU;CACxB,CAAC;AAEW,QAAA,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CACtC,IAAI,wCAAkB,CAAC;QACrB,KAAK;QACL,SAAS;QACT,mBAAmB,EACjB,OAAO,CAAC,mBAAmB,IAAI,CAAC,GAAS,EAAE,CAAC,SAAS,CAAC;QACxD,6BAA6B,EAC3B,OAAO,CAAC,6BAA6B;YACrC,yCAAyC;KAC5C,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,qBAAS,CAAC;QACZ,SAAS,EAAE,oBAAoB;QAC/B,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ApprovalController,\n ApprovalControllerMessenger,\n} from '@metamask/approval-controller';\nimport { ApprovalType } from '@metamask/controller-utils';\nimport { Messenger } from '@metamask/messenger';\n\nimport { InitializationConfiguration } from '../../types.js';\n\n/**\n * Approval types that are exempt from per-origin rate limiting, so more than one\n * request of the same type can be pending at once. These are the common EVM\n * types: signing, transactions, watch-asset, and encryption.\n *\n * Clients can replace this list via\n * `instanceOptions.approvalController.typesExcludedFromRateLimiting` — the\n * extension and mobile pass their own. `snap_dialog` will be added here once the\n * wallet wires `SnapController`.\n */\nconst DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING = [\n ApprovalType.PersonalSign,\n ApprovalType.EthSignTypedData,\n ApprovalType.Transaction,\n ApprovalType.WatchAsset,\n ApprovalType.EthGetEncryptionPublicKey,\n ApprovalType.EthDecrypt,\n];\n\nexport const approvalController: InitializationConfiguration<\n ApprovalController,\n ApprovalControllerMessenger\n> = {\n name: 'ApprovalController',\n init: ({ state, messenger, options }) =>\n new ApprovalController({\n state,\n messenger,\n showApprovalRequest:\n options.showApprovalRequest ?? ((): void => undefined),\n typesExcludedFromRateLimiting:\n options.typesExcludedFromRateLimiting ??\n DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'ApprovalController',\n parent,\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"approval-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAIvC,OAAO,EAAE,2BAA2B,EAAE,wBAAoB;AAqB1D,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAkB5B,CAAC"}
1
+ {"version":3,"file":"approval-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAIvC,OAAO,EAAE,2BAA2B,EAAE,wBAAuB;AAqB7D,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAkB5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"approval-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAIvC,OAAO,EAAE,2BAA2B,EAAE,wBAAoB;AAqB1D,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAkB5B,CAAC"}
1
+ {"version":3,"file":"approval-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC5B,sCAAsC;AAIvC,OAAO,EAAE,2BAA2B,EAAE,wBAAuB;AAqB7D,eAAO,MAAM,kBAAkB,EAAE,2BAA2B,CAC1D,kBAAkB,EAClB,2BAA2B,CAkB5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"approval-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,sCAAsC;AACvC,OAAO,EAAE,YAAY,EAAE,mCAAmC;AAC1D,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAIhD;;;;;;;;;GASG;AACH,MAAM,yCAAyC,GAAG;IAChD,YAAY,CAAC,YAAY;IACzB,YAAY,CAAC,gBAAgB;IAC7B,YAAY,CAAC,WAAW;IACxB,YAAY,CAAC,UAAU;IACvB,YAAY,CAAC,yBAAyB;IACtC,YAAY,CAAC,UAAU;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CACtC,IAAI,kBAAkB,CAAC;QACrB,KAAK;QACL,SAAS;QACT,mBAAmB,EACjB,OAAO,CAAC,mBAAmB,IAAI,CAAC,GAAS,EAAE,CAAC,SAAS,CAAC;QACxD,6BAA6B,EAC3B,OAAO,CAAC,6BAA6B;YACrC,yCAAyC;KAC5C,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,SAAS,CAAC;QACZ,SAAS,EAAE,oBAAoB;QAC/B,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ApprovalController,\n ApprovalControllerMessenger,\n} from '@metamask/approval-controller';\nimport { ApprovalType } from '@metamask/controller-utils';\nimport { Messenger } from '@metamask/messenger';\n\nimport { InitializationConfiguration } from '../../types';\n\n/**\n * Approval types that are exempt from per-origin rate limiting, so more than one\n * request of the same type can be pending at once. These are the common EVM\n * types: signing, transactions, watch-asset, and encryption.\n *\n * Clients can replace this list via\n * `instanceOptions.approvalController.typesExcludedFromRateLimiting` — the\n * extension and mobile pass their own. `snap_dialog` will be added here once the\n * wallet wires `SnapController`.\n */\nconst DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING = [\n ApprovalType.PersonalSign,\n ApprovalType.EthSignTypedData,\n ApprovalType.Transaction,\n ApprovalType.WatchAsset,\n ApprovalType.EthGetEncryptionPublicKey,\n ApprovalType.EthDecrypt,\n];\n\nexport const approvalController: InitializationConfiguration<\n ApprovalController,\n ApprovalControllerMessenger\n> = {\n name: 'ApprovalController',\n init: ({ state, messenger, options }) =>\n new ApprovalController({\n state,\n messenger,\n showApprovalRequest:\n options.showApprovalRequest ?? ((): void => undefined),\n typesExcludedFromRateLimiting:\n options.typesExcludedFromRateLimiting ??\n DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'ApprovalController',\n parent,\n }),\n};\n"]}
1
+ {"version":3,"file":"approval-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/approval-controller/approval-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,sCAAsC;AACvC,OAAO,EAAE,YAAY,EAAE,mCAAmC;AAC1D,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAIhD;;;;;;;;;GASG;AACH,MAAM,yCAAyC,GAAG;IAChD,YAAY,CAAC,YAAY;IACzB,YAAY,CAAC,gBAAgB;IAC7B,YAAY,CAAC,WAAW;IACxB,YAAY,CAAC,UAAU;IACvB,YAAY,CAAC,yBAAyB;IACtC,YAAY,CAAC,UAAU;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAG3B;IACF,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CACtC,IAAI,kBAAkB,CAAC;QACrB,KAAK;QACL,SAAS;QACT,mBAAmB,EACjB,OAAO,CAAC,mBAAmB,IAAI,CAAC,GAAS,EAAE,CAAC,SAAS,CAAC;QACxD,6BAA6B,EAC3B,OAAO,CAAC,6BAA6B;YACrC,yCAAyC;KAC5C,CAAC;IACJ,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,IAAI,SAAS,CAAC;QACZ,SAAS,EAAE,oBAAoB;QAC/B,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ApprovalController,\n ApprovalControllerMessenger,\n} from '@metamask/approval-controller';\nimport { ApprovalType } from '@metamask/controller-utils';\nimport { Messenger } from '@metamask/messenger';\n\nimport { InitializationConfiguration } from '../../types.js';\n\n/**\n * Approval types that are exempt from per-origin rate limiting, so more than one\n * request of the same type can be pending at once. These are the common EVM\n * types: signing, transactions, watch-asset, and encryption.\n *\n * Clients can replace this list via\n * `instanceOptions.approvalController.typesExcludedFromRateLimiting` — the\n * extension and mobile pass their own. `snap_dialog` will be added here once the\n * wallet wires `SnapController`.\n */\nconst DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING = [\n ApprovalType.PersonalSign,\n ApprovalType.EthSignTypedData,\n ApprovalType.Transaction,\n ApprovalType.WatchAsset,\n ApprovalType.EthGetEncryptionPublicKey,\n ApprovalType.EthDecrypt,\n];\n\nexport const approvalController: InitializationConfiguration<\n ApprovalController,\n ApprovalControllerMessenger\n> = {\n name: 'ApprovalController',\n init: ({ state, messenger, options }) =>\n new ApprovalController({\n state,\n messenger,\n showApprovalRequest:\n options.showApprovalRequest ?? ((): void => undefined),\n typesExcludedFromRateLimiting:\n options.typesExcludedFromRateLimiting ??\n DEFAULT_TYPES_EXCLUDED_FROM_RATE_LIMITING,\n }),\n getMessenger: (parent) =>\n new Messenger({\n namespace: 'ApprovalController',\n parent,\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"connectivity-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":";;;AAAA,+EAG2C;AAC3C,mDAAgD;AASnC,QAAA,sBAAsB,GAG/B;IACF,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAC/B,IAAI,gDAAsB,CAAC;QACzB,SAAS;QACT,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;KACjD,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE,CACrE,IAAI,qBAAS,CAAC;QACZ,SAAS,EAAE,wBAAwB;QACnC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ConnectivityController,\n ConnectivityControllerMessenger,\n} from '@metamask/connectivity-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults';\nimport type { InitializationConfiguration } from '../../types';\n\nexport const connectivityController: InitializationConfiguration<\n ConnectivityController,\n ConnectivityControllerMessenger\n> = {\n name: 'ConnectivityController',\n init: ({ messenger, options }) =>\n new ConnectivityController({\n messenger,\n connectivityAdapter: options.connectivityAdapter,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) =>\n new Messenger({\n namespace: 'ConnectivityController',\n parent,\n }),\n};\n"]}
1
+ {"version":3,"file":"connectivity-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":";;;AAAA,+EAG2C;AAC3C,mDAAgD;AASnC,QAAA,sBAAsB,GAG/B;IACF,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAC/B,IAAI,gDAAsB,CAAC;QACzB,SAAS;QACT,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;KACjD,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE,CACrE,IAAI,qBAAS,CAAC;QACZ,SAAS,EAAE,wBAAwB;QACnC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ConnectivityController,\n ConnectivityControllerMessenger,\n} from '@metamask/connectivity-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults.js';\nimport type { InitializationConfiguration } from '../../types.js';\n\nexport const connectivityController: InitializationConfiguration<\n ConnectivityController,\n ConnectivityControllerMessenger\n> = {\n name: 'ConnectivityController',\n init: ({ messenger, options }) =>\n new ConnectivityController({\n messenger,\n connectivityAdapter: options.connectivityAdapter,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) =>\n new Messenger({\n namespace: 'ConnectivityController',\n parent,\n }),\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"connectivity-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAChC,0CAA0C;AAQ3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAoB;AAE/D,eAAO,MAAM,sBAAsB,EAAE,2BAA2B,CAC9D,sBAAsB,EACtB,+BAA+B,CAahC,CAAC"}
1
+ {"version":3,"file":"connectivity-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAChC,0CAA0C;AAQ3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,eAAO,MAAM,sBAAsB,EAAE,2BAA2B,CAC9D,sBAAsB,EACtB,+BAA+B,CAahC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"connectivity-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAChC,0CAA0C;AAQ3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAoB;AAE/D,eAAO,MAAM,sBAAsB,EAAE,2BAA2B,CAC9D,sBAAsB,EACtB,+BAA+B,CAahC,CAAC"}
1
+ {"version":3,"file":"connectivity-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAChC,0CAA0C;AAQ3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,eAAO,MAAM,sBAAsB,EAAE,2BAA2B,CAC9D,sBAAsB,EACtB,+BAA+B,CAahC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"connectivity-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEvB,0CAA0C;AAC3C,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAShD,MAAM,CAAC,MAAM,sBAAsB,GAG/B;IACF,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAC/B,IAAI,sBAAsB,CAAC;QACzB,SAAS;QACT,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;KACjD,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE,CACrE,IAAI,SAAS,CAAC;QACZ,SAAS,EAAE,wBAAwB;QACnC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ConnectivityController,\n ConnectivityControllerMessenger,\n} from '@metamask/connectivity-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults';\nimport type { InitializationConfiguration } from '../../types';\n\nexport const connectivityController: InitializationConfiguration<\n ConnectivityController,\n ConnectivityControllerMessenger\n> = {\n name: 'ConnectivityController',\n init: ({ messenger, options }) =>\n new ConnectivityController({\n messenger,\n connectivityAdapter: options.connectivityAdapter,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) =>\n new Messenger({\n namespace: 'ConnectivityController',\n parent,\n }),\n};\n"]}
1
+ {"version":3,"file":"connectivity-controller.mjs","sourceRoot":"","sources":["../../../../src/initialization/instances/connectivity-controller/connectivity-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEvB,0CAA0C;AAC3C,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAShD,MAAM,CAAC,MAAM,sBAAsB,GAG/B;IACF,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAC/B,IAAI,sBAAsB,CAAC;QACzB,SAAS;QACT,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;KACjD,CAAC;IACJ,YAAY,EAAE,CAAC,MAAoD,EAAE,EAAE,CACrE,IAAI,SAAS,CAAC;QACZ,SAAS,EAAE,wBAAwB;QACnC,MAAM;KACP,CAAC;CACL,CAAC","sourcesContent":["import {\n ConnectivityController,\n ConnectivityControllerMessenger,\n} from '@metamask/connectivity-controller';\nimport { Messenger } from '@metamask/messenger';\n\nimport type {\n DefaultActions,\n DefaultEvents,\n RootMessenger,\n} from '../../defaults.js';\nimport type { InitializationConfiguration } from '../../types.js';\n\nexport const connectivityController: InitializationConfiguration<\n ConnectivityController,\n ConnectivityControllerMessenger\n> = {\n name: 'ConnectivityController',\n init: ({ messenger, options }) =>\n new ConnectivityController({\n messenger,\n connectivityAdapter: options.connectivityAdapter,\n }),\n getMessenger: (parent: RootMessenger<DefaultActions, DefaultEvents>) =>\n new Messenger({\n namespace: 'ConnectivityController',\n parent,\n }),\n};\n"]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gasFeeController = void 0;
4
+ const gas_fee_controller_1 = require("@metamask/gas-fee-controller");
5
+ const messenger_1 = require("@metamask/messenger");
6
+ const GAS_API_BASE_URL = 'https://gas.api.cx.metamask.io';
7
+ // The controller substitutes `<chain_id>` with the decimal chain ID per request.
8
+ const DEFAULT_EIP1559_API_ENDPOINT = `${GAS_API_BASE_URL}/networks/<chain_id>/suggestedGasFees`;
9
+ const DEFAULT_LEGACY_API_ENDPOINT = `${GAS_API_BASE_URL}/networks/<chain_id>/gasPrices`;
10
+ exports.gasFeeController = {
11
+ name: 'GasFeeController',
12
+ init: ({ state, messenger, options }) => {
13
+ const { clientId, EIP1559APIEndpoint = DEFAULT_EIP1559_API_ENDPOINT, legacyAPIEndpoint = DEFAULT_LEGACY_API_ENDPOINT, interval, getCurrentNetworkLegacyGasAPICompatibility = () => false, getCurrentAccountEIP1559Compatibility = () => true, } = options;
14
+ return new gas_fee_controller_1.GasFeeController({
15
+ messenger,
16
+ state,
17
+ interval,
18
+ EIP1559APIEndpoint,
19
+ legacyAPIEndpoint,
20
+ clientId,
21
+ getCurrentNetworkLegacyGasAPICompatibility,
22
+ getCurrentAccountEIP1559Compatibility,
23
+ // Built from `NetworkController`, which the controller expects as direct
24
+ // callbacks rather than messenger actions.
25
+ getProvider: () => {
26
+ const { selectedNetworkClientId } = messenger.call('NetworkController:getState');
27
+ // The client's provider proxy lacks `setTarget`, which `ProviderProxy`
28
+ // nominally requires but `GasFeeController` never calls.
29
+ return messenger.call('NetworkController:getNetworkClientById', selectedNetworkClientId).provider;
30
+ },
31
+ getCurrentNetworkEIP1559Compatibility: async () => Boolean(await messenger.call('NetworkController:getEIP1559Compatibility')),
32
+ });
33
+ },
34
+ getMessenger: (parent) => {
35
+ const messenger = new messenger_1.Messenger({
36
+ namespace: 'GasFeeController',
37
+ parent,
38
+ });
39
+ parent.delegate({
40
+ messenger,
41
+ actions: [
42
+ 'NetworkController:getEIP1559Compatibility',
43
+ 'NetworkController:getNetworkClientById',
44
+ 'NetworkController:getState',
45
+ ],
46
+ events: ['NetworkController:networkDidChange'],
47
+ });
48
+ return messenger;
49
+ },
50
+ };
51
+ //# sourceMappingURL=gas-fee-controller.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gas-fee-controller.cjs","sourceRoot":"","sources":["../../../../src/initialization/instances/gas-fee-controller/gas-fee-controller.ts"],"names":[],"mappings":";;;AACA,qEAAgE;AAChE,mDAAgD;AAOhD,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAE1D,iFAAiF;AACjF,MAAM,4BAA4B,GAAG,GAAG,gBAAgB,uCAAuC,CAAC;AAChG,MAAM,2BAA2B,GAAG,GAAG,gBAAgB,gCAAgC,CAAC;AAE3E,QAAA,gBAAgB,GAGzB;IACF,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,MAAM,EACJ,QAAQ,EACR,kBAAkB,GAAG,4BAA4B,EACjD,iBAAiB,GAAG,2BAA2B,EAC/C,QAAQ,EACR,0CAA0C,GAAG,GAAY,EAAE,CAAC,KAAK,EACjE,qCAAqC,GAAG,GAAY,EAAE,CAAC,IAAI,GAC5D,GAAG,OAAO,CAAC;QAEZ,OAAO,IAAI,qCAAgB,CAAC;YAC1B,SAAS;YACT,KAAK;YACL,QAAQ;YACR,kBAAkB;YAClB,iBAAiB;YACjB,QAAQ;YACR,0CAA0C;YAC1C,qCAAqC;YACrC,yEAAyE;YACzE,2CAA2C;YAC3C,WAAW,EAAE,GAAkB,EAAE;gBAC/B,MAAM,EAAE,uBAAuB,EAAE,GAAG,SAAS,CAAC,IAAI,CAChD,4BAA4B,CAC7B,CAAC;gBACF,uEAAuE;gBACvE,yDAAyD;gBACzD,OAAO,SAAS,CAAC,IAAI,CACnB,wCAAwC,EACxC,uBAAuB,CACxB,CAAC,QAAyB,CAAC;YAC9B,CAAC;YACD,qCAAqC,EAAE,KAAK,IAAI,EAAE,CAChD,OAAO,CACL,MAAM,SAAS,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAClE;SACJ,CAAC,CAAC;IACL,CAAC;IACD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;QACvB,MAAM,SAAS,GAAoB,IAAI,qBAAS,CAAC;YAC/C,SAAS,EAAE,kBAAkB;YAC7B,MAAM;SACP,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC;YACd,SAAS;YACT,OAAO,EAAE;gBACP,2CAA2C;gBAC3C,wCAAwC;gBACxC,4BAA4B;aAC7B;YACD,MAAM,EAAE,CAAC,oCAAoC,CAAC;SAC/C,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["import type { GasFeeMessenger } from '@metamask/gas-fee-controller';\nimport { GasFeeController } from '@metamask/gas-fee-controller';\nimport { Messenger } from '@metamask/messenger';\nimport type { ProviderProxy } from '@metamask/network-controller';\n\nimport type { InitializationConfiguration } from '../../types.js';\n\nexport type { GasFeeControllerInstanceOptions } from './types.js';\n\nconst GAS_API_BASE_URL = 'https://gas.api.cx.metamask.io';\n\n// The controller substitutes `<chain_id>` with the decimal chain ID per request.\nconst DEFAULT_EIP1559_API_ENDPOINT = `${GAS_API_BASE_URL}/networks/<chain_id>/suggestedGasFees`;\nconst DEFAULT_LEGACY_API_ENDPOINT = `${GAS_API_BASE_URL}/networks/<chain_id>/gasPrices`;\n\nexport const gasFeeController: InitializationConfiguration<\n GasFeeController,\n GasFeeMessenger\n> = {\n name: 'GasFeeController',\n init: ({ state, messenger, options }) => {\n const {\n clientId,\n EIP1559APIEndpoint = DEFAULT_EIP1559_API_ENDPOINT,\n legacyAPIEndpoint = DEFAULT_LEGACY_API_ENDPOINT,\n interval,\n getCurrentNetworkLegacyGasAPICompatibility = (): boolean => false,\n getCurrentAccountEIP1559Compatibility = (): boolean => true,\n } = options;\n\n return new GasFeeController({\n messenger,\n state,\n interval,\n EIP1559APIEndpoint,\n legacyAPIEndpoint,\n clientId,\n getCurrentNetworkLegacyGasAPICompatibility,\n getCurrentAccountEIP1559Compatibility,\n // Built from `NetworkController`, which the controller expects as direct\n // callbacks rather than messenger actions.\n getProvider: (): ProviderProxy => {\n const { selectedNetworkClientId } = messenger.call(\n 'NetworkController:getState',\n );\n // The client's provider proxy lacks `setTarget`, which `ProviderProxy`\n // nominally requires but `GasFeeController` never calls.\n return messenger.call(\n 'NetworkController:getNetworkClientById',\n selectedNetworkClientId,\n ).provider as ProviderProxy;\n },\n getCurrentNetworkEIP1559Compatibility: async () =>\n Boolean(\n await messenger.call('NetworkController:getEIP1559Compatibility'),\n ),\n });\n },\n getMessenger: (parent) => {\n const messenger: GasFeeMessenger = new Messenger({\n namespace: 'GasFeeController',\n parent,\n });\n\n parent.delegate({\n messenger,\n actions: [\n 'NetworkController:getEIP1559Compatibility',\n 'NetworkController:getNetworkClientById',\n 'NetworkController:getState',\n ],\n events: ['NetworkController:networkDidChange'],\n });\n\n return messenger;\n },\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import type { GasFeeMessenger } from "@metamask/gas-fee-controller";
2
+ import { GasFeeController } from "@metamask/gas-fee-controller";
3
+ import type { InitializationConfiguration } from "../../types.cjs";
4
+ export type { GasFeeControllerInstanceOptions } from "./types.cjs";
5
+ export declare const gasFeeController: InitializationConfiguration<GasFeeController, GasFeeMessenger>;
6
+ //# sourceMappingURL=gas-fee-controller.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gas-fee-controller.d.cts","sourceRoot":"","sources":["../../../../src/initialization/instances/gas-fee-controller/gas-fee-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAqC;AACpE,OAAO,EAAE,gBAAgB,EAAE,qCAAqC;AAIhE,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,YAAY,EAAE,+BAA+B,EAAE,oBAAmB;AAQlE,eAAO,MAAM,gBAAgB,EAAE,2BAA2B,CACxD,gBAAgB,EAChB,eAAe,CA2DhB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { GasFeeMessenger } from "@metamask/gas-fee-controller";
2
+ import { GasFeeController } from "@metamask/gas-fee-controller";
3
+ import type { InitializationConfiguration } from "../../types.mjs";
4
+ export type { GasFeeControllerInstanceOptions } from "./types.mjs";
5
+ export declare const gasFeeController: InitializationConfiguration<GasFeeController, GasFeeMessenger>;
6
+ //# sourceMappingURL=gas-fee-controller.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gas-fee-controller.d.mts","sourceRoot":"","sources":["../../../../src/initialization/instances/gas-fee-controller/gas-fee-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,qCAAqC;AACpE,OAAO,EAAE,gBAAgB,EAAE,qCAAqC;AAIhE,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAuB;AAElE,YAAY,EAAE,+BAA+B,EAAE,oBAAmB;AAQlE,eAAO,MAAM,gBAAgB,EAAE,2BAA2B,CACxD,gBAAgB,EAChB,eAAe,CA2DhB,CAAC"}