spec

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("already-exists")
View Source
var ErrNotFound = errors.New("not-found")

Functions

This section is empty.

Types

type Balance added in v0.0.3

type Balance struct {
	Incoming  koinu.Koinu `json:"incoming"`  // takes N confirmations to become Availble
	Available koinu.Koinu `json:"available"` // confirmed balance you can spend
	Outgoing  koinu.Koinu `json:"outgoing"`  // takes N confirmations to become fully Spent
	Current   koinu.Koinu `json:"current"`   // current balance: Incoming + Available
}

Balance

type OutPointKey

type OutPointKey struct {
	Tx   []byte // 32-byte hash
	VOut uint32 // output number
}

func OutPoint

func OutPoint(txID []byte, index uint32) OutPointKey

OutPoint makes a binary string to use as a database key.

type Store

type Store interface {
	storelib.StoreAPI[Store, StoreTx] // include the Base Store API
	StoreTx                           // include all the StoreTx methods
}

type StoreTx

type StoreTx interface {

	// GetResumePoint gets the hash to resume from.
	GetResumePoint() (hash []byte, err error)

	// SetResumePoint sets the hash to resume from.
	SetResumePoint(hash []byte, height int64) error

	// RemoveUTXOs marks UTXOs as spent at `height`
	RemoveUTXOs(removeUTXOs []OutPointKey, height int64) error

	// CreateUTXOs inserts new UTXOs at `height`
	CreateUTXOs(createUTXOs []UTXO, height int64) error

	// FindUTXOs finds all unspent UTXOs for an address.
	FindUTXOs(kind doge.ScriptType, address []byte) (res []UTXO, err error)

	// GetBalance sums all unspent UTXOs for an address.
	// 'confirmations' is the number of confirmations before a balance is available (typically 6)
	GetBalance(kind doge.ScriptType, address []byte, confirmations int64) (res Balance, err error)

	// UndoAbove removes created UTXOs and re-activates Removed UTXOs above `height`.
	UndoAbove(height int64) error

	// TrimSpentUTXOs permanently deletes all spent UTXOs below `height`
	TrimSpentUTXOs(height int64) error
}

type UTXO

type UTXO struct {
	TxID   []byte          // 32-byte tx hash
	VOut   uint32          // tx output index
	Value  int64           // Koinu value
	Type   doge.ScriptType // script type
	Script []byte          // content depends on 'Type' (compressed by ClassifyScript)
}

Jump to

Keyboard shortcuts

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