Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateWalletCredentials(backend WalletBackend, credentials *WalletCredentials) error
- type Balance
- type BlockEpoch
- type ChainProvider
- type Currency
- type ElectrumConfig
- type ElectrumOptions
- type Id
- type LightzProvider
- func (txProvider LightzProvider) BroadcastTransaction(txHex string) (string, error)
- func (txProvider LightzProvider) Disconnect()
- func (txProvider LightzProvider) EstimateFee() (float64, error)
- func (txProvider LightzProvider) GetBlockHeight() (uint32, error)
- func (txProvider LightzProvider) GetRawTransaction(txId string) (string, error)
- func (txProvider LightzProvider) GetUnspentOutputs(address string) ([]*Output, error)
- func (txProvider LightzProvider) IsTransactionConfirmed(txId string) (bool, error)
- type MultiChainProvider
- func (m MultiChainProvider) BroadcastTransaction(txHex string) (txId string, err error)
- func (m MultiChainProvider) Disconnect()
- func (m MultiChainProvider) EstimateFee() (float64, error)
- func (m MultiChainProvider) GetBlockHeight() (uint32, error)
- func (m MultiChainProvider) GetRawTransaction(txId string) (hex string, err error)
- func (m MultiChainProvider) GetUnspentOutputs(address string) ([]*Output, error)
- func (m MultiChainProvider) IsTransactionConfirmed(txId string) (confirmed bool, err error)
- type Onchain
- func (onchain *Onchain) AddWallet(wallet Wallet)
- func (onchain *Onchain) BroadcastTransaction(transaction lightz.Transaction) (string, error)
- func (onchain *Onchain) Disconnect()
- func (onchain *Onchain) EstimateFee(currency lightz.Currency) (float64, error)
- func (onchain *Onchain) FindOutput(info OutputArgs) (*OutputResult, error)
- func (onchain *Onchain) GetAnyWallet(checker WalletChecker) (Wallet, error)
- func (onchain *Onchain) GetBlockHeight(currency lightz.Currency) (uint32, error)
- func (onchain *Onchain) GetBlockProvider(currency lightz.Currency) ChainProvider
- func (onchain *Onchain) GetCurrency(currency lightz.Currency) (*Currency, error)
- func (onchain *Onchain) GetTransaction(currency lightz.Currency, txId string, ourOutputBlindingKey *btcec.PrivateKey, ...) (lightz.Transaction, error)
- func (onchain *Onchain) GetTransactionFee(transaction lightz.Transaction) (uint64, error)
- func (onchain *Onchain) GetUnspentOutputs(currency lightz.Currency, address string) ([]*Output, error)
- func (onchain *Onchain) GetWallets(checker WalletChecker) []Wallet
- func (onchain *Onchain) Init()
- func (onchain *Onchain) IsTransactionConfirmed(currency lightz.Currency, txId string, retry bool) (bool, error)
- func (onchain *Onchain) RegisterBlockListener(ctx context.Context, currency lightz.Currency) *utils.ChannelForwarder[*BlockEpoch]
- func (onchain *Onchain) RemoveWallet(id Id)
- type Output
- type OutputArgs
- type OutputResult
- type TransactionOutput
- type Wallet
- type WalletBackend
- type WalletChecker
- type WalletCredentials
- type WalletInfo
- type WalletSendArgs
- type WalletTransaction
Constants ¶
View Source
const DefaultTransactionsLimit = 30
Variables ¶
View Source
var DefaultWalletSyncIntervals = map[lightz.Currency]time.Duration{ lightz.CurrencyBtc: 3 * time.Minute, lightz.CurrencyLiquid: time.Minute, }
View Source
var ErrNotConfirmed = errors.New("lockup transaction not confirmed")
View Source
var FeeFloor = map[lightz.Currency]float64{ lightz.CurrencyLiquid: 0.1, lightz.CurrencyBtc: 2, }
View Source
var RegtestElectrumConfig = ElectrumConfig{ Btc: &ElectrumOptions{Url: "localhost:19001"}, Liquid: &ElectrumOptions{Url: "localhost:19002"}, }
Functions ¶
func ValidateWalletCredentials ¶
func ValidateWalletCredentials(backend WalletBackend, credentials *WalletCredentials) error
Types ¶
type BlockEpoch ¶
type BlockEpoch struct {
Height uint32
}
type ChainProvider ¶
type ChainProvider interface {
EstimateFee() (float64, error)
GetBlockHeight() (uint32, error)
GetRawTransaction(txId string) (string, error)
BroadcastTransaction(txHex string) (string, error)
IsTransactionConfirmed(txId string) (bool, error)
GetUnspentOutputs(address string) ([]*Output, error)
Disconnect()
}
type Currency ¶
type Currency struct {
Chain ChainProvider
// contains filtered or unexported fields
}
type ElectrumConfig ¶
type ElectrumConfig struct {
Btc *ElectrumOptions
Liquid *ElectrumOptions
}
type ElectrumOptions ¶
func (*ElectrumOptions) String ¶
func (e *ElectrumOptions) String() string
type LightzProvider ¶
func NewLightzChainProvider ¶
func NewLightzChainProvider(lightzd *lightz.Api, currency lightz.Currency) *LightzProvider
func (LightzProvider) BroadcastTransaction ¶
func (txProvider LightzProvider) BroadcastTransaction(txHex string) (string, error)
func (LightzProvider) Disconnect ¶
func (txProvider LightzProvider) Disconnect()
func (LightzProvider) EstimateFee ¶
func (txProvider LightzProvider) EstimateFee() (float64, error)
func (LightzProvider) GetBlockHeight ¶
func (txProvider LightzProvider) GetBlockHeight() (uint32, error)
func (LightzProvider) GetRawTransaction ¶
func (txProvider LightzProvider) GetRawTransaction(txId string) (string, error)
func (LightzProvider) GetUnspentOutputs ¶
func (txProvider LightzProvider) GetUnspentOutputs(address string) ([]*Output, error)
func (LightzProvider) IsTransactionConfirmed ¶
func (txProvider LightzProvider) IsTransactionConfirmed(txId string) (bool, error)
type MultiChainProvider ¶
type MultiChainProvider struct {
ChainProvider
Providers []ChainProvider
Lightz ChainProvider
}
MultiChainProvider is a chain provider that can combine multiple third party providers into a single one, potentially using a lightzd chain provider as a fallback. Its a trust-minimized implementation where lightzd API is only ever trusted if every single provider is not reachable.
func (MultiChainProvider) BroadcastTransaction ¶
func (m MultiChainProvider) BroadcastTransaction(txHex string) (txId string, err error)
func (MultiChainProvider) Disconnect ¶
func (m MultiChainProvider) Disconnect()
func (MultiChainProvider) EstimateFee ¶
func (m MultiChainProvider) EstimateFee() (float64, error)
func (MultiChainProvider) GetBlockHeight ¶
func (m MultiChainProvider) GetBlockHeight() (uint32, error)
func (MultiChainProvider) GetRawTransaction ¶
func (m MultiChainProvider) GetRawTransaction(txId string) (hex string, err error)
func (MultiChainProvider) GetUnspentOutputs ¶
func (m MultiChainProvider) GetUnspentOutputs(address string) ([]*Output, error)
func (MultiChainProvider) IsTransactionConfirmed ¶
func (m MultiChainProvider) IsTransactionConfirmed(txId string) (confirmed bool, err error)
type Onchain ¶
type Onchain struct {
Btc *Currency
Liquid *Currency
Network *lightz.Network
Wallets []Wallet
OnWalletChange *utils.ChannelForwarder[[]Wallet]
WalletSyncIntervals map[lightz.Currency]time.Duration
// contains filtered or unexported fields
}
func (*Onchain) BroadcastTransaction ¶
func (onchain *Onchain) BroadcastTransaction(transaction lightz.Transaction) (string, error)
func (*Onchain) Disconnect ¶
func (onchain *Onchain) Disconnect()
func (*Onchain) EstimateFee ¶
func (*Onchain) FindOutput ¶
func (onchain *Onchain) FindOutput(info OutputArgs) (*OutputResult, error)
func (*Onchain) GetAnyWallet ¶
func (onchain *Onchain) GetAnyWallet(checker WalletChecker) (Wallet, error)
func (*Onchain) GetBlockHeight ¶
func (*Onchain) GetBlockProvider ¶
func (onchain *Onchain) GetBlockProvider(currency lightz.Currency) ChainProvider
func (*Onchain) GetCurrency ¶
func (*Onchain) GetTransaction ¶
func (onchain *Onchain) GetTransaction(currency lightz.Currency, txId string, ourOutputBlindingKey *btcec.PrivateKey, retry bool) (lightz.Transaction, error)
func (*Onchain) GetTransactionFee ¶
func (onchain *Onchain) GetTransactionFee(transaction lightz.Transaction) (uint64, error)
func (*Onchain) GetUnspentOutputs ¶
func (*Onchain) GetWallets ¶
func (onchain *Onchain) GetWallets(checker WalletChecker) []Wallet
func (*Onchain) IsTransactionConfirmed ¶
func (*Onchain) RegisterBlockListener ¶
func (onchain *Onchain) RegisterBlockListener(ctx context.Context, currency lightz.Currency) *utils.ChannelForwarder[*BlockEpoch]
func (*Onchain) RemoveWallet ¶
type OutputArgs ¶
type OutputResult ¶
type OutputResult struct {
Transaction lightz.Transaction
Vout uint32
Value uint64
}
type TransactionOutput ¶
type Wallet ¶
type Wallet interface {
NewAddress() (string, error)
SendToAddress(args WalletSendArgs) (string, error)
Ready() bool
GetBalance() (*Balance, error)
GetWalletInfo() WalletInfo
Disconnect() error
GetTransactions(limit, offset uint64) ([]*WalletTransaction, error)
BumpTransactionFee(txId string, satPerVbyte float64) (string, error)
GetSendFee(args WalletSendArgs) (send uint64, fee uint64, err error)
GetOutputs(address string) ([]*Output, error)
Sync() error
FullScan() error
ApplyTransaction(txHex string) error
}
type WalletBackend ¶
type WalletChecker ¶
type WalletChecker struct {
Id *Id
Name *string
Currency lightz.Currency
AllowReadonly bool
TenantId *Id
}
func (*WalletChecker) Allowed ¶
func (walletChecker *WalletChecker) Allowed(wallet Wallet) bool
type WalletCredentials ¶
type WalletCredentials struct {
WalletInfo
Mnemonic string
Subaccount *uint64
Xpub string
CoreDescriptor string
Salt string
Legacy bool
}
func (*WalletCredentials) Decrypt ¶
func (c *WalletCredentials) Decrypt(password string) (*WalletCredentials, error)
func (*WalletCredentials) Encrypt ¶
func (c *WalletCredentials) Encrypt(password string) (*WalletCredentials, error)
func (*WalletCredentials) Encrypted ¶
func (c *WalletCredentials) Encrypted() bool
type WalletInfo ¶
func (WalletInfo) InsufficientBalanceError ¶
func (info WalletInfo) InsufficientBalanceError(amount uint64) error
func (WalletInfo) String ¶
func (info WalletInfo) String() string
type WalletSendArgs ¶
type WalletTransaction ¶
Click to show internal directories.
Click to hide internal directories.