docs: simplified example output for some objects.

This commit is contained in:
Richard Moore 2023-01-15 07:49:14 -05:00
parent 32e49fa759
commit fb035d8416

@ -1,3 +1,5 @@
import { inspect } from "util";
import * as ethers from "../lib.esm/index.js";
import { version } from "../lib.esm/_version.js";
@ -17,10 +19,27 @@ export default {
prefix: "v6-beta",
contextify: function(context) {
Object.assign(context, ethers);
context.provider = new ethers.InfuraProvider();
//context.getAddress = ethers.getAddress;
context.Uint8Array = Uint8Array;
Object.assign(context, ethers);
context.provider = new ethers.InfuraProvider();
context.Uint8Array = Uint8Array;
ethers.InfuraProvider.prototype[inspect.custom] = function(depth, options, inspect) {
if (depth > 0) { return `InfuraProvider { ... }`; }
// Does this cause infinite recursion??
return this;
};
ethers.Interface.prototype[inspect.custom] = function(depth, options, inspect) {
if (depth > 0) { return `Interface { ... }`; }
// Does this cause infinite recursion??
return this;
};
ethers.Fragment.prototype[inspect.custom] = function(depth, options, inspect) {
if (depth > 0) { return `${ this.constructor.name } { ... }`; }
// Does this cause infinite recursion??
return this;
};
},
srcBaseUrl: "https:/\/github.com/ethers-io/ethers.js/blob/v6-beta-exports/src.ts/{FILENAME}#L{LINENO}",