ipldbindcode

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisableHashVerification bool
View Source
var Prototypes schemaSlab

Functions

func VerifyHash

func VerifyHash(data []byte, hash uint64) error

VerifyHash verifies that the provided data matches the provided hash. In case of DataFrames, the hash is stored in the 'Hash' field, and it is the hash of the concatenated 'Data' fields of all the DataFrames.

Types

type Block

type Block struct {
	Kind      int             `json:"kind" yaml:"kind"`
	Slot      int             `json:"slot" yaml:"slot"`
	Shredding List__Shredding `json:"shredding" yaml:"shredding"`
	Entries   List__Link      `json:"entries" yaml:"entries"`
	Meta      SlotMeta        `json:"meta" yaml:"meta"`
	Rewards   datamodel.Link  `json:"rewards" yaml:"rewards"`
}

func (Block) GetBlockHeight

func (n Block) GetBlockHeight() (uint64, bool)

GetBlockHeight returns the 'block_height' field, which indicates the height of the block, and a flag indicating whether the field has a value.

type Buffer

type Buffer []uint8

func (*Buffer) FromString

func (b *Buffer) FromString(s string) error

func (Buffer) MarshalJSON

func (b Buffer) MarshalJSON() ([]byte, error)

Buffer.MarshalJSON() returns the JSON representation of the Buffer in base64.

func (Buffer) String

func (b Buffer) String() string

Buffer.String() returns the string representation of the Buffer in base64.

func (*Buffer) UnmarshalJSON

func (b *Buffer) UnmarshalJSON(data []byte) error

Buffer.UnmarshalJSON() decodes the JSON representation of the Buffer in base64.

type DataFrame

type DataFrame struct {
	Kind  int          `json:"kind" yaml:"kind"`
	Hash  **int        `json:"hash" yaml:"hash"`
	Index **int        `json:"index" yaml:"index"`
	Total **int        `json:"total" yaml:"total"`
	Data  Buffer       `json:"data" yaml:"data"`
	Next  **List__Link `json:"next" yaml:"next"`
}

func (DataFrame) Bytes

func (n DataFrame) Bytes() []uint8

GetData returns the value of the 'Data' field and a flag indicating whether the field has a value.

func (DataFrame) GetHash

func (n DataFrame) GetHash() (uint64, bool)

GetHash returns the value of the 'Hash' field and a flag indicating whether the field has a value.

func (DataFrame) GetIndex

func (n DataFrame) GetIndex() (int, bool)

GetIndex returns the value of the 'Index' field and a flag indicating whether the field has a value.

func (DataFrame) GetNext

func (n DataFrame) GetNext() (List__Link, bool)

GetNext returns the value of the 'Next' field and a flag indicating whether the field has a value.

func (DataFrame) GetTotal

func (n DataFrame) GetTotal() (int, bool)

GetTotal returns the value of the 'Total' field and a flag indicating whether the field has a value.

func (DataFrame) HasHash

func (n DataFrame) HasHash() bool

DataFrame.HasHash returns whether the 'Hash' field is present.

func (DataFrame) HasIndex

func (n DataFrame) HasIndex() bool

HasIndex returns whether the 'Index' field is present.

func (DataFrame) HasNext

func (n DataFrame) HasNext() bool

HasNext returns whether the 'Next' field is present and non-empty.

func (DataFrame) HasTotal

func (n DataFrame) HasTotal() bool

HasTotal returns whether the 'Total' field is present.

func (DataFrame) MarshalJSON

func (n DataFrame) MarshalJSON() ([]byte, error)

DataFrame.MarshalJSON implements the json.Marshaler interface.

func (*DataFrame) UnmarshalJSON

func (n *DataFrame) UnmarshalJSON(data []byte) error

DataFrame.UnmarshalJSON implements the json.Unmarshaler interface.

type Entry

type Entry struct {
	Kind         int        `json:"kind" yaml:"kind"`
	NumHashes    int        `json:"num_hashes" yaml:"num_hashes"`
	Hash         Hash       `json:"hash" yaml:"hash"`
	Transactions List__Link `json:"transactions" yaml:"transactions"`
}

type Epoch

type Epoch struct {
	Kind    int        `json:"kind" yaml:"kind"`
	Epoch   int        `json:"epoch" yaml:"epoch"`
	Subsets List__Link `json:"subsets" yaml:"subsets"`
}

type Hash

type Hash []uint8

func (Hash) MarshalJSON

func (h Hash) MarshalJSON() ([]byte, error)

Hash.MarshalJSON() returns the JSON representation of the Hash in hex.

func (Hash) String

func (h Hash) String() string

Hash.String() returns the string representation of the Hash in hex.

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(data []byte) error

Hash.UnmarshalJSON() decodes the JSON representation of the Hash in hex.

type List__Link []datamodel.Link

type List__Shredding

type List__Shredding []Shredding

type Rewards

type Rewards struct {
	Kind int       `json:"kind" yaml:"kind"`
	Slot int       `json:"slot" yaml:"slot"`
	Data DataFrame `json:"data" yaml:"data"`
}

type Shredding

type Shredding struct {
	EntryEndIdx int `json:"entry_end_idx" yaml:"entry_end_idx"`
	ShredEndIdx int `json:"shred_end_idx" yaml:"shred_end_idx"`
}

type SlotMeta

type SlotMeta struct {
	Parent_slot  int   `json:"parent_slot" yaml:"parent_slot"`
	Blocktime    int   `json:"blocktime" yaml:"blocktime"`
	Block_height **int `json:"block_height" yaml:"block_height"`
}

type Subset

type Subset struct {
	Kind   int        `json:"kind" yaml:"kind"`
	First  int        `json:"first" yaml:"first"`
	Last   int        `json:"last" yaml:"last"`
	Blocks List__Link `json:"blocks" yaml:"blocks"`
}

type Transaction

type Transaction struct {
	Kind     int       `json:"kind" yaml:"kind"`
	Data     DataFrame `json:"data" yaml:"data"`
	Metadata DataFrame `json:"metadata" yaml:"metadata"`
	Slot     int       `json:"slot" yaml:"slot"`
	Index    **int     `json:"index" yaml:"index"`
}

func (Transaction) GetPositionIndex

func (n Transaction) GetPositionIndex() (int, bool)

GetPositionIndex returns the 'Index' field, which indicates the index of the transaction in the block (0-based), and a flag indicating whether the field has a value.

func (Transaction) GetSolanaTransaction added in v0.4.0

func (decoded Transaction) GetSolanaTransaction() (*solana.Transaction, error)

func (Transaction) HasIndex

func (n Transaction) HasIndex() bool

Transaction.HasIndex returns whether the 'Index' field is present.

func (Transaction) Signature added in v0.4.0

func (decoded Transaction) Signature() (solana.Signature, error)

func (Transaction) Signatures added in v0.4.0

func (decoded Transaction) Signatures() ([]solana.Signature, error)

Jump to

Keyboard shortcuts

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