From 281b9eaa5d207d32ae38fbab25cbca83fe81efa1 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 29 May 2017 09:06:24 +0200 Subject: Move bigNumberToBN to utils module --- src/ts/utils/utils.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/ts/utils/utils.ts (limited to 'src/ts/utils') diff --git a/src/ts/utils/utils.ts b/src/ts/utils/utils.ts new file mode 100644 index 000000000..bde1e7aba --- /dev/null +++ b/src/ts/utils/utils.ts @@ -0,0 +1,13 @@ +import * as BN from 'bn.js'; + +export const utils = { + /** + * Converts BigNumber instance to BN + * The only we convert to BN is to remain compatible with `ethABI. soliditySHA3 ` that + * expects values of Solidity type `uint` to be of type `BN`. + * We do not use BN anywhere else in the codebase. + */ + bigNumberToBN(value: BigNumber.BigNumber) { + return new BN(value.toString(), 10); + }, +}; -- cgit v1.2.3