types

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeSlice

func DeserializeSlice[T encoding.BinaryUnmarshaler](bts []byte, newFn func() T) ([]T, error)

DeserializeSlice deserializes a slice of binary marshalable items. It expects bytes, as well as a function to create a new item of the slice type.

func SerializeSlice

func SerializeSlice[T encoding.BinaryMarshaler](slice []T) ([]byte, error)

SerializeSlice serializes a slice of binary marshalable items. It prepends the length of each item to the serialized data.

Types

type Account

type Account struct {
	Identifier []byte   `json:"identifier"`
	Balance    *big.Int `json:"balance"`
	Nonce      int64    `json:"nonce"`
}

type AccountStatus

type AccountStatus uint32
const (
	AccountStatusLatest AccountStatus = iota
	AccountStatusPending
)

type ChainInfo

type ChainInfo struct {
	ChainID     string `json:"chain_id"`
	BlockHeight uint64 `json:"block_height"`
	BlockHash   string `json:"block_hash"`
}

ChainInfo describes the current status of a Kwil blockchain.

type DatasetIdentifier

type DatasetIdentifier struct {
	Name  string `json:"name"`
	Owner []byte `json:"owner"`
	DBID  string `json:"dbid"`
}

DatasetIdentifier contains the information required to identify a dataset.

type HexBytes

type HexBytes []byte

HexBytes is used to decode hexadecimal text into a byte slice.

func (HexBytes) MarshalJSON

func (hb HexBytes) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface.

func (HexBytes) String

func (hb HexBytes) String() string

func (*HexBytes) UnmarshalJSON

func (hb *HexBytes) UnmarshalJSON(b []byte) error

UnmarshalText satisfies the json.Unmarshaler interface.

type JoinRequest

type JoinRequest struct {
	Candidate []byte   `json:"candidate"`  // pubkey of the candidate validator
	Power     int64    `json:"power"`      // the requested power
	ExpiresAt int64    `json:"expires_at"` // the block height at which the join request expires
	Board     [][]byte `json:"board"`      // slice of pubkeys of all the eligible voting validators
	Approved  []bool   `json:"approved"`   // slice of bools indicating if the corresponding validator approved
}

type NodeInfo

type NodeInfo struct {
	NodeID           string   `json:"node_id"`
	PublicKey        HexBytes `json:"pubkey"`
	P2PListenAddress string   `json:"p2p_listen_address"`
}

NodeInfo contains public information about a node. It can be used by clients to join as a peer.

type UUID

type UUID [16]byte

UUID is a rfc4122 compliant uuidv5

func NewUUIDV5

func NewUUIDV5(from []byte) UUID

NewUUIDV5 generates a uuidv5 from a byte slice. This is used to deterministically generate uuids.

func (*UUID) Scan

func (u *UUID) Scan(src any) error

func (UUID) String

func (u UUID) String() string

String returns the string representation of the uuid

func (UUID) Value

func (u UUID) Value() (driver.Value, error)

type UUIDArray

type UUIDArray []UUID

func (*UUIDArray) Scan

func (u *UUIDArray) Scan(src any) error

func (UUIDArray) Value

func (u UUIDArray) Value() (driver.Value, error)

type Validator

type Validator struct {
	PubKey []byte `json:"pubkey"`
	Power  int64  `json:"power"`
}

func (*Validator) String

func (v *Validator) String() string

type ValidatorRemoveProposal

type ValidatorRemoveProposal struct {
	Target  []byte `json:"target"`  // pubkey of the validator to remove
	Remover []byte `json:"remover"` // pubkey of the validator proposing the removal
}

ValidatorRemoveProposal is a proposal from an existing validator (remover) to remove a validator (the target) from the validator set.

type VotableEvent

type VotableEvent struct {
	Type string `json:"type"`
	Body []byte `json:"body"`
}

VotableEvent is an event that can be voted. It contains an event type and a body. An ID can be generated from the event type and body.

func (*VotableEvent) ID

func (e *VotableEvent) ID() UUID

Directories

Path Synopsis
_numbers
big
Package types contains the type used by the administrative RPC client and servers.
Package types contains the type used by the administrative RPC client and servers.
Package transactions contains all the logic for creating and validating transactions and call messages.
Package transactions contains all the logic for creating and validating transactions and call messages.

Jump to

Keyboard shortcuts

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