abstract struct Fremkit::Address

Overview

This represents an address and contains general helper methods. To obtain a workable object, #check_format needs to be over- loaded to check that the address' format is correct.

Direct Known Subclasses

Defined in:

common/address.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

from_rlp(rlp : Bytes) : Tuple(self, UInt32) from_rlp, to_rlp : Bytes to_rlp

Class methods inherited from class Object

from_rlp(rlp : Bytes) : Tuple(self, UInt32) from_rlp

Constructor Detail

def self.new(bytes : Array(UInt8), little : Bool = false) #

Turns the list of bytes into an address. #little specifies the endianness of those bytes.


[View source]
def self.new(str : String, little : Bool = false) #

Turns a hex string representing an address into an address. #little is true if bytes should be stored in little-endian order


[View source]

Instance Method Detail

def bytes : Array(UInt8) #

[View source]
abstract def check_format : Bool #

This should be overloaded to check that the size of the @bytes array corresponds to a valid address.


[View source]
abstract def format_size : Int32 #

This should be overloaded to allocate the right size of bytes into @bytes


[View source]
def format_str : String #

Default address format descriptor, overload if needed.


[View source]
def from_bytes(bytes : Array(UInt8)) #

[View source]
def hex_str : String #

[View source]
def little : Bool #

[View source]
def to_i : BigInt #

[View source]
def to_s #
Description copied from class Object

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]