balance

package
v0.0.0-...-c6effd4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCheckpointNotFound = errors.New("checkpoint not found")

	ErrStaleCheckpoint = errors.New("checkpoint is stale")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	Id uint64

	TokenAccount   string
	Quarks         uint64
	SlotCheckpoint uint64

	LastUpdatedAt time.Time
}

Note: Only supports external balances

func (*Record) Clone

func (r *Record) Clone() Record

func (*Record) CopyTo

func (r *Record) CopyTo(dst *Record)

func (*Record) Validate

func (r *Record) Validate() error

type Store

type Store interface {
	// SaveCheckpoint saves a balance at a checkpoint. ErrStaleCheckpoint is returned
	// if the checkpoint is outdated
	SaveCheckpoint(ctx context.Context, record *Record) error

	// GetCheckpoint gets a balance checkpoint for a given account. ErrCheckpointNotFound
	// is returend if no DB record exists.
	GetCheckpoint(ctx context.Context, account string) (*Record, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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