aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-08-17 03:54:23 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-08-22 05:14:22 +0800
commit1053aed74d2dcb5018a9647f21dd05e2902528fd (patch)
treec32c0b2dab902cdd9121e96cad714665299a956f
parentf53157414f144a7ea8c24126c9d75d3168228130 (diff)
downloaddexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar.gz
dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.tar.zst
dexon-sol-tools-1053aed74d2dcb5018a9647f21dd05e2902528fd.zip
Set curstom inspect printer in BigNumber
-rw-r--r--packages/utils/src/configured_bignumber.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/utils/src/configured_bignumber.ts b/packages/utils/src/configured_bignumber.ts
index 2b22b6938..977042f1e 100644
--- a/packages/utils/src/configured_bignumber.ts
+++ b/packages/utils/src/configured_bignumber.ts
@@ -11,4 +11,15 @@ BigNumber.config({
DECIMAL_PLACES: 78,
});
+// Set a debug print function for NodeJS
+if (typeof window === 'undefined') { // Check if running in NodeJS
+ const util = require('util');
+
+ // Set a custom util.inspect function
+ (BigNumber.prototype as any)[util.inspect.custom] = function() {
+ // Return the readable string representation
+ return this.toString();
+ };
+}
+
export { BigNumber };