types

package
v0.0.0-...-241d3e1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 7 Imported by: 2

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 Config

type Config struct {
	ServerUrl                  string
	ServerPubKey               *secp256k1.PublicKey
	WalletType                 string
	ClientType                 string
	Network                    common.Network
	VtxoTreeExpiry             common.RelativeLocktime
	RoundInterval              int64
	UnilateralExitDelay        common.RelativeLocktime
	Dust                       uint64
	BoardingExitDelay          common.RelativeLocktime
	BoardingDescriptorTemplate string
	ExplorerURL                string
	ForfeitAddress             string
	WithTransactionFeed        bool
	MarketHourStartTime        int64
	MarketHourEndTime          int64
	MarketHourPeriod           int64
	MarketHourRoundInterval    int64
	UtxoMinAmount              int64
	UtxoMaxAmount              int64
	VtxoMinAmount              int64
	VtxoMaxAmount              int64
}

type ConfigStore

type ConfigStore interface {
	GetType() string
	GetDatadir() string
	AddData(ctx context.Context, data Config) error
	GetData(ctx context.Context) (*Config, error)
	CleanData(ctx context.Context) error
	Close()
}

type Store

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

type Transaction

type Transaction struct {
	TransactionKey
	Amount    uint64
	Type      TxType
	Settled   bool
	CreatedAt time.Time
	Hex       string
}

func (Transaction) IsBoarding

func (t Transaction) IsBoarding() bool

func (Transaction) IsOOR

func (t Transaction) IsOOR() bool

func (Transaction) IsRound

func (t Transaction) IsRound() bool

func (Transaction) String

func (t Transaction) String() string

type TransactionEvent

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

type TransactionKey

type TransactionKey struct {
	BoardingTxid string
	RoundTxid    string
	RedeemTxid   string
}

func (TransactionKey) String

func (t TransactionKey) String() string

type TransactionStore

type TransactionStore interface {
	AddTransactions(ctx context.Context, txs []Transaction) (int, error)
	SettleTransactions(ctx context.Context, txids []string) (int, error)
	ConfirmTransactions(ctx context.Context, txids []string, timestamp time.Time) (int, error)
	RbfTransactions(ctx context.Context, rbfTxs map[string]Transaction) (int, error)
	GetAllTransactions(ctx context.Context) ([]Transaction, error)
	GetTransactions(ctx context.Context, txids []string) ([]Transaction, error)
	UpdateTransactions(ctx context.Context, txs []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 TxType

type TxType string
const (
	TxSent     TxType = "SENT"
	TxReceived TxType = "RECEIVED"
)

type Utxo

type Utxo struct {
	Txid        string
	VOut        uint32
	Amount      uint64
	Delay       common.RelativeLocktime
	SpendableAt time.Time
	CreatedAt   time.Time
	Tapscripts  []string
	Spent       bool
	Tx          string
}

func (*Utxo) Sequence

func (u *Utxo) Sequence() (uint32, error)

type Vtxo

type Vtxo struct {
	VtxoKey
	PubKey    string
	Amount    uint64
	RoundTxid string
	ExpiresAt time.Time
	CreatedAt time.Time
	RedeemTx  string
	Pending   bool
	SpentBy   string
	Spent     bool
}

type VtxoEvent

type VtxoEvent struct {
	Type  VtxoEventType
	Vtxos []Vtxo
}

type VtxoEventType

type VtxoEventType int
const (
	VtxosAdded VtxoEventType = iota
	VtxosSpent
	VtxosUpdated
)

func (VtxoEventType) String

func (e VtxoEventType) String() string

type VtxoKey

type VtxoKey struct {
	Txid string
	VOut uint32
}

func (VtxoKey) String

func (v VtxoKey) String() string

type VtxoStore

type VtxoStore interface {
	AddVtxos(ctx context.Context, vtxos []Vtxo) (int, error)
	SpendVtxos(ctx context.Context, vtxos []VtxoKey, spentBy string) (int, error)
	UpdateVtxos(ctx context.Context, vtxos []Vtxo) (int, error)
	GetAllVtxos(ctx context.Context) (spendable []Vtxo, spent []Vtxo, err error)
	GetVtxos(ctx context.Context, keys []VtxoKey) ([]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