txrecords

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(b *bytes.Buffer, t *TxRecord) error

Decode a TxRecord from a buffer.

func Encode

func Encode(b *bytes.Buffer, t *TxRecord) error

Encode the TxRecord into a buffer.

Types

type Direction

type Direction uint8

Direction is an enum which tells us whether a transaction is incoming or outgoing.

const (
	// In identifies incoming transaction.
	In Direction = iota
	// Out identifies outgoing transaction.
	Out
)

type TxMeta added in v0.4.0

type TxMeta struct {
	Height    uint64
	Direction Direction
	Timestamp int64
}

TxMeta is a convenience structure which groups fields common to the TxView and the TxRecord.

type TxRecord

type TxRecord struct {
	TxMeta
	Transaction transactions.ContractCall
}

TxRecord encapsulates the data stored on the DB related to a transaction such as block height, direction, etc. The fields related to the ContractCall are embedded inside the Transaction carrying the information about the `Fee` (gas) and the `Amount` (which can be zero for smart contract calls not related to transfer o value).

func New

func New(call transactions.ContractCall, height uint64, direction Direction) *TxRecord

New creates a TxRecord.

func (TxRecord) View added in v0.4.0

func (t TxRecord) View() TxView

View returns a UI consumable representation of a TXRecord.

type TxView added in v0.4.0

type TxView struct {
	TxMeta
	Type       transactions.TxType
	Amount     uint64
	Fee        uint64
	Timelock   uint64
	Hash       []byte
	Data       []byte
	Obfuscated bool
}

TxView is the UX-friendly structure to be served to the UI requesting them.

Jump to

Keyboard shortcuts

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