class

Eth::Address

Inherits Reference / Object

Provides an address object that ensures the address is valid and always checksummed according to EIP-55.

Properties:

  • address (String): the Ethereum address.

Constructors

new(addr : String)

Creates an address object that ensures the address is valid and always checksummed according to EIP-55.

Parameters:

  • addr (String): the Ethereum address.

Raises an exception if the address is invalid (no hex, of wrong size, or the checksum is invalid).

Address.new "0x2ef1f605af5d03874ee88773f41c1382ac71c239"
# => #<Eth::Address:0x7fecd167a9c0
#           @address="0x2Ef1f605AF5d03874eE88773f41c1382ac71C239">
Source

Instance methods

address

Returns a checksummed string representation of the address.

Address.new("0x2ef1f605af5d03874ee88773f41c1382ac71c239").address
# => "0x2Ef1f605AF5d03874eE88773f41c1382ac71C239"
Source
to_s

Returns a checksummed string representation of the address.

Address.new("0x2ef1f605af5d03874ee88773f41c1382ac71c239").to_s
# => "0x2Ef1f605AF5d03874eE88773f41c1382ac71C239"
Source