Class: Web3::Eth::TransactionReceipt

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utility

#from_hex, #hex, #remove_0x_head, #wei_to_ether

Constructor Details

#initialize(transaction_data) ⇒ TransactionReceipt

Returns a new instance of TransactionReceipt.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/web3ethereum/transaction_receipt.rb', line 10

def initialize transaction_data
  @raw_data = transaction_data

  transaction_data.each do |k, v|
    self.instance_variable_set("@#{k}", v)
    self.class.send(:define_method, k, proc {self.instance_variable_get("@#{k}")})
  end

  @logs = @logs.collect {|log|  Web3::Eth::Log.new log }

end

Instance Attribute Details

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



8
9
10
# File 'lib/web3ethereum/transaction_receipt.rb', line 8

def raw_data
  @raw_data
end

Instance Method Details

#block_numberObject



22
23
24
# File 'lib/web3ethereum/transaction_receipt.rb', line 22

def block_number
  from_hex blockNumber
end

#cumulative_gas_usedObject



35
36
37
# File 'lib/web3ethereum/transaction_receipt.rb', line 35

def cumulative_gas_used
  from_hex cumulativeGasUsed
end

#gas_usedObject



30
31
32
# File 'lib/web3ethereum/transaction_receipt.rb', line 30

def gas_used
  from_hex gasUsed
end

#success?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/web3ethereum/transaction_receipt.rb', line 26

def success?
   status==1 || status=='0x1' || status.nil?
end