@metamask-previews/network-controller 36.0.0-preview-8bfa290fb → 37.0.0-preview-0a30e47

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 (158) hide show
  1. package/CHANGELOG.md +24 -3
  2. package/dist/{NetworkController-method-action-types.d.mts → NetworkController-method-action-types.d.ts} +2 -2
  3. package/dist/NetworkController-method-action-types.d.ts.map +1 -0
  4. package/dist/{NetworkController-method-action-types.mjs → NetworkController-method-action-types.js} +1 -1
  5. package/dist/NetworkController-method-action-types.js.map +1 -0
  6. package/dist/{NetworkController.d.cts → NetworkController.d.ts} +37 -29
  7. package/dist/NetworkController.d.ts.map +1 -0
  8. package/dist/{NetworkController.mjs → NetworkController.js} +717 -615
  9. package/dist/NetworkController.js.map +1 -0
  10. package/dist/{constants.d.cts → constants.d.ts} +1 -1
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/{constants.mjs → constants.js} +1 -1
  13. package/dist/constants.js.map +1 -0
  14. package/dist/{create-auto-managed-network-client.d.cts → create-auto-managed-network-client.d.ts} +7 -7
  15. package/dist/create-auto-managed-network-client.d.ts.map +1 -0
  16. package/dist/{create-auto-managed-network-client.mjs → create-auto-managed-network-client.js} +4 -4
  17. package/dist/create-auto-managed-network-client.js.map +1 -0
  18. package/dist/{create-network-client.d.cts → create-network-client.d.ts} +7 -7
  19. package/dist/create-network-client.d.ts.map +1 -0
  20. package/dist/{create-network-client.mjs → create-network-client.js} +17 -14
  21. package/dist/create-network-client.js.map +1 -0
  22. package/dist/{index.d.cts → index.d.ts} +16 -16
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +6 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/logger.d.ts +4 -0
  27. package/dist/logger.d.ts.map +1 -0
  28. package/dist/logger.js +4 -0
  29. package/dist/logger.js.map +1 -0
  30. package/dist/rpc-service/{abstract-rpc-service.d.cts → abstract-rpc-service.d.ts} +2 -2
  31. package/dist/rpc-service/abstract-rpc-service.d.ts.map +1 -0
  32. package/dist/rpc-service/abstract-rpc-service.js +2 -0
  33. package/dist/rpc-service/abstract-rpc-service.js.map +1 -0
  34. package/dist/rpc-service/{rpc-service-chain.d.cts → rpc-service-chain.d.ts} +6 -6
  35. package/dist/rpc-service/rpc-service-chain.d.ts.map +1 -0
  36. package/dist/rpc-service/{rpc-service-chain.mjs → rpc-service-chain.js} +57 -70
  37. package/dist/rpc-service/rpc-service-chain.js.map +1 -0
  38. package/dist/rpc-service/{rpc-service-requestable.d.cts → rpc-service-requestable.d.ts} +4 -4
  39. package/dist/rpc-service/rpc-service-requestable.d.ts.map +1 -0
  40. package/dist/rpc-service/rpc-service-requestable.js +2 -0
  41. package/dist/rpc-service/rpc-service-requestable.js.map +1 -0
  42. package/dist/rpc-service/{rpc-service.d.mts → rpc-service.d.ts} +6 -6
  43. package/dist/rpc-service/rpc-service.d.ts.map +1 -0
  44. package/dist/rpc-service/{rpc-service.mjs → rpc-service.js} +206 -197
  45. package/dist/rpc-service/rpc-service.js.map +1 -0
  46. package/dist/rpc-service/{shared.d.cts → shared.d.ts} +2 -2
  47. package/dist/rpc-service/shared.d.ts.map +1 -0
  48. package/dist/rpc-service/shared.js +2 -0
  49. package/dist/rpc-service/shared.js.map +1 -0
  50. package/dist/{rpc-service-analytics.d.mts → rpc-service-analytics.d.ts} +3 -3
  51. package/dist/rpc-service-analytics.d.ts.map +1 -0
  52. package/dist/{rpc-service-analytics.mjs → rpc-service-analytics.js} +4 -4
  53. package/dist/rpc-service-analytics.js.map +1 -0
  54. package/dist/{selectors.d.mts → selectors.d.ts} +2 -2
  55. package/dist/selectors.d.ts.map +1 -0
  56. package/dist/{selectors.mjs → selectors.js} +1 -1
  57. package/dist/selectors.js.map +1 -0
  58. package/dist/{types.d.cts → types.d.ts} +5 -5
  59. package/dist/types.d.ts.map +1 -0
  60. package/dist/{types.mjs → types.js} +1 -1
  61. package/dist/types.js.map +1 -0
  62. package/package.json +26 -30
  63. package/dist/NetworkController-method-action-types.cjs +0 -7
  64. package/dist/NetworkController-method-action-types.cjs.map +0 -1
  65. package/dist/NetworkController-method-action-types.d.cts +0 -268
  66. package/dist/NetworkController-method-action-types.d.cts.map +0 -1
  67. package/dist/NetworkController-method-action-types.d.mts.map +0 -1
  68. package/dist/NetworkController-method-action-types.mjs.map +0 -1
  69. package/dist/NetworkController.cjs +0 -1599
  70. package/dist/NetworkController.cjs.map +0 -1
  71. package/dist/NetworkController.d.cts.map +0 -1
  72. package/dist/NetworkController.d.mts +0 -956
  73. package/dist/NetworkController.d.mts.map +0 -1
  74. package/dist/NetworkController.mjs.map +0 -1
  75. package/dist/constants.cjs +0 -46
  76. package/dist/constants.cjs.map +0 -1
  77. package/dist/constants.d.cts.map +0 -1
  78. package/dist/constants.d.mts +0 -42
  79. package/dist/constants.d.mts.map +0 -1
  80. package/dist/constants.mjs.map +0 -1
  81. package/dist/create-auto-managed-network-client.cjs +0 -149
  82. package/dist/create-auto-managed-network-client.cjs.map +0 -1
  83. package/dist/create-auto-managed-network-client.d.cts.map +0 -1
  84. package/dist/create-auto-managed-network-client.d.mts +0 -74
  85. package/dist/create-auto-managed-network-client.d.mts.map +0 -1
  86. package/dist/create-auto-managed-network-client.mjs.map +0 -1
  87. package/dist/create-network-client.cjs +0 -439
  88. package/dist/create-network-client.cjs.map +0 -1
  89. package/dist/create-network-client.d.cts.map +0 -1
  90. package/dist/create-network-client.d.mts +0 -60
  91. package/dist/create-network-client.d.mts.map +0 -1
  92. package/dist/create-network-client.mjs.map +0 -1
  93. package/dist/index.cjs +0 -31
  94. package/dist/index.cjs.map +0 -1
  95. package/dist/index.d.cts.map +0 -1
  96. package/dist/index.d.mts +0 -16
  97. package/dist/index.d.mts.map +0 -1
  98. package/dist/index.mjs +0 -6
  99. package/dist/index.mjs.map +0 -1
  100. package/dist/logger.cjs +0 -7
  101. package/dist/logger.cjs.map +0 -1
  102. package/dist/logger.d.cts +0 -5
  103. package/dist/logger.d.cts.map +0 -1
  104. package/dist/logger.d.mts +0 -5
  105. package/dist/logger.d.mts.map +0 -1
  106. package/dist/logger.mjs +0 -4
  107. package/dist/logger.mjs.map +0 -1
  108. package/dist/rpc-service/abstract-rpc-service.cjs +0 -3
  109. package/dist/rpc-service/abstract-rpc-service.cjs.map +0 -1
  110. package/dist/rpc-service/abstract-rpc-service.d.cts.map +0 -1
  111. package/dist/rpc-service/abstract-rpc-service.d.mts +0 -17
  112. package/dist/rpc-service/abstract-rpc-service.d.mts.map +0 -1
  113. package/dist/rpc-service/abstract-rpc-service.mjs +0 -2
  114. package/dist/rpc-service/abstract-rpc-service.mjs.map +0 -1
  115. package/dist/rpc-service/rpc-service-chain.cjs +0 -304
  116. package/dist/rpc-service/rpc-service-chain.cjs.map +0 -1
  117. package/dist/rpc-service/rpc-service-chain.d.cts.map +0 -1
  118. package/dist/rpc-service/rpc-service-chain.d.mts +0 -169
  119. package/dist/rpc-service/rpc-service-chain.d.mts.map +0 -1
  120. package/dist/rpc-service/rpc-service-chain.mjs.map +0 -1
  121. package/dist/rpc-service/rpc-service-requestable.cjs +0 -3
  122. package/dist/rpc-service/rpc-service-requestable.cjs.map +0 -1
  123. package/dist/rpc-service/rpc-service-requestable.d.cts.map +0 -1
  124. package/dist/rpc-service/rpc-service-requestable.d.mts +0 -63
  125. package/dist/rpc-service/rpc-service-requestable.d.mts.map +0 -1
  126. package/dist/rpc-service/rpc-service-requestable.mjs +0 -2
  127. package/dist/rpc-service/rpc-service-requestable.mjs.map +0 -1
  128. package/dist/rpc-service/rpc-service.cjs +0 -540
  129. package/dist/rpc-service/rpc-service.cjs.map +0 -1
  130. package/dist/rpc-service/rpc-service.d.cts +0 -247
  131. package/dist/rpc-service/rpc-service.d.cts.map +0 -1
  132. package/dist/rpc-service/rpc-service.d.mts.map +0 -1
  133. package/dist/rpc-service/rpc-service.mjs.map +0 -1
  134. package/dist/rpc-service/shared.cjs +0 -3
  135. package/dist/rpc-service/shared.cjs.map +0 -1
  136. package/dist/rpc-service/shared.d.cts.map +0 -1
  137. package/dist/rpc-service/shared.d.mts +0 -32
  138. package/dist/rpc-service/shared.d.mts.map +0 -1
  139. package/dist/rpc-service/shared.mjs +0 -2
  140. package/dist/rpc-service/shared.mjs.map +0 -1
  141. package/dist/rpc-service-analytics.cjs +0 -180
  142. package/dist/rpc-service-analytics.cjs.map +0 -1
  143. package/dist/rpc-service-analytics.d.cts +0 -85
  144. package/dist/rpc-service-analytics.d.cts.map +0 -1
  145. package/dist/rpc-service-analytics.d.mts.map +0 -1
  146. package/dist/rpc-service-analytics.mjs.map +0 -1
  147. package/dist/selectors.cjs +0 -16
  148. package/dist/selectors.cjs.map +0 -1
  149. package/dist/selectors.d.cts +0 -22
  150. package/dist/selectors.d.cts.map +0 -1
  151. package/dist/selectors.d.mts.map +0 -1
  152. package/dist/selectors.mjs.map +0 -1
  153. package/dist/types.cjs +0 -12
  154. package/dist/types.cjs.map +0 -1
  155. package/dist/types.d.cts.map +0 -1
  156. package/dist/types.d.mts +0 -49
  157. package/dist/types.d.mts.map +0 -1
  158. package/dist/types.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
- import { generateDeterministicRandomNumber } from "@metamask/remote-feature-flag-controller";
2
- import { hasProperty, hexToNumber, isObject, isValidJson, wrapError } from "@metamask/utils";
3
- import { isConnectionError } from "./rpc-service/rpc-service.mjs";
1
+ import { generateDeterministicRandomNumber } from '@metamask/remote-feature-flag-controller';
2
+ import { hasProperty, hexToNumber, isObject, isValidJson, wrapError, } from '@metamask/utils';
3
+ import { isConnectionError } from './rpc-service/rpc-service.js';
4
4
  /**
5
5
  * Hides any API key contained in an RPC endpoint URL by reducing it to its
6
6
  * host, but only when the endpoint is considered public. Non-public endpoints
@@ -169,4 +169,4 @@ export function trackRpcServiceDegraded(messenger, analyticsOptions, payload) {
169
169
  buildTrackingEvent: () => buildRpcServiceDegradedAnalyticsTrackingEvent(payload, analyticsOptions.isRpcEndpointUrlPublic),
170
170
  });
171
171
  }
172
- //# sourceMappingURL=rpc-service-analytics.mjs.map
172
+ //# sourceMappingURL=rpc-service-analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-service-analytics.js","sourceRoot":"","sources":["../src/rpc-service-analytics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,0CAA0C,CAAC;AAE7F,OAAO,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,GACV,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAgDjE;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CACpC,WAAmB,EACnB,QAAiB;IAEjB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,wBAAwB,CAC/B,IAAyB,EACzB,UAAgC;IAEhC,OAAO;QACL,IAAI;QACJ,UAAU;QACV,mBAAmB,EAAE,EAAE;QACvB,iBAAiB,EAAE,KAAK;QACxB,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC;KAClD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,oCAAoC,CAAC,EAC5C,OAAO,EACP,WAAW,EACX,KAAK,EACL,sBAAsB,GAMvB;IACC,MAAM,YAAY,GAAG,sBAAsB,CACzC,WAAW,EACX,sBAAsB,CAAC,WAAW,CAAC,CACpC,CAAC;IAEF,4DAA4D;IAC5D,OAAO;QACL,aAAa,EAAE,UAAU,WAAW,CAAC,OAAO,CAAC,EAAE;QAC/C,UAAU,EAAE,YAAY;QACxB,gBAAgB,EAAE,YA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kBAAkB,EAAE,GAAG,EAAE,CACvB,6CAA6C,CAC3C,OAAO,EACP,gBAAgB,CAAC,sBAAsB,CACxC;KACJ,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { AnalyticsTrackingEvent } from '@metamask/analytics-controller';\nimport { generateDeterministicRandomNumber } from '@metamask/remote-feature-flag-controller';\nimport type { Hex, Json } from '@metamask/utils';\nimport {\n hasProperty,\n hexToNumber,\n isObject,\n isValidJson,\n wrapError,\n} from '@metamask/utils';\n\nimport type {\n NetworkControllerMessenger,\n NetworkControllerRpcEndpointDegradedEvent,\n NetworkControllerRpcEndpointUnavailableEvent,\n} from './NetworkController.js';\nimport { isConnectionError } from './rpc-service/rpc-service.js';\n\ntype RpcEndpointUnavailablePayload =\n NetworkControllerRpcEndpointUnavailableEvent['payload'][0];\n\ntype RpcEndpointDegradedPayload =\n NetworkControllerRpcEndpointDegradedEvent['payload'][0];\n\n/**\n * The names of the analytics events that {@link NetworkController} emits when an\n * RPC endpoint becomes unavailable or degraded.\n */\nexport type RpcServiceEventName =\n | 'RPC Service Unavailable'\n | 'RPC Service Degraded';\n\n/**\n * Configuration that enables {@link NetworkController} to emit analytics events\n * for unavailable or degraded RPC endpoints.\n *\n * The pieces here are client-specific and cannot be derived inside the\n * controller: deciding whether an endpoint URL is safe to report depends on the\n * client's lists of known networks, and the sample rate depends on the client's\n * build environment.\n */\nexport type NetworkControllerAnalyticsOptions = {\n /**\n * Returns `true` if the given RPC endpoint URL is safe to report verbatim (a\n * \"public\" endpoint), or `false` if it must be reported as the literal string\n * `'custom'` to avoid leaking private servers. Defaults to `() => false`.\n */\n isRpcEndpointUrlPublic?: (endpointUrl: string) => boolean;\n /**\n * The proportion of events to emit, between 0 and 1. `1` emits every event,\n * `0` emits none. Clients typically use a small value (e.g. `0.01`) in\n * production to stay within their analytics quota, and `1` in development.\n * Defaults to `0`.\n */\n rpcServiceEventsSampleRate?: number;\n};\n\n/**\n * {@link NetworkControllerAnalyticsOptions} with defaults applied, as used\n * internally once the controller has filled in any omitted properties.\n */\nexport type ResolvedNetworkControllerAnalyticsOptions =\n Required<NetworkControllerAnalyticsOptions>;\n\n/**\n * Hides any API key contained in an RPC endpoint URL by reducing it to its\n * host, but only when the endpoint is considered public. Non-public endpoints\n * (and URLs that cannot be parsed) are reported as the literal string\n * `'custom'`.\n *\n * @param endpointUrl - The URL of the RPC endpoint.\n * @param isPublic - Whether the endpoint is safe to report verbatim.\n * @returns The sanitized value to report.\n */\nexport function sanitizeRpcEndpointUrl(\n endpointUrl: string,\n isPublic: boolean,\n): string {\n if (!isPublic) {\n return 'custom';\n }\n\n try {\n return new URL(endpointUrl).host;\n } catch {\n return 'custom';\n }\n}\n\n/**\n * Wraps a name and properties into the shape expected by the\n * `AnalyticsController:trackEvent` action.\n *\n * @param name - The analytics event name.\n * @param properties - The analytics event properties.\n * @returns The analytics tracking event.\n */\nfunction toAnalyticsTrackingEvent(\n name: RpcServiceEventName,\n properties: Record<string, Json>,\n): AnalyticsTrackingEvent {\n return {\n name,\n properties,\n sensitiveProperties: {},\n saveDataRecording: false,\n hasProperties: Object.keys(properties).length > 0,\n };\n}\n\n/**\n * Builds the properties common to both RPC service events.\n *\n * @param args - The arguments.\n * @param args.chainId - The chain ID that the endpoint represents.\n * @param args.endpointUrl - The URL of the endpoint.\n * @param args.error - The connection or response error encountered.\n * @param args.isRpcEndpointUrlPublic - Returns whether the endpoint URL is safe\n * to report verbatim.\n * @returns The common analytics event properties.\n */\nfunction buildCommonRpcServiceEventProperties({\n chainId,\n endpointUrl,\n error,\n isRpcEndpointUrlPublic,\n}: {\n chainId: Hex;\n endpointUrl: string;\n error: unknown;\n isRpcEndpointUrlPublic: (endpointUrl: string) => boolean;\n}): Record<string, Json> {\n const sanitizedUrl = sanitizeRpcEndpointUrl(\n endpointUrl,\n isRpcEndpointUrlPublic(endpointUrl),\n );\n\n // The names of analytics properties have a particular case.\n return {\n chain_id_caip: `eip155:${hexToNumber(chainId)}`,\n rpc_domain: sanitizedUrl,\n rpc_endpoint_url: sanitizedUrl, // @deprecated - Will be removed in a future release.\n ...(isObject(error) &&\n hasProperty(error, 'httpStatus') &&\n isValidJson(error.httpStatus)\n ? { http_status: error.httpStatus }\n : {}),\n };\n}\n\n/**\n * Builds the \"RPC Service Unavailable\" analytics tracking event.\n *\n * @param payload - The `rpcEndpointUnavailable` event payload.\n * @param isRpcEndpointUrlPublic - Returns whether the endpoint URL is safe to\n * report verbatim.\n * @returns The analytics tracking event.\n */\nexport function buildRpcServiceUnavailableAnalyticsTrackingEvent(\n payload: RpcEndpointUnavailablePayload,\n isRpcEndpointUrlPublic: (endpointUrl: string) => boolean,\n): AnalyticsTrackingEvent {\n return toAnalyticsTrackingEvent(\n 'RPC Service Unavailable',\n buildCommonRpcServiceEventProperties({\n chainId: payload.chainId,\n endpointUrl: payload.endpointUrl,\n error: payload.error,\n isRpcEndpointUrlPublic,\n }),\n );\n}\n\n/**\n * Builds the \"RPC Service Degraded\" analytics tracking event.\n *\n * @param payload - The `rpcEndpointDegraded` event payload.\n * @param isRpcEndpointUrlPublic - Returns whether the endpoint URL is safe to\n * report verbatim.\n * @returns The analytics tracking event.\n */\nexport function buildRpcServiceDegradedAnalyticsTrackingEvent(\n payload: RpcEndpointDegradedPayload,\n isRpcEndpointUrlPublic: (endpointUrl: string) => boolean,\n): AnalyticsTrackingEvent {\n const { duration, retryReason, rpcMethodName, traceId, type } = payload;\n\n // The names of analytics properties have a particular case.\n return toAnalyticsTrackingEvent('RPC Service Degraded', {\n ...buildCommonRpcServiceEventProperties({\n chainId: payload.chainId,\n endpointUrl: payload.endpointUrl,\n error: payload.error,\n isRpcEndpointUrlPublic,\n }),\n rpc_method_name: rpcMethodName,\n type,\n ...(retryReason ? { retry_reason: retryReason } : {}),\n ...(duration === undefined ? {} : { duration_ms: duration }),\n ...(traceId === undefined ? {} : { trace_id: traceId }),\n });\n}\n\n/**\n * Delivers an RPC service analytics event via the\n * `AnalyticsController:trackEvent` action, skipping local connection errors,\n * users without an analytics ID, and events that fall outside the configured\n * sample. Failures never propagate to the caller.\n *\n * @param args - The arguments.\n * @param args.messenger - The controller messenger.\n * @param args.analyticsOptions - The analytics configuration.\n * @param args.error - The error encountered, used to skip local connection errors.\n * @param args.buildTrackingEvent - Builds the event to deliver. Called lazily\n * inside the `try` so that a throw from the client's `isRpcEndpointUrlPublic` is\n * captured rather than propagated, and so the event is not built when it will\n * not be sent.\n */\nfunction trackRpcServiceEvent({\n messenger,\n analyticsOptions,\n error,\n buildTrackingEvent,\n}: {\n messenger: NetworkControllerMessenger;\n analyticsOptions: ResolvedNetworkControllerAnalyticsOptions;\n error: unknown;\n buildTrackingEvent: () => AnalyticsTrackingEvent;\n}): void {\n try {\n if (isConnectionError(error)) {\n return;\n }\n\n const { analyticsId } = messenger.call('AnalyticsController:getState');\n if (!analyticsId) {\n return;\n }\n\n if (\n generateDeterministicRandomNumber(analyticsId) >=\n analyticsOptions.rpcServiceEventsSampleRate\n ) {\n return;\n }\n\n messenger.call('AnalyticsController:trackEvent', buildTrackingEvent());\n } catch (caughtError) {\n messenger.captureException?.(\n wrapError(caughtError, 'Could not create analytics event'),\n );\n }\n}\n\n/**\n * Emits an \"RPC Service Unavailable\" analytics event.\n *\n * @param messenger - The controller messenger.\n * @param analyticsOptions - The analytics configuration.\n * @param payload - The `rpcEndpointUnavailable` event payload.\n */\nexport function trackRpcServiceUnavailable(\n messenger: NetworkControllerMessenger,\n analyticsOptions: ResolvedNetworkControllerAnalyticsOptions,\n payload: RpcEndpointUnavailablePayload,\n): void {\n trackRpcServiceEvent({\n messenger,\n analyticsOptions,\n error: payload.error,\n buildTrackingEvent: () =>\n buildRpcServiceUnavailableAnalyticsTrackingEvent(\n payload,\n analyticsOptions.isRpcEndpointUrlPublic,\n ),\n });\n}\n\n/**\n * Emits an \"RPC Service Degraded\" analytics event.\n *\n * @param messenger - The controller messenger.\n * @param analyticsOptions - The analytics configuration.\n * @param payload - The `rpcEndpointDegraded` event payload.\n */\nexport function trackRpcServiceDegraded(\n messenger: NetworkControllerMessenger,\n analyticsOptions: ResolvedNetworkControllerAnalyticsOptions,\n payload: RpcEndpointDegradedPayload,\n): void {\n trackRpcServiceEvent({\n messenger,\n analyticsOptions,\n error: payload.error,\n buildTrackingEvent: () =>\n buildRpcServiceDegradedAnalyticsTrackingEvent(\n payload,\n analyticsOptions.isRpcEndpointUrlPublic,\n ),\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { RemoteFeatureFlagControllerState } from "@metamask/remote-feature-flag-controller";
1
+ import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-controller';
2
2
  /**
3
3
  * The RPC failover behavior for Infura networks, controlled by the
4
4
  * `corePlatformRpcFailoverMode` remote feature flag.
@@ -19,4 +19,4 @@ export type RpcFailoverMode = 'disabled' | 'enabled' | 'forced';
19
19
  * @returns The RPC failover mode.
20
20
  */
21
21
  export declare function getRpcFailoverMode(state: RemoteFeatureFlagControllerState): RpcFailoverMode;
22
- //# sourceMappingURL=selectors.d.mts.map
22
+ //# sourceMappingURL=selectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gCAAgC,GACtC,eAAe,CAGjB"}
@@ -9,4 +9,4 @@ export function getRpcFailoverMode(state) {
9
9
  const mode = state.remoteFeatureFlags.corePlatformRpcFailoverMode;
10
10
  return mode === 'enabled' || mode === 'forced' ? mode : 'disabled';
11
11
  }
12
- //# sourceMappingURL=selectors.mjs.map
12
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAuC;IAEvC,MAAM,IAAI,GAAG,KAAK,CAAC,kBAAkB,CAAC,2BAA2B,CAAC;IAClE,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;AACrE,CAAC","sourcesContent":["import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-controller';\n\n/**\n * The RPC failover behavior for Infura networks, controlled by the\n * `corePlatformRpcFailoverMode` remote feature flag.\n *\n * - `disabled`: failover URLs are ignored; traffic stays on the primary\n * endpoint.\n * - `enabled`: traffic automatically diverts to failover URLs when the primary\n * endpoint is unavailable.\n * - `forced`: Infura endpoints that have failover URLs route all traffic to\n * those failover URLs, bypassing Infura entirely.\n */\nexport type RpcFailoverMode = 'disabled' | 'enabled' | 'forced';\n\n/**\n * Reads the RPC failover mode from the remote feature flags, defaulting to\n * `disabled` when the flag is absent or not a recognized value.\n *\n * @param state - The remote feature flag controller state.\n * @returns The RPC failover mode.\n */\nexport function getRpcFailoverMode(\n state: RemoteFeatureFlagControllerState,\n): RpcFailoverMode {\n const mode = state.remoteFeatureFlags.corePlatformRpcFailoverMode;\n return mode === 'enabled' || mode === 'forced' ? mode : 'disabled';\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { BlockTracker as BaseBlockTracker } from "@metamask/eth-block-tracker";
2
- import type { InternalProvider } from "@metamask/eth-json-rpc-provider";
3
- import type { MiddlewareContext } from "@metamask/json-rpc-engine/v2";
4
- import type { Hex } from "@metamask/utils";
1
+ import type { BlockTracker as BaseBlockTracker } from '@metamask/eth-block-tracker';
2
+ import type { InternalProvider } from '@metamask/eth-json-rpc-provider';
3
+ import type { MiddlewareContext } from '@metamask/json-rpc-engine/v2';
4
+ import type { Hex } from '@metamask/utils';
5
5
  export type Provider = InternalProvider<MiddlewareContext<{
6
6
  origin: string;
7
7
  skipCache: boolean;
@@ -46,4 +46,4 @@ export type InfuraNetworkClientConfiguration = CommonNetworkClientConfiguration
46
46
  */
47
47
  export type NetworkClientConfiguration = CustomNetworkClientConfiguration | InfuraNetworkClientConfiguration;
48
48
  export {};
49
- //# sourceMappingURL=types.d.cts.map
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CACrC,iBAAiB,CACf;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACjE,CACF,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG;IAC5C,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,KAAK,gCAAgC,GAAG;IACtC,OAAO,EAAE,GAAG,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAC1C,gCAAgC,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;CAChC,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAC1C,gCAAgC,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;CAChC,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAClC,gCAAgC,GAChC,gCAAgC,CAAC"}
@@ -6,4 +6,4 @@ export var NetworkClientType;
6
6
  NetworkClientType["Custom"] = "custom";
7
7
  NetworkClientType["Infura"] = "infura";
8
8
  })(NetworkClientType || (NetworkClientType = {}));
9
- //# sourceMappingURL=types.mjs.map
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B","sourcesContent":["import type { BlockTracker as BaseBlockTracker } from '@metamask/eth-block-tracker';\nimport type { InternalProvider } from '@metamask/eth-json-rpc-provider';\nimport type { MiddlewareContext } from '@metamask/json-rpc-engine/v2';\nimport type { Hex } from '@metamask/utils';\n\nexport type Provider = InternalProvider<\n MiddlewareContext<\n { origin: string; skipCache: boolean } & Record<string, unknown>\n >\n>;\n\nexport type BlockTracker = BaseBlockTracker & {\n checkForLatestBlock(): Promise<string>;\n};\n\n/**\n * The type of network client that can be created.\n */\nexport enum NetworkClientType {\n Custom = 'custom',\n Infura = 'infura',\n}\n\n/**\n * A configuration object that can be used to create a client for a network.\n */\ntype CommonNetworkClientConfiguration = {\n chainId: Hex;\n failoverRpcUrls?: string[];\n ticker: string;\n};\n\n/**\n * A configuration object that can be used to create a client for a custom\n * network.\n */\nexport type CustomNetworkClientConfiguration =\n CommonNetworkClientConfiguration & {\n rpcUrl: string;\n type: NetworkClientType.Custom;\n };\n\n/**\n * A configuration object that can be used to create a client for an Infura\n * network.\n */\nexport type InfuraNetworkClientConfiguration =\n CommonNetworkClientConfiguration & {\n network: string;\n infuraProjectId: string;\n type: NetworkClientType.Infura;\n };\n\n/**\n * A configuration object that can be used to create a client for a network.\n */\nexport type NetworkClientConfiguration =\n | CustomNetworkClientConfiguration\n | InfuraNetworkClientConfiguration;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/network-controller",
3
- "version": "36.0.0-preview-8bfa290fb",
3
+ "version": "37.0.0-preview-0a30e47",
4
4
  "description": "Provides an interface to the currently selected network via a MetaMask-compatible provider object",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -18,19 +18,12 @@
18
18
  "files": [
19
19
  "dist/"
20
20
  ],
21
+ "type": "module",
21
22
  "sideEffects": false,
22
- "main": "./dist/index.cjs",
23
- "types": "./dist/index.d.cts",
24
23
  "exports": {
25
24
  ".": {
26
- "import": {
27
- "types": "./dist/index.d.mts",
28
- "default": "./dist/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.cts",
32
- "default": "./dist/index.cjs"
33
- }
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
34
27
  },
35
28
  "./package.json": "./package.json"
36
29
  },
@@ -39,9 +32,11 @@
39
32
  "registry": "https://registry.npmjs.org/"
40
33
  },
41
34
  "scripts": {
42
- "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
43
- "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
35
+ "build": "tsc --project tsconfig.build.json",
36
+ "build:all": "tsc --build tsconfig.build.json --verbose",
37
+ "build:clean": "yarn build:only-clean && yarn build",
44
38
  "build:docs": "typedoc",
39
+ "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
45
40
  "changelog:update": "../../scripts/update-changelog.sh @metamask/network-controller",
46
41
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/network-controller",
47
42
  "lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts",
@@ -55,19 +50,19 @@
55
50
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
56
51
  },
57
52
  "dependencies": {
58
- "@metamask/analytics-controller": "^2.0.0",
59
- "@metamask/base-controller": "^9.1.0",
60
- "@metamask/config-registry-controller": "^3.1.0",
61
- "@metamask/connectivity-controller": "^0.3.0",
62
- "@metamask/controller-utils": "^12.3.0",
63
- "@metamask/eth-block-tracker": "^15.0.1",
53
+ "@metamask/analytics-controller": "^3.0.0",
54
+ "@metamask/base-controller": "^10.0.0",
55
+ "@metamask/config-registry-controller": "^4.0.0",
56
+ "@metamask/connectivity-controller": "^1.0.0",
57
+ "@metamask/controller-utils": "^13.0.0",
58
+ "@metamask/eth-block-tracker": "^16.0.0",
64
59
  "@metamask/eth-json-rpc-infura": "^10.3.0",
65
- "@metamask/eth-json-rpc-middleware": "^24.0.2",
66
- "@metamask/eth-json-rpc-provider": "^6.0.1",
60
+ "@metamask/eth-json-rpc-middleware": "^25.0.0",
61
+ "@metamask/eth-json-rpc-provider": "^7.0.0",
67
62
  "@metamask/eth-query": "^4.0.0",
68
- "@metamask/json-rpc-engine": "^10.5.0",
69
- "@metamask/messenger": "^2.0.0",
70
- "@metamask/remote-feature-flag-controller": "^6.1.0",
63
+ "@metamask/json-rpc-engine": "^11.0.0",
64
+ "@metamask/messenger": "^3.0.0",
65
+ "@metamask/remote-feature-flag-controller": "^7.0.0",
71
66
  "@metamask/rpc-errors": "^7.0.2",
72
67
  "@metamask/swappable-obj-proxy": "^2.3.0",
73
68
  "@metamask/utils": "^11.12.0",
@@ -76,33 +71,34 @@
76
71
  "loglevel": "^1.8.1",
77
72
  "reselect": "^5.1.1",
78
73
  "uri-js": "^4.4.1",
79
- "uuid": "^8.3.2"
74
+ "uuid": "^9.0.1"
80
75
  },
81
76
  "devDependencies": {
82
77
  "@json-rpc-specification/meta-schema": "^1.0.6",
83
78
  "@metamask/auto-changelog": "^6.1.0",
84
- "@ts-bridge/cli": "^0.6.4",
85
79
  "@types/deep-freeze-strict": "^1.1.0",
86
80
  "@types/jest": "^30.0.0",
87
81
  "@types/jest-when": "^2.7.3",
88
- "@types/lodash": "^4.14.191",
82
+ "@types/lodash-es": "^4.17.12",
89
83
  "@types/node-fetch": "^2.6.12",
84
+ "@typescript/native": "npm:typescript@^7.0.2",
90
85
  "cockatiel": "^3.1.2",
91
86
  "deep-freeze-strict": "^1.1.1",
92
87
  "deepmerge": "^4.2.2",
93
88
  "jest": "^30.4.2",
94
89
  "jest-environment-jsdom": "^30.4.1",
95
90
  "jest-when": "^3.7.0",
96
- "lodash": "^4.17.21",
91
+ "lodash-es": "^4.17.21",
97
92
  "nock": "^13.3.1",
98
93
  "node-fetch": "^2.7.0",
94
+ "rimraf": "^5.0.5",
99
95
  "ts-jest": "^29.4.11",
100
96
  "tsx": "^4.20.5",
101
97
  "typedoc": "^0.25.13",
102
98
  "typedoc-plugin-missing-exports": "^2.0.0",
103
- "typescript": "~5.3.3"
99
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
104
100
  },
105
101
  "engines": {
106
- "node": "^18.18 || >=20"
102
+ "node": "^22.14.0 || ^24"
107
103
  }
108
104
  }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file is auto generated.
4
- * Do not edit manually.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=NetworkController-method-action-types.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NetworkController-method-action-types.cjs","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkController } from './NetworkController.js';\n\n/**\n * Returns the EthQuery instance for the currently selected network.\n *\n * @returns The EthQuery instance, or undefined if the provider has not been\n * initialized.\n */\nexport type NetworkControllerGetEthQueryAction = {\n type: `NetworkController:getEthQuery`;\n handler: NetworkController['getEthQuery'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns The proxy and block tracker proxies.\n * @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.\n */\nexport type NetworkControllerGetProviderAndBlockTrackerAction = {\n type: `NetworkController:getProviderAndBlockTracker`;\n handler: NetworkController['getProviderAndBlockTracker'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns an object with the provider and block tracker proxies for the currently selected network.\n */\nexport type NetworkControllerGetSelectedNetworkClientAction = {\n type: `NetworkController:getSelectedNetworkClient`;\n handler: NetworkController['getSelectedNetworkClient'];\n};\n\n/**\n * Accesses the chain ID from the selected network client.\n *\n * @returns The chain ID of the selected network client in hex format or undefined if there is no network client.\n */\nexport type NetworkControllerGetSelectedChainIdAction = {\n type: `NetworkController:getSelectedChainId`;\n handler: NetworkController['getSelectedChainId'];\n};\n\n/**\n * Internally, the Infura and custom network clients are categorized by type\n * so that when accessing either kind of network client, TypeScript knows\n * which type to assign to the network client. For some cases it's more useful\n * to be able to access network clients by ID instead of by type and then ID,\n * so this function makes that possible.\n *\n * @returns The network clients registered so far, keyed by ID.\n */\nexport type NetworkControllerGetNetworkClientRegistryAction = {\n type: `NetworkController:getNetworkClientRegistry`;\n handler: NetworkController['getNetworkClientRegistry'];\n};\n\n/**\n * Returns the Infura network client with the given ID.\n *\n * @param infuraNetworkClientId - An Infura network client ID.\n * @returns The Infura network client.\n * @throws If an Infura network client does not exist with the given ID.\n */\nexport type NetworkControllerGetNetworkClientByIdAction = {\n type: `NetworkController:getNetworkClientById`;\n handler: NetworkController['getNetworkClientById'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given or selected network, persisting it to state:\n *\n * - The connectivity status: whether it is available, geo-blocked (Infura\n * only), unavailable, or unknown\n * - The capabilities status: whether it supports EIP-1559, whether it does\n * not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * If no ID is provided, uses the currently selected network.\n */\nexport type NetworkControllerLookupNetworkAction = {\n type: `NetworkController:lookupNetwork`;\n handler: NetworkController['lookupNetwork'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given network, persisting it to state:\n *\n * - The connectivity status: whether the network is available, geo-blocked\n * (Infura only), unavailable, or unknown\n * - The feature compatibility status: whether the network supports EIP-1559,\n * whether it does not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * @deprecated Please use `lookupNetwork` and pass a network client ID\n * instead. This method will be removed in a future major version.\n */\nexport type NetworkControllerLookupNetworkByClientIdAction = {\n type: `NetworkController:lookupNetworkByClientId`;\n handler: NetworkController['lookupNetworkByClientId'];\n};\n\n/**\n * Convenience method to update provider network type settings.\n *\n * @param type - Human readable network name.\n * @deprecated This has been replaced by `setActiveNetwork`, and will be\n * removed in a future release\n */\nexport type NetworkControllerSetProviderTypeAction = {\n type: `NetworkController:setProviderType`;\n handler: NetworkController['setProviderType'];\n};\n\n/**\n * Changes the selected network.\n *\n * @param networkClientId - The ID of a network client that will be used to\n * make requests.\n * @param options - Options for this method.\n * @param options.updateState - Allows for updating state.\n * @throws if no network client is associated with the given\n * network client ID.\n */\nexport type NetworkControllerSetActiveNetworkAction = {\n type: `NetworkController:setActiveNetwork`;\n handler: NetworkController['setActiveNetwork'];\n};\n\n/**\n * Determines whether the network supports EIP-1559 by checking whether the\n * latest block has a `baseFeePerGas` property, then updates state\n * appropriately.\n *\n * @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.\n * @returns A promise that resolves to true if the network supports EIP-1559\n * , false otherwise, or `undefined` if unable to determine the compatibility.\n */\nexport type NetworkControllerGetEIP1559CompatibilityAction = {\n type: `NetworkController:getEIP1559Compatibility`;\n handler: NetworkController['getEIP1559Compatibility'];\n};\n\nexport type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {\n type: `NetworkController:get1559CompatibilityWithNetworkClientId`;\n handler: NetworkController['get1559CompatibilityWithNetworkClientId'];\n};\n\n/**\n * Ensures that the provider and block tracker proxies are pointed to the\n * currently selected network and refreshes the metadata for the\n */\nexport type NetworkControllerResetConnectionAction = {\n type: `NetworkController:resetConnection`;\n handler: NetworkController['resetConnection'];\n};\n\n/**\n * Returns the network configuration that has been filed under the given chain\n * ID.\n *\n * @param chainId - The chain ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByChainIdAction = {\n type: `NetworkController:getNetworkConfigurationByChainId`;\n handler: NetworkController['getNetworkConfigurationByChainId'];\n};\n\n/**\n * Returns the network configuration that contains an RPC endpoint with the\n * given network client ID.\n *\n * @param networkClientId - The network client ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {\n type: `NetworkController:getNetworkConfigurationByNetworkClientId`;\n handler: NetworkController['getNetworkConfigurationByNetworkClientId'];\n};\n\n/**\n * Creates and registers network clients for the collection of Infura and\n * custom RPC endpoints that can be used to make requests for a particular\n * chain, storing the given configuration object in state for later reference.\n *\n * @param fields - The object that describes the new network/chain and lists\n * the RPC endpoints which front that chain.\n * @returns The newly added network configuration.\n * @throws if any part of `fields` would produce invalid state.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerAddNetworkAction = {\n type: `NetworkController:addNetwork`;\n handler: NetworkController['addNetwork'];\n};\n\n/**\n * Updates the configuration for a previously stored network filed under the\n * given chain ID, creating + registering new network clients to represent RPC\n * endpoints that have been added and destroying + unregistering existing\n * network clients for RPC endpoints that have been removed.\n *\n * Note that if `chainId` is changed, then all network clients associated with\n * that chain will be removed and re-added, even if none of the RPC endpoints\n * have changed.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @param fields - The object that describes the updates to the network/chain,\n * including the new set of RPC endpoints which should front that chain.\n * @param options - Options to provide.\n * @param options.replacementSelectedRpcEndpointIndex - Usually you cannot\n * remove an RPC endpoint that is being represented by the currently selected\n * network client. This option allows you to specify another RPC endpoint\n * (either an existing one or a new one) that should be used to select a new\n * network instead.\n * @returns The updated network configuration.\n * @throws if `chainId` does not refer to an existing network configuration,\n * if any part of `fields` would produce invalid state, etc.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerUpdateNetworkAction = {\n type: `NetworkController:updateNetwork`;\n handler: NetworkController['updateNetwork'];\n};\n\n/**\n * Destroys and unregisters the network identified by the given chain ID, also\n * removing the associated network configuration from state.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @throws if `chainId` does not refer to an existing network configuration,\n * or if the currently selected network is being removed.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerRemoveNetworkAction = {\n type: `NetworkController:removeNetwork`;\n handler: NetworkController['removeNetwork'];\n};\n\n/**\n * Assuming that the network has been previously switched, switches to this\n * new network.\n *\n * If the network has not been previously switched, this method is equivalent\n * to {@link resetConnection}.\n */\nexport type NetworkControllerRollbackToPreviousProviderAction = {\n type: `NetworkController:rollbackToPreviousProvider`;\n handler: NetworkController['rollbackToPreviousProvider'];\n};\n\n/**\n * Merges the given backup data into controller state.\n *\n * @param backup - The data that has been backed up.\n * @param backup.networkConfigurationsByChainId - Network configurations,\n * keyed by chain ID.\n */\nexport type NetworkControllerLoadBackupAction = {\n type: `NetworkController:loadBackup`;\n handler: NetworkController['loadBackup'];\n};\n\n/**\n * Searches for the default RPC endpoint configured for the given chain and\n * returns its network client ID. This can then be passed to\n * {@link getNetworkClientById} to retrieve the network client.\n *\n * @param chainId - Chain ID to search for.\n * @returns The ID of the network client created for the chain's default RPC\n * endpoint.\n */\nexport type NetworkControllerFindNetworkClientIdByChainIdAction = {\n type: `NetworkController:findNetworkClientIdByChainId`;\n handler: NetworkController['findNetworkClientIdByChainId'];\n};\n\n/**\n * Union of all NetworkController action types.\n */\nexport type NetworkControllerMethodActions =\n | NetworkControllerGetEthQueryAction\n | NetworkControllerGetProviderAndBlockTrackerAction\n | NetworkControllerGetSelectedNetworkClientAction\n | NetworkControllerGetSelectedChainIdAction\n | NetworkControllerGetNetworkClientRegistryAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerLookupNetworkAction\n | NetworkControllerLookupNetworkByClientIdAction\n | NetworkControllerSetProviderTypeAction\n | NetworkControllerSetActiveNetworkAction\n | NetworkControllerGetEIP1559CompatibilityAction\n | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction\n | NetworkControllerResetConnectionAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerUpdateNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerRollbackToPreviousProviderAction\n | NetworkControllerLoadBackupAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n"]}
@@ -1,268 +0,0 @@
1
- /**
2
- * This file is auto generated.
3
- * Do not edit manually.
4
- */
5
- import type { NetworkController } from "./NetworkController.cjs";
6
- /**
7
- * Returns the EthQuery instance for the currently selected network.
8
- *
9
- * @returns The EthQuery instance, or undefined if the provider has not been
10
- * initialized.
11
- */
12
- export type NetworkControllerGetEthQueryAction = {
13
- type: `NetworkController:getEthQuery`;
14
- handler: NetworkController['getEthQuery'];
15
- };
16
- /**
17
- * Accesses the provider and block tracker for the currently selected network.
18
- *
19
- * @returns The proxy and block tracker proxies.
20
- * @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.
21
- */
22
- export type NetworkControllerGetProviderAndBlockTrackerAction = {
23
- type: `NetworkController:getProviderAndBlockTracker`;
24
- handler: NetworkController['getProviderAndBlockTracker'];
25
- };
26
- /**
27
- * Accesses the provider and block tracker for the currently selected network.
28
- *
29
- * @returns an object with the provider and block tracker proxies for the currently selected network.
30
- */
31
- export type NetworkControllerGetSelectedNetworkClientAction = {
32
- type: `NetworkController:getSelectedNetworkClient`;
33
- handler: NetworkController['getSelectedNetworkClient'];
34
- };
35
- /**
36
- * Accesses the chain ID from the selected network client.
37
- *
38
- * @returns The chain ID of the selected network client in hex format or undefined if there is no network client.
39
- */
40
- export type NetworkControllerGetSelectedChainIdAction = {
41
- type: `NetworkController:getSelectedChainId`;
42
- handler: NetworkController['getSelectedChainId'];
43
- };
44
- /**
45
- * Internally, the Infura and custom network clients are categorized by type
46
- * so that when accessing either kind of network client, TypeScript knows
47
- * which type to assign to the network client. For some cases it's more useful
48
- * to be able to access network clients by ID instead of by type and then ID,
49
- * so this function makes that possible.
50
- *
51
- * @returns The network clients registered so far, keyed by ID.
52
- */
53
- export type NetworkControllerGetNetworkClientRegistryAction = {
54
- type: `NetworkController:getNetworkClientRegistry`;
55
- handler: NetworkController['getNetworkClientRegistry'];
56
- };
57
- /**
58
- * Returns the Infura network client with the given ID.
59
- *
60
- * @param infuraNetworkClientId - An Infura network client ID.
61
- * @returns The Infura network client.
62
- * @throws If an Infura network client does not exist with the given ID.
63
- */
64
- export type NetworkControllerGetNetworkClientByIdAction = {
65
- type: `NetworkController:getNetworkClientById`;
66
- handler: NetworkController['getNetworkClientById'];
67
- };
68
- /**
69
- * Uses a request for the latest block to gather the following information on
70
- * the given or selected network, persisting it to state:
71
- *
72
- * - The connectivity status: whether it is available, geo-blocked (Infura
73
- * only), unavailable, or unknown
74
- * - The capabilities status: whether it supports EIP-1559, whether it does
75
- * not, or whether it is unknown
76
- *
77
- * @param networkClientId - The ID of the network client to inspect.
78
- * If no ID is provided, uses the currently selected network.
79
- */
80
- export type NetworkControllerLookupNetworkAction = {
81
- type: `NetworkController:lookupNetwork`;
82
- handler: NetworkController['lookupNetwork'];
83
- };
84
- /**
85
- * Uses a request for the latest block to gather the following information on
86
- * the given network, persisting it to state:
87
- *
88
- * - The connectivity status: whether the network is available, geo-blocked
89
- * (Infura only), unavailable, or unknown
90
- * - The feature compatibility status: whether the network supports EIP-1559,
91
- * whether it does not, or whether it is unknown
92
- *
93
- * @param networkClientId - The ID of the network client to inspect.
94
- * @deprecated Please use `lookupNetwork` and pass a network client ID
95
- * instead. This method will be removed in a future major version.
96
- */
97
- export type NetworkControllerLookupNetworkByClientIdAction = {
98
- type: `NetworkController:lookupNetworkByClientId`;
99
- handler: NetworkController['lookupNetworkByClientId'];
100
- };
101
- /**
102
- * Convenience method to update provider network type settings.
103
- *
104
- * @param type - Human readable network name.
105
- * @deprecated This has been replaced by `setActiveNetwork`, and will be
106
- * removed in a future release
107
- */
108
- export type NetworkControllerSetProviderTypeAction = {
109
- type: `NetworkController:setProviderType`;
110
- handler: NetworkController['setProviderType'];
111
- };
112
- /**
113
- * Changes the selected network.
114
- *
115
- * @param networkClientId - The ID of a network client that will be used to
116
- * make requests.
117
- * @param options - Options for this method.
118
- * @param options.updateState - Allows for updating state.
119
- * @throws if no network client is associated with the given
120
- * network client ID.
121
- */
122
- export type NetworkControllerSetActiveNetworkAction = {
123
- type: `NetworkController:setActiveNetwork`;
124
- handler: NetworkController['setActiveNetwork'];
125
- };
126
- /**
127
- * Determines whether the network supports EIP-1559 by checking whether the
128
- * latest block has a `baseFeePerGas` property, then updates state
129
- * appropriately.
130
- *
131
- * @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.
132
- * @returns A promise that resolves to true if the network supports EIP-1559
133
- * , false otherwise, or `undefined` if unable to determine the compatibility.
134
- */
135
- export type NetworkControllerGetEIP1559CompatibilityAction = {
136
- type: `NetworkController:getEIP1559Compatibility`;
137
- handler: NetworkController['getEIP1559Compatibility'];
138
- };
139
- export type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {
140
- type: `NetworkController:get1559CompatibilityWithNetworkClientId`;
141
- handler: NetworkController['get1559CompatibilityWithNetworkClientId'];
142
- };
143
- /**
144
- * Ensures that the provider and block tracker proxies are pointed to the
145
- * currently selected network and refreshes the metadata for the
146
- */
147
- export type NetworkControllerResetConnectionAction = {
148
- type: `NetworkController:resetConnection`;
149
- handler: NetworkController['resetConnection'];
150
- };
151
- /**
152
- * Returns the network configuration that has been filed under the given chain
153
- * ID.
154
- *
155
- * @param chainId - The chain ID to use as a key.
156
- * @returns The network configuration if one exists, or undefined.
157
- */
158
- export type NetworkControllerGetNetworkConfigurationByChainIdAction = {
159
- type: `NetworkController:getNetworkConfigurationByChainId`;
160
- handler: NetworkController['getNetworkConfigurationByChainId'];
161
- };
162
- /**
163
- * Returns the network configuration that contains an RPC endpoint with the
164
- * given network client ID.
165
- *
166
- * @param networkClientId - The network client ID to use as a key.
167
- * @returns The network configuration if one exists, or undefined.
168
- */
169
- export type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {
170
- type: `NetworkController:getNetworkConfigurationByNetworkClientId`;
171
- handler: NetworkController['getNetworkConfigurationByNetworkClientId'];
172
- };
173
- /**
174
- * Creates and registers network clients for the collection of Infura and
175
- * custom RPC endpoints that can be used to make requests for a particular
176
- * chain, storing the given configuration object in state for later reference.
177
- *
178
- * @param fields - The object that describes the new network/chain and lists
179
- * the RPC endpoints which front that chain.
180
- * @returns The newly added network configuration.
181
- * @throws if any part of `fields` would produce invalid state.
182
- * @see {@link NetworkConfiguration}
183
- */
184
- export type NetworkControllerAddNetworkAction = {
185
- type: `NetworkController:addNetwork`;
186
- handler: NetworkController['addNetwork'];
187
- };
188
- /**
189
- * Updates the configuration for a previously stored network filed under the
190
- * given chain ID, creating + registering new network clients to represent RPC
191
- * endpoints that have been added and destroying + unregistering existing
192
- * network clients for RPC endpoints that have been removed.
193
- *
194
- * Note that if `chainId` is changed, then all network clients associated with
195
- * that chain will be removed and re-added, even if none of the RPC endpoints
196
- * have changed.
197
- *
198
- * @param chainId - The chain ID associated with an existing network.
199
- * @param fields - The object that describes the updates to the network/chain,
200
- * including the new set of RPC endpoints which should front that chain.
201
- * @param options - Options to provide.
202
- * @param options.replacementSelectedRpcEndpointIndex - Usually you cannot
203
- * remove an RPC endpoint that is being represented by the currently selected
204
- * network client. This option allows you to specify another RPC endpoint
205
- * (either an existing one or a new one) that should be used to select a new
206
- * network instead.
207
- * @returns The updated network configuration.
208
- * @throws if `chainId` does not refer to an existing network configuration,
209
- * if any part of `fields` would produce invalid state, etc.
210
- * @see {@link NetworkConfiguration}
211
- */
212
- export type NetworkControllerUpdateNetworkAction = {
213
- type: `NetworkController:updateNetwork`;
214
- handler: NetworkController['updateNetwork'];
215
- };
216
- /**
217
- * Destroys and unregisters the network identified by the given chain ID, also
218
- * removing the associated network configuration from state.
219
- *
220
- * @param chainId - The chain ID associated with an existing network.
221
- * @throws if `chainId` does not refer to an existing network configuration,
222
- * or if the currently selected network is being removed.
223
- * @see {@link NetworkConfiguration}
224
- */
225
- export type NetworkControllerRemoveNetworkAction = {
226
- type: `NetworkController:removeNetwork`;
227
- handler: NetworkController['removeNetwork'];
228
- };
229
- /**
230
- * Assuming that the network has been previously switched, switches to this
231
- * new network.
232
- *
233
- * If the network has not been previously switched, this method is equivalent
234
- * to {@link resetConnection}.
235
- */
236
- export type NetworkControllerRollbackToPreviousProviderAction = {
237
- type: `NetworkController:rollbackToPreviousProvider`;
238
- handler: NetworkController['rollbackToPreviousProvider'];
239
- };
240
- /**
241
- * Merges the given backup data into controller state.
242
- *
243
- * @param backup - The data that has been backed up.
244
- * @param backup.networkConfigurationsByChainId - Network configurations,
245
- * keyed by chain ID.
246
- */
247
- export type NetworkControllerLoadBackupAction = {
248
- type: `NetworkController:loadBackup`;
249
- handler: NetworkController['loadBackup'];
250
- };
251
- /**
252
- * Searches for the default RPC endpoint configured for the given chain and
253
- * returns its network client ID. This can then be passed to
254
- * {@link getNetworkClientById} to retrieve the network client.
255
- *
256
- * @param chainId - Chain ID to search for.
257
- * @returns The ID of the network client created for the chain's default RPC
258
- * endpoint.
259
- */
260
- export type NetworkControllerFindNetworkClientIdByChainIdAction = {
261
- type: `NetworkController:findNetworkClientIdByChainId`;
262
- handler: NetworkController['findNetworkClientIdByChainId'];
263
- };
264
- /**
265
- * Union of all NetworkController action types.
266
- */
267
- export type NetworkControllerMethodActions = NetworkControllerGetEthQueryAction | NetworkControllerGetProviderAndBlockTrackerAction | NetworkControllerGetSelectedNetworkClientAction | NetworkControllerGetSelectedChainIdAction | NetworkControllerGetNetworkClientRegistryAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerLookupNetworkAction | NetworkControllerLookupNetworkByClientIdAction | NetworkControllerSetProviderTypeAction | NetworkControllerSetActiveNetworkAction | NetworkControllerGetEIP1559CompatibilityAction | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction | NetworkControllerResetConnectionAction | NetworkControllerGetNetworkConfigurationByChainIdAction | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction | NetworkControllerAddNetworkAction | NetworkControllerUpdateNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerRollbackToPreviousProviderAction | NetworkControllerLoadBackupAction | NetworkControllerFindNetworkClientIdByChainIdAction;
268
- //# sourceMappingURL=NetworkController-method-action-types.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NetworkController-method-action-types.d.cts","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA+B;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,iBAAiB,CAAC,oBA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,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,iBAAiB,CAAC,8BAA8B,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,kCAAkC,GAClC,iDAAiD,GACjD,+CAA+C,GAC/C,yCAAyC,GACzC,+CAA+C,GAC/C,2CAA2C,GAC3C,oCAAoC,GACpC,8CAA8C,GAC9C,sCAAsC,GACtC,uCAAuC,GACvC,8CAA8C,GAC9C,8DAA8D,GAC9D,sCAAsC,GACtC,uDAAuD,GACvD,+DAA+D,GAC/D,iCAAiC,GACjC,oCAAoC,GACpC,oCAAoC,GACpC,iDAAiD,GACjD,iCAAiC,GACjC,mDAAmD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NetworkController-method-action-types.d.mts","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA+B;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;CAClD,CAAC;AAEF;;;;;;;;G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,OAAO,EAAE,iBAAiB,CAAC,8BAA8B,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,kCAAkC,GAClC,iDAAiD,GACjD,+CAA+C,GAC/C,yCAAyC,GACzC,+CAA+C,GAC/C,2CAA2C,GAC3C,oCAAoC,GACpC,8CAA8C,GAC9C,sCAAsC,GACtC,uCAAuC,GACvC,8CAA8C,GAC9C,8DAA8D,GAC9D,sCAAsC,GACtC,uDAAuD,GACvD,+DAA+D,GAC/D,iCAAiC,GACjC,oCAAoC,GACpC,oCAAoC,GACpC,iDAAiD,GACjD,iCAAiC,GACjC,mDAAmD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NetworkController-method-action-types.mjs","sourceRoot":"","sources":["../src/NetworkController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NetworkController } from './NetworkController.js';\n\n/**\n * Returns the EthQuery instance for the currently selected network.\n *\n * @returns The EthQuery instance, or undefined if the provider has not been\n * initialized.\n */\nexport type NetworkControllerGetEthQueryAction = {\n type: `NetworkController:getEthQuery`;\n handler: NetworkController['getEthQuery'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns The proxy and block tracker proxies.\n * @deprecated This method has been replaced by `getSelectedNetworkClient` (which has a more easily used return type) and will be removed in a future release.\n */\nexport type NetworkControllerGetProviderAndBlockTrackerAction = {\n type: `NetworkController:getProviderAndBlockTracker`;\n handler: NetworkController['getProviderAndBlockTracker'];\n};\n\n/**\n * Accesses the provider and block tracker for the currently selected network.\n *\n * @returns an object with the provider and block tracker proxies for the currently selected network.\n */\nexport type NetworkControllerGetSelectedNetworkClientAction = {\n type: `NetworkController:getSelectedNetworkClient`;\n handler: NetworkController['getSelectedNetworkClient'];\n};\n\n/**\n * Accesses the chain ID from the selected network client.\n *\n * @returns The chain ID of the selected network client in hex format or undefined if there is no network client.\n */\nexport type NetworkControllerGetSelectedChainIdAction = {\n type: `NetworkController:getSelectedChainId`;\n handler: NetworkController['getSelectedChainId'];\n};\n\n/**\n * Internally, the Infura and custom network clients are categorized by type\n * so that when accessing either kind of network client, TypeScript knows\n * which type to assign to the network client. For some cases it's more useful\n * to be able to access network clients by ID instead of by type and then ID,\n * so this function makes that possible.\n *\n * @returns The network clients registered so far, keyed by ID.\n */\nexport type NetworkControllerGetNetworkClientRegistryAction = {\n type: `NetworkController:getNetworkClientRegistry`;\n handler: NetworkController['getNetworkClientRegistry'];\n};\n\n/**\n * Returns the Infura network client with the given ID.\n *\n * @param infuraNetworkClientId - An Infura network client ID.\n * @returns The Infura network client.\n * @throws If an Infura network client does not exist with the given ID.\n */\nexport type NetworkControllerGetNetworkClientByIdAction = {\n type: `NetworkController:getNetworkClientById`;\n handler: NetworkController['getNetworkClientById'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given or selected network, persisting it to state:\n *\n * - The connectivity status: whether it is available, geo-blocked (Infura\n * only), unavailable, or unknown\n * - The capabilities status: whether it supports EIP-1559, whether it does\n * not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * If no ID is provided, uses the currently selected network.\n */\nexport type NetworkControllerLookupNetworkAction = {\n type: `NetworkController:lookupNetwork`;\n handler: NetworkController['lookupNetwork'];\n};\n\n/**\n * Uses a request for the latest block to gather the following information on\n * the given network, persisting it to state:\n *\n * - The connectivity status: whether the network is available, geo-blocked\n * (Infura only), unavailable, or unknown\n * - The feature compatibility status: whether the network supports EIP-1559,\n * whether it does not, or whether it is unknown\n *\n * @param networkClientId - The ID of the network client to inspect.\n * @deprecated Please use `lookupNetwork` and pass a network client ID\n * instead. This method will be removed in a future major version.\n */\nexport type NetworkControllerLookupNetworkByClientIdAction = {\n type: `NetworkController:lookupNetworkByClientId`;\n handler: NetworkController['lookupNetworkByClientId'];\n};\n\n/**\n * Convenience method to update provider network type settings.\n *\n * @param type - Human readable network name.\n * @deprecated This has been replaced by `setActiveNetwork`, and will be\n * removed in a future release\n */\nexport type NetworkControllerSetProviderTypeAction = {\n type: `NetworkController:setProviderType`;\n handler: NetworkController['setProviderType'];\n};\n\n/**\n * Changes the selected network.\n *\n * @param networkClientId - The ID of a network client that will be used to\n * make requests.\n * @param options - Options for this method.\n * @param options.updateState - Allows for updating state.\n * @throws if no network client is associated with the given\n * network client ID.\n */\nexport type NetworkControllerSetActiveNetworkAction = {\n type: `NetworkController:setActiveNetwork`;\n handler: NetworkController['setActiveNetwork'];\n};\n\n/**\n * Determines whether the network supports EIP-1559 by checking whether the\n * latest block has a `baseFeePerGas` property, then updates state\n * appropriately.\n *\n * @param networkClientId - The networkClientId to fetch the correct provider against which to check 1559 compatibility.\n * @returns A promise that resolves to true if the network supports EIP-1559\n * , false otherwise, or `undefined` if unable to determine the compatibility.\n */\nexport type NetworkControllerGetEIP1559CompatibilityAction = {\n type: `NetworkController:getEIP1559Compatibility`;\n handler: NetworkController['getEIP1559Compatibility'];\n};\n\nexport type NetworkControllerGet1559CompatibilityWithNetworkClientIdAction = {\n type: `NetworkController:get1559CompatibilityWithNetworkClientId`;\n handler: NetworkController['get1559CompatibilityWithNetworkClientId'];\n};\n\n/**\n * Ensures that the provider and block tracker proxies are pointed to the\n * currently selected network and refreshes the metadata for the\n */\nexport type NetworkControllerResetConnectionAction = {\n type: `NetworkController:resetConnection`;\n handler: NetworkController['resetConnection'];\n};\n\n/**\n * Returns the network configuration that has been filed under the given chain\n * ID.\n *\n * @param chainId - The chain ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByChainIdAction = {\n type: `NetworkController:getNetworkConfigurationByChainId`;\n handler: NetworkController['getNetworkConfigurationByChainId'];\n};\n\n/**\n * Returns the network configuration that contains an RPC endpoint with the\n * given network client ID.\n *\n * @param networkClientId - The network client ID to use as a key.\n * @returns The network configuration if one exists, or undefined.\n */\nexport type NetworkControllerGetNetworkConfigurationByNetworkClientIdAction = {\n type: `NetworkController:getNetworkConfigurationByNetworkClientId`;\n handler: NetworkController['getNetworkConfigurationByNetworkClientId'];\n};\n\n/**\n * Creates and registers network clients for the collection of Infura and\n * custom RPC endpoints that can be used to make requests for a particular\n * chain, storing the given configuration object in state for later reference.\n *\n * @param fields - The object that describes the new network/chain and lists\n * the RPC endpoints which front that chain.\n * @returns The newly added network configuration.\n * @throws if any part of `fields` would produce invalid state.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerAddNetworkAction = {\n type: `NetworkController:addNetwork`;\n handler: NetworkController['addNetwork'];\n};\n\n/**\n * Updates the configuration for a previously stored network filed under the\n * given chain ID, creating + registering new network clients to represent RPC\n * endpoints that have been added and destroying + unregistering existing\n * network clients for RPC endpoints that have been removed.\n *\n * Note that if `chainId` is changed, then all network clients associated with\n * that chain will be removed and re-added, even if none of the RPC endpoints\n * have changed.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @param fields - The object that describes the updates to the network/chain,\n * including the new set of RPC endpoints which should front that chain.\n * @param options - Options to provide.\n * @param options.replacementSelectedRpcEndpointIndex - Usually you cannot\n * remove an RPC endpoint that is being represented by the currently selected\n * network client. This option allows you to specify another RPC endpoint\n * (either an existing one or a new one) that should be used to select a new\n * network instead.\n * @returns The updated network configuration.\n * @throws if `chainId` does not refer to an existing network configuration,\n * if any part of `fields` would produce invalid state, etc.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerUpdateNetworkAction = {\n type: `NetworkController:updateNetwork`;\n handler: NetworkController['updateNetwork'];\n};\n\n/**\n * Destroys and unregisters the network identified by the given chain ID, also\n * removing the associated network configuration from state.\n *\n * @param chainId - The chain ID associated with an existing network.\n * @throws if `chainId` does not refer to an existing network configuration,\n * or if the currently selected network is being removed.\n * @see {@link NetworkConfiguration}\n */\nexport type NetworkControllerRemoveNetworkAction = {\n type: `NetworkController:removeNetwork`;\n handler: NetworkController['removeNetwork'];\n};\n\n/**\n * Assuming that the network has been previously switched, switches to this\n * new network.\n *\n * If the network has not been previously switched, this method is equivalent\n * to {@link resetConnection}.\n */\nexport type NetworkControllerRollbackToPreviousProviderAction = {\n type: `NetworkController:rollbackToPreviousProvider`;\n handler: NetworkController['rollbackToPreviousProvider'];\n};\n\n/**\n * Merges the given backup data into controller state.\n *\n * @param backup - The data that has been backed up.\n * @param backup.networkConfigurationsByChainId - Network configurations,\n * keyed by chain ID.\n */\nexport type NetworkControllerLoadBackupAction = {\n type: `NetworkController:loadBackup`;\n handler: NetworkController['loadBackup'];\n};\n\n/**\n * Searches for the default RPC endpoint configured for the given chain and\n * returns its network client ID. This can then be passed to\n * {@link getNetworkClientById} to retrieve the network client.\n *\n * @param chainId - Chain ID to search for.\n * @returns The ID of the network client created for the chain's default RPC\n * endpoint.\n */\nexport type NetworkControllerFindNetworkClientIdByChainIdAction = {\n type: `NetworkController:findNetworkClientIdByChainId`;\n handler: NetworkController['findNetworkClientIdByChainId'];\n};\n\n/**\n * Union of all NetworkController action types.\n */\nexport type NetworkControllerMethodActions =\n | NetworkControllerGetEthQueryAction\n | NetworkControllerGetProviderAndBlockTrackerAction\n | NetworkControllerGetSelectedNetworkClientAction\n | NetworkControllerGetSelectedChainIdAction\n | NetworkControllerGetNetworkClientRegistryAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerLookupNetworkAction\n | NetworkControllerLookupNetworkByClientIdAction\n | NetworkControllerSetProviderTypeAction\n | NetworkControllerSetActiveNetworkAction\n | NetworkControllerGetEIP1559CompatibilityAction\n | NetworkControllerGet1559CompatibilityWithNetworkClientIdAction\n | NetworkControllerResetConnectionAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | NetworkControllerGetNetworkConfigurationByNetworkClientIdAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerUpdateNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerRollbackToPreviousProviderAction\n | NetworkControllerLoadBackupAction\n | NetworkControllerFindNetworkClientIdByChainIdAction;\n"]}