From 293ce6f4b2e495589ae3675eb293fb9948f22dbb Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 2 Jun 2017 09:39:05 +0200 Subject: Always wrap BigNumbers returned by web3 with our own version and add comment --- src/contract_wrappers/exchange_wrapper.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/contract_wrappers/exchange_wrapper.ts') diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 8b20d2b4d..2894c5a9f 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -70,7 +70,9 @@ export class ExchangeWrapper extends ContractWrapper { assert.isValidOrderHash('orderHashHex', orderHashHex); const exchangeContract = await this.getExchangeContractAsync(); - const unavailableAmountInBaseUnits = await exchangeContract.getUnavailableValueT.call(orderHashHex); + let unavailableAmountInBaseUnits = await exchangeContract.getUnavailableValueT.call(orderHashHex); + // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber + unavailableAmountInBaseUnits = new BigNumber(unavailableAmountInBaseUnits); return unavailableAmountInBaseUnits; } /** @@ -80,7 +82,9 @@ export class ExchangeWrapper extends ContractWrapper { assert.isValidOrderHash('orderHashHex', orderHashHex); const exchangeContract = await this.getExchangeContractAsync(); - const fillAmountInBaseUnits = await exchangeContract.filled.call(orderHashHex); + let fillAmountInBaseUnits = await exchangeContract.filled.call(orderHashHex); + // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber + fillAmountInBaseUnits = new BigNumber(fillAmountInBaseUnits); return fillAmountInBaseUnits; } /** @@ -90,7 +94,9 @@ export class ExchangeWrapper extends ContractWrapper { assert.isValidOrderHash('orderHashHex', orderHashHex); const exchangeContract = await this.getExchangeContractAsync(); - const cancelledAmountInBaseUnits = await exchangeContract.cancelled.call(orderHashHex); + let cancelledAmountInBaseUnits = await exchangeContract.cancelled.call(orderHashHex); + // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber + cancelledAmountInBaseUnits = new BigNumber(cancelledAmountInBaseUnits); return cancelledAmountInBaseUnits; } /** -- cgit v1.2.3