Class: Web3::Eth::Debug::TransactionCallTrace
- Inherits:
-
Object
- Object
- Web3::Eth::Debug::TransactionCallTrace
show all
- Includes:
- Utility
- Defined in:
- lib/web3/eth/debug/transaction_call_trace.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Utility
#from_hex, #hex, #remove_0x_head, #wei_to_ether
Constructor Details
Returns a new instance of TransactionCallTrace.
8
9
10
11
12
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 8
def initialize raw, traceAddress = []
@raw_data = raw
@traceAddress = traceAddress
@calls = raw['calls'] ? raw['calls'].each_with_index.map{|c,i| TransactionCallTrace.new c, (traceAddress + [i]) } : []
end
|
Instance Attribute Details
#calls ⇒ Object
Returns the value of attribute calls.
7
8
9
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 7
def calls
@calls
end
|
#raw_data ⇒ Object
Returns the value of attribute raw_data.
7
8
9
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 7
def raw_data
@raw_data
end
|
#traceAddress ⇒ Object
Returns the value of attribute traceAddress.
7
8
9
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 7
def traceAddress
@traceAddress
end
|
Instance Method Details
#action ⇒ Object
19
20
21
22
23
24
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 19
def action
{
'callType' => type.downcase,
'address' => raw_data['to']
}
end
|
88
89
90
91
92
93
94
95
96
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 88
def call_input_data
if creates && input
input[/a165627a7a72305820\w{64}0029(\w*)/,1]
elsif input && input.length>10
input[10..input.length]
else
[]
end
end
|
#creates ⇒ Object
26
27
28
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 26
def creates
(type=='CREATE' || type=='CREATE2') ? to : nil
end
|
#error ⇒ Object
78
79
80
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 78
def error
raw_data['error']
end
|
#from ⇒ Object
42
43
44
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 42
def from
raw_data['from']
end
|
#gas ⇒ Object
58
59
60
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 58
def gas
from_hex raw_data['gas']
end
|
#gas_used ⇒ Object
62
63
64
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 62
def gas_used
from_hex raw_data['gasUsed']
end
|
66
67
68
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 66
def input
raw_data['input']
end
|
#method_hash ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 30
def method_hash
if input && input.length>=10
input[2...10]
else
nil
end
end
|
#output ⇒ Object
70
71
72
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 70
def output
raw_data['output']
end
|
#success? ⇒ Boolean
82
83
84
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 82
def success?
!raw_data['error']
end
|
#suicide? ⇒ Boolean
38
39
40
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 38
def suicide?
type=='SELFDESTRUCT'
end
|
#time ⇒ Object
74
75
76
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 74
def time
raw_data['time']
end
|
#to ⇒ Object
46
47
48
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 46
def to
raw_data['to']
end
|
#type ⇒ Object
CALL STATICCALL DELEGATECALL CREATE SELFDESTRUCT
15
16
17
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 15
def type
raw_data['type']
end
|
#value_eth ⇒ Object
54
55
56
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 54
def value_eth
wei_to_ether value_wei
end
|
#value_wei ⇒ Object
50
51
52
|
# File 'lib/web3/eth/debug/transaction_call_trace.rb', line 50
def value_wei
from_hex raw_data['value']
end
|