Class: Web3::Eth::TraceModule

Inherits:
Object
  • Object
show all
Includes:
Utility
Defined in:
lib/web3ethereum/trace_module.rb

Constant Summary collapse

PREFIX =
'trace_'

Instance Method Summary collapse

Methods included from Utility

#from_hex, #hex, #remove_0x_head, #wei_to_ether

Constructor Details

#initialize(web3_rpc) ⇒ TraceModule

Returns a new instance of TraceModule.



10
11
12
# File 'lib/web3ethereum/trace_module.rb', line 10

def initialize web3_rpc
  @web3_rpc = web3_rpc
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



14
15
16
# File 'lib/web3ethereum/trace_module.rb', line 14

def method_missing m, *args
  @web3_rpc.request "#{PREFIX}#{m}", args[0]
end

Instance Method Details

#internalCallsByHash(tx_hash) ⇒ Object



18
19
20
21
22
# File 'lib/web3ethereum/trace_module.rb', line 18

def internalCallsByHash tx_hash
  @web3_rpc.request("#{PREFIX}transaction", [tx_hash]).select{|t| t['traceAddress']!=[]}.collect{|t|
    CallTrace.new t
  }
end