types

package
v0.0.0-...-a76333c Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const RootCodeSpace = "tibc-sdk-go"

Variables

View Source
var (
	ErrInternal                     = Register(RootCodeSpace, 1, "internal")
	ErrChainConn                    = Register(RootCodeSpace, 2, "connection chain failed")
	ErrGetLightClientState          = Register(RootCodeSpace, 3, "failed to get light client state")
	ErrGetBlockHeader               = Register(RootCodeSpace, 4, "failed to get block header")
	ErrUpdateClient                 = Register(RootCodeSpace, 5, "failed to update client")
	ErrGetPackets                   = Register(RootCodeSpace, 6, "failed to get packets")
	ErrGetCommitmentPacket          = Register(RootCodeSpace, 7, "failed to get commitment packet")
	ErrGetAckPacket                 = Register(RootCodeSpace, 8, "failed to get ack packet")
	ErrGetReceiptPacket             = Register(RootCodeSpace, 9, "failed to get receipt packet")
	ErrGetProof                     = Register(RootCodeSpace, 10, "failed to get proof")
	ErrGetLatestHeight              = Register(RootCodeSpace, 11, "failed to get latest height")
	ErrRecvPacket                   = Register(RootCodeSpace, 12, "failed to recv packet")
	ErrNotProduced                  = Register(RootCodeSpace, 13, "failed to not produced")
	ErrUnknownMsg                   = Register(RootCodeSpace, 14, "failed to unknown msg type")
	ErrUnpackAny                    = Register(RootCodeSpace, 15, "failed to unpack any")
	ErrGetLightClientConsensusState = Register(RootCodeSpace, 16, "failed to light consensus state")
	ErrGetRelayer                   = Register(RootCodeSpace, 17, "failed to get relayer")
	ErrGetAddress                   = Register(RootCodeSpace, 18, "failed to get address")
	ErrPackAny                      = Register(RootCodeSpace, 19, "failed to pack any")
	ErrGetUnreceivedPacket          = Register(RootCodeSpace, 20, "failed to get unreceived packet")
	ErrSendAckPacket                = Register(RootCodeSpace, 21, "failed to send ack packet")
	ErrSendCleanPacket              = Register(RootCodeSpace, 22, "failed to send clean packet")
	ErrRecvCleanPacket              = Register(RootCodeSpace, 23, "failed to recv clean packet")
	ErrNftTransfer                  = Register(RootCodeSpace, 24, "failed to send nft transfer  ")
	ErrInvalidConsensus             = Register(RootCodeSpace, 25, "invalid consensus state")
	ErrInvalidHeader                = Register(RootCodeSpace, 26, "invalid consensus state")
	ErrInvalidHeight                = Register(RootCodeSpace, 27, "invalid height")
	ErrInvalidAddress               = Register(RootCodeSpace, 28, "invalid address")
	ErrInvalidID                    = Register(RootCodeSpace, 29, "invalid identifier")
)

Functions

func Wrap

func Wrap(err error, description string) error

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Types

type CleanPacketI

type CleanPacketI interface {
	GetSequence() uint64
	GetSourceChain() string
	GetDestChain() string
	GetRelayChain() string
	ValidateBasic() error
}

CleanPacketI defines the standard interface for TIBC clean packets

type ClientState

type ClientState interface {
	proto.Message

	ClientType() string
	GetLatestHeight() Height
	Validate() error
	GetDelayTime() uint64
	GetDelayBlock() uint64
	GetPrefix() Prefix
}

ClientState defines the required common functions for light clients.

type ConsensusState

type ConsensusState interface {
	proto.Message

	ClientType() string // Consensus kind

	// GetRoot returns the commitment root of the consensus state,
	// which is used for key-value pair verification.
	GetRoot() Root

	// GetTimestamp returns the timestamp (in nanoseconds) of the consensus state
	GetTimestamp() uint64

	ValidateBasic() error
}

ConsensusState is the state of the consensus process

type Error

type Error struct {
	// contains filtered or unexported fields
}

func New

func New(codeSpace string, code uint32, desc string) *Error

func Register

func Register(codespace string, code uint32, description string) *Error

func (Error) Code

func (e Error) Code() uint32

func (Error) Codespace

func (e Error) Codespace() string

func (Error) Error

func (e Error) Error() string
type Header interface {
	proto.Message

	ClientType() string
	GetHeight() Height
	ValidateBasic() error
}

Header is the consensus state update information

type Height

type Height interface {
	IsZero() bool
	GetRevisionNumber() uint64
	GetRevisionHeight() uint64
	Increment() Height
	Decrement() (Height, bool)
	String() string
}

Height is a wrapper interface over client.Height all clients must use the concrete implementation in types

type IError

type IError interface {
	error
	Code() uint32
	Codespace() string
}

func IErrorWrap

func IErrorWrap(err IError, description string) IError

type PacketI

type PacketI interface {
	GetSequence() uint64
	GetPort() string
	GetSourceChain() string
	GetDestChain() string
	GetRelayChain() string
	GetData() []byte
	ValidateBasic() error
}

PacketI defines the standard interface for IBC packets

type Path

type Path interface {
	String() string
	Empty() bool
}

Path implements spec:CommitmentPath. A path is the additional information provided to the verification function.

type Prefix

type Prefix interface {
	Bytes() []byte
	Empty() bool
}

Prefix implements spec:CommitmentPrefix. Prefix represents the common "prefix" that a set of keys shares.

type Root

type Root interface {
	GetHash() []byte
	Empty() bool
}

Root implements spec:CommitmentRoot. A root is constructed from a set of key-value pairs, and the inclusion or non-inclusion of an arbitrary key-value pair can be proven with the proof.

type UpdateClientRequest

type UpdateClientRequest struct {
	ChainName string `json:"chain_name"`
	// header to update the light client
	Header Header `json:"header"`
}

TODO:

type WrappedError

type WrappedError struct {
	// contains filtered or unexported fields
}

func (*WrappedError) Cause

func (e *WrappedError) Cause() error

func (*WrappedError) Error

func (e *WrappedError) Error() string

func (*WrappedError) Is

func (e *WrappedError) Is(target error) bool

Is reports whether any error in e's chain matches a target.

func (*WrappedError) Unwrap

func (e *WrappedError) Unwrap() error

Unwrap implements the built-in errors.Unwrap

Jump to

Keyboard shortcuts

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