class Eth::Address

Overview

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

Properties:

Defined in:

eth/address.cr

Constructors

Instance Method Summary

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">

[View source]

Instance Method Detail

def address : String #

Returns a checksummed string representation of the address.

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

[View source]
def to_s : String #

Returns a checksummed string representation of the address.

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

[View source]