@metamask-previews/network-controller 24.1.0-preview-e821953d → 24.1.0-preview-e43ca14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-auto-managed-network-client.cjs +1 -1
- package/dist/create-auto-managed-network-client.cjs.map +1 -1
- package/dist/create-auto-managed-network-client.mjs +1 -1
- package/dist/create-auto-managed-network-client.mjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAutoManagedNetworkClient = void 0;
|
|
4
|
-
const create_network_client_1 = require("./create-network-client
|
|
4
|
+
const create_network_client_1 = require("./create-network-client");
|
|
5
5
|
/**
|
|
6
6
|
* The name of the method on both the provider and block tracker proxy which can
|
|
7
7
|
* be used to get the underlying provider or block tracker from the network
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-auto-managed-network-client.cjs","sourceRoot":"","sources":["../src/create-auto-managed-network-client.ts"],"names":[],"mappings":";;;AAGA,uEAA8D;AAS9D;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,YAAY,CAAC;AA+B9C;;;;GAIG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,MAAM,oBAAoB,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,8BAA8B,CAE5C,EACA,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EACnC,SAAS,EACT,oBAAoB,EAAE,yBAAyB,GAWhD;IACC,IAAI,oBAAoB,GAAG,yBAAyB,CAAC;IACrD,IAAI,aAAwC,CAAC;IAE7C,MA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AAC;KACF,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,aAAa,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,oBAAoB,GAAG,IAAI,CAAC;QAC5B,OAAO,EAAE,CAAC;QACV,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,oBAAoB,GAAG,KAAK,CAAC;QAC7B,OAAO,EAAE,CAAC;QACV,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO;QACL,aAAa,EAAE,0BAA0B;QACzC,QAAQ,EAAE,aAAa;QACvB,YAAY,EAAE,iBAAiB;QAC/B,OAAO;QACP,iBAAiB;QACjB,kBAAkB;KACnB,CAAC;AACJ,CAAC;AA3JD,wEA2JC","sourcesContent":["import type { PollingBlockTrackerOptions } from '@metamask/eth-block-tracker';\n\nimport type { NetworkClient } from './create-network-client';\nimport { createNetworkClient } from './create-network-client';\nimport type { NetworkControllerMessenger } from './NetworkController';\nimport type { RpcServiceOptions } from './rpc-service/rpc-service';\nimport type {\n BlockTracker,\n NetworkClientConfiguration,\n Provider,\n} from './types';\n\n/**\n * The name of the method on both the provider and block tracker proxy which can\n * be used to get the underlying provider or block tracker from the network\n * client, when it is initialized.\n */\nconst REFLECTIVE_PROPERTY_NAME = '__target__';\n\n/**\n * Represents a proxy object which wraps a target object. As a proxy, it allows\n * for accessing and setting all of the properties that the target object\n * supports, but also supports an extra propertyName (`__target__`) to access\n * the target itself.\n *\n * @template Type - The type of the target object. It is assumed that this type\n * will be constant even when the target is swapped.\n */\nexport type ProxyWithAccessibleTarget<TargetType> = TargetType & {\n [REFLECTIVE_PROPERTY_NAME]: TargetType;\n};\n\n/**\n * An object that provides the same interface as a network client but where the\n * network client is not initialized until either the provider or block tracker\n * is first accessed.\n */\nexport type AutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n> = {\n configuration: Configuration;\n provider: ProxyWithAccessibleTarget<Provider>;\n blockTracker: ProxyWithAccessibleTarget<BlockTracker>;\n destroy: () => void;\n enableRpcFailover: () => void;\n disableRpcFailover: () => void;\n};\n\n/**\n * By default, the provider and block provider proxies will point to nothing.\n * This is impossible when using the Proxy API, as the target object has to be\n * something, so this object represents that \"something\".\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst UNINITIALIZED_TARGET = { __UNINITIALIZED__: true };\n\n/**\n * This function creates two proxies, one that wraps a provider and another that\n * wraps a block tracker. These proxies are unique in that both will be \"empty\"\n * at first; that is, neither will point to a functional provider or block\n * tracker. Instead, as soon as a method or event is accessed on either object\n * that requires a network request to function, a network client is created on\n * the fly and the method or event in question is then forwarded to whichever\n * part of the network client is serving as the receiver. The network client is\n * then cached for subsequent usages.\n *\n * @param args - The arguments.\n * @param args.networkClientConfiguration - The configuration object that will be\n * used to instantiate the network client when it is needed.\n * @param args.getRpcServiceOptions - Factory for constructing RPC service\n * options. See {@link NetworkControllerOptions.getRpcServiceOptions}.\n * @param args.getBlockTrackerOptions - Factory for constructing block tracker\n * options. See {@link NetworkControllerOptions.getBlockTrackerOptions}.\n * @param args.messenger - The network controller messenger.\n * @param args.isRpcFailoverEnabled - Whether or not requests sent to the\n * primary RPC endpoint for this network should be automatically diverted to\n * provided failover endpoints if the primary is unavailable.\n * @returns The auto-managed network client.\n */\nexport function createAutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n>({\n networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions = () => ({}),\n messenger,\n isRpcFailoverEnabled: givenIsRpcFailoverEnabled,\n}: {\n networkClientConfiguration: Configuration;\n getRpcServiceOptions: (\n rpcEndpointUrl: string,\n ) => Omit<RpcServiceOptions, 'failoverService' | 'endpointUrl'>;\n getBlockTrackerOptions?: (\n rpcEndpointUrl: string,\n ) => Omit<PollingBlockTrackerOptions, 'provider'>;\n messenger: NetworkControllerMessenger;\n isRpcFailoverEnabled: boolean;\n}): AutoManagedNetworkClient<Configuration> {\n let isRpcFailoverEnabled = givenIsRpcFailoverEnabled;\n let networkClient: NetworkClient | undefined;\n\n const ensureNetworkClientCreated = (): NetworkClient => {\n networkClient ??= createNetworkClient({\n configuration: networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions,\n messenger,\n isRpcFailoverEnabled,\n });\n\n if (networkClient === undefined) {\n throw new Error(\n \"It looks like `createNetworkClient` didn't return anything. Perhaps it's being mocked?\",\n );\n }\n\n return networkClient;\n };\n\n const providerProxy = new Proxy(UNINITIALIZED_TARGET, {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.provider;\n }\n\n const { provider } = ensureNetworkClientCreated();\n\n if (propertyName in provider) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = provider[propertyName as keyof typeof provider];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be compatible\n // with the signature of the method being called, as technically\n // it can be anything.\n return value.apply(this === receiver ? provider : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { provider } = ensureNetworkClientCreated();\n return propertyName in provider;\n },\n });\n\n const blockTrackerProxy: ProxyWithAccessibleTarget<BlockTracker> = new Proxy(\n UNINITIALIZED_TARGET,\n {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.blockTracker;\n }\n\n const { blockTracker } = ensureNetworkClientCreated();\n\n if (propertyName in blockTracker) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = blockTracker[propertyName as keyof typeof blockTracker];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be\n // compatible with the signature of the method being called, as\n // technically it can be anything.\n return value.apply(this === receiver ? blockTracker : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { blockTracker } = ensureNetworkClientCreated();\n return propertyName in blockTracker;\n },\n },\n );\n\n const destroy = () => {\n networkClient?.destroy();\n };\n\n const enableRpcFailover = () => {\n isRpcFailoverEnabled = true;\n destroy();\n networkClient = undefined;\n };\n\n const disableRpcFailover = () => {\n isRpcFailoverEnabled = false;\n destroy();\n networkClient = undefined;\n };\n\n return {\n configuration: networkClientConfiguration,\n provider: providerProxy,\n blockTracker: blockTrackerProxy,\n destroy,\n enableRpcFailover,\n disableRpcFailover,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"create-auto-managed-network-client.cjs","sourceRoot":"","sources":["../src/create-auto-managed-network-client.ts"],"names":[],"mappings":";;;AAGA,mEAA8D;AAS9D;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,YAAY,CAAC;AA+B9C;;;;GAIG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,MAAM,oBAA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BACpE,CAAC,CAAC;iBACH;gBACD,OAAO,KAAK,CAAC;aACd;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,gCAAgC;QAChC,8DAA8D;QAC9D,GAAG,CAAC,OAAY,EAAE,YAAyB;YACzC,IAAI,YAAY,KAAK,wBAAwB,EAAE;gBAC7C,OAAO,IAAI,CAAC;aACb;YACD,MAAM,EAAE,YAAY,EAAE,GAAG,0BAA0B,EAAE,CAAC;YACtD,OAAO,YAAY,IAAI,YAAY,CAAC;QACtC,CAAC;KACF,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,aAAa,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,oBAAoB,GAAG,IAAI,CAAC;QAC5B,OAAO,EAAE,CAAC;QACV,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,oBAAoB,GAAG,KAAK,CAAC;QAC7B,OAAO,EAAE,CAAC;QACV,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO;QACL,aAAa,EAAE,0BAA0B;QACzC,QAAQ,EAAE,aAAa;QACvB,YAAY,EAAE,iBAAiB;QAC/B,OAAO;QACP,iBAAiB;QACjB,kBAAkB;KACnB,CAAC;AACJ,CAAC;AA3JD,wEA2JC","sourcesContent":["import type { PollingBlockTrackerOptions } from '@metamask/eth-block-tracker';\n\nimport type { NetworkClient } from './create-network-client';\nimport { createNetworkClient } from './create-network-client';\nimport type { NetworkControllerMessenger } from './NetworkController';\nimport type { RpcServiceOptions } from './rpc-service/rpc-service';\nimport type {\n BlockTracker,\n NetworkClientConfiguration,\n Provider,\n} from './types';\n\n/**\n * The name of the method on both the provider and block tracker proxy which can\n * be used to get the underlying provider or block tracker from the network\n * client, when it is initialized.\n */\nconst REFLECTIVE_PROPERTY_NAME = '__target__';\n\n/**\n * Represents a proxy object which wraps a target object. As a proxy, it allows\n * for accessing and setting all of the properties that the target object\n * supports, but also supports an extra propertyName (`__target__`) to access\n * the target itself.\n *\n * @template Type - The type of the target object. It is assumed that this type\n * will be constant even when the target is swapped.\n */\nexport type ProxyWithAccessibleTarget<TargetType> = TargetType & {\n [REFLECTIVE_PROPERTY_NAME]: TargetType;\n};\n\n/**\n * An object that provides the same interface as a network client but where the\n * network client is not initialized until either the provider or block tracker\n * is first accessed.\n */\nexport type AutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n> = {\n configuration: Configuration;\n provider: ProxyWithAccessibleTarget<Provider>;\n blockTracker: ProxyWithAccessibleTarget<BlockTracker>;\n destroy: () => void;\n enableRpcFailover: () => void;\n disableRpcFailover: () => void;\n};\n\n/**\n * By default, the provider and block provider proxies will point to nothing.\n * This is impossible when using the Proxy API, as the target object has to be\n * something, so this object represents that \"something\".\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst UNINITIALIZED_TARGET = { __UNINITIALIZED__: true };\n\n/**\n * This function creates two proxies, one that wraps a provider and another that\n * wraps a block tracker. These proxies are unique in that both will be \"empty\"\n * at first; that is, neither will point to a functional provider or block\n * tracker. Instead, as soon as a method or event is accessed on either object\n * that requires a network request to function, a network client is created on\n * the fly and the method or event in question is then forwarded to whichever\n * part of the network client is serving as the receiver. The network client is\n * then cached for subsequent usages.\n *\n * @param args - The arguments.\n * @param args.networkClientConfiguration - The configuration object that will be\n * used to instantiate the network client when it is needed.\n * @param args.getRpcServiceOptions - Factory for constructing RPC service\n * options. See {@link NetworkControllerOptions.getRpcServiceOptions}.\n * @param args.getBlockTrackerOptions - Factory for constructing block tracker\n * options. See {@link NetworkControllerOptions.getBlockTrackerOptions}.\n * @param args.messenger - The network controller messenger.\n * @param args.isRpcFailoverEnabled - Whether or not requests sent to the\n * primary RPC endpoint for this network should be automatically diverted to\n * provided failover endpoints if the primary is unavailable.\n * @returns The auto-managed network client.\n */\nexport function createAutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n>({\n networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions = () => ({}),\n messenger,\n isRpcFailoverEnabled: givenIsRpcFailoverEnabled,\n}: {\n networkClientConfiguration: Configuration;\n getRpcServiceOptions: (\n rpcEndpointUrl: string,\n ) => Omit<RpcServiceOptions, 'failoverService' | 'endpointUrl'>;\n getBlockTrackerOptions?: (\n rpcEndpointUrl: string,\n ) => Omit<PollingBlockTrackerOptions, 'provider'>;\n messenger: NetworkControllerMessenger;\n isRpcFailoverEnabled: boolean;\n}): AutoManagedNetworkClient<Configuration> {\n let isRpcFailoverEnabled = givenIsRpcFailoverEnabled;\n let networkClient: NetworkClient | undefined;\n\n const ensureNetworkClientCreated = (): NetworkClient => {\n networkClient ??= createNetworkClient({\n configuration: networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions,\n messenger,\n isRpcFailoverEnabled,\n });\n\n if (networkClient === undefined) {\n throw new Error(\n \"It looks like `createNetworkClient` didn't return anything. Perhaps it's being mocked?\",\n );\n }\n\n return networkClient;\n };\n\n const providerProxy = new Proxy(UNINITIALIZED_TARGET, {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.provider;\n }\n\n const { provider } = ensureNetworkClientCreated();\n\n if (propertyName in provider) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = provider[propertyName as keyof typeof provider];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be compatible\n // with the signature of the method being called, as technically\n // it can be anything.\n return value.apply(this === receiver ? provider : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { provider } = ensureNetworkClientCreated();\n return propertyName in provider;\n },\n });\n\n const blockTrackerProxy: ProxyWithAccessibleTarget<BlockTracker> = new Proxy(\n UNINITIALIZED_TARGET,\n {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.blockTracker;\n }\n\n const { blockTracker } = ensureNetworkClientCreated();\n\n if (propertyName in blockTracker) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = blockTracker[propertyName as keyof typeof blockTracker];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be\n // compatible with the signature of the method being called, as\n // technically it can be anything.\n return value.apply(this === receiver ? blockTracker : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { blockTracker } = ensureNetworkClientCreated();\n return propertyName in blockTracker;\n },\n },\n );\n\n const destroy = () => {\n networkClient?.destroy();\n };\n\n const enableRpcFailover = () => {\n isRpcFailoverEnabled = true;\n destroy();\n networkClient = undefined;\n };\n\n const disableRpcFailover = () => {\n isRpcFailoverEnabled = false;\n destroy();\n networkClient = undefined;\n };\n\n return {\n configuration: networkClientConfiguration,\n provider: providerProxy,\n blockTracker: blockTrackerProxy,\n destroy,\n enableRpcFailover,\n disableRpcFailover,\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createNetworkClient } from "./create-network-client
|
|
1
|
+
import { createNetworkClient } from "./create-network-client";
|
|
2
2
|
/**
|
|
3
3
|
* The name of the method on both the provider and block tracker proxy which can
|
|
4
4
|
* be used to get the underlying provider or block tracker from the network
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-auto-managed-network-client.mjs","sourceRoot":"","sources":["../src/create-auto-managed-network-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,oCAAgC;AAS9D;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,YAAY,CAAC;AA+B9C;;;;GAIG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,MAAM,oBAAoB,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,8BAA8B,CAE5C,EACA,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EACnC,SAAS,EACT,oBAAoB,EAAE,yBAAyB,GAWhD;IACC,IAAI,oBAAoB,GAAG,yBAAyB,CAAC;IACrD,IAAI,aAAwC,CAAC;IAE7C,MAAM,0BAA0B,GAAG,GAAkB,EAAE;QACrD,aAAa,KAAb,aAAa,GAAK,mBAAmB,CAAC;YACpC,aAAa,EAAE,0BAA0B;YACzC,oBAAoB;YACpB,sBAAsB;YACtB,SAAS;YACT,oBAAoB;SACrB,CAAC,EAAC;QAEH,IAAI,aAAa,KAAK,SAAS,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;SACH;QAED,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,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QACV,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO;QACL,aAAa,EAAE,0BAA0B;QACzC,QAAQ,EAAE,aAAa;QACvB,YAAY,EAAE,iBAAiB;QAC/B,OAAO;QACP,iBAAiB;QACjB,kBAAkB;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import type { PollingBlockTrackerOptions } from '@metamask/eth-block-tracker';\n\nimport type { NetworkClient } from './create-network-client';\nimport { createNetworkClient } from './create-network-client';\nimport type { NetworkControllerMessenger } from './NetworkController';\nimport type { RpcServiceOptions } from './rpc-service/rpc-service';\nimport type {\n BlockTracker,\n NetworkClientConfiguration,\n Provider,\n} from './types';\n\n/**\n * The name of the method on both the provider and block tracker proxy which can\n * be used to get the underlying provider or block tracker from the network\n * client, when it is initialized.\n */\nconst REFLECTIVE_PROPERTY_NAME = '__target__';\n\n/**\n * Represents a proxy object which wraps a target object. As a proxy, it allows\n * for accessing and setting all of the properties that the target object\n * supports, but also supports an extra propertyName (`__target__`) to access\n * the target itself.\n *\n * @template Type - The type of the target object. It is assumed that this type\n * will be constant even when the target is swapped.\n */\nexport type ProxyWithAccessibleTarget<TargetType> = TargetType & {\n [REFLECTIVE_PROPERTY_NAME]: TargetType;\n};\n\n/**\n * An object that provides the same interface as a network client but where the\n * network client is not initialized until either the provider or block tracker\n * is first accessed.\n */\nexport type AutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n> = {\n configuration: Configuration;\n provider: ProxyWithAccessibleTarget<Provider>;\n blockTracker: ProxyWithAccessibleTarget<BlockTracker>;\n destroy: () => void;\n enableRpcFailover: () => void;\n disableRpcFailover: () => void;\n};\n\n/**\n * By default, the provider and block provider proxies will point to nothing.\n * This is impossible when using the Proxy API, as the target object has to be\n * something, so this object represents that \"something\".\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst UNINITIALIZED_TARGET = { __UNINITIALIZED__: true };\n\n/**\n * This function creates two proxies, one that wraps a provider and another that\n * wraps a block tracker. These proxies are unique in that both will be \"empty\"\n * at first; that is, neither will point to a functional provider or block\n * tracker. Instead, as soon as a method or event is accessed on either object\n * that requires a network request to function, a network client is created on\n * the fly and the method or event in question is then forwarded to whichever\n * part of the network client is serving as the receiver. The network client is\n * then cached for subsequent usages.\n *\n * @param args - The arguments.\n * @param args.networkClientConfiguration - The configuration object that will be\n * used to instantiate the network client when it is needed.\n * @param args.getRpcServiceOptions - Factory for constructing RPC service\n * options. See {@link NetworkControllerOptions.getRpcServiceOptions}.\n * @param args.getBlockTrackerOptions - Factory for constructing block tracker\n * options. See {@link NetworkControllerOptions.getBlockTrackerOptions}.\n * @param args.messenger - The network controller messenger.\n * @param args.isRpcFailoverEnabled - Whether or not requests sent to the\n * primary RPC endpoint for this network should be automatically diverted to\n * provided failover endpoints if the primary is unavailable.\n * @returns The auto-managed network client.\n */\nexport function createAutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n>({\n networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions = () => ({}),\n messenger,\n isRpcFailoverEnabled: givenIsRpcFailoverEnabled,\n}: {\n networkClientConfiguration: Configuration;\n getRpcServiceOptions: (\n rpcEndpointUrl: string,\n ) => Omit<RpcServiceOptions, 'failoverService' | 'endpointUrl'>;\n getBlockTrackerOptions?: (\n rpcEndpointUrl: string,\n ) => Omit<PollingBlockTrackerOptions, 'provider'>;\n messenger: NetworkControllerMessenger;\n isRpcFailoverEnabled: boolean;\n}): AutoManagedNetworkClient<Configuration> {\n let isRpcFailoverEnabled = givenIsRpcFailoverEnabled;\n let networkClient: NetworkClient | undefined;\n\n const ensureNetworkClientCreated = (): NetworkClient => {\n networkClient ??= createNetworkClient({\n configuration: networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions,\n messenger,\n isRpcFailoverEnabled,\n });\n\n if (networkClient === undefined) {\n throw new Error(\n \"It looks like `createNetworkClient` didn't return anything. Perhaps it's being mocked?\",\n );\n }\n\n return networkClient;\n };\n\n const providerProxy = new Proxy(UNINITIALIZED_TARGET, {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.provider;\n }\n\n const { provider } = ensureNetworkClientCreated();\n\n if (propertyName in provider) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = provider[propertyName as keyof typeof provider];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be compatible\n // with the signature of the method being called, as technically\n // it can be anything.\n return value.apply(this === receiver ? provider : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { provider } = ensureNetworkClientCreated();\n return propertyName in provider;\n },\n });\n\n const blockTrackerProxy: ProxyWithAccessibleTarget<BlockTracker> = new Proxy(\n UNINITIALIZED_TARGET,\n {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.blockTracker;\n }\n\n const { blockTracker } = ensureNetworkClientCreated();\n\n if (propertyName in blockTracker) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = blockTracker[propertyName as keyof typeof blockTracker];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be\n // compatible with the signature of the method being called, as\n // technically it can be anything.\n return value.apply(this === receiver ? blockTracker : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { blockTracker } = ensureNetworkClientCreated();\n return propertyName in blockTracker;\n },\n },\n );\n\n const destroy = () => {\n networkClient?.destroy();\n };\n\n const enableRpcFailover = () => {\n isRpcFailoverEnabled = true;\n destroy();\n networkClient = undefined;\n };\n\n const disableRpcFailover = () => {\n isRpcFailoverEnabled = false;\n destroy();\n networkClient = undefined;\n };\n\n return {\n configuration: networkClientConfiguration,\n provider: providerProxy,\n blockTracker: blockTrackerProxy,\n destroy,\n enableRpcFailover,\n disableRpcFailover,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"create-auto-managed-network-client.mjs","sourceRoot":"","sources":["../src/create-auto-managed-network-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,gCAAgC;AAS9D;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,YAAY,CAAC;AA+B9C;;;;GAIG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,MAAM,oBAAoB,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,8BAA8B,CAE5C,EACA,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EACnC,SAAS,EACT,oBAAoB,EAAE,yBAAyB,GAWhD;IACC,IAAI,oBAAoB,GAAG,yBAAyB,CAAC;IACrD,IAAI,aAAwC,CAAC;IAE7C,MAAM,0BAA0B,GAAG,G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,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,aAAa,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,oBAAoB,GAAG,IAAI,CAAC;QAC5B,OAAO,EAAE,CAAC;QACV,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,oBAAoB,GAAG,KAAK,CAAC;QAC7B,OAAO,EAAE,CAAC;QACV,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO;QACL,aAAa,EAAE,0BAA0B;QACzC,QAAQ,EAAE,aAAa;QACvB,YAAY,EAAE,iBAAiB;QAC/B,OAAO;QACP,iBAAiB;QACjB,kBAAkB;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import type { PollingBlockTrackerOptions } from '@metamask/eth-block-tracker';\n\nimport type { NetworkClient } from './create-network-client';\nimport { createNetworkClient } from './create-network-client';\nimport type { NetworkControllerMessenger } from './NetworkController';\nimport type { RpcServiceOptions } from './rpc-service/rpc-service';\nimport type {\n BlockTracker,\n NetworkClientConfiguration,\n Provider,\n} from './types';\n\n/**\n * The name of the method on both the provider and block tracker proxy which can\n * be used to get the underlying provider or block tracker from the network\n * client, when it is initialized.\n */\nconst REFLECTIVE_PROPERTY_NAME = '__target__';\n\n/**\n * Represents a proxy object which wraps a target object. As a proxy, it allows\n * for accessing and setting all of the properties that the target object\n * supports, but also supports an extra propertyName (`__target__`) to access\n * the target itself.\n *\n * @template Type - The type of the target object. It is assumed that this type\n * will be constant even when the target is swapped.\n */\nexport type ProxyWithAccessibleTarget<TargetType> = TargetType & {\n [REFLECTIVE_PROPERTY_NAME]: TargetType;\n};\n\n/**\n * An object that provides the same interface as a network client but where the\n * network client is not initialized until either the provider or block tracker\n * is first accessed.\n */\nexport type AutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n> = {\n configuration: Configuration;\n provider: ProxyWithAccessibleTarget<Provider>;\n blockTracker: ProxyWithAccessibleTarget<BlockTracker>;\n destroy: () => void;\n enableRpcFailover: () => void;\n disableRpcFailover: () => void;\n};\n\n/**\n * By default, the provider and block provider proxies will point to nothing.\n * This is impossible when using the Proxy API, as the target object has to be\n * something, so this object represents that \"something\".\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst UNINITIALIZED_TARGET = { __UNINITIALIZED__: true };\n\n/**\n * This function creates two proxies, one that wraps a provider and another that\n * wraps a block tracker. These proxies are unique in that both will be \"empty\"\n * at first; that is, neither will point to a functional provider or block\n * tracker. Instead, as soon as a method or event is accessed on either object\n * that requires a network request to function, a network client is created on\n * the fly and the method or event in question is then forwarded to whichever\n * part of the network client is serving as the receiver. The network client is\n * then cached for subsequent usages.\n *\n * @param args - The arguments.\n * @param args.networkClientConfiguration - The configuration object that will be\n * used to instantiate the network client when it is needed.\n * @param args.getRpcServiceOptions - Factory for constructing RPC service\n * options. See {@link NetworkControllerOptions.getRpcServiceOptions}.\n * @param args.getBlockTrackerOptions - Factory for constructing block tracker\n * options. See {@link NetworkControllerOptions.getBlockTrackerOptions}.\n * @param args.messenger - The network controller messenger.\n * @param args.isRpcFailoverEnabled - Whether or not requests sent to the\n * primary RPC endpoint for this network should be automatically diverted to\n * provided failover endpoints if the primary is unavailable.\n * @returns The auto-managed network client.\n */\nexport function createAutoManagedNetworkClient<\n Configuration extends NetworkClientConfiguration,\n>({\n networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions = () => ({}),\n messenger,\n isRpcFailoverEnabled: givenIsRpcFailoverEnabled,\n}: {\n networkClientConfiguration: Configuration;\n getRpcServiceOptions: (\n rpcEndpointUrl: string,\n ) => Omit<RpcServiceOptions, 'failoverService' | 'endpointUrl'>;\n getBlockTrackerOptions?: (\n rpcEndpointUrl: string,\n ) => Omit<PollingBlockTrackerOptions, 'provider'>;\n messenger: NetworkControllerMessenger;\n isRpcFailoverEnabled: boolean;\n}): AutoManagedNetworkClient<Configuration> {\n let isRpcFailoverEnabled = givenIsRpcFailoverEnabled;\n let networkClient: NetworkClient | undefined;\n\n const ensureNetworkClientCreated = (): NetworkClient => {\n networkClient ??= createNetworkClient({\n configuration: networkClientConfiguration,\n getRpcServiceOptions,\n getBlockTrackerOptions,\n messenger,\n isRpcFailoverEnabled,\n });\n\n if (networkClient === undefined) {\n throw new Error(\n \"It looks like `createNetworkClient` didn't return anything. Perhaps it's being mocked?\",\n );\n }\n\n return networkClient;\n };\n\n const providerProxy = new Proxy(UNINITIALIZED_TARGET, {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.provider;\n }\n\n const { provider } = ensureNetworkClientCreated();\n\n if (propertyName in provider) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = provider[propertyName as keyof typeof provider];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be compatible\n // with the signature of the method being called, as technically\n // it can be anything.\n return value.apply(this === receiver ? provider : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { provider } = ensureNetworkClientCreated();\n return propertyName in provider;\n },\n });\n\n const blockTrackerProxy: ProxyWithAccessibleTarget<BlockTracker> = new Proxy(\n UNINITIALIZED_TARGET,\n {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(_target: any, propertyName: PropertyKey, receiver: unknown) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return networkClient?.blockTracker;\n }\n\n const { blockTracker } = ensureNetworkClientCreated();\n\n if (propertyName in blockTracker) {\n // Typecast: We know that `[propertyName]` is a propertyName on\n // `provider`.\n const value = blockTracker[propertyName as keyof typeof blockTracker];\n if (typeof value === 'function') {\n // Ensure that the method on the provider is called with `this` as\n // the target, *not* the proxy (which happens by default) —\n // this allows private properties to be accessed\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (this: unknown, ...args: any[]) {\n // @ts-expect-error We don't care that `this` may not be\n // compatible with the signature of the method being called, as\n // technically it can be anything.\n return value.apply(this === receiver ? blockTracker : this, args);\n };\n }\n return value;\n }\n\n return undefined;\n },\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n has(_target: any, propertyName: PropertyKey) {\n if (propertyName === REFLECTIVE_PROPERTY_NAME) {\n return true;\n }\n const { blockTracker } = ensureNetworkClientCreated();\n return propertyName in blockTracker;\n },\n },\n );\n\n const destroy = () => {\n networkClient?.destroy();\n };\n\n const enableRpcFailover = () => {\n isRpcFailoverEnabled = true;\n destroy();\n networkClient = undefined;\n };\n\n const disableRpcFailover = () => {\n isRpcFailoverEnabled = false;\n destroy();\n networkClient = undefined;\n };\n\n return {\n configuration: networkClientConfiguration,\n provider: providerProxy,\n blockTracker: blockTrackerProxy,\n destroy,\n enableRpcFailover,\n disableRpcFailover,\n };\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./constants.cjs";
|
|
|
5
5
|
export type { BlockTracker, Provider } from "./types.cjs";
|
|
6
6
|
export type { NetworkClientConfiguration, InfuraNetworkClientConfiguration, CustomNetworkClientConfiguration, } from "./types.cjs";
|
|
7
7
|
export { NetworkClientType } from "./types.cjs";
|
|
8
|
-
export type { NetworkClient } from "./create-network-client
|
|
8
|
+
export type { NetworkClient } from "./create-network-client";
|
|
9
9
|
export type { AbstractRpcService } from "./rpc-service/abstract-rpc-service.cjs";
|
|
10
10
|
export type { RpcServiceRequestable } from "./rpc-service/rpc-service-requestable.cjs";
|
|
11
11
|
export { isConnectionError } from "./rpc-service/rpc-service.cjs";
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,iDAA6C;AACrF,YAAY,EACV,KAAK,EACL,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,qCAAqC,EACrC,uCAAuC,EACvC,kCAAkC,EAClC,oCAAoC,EACpC,uBAAuB,EACvB,+BAA+B,EAC/B,kCAAkC,EAClC,2CAA2C,EAC3C,+CAA+C,EAC/C,yCAAyC,EACzC,8CAA8C,EAC9C,mDAAmD,EACnD,sCAAsC,EACtC,uCAAuC,EACvC,iCAAiC,EACjC,oCAAoC,EACpC,oCAAoC,EACpC,yDAAyD,EACzD,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,4CAA4C,EAC5C,yCAAyC,EACzC,+CAA+C,GAChD,gCAA4B;AAC7B,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAC/B,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,gCAA4B;AAC7B,gCAA4B;AAC5B,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,oBAAgB;AACtD,YAAY,EACV,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GACjC,oBAAgB;AACjB,OAAO,EAAE,iBAAiB,EAAE,oBAAgB;AAC5C,YAAY,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,iDAA6C;AACrF,YAAY,EACV,KAAK,EACL,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,qCAAqC,EACrC,uCAAuC,EACvC,kCAAkC,EAClC,oCAAoC,EACpC,uBAAuB,EACvB,+BAA+B,EAC/B,kCAAkC,EAClC,2CAA2C,EAC3C,+CAA+C,EAC/C,yCAAyC,EACzC,8CAA8C,EAC9C,mDAAmD,EACnD,sCAAsC,EACtC,uCAAuC,EACvC,iCAAiC,EACjC,oCAAoC,EACpC,oCAAoC,EACpC,yDAAyD,EACzD,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,4CAA4C,EAC5C,yCAAyC,EACzC,+CAA+C,GAChD,gCAA4B;AAC7B,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAC/B,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,gCAA4B;AAC7B,gCAA4B;AAC5B,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,oBAAgB;AACtD,YAAY,EACV,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GACjC,oBAAgB;AACjB,OAAO,EAAE,iBAAiB,EAAE,oBAAgB;AAC5C,YAAY,EAAE,aAAa,EAAE,gCAAgC;AAC7D,YAAY,EAAE,kBAAkB,EAAE,+CAA2C;AAC7E,YAAY,EAAE,qBAAqB,EAAE,kDAA8C;AACnF,OAAO,EAAE,iBAAiB,EAAE,sCAAkC"}
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./constants.mjs";
|
|
|
5
5
|
export type { BlockTracker, Provider } from "./types.mjs";
|
|
6
6
|
export type { NetworkClientConfiguration, InfuraNetworkClientConfiguration, CustomNetworkClientConfiguration, } from "./types.mjs";
|
|
7
7
|
export { NetworkClientType } from "./types.mjs";
|
|
8
|
-
export type { NetworkClient } from "./create-network-client
|
|
8
|
+
export type { NetworkClient } from "./create-network-client";
|
|
9
9
|
export type { AbstractRpcService } from "./rpc-service/abstract-rpc-service.mjs";
|
|
10
10
|
export type { RpcServiceRequestable } from "./rpc-service/rpc-service-requestable.mjs";
|
|
11
11
|
export { isConnectionError } from "./rpc-service/rpc-service.mjs";
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,iDAA6C;AACrF,YAAY,EACV,KAAK,EACL,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,EACtC,qCAAqC,EACrC,uCAAuC,EACvC,kCAAkC,EAClC,oCAAoC,EACpC,uBAAuB,EACvB,+BAA+B,EAC/B,kCAAkC,EAClC,2CAA2C,EAC3C,+CAA+C,EAC/C,yCAAyC,EACzC,8CAA8C,EAC9C,mDAAmD,EACnD,sCAAsC,EACtC,uCAAuC,EACvC,iCAAiC,EACjC,oCAAoC,EACpC,oCAAoC,EACpC,yDAAyD,EACzD,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,4CAA4C,EAC5C,yCAAyC,EACzC,+CAA+C,GAChD,gCAA4B;AAC7B,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAC/B,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,gCAA4B;AAC7B,gCAA4B;AAC5B,YAAY,EAAE,YAAY,EAAE,QAAQ,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EAAE,kDAA8C;AACnF,OAAO,EAAE,iBAAiB,EAAE,sCAAkC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/network-controller",
|
|
3
|
-
"version": "24.1.0-preview-
|
|
3
|
+
"version": "24.1.0-preview-e43ca14",
|
|
4
4
|
"description": "Provides an interface to the currently selected network via a MetaMask-compatible provider object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|