From 6738abd0b3e0cfec231f025d2cd091bd4bfec4fa Mon Sep 17 00:00:00 2001 From: bumi Date: Fri, 20 Apr 2018 02:09:30 +0200 Subject: [PATCH] Add support for contract tx call options This allows to provide options like gas price/limit settings for the state changing contract calls. These options are simply passed to the ethers contract instance. We need to provide the gas limit when using the jsonrpc provider. (ganache failed with revert if not enought gas was provider) --- lib/contracts/contributor.js | 4 ++-- lib/contracts/operator.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/contracts/contributor.js b/lib/contracts/contributor.js index 94d4921..1845730 100644 --- a/lib/contracts/contributor.js +++ b/lib/contracts/contributor.js @@ -34,7 +34,7 @@ class Contributor extends Base { }); } - add(contributorAttr) { + add(contributorAttr, callOptions = {}) { let json = ContributorSerializer.serialize(contributorAttr); // TODO: validate against schema @@ -49,7 +49,7 @@ class Contributor extends Base { contributorAttr.isCore, ]; - return this.functions.addContributor(...contributor); + return this.functions.addContributor(...contributor, callOptions); }); } } diff --git a/lib/contracts/operator.js b/lib/contracts/operator.js index bcb31b8..83a5eae 100644 --- a/lib/contracts/operator.js +++ b/lib/contracts/operator.js @@ -34,7 +34,7 @@ class Operator extends Base { }); } - addProposal(proposalAttr) { + addProposal(proposalAttr, callOptions = {}) { let json = ContributionSerializer.serialize(proposalAttr); // TODO: validate against schema @@ -49,7 +49,7 @@ class Operator extends Base { ipfsHashAttr.hashSize, ]; - return this.functions.addProposal(...proposal); + return this.functions.addProposal(...proposal, callOptions); }); } }