Class: Web3::Eth::Transaction
- Inherits:
-
Object
- Object
- Web3::Eth::Transaction
show all
- Includes:
- Utility
- Defined in:
- lib/web3/eth/transaction.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) ⇒ Transaction
Returns a new instance of Transaction.
10
11
12
13
14
15
16
|
# File 'lib/web3/eth/transaction.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
end
|
Instance Attribute Details
#raw_data ⇒ Object
Returns the value of attribute raw_data.
8
9
10
|
# File 'lib/web3/eth/transaction.rb', line 8
def raw_data
@raw_data
end
|
Instance Method Details
#block_number ⇒ Object
36
37
38
39
40
|
# File 'lib/web3/eth/transaction.rb', line 36
def block_number
blockNumber && from_hex(blockNumber)
end
|
28
29
30
31
32
33
34
|
# File 'lib/web3/eth/transaction.rb', line 28
def call_input_data
if input && input.length>10
input[10..input.length]
else
[]
end
end
|
#gas_limit ⇒ Object
50
51
52
|
# File 'lib/web3/eth/transaction.rb', line 50
def gas_limit
from_hex gas
end
|
#gasPrice_eth ⇒ Object
54
55
56
|
# File 'lib/web3/eth/transaction.rb', line 54
def gasPrice_eth
wei_to_ether from_hex gasPrice
end
|
#gasPrice_weth ⇒ Object
58
59
60
|
# File 'lib/web3/eth/transaction.rb', line 58
def gasPrice_weth
from_hex gasPrice
end
|
#method_hash ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/web3/eth/transaction.rb', line 18
def method_hash
if input && input.length>=10
input[2...10]
else
nil
end
end
|
#transaction_nonce ⇒ Object
63
64
65
|
# File 'lib/web3/eth/transaction.rb', line 63
def transaction_nonce
from_hex nonce
end
|
#value_eth ⇒ Object
46
47
48
|
# File 'lib/web3/eth/transaction.rb', line 46
def value_eth
wei_to_ether from_hex value
end
|
#value_wei ⇒ Object
42
43
44
|
# File 'lib/web3/eth/transaction.rb', line 42
def value_wei
from_hex value
end
|