provider

Ethcode exports an API to access ethers js provider for extension developers.

provider.get(): Promise<Provider>

```
/**
* Returns a Promise that resolves to the current ethers.js provider instanc for the network selected in the extension.
*
* @returns A Promise that resolves to the current Ethereum provider instance.
*/
async function get (): Promise<Provider> {
 const provider = await providerDefault(context)
 return provider
}
```

provider.network.get() => NetworkConfig

```
/**
* Returns the current network configuration selected in the extension.
*
* @returns The current network configuration.
*/
get: () => NetworkConfig
```

provider.network.set() => string

```
/**
* Sets the current network configuration with the given network name in the extension.
*
* @param network - The name of the network to switch to.
* @returns The name of the network that was set.
*/
set: (network: string) => string
```

provider.network.list() => string[]

```
/**
* Returns an array of the names of all available networks in the extension.
*
* @returns An array of the names of all available networks.
*/
list: () => string[]
```

Last updated