Documentation
¶
Index ¶
- Constants
- func ConvertSPRecipient(recipient *bip352.Recipient) *src.Recipient
- func CreateUnsignedPsbt(recipients []*src.Recipient, vins []*bip352.Vin) (*psbt.Packet, error)
- func ParseRecipients(recipients []*src.Recipient, vins []*bip352.Vin, chainParam *chaincfg.Params) ([]*src.Recipient, error)
- func SignPsbt(packet *psbt.Packet, vins []*bip352.Vin) error
- type Daemon
- func (d *Daemon) BroadcastTx(rawTx []byte) (string, error)
- func (d *Daemon) CheckUnspentUTXOs() error
- func (d *Daemon) ContinuousScan() error
- func (d *Daemon) CreateNewKeys(seedPassphrase string) error
- func (d *Daemon) ForceSyncFrom(fromHeight uint64) error
- func (d *Daemon) LoadDataFromDB() error
- func (d *Daemon) LoadTestData() error
- func (d *Daemon) MarkSpentUTXOs(blockHeight uint64) error
- func (d *Daemon) RecoverFromSeed(mnemonic, seedPassphrase string, birthHeight uint64) error
- func (d *Daemon) Run() error
- func (d *Daemon) RunTests()
- func (d *Daemon) SendToRecipients(recipients []*src.Recipient, feeRate int64, ...) ([]byte, error)
- func (d *Daemon) Shutdown() error
- func (d *Daemon) SyncToTip(chainTip uint64) error
Constants ¶
const ExtraDataAmountKey = "amount"
Variables ¶
This section is empty.
Functions ¶
func ConvertSPRecipient ¶
ConvertSPRecipient converts a bip352.Recipient to a Recipient native to this program
func CreateUnsignedPsbt ¶
func ParseRecipients ¶
func ParseRecipients(recipients []*src.Recipient, vins []*bip352.Vin, chainParam *chaincfg.Params) ([]*src.Recipient, error)
ParseRecipients Checks all recipients and adds the PkScript based on the given address. Silent Payment addresses are also parsed and the outputs will be computed based on the vins. For that reason this function has to be called after the final coinSelection is done. Otherwise, the SP outputs will NOT be found by the receiver. SP Recipients are always at the end. Hence, the tx must be sorted according to BIP 69 to avoid a specific signature of this wallet.
NOTE: Existing PkScripts will NOT be overridden, those recipients will be skipped and returned as given todo keep original order in case that is relevant for any use case?
Types ¶
type Daemon ¶
type Daemon struct { Status pb.Status Password []byte Locked bool ReadyChan chan struct{} // for the startup signal; either unlocking or setting password on initial startup ShutdownChan chan struct{} Mnemonic string ClientElectrum *electrum.Client ClientBlindBit *networking.ClientBlindBit Wallet *src.Wallet NewBlockChan <-chan *electrum.SubscribeHeadersResult TriggerRescanChan chan uint64 }
func NewDaemon ¶
func NewDaemon(wallet *src.Wallet, clientBlindBit *networking.ClientBlindBit, clientElectrum *electrum.Client) (*Daemon, error)
func (*Daemon) BroadcastTx ¶
BroadcastTx broadcasts a transaction and returns the txid
func (*Daemon) CheckUnspentUTXOs ¶
CheckUnspentUTXOs checks against electrum whether unspent owned UTXOs are now unspent
func (*Daemon) ContinuousScan ¶
func (*Daemon) CreateNewKeys ¶
CreateNewKeys WARNING: Must only be called if no other wallet is present. Will overwrite the old keys.
func (*Daemon) ForceSyncFrom ¶
func (*Daemon) LoadDataFromDB ¶
LoadDataFromDB Load keys and wallet data from disk
func (*Daemon) LoadTestData ¶
func (*Daemon) MarkSpentUTXOs ¶
func (*Daemon) RecoverFromSeed ¶
func (*Daemon) SendToRecipients ¶
func (d *Daemon) SendToRecipients(recipients []*src.Recipient, feeRate int64, markSpent, useSpentUnconfirmed bool) ([]byte, error)
SendToRecipients creates a signed transaction that sends to the specified recipients todo should all these functions just be Daemon functions use markSpent to set the used UTXOs to spent_unconfirmed use useSpentUnconfirmed to also include spent_undconfirmed UTXOs in the coinSelection process