Documentation
¶
Overview ¶
Package types defines common types.
Index ¶
- func Equal(a *big.Int, b *big.Int) bool
- func Gt(a *big.Int, b *big.Int) bool
- func IsZero(a *big.Int) bool
- func Lt(a *big.Int, b *big.Int) bool
- func Max(a *big.Int, b *big.Int) *big.Int
- func Min(a *big.Int, b *big.Int) *big.Int
- type Address
- type Bytes
- type Bytes32
- type ConstError
- type Destination
- func (d Destination) Bytes() []byte
- func (d Destination) IsExternal() bool
- func (d Destination) IsZero() bool
- func (d Destination) MarshalText() (text []byte, err error)
- func (d Destination) String() string
- func (d Destination) ToAddress() (Address, error)
- func (d *Destination) UnmarshalText(text []byte) error
- type Funds
- type Uint256
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConstError ¶
type ConstError string
ConstError is a const-friendly error type.
func (ConstError) Error ¶
func (c ConstError) Error() string
type Destination ¶
type Destination Bytes32
Destination represents a payable address in go-nitro. In a state channel network, payable address are either:
- Internal: a 32-byte nitro channel ID, or
- External: a blockchain account or contract address, left-padded with 0s
func AddressToDestination ¶
func AddressToDestination(a Address) Destination
AddressToDestinaion left-pads the blockchain address with zeros.
func (Destination) Bytes ¶
func (d Destination) Bytes() []byte
func (Destination) IsExternal ¶
func (d Destination) IsExternal() bool
IsExternal returns true if the destination is a blockchain address, and false if it is a state channel ID.
func (Destination) IsZero ¶
func (d Destination) IsZero() bool
IsZero returns true if the destination is all zeros, and false otherwise.
func (Destination) MarshalText ¶
func (d Destination) MarshalText() (text []byte, err error)
MarshalText encodes the receiver into UTF-8-encoded text and returns the result.
This makes Destination an encoding.TextMarshaler, meaning it can be safely used as the key in a map which will be encoded into json.
func (Destination) String ¶
func (d Destination) String() string
func (Destination) ToAddress ¶
func (d Destination) ToAddress() (Address, error)
ToAddress returns a types.Address encoded external destination, or an error if destination is not an external address
func (*Destination) UnmarshalText ¶
func (d *Destination) UnmarshalText(text []byte) error
UnmarshalText unmarshals the supplied text (assumed to be a valid marshaling) into the receiver.
This makes Destination an encoding.TextUnmarshaler.
type Funds ¶
A {tokenAddress: amount} map. Address 0 represents a chain's native token (ETH, FIL, etc)
func Sum ¶
Sum returns a new Funds object with all of the asset keys from the supplied Funds objects, each having an amount summed across that asset's amount in each input object.
e.g. {[0x0a,0x01][0x0b,0x01]} + {[0x0a,0x02]} = {[0x0a,0x03][0x0b,0x01]}
func (Funds) Equal ¶
Equal returns true if receiver and input g are identical in monetary value, and false otherwise.
Note that a zero-balance equals a non-balance: {[0x0a,0x00],[0x0b,0x01]} == {[0x0b,0x01]}