Expose ethers.providers

This commit is contained in:
Evgeny Kuzyakov 2023-08-14 09:44:11 -07:00
parent 6e29c48f8c
commit 643ecd0b6a
3 changed files with 16 additions and 2 deletions

View File

@ -20,6 +20,17 @@
```
- Expose `Ethers.setChain({chainId})` to be able to switch between EVM networks. Note, the gateway should inject it as part of the `EthersProviderContext`.
- Add `config.defaultFinality` to be able to specify `final` instead of `optimistic` (default). It would route the majority of the view calls through the API server.
- Expose `ethers.providers`. You will be able to construct a custom JSON provider for read only data. Example usage:
```jsx
const opGoerliProvider = new ethers.providers.JsonRpcProvider(
"https://optimism-goerli.blockpi.network/v1/rpc/public"
);
console.log(opGoerliProvider);
```
```jsx
## 2.2.4

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -75,6 +75,7 @@ const frozenEthers = Object.freeze({
utils: deepFreeze(ethers.utils),
BigNumber: deepFreeze(ethers.BigNumber),
Contract: deepFreeze(ethers.Contract),
providers: deepFreeze(ethers.providers),
});
// `nanoid.nanoid()` is a but odd, but it seems better to match the official
@ -1778,7 +1779,9 @@ export default class VM {
this.intervals = new Set();
this.websockets = [];
this.vmInstances = new Map();
this.networkId = widgetConfigs.findLast(config => config && config.networkId)?.networkId || near.config.networkId
this.networkId =
widgetConfigs.findLast((config) => config && config.networkId)
?.networkId || near.config.networkId;
}
stop() {