ens-did-resolver
Version:
Resolve DID documents for ENS
47 lines • 2.16 kB
TypeScript
import { Provider } from '@ethersproject/providers';
/**
* A configuration entry for an ethereum network
* It should contain at least one of `name` or `chainId` AND one of `provider`, `web3`, or `rpcUrl`
*
* @example ```js
* { name: 'development', rpcUrl: 'http://127.0.0.1:8545/' }
* { name: 'goerli', chainId: 5, provider: new InfuraProvider('goerli') }
* { name: 'rinkeby', provider: new AlchemyProvider('rinkeby') }
* { name: 'rsk:testnet', chainId: '0x1f', rpcUrl: 'https://public-node.testnet.rsk.co' }
* ```
*/
export interface ProviderConfiguration {
name?: string;
provider?: Provider;
rpcUrl?: string;
chainId?: string | number;
web3?: any;
[index: string]: any;
}
export interface MultiProviderConfiguration extends ProviderConfiguration {
networks?: ProviderConfiguration[];
}
export interface InfuraConfiguration {
infuraProjectId: string;
}
export type ConfigurationOptions = MultiProviderConfiguration | InfuraConfiguration;
export type ConfiguredNetworks = Record<string, Provider>;
export declare function getProviderForNetwork(conf: ProviderConfiguration): Provider;
/**
* Generates a configuration that maps ethereum network names and chainIDs to the respective web3 providers.
* @returns a record of providers
* @param conf configuration options for the resolver. An array of network details.
* Each network entry should contain at least one of `name` or `chainId` AND one of `provider`, `web3`, or `rpcUrl`
* For convenience, you can also specify an `infuraProjectId` which will create a mapping for all the networks
* supported by https://infura.io.
* @example ```js
* [
* { name: 'development', rpcUrl: 'http://127.0.0.1:8545/' },
* { name: 'goerli', chainId: 5, provider: new InfuraProvider('goerli') },
* { name: 'rinkeby', provider: new AlchemyProvider('rinkeby') },
* { name: 'rsk:testnet', chainId: '0x1f', rpcUrl: 'https://public-node.testnet.rsk.co' },
* ]
* ```
*/
export declare function configureResolverWithNetworks(conf?: ConfigurationOptions): ConfiguredNetworks;
//# sourceMappingURL=configuration.d.ts.map