ethereum.rb 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af8be90237dd21308f3aea4f6be1df684d245eab
4
- data.tar.gz: 16006aa3e05782c5fa07450bea706c6d9fb78c11
3
+ metadata.gz: 49c6da26b64e4d9ca2cc696c67a455eaed8e3b48
4
+ data.tar.gz: 7eb88a934534f292fd05930270f157f1c17a299c
5
5
  SHA512:
6
- metadata.gz: 994be4aec69fcb7430a87f95ed89fe4577de21cd2884ea3aa46169cd00b64a6032cd23daac13b26b438194344fb1c6a0a9113587be1c35c696eaaf0b0dcd3565
7
- data.tar.gz: 534a8e2c925b76463c53fc1b09401c309e7842e6560beaabc5fb697efff39aff6eaf9799d948bd9f731fdd753c2886beb4c19e8f9a02f9878ed063f16bd86e2f
6
+ metadata.gz: 7f2bda6848455535558e18ecc9fde467fba0f685e36bc8befeec29e2bbc083cdd317aeb8ffa3d207cbb96f29004dd0061183a3f5e85544d13aa20fb359bc6b5e
7
+ data.tar.gz: 9356203de304aca16fd53a60b04c83da5de78b7427d080e2e87920a8909bdd92fdfb3a9039a5ce8472b6709bcd3a38eead1d31df098fd02222e95779de00481c
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ rvm:
4
4
  - 2.3.1
5
5
  env:
6
6
  - PARITY="1.5.0"
7
+ - PARITY="1.5.7"
7
8
  cache:
8
9
  bundler: true
9
10
  directories:
@@ -18,7 +19,6 @@ before_script:
18
19
  - parity --chain testnet account list
19
20
  - cat ~/.parity.log
20
21
  - bundle exec rake ethereum:node:waitforsync
21
- - bundle exec rake ethereum:test:setup
22
22
  script:
23
23
  - bundle exec rspec --tag ~blockchain && bundle exec rspec --tag blockchain
24
24
  before_cache:
@@ -62,7 +62,6 @@ module Ethereum
62
62
  end
63
63
 
64
64
  payload = {jsonrpc: "2.0", method: command, params: encode_params(args), id: get_id}
65
-
66
65
  @logger.info("Sending #{payload.to_json}") if @log
67
66
 
68
67
  if @batch
@@ -2,6 +2,7 @@ module Ethereum
2
2
  class Contract
3
3
 
4
4
  attr_reader :address
5
+ attr_accessor :gas, :gas_price
5
6
  attr_accessor :code, :name, :abi, :class_object, :sender, :deployment, :client
6
7
  attr_accessor :events, :functions, :constructor_inputs
7
8
  attr_accessor :call_raw_proxy, :call_proxy, :transact_proxy, :transact_and_wait_proxy
@@ -35,7 +36,6 @@ module Ethereum
35
36
  contract
36
37
  end
37
38
 
38
-
39
39
  def address=(addr)
40
40
  @address = addr
41
41
  @events.each do |event|
@@ -93,9 +93,16 @@ module Ethereum
93
93
  end
94
94
  end
95
95
 
96
+ def add_gas_options_args(args)
97
+ args[:gas] = @client.int_to_hex(@gas) if @gas.present?
98
+ args[:gasPrice] = @client.int_to_hex(@gas_price) if @gas_price.present?
99
+ args
100
+ end
101
+
96
102
  def transact(fun, *args)
97
103
  payload = fun.signature + @encoder.encode_arguments(fun.inputs, args)
98
- txid = @client.eth_send_transaction({to: @address, from: @sender, data: "0x" + payload})["result"]
104
+ args = {to: @address, from: @sender, data: "0x" + payload}
105
+ txid = @client.eth_send_transaction(add_gas_options_args(args))["result"]
99
106
  return Ethereum::Transaction.new(txid, @client, payload, args)
100
107
  end
101
108
 
@@ -151,6 +158,7 @@ module Ethereum
151
158
  create_event_proxies
152
159
  class_methods = Class.new do
153
160
  extend Forwardable
161
+ def_delegators :parent, :gas, :gas_price, :gas=, :gas_price=
154
162
  def_delegators :parent, :abi, :deployment, :events
155
163
  def_delegators :parent, :estimate, :deploy, :deploy_and_wait
156
164
  def_delegators :parent, :address, :address=, :sender, :sender=
@@ -1,3 +1,3 @@
1
1
  module Ethereum
2
- VERSION = "2.0.6"
2
+ VERSION = "2.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethereum.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Kirejczyk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-07 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler