class EthereumContractABI::Util
Public Class Methods
fromHexByteString(str, with_prefix: true)
click to toggle source
# File lib/ethereum-contract-abi/util.rb, line 11 def self.fromHexByteString(str, with_prefix: true) prefix = with_prefix ? "0x" : "" prefix + str.unpack("H*").first end
keccak_hash(str)
click to toggle source
# File lib/ethereum-contract-abi/util.rb, line 20 def self. keccak_hash(str) [Digest::Keccak256.new.hexdigest(signature)].pack("H*") end
remove_hex_prefix(str)
click to toggle source
# File lib/ethereum-contract-abi/util.rb, line 16 def self.remove_hex_prefix(str) str.slice(2, str.length) end
toHexByteString(str)
click to toggle source
# File lib/ethereum-contract-abi/util.rb, line 4 def self.toHexByteString(str) if str.start_with?("0x") return [str.slice(2, str.length)].pack("H*") end [str].pack("H*") end