types

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	InMemoryStore = "inmemory"
	FileStore     = "file"
	KVStore       = "kv"
	SQLStore      = "sql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetStore

type AssetStore interface {
	GetAsset(ctx context.Context, assetId string) (*types.AssetInfo, error)
	UpsertAsset(ctx context.Context, asset types.AssetInfo) error
	Clean(ctx context.Context) error
	Close()
}

type OnchainAddressEvent

type OnchainAddressEvent struct {
	Error          error
	SpentUtxos     []clientTypes.OnchainOutput
	NewUtxos       []clientTypes.OnchainOutput
	ConfirmedUtxos []clientTypes.OnchainOutput
	Replacements   map[string]string // replacedTxid -> replacementTxid
}

type Store

type Store interface {
	TransactionStore() TransactionStore
	UtxoStore() UtxoStore
	VtxoStore() VtxoStore
	AssetStore() AssetStore
	Clean(ctx context.Context)
	Close()
}

type SyncEvent

type SyncEvent struct {
	Synced bool
	Err    error
}

type TransactionEvent

type TransactionEvent struct {
	Type         TxEventType
	Txs          []clientTypes.Transaction
	Replacements map[string]string
}

type TransactionStore

type TransactionStore interface {
	AddTransactions(ctx context.Context, txs []types.Transaction) (int, error)
	SettleTransactions(ctx context.Context, txids []string, settledBy string) (int, error)
	ConfirmTransactions(ctx context.Context, txids []string, timestamp time.Time) (int, error)
	RbfTransactions(ctx context.Context, rbfTxs map[string]string) (int, error)
	GetAllTransactions(ctx context.Context) ([]types.Transaction, error)
	GetTransactions(ctx context.Context, txids []string) ([]types.Transaction, error)
	UpdateTransactions(ctx context.Context, txs []types.Transaction) (int, error)
	Clean(ctx context.Context) error
	GetEventChannel() <-chan TransactionEvent
	Close()
}

type TxEventType

type TxEventType int
const (
	TxsAdded TxEventType = iota
	TxsSettled
	TxsConfirmed
	TxsReplaced
	TxsUpdated
)

func (TxEventType) String

func (e TxEventType) String() string

type UtxoEvent

type UtxoEvent struct {
	Type  UtxoEventType
	Utxos []clientTypes.Utxo
}

type UtxoEventType

type UtxoEventType int
const (
	UtxosAdded UtxoEventType = iota
	UtxosConfirmed
	UtxosReplaced
	UtxosSpent
)

func (UtxoEventType) String

func (e UtxoEventType) String() string

type UtxoStore

type UtxoStore interface {
	AddUtxos(ctx context.Context, utxos []types.Utxo) (int, error)
	ReplaceUtxo(ctx context.Context, from, to types.Outpoint) error
	ConfirmUtxos(ctx context.Context, confirmedUtxos map[types.Outpoint]int64) (int, error)
	SpendUtxos(ctx context.Context, spentUtxos map[types.Outpoint]string) (int, error)
	GetAllUtxos(ctx context.Context) (spendable, spent []types.Utxo, err error)
	GetUtxos(ctx context.Context, keys []types.Outpoint) ([]types.Utxo, error)
	Clean(ctx context.Context) error
	GetEventChannel() <-chan UtxoEvent
	Close()
}

type VtxoEvent

type VtxoEvent struct {
	Type  VtxoEventType
	Vtxos []clientTypes.Vtxo
}

type VtxoEventType

type VtxoEventType int
const (
	VtxosAdded VtxoEventType = iota
	VtxosSpent
	VtxoSettled
	VtxosSwept
	VtxosUnrolled
)

func (VtxoEventType) String

func (e VtxoEventType) String() string

type VtxoStore

type VtxoStore interface {
	AddVtxos(ctx context.Context, vtxos []types.Vtxo) (int, error)
	SpendVtxos(
		ctx context.Context, spentVtxos map[types.Outpoint]string, arkTxid string,
	) (int, error)
	SettleVtxos(
		ctx context.Context, spentVtxos map[types.Outpoint]string, settledBy string,
	) (int, error)
	SweepVtxos(ctx context.Context, vtxosToSweep []types.Vtxo) (int, error)
	UnrollVtxos(ctx context.Context, vtxosToUnroll []types.Vtxo) (int, error)
	GetAllVtxos(ctx context.Context) (spendable, spent []types.Vtxo, err error)
	GetSpendableVtxos(ctx context.Context) ([]types.Vtxo, error)
	GetVtxos(ctx context.Context, keys []types.Outpoint) ([]types.Vtxo, error)
	Clean(ctx context.Context) error
	GetEventChannel() <-chan VtxoEvent
	Close()
}

Jump to

Keyboard shortcuts

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