From 13996ae867605e6c598c45d7ae44059012d80c68 Mon Sep 17 00:00:00 2001 From: Mariusz Kulerski Date: Thu, 22 Feb 2018 09:30:47 +0100 Subject: [PATCH] Allow to change nonce on contract before sending transaction Reason: It allows a developer to calculate transaction nonce on his own. May be needed when you want to control transactions order or calculate nonce using transaction pool rather than relying on current client algorithm. Relates to: - https://github.com/EthWorks/ethereum.rb/issues/35 - https://github.com/ethereum/go-ethereum/issues/2880 --- lib/ethereum/contract.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ethereum/contract.rb b/lib/ethereum/contract.rb index 35622a1..57783e5 100644 --- a/lib/ethereum/contract.rb +++ b/lib/ethereum/contract.rb @@ -5,7 +5,7 @@ class Contract attr_reader :address attr_accessor :key - attr_accessor :gas_limit, :gas_price + attr_accessor :gas_limit, :gas_price, :nonce attr_accessor :code, :name, :abi, :class_object, :sender, :deployment, :client attr_accessor :events, :functions, :constructor_inputs attr_accessor :call_raw_proxy, :call_proxy, :transact_proxy, :transact_and_wait_proxy @@ -247,7 +247,7 @@ def build extend Forwardable def_delegators :parent, :deploy_payload, :deploy_args, :call_payload, :call_args def_delegators :parent, :signed_deploy, :key, :key= - def_delegators :parent, :gas_limit, :gas_price, :gas_limit=, :gas_price= + def_delegators :parent, :gas_limit, :gas_price, :gas_limit=, :gas_price=, :nonce, :nonce= def_delegators :parent, :abi, :deployment, :events def_delegators :parent, :estimate, :deploy, :deploy_and_wait def_delegators :parent, :address, :address=, :sender, :sender=