web3-eth 0.2.35 → 0.2.40

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
  SHA256:
3
- metadata.gz: db3f1f3b034625e2da1a0553ab2943f3140c86547e7667a2671c8fdd2252ef19
4
- data.tar.gz: 6d9108ec98ae3b3e4a715c6ba136706ee062eb5e7cb036272a6ef81fb228701e
3
+ metadata.gz: 5aacea6822d6743a8cecd1620d10c39fe1552cb3ec3f98891527c93bbf20c66e
4
+ data.tar.gz: a70a11f63c761b1923dce7c4e9cf66ddd93c4e0914a03e539fd94d5f638b9c33
5
5
  SHA512:
6
- metadata.gz: 22f3c3598e84b3ddc6eb4cedadf434feb7f44dacaacabde27f0c044fe9e7c36213b7473f83b90b6a9e6fc6b994d68d22578d498240c6c19c3711a90465520d90
7
- data.tar.gz: a05ff6d9dd49db8323efc84d3dfac07234bc42bac24eb46a054411da52c7c35d3e846dd1330f49a4f9dcc66a9964cea56e5be6f7862a9103224e3c985a74f25b
6
+ metadata.gz: 2f0d38f4875da54624615267a9502b022efd7f2e780c3e07a7fe9b66f0e5479a365b63afca17da62f76385fbf30fb9fc1100eb690a56a04340c842ab0110cd74
7
+ data.tar.gz: 4cbf7ccd1ab947b86591343d5177ebc2f617388549a62fe0c916d8beee3b87910598c075b92c5e6977a566064a81b6a317a1c8e1c64e0c34846135890f7ae0a0
@@ -11,5 +11,6 @@ require "web3/eth/eth_module"
11
11
  require "web3/eth/debug/debug_module"
12
12
  require "web3/eth/debug/transaction_call_trace"
13
13
  require "web3/eth/trace_module"
14
+ require "web3/eth/parity_module"
14
15
  require "web3/eth/etherscan"
15
16
  require "web3/eth/rpc"
@@ -16,7 +16,10 @@ module Web3::Eth::Debug
16
16
  end
17
17
 
18
18
  def traceBlockByNumber number, tracer = 'callTracer', convert_to_object = true
19
- raw = @web3_rpc.request("#{PREFIX}#{__method__}", [hex(number), {tracer: tracer}])
19
+ timeout = @web3_rpc.connect_options[:read_timeout] || 120
20
+ raw = @web3_rpc.request("#{PREFIX}#{__method__}", [hex(number), {tracer: tracer,
21
+ timeout: "#{timeout}s"}])
22
+ raise raw.first['error'] if (raw.first && raw.first['error'])
20
23
  convert_to_object ? raw.map{|r| TransactionCallTrace.new(r['result'])} : raw
21
24
  end
22
25
 
@@ -9,7 +9,7 @@ module Web3::Eth::Debug
9
9
  @raw_data = raw
10
10
  @traceAddress = traceAddress
11
11
  @parent = parent
12
- @calls = raw['calls'] ? raw['calls'].each_with_index.map{|c,i| TransactionCallTrace.new c, (traceAddress + [i]), parent } : []
12
+ @calls = raw['calls'] ? raw['calls'].each_with_index.map{|c,i| TransactionCallTrace.new c, (traceAddress + [i]), self } : []
13
13
  end
14
14
 
15
15
  # CALL STATICCALL DELEGATECALL CREATE SELFDESTRUCT
@@ -25,7 +25,7 @@ module Web3::Eth::Debug
25
25
  end
26
26
 
27
27
  def smart_contract
28
- ['DELEGATECALL','CALL'].include?(type) ? to : from
28
+ ['STATICCALL','CALL'].include?(type) ? to : from
29
29
  end
30
30
 
31
31
  def creates
@@ -0,0 +1,26 @@
1
+ module Web3
2
+ module Eth
3
+
4
+ class ParityModule
5
+
6
+ include Web3::Eth::Utility
7
+
8
+ PREFIX = 'parity_'
9
+
10
+ def initialize web3_rpc
11
+ @web3_rpc = web3_rpc
12
+ end
13
+
14
+ def method_missing m, *args
15
+ @web3_rpc.request "#{PREFIX}#{m}", args[0]
16
+ end
17
+
18
+ def getBlockReceiptsByBlockNumber block
19
+ @web3_rpc.request("#{PREFIX}getBlockReceipts", [hex(block)]).collect{|tr|
20
+ TransactionReceipt.new tr
21
+ }
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -17,7 +17,7 @@ module Web3
17
17
  DEFAULT_HOST = 'localhost'
18
18
  DEFAULT_PORT = 8545
19
19
 
20
- attr_reader :eth, :trace
20
+ attr_reader :eth, :connect_options
21
21
 
22
22
  def initialize host: DEFAULT_HOST, port: DEFAULT_PORT, connect_options: DEFAULT_CONNECT_OPTIONS
23
23
 
@@ -27,15 +27,20 @@ module Web3
27
27
  @connect_options = connect_options
28
28
 
29
29
  @eth = EthModule.new self
30
- @trace = TraceModule.new self
31
30
 
32
31
  end
33
32
 
33
+ def trace
34
+ @trace ||= TraceModule.new(self)
35
+ end
34
36
 
35
- def debug
36
- Debug::DebugModule.new self
37
+ def parity
38
+ @parity ||= ParityModule.new(self)
37
39
  end
38
40
 
41
+ def debug
42
+ @debug ||= Debug::DebugModule.new(self)
43
+ end
39
44
 
40
45
  def request method, params = nil
41
46
 
@@ -21,6 +21,12 @@ module Web3
21
21
  }
22
22
  end
23
23
 
24
+ def tracesByBlockNumber block
25
+ @web3_rpc.request("#{PREFIX}block", [hex(block)]).collect{|t|
26
+ CallTrace.new t
27
+ }
28
+ end
29
+
24
30
  end
25
31
  end
26
32
  end
@@ -1,5 +1,5 @@
1
1
  module Web3
2
2
  module Eth
3
- VERSION = "0.2.35"
3
+ VERSION = "0.2.40"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web3-eth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.35
4
+ version: 0.2.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - studnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-24 00:00:00.000000000 Z
11
+ date: 2020-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rlp
@@ -110,6 +110,7 @@ files:
110
110
  - lib/web3/eth/eth_module.rb
111
111
  - lib/web3/eth/etherscan.rb
112
112
  - lib/web3/eth/log.rb
113
+ - lib/web3/eth/parity_module.rb
113
114
  - lib/web3/eth/rpc.rb
114
115
  - lib/web3/eth/trace_module.rb
115
116
  - lib/web3/eth/transaction.rb