Documentation
¶
Overview ¶
Package utxo provides a generic UTXO (Unspent Transaction Output) management system that can be used across different blockchain architectures (Bitcoin, XRPL, Lux)
Index ¶
- Variables
- type BaseManager
- func (m *BaseManager) AddUTXO(_ context.Context, utxo *UTXO) error
- func (m *BaseManager) GetBalance(_ context.Context, address string, assetID ids.ID) (*big.Int, error)
- func (m *BaseManager) GetUTXO(_ context.Context, utxoID ids.ID) (*UTXO, error)
- func (m *BaseManager) GetUTXOs(_ context.Context, address string) ([]*UTXO, error)
- func (m *BaseManager) RemoveUTXO(_ context.Context, utxoID ids.ID) error
- func (m *BaseManager) SelectUTXOs(_ context.Context, address string, assetID ids.ID, targetAmount *big.Int) ([]*UTXO, *big.Int, error)
- type ChainType
- type Manager
- type UTXO
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BaseManager ¶
type BaseManager struct {
// contains filtered or unexported fields
}
BaseManager provides a basic implementation of UTXO management
func NewBaseManager ¶
func NewBaseManager() *BaseManager
NewBaseManager creates a new base UTXO manager
func (*BaseManager) GetBalance ¶
func (*BaseManager) RemoveUTXO ¶
type Manager ¶
type Manager interface {
// AddUTXO adds a new UTXO to the set
AddUTXO(ctx context.Context, utxo *UTXO) error
// RemoveUTXO removes a UTXO from the set
RemoveUTXO(ctx context.Context, utxoID ids.ID) error
// GetUTXO retrieves a specific UTXO
GetUTXO(ctx context.Context, utxoID ids.ID) (*UTXO, error)
// GetUTXOs retrieves all UTXOs for a given address
GetUTXOs(ctx context.Context, address string) ([]*UTXO, error)
// GetBalance calculates the total balance for an address
GetBalance(ctx context.Context, address string, assetID ids.ID) (*big.Int, error)
// SelectUTXOs selects UTXOs to meet a target amount
SelectUTXOs(ctx context.Context, address string, assetID ids.ID, targetAmount *big.Int) ([]*UTXO, *big.Int, error)
}
Manager provides chain-agnostic UTXO management
type UTXO ¶
type UTXO struct {
ID ids.ID
TxID ids.ID
OutputIndex uint32
AssetID ids.ID
Amount *big.Int
Address string // Can be different formats based on chain type
ScriptPubKey []byte // For Bitcoin-style chains
Locktime uint64
ChainType ChainType
Extra interface{} // Chain-specific data
}
UTXO represents a generic unspent transaction output
Click to show internal directories.
Click to hide internal directories.