From fb035d84169fbb750e6bd148f86a57529ebfd9c4 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Sun, 15 Jan 2023 07:49:14 -0500 Subject: [PATCH] docs: simplified example output for some objects. --- docs.wrm/config.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/docs.wrm/config.js b/docs.wrm/config.js index aff04a586..0a49a3fc6 100644 --- a/docs.wrm/config.js +++ b/docs.wrm/config.js @@ -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}",