From 574282ccc5bcf47bfad62b66a889986afa7378bf Mon Sep 17 00:00:00 2001 From: Doron Zavelevsky Date: Wed, 11 Dec 2024 01:42:58 +0000 Subject: [PATCH] cloned decimal ctor --- package.json | 2 +- src/utils/numerics.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 91298a3..60618ec 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@bancor/carbon-sdk", "type": "module", "source": "src/index.ts", - "version": "0.0.102-DEV", + "version": "0.0.103-DEV", "description": "The SDK is a READ-ONLY tool, intended to facilitate working with Carbon contracts. It's a convenient wrapper around our matching algorithm, allowing programs and users get a ready to use transaction data that will allow them to manage strategies and fulfill trades", "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/src/utils/numerics.ts b/src/utils/numerics.ts index e3c63a5..ff86fc5 100644 --- a/src/utils/numerics.ts +++ b/src/utils/numerics.ts @@ -3,8 +3,9 @@ import { parseUnits as _parseUnits, formatUnits as _formatUnits, } from '@ethersproject/units'; -import Decimal from 'decimal.js'; +import DecimalJS from 'decimal.js'; +const Decimal = DecimalJS.clone(); Decimal.set({ precision: 100, rounding: Decimal.ROUND_HALF_DOWN, @@ -13,6 +14,7 @@ Decimal.set({ }); export { Decimal, BigNumber, BigNumberish }; +export type Decimal = DecimalJS; export const BigNumberMin = (a: BigNumber, b: BigNumber) => (a.lt(b) ? a : b); export const BigNumberMax = (a: BigNumber, b: BigNumber) => (a.gt(b) ? a : b);