class Eth::Address
- Eth::Address
- Reference
- Object
Overview
Provides an address object that ensures the address is valid and always checksummed according to EIP-55.
Properties:
#address
(String
): the Ethereum address.
Defined in:
eth/address.crConstructors
-
.new(addr : String)
Creates an address object that ensures the address is valid and always checksummed according to EIP-55.
Instance Method Summary
-
#address : String
Returns a checksummed string representation of the address.
-
#to_s : String
Returns a checksummed string representation of the address.
Constructor Detail
def self.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">
Instance Method Detail
def address : String
#
Returns a checksummed string representation of the address.
Address.new("0x2ef1f605af5d03874ee88773f41c1382ac71c239").address
# => "0x2Ef1f605AF5d03874eE88773f41c1382ac71C239"
def to_s : String
#
Returns a checksummed string representation of the address.
Address.new("0x2ef1f605af5d03874ee88773f41c1382ac71c239").to_s
# => "0x2Ef1f605AF5d03874eE88773f41c1382ac71C239"