From 0aa2cddb04b70d8d69495f28b8c826b27dee73fd Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 6 Apr 2023 10:20:20 -0700 Subject: [PATCH] Set BigNumber debugging globally --- src/account.js | 3 --- src/{index.mjs => index.js} | 3 +++ src/util/continued_fraction.js | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) rename src/{index.mjs => index.js} (92%) diff --git a/src/account.js b/src/account.js index fcf75986..5e20d27f 100644 --- a/src/account.js +++ b/src/account.js @@ -35,9 +35,6 @@ export class Account { this._accountId = accountId; this.sequence = new BigNumber(sequence); - if (this.sequence.isNaN()) { - throw new Error(`sequence number '${sequence}' is not valid`); - } } /** diff --git a/src/index.mjs b/src/index.js similarity index 92% rename from src/index.mjs rename to src/index.js index e6197c9f..78a14744 100644 --- a/src/index.mjs +++ b/src/index.js @@ -1,6 +1,9 @@ /* eslint-disable import/no-import-module-exports */ +import BigNumber from 'bignumber.js'; import xdr from './xdr'; +BigNumber.DEBUG = true; // gives us exceptions on bad constructor values + export { xdr }; export { hash } from './hashing'; export { sign, verify, FastSigning } from './signing'; diff --git a/src/util/continued_fraction.js b/src/util/continued_fraction.js index b3877cb4..51255f82 100644 --- a/src/util/continued_fraction.js +++ b/src/util/continued_fraction.js @@ -11,8 +11,6 @@ const MAX_INT = ((1 << 31) >>> 0) - 1; * @returns {array} first element is n (numerator), second element is d (denominator) */ export function best_r(rawNumber) { - BigNumber.DEBUG = true; // throws on bad number values - let number = new BigNumber(rawNumber); let a; let f;