@metamask-previews/core-backend 7.0.0-preview-d548cc9a9 → 7.0.0-preview-6c0186513

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 (111) hide show
  1. package/dist/ApiPlatformClientService-method-action-types.cjs.map +1 -1
  2. package/dist/ApiPlatformClientService-method-action-types.d.cts.map +1 -1
  3. package/dist/ApiPlatformClientService-method-action-types.d.mts.map +1 -1
  4. package/dist/ApiPlatformClientService-method-action-types.mjs.map +1 -1
  5. package/dist/ApiPlatformClientService.cjs +2 -2
  6. package/dist/ApiPlatformClientService.cjs.map +1 -1
  7. package/dist/ApiPlatformClientService.d.cts.map +1 -1
  8. package/dist/ApiPlatformClientService.d.mts.map +1 -1
  9. package/dist/ApiPlatformClientService.mjs.map +1 -1
  10. package/dist/api/ApiPlatformClient.cjs +15 -15
  11. package/dist/api/ApiPlatformClient.cjs.map +1 -1
  12. package/dist/api/ApiPlatformClient.d.cts.map +1 -1
  13. package/dist/api/ApiPlatformClient.d.mts.map +1 -1
  14. package/dist/api/ApiPlatformClient.mjs.map +1 -1
  15. package/dist/api/accounts/client.cjs +59 -59
  16. package/dist/api/accounts/client.cjs.map +1 -1
  17. package/dist/api/accounts/client.d.cts.map +1 -1
  18. package/dist/api/accounts/client.d.mts.map +1 -1
  19. package/dist/api/accounts/client.mjs.map +1 -1
  20. package/dist/api/accounts/index.cjs +4 -4
  21. package/dist/api/accounts/index.cjs.map +1 -1
  22. package/dist/api/accounts/index.d.cts.map +1 -1
  23. package/dist/api/accounts/index.d.mts.map +1 -1
  24. package/dist/api/accounts/index.mjs.map +1 -1
  25. package/dist/api/accounts/types.cjs.map +1 -1
  26. package/dist/api/accounts/types.d.cts.map +1 -1
  27. package/dist/api/accounts/types.d.mts.map +1 -1
  28. package/dist/api/accounts/types.mjs.map +1 -1
  29. package/dist/api/base-client.cjs +11 -11
  30. package/dist/api/base-client.cjs.map +1 -1
  31. package/dist/api/base-client.d.cts.map +1 -1
  32. package/dist/api/base-client.d.mts.map +1 -1
  33. package/dist/api/base-client.mjs.map +1 -1
  34. package/dist/api/index.cjs +23 -23
  35. package/dist/api/index.cjs.map +1 -1
  36. package/dist/api/index.d.cts.map +1 -1
  37. package/dist/api/index.d.mts.map +1 -1
  38. package/dist/api/index.mjs.map +1 -1
  39. package/dist/api/prices/client.cjs +71 -71
  40. package/dist/api/prices/client.cjs.map +1 -1
  41. package/dist/api/prices/client.d.cts.map +1 -1
  42. package/dist/api/prices/client.d.mts.map +1 -1
  43. package/dist/api/prices/client.mjs.map +1 -1
  44. package/dist/api/prices/index.cjs +2 -2
  45. package/dist/api/prices/index.cjs.map +1 -1
  46. package/dist/api/prices/index.d.cts.map +1 -1
  47. package/dist/api/prices/index.d.mts.map +1 -1
  48. package/dist/api/prices/index.mjs.map +1 -1
  49. package/dist/api/test-utils.cjs +2 -2
  50. package/dist/api/test-utils.cjs.map +1 -1
  51. package/dist/api/test-utils.d.cts.map +1 -1
  52. package/dist/api/test-utils.d.mts.map +1 -1
  53. package/dist/api/test-utils.mjs.map +1 -1
  54. package/dist/api/token/client.cjs +43 -43
  55. package/dist/api/token/client.cjs.map +1 -1
  56. package/dist/api/token/client.d.cts.map +1 -1
  57. package/dist/api/token/client.d.mts.map +1 -1
  58. package/dist/api/token/client.mjs.map +1 -1
  59. package/dist/api/token/index.cjs +2 -2
  60. package/dist/api/token/index.cjs.map +1 -1
  61. package/dist/api/token/index.d.cts.map +1 -1
  62. package/dist/api/token/index.d.mts.map +1 -1
  63. package/dist/api/token/index.mjs.map +1 -1
  64. package/dist/api/tokens/client.cjs +15 -15
  65. package/dist/api/tokens/client.cjs.map +1 -1
  66. package/dist/api/tokens/client.d.cts.map +1 -1
  67. package/dist/api/tokens/client.d.mts.map +1 -1
  68. package/dist/api/tokens/client.mjs.map +1 -1
  69. package/dist/api/tokens/index.cjs +2 -2
  70. package/dist/api/tokens/index.cjs.map +1 -1
  71. package/dist/api/tokens/index.d.cts.map +1 -1
  72. package/dist/api/tokens/index.d.mts.map +1 -1
  73. package/dist/api/tokens/index.mjs.map +1 -1
  74. package/dist/index.cjs +31 -31
  75. package/dist/index.cjs.map +1 -1
  76. package/dist/index.d.cts.map +1 -1
  77. package/dist/index.d.mts.map +1 -1
  78. package/dist/index.mjs.map +1 -1
  79. package/dist/ws/AccountActivityService.cjs +6 -6
  80. package/dist/ws/AccountActivityService.cjs.map +1 -1
  81. package/dist/ws/AccountActivityService.d.cts +1 -1
  82. package/dist/ws/AccountActivityService.d.cts.map +1 -1
  83. package/dist/ws/AccountActivityService.d.mts +1 -1
  84. package/dist/ws/AccountActivityService.d.mts.map +1 -1
  85. package/dist/ws/AccountActivityService.mjs.map +1 -1
  86. package/dist/ws/BackendWebSocketService-method-action-types.cjs.map +1 -1
  87. package/dist/ws/BackendWebSocketService-method-action-types.d.cts.map +1 -1
  88. package/dist/ws/BackendWebSocketService-method-action-types.d.mts.map +1 -1
  89. package/dist/ws/BackendWebSocketService-method-action-types.mjs.map +1 -1
  90. package/dist/ws/BackendWebSocketService.cjs +2 -2
  91. package/dist/ws/BackendWebSocketService.cjs.map +1 -1
  92. package/dist/ws/BackendWebSocketService.d.cts.map +1 -1
  93. package/dist/ws/BackendWebSocketService.d.mts.map +1 -1
  94. package/dist/ws/BackendWebSocketService.mjs.map +1 -1
  95. package/dist/ws/ohlcv/OHLCVService-method-action-types.cjs.map +1 -1
  96. package/dist/ws/ohlcv/OHLCVService-method-action-types.d.cts.map +1 -1
  97. package/dist/ws/ohlcv/OHLCVService-method-action-types.d.mts.map +1 -1
  98. package/dist/ws/ohlcv/OHLCVService-method-action-types.mjs.map +1 -1
  99. package/dist/ws/ohlcv/OHLCVService.cjs +5 -5
  100. package/dist/ws/ohlcv/OHLCVService.cjs.map +1 -1
  101. package/dist/ws/ohlcv/OHLCVService.d.cts +1 -1
  102. package/dist/ws/ohlcv/OHLCVService.d.cts.map +1 -1
  103. package/dist/ws/ohlcv/OHLCVService.d.mts +1 -1
  104. package/dist/ws/ohlcv/OHLCVService.d.mts.map +1 -1
  105. package/dist/ws/ohlcv/OHLCVService.mjs.map +1 -1
  106. package/dist/ws/ohlcv/index.cjs +5 -5
  107. package/dist/ws/ohlcv/index.cjs.map +1 -1
  108. package/dist/ws/ohlcv/index.d.cts.map +1 -1
  109. package/dist/ws/ohlcv/index.d.mts.map +1 -1
  110. package/dist/ws/ohlcv/index.mjs.map +1 -1
  111. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClientService-method-action-types.cjs","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { ApiPlatformClientService } from './ApiPlatformClientService';\n\n/**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\nexport type ApiPlatformClientServiceGetApiPlatformClientAction = {\n type: `ApiPlatformClientService:getApiPlatformClient`;\n handler: ApiPlatformClientService['getApiPlatformClient'];\n};\n\n/**\n * Union of all ApiPlatformClientService action types.\n */\nexport type ApiPlatformClientServiceMethodActions =\n ApiPlatformClientServiceGetApiPlatformClientAction;\n"]}
1
+ {"version":3,"file":"ApiPlatformClientService-method-action-types.cjs","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { ApiPlatformClientService } from './ApiPlatformClientService.js';\n\n/**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\nexport type ApiPlatformClientServiceGetApiPlatformClientAction = {\n type: `ApiPlatformClientService:getApiPlatformClient`;\n handler: ApiPlatformClientService['getApiPlatformClient'];\n};\n\n/**\n * Union of all ApiPlatformClientService action types.\n */\nexport type ApiPlatformClientServiceMethodActions =\n ApiPlatformClientServiceGetApiPlatformClientAction;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClientService-method-action-types.d.cts","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;;;;GAMG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC/D,IAAI,EAAE,+CAA+C,CAAC;IACtD,OAAO,EAAE,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;CAC3D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC/C,kDAAkD,CAAC"}
1
+ {"version":3,"file":"ApiPlatformClientService-method-action-types.d.cts","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAsC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC/D,IAAI,EAAE,+CAA+C,CAAC;IACtD,OAAO,EAAE,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;CAC3D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC/C,kDAAkD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClientService-method-action-types.d.mts","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;;;;GAMG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC/D,IAAI,EAAE,+CAA+C,CAAC;IACtD,OAAO,EAAE,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;CAC3D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC/C,kDAAkD,CAAC"}
1
+ {"version":3,"file":"ApiPlatformClientService-method-action-types.d.mts","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAsC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC/D,IAAI,EAAE,+CAA+C,CAAC;IACtD,OAAO,EAAE,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;CAC3D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC/C,kDAAkD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClientService-method-action-types.mjs","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { ApiPlatformClientService } from './ApiPlatformClientService';\n\n/**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\nexport type ApiPlatformClientServiceGetApiPlatformClientAction = {\n type: `ApiPlatformClientService:getApiPlatformClient`;\n handler: ApiPlatformClientService['getApiPlatformClient'];\n};\n\n/**\n * Union of all ApiPlatformClientService action types.\n */\nexport type ApiPlatformClientServiceMethodActions =\n ApiPlatformClientServiceGetApiPlatformClientAction;\n"]}
1
+ {"version":3,"file":"ApiPlatformClientService-method-action-types.mjs","sourceRoot":"","sources":["../src/ApiPlatformClientService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { ApiPlatformClientService } from './ApiPlatformClientService.js';\n\n/**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\nexport type ApiPlatformClientServiceGetApiPlatformClientAction = {\n type: `ApiPlatformClientService:getApiPlatformClient`;\n handler: ApiPlatformClientService['getApiPlatformClient'];\n};\n\n/**\n * Union of all ApiPlatformClientService action types.\n */\nexport type ApiPlatformClientServiceMethodActions =\n ApiPlatformClientServiceGetApiPlatformClientAction;\n"]}
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _ApiPlatformClientService_messenger, _ApiPlatformClientService_client;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ApiPlatformClientService = exports.apiPlatformClientServiceName = void 0;
16
- const api_1 = require("./api/index.cjs");
16
+ const index_js_1 = require("./api/index.cjs");
17
17
  // === GENERAL ===
18
18
  /**
19
19
  * The name of the {@link ApiPlatformClientService}, used to namespace the
@@ -63,7 +63,7 @@ class ApiPlatformClientService {
63
63
  _ApiPlatformClientService_client.set(this, void 0);
64
64
  this.name = exports.apiPlatformClientServiceName;
65
65
  __classPrivateFieldSet(this, _ApiPlatformClientService_messenger, messenger, "f");
66
- __classPrivateFieldSet(this, _ApiPlatformClientService_client, new api_1.ApiPlatformClient(clientOptions), "f");
66
+ __classPrivateFieldSet(this, _ApiPlatformClientService_client, new index_js_1.ApiPlatformClient(clientOptions), "f");
67
67
  __classPrivateFieldGet(this, _ApiPlatformClientService_messenger, "f").registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
68
68
  }
69
69
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClientService.cjs","sourceRoot":"","sources":["../src/ApiPlatformClientService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,yCAA0C;AAI1C,kBAAkB;AAElB;;;GAGG;AACU,QAAA,4BAA4B,GAAG,0BAA0B,CAAC;AAEvE,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG,CAAC,sBAAsB,CAAU,CAAC;AA2CpE,6BAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,wBAAwB;IAOnC,YAAY,EACV,SAAS,EACT,GAAG,aAAa,EACgB;QAPzB,sDAA8C;QAE9C,mDAA2B;QAMlC,IAAI,CAAC,IAAI,GAAG,oCAA4B,CAAC;QACzC,uBAAA,IAAI,uCAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,oCAAW,IAAI,uBAAiB,CAAC,aAAa,CAAC,MAAA,CAAC;QAEpD,uBAAA,IAAI,2CAAW,CAAC,4BAA4B,CAC1C,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB;QAClB,OAAO,uBAAA,IAAI,wCAAQ,CAAC;IACtB,CAAC;CACF;AA/BD,4DA+BC","sourcesContent":["import type { Messenger } from '@metamask/messenger';\n\nimport { ApiPlatformClient } from './api';\nimport type { ApiPlatformClientOptions } from './api';\nimport type { ApiPlatformClientServiceMethodActions } from './ApiPlatformClientService-method-action-types';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link ApiPlatformClientService}, used to namespace the\n * service's actions and events.\n */\nexport const apiPlatformClientServiceName = 'ApiPlatformClientService';\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = ['getApiPlatformClient'] as const;\n\n/**\n * Actions that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceActions =\n ApiPlatformClientServiceMethodActions;\n\n/**\n * Actions from other messengers that {@link ApiPlatformClientServiceMessenger} calls.\n */\ntype AllowedActions = never;\n\n/**\n * Events that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceEvents = never;\n\n/**\n * Events from other messengers that {@link ApiPlatformClientService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceMessenger = Messenger<\n typeof apiPlatformClientServiceName,\n ApiPlatformClientServiceActions | AllowedActions,\n ApiPlatformClientServiceEvents | AllowedEvents\n>;\n\n// === SERVICE OPTIONS ===\n\n/**\n * Options for constructing {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceOptions = {\n /** The messenger suited for this service. */\n messenger: ApiPlatformClientServiceMessenger;\n} & ApiPlatformClientOptions;\n\n// === SERVICE DEFINITION ===\n\n/**\n * Service that provides access to {@link ApiPlatformClient} via the messenger.\n *\n * Consumers obtain the client by calling the `ApiPlatformClientService:getApiPlatformClient`\n * action, then use it for accounts, prices, token, and tokens API calls.\n *\n * @example\n *\n * ```ts\n * import { Messenger } from '@metamask/messenger';\n * import {\n * ApiPlatformClientService,\n * type ApiPlatformClientServiceActions,\n * type ApiPlatformClientServiceEvents,\n * } from '@metamask/core-backend';\n *\n * const rootMessenger = new Messenger<'Root', ApiPlatformClientServiceActions, ApiPlatformClientServiceEvents>({ namespace: 'Root' });\n * const serviceMessenger = new Messenger<\n * 'ApiPlatformClientService',\n * ApiPlatformClientServiceActions,\n * ApiPlatformClientServiceEvents,\n * typeof rootMessenger\n * >({ namespace: 'ApiPlatformClientService', parent: rootMessenger });\n *\n * new ApiPlatformClientService({\n * messenger: serviceMessenger,\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * const client = rootMessenger.call('ApiPlatformClientService:getApiPlatformClient');\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * ```\n */\nexport class ApiPlatformClientService {\n readonly name: typeof apiPlatformClientServiceName;\n\n readonly #messenger: ApiPlatformClientServiceMessenger;\n\n readonly #client: ApiPlatformClient;\n\n constructor({\n messenger,\n ...clientOptions\n }: ApiPlatformClientServiceOptions) {\n this.name = apiPlatformClientServiceName;\n this.#messenger = messenger;\n this.#client = new ApiPlatformClient(clientOptions);\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\n getApiPlatformClient(): ApiPlatformClient {\n return this.#client;\n }\n}\n"]}
1
+ {"version":3,"file":"ApiPlatformClientService.cjs","sourceRoot":"","sources":["../src/ApiPlatformClientService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,8CAAmD;AAInD,kBAAkB;AAElB;;;GAGG;AACU,QAAA,4BAA4B,GAAG,0BAA0B,CAAC;AAEvE,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG,CAAC,sBAAsB,CAAU,CAAC;AA2CpE,6BAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,wBAAwB;IAOnC,YAAY,EACV,SAAS,EACT,GAAG,aAAa,EACgB;QAPzB,sDAA8C;QAE9C,mDAA2B;QAMlC,IAAI,CAAC,IAAI,GAAG,oCAA4B,CAAC;QACzC,uBAAA,IAAI,uCAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,oCAAW,IAAI,4BAAiB,CAAC,aAAa,CAAC,MAAA,CAAC;QAEpD,uBAAA,IAAI,2CAAW,CAAC,4BAA4B,CAC1C,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB;QAClB,OAAO,uBAAA,IAAI,wCAAQ,CAAC;IACtB,CAAC;CACF;AA/BD,4DA+BC","sourcesContent":["import type { Messenger } from '@metamask/messenger';\n\nimport { ApiPlatformClient } from './api/index.js';\nimport type { ApiPlatformClientOptions } from './api/index.js';\nimport type { ApiPlatformClientServiceMethodActions } from './ApiPlatformClientService-method-action-types.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link ApiPlatformClientService}, used to namespace the\n * service's actions and events.\n */\nexport const apiPlatformClientServiceName = 'ApiPlatformClientService';\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = ['getApiPlatformClient'] as const;\n\n/**\n * Actions that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceActions =\n ApiPlatformClientServiceMethodActions;\n\n/**\n * Actions from other messengers that {@link ApiPlatformClientServiceMessenger} calls.\n */\ntype AllowedActions = never;\n\n/**\n * Events that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceEvents = never;\n\n/**\n * Events from other messengers that {@link ApiPlatformClientService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceMessenger = Messenger<\n typeof apiPlatformClientServiceName,\n ApiPlatformClientServiceActions | AllowedActions,\n ApiPlatformClientServiceEvents | AllowedEvents\n>;\n\n// === SERVICE OPTIONS ===\n\n/**\n * Options for constructing {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceOptions = {\n /** The messenger suited for this service. */\n messenger: ApiPlatformClientServiceMessenger;\n} & ApiPlatformClientOptions;\n\n// === SERVICE DEFINITION ===\n\n/**\n * Service that provides access to {@link ApiPlatformClient} via the messenger.\n *\n * Consumers obtain the client by calling the `ApiPlatformClientService:getApiPlatformClient`\n * action, then use it for accounts, prices, token, and tokens API calls.\n *\n * @example\n *\n * ```ts\n * import { Messenger } from '@metamask/messenger';\n * import {\n * ApiPlatformClientService,\n * type ApiPlatformClientServiceActions,\n * type ApiPlatformClientServiceEvents,\n * } from '@metamask/core-backend';\n *\n * const rootMessenger = new Messenger<'Root', ApiPlatformClientServiceActions, ApiPlatformClientServiceEvents>({ namespace: 'Root' });\n * const serviceMessenger = new Messenger<\n * 'ApiPlatformClientService',\n * ApiPlatformClientServiceActions,\n * ApiPlatformClientServiceEvents,\n * typeof rootMessenger\n * >({ namespace: 'ApiPlatformClientService', parent: rootMessenger });\n *\n * new ApiPlatformClientService({\n * messenger: serviceMessenger,\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * const client = rootMessenger.call('ApiPlatformClientService:getApiPlatformClient');\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * ```\n */\nexport class ApiPlatformClientService {\n readonly name: typeof apiPlatformClientServiceName;\n\n readonly #messenger: ApiPlatformClientServiceMessenger;\n\n readonly #client: ApiPlatformClient;\n\n constructor({\n messenger,\n ...clientOptions\n }: ApiPlatformClientServiceOptions) {\n this.name = apiPlatformClientServiceName;\n this.#messenger = messenger;\n this.#client = new ApiPlatformClient(clientOptions);\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\n getApiPlatformClient(): ApiPlatformClient {\n return this.#client;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClientService.d.cts","sourceRoot":"","sources":["../src/ApiPlatformClientService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAErD,OAAO,EAAE,iBAAiB,EAAE,wBAAc;AAC1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,wBAAc;AACtD,OAAO,KAAK,EAAE,qCAAqC,EAAE,2DAAuD;AAI5G;;;GAGG;AACH,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AAMvE;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACzC,qCAAqC,CAAC;AAExC;;GAEG;AACH,KAAK,cAAc,GAAG,KAAK,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAEnD;;GAEG;AACH,KAAK,aAAa,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,SAAS,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EAAE,+BAA+B;IAWlC;;;;;;OAMG;IACH,oBAAoB,IAAI,iBAAiB;CAG1C"}
1
+ {"version":3,"file":"ApiPlatformClientService.d.mts","sourceRoot":"","sources":["../src/ApiPlatformClientService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAErD,OAAO,EAAE,iBAAiB,EAAE,wBAAuB;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,wBAAuB;AAC/D,OAAO,KAAK,EAAE,qCAAqC,EAAE,2DAA0D;AAI/G;;;GAGG;AACH,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AAMvE;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACzC,qCAAqC,CAAC;AAExC;;GAEG;AACH,KAAK,cAAc,GAAG,KAAK,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAAC;AAEnD;;GAEG;AACH,KAAK,aAAa,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GAAG,SAAS,CACvD,OAAO,4BAA4B,EACnC,+BAA+B,GAAG,cAAc,EAChD,8BAA8B,GAAG,aAAa,CAC/C,CAAC;AAIF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,6CAA6C;IAC7C,SAAS,EAAE,iCAAiC,CAAC;CAC9C,GAAG,wBAAwB,CAAC;AAI7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,wBAAwB;;IACnC,QAAQ,CAAC,IAAI,EAAE,OAAO,4BAA4B,CAAC;gBAMvC,EACV,SAAS,EACT,GAAG,aAAa,EACjB,EAAE,+BAA+B;IAWlC;;;;;;OAMG;IACH,oBAAoB,IAAI,iBAAiB;CAG1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClientService.mjs","sourceRoot":"","sources":["../src/ApiPlatformClientService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,iBAAiB,EAAE,wBAAc;AAI1C,kBAAkB;AAElB;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,0BAA0B,CAAC;AAEvE,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG,CAAC,sBAAsB,CAAU,CAAC;AA2CpE,6BAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,wBAAwB;IAOnC,YAAY,EACV,SAAS,EACT,GAAG,aAAa,EACgB;QAPzB,sDAA8C;QAE9C,mDAA2B;QAMlC,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,uBAAA,IAAI,uCAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,oCAAW,IAAI,iBAAiB,CAAC,aAAa,CAAC,MAAA,CAAC;QAEpD,uBAAA,IAAI,2CAAW,CAAC,4BAA4B,CAC1C,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB;QAClB,OAAO,uBAAA,IAAI,wCAAQ,CAAC;IACtB,CAAC;CACF","sourcesContent":["import type { Messenger } from '@metamask/messenger';\n\nimport { ApiPlatformClient } from './api';\nimport type { ApiPlatformClientOptions } from './api';\nimport type { ApiPlatformClientServiceMethodActions } from './ApiPlatformClientService-method-action-types';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link ApiPlatformClientService}, used to namespace the\n * service's actions and events.\n */\nexport const apiPlatformClientServiceName = 'ApiPlatformClientService';\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = ['getApiPlatformClient'] as const;\n\n/**\n * Actions that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceActions =\n ApiPlatformClientServiceMethodActions;\n\n/**\n * Actions from other messengers that {@link ApiPlatformClientServiceMessenger} calls.\n */\ntype AllowedActions = never;\n\n/**\n * Events that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceEvents = never;\n\n/**\n * Events from other messengers that {@link ApiPlatformClientService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceMessenger = Messenger<\n typeof apiPlatformClientServiceName,\n ApiPlatformClientServiceActions | AllowedActions,\n ApiPlatformClientServiceEvents | AllowedEvents\n>;\n\n// === SERVICE OPTIONS ===\n\n/**\n * Options for constructing {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceOptions = {\n /** The messenger suited for this service. */\n messenger: ApiPlatformClientServiceMessenger;\n} & ApiPlatformClientOptions;\n\n// === SERVICE DEFINITION ===\n\n/**\n * Service that provides access to {@link ApiPlatformClient} via the messenger.\n *\n * Consumers obtain the client by calling the `ApiPlatformClientService:getApiPlatformClient`\n * action, then use it for accounts, prices, token, and tokens API calls.\n *\n * @example\n *\n * ```ts\n * import { Messenger } from '@metamask/messenger';\n * import {\n * ApiPlatformClientService,\n * type ApiPlatformClientServiceActions,\n * type ApiPlatformClientServiceEvents,\n * } from '@metamask/core-backend';\n *\n * const rootMessenger = new Messenger<'Root', ApiPlatformClientServiceActions, ApiPlatformClientServiceEvents>({ namespace: 'Root' });\n * const serviceMessenger = new Messenger<\n * 'ApiPlatformClientService',\n * ApiPlatformClientServiceActions,\n * ApiPlatformClientServiceEvents,\n * typeof rootMessenger\n * >({ namespace: 'ApiPlatformClientService', parent: rootMessenger });\n *\n * new ApiPlatformClientService({\n * messenger: serviceMessenger,\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * const client = rootMessenger.call('ApiPlatformClientService:getApiPlatformClient');\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * ```\n */\nexport class ApiPlatformClientService {\n readonly name: typeof apiPlatformClientServiceName;\n\n readonly #messenger: ApiPlatformClientServiceMessenger;\n\n readonly #client: ApiPlatformClient;\n\n constructor({\n messenger,\n ...clientOptions\n }: ApiPlatformClientServiceOptions) {\n this.name = apiPlatformClientServiceName;\n this.#messenger = messenger;\n this.#client = new ApiPlatformClient(clientOptions);\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\n getApiPlatformClient(): ApiPlatformClient {\n return this.#client;\n }\n}\n"]}
1
+ {"version":3,"file":"ApiPlatformClientService.mjs","sourceRoot":"","sources":["../src/ApiPlatformClientService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,iBAAiB,EAAE,wBAAuB;AAInD,kBAAkB;AAElB;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,0BAA0B,CAAC;AAEvE,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG,CAAC,sBAAsB,CAAU,CAAC;AA2CpE,6BAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,wBAAwB;IAOnC,YAAY,EACV,SAAS,EACT,GAAG,aAAa,EACgB;QAPzB,sDAA8C;QAE9C,mDAA2B;QAMlC,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,uBAAA,IAAI,uCAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,oCAAW,IAAI,iBAAiB,CAAC,aAAa,CAAC,MAAA,CAAC;QAEpD,uBAAA,IAAI,2CAAW,CAAC,4BAA4B,CAC1C,IAAI,EACJ,yBAAyB,CAC1B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB;QAClB,OAAO,uBAAA,IAAI,wCAAQ,CAAC;IACtB,CAAC;CACF","sourcesContent":["import type { Messenger } from '@metamask/messenger';\n\nimport { ApiPlatformClient } from './api/index.js';\nimport type { ApiPlatformClientOptions } from './api/index.js';\nimport type { ApiPlatformClientServiceMethodActions } from './ApiPlatformClientService-method-action-types.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link ApiPlatformClientService}, used to namespace the\n * service's actions and events.\n */\nexport const apiPlatformClientServiceName = 'ApiPlatformClientService';\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = ['getApiPlatformClient'] as const;\n\n/**\n * Actions that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceActions =\n ApiPlatformClientServiceMethodActions;\n\n/**\n * Actions from other messengers that {@link ApiPlatformClientServiceMessenger} calls.\n */\ntype AllowedActions = never;\n\n/**\n * Events that {@link ApiPlatformClientService} exposes to other consumers.\n */\nexport type ApiPlatformClientServiceEvents = never;\n\n/**\n * Events from other messengers that {@link ApiPlatformClientService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceMessenger = Messenger<\n typeof apiPlatformClientServiceName,\n ApiPlatformClientServiceActions | AllowedActions,\n ApiPlatformClientServiceEvents | AllowedEvents\n>;\n\n// === SERVICE OPTIONS ===\n\n/**\n * Options for constructing {@link ApiPlatformClientService}.\n */\nexport type ApiPlatformClientServiceOptions = {\n /** The messenger suited for this service. */\n messenger: ApiPlatformClientServiceMessenger;\n} & ApiPlatformClientOptions;\n\n// === SERVICE DEFINITION ===\n\n/**\n * Service that provides access to {@link ApiPlatformClient} via the messenger.\n *\n * Consumers obtain the client by calling the `ApiPlatformClientService:getApiPlatformClient`\n * action, then use it for accounts, prices, token, and tokens API calls.\n *\n * @example\n *\n * ```ts\n * import { Messenger } from '@metamask/messenger';\n * import {\n * ApiPlatformClientService,\n * type ApiPlatformClientServiceActions,\n * type ApiPlatformClientServiceEvents,\n * } from '@metamask/core-backend';\n *\n * const rootMessenger = new Messenger<'Root', ApiPlatformClientServiceActions, ApiPlatformClientServiceEvents>({ namespace: 'Root' });\n * const serviceMessenger = new Messenger<\n * 'ApiPlatformClientService',\n * ApiPlatformClientServiceActions,\n * ApiPlatformClientServiceEvents,\n * typeof rootMessenger\n * >({ namespace: 'ApiPlatformClientService', parent: rootMessenger });\n *\n * new ApiPlatformClientService({\n * messenger: serviceMessenger,\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * const client = rootMessenger.call('ApiPlatformClientService:getApiPlatformClient');\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * ```\n */\nexport class ApiPlatformClientService {\n readonly name: typeof apiPlatformClientServiceName;\n\n readonly #messenger: ApiPlatformClientServiceMessenger;\n\n readonly #client: ApiPlatformClient;\n\n constructor({\n messenger,\n ...clientOptions\n }: ApiPlatformClientServiceOptions) {\n this.name = apiPlatformClientServiceName;\n this.#messenger = messenger;\n this.#client = new ApiPlatformClient(clientOptions);\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Returns the shared ApiPlatformClient instance.\n *\n * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`.\n *\n * @returns The ApiPlatformClient instance (accounts, prices, token, tokens).\n */\n getApiPlatformClient(): ApiPlatformClient {\n return this.#client;\n }\n}\n"]}
@@ -50,12 +50,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.createApiPlatformClient = exports.ApiPlatformClient = void 0;
51
51
  const query_core_1 = require("@tanstack/query-core");
52
52
  // Import API clients from subfolders
53
- const accounts_1 = require("./accounts/index.cjs");
54
- const base_client_1 = require("./base-client.cjs");
55
- const prices_1 = require("./prices/index.cjs");
56
- const shared_types_1 = require("./shared-types.cjs");
57
- const token_1 = require("./token/index.cjs");
58
- const tokens_1 = require("./tokens/index.cjs");
53
+ const index_js_1 = require("./accounts/index.cjs");
54
+ const base_client_js_1 = require("./base-client.cjs");
55
+ const index_js_2 = require("./prices/index.cjs");
56
+ const shared_types_js_1 = require("./shared-types.cjs");
57
+ const index_js_3 = require("./token/index.cjs");
58
+ const index_js_4 = require("./tokens/index.cjs");
59
59
  // ============================================================================
60
60
  // UNIFIED API CLIENT
61
61
  // ============================================================================
@@ -80,10 +80,10 @@ class ApiPlatformClient {
80
80
  new query_core_1.QueryClient({
81
81
  defaultOptions: {
82
82
  queries: {
83
- staleTime: shared_types_1.STALE_TIMES.DEFAULT,
84
- gcTime: shared_types_1.GC_TIMES.DEFAULT,
85
- retry: shared_types_1.shouldRetry,
86
- retryDelay: shared_types_1.calculateRetryDelay,
83
+ staleTime: shared_types_js_1.STALE_TIMES.DEFAULT,
84
+ gcTime: shared_types_js_1.GC_TIMES.DEFAULT,
85
+ retry: shared_types_js_1.shouldRetry,
86
+ retryDelay: shared_types_js_1.calculateRetryDelay,
87
87
  refetchOnWindowFocus: false,
88
88
  networkMode: 'always',
89
89
  },
@@ -94,10 +94,10 @@ class ApiPlatformClient {
94
94
  ...options,
95
95
  queryClient: __classPrivateFieldGet(this, _ApiPlatformClient_sharedQueryClient, "f"),
96
96
  };
97
- this.accounts = new accounts_1.AccountsApiClient(sharedOptions);
98
- this.prices = new prices_1.PricesApiClient(sharedOptions);
99
- this.token = new token_1.TokenApiClient(sharedOptions);
100
- this.tokens = new tokens_1.TokensApiClient(sharedOptions);
97
+ this.accounts = new index_js_1.AccountsApiClient(sharedOptions);
98
+ this.prices = new index_js_2.PricesApiClient(sharedOptions);
99
+ this.token = new index_js_3.TokenApiClient(sharedOptions);
100
+ this.tokens = new index_js_4.TokensApiClient(sharedOptions);
101
101
  }
102
102
  // ==========================================================================
103
103
  // CACHE MANAGEMENT (operates on shared QueryClient)
@@ -158,7 +158,7 @@ class ApiPlatformClient {
158
158
  */
159
159
  async invalidateAuthToken() {
160
160
  await __classPrivateFieldGet(this, _ApiPlatformClient_sharedQueryClient, "f").resetQueries({
161
- queryKey: base_client_1.authQueryKeys.bearerToken(),
161
+ queryKey: base_client_js_1.authQueryKeys.bearerToken(),
162
162
  });
163
163
  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AIG;IACH,IAAI,WAAW;QACb,OAAO,uBAAA,IAAI,4CAAmB,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAa,QAAkB;QAC1C,OAAO,uBAAA,IAAI,4CAAmB,CAAC,YAAY,CAAa,QAAQ,CAAC,CAAC;IACpE,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAa,QAAkB,EAAE,IAAgB;QAC5D,uBAAA,IAAI,4CAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,QAAkB;QAC3B,OAAO,uBAAA,IAAI,4CAAmB,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,KAAK;QACH,uBAAA,IAAI,4CAAmB,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACjB,MAAM,uBAAA,IAAI,4CAAmB,CAAC,iBAAiB,EAAE,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,uBAAA,IAAI,4CAAmB,CAAC,YAAY,CAAC;YACzC,QAAQ,EAAE,2BAAa,CAAC,WAAW,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;CACF;AAhID,8CAgIC;;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,OAAiC;IAEjC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC;AAJD,0DAIC","sourcesContent":["/**\n * ApiPlatformClient - MetaMask API Platform Client\n *\n * A comprehensive API client that uses @tanstack/query-core directly for:\n * - Automatic request deduplication\n * - Intelligent caching\n * - Automatic retries with exponential backoff\n *\n * Provides unified access to all MetaMask backend APIs:\n * - Accounts API (accounts.api.cx.metamask.io)\n * - Price API (price.api.cx.metamask.io)\n * - Token API (token.api.cx.metamask.io)\n * - Tokens API (tokens.api.cx.metamask.io)\n *\n * @example\n * ```typescript\n * const client = new ApiPlatformClient({\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * // Access API methods through sub-clients\n * const networks = await client.accounts.fetchV2SupportedNetworks();\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * const prices = await client.prices.fetchV3SpotPrices(assetIds);\n * const tokenList = await client.token.fetchTokenList(1);\n * const assets = await client.tokens.fetchV3Assets(assetIds);\n *\n * // Cache management\n * await client.invalidateAll(); // Invalidate all caches\n * await client.invalidateAuthToken(); // Invalidate auth token\n * await client.accounts.invalidateBalances(); // Domain-specific via sub-client\n * await client.prices.invalidatePrices(); // Domain-specific via sub-client\n * ```\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\n// Import API clients from subfolders\nimport { AccountsApiClient } from './accounts';\nimport { authQueryKeys } from './base-client';\nimport { PricesApiClient } from './prices';\nimport {\n STALE_TIMES,\n GC_TIMES,\n shouldRetry,\n calculateRetryDelay,\n} from './shared-types';\nimport type { ApiPlatformClientOptions } from './shared-types';\nimport { TokenApiClient } from './token';\nimport { TokensApiClient } from './tokens';\n\n// ============================================================================\n// UNIFIED API CLIENT\n// ============================================================================\n\n/**\n * MetaMask API Platform Client with TanStack Query caching.\n * Provides cached access to all MetaMask backend APIs through a unified interface.\n *\n * Access API methods through the sub-clients:\n * - `client.accounts` - Accounts API (balances, transactions, NFTs, etc.)\n * - `client.prices` - Prices API (spot prices, exchange rates, historical prices)\n * - `client.token` - Token API (token metadata, trending, top gainers)\n * - `client.tokens` - Tokens API (bulk asset operations, supported networks)\n */\nexport class ApiPlatformClient {\n /**\n * Accounts API client.\n * Provides methods for balances, transactions, relationships, NFTs, and token discovery.\n */\n readonly accounts: AccountsApiClient;\n\n /**\n * Prices API client.\n * Provides methods for spot prices, exchange rates, and historical prices.\n */\n readonly prices: PricesApiClient;\n\n /**\n * Token API client.\n * Provides methods for token metadata, networks, trending tokens, and top assets.\n */\n readonly token: TokenApiClient;\n\n /**\n * Tokens API client.\n * Provides methods for bulk asset operations and supported networks.\n */\n readonly tokens: TokensApiClient;\n\n /**\n * Shared QueryClient instance used by all sub-clients.\n */\n readonly #sharedQueryClient: QueryClient;\n\n constructor(options: ApiPlatformClientOptions) {\n // Create or use provided QueryClient - shared by all sub-clients\n this.#sharedQueryClient =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n\n // Pass the shared QueryClient to all sub-clients\n const sharedOptions: ApiPlatformClientOptions = {\n ...options,\n queryClient: this.#sharedQueryClient,\n };\n\n this.accounts = new AccountsApiClient(sharedOptions);\n this.prices = new PricesApiClient(sharedOptions);\n this.token = new TokenApiClient(sharedOptions);\n this.tokens = new TokensApiClient(sharedOptions);\n }\n\n // ==========================================================================\n // CACHE MANAGEMENT (operates on shared QueryClient)\n // ==========================================================================\n\n /**\n * Get the underlying QueryClient (for advanced usage).\n *\n * @returns The underlying QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#sharedQueryClient;\n }\n\n /**\n * Get cached data for a query key.\n *\n * @param queryKey - The query key to look up.\n * @returns The cached data or undefined.\n */\n getCachedData<CachedData>(queryKey: QueryKey): CachedData | undefined {\n return this.#sharedQueryClient.getQueryData<CachedData>(queryKey);\n }\n\n /**\n * Set cached data for a query key.\n *\n * @param queryKey - The query key to set data for.\n * @param data - The data to cache.\n */\n setCachedData<CachedData>(queryKey: QueryKey, data: CachedData): void {\n this.#sharedQueryClient.setQueryData(queryKey, data);\n }\n\n /**\n * Check if a query is currently fetching.\n *\n * @param queryKey - The query key to check.\n * @returns True if the query is currently fetching.\n */\n isFetching(queryKey: QueryKey): boolean {\n return this.#sharedQueryClient.isFetching({ queryKey }) > 0;\n }\n\n /**\n * Clear all cached data across all sub-clients.\n */\n clear(): void {\n this.#sharedQueryClient.clear();\n }\n\n /**\n * Invalidate all queries across all sub-clients.\n */\n async invalidateAll(): Promise<void> {\n await this.#sharedQueryClient.invalidateQueries();\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#sharedQueryClient.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n}\n\n/**\n * Factory function to create an ApiPlatformClient.\n *\n * @param options - Configuration options for the client.\n * @returns A new ApiPlatformClient instance.\n */\nexport function createApiPlatformClient(\n options: ApiPlatformClientOptions,\n): ApiPlatformClient {\n return new ApiPlatformClient(options);\n}\n"]}
1
+ {"version":3,"file":"ApiPlatformClient.cjs","sourceRoot":"","sources":["../../src/api/ApiPlatformClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;;;;;;;;;;;;;AAEH,qDAAmD;AAGnD,qCAAqC;AACrC,mDAAwD;AACxD,sDAAiD;AACjD,iDAAoD;AACpD,wDAK2B;AAE3B,gDAAkD;AAClD,iDAAoD;AAEpD,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;;;;;;;;GASG;AACH,MAAa,iBAAiB;IA8B5B,YAAY,OAAiC;QAL7C;;WAEG;QACM,uDAAgC;QAGvC,iEAAiE;QACjE,uBAAA,IAAI,wCACF,OAAO,CAAC,WAAW;YACnB,IAAI,wBAAW,CAAC;gBACd,cAAc,EAAE;oBACd,OAAO,EAAE;wBACP,SAAS,EAAE,6BAAW,CAAC,OAAO;wBAC9B,MAAM,EAAE,0BAAQ,CAAC,OAAO;wBACxB,KAAK,EAAE,6BAAW;wBAClB,UAAU,EAAE,qCAAmB;wBAC/B,oBAAoB,EAAE,KAAK;wBAC3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ACvB,MAAM,uBAAA,IAAI,4CAAmB,CAAC,YAAY,CAAC;YACzC,QAAQ,EAAE,8BAAa,CAAC,WAAW,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;CACF;AAhID,8CAgIC;;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,OAAiC;IAEjC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC;AAJD,0DAIC","sourcesContent":["/**\n * ApiPlatformClient - MetaMask API Platform Client\n *\n * A comprehensive API client that uses @tanstack/query-core directly for:\n * - Automatic request deduplication\n * - Intelligent caching\n * - Automatic retries with exponential backoff\n *\n * Provides unified access to all MetaMask backend APIs:\n * - Accounts API (accounts.api.cx.metamask.io)\n * - Price API (price.api.cx.metamask.io)\n * - Token API (token.api.cx.metamask.io)\n * - Tokens API (tokens.api.cx.metamask.io)\n *\n * @example\n * ```typescript\n * const client = new ApiPlatformClient({\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * // Access API methods through sub-clients\n * const networks = await client.accounts.fetchV2SupportedNetworks();\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * const prices = await client.prices.fetchV3SpotPrices(assetIds);\n * const tokenList = await client.token.fetchTokenList(1);\n * const assets = await client.tokens.fetchV3Assets(assetIds);\n *\n * // Cache management\n * await client.invalidateAll(); // Invalidate all caches\n * await client.invalidateAuthToken(); // Invalidate auth token\n * await client.accounts.invalidateBalances(); // Domain-specific via sub-client\n * await client.prices.invalidatePrices(); // Domain-specific via sub-client\n * ```\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\n// Import API clients from subfolders\nimport { AccountsApiClient } from './accounts/index.js';\nimport { authQueryKeys } from './base-client.js';\nimport { PricesApiClient } from './prices/index.js';\nimport {\n STALE_TIMES,\n GC_TIMES,\n shouldRetry,\n calculateRetryDelay,\n} from './shared-types.js';\nimport type { ApiPlatformClientOptions } from './shared-types.js';\nimport { TokenApiClient } from './token/index.js';\nimport { TokensApiClient } from './tokens/index.js';\n\n// ============================================================================\n// UNIFIED API CLIENT\n// ============================================================================\n\n/**\n * MetaMask API Platform Client with TanStack Query caching.\n * Provides cached access to all MetaMask backend APIs through a unified interface.\n *\n * Access API methods through the sub-clients:\n * - `client.accounts` - Accounts API (balances, transactions, NFTs, etc.)\n * - `client.prices` - Prices API (spot prices, exchange rates, historical prices)\n * - `client.token` - Token API (token metadata, trending, top gainers)\n * - `client.tokens` - Tokens API (bulk asset operations, supported networks)\n */\nexport class ApiPlatformClient {\n /**\n * Accounts API client.\n * Provides methods for balances, transactions, relationships, NFTs, and token discovery.\n */\n readonly accounts: AccountsApiClient;\n\n /**\n * Prices API client.\n * Provides methods for spot prices, exchange rates, and historical prices.\n */\n readonly prices: PricesApiClient;\n\n /**\n * Token API client.\n * Provides methods for token metadata, networks, trending tokens, and top assets.\n */\n readonly token: TokenApiClient;\n\n /**\n * Tokens API client.\n * Provides methods for bulk asset operations and supported networks.\n */\n readonly tokens: TokensApiClient;\n\n /**\n * Shared QueryClient instance used by all sub-clients.\n */\n readonly #sharedQueryClient: QueryClient;\n\n constructor(options: ApiPlatformClientOptions) {\n // Create or use provided QueryClient - shared by all sub-clients\n this.#sharedQueryClient =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n\n // Pass the shared QueryClient to all sub-clients\n const sharedOptions: ApiPlatformClientOptions = {\n ...options,\n queryClient: this.#sharedQueryClient,\n };\n\n this.accounts = new AccountsApiClient(sharedOptions);\n this.prices = new PricesApiClient(sharedOptions);\n this.token = new TokenApiClient(sharedOptions);\n this.tokens = new TokensApiClient(sharedOptions);\n }\n\n // ==========================================================================\n // CACHE MANAGEMENT (operates on shared QueryClient)\n // ==========================================================================\n\n /**\n * Get the underlying QueryClient (for advanced usage).\n *\n * @returns The underlying QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#sharedQueryClient;\n }\n\n /**\n * Get cached data for a query key.\n *\n * @param queryKey - The query key to look up.\n * @returns The cached data or undefined.\n */\n getCachedData<CachedData>(queryKey: QueryKey): CachedData | undefined {\n return this.#sharedQueryClient.getQueryData<CachedData>(queryKey);\n }\n\n /**\n * Set cached data for a query key.\n *\n * @param queryKey - The query key to set data for.\n * @param data - The data to cache.\n */\n setCachedData<CachedData>(queryKey: QueryKey, data: CachedData): void {\n this.#sharedQueryClient.setQueryData(queryKey, data);\n }\n\n /**\n * Check if a query is currently fetching.\n *\n * @param queryKey - The query key to check.\n * @returns True if the query is currently fetching.\n */\n isFetching(queryKey: QueryKey): boolean {\n return this.#sharedQueryClient.isFetching({ queryKey }) > 0;\n }\n\n /**\n * Clear all cached data across all sub-clients.\n */\n clear(): void {\n this.#sharedQueryClient.clear();\n }\n\n /**\n * Invalidate all queries across all sub-clients.\n */\n async invalidateAll(): Promise<void> {\n await this.#sharedQueryClient.invalidateQueries();\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#sharedQueryClient.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n}\n\n/**\n * Factory function to create an ApiPlatformClient.\n *\n * @param options - Configuration options for the client.\n * @returns A new ApiPlatformClient instance.\n */\nexport function createApiPlatformClient(\n options: ApiPlatformClientOptions,\n): ApiPlatformClient {\n return new ApiPlatformClient(options);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiPlatformClient.d.cts","sourceRoot":"","sources":["../../src/api/ApiPlatformClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAA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C;IAEjC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * ApiPlatformClient - MetaMask API Platform Client\n *\n * A comprehensive API client that uses @tanstack/query-core directly for:\n * - Automatic request deduplication\n * - Intelligent caching\n * - Automatic retries with exponential backoff\n *\n * Provides unified access to all MetaMask backend APIs:\n * - Accounts API (accounts.api.cx.metamask.io)\n * - Price API (price.api.cx.metamask.io)\n * - Token API (token.api.cx.metamask.io)\n * - Tokens API (tokens.api.cx.metamask.io)\n *\n * @example\n * ```typescript\n * const client = new ApiPlatformClient({\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * // Access API methods through sub-clients\n * const networks = await client.accounts.fetchV2SupportedNetworks();\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * const prices = await client.prices.fetchV3SpotPrices(assetIds);\n * const tokenList = await client.token.fetchTokenList(1);\n * const assets = await client.tokens.fetchV3Assets(assetIds);\n *\n * // Cache management\n * await client.invalidateAll(); // Invalidate all caches\n * await client.invalidateAuthToken(); // Invalidate auth token\n * await client.accounts.invalidateBalances(); // Domain-specific via sub-client\n * await client.prices.invalidatePrices(); // Domain-specific via sub-client\n * ```\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\n// Import API clients from subfolders\nimport { AccountsApiClient } from './accounts';\nimport { authQueryKeys } from './base-client';\nimport { PricesApiClient } from './prices';\nimport {\n STALE_TIMES,\n GC_TIMES,\n shouldRetry,\n calculateRetryDelay,\n} from './shared-types';\nimport type { ApiPlatformClientOptions } from './shared-types';\nimport { TokenApiClient } from './token';\nimport { TokensApiClient } from './tokens';\n\n// ============================================================================\n// UNIFIED API CLIENT\n// ============================================================================\n\n/**\n * MetaMask API Platform Client with TanStack Query caching.\n * Provides cached access to all MetaMask backend APIs through a unified interface.\n *\n * Access API methods through the sub-clients:\n * - `client.accounts` - Accounts API (balances, transactions, NFTs, etc.)\n * - `client.prices` - Prices API (spot prices, exchange rates, historical prices)\n * - `client.token` - Token API (token metadata, trending, top gainers)\n * - `client.tokens` - Tokens API (bulk asset operations, supported networks)\n */\nexport class ApiPlatformClient {\n /**\n * Accounts API client.\n * Provides methods for balances, transactions, relationships, NFTs, and token discovery.\n */\n readonly accounts: AccountsApiClient;\n\n /**\n * Prices API client.\n * Provides methods for spot prices, exchange rates, and historical prices.\n */\n readonly prices: PricesApiClient;\n\n /**\n * Token API client.\n * Provides methods for token metadata, networks, trending tokens, and top assets.\n */\n readonly token: TokenApiClient;\n\n /**\n * Tokens API client.\n * Provides methods for bulk asset operations and supported networks.\n */\n readonly tokens: TokensApiClient;\n\n /**\n * Shared QueryClient instance used by all sub-clients.\n */\n readonly #sharedQueryClient: QueryClient;\n\n constructor(options: ApiPlatformClientOptions) {\n // Create or use provided QueryClient - shared by all sub-clients\n this.#sharedQueryClient =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n\n // Pass the shared QueryClient to all sub-clients\n const sharedOptions: ApiPlatformClientOptions = {\n ...options,\n queryClient: this.#sharedQueryClient,\n };\n\n this.accounts = new AccountsApiClient(sharedOptions);\n this.prices = new PricesApiClient(sharedOptions);\n this.token = new TokenApiClient(sharedOptions);\n this.tokens = new TokensApiClient(sharedOptions);\n }\n\n // ==========================================================================\n // CACHE MANAGEMENT (operates on shared QueryClient)\n // ==========================================================================\n\n /**\n * Get the underlying QueryClient (for advanced usage).\n *\n * @returns The underlying QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#sharedQueryClient;\n }\n\n /**\n * Get cached data for a query key.\n *\n * @param queryKey - The query key to look up.\n * @returns The cached data or undefined.\n */\n getCachedData<CachedData>(queryKey: QueryKey): CachedData | undefined {\n return this.#sharedQueryClient.getQueryData<CachedData>(queryKey);\n }\n\n /**\n * Set cached data for a query key.\n *\n * @param queryKey - The query key to set data for.\n * @param data - The data to cache.\n */\n setCachedData<CachedData>(queryKey: QueryKey, data: CachedData): void {\n this.#sharedQueryClient.setQueryData(queryKey, data);\n }\n\n /**\n * Check if a query is currently fetching.\n *\n * @param queryKey - The query key to check.\n * @returns True if the query is currently fetching.\n */\n isFetching(queryKey: QueryKey): boolean {\n return this.#sharedQueryClient.isFetching({ queryKey }) > 0;\n }\n\n /**\n * Clear all cached data across all sub-clients.\n */\n clear(): void {\n this.#sharedQueryClient.clear();\n }\n\n /**\n * Invalidate all queries across all sub-clients.\n */\n async invalidateAll(): Promise<void> {\n await this.#sharedQueryClient.invalidateQueries();\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#sharedQueryClient.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n}\n\n/**\n * Factory function to create an ApiPlatformClient.\n *\n * @param options - Configuration options for the client.\n * @returns A new ApiPlatformClient instance.\n */\nexport function createApiPlatformClient(\n options: ApiPlatformClientOptions,\n): ApiPlatformClient {\n return new ApiPlatformClient(options);\n}\n"]}
1
+ {"version":3,"file":"ApiPlatformClient.mjs","sourceRoot":"","sources":["../../src/api/ApiPlatformClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,6BAA6B;AAGnD,qCAAqC;AACrC,OAAO,EAAE,iBAAiB,EAAE,6BAA4B;AACxD,OAAO,EAAE,aAAa,EAAE,0BAAyB;AACjD,OAAO,EAAE,eAAe,EAAE,2BAA0B;AACpD,OAAO,EACL,WAAW,EACX,QAAQ,EACR,WAAW,EACX,mBAAmB,EACpB,2BA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a,CAAa,QAAkB,EAAE,IAAgB;QAC5D,uBAAA,IAAI,4CAAmB,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,QAAkB;QAC3B,OAAO,uBAAA,IAAI,4CAAmB,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,KAAK;QACH,uBAAA,IAAI,4CAAmB,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACjB,MAAM,uBAAA,IAAI,4CAAmB,CAAC,iBAAiB,EAAE,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,uBAAA,IAAI,4CAAmB,CAAC,YAAY,CAAC;YACzC,QAAQ,EAAE,aAAa,CAAC,WAAW,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;CACF;;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAiC;IAEjC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * ApiPlatformClient - MetaMask API Platform Client\n *\n * A comprehensive API client that uses @tanstack/query-core directly for:\n * - Automatic request deduplication\n * - Intelligent caching\n * - Automatic retries with exponential backoff\n *\n * Provides unified access to all MetaMask backend APIs:\n * - Accounts API (accounts.api.cx.metamask.io)\n * - Price API (price.api.cx.metamask.io)\n * - Token API (token.api.cx.metamask.io)\n * - Tokens API (tokens.api.cx.metamask.io)\n *\n * @example\n * ```typescript\n * const client = new ApiPlatformClient({\n * clientProduct: 'metamask-extension',\n * getBearerToken: async () => token,\n * });\n *\n * // Access API methods through sub-clients\n * const networks = await client.accounts.fetchV2SupportedNetworks();\n * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds);\n * const prices = await client.prices.fetchV3SpotPrices(assetIds);\n * const tokenList = await client.token.fetchTokenList(1);\n * const assets = await client.tokens.fetchV3Assets(assetIds);\n *\n * // Cache management\n * await client.invalidateAll(); // Invalidate all caches\n * await client.invalidateAuthToken(); // Invalidate auth token\n * await client.accounts.invalidateBalances(); // Domain-specific via sub-client\n * await client.prices.invalidatePrices(); // Domain-specific via sub-client\n * ```\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\n// Import API clients from subfolders\nimport { AccountsApiClient } from './accounts/index.js';\nimport { authQueryKeys } from './base-client.js';\nimport { PricesApiClient } from './prices/index.js';\nimport {\n STALE_TIMES,\n GC_TIMES,\n shouldRetry,\n calculateRetryDelay,\n} from './shared-types.js';\nimport type { ApiPlatformClientOptions } from './shared-types.js';\nimport { TokenApiClient } from './token/index.js';\nimport { TokensApiClient } from './tokens/index.js';\n\n// ============================================================================\n// UNIFIED API CLIENT\n// ============================================================================\n\n/**\n * MetaMask API Platform Client with TanStack Query caching.\n * Provides cached access to all MetaMask backend APIs through a unified interface.\n *\n * Access API methods through the sub-clients:\n * - `client.accounts` - Accounts API (balances, transactions, NFTs, etc.)\n * - `client.prices` - Prices API (spot prices, exchange rates, historical prices)\n * - `client.token` - Token API (token metadata, trending, top gainers)\n * - `client.tokens` - Tokens API (bulk asset operations, supported networks)\n */\nexport class ApiPlatformClient {\n /**\n * Accounts API client.\n * Provides methods for balances, transactions, relationships, NFTs, and token discovery.\n */\n readonly accounts: AccountsApiClient;\n\n /**\n * Prices API client.\n * Provides methods for spot prices, exchange rates, and historical prices.\n */\n readonly prices: PricesApiClient;\n\n /**\n * Token API client.\n * Provides methods for token metadata, networks, trending tokens, and top assets.\n */\n readonly token: TokenApiClient;\n\n /**\n * Tokens API client.\n * Provides methods for bulk asset operations and supported networks.\n */\n readonly tokens: TokensApiClient;\n\n /**\n * Shared QueryClient instance used by all sub-clients.\n */\n readonly #sharedQueryClient: QueryClient;\n\n constructor(options: ApiPlatformClientOptions) {\n // Create or use provided QueryClient - shared by all sub-clients\n this.#sharedQueryClient =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n\n // Pass the shared QueryClient to all sub-clients\n const sharedOptions: ApiPlatformClientOptions = {\n ...options,\n queryClient: this.#sharedQueryClient,\n };\n\n this.accounts = new AccountsApiClient(sharedOptions);\n this.prices = new PricesApiClient(sharedOptions);\n this.token = new TokenApiClient(sharedOptions);\n this.tokens = new TokensApiClient(sharedOptions);\n }\n\n // ==========================================================================\n // CACHE MANAGEMENT (operates on shared QueryClient)\n // ==========================================================================\n\n /**\n * Get the underlying QueryClient (for advanced usage).\n *\n * @returns The underlying QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#sharedQueryClient;\n }\n\n /**\n * Get cached data for a query key.\n *\n * @param queryKey - The query key to look up.\n * @returns The cached data or undefined.\n */\n getCachedData<CachedData>(queryKey: QueryKey): CachedData | undefined {\n return this.#sharedQueryClient.getQueryData<CachedData>(queryKey);\n }\n\n /**\n * Set cached data for a query key.\n *\n * @param queryKey - The query key to set data for.\n * @param data - The data to cache.\n */\n setCachedData<CachedData>(queryKey: QueryKey, data: CachedData): void {\n this.#sharedQueryClient.setQueryData(queryKey, data);\n }\n\n /**\n * Check if a query is currently fetching.\n *\n * @param queryKey - The query key to check.\n * @returns True if the query is currently fetching.\n */\n isFetching(queryKey: QueryKey): boolean {\n return this.#sharedQueryClient.isFetching({ queryKey }) > 0;\n }\n\n /**\n * Clear all cached data across all sub-clients.\n */\n clear(): void {\n this.#sharedQueryClient.clear();\n }\n\n /**\n * Invalidate all queries across all sub-clients.\n */\n async invalidateAll(): Promise<void> {\n await this.#sharedQueryClient.invalidateQueries();\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#sharedQueryClient.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n}\n\n/**\n * Factory function to create an ApiPlatformClient.\n *\n * @param options - Configuration options for the client.\n * @returns A new ApiPlatformClient instance.\n */\nexport function createApiPlatformClient(\n options: ApiPlatformClientOptions,\n): ApiPlatformClient {\n return new ApiPlatformClient(options);\n}\n"]}
@@ -13,13 +13,13 @@
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AccountsApiClient = void 0;
16
- const base_client_1 = require("../base-client.cjs");
17
- const shared_types_1 = require("../shared-types.cjs");
16
+ const base_client_js_1 = require("../base-client.cjs");
17
+ const shared_types_js_1 = require("../shared-types.cjs");
18
18
  /**
19
19
  * Accounts API Client.
20
20
  * Provides methods for interacting with the Accounts API.
21
21
  */
22
- class AccountsApiClient extends base_client_1.BaseApiClient {
22
+ class AccountsApiClient extends base_client_js_1.BaseApiClient {
23
23
  // ==========================================================================
24
24
  // CACHE MANAGEMENT
25
25
  // ==========================================================================
@@ -51,10 +51,10 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
51
51
  getV1SupportedNetworksQueryOptions(options) {
52
52
  return {
53
53
  queryKey: ['accounts', 'v1SupportedNetworks'],
54
- queryFn: ({ signal }) => this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v1/supportedNetworks', { signal }),
55
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
56
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.SUPPORTED_NETWORKS,
57
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.EXTENDED,
54
+ queryFn: ({ signal }) => this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v1/supportedNetworks', { signal }),
55
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
56
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.SUPPORTED_NETWORKS,
57
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.EXTENDED,
58
58
  };
59
59
  }
60
60
  /**
@@ -75,10 +75,10 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
75
75
  getV2SupportedNetworksQueryOptions(options) {
76
76
  return {
77
77
  queryKey: ['accounts', 'v2SupportedNetworks'],
78
- queryFn: ({ signal }) => this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v2/supportedNetworks', { signal }),
79
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
80
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.SUPPORTED_NETWORKS,
81
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.EXTENDED,
78
+ queryFn: ({ signal }) => this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v2/supportedNetworks', { signal }),
79
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
80
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.SUPPORTED_NETWORKS,
81
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.EXTENDED,
82
82
  };
83
83
  }
84
84
  /**
@@ -120,7 +120,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
120
120
  if (accountIds.length === 0) {
121
121
  return { activeNetworks: [] };
122
122
  }
123
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v2/activeNetworks', {
123
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v2/activeNetworks', {
124
124
  signal,
125
125
  params: {
126
126
  accountIds,
@@ -129,9 +129,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
129
129
  },
130
130
  });
131
131
  },
132
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
133
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.NETWORKS,
134
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
132
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
133
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.NETWORKS,
134
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
135
135
  };
136
136
  }
137
137
  /**
@@ -185,7 +185,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
185
185
  if (address === '') {
186
186
  return { count: 0, balances: [], unprocessedNetworks: [] };
187
187
  }
188
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, `/v2/accounts/${address}/balances`, {
188
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, `/v2/accounts/${address}/balances`, {
189
189
  signal,
190
190
  params: {
191
191
  networks: queryOptions?.networks,
@@ -195,9 +195,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
195
195
  },
196
196
  });
197
197
  },
198
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
199
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.BALANCES,
200
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
198
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
199
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.BALANCES,
200
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
201
201
  };
202
202
  }
203
203
  /**
@@ -245,7 +245,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
245
245
  if (accountAddresses.length === 0) {
246
246
  return { count: 0, balances: [], unprocessedNetworks: [] };
247
247
  }
248
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v4/multiaccount/balances', {
248
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v4/multiaccount/balances', {
249
249
  signal,
250
250
  params: {
251
251
  accountAddresses,
@@ -253,9 +253,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
253
253
  },
254
254
  });
255
255
  },
256
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
257
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.BALANCES,
258
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
256
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
257
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.BALANCES,
258
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
259
259
  };
260
260
  }
261
261
  /**
@@ -302,7 +302,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
302
302
  if (accountIds.length === 0) {
303
303
  return { count: 0, unprocessedNetworks: [], balances: [] };
304
304
  }
305
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v5/multiaccount/balances', {
305
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v5/multiaccount/balances', {
306
306
  signal,
307
307
  params: {
308
308
  accountIds,
@@ -312,9 +312,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
312
312
  },
313
313
  });
314
314
  },
315
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
316
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.BALANCES,
317
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
315
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
316
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.BALANCES,
317
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
318
318
  };
319
319
  }
320
320
  /**
@@ -382,7 +382,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
382
382
  accounts: [],
383
383
  };
384
384
  }
385
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v6/multiaccount/balances', {
385
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v6/multiaccount/balances', {
386
386
  signal,
387
387
  params: {
388
388
  accountIds,
@@ -401,9 +401,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
401
401
  },
402
402
  });
403
403
  },
404
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
405
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.BALANCES,
406
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
404
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
405
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.BALANCES,
406
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
407
407
  };
408
408
  }
409
409
  /**
@@ -461,7 +461,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
461
461
  'v1ByHash',
462
462
  { chainId, txHash, options: queryOptions },
463
463
  ],
464
- queryFn: ({ signal }) => this.fetch(base_client_1.API_URLS.ACCOUNTS, `/v1/networks/${chainId}/transactions/${txHash}`, {
464
+ queryFn: ({ signal }) => this.fetch(base_client_js_1.API_URLS.ACCOUNTS, `/v1/networks/${chainId}/transactions/${txHash}`, {
465
465
  signal,
466
466
  params: {
467
467
  includeLogs: queryOptions?.includeLogs,
@@ -470,9 +470,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
470
470
  lang: queryOptions?.lang,
471
471
  },
472
472
  }),
473
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
474
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.TRANSACTIONS,
475
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
473
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
474
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.TRANSACTIONS,
475
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
476
476
  };
477
477
  }
478
478
  /**
@@ -522,7 +522,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
522
522
  if (address === '') {
523
523
  return { data: [], pageInfo: { count: 0, hasNextPage: false } };
524
524
  }
525
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, `/v1/accounts/${address}/transactions`, {
525
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, `/v1/accounts/${address}/transactions`, {
526
526
  signal,
527
527
  params: {
528
528
  networks: queryOptions?.chainIds,
@@ -533,9 +533,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
533
533
  },
534
534
  });
535
535
  },
536
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
537
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.TRANSACTIONS,
538
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
536
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
537
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.TRANSACTIONS,
538
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
539
539
  };
540
540
  }
541
541
  /**
@@ -593,7 +593,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
593
593
  },
594
594
  },
595
595
  ],
596
- queryFn: ({ signal }) => this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v4/multiaccount/transactions', {
596
+ queryFn: ({ signal }) => this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v4/multiaccount/transactions', {
597
597
  signal,
598
598
  params: {
599
599
  accountAddresses,
@@ -611,9 +611,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
611
611
  lang: queryOptions?.lang,
612
612
  },
613
613
  }),
614
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
615
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.TRANSACTIONS,
616
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
614
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
615
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.TRANSACTIONS,
616
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
617
617
  };
618
618
  }
619
619
  /**
@@ -653,7 +653,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
653
653
  lang: params.lang,
654
654
  },
655
655
  ],
656
- queryFn: ({ pageParam, signal, }) => this.fetch(base_client_1.API_URLS.ACCOUNTS, '/v4/multiaccount/transactions', {
656
+ queryFn: ({ pageParam, signal, }) => this.fetch(base_client_js_1.API_URLS.ACCOUNTS, '/v4/multiaccount/transactions', {
657
657
  signal,
658
658
  params: {
659
659
  accountAddresses: params.accountAddresses,
@@ -671,9 +671,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
671
671
  }),
672
672
  getNextPageParam: ({ pageInfo }) => pageInfo.hasNextPage ? pageInfo.endCursor : undefined,
673
673
  initialPageParam: options?.initialPageParam,
674
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
675
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.TRANSACTIONS,
676
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
674
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
675
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.TRANSACTIONS,
676
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
677
677
  };
678
678
  }
679
679
  /**
@@ -714,10 +714,10 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
714
714
  getV1AccountRelationshipQueryOptions(chainId, from, to, options) {
715
715
  return {
716
716
  queryKey: ['accounts', 'v1Relationship', chainId, from, to],
717
- queryFn: async ({ signal, }) => this.fetch(base_client_1.API_URLS.ACCOUNTS, `/v1/networks/${chainId}/accounts/${from}/relationships/${to}`, { signal }),
718
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
719
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.DEFAULT,
720
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
717
+ queryFn: async ({ signal, }) => this.fetch(base_client_js_1.API_URLS.ACCOUNTS, `/v1/networks/${chainId}/accounts/${from}/relationships/${to}`, { signal }),
718
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
719
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.DEFAULT,
720
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
721
721
  };
722
722
  }
723
723
  /**
@@ -762,7 +762,7 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
762
762
  if (address === '') {
763
763
  return { data: [], pageInfo: { count: 0, hasNextPage: false } };
764
764
  }
765
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, `/v2/accounts/${address}/nfts`, {
765
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, `/v2/accounts/${address}/nfts`, {
766
766
  signal,
767
767
  params: {
768
768
  networks: queryOptions?.networks,
@@ -770,9 +770,9 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
770
770
  },
771
771
  });
772
772
  },
773
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
774
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.DEFAULT,
775
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
773
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
774
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.DEFAULT,
775
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
776
776
  };
777
777
  }
778
778
  /**
@@ -820,14 +820,14 @@ class AccountsApiClient extends base_client_1.BaseApiClient {
820
820
  if (address === '') {
821
821
  return { data: [] };
822
822
  }
823
- return this.fetch(base_client_1.API_URLS.ACCOUNTS, `/v2/accounts/${address}/tokens`, {
823
+ return this.fetch(base_client_js_1.API_URLS.ACCOUNTS, `/v2/accounts/${address}/tokens`, {
824
824
  signal,
825
825
  params: { networks: queryOptions?.networks },
826
826
  });
827
827
  },
828
- ...(0, shared_types_1.getQueryOptionsOverrides)(options),
829
- staleTime: options?.staleTime ?? base_client_1.STALE_TIMES.DEFAULT,
830
- gcTime: options?.gcTime ?? base_client_1.GC_TIMES.DEFAULT,
828
+ ...(0, shared_types_js_1.getQueryOptionsOverrides)(options),
829
+ staleTime: options?.staleTime ?? base_client_js_1.STALE_TIMES.DEFAULT,
830
+ gcTime: options?.gcTime ?? base_client_js_1.GC_TIMES.DEFAULT,
831
831
  };
832
832
  }
833
833
  /**