asset

package
v0.20.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// paired against USD
	ErrInvalidTokenPair = sdkerrors.Register("asset", 1, "invalid token pair")
)
View Source
var PairKeyEncoder collections.KeyEncoder[Pair] = pairKeyEncoder{}
View Source
var Registry registry

Functions

This section is empty.

Types

type Pair

type Pair string

func MustNewPair

func MustNewPair(pair string) Pair

MustNewPair returns a new asset pair. It will panic if 'pair' is invalid. The form, "token0:token1", is expected for 'pair'.

func NewPair

func NewPair(base string, quote string) Pair

func TryNewPair

func TryNewPair(pair string) (Pair, error)

New returns a new asset pair instance if the pair is valid. The form, "token0:token1", is expected for 'pair'. Use this function to return an error instead of panicking.

func (Pair) BaseDenom

func (pair Pair) BaseDenom() string

func (Pair) Equal

func (pair Pair) Equal(other Pair) bool

func (Pair) Inverse

func (pair Pair) Inverse() Pair

func (Pair) Marshal

func (pair Pair) Marshal() ([]byte, error)

func (Pair) MarshalJSON

func (pair Pair) MarshalJSON() ([]byte, error)

func (Pair) MarshalTo

func (pair Pair) MarshalTo(data []byte) (n int, err error)

func (Pair) QuoteDenom

func (pair Pair) QuoteDenom() string

func (Pair) Size

func (pair Pair) Size() int

func (Pair) String

func (pair Pair) String() string

String returns the string representation of the asset pair.

Note that this differs from the output of the proto-generated 'String' method.

func (*Pair) Unmarshal

func (pair *Pair) Unmarshal(data []byte) error

func (*Pair) UnmarshalJSON

func (pair *Pair) UnmarshalJSON(data []byte) error

func (Pair) Validate

func (pair Pair) Validate() error

Validate performs a basic validation of the market params

type Pairs

type Pairs []Pair

Pairs is a set of Pair, one per pair.

func News

func News(pairStrings ...string) (pairs Pairs)

News constructs a new asset pair set. A panic will occur if one of the provided pair names is invalid.

func (Pairs) Contains

func (haystack Pairs) Contains(needle Pair) bool

Contains checks if a token pair is contained within 'Pairs'

func (Pairs) Strings

func (pairs Pairs) Strings() []string

func (Pairs) Validate

func (pairs Pairs) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL