From 987f63a3bb95273e242838f99032a969ba2708de Mon Sep 17 00:00:00 2001 From: Nicolas Wagner Date: Tue, 13 Nov 2018 12:00:14 +0200 Subject: [PATCH] feat(contract): convert wei amount to eth --- package.json | 2 +- .../MultipleArbitrableTransaction.js | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 3d7e848..449bdcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kleros-api-2", - "version": "0.18.9", + "version": "0.18.11", "description": "A Javascript library that makes it easy to build relayers and other DApps that use the Kleros protocol.", "keywords": [ "Blockchain", diff --git a/src/contracts/implementations/arbitrable/MultipleArbitrableTransaction.js b/src/contracts/implementations/arbitrable/MultipleArbitrableTransaction.js index 13dc297..7ca9569 100644 --- a/src/contracts/implementations/arbitrable/MultipleArbitrableTransaction.js +++ b/src/contracts/implementations/arbitrable/MultipleArbitrableTransaction.js @@ -91,10 +91,14 @@ class MultipleArbitrableTransaction extends Arbitrable { await this.loadContract() try { - return this.contractInstance.pay(arbitrableTransactionId, amount, { - from: account, - value: 0 - }) + return this.contractInstance.pay( + arbitrableTransactionId, + this._Web3Wrapper.fromWei(amount, 'ether'), + { + from: account, + value: 0 + } + ) } catch (err) { console.error(err) throw new Error(errorConstants.UNABLE_TO_PAY_SELLER) @@ -116,10 +120,14 @@ class MultipleArbitrableTransaction extends Arbitrable { await this.loadContract() try { - return this.contractInstance.reimburse(arbitrableTransactionId, amount, { - from: account, - value: 0 - }) + return this.contractInstance.reimburse( + arbitrableTransactionId, + this._Web3Wrapper.fromWei(amount, 'ether'), + { + from: account, + value: 0 + } + ) } catch (err) { console.error(err) throw new Error(errorConstants.UNABLE_TO_REIMBURSE_BUYER)