Versions in this module Expand all Collapse all v0 v0.0.14 Dec 3, 2024 v0.0.13 Nov 15, 2024 Changes in this version type Wallet + FeeCoefficient float64 + func (w *Wallet) FetchDerivationInfo(pkScript []byte) (*psbt.Bip32Derivation, error) + func (w *Wallet) FetchOutpointInfo(prevOut *wire.OutPoint) (*wire.MsgTx, *wire.TxOut, int64, error) + func (w *Wallet) RescanFor(addr btcutil.Address, startBlock *waddrmgr.BlockStamp) error v0.0.12 Oct 11, 2024 v0.0.11 Sep 26, 2024 v0.0.10 Sep 18, 2024 v0.0.9 Sep 18, 2024 v0.0.8 Aug 29, 2024 Changes in this version type Wallet + ChangeAddressKey *btcec.PublicKey + func (w *Wallet) GenerateAndImportKeyWithCheck(btcAddr, ethAddr string) (*btcec.PublicKey, error) + func (w *Wallet) GenerateKeyFromEthAddressAndImport(ethAddr string) (*btcec.PublicKey, error) v0.0.7 Aug 21, 2024 Changes in this version type Wallet + func (w *Wallet) GetTransactionDetails(txHash chainhash.Hash) (*wtxmgr.TxDetails, error) + func (w *Wallet) SendOutputsWithData(outputs []*wire.TxOut, keyScope *waddrmgr.KeyScope, account uint32, ...) (*wire.MsgTx, error) v0.0.6 Jul 13, 2024 v0.0.5 Jun 18, 2024 Changes in this version + const DefaultStorageFileName + type AddressMapStorage struct + func NewAddressMapStorage(storageFilePath string) (*AddressMapStorage, error) + func (s *AddressMapStorage) GetEthAddress(btcAddress string) (string, error) + func (s *AddressMapStorage) SetEthAddress(btcAddress, ethAddress string) error type Wallet + AddressMapStorage *AddressMapStorage v0.0.4 Jun 10, 2024 v0.0.3 Jun 1, 2024 v0.0.2 May 2, 2024 Changes in this version + const DefaultDBTimeout + const InsecurePubPassphrase + const WalletDBName + var ErrExists = errors.New("wallet already exists") + var ErrLoaded = errors.New("wallet already loaded") + var ErrNoTx = errors.New("can not find transaction") + var ErrNotLoaded = errors.New("wallet is not loaded") + var ErrNotMine = errors.New(...) + var ErrNotSynced = errors.New("wallet is not synchronized with the chain server") + var ErrTxLabelExists = errors.New("transaction already labelled") + var ErrTxUnsigned = errors.New("watch-only wallet, transaction not signed") + var ErrUnknownTransaction = errors.New(...) + var ErrWalletShuttingDown = errors.New("wallet shutting down") + func Create(db walletdb.DB, pubPass, privPass []byte, rootKey *hdkeychain.ExtendedKey, ...) error + func CreateWatchingOnly(db walletdb.DB, pubPass []byte, params *chaincfg.Params, birthday time.Time) error + func CreateWatchingOnlyWithCallback(db walletdb.DB, pubPass []byte, params *chaincfg.Params, birthday time.Time, ...) error + func CreateWithCallback(db walletdb.DB, pubPass, privPass []byte, rootKey *hdkeychain.ExtendedKey, ...) error + func DisableLog() + func DropTransactionHistory(db walletdb.DB, keepLabels bool) error + func PsbtPrevOutputFetcher(packet *psbt.Packet) *txscript.MultiPrevOutFetcher + func UnstableAPI(w *Wallet) unstableAPI + func UseLogger(logger btclog.Logger) + type AccountBalance struct + Account uint32 + TotalBalance btcutil.Amount + type AccountBalanceResult struct + AccountBalance btcutil.Amount + AccountName string + AccountNumber uint32 + type AccountNotification struct + AccountName string + AccountNumber uint32 + ExternalKeyCount uint32 + ImportedKeyCount uint32 + InternalKeyCount uint32 + type AccountNotificationsClient struct + C chan *AccountNotification + func (c *AccountNotificationsClient) Done() + type AccountResult struct + TotalBalance btcutil.Amount + type AccountTotalReceivedResult struct + AccountName string + AccountNumber uint32 + LastConfirmation int32 + TotalReceived btcutil.Amount + type AccountsResult struct + Accounts []AccountResult + CurrentBlockHash *chainhash.Hash + CurrentBlockHeight int32 + type Balances struct + ImmatureReward btcutil.Amount + Spendable btcutil.Amount + Total btcutil.Amount + type Block struct + Hash *chainhash.Hash + Height int32 + Timestamp int64 + Transactions []TransactionSummary + type BlockIdentifier struct + func NewBlockIdentifierFromHash(hash *chainhash.Hash) *BlockIdentifier + func NewBlockIdentifierFromHeight(height int32) *BlockIdentifier + type BlockIdentity struct + Hash chainhash.Hash + Height int32 + func (b *BlockIdentity) None() bool + type BranchRecoveryState struct + func NewBranchRecoveryState(recoveryWindow uint32) *BranchRecoveryState + func (brs *BranchRecoveryState) AddAddr(index uint32, addr btcutil.Address) + func (brs *BranchRecoveryState) Addrs() map[uint32]btcutil.Address + func (brs *BranchRecoveryState) ExtendHorizon() (uint32, uint32) + func (brs *BranchRecoveryState) GetAddr(index uint32) btcutil.Address + func (brs *BranchRecoveryState) MarkInvalidChild(index uint32) + func (brs *BranchRecoveryState) NextUnfound() uint32 + func (brs *BranchRecoveryState) NumInvalidInHorizon() uint32 + func (brs *BranchRecoveryState) ReportFound(index uint32) + type Coin struct + type CoinSelectionStrategy interface + ArrangeCoins func(eligible []Coin, feeSatPerKb btcutil.Amount) ([]Coin, error) + var CoinSelectionLargest CoinSelectionStrategy = &LargestFirstCoinSelector{} + var CoinSelectionRandom CoinSelectionStrategy = &RandomCoinSelector{} + type CreditCategory byte + const CreditGenerate + const CreditImmature + const CreditReceive + func RecvCategory(details *wtxmgr.TxDetails, syncHeight int32, net *chaincfg.Params) CreditCategory + func (c CreditCategory) String() string + type ErrAlreadyConfirmed struct + func (e *ErrAlreadyConfirmed) Error() string + func (e *ErrAlreadyConfirmed) Unwrap() error + type ErrDoubleSpend struct + func (e *ErrDoubleSpend) Error() string + func (e *ErrDoubleSpend) Unwrap() error + type ErrInMempool struct + func (e *ErrInMempool) Error() string + func (e *ErrInMempool) Unwrap() error + type ErrMempoolFee struct + func (e *ErrMempoolFee) Error() string + func (e *ErrMempoolFee) Unwrap() error + type GetTransactionResult struct + BlockHash *chainhash.Hash + Confirmations int32 + Height int32 + Summary TransactionSummary + Timestamp int64 + type GetTransactionsResult struct + MinedTransactions []Block + UnminedTransactions []TransactionSummary + type LargestFirstCoinSelector struct + func (*LargestFirstCoinSelector) ArrangeCoins(eligible []Coin, _ btcutil.Amount) ([]Coin, error) + type ListLeasedOutputResult struct + PkScript []byte + Value int64 + type Loader struct + func NewLoader(chainParams *chaincfg.Params, dbDirPath string, noFreelistSync bool, ...) *Loader + func NewLoaderWithDB(chainParams *chaincfg.Params, recoveryWindow uint32, db walletdb.DB, ...) (*Loader, error) + func (l *Loader) CreateNewWallet(pubPassphrase, privPassphrase, seed []byte, bday time.Time) (*Wallet, error) + func (l *Loader) CreateNewWalletExtendedKey(pubPassphrase, privPassphrase []byte, rootKey *hdkeychain.ExtendedKey, ...) (*Wallet, error) + func (l *Loader) CreateNewWatchingOnlyWallet(pubPassphrase []byte, bday time.Time) (*Wallet, error) + func (l *Loader) LoadedWallet() (*Wallet, bool) + func (l *Loader) OnWalletCreated(fn func(walletdb.ReadWriteTx) error) + func (l *Loader) OpenExistingWallet(pubPassphrase []byte, canConsolePrompt bool) (*Wallet, error) + func (l *Loader) RunAfterLoad(fn func(*Wallet)) + func (l *Loader) UnloadWallet() error + func (l *Loader) WalletExists() (bool, error) + type LoaderOption func(*loaderConfig) + func WithWalletSyncRetryInterval(interval time.Duration) LoaderOption + type NotificationServer struct + func (s *NotificationServer) AccountNotifications() AccountNotificationsClient + func (s *NotificationServer) AccountSpentnessNotifications(account uint32) SpentnessNotificationsClient + func (s *NotificationServer) TransactionNotifications() TransactionNotificationsClient + type OutputKind byte + const OutputKindCoinbase + const OutputKindNormal + type OutputRedeemer struct + InputIndex uint32 + TxHash chainhash.Hash + type OutputSelectionPolicy struct + Account uint32 + RequiredConfirmations int32 + type P2SHMultiSigOutput struct + ContainingBlock BlockIdentity + M uint8 + N uint8 + OutPoint wire.OutPoint + OutputAmount btcutil.Amount + P2SHAddress *btcutil.AddressScriptHash + RedeemScript []byte + Redeemer *OutputRedeemer + type PrivKeyTweaker func(*btcec.PrivateKey) (*btcec.PrivateKey, error) + type RandomCoinSelector struct + func (*RandomCoinSelector) ArrangeCoins(eligible []Coin, feeSatPerKb btcutil.Amount) ([]Coin, error) + type RecoveryManager struct + func NewRecoveryManager(recoveryWindow, batchSize uint32, chainParams *chaincfg.Params) *RecoveryManager + func (rm *RecoveryManager) AddToBlockBatch(hash *chainhash.Hash, height int32, timestamp time.Time) + func (rm *RecoveryManager) BlockBatch() []wtxmgr.BlockMeta + func (rm *RecoveryManager) ResetBlockBatch() + func (rm *RecoveryManager) Resurrect(ns walletdb.ReadBucket, ...) error + func (rm *RecoveryManager) State() *RecoveryState + type RecoveryState struct + func NewRecoveryState(recoveryWindow uint32) *RecoveryState + func (rs *RecoveryState) AddWatchedOutPoint(outPoint *wire.OutPoint, addr btcutil.Address) + func (rs *RecoveryState) StateForScope(keyScope waddrmgr.KeyScope) *ScopeRecoveryState + func (rs *RecoveryState) WatchedOutPoints() map[wire.OutPoint]btcutil.Address + type RescanFinishedMsg struct + Addresses []btcutil.Address + Notification *chain.RescanFinished + type RescanJob struct + Addrs []btcutil.Address + BlockStamp waddrmgr.BlockStamp + InitialSync bool + OutPoints map[wire.OutPoint]btcutil.Address + type RescanProgressMsg struct + Addresses []btcutil.Address + Notification chain.RescanProgress + type ScopeRecoveryState struct + ExternalBranch *BranchRecoveryState + InternalBranch *BranchRecoveryState + func NewScopeRecoveryState(recoveryWindow uint32) *ScopeRecoveryState + type SignatureError struct + Error error + InputIndex uint32 + type SpentnessNotifications struct + func (n *SpentnessNotifications) Hash() *chainhash.Hash + func (n *SpentnessNotifications) Index() uint32 + func (n *SpentnessNotifications) Spender() (*chainhash.Hash, uint32, bool) + type SpentnessNotificationsClient struct + C <-chan *SpentnessNotifications + func (c *SpentnessNotificationsClient) Done() + type TransactionNotifications struct + AttachedBlocks []Block + DetachedBlocks []*chainhash.Hash + NewBalances []AccountBalance + UnminedTransactionHashes []*chainhash.Hash + UnminedTransactions []TransactionSummary + type TransactionNotificationsClient struct + C <-chan *TransactionNotifications + func (c *TransactionNotificationsClient) Done() + type TransactionOutput struct + ContainingBlock BlockIdentity + OutPoint wire.OutPoint + Output wire.TxOut + OutputKind OutputKind + ReceiveTime time.Time + type TransactionSummary struct + Fee btcutil.Amount + Hash *chainhash.Hash + Label string + MyInputs []TransactionSummaryInput + MyOutputs []TransactionSummaryOutput + Timestamp int64 + Transaction []byte + type TransactionSummaryInput struct + Index uint32 + PreviousAccount uint32 + PreviousAmount btcutil.Amount + type TransactionSummaryOutput struct + Account uint32 + Index uint32 + Internal bool + type TxCreateOption func(*txCreateOptions) + func WithCustomChangeScope(changeScope *waddrmgr.KeyScope) TxCreateOption + func WithCustomSelectUtxos(utxos []wire.OutPoint) TxCreateOption + func WithUtxoFilter(allowUtxo func(utxo wtxmgr.Credit) bool) TxCreateOption + type Wallet struct + FrostSigner frost.ISigner + Manager *waddrmgr.Manager + NtfnServer *NotificationServer + Pk1 *btcec.PublicKey + Pk2 *btcec.PublicKey + TxStore *wtxmgr.Store + func Open(db walletdb.DB, pubPass []byte, cbs *waddrmgr.OpenCallbacks, ...) (*Wallet, error) + func OpenWithRetry(db walletdb.DB, pubPass []byte, cbs *waddrmgr.OpenCallbacks, ...) (*Wallet, error) + func (w *Wallet) AccountAddresses(account uint32) (addrs []btcutil.Address, err error) + func (w *Wallet) AccountBalances(scope waddrmgr.KeyScope, requiredConfs int32) ([]AccountBalanceResult, error) + func (w *Wallet) AccountName(scope waddrmgr.KeyScope, accountNumber uint32) (string, error) + func (w *Wallet) AccountNumber(scope waddrmgr.KeyScope, accountName string) (uint32, error) + func (w *Wallet) AccountOfAddress(a btcutil.Address) (uint32, error) + func (w *Wallet) AccountProperties(scope waddrmgr.KeyScope, acct uint32) (*waddrmgr.AccountProperties, error) + func (w *Wallet) AccountPropertiesByName(scope waddrmgr.KeyScope, name string) (*waddrmgr.AccountProperties, error) + func (w *Wallet) Accounts(scope waddrmgr.KeyScope) (*AccountsResult, error) + func (w *Wallet) AddressInfo(a btcutil.Address) (waddrmgr.ManagedAddress, error) + func (w *Wallet) CalculateAccountBalances(account uint32, confirms int32) (Balances, error) + func (w *Wallet) CalculateBalance(confirms int32) (btcutil.Amount, error) + func (w *Wallet) ChainClient() chain.Interface + func (w *Wallet) ChainParams() *chaincfg.Params + func (w *Wallet) ChainSynced() bool + func (w *Wallet) ChangePassphrases(publicOld, publicNew, privateOld, privateNew []byte) error + func (w *Wallet) ChangePrivatePassphrase(old, new []byte) error + func (w *Wallet) ChangePublicPassphrase(old, new []byte) error + func (w *Wallet) CheckDoubleSpendAndCreateTxWithRedemptionId(start, end *BlockIdentifier, redemptionId uint32, ...) (*txauthor.AuthoredTx, error) + func (w *Wallet) ComputeInputScript(tx *wire.MsgTx, output *wire.TxOut, inputIndex int, ...) (wire.TxWitness, []byte, error) + func (w *Wallet) CreateSimpleTx(coinSelectKeyScope *waddrmgr.KeyScope, account uint32, outputs []*wire.TxOut, ...) (*txauthor.AuthoredTx, error) + func (w *Wallet) CreateSimpleTxWithRedemptionId(coinSelectKeyScope *waddrmgr.KeyScope, account uint32, outputs []*wire.TxOut, ...) (*txauthor.AuthoredTx, error) + func (w *Wallet) CurrentAddress(account uint32, scope waddrmgr.KeyScope) (btcutil.Address, error) + func (w *Wallet) Database() walletdb.DB + func (w *Wallet) DecorateInputs(packet *psbt.Packet, failOnUnknown bool) error + func (w *Wallet) DumpPrivKeys() ([]string, error) + func (w *Wallet) DumpWIFPrivateKey(addr btcutil.Address) (string, error) + func (w *Wallet) FetchInputInfo(prevOut *wire.OutPoint) (*wire.MsgTx, *wire.TxOut, *psbt.Bip32Derivation, int64, error) + func (w *Wallet) FinalizePsbt(keyScope *waddrmgr.KeyScope, account uint32, packet *psbt.Packet) error + func (w *Wallet) FundPsbt(packet *psbt.Packet, keyScope *waddrmgr.KeyScope, minConfs int32, ...) (int32, error) + func (w *Wallet) GetSignerPublicKeys() (*btcec.PublicKey, *btcec.PublicKey, error) + func (w *Wallet) GetTransaction(txHash chainhash.Hash) (*GetTransactionResult, error) + func (w *Wallet) GetTransactions(startBlock, endBlock *BlockIdentifier, accountName string, ...) (*GetTransactionsResult, error) + func (w *Wallet) HaveAddress(a btcutil.Address) (bool, error) + func (w *Wallet) ImportAccount(name string, accountPubKey *hdkeychain.ExtendedKey, ...) (*waddrmgr.AccountProperties, error) + func (w *Wallet) ImportAccountDryRun(name string, accountPubKey *hdkeychain.ExtendedKey, ...) (*waddrmgr.AccountProperties, []waddrmgr.ManagedAddress, ...) + func (w *Wallet) ImportAccountWithScope(name string, accountPubKey *hdkeychain.ExtendedKey, ...) (*waddrmgr.AccountProperties, error) + func (w *Wallet) ImportBtcAddressWithEthAddr(btcAddr, ethAddr string) (*btcec.PublicKey, error) + func (w *Wallet) ImportP2SHRedeemScript(script []byte) (*btcutil.AddressScriptHash, error) + func (w *Wallet) ImportPrivateKey(scope waddrmgr.KeyScope, wif *btcutil.WIF, bs *waddrmgr.BlockStamp, ...) (string, error) + func (w *Wallet) ImportPublicKey(pubKey *btcec.PublicKey, addrType waddrmgr.AddressType) error + func (w *Wallet) ImportPublicKeyReturnAddress(pubKey *btcec.PublicKey, addrType waddrmgr.AddressType) (waddrmgr.ManagedAddress, error) + func (w *Wallet) ImportTaprootScript(scope waddrmgr.KeyScope, tapscript *waddrmgr.Tapscript, ...) (waddrmgr.ManagedAddress, error) + func (w *Wallet) IsRedemptionIdAlreadySpent(redemptionId uint32, start, end *BlockIdentifier) (bool, chainhash.Hash, error) + func (w *Wallet) LabelTransaction(hash chainhash.Hash, label string, overwrite bool) error + func (w *Wallet) LeaseOutput(id wtxmgr.LockID, op wire.OutPoint, duration time.Duration) (time.Time, error) + func (w *Wallet) ListAddressTransactions(pkHashes map[string]struct{}) ([]btcjson.ListTransactionsResult, error) + func (w *Wallet) ListAllTransactions() ([]btcjson.ListTransactionsResult, error) + func (w *Wallet) ListLeasedOutputs() ([]*ListLeasedOutputResult, error) + func (w *Wallet) ListSinceBlock(start, end, syncHeight int32) ([]btcjson.ListTransactionsResult, error) + func (w *Wallet) ListTransactions(from, count int) ([]btcjson.ListTransactionsResult, error) + func (w *Wallet) ListUnspent(minconf, maxconf int32, accountName string) ([]*btcjson.ListUnspentResult, error) + func (w *Wallet) Lock() + func (w *Wallet) LockOutpoint(op wire.OutPoint) + func (w *Wallet) Locked() bool + func (w *Wallet) LockedOutpoint(op wire.OutPoint) bool + func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput + func (w *Wallet) LookupAccount(name string) (waddrmgr.KeyScope, uint32, error) + func (w *Wallet) MakeMultiSigScript(addrs []btcutil.Address, nRequired int) ([]byte, error) + func (w *Wallet) NewAddress(account uint32, scope waddrmgr.KeyScope) (btcutil.Address, error) + func (w *Wallet) NewChangeAddress(account uint32, scope waddrmgr.KeyScope) (btcutil.Address, error) + func (w *Wallet) NextAccount(scope waddrmgr.KeyScope, name string) (uint32, error) + func (w *Wallet) PrivKeyForAddress(a btcutil.Address) (*btcec.PrivateKey, error) + func (w *Wallet) PubKeyForAddress(a btcutil.Address) (*btcec.PublicKey, error) + func (w *Wallet) PublishTransaction(tx *wire.MsgTx, label string) error + func (w *Wallet) ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error + func (w *Wallet) RenameAccount(scope waddrmgr.KeyScope, account uint32, newName string) error + func (w *Wallet) Rescan(addrs []btcutil.Address, unspent []wtxmgr.Credit) error + func (w *Wallet) ResetLockedOutpoints() + func (w *Wallet) ScriptForOutput(output *wire.TxOut) (waddrmgr.ManagedPubKeyAddress, []byte, []byte, error) + func (w *Wallet) SendOutputs(outputs []*wire.TxOut, keyScope *waddrmgr.KeyScope, account uint32, ...) (*wire.MsgTx, error) + func (w *Wallet) SendOutputsWithInput(outputs []*wire.TxOut, keyScope *waddrmgr.KeyScope, account uint32, ...) (*wire.MsgTx, error) + func (w *Wallet) SetChainSynced(synced bool) + func (w *Wallet) ShuttingDown() bool + func (w *Wallet) SignTransaction(tx *wire.MsgTx, hashType txscript.SigHashType, ...) ([]SignatureError, error) + func (w *Wallet) SortedActivePaymentAddresses() ([]string, error) + func (w *Wallet) Start() + func (w *Wallet) Stop() + func (w *Wallet) SubmitRescan(job *RescanJob) <-chan error + func (w *Wallet) SynchronizeRPC(chainClient chain.Interface) + func (w *Wallet) SynchronizingToNetwork() bool + func (w *Wallet) TotalReceivedForAccounts(scope waddrmgr.KeyScope, minConf int32) ([]AccountTotalReceivedResult, error) + func (w *Wallet) TotalReceivedForAddr(addr btcutil.Address, minConf int32) (btcutil.Amount, error) + func (w *Wallet) Unlock(passphrase []byte, lock <-chan time.Time) error + func (w *Wallet) UnlockOutpoint(op wire.OutPoint) + func (w *Wallet) UnspentOutputs(policy OutputSelectionPolicy) ([]*TransactionOutput, error) + func (w *Wallet) WaitForShutdown()