docs: use local dev node for exampels during build.

This commit is contained in:
Richard Moore 2020-12-08 18:30:34 -05:00
parent 8efbfc6afa
commit 21c6c7ddb6
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

View File

@ -129,6 +129,13 @@ function codeContextify(context) {
context.Wallet = ethers.Wallet;
context.provider = new ethers.providers.InfuraProvider("mainnet", "49a0efa3aaee4fd99797bfa94d8ce2f1");
// We use a local dev node for some signing examples, but want to
// resolve ENS names against mainnet; super hacky but makes the
// docs nicer
context.localProvider = new ethers.providers.JsonRpcProvider();
context.localSigner = context.localProvider.getSigner();
context.localProvider.resolveName = context.provider.resolveName.bind(context.provider);
context.BigNumber.prototype[inspect.custom] = function(depth, options) {
return `{ BigNumber: ${JSON.stringify(this.toString()) } }`;
}