Method: Eth::Tx#sanitize_address

Defined in:
lib/eth/tx.rb

#sanitize_address(addr) ⇒ String

Populates the transaction destination address with a serializable empty value in case it is undefined; also ensures the address is checksummed but not prefixed for consistency.

Parameters:

  • addr (String)

    the transaction destination address.

Returns:

  • (String)

    the sanitized transaction destination address.



343
344
345
346
347
348
349
350
# File 'lib/eth/tx.rb', line 343

def sanitize_address(addr)
  addr = "" if addr.nil?
  if addr.is_a? String and !addr.empty?
    addr = Address.new(addr).to_s
    addr = Util.remove_hex_prefix addr
  end
  return addr
end