class Web3::Hpb::HpbModule

Constants

PREFIX

Public Class Methods

new(web3_rpc) click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 10
def initialize web3_rpc
  @web3_rpc = web3_rpc
end

Public Instance Methods

blockNumber() click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 24
def blockNumber
  from_hex @web3_rpc.request("#{PREFIX}#{__method__}")
end
contract(abi) click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 36
def contract abi
  Web3::Hpb::Contract.new abi, @web3_rpc
end
getBalance(address, block = 'latest', convert_to_hpb = true) click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 14
def getBalance address, block = 'latest', convert_to_hpb = true
  wei = @web3_rpc.request("#{PREFIX}#{__method__}", [address, block]).to_i 16
  convert_to_hpb ? wei_to_hpb(wei) : wei
end
getBlockByNumber(block, full = true, convert_to_object = true) click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 19
def getBlockByNumber block, full = true, convert_to_object = true
  resp = @web3_rpc.request("#{PREFIX}#{__method__}", [hex(block), full])
  convert_to_object ? Block.new(resp) : resp
end
getTransactionByHash(tx_hash) click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 28
def getTransactionByHash tx_hash
  Transaction.new @web3_rpc.request("#{PREFIX}#{__method__}", [tx_hash])
end
getTransactionReceipt(tx_hash) click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 32
def getTransactionReceipt tx_hash
  TransactionReceipt.new @web3_rpc.request("#{PREFIX}#{__method__}", [tx_hash])
end
method_missing(m, *args) click to toggle source
# File lib/web3/hpb/hpb_module.rb, line 40
def method_missing m, *args
  @web3_rpc.request "#{PREFIX}#{m}", args[0]
end