Documentation ¶
Index ¶
- func SignTransaction(keystores *keystore.Keystores, txProposal *maketx.TxProposal, ...) error
- func XPubVersionForScriptType(coin *Coin, scriptType signing.ScriptType) [4]byte
- type Account
- func (account *Account) Balance() (*accounts.Balance, error)
- func (account *Account) CanVerifyAddresses() (bool, bool, error)
- func (account *Account) CanVerifyExtendedPublicKey() []int
- func (account *Account) Close()
- func (account *Account) Code() string
- func (account *Account) Coin() coin.Coin
- func (account *Account) ConvertToLegacyAddress(addressID string) (btcutil.Address, error)
- func (account *Account) FatalError() bool
- func (account *Account) FeeTargets() ([]accounts.FeeTarget, accounts.FeeTargetCode)
- func (account *Account) GetUnusedReceiveAddresses() []accounts.Address
- func (account *Account) Info() *accounts.Info
- func (account *Account) Initialize() error
- func (account *Account) Initialized() bool
- func (account *Account) Keystores() *keystore.Keystores
- func (account *Account) Name() string
- func (account *Account) Notifier() accounts.Notifier
- func (account *Account) Offline() bool
- func (account *Account) RateUpdater() *rates.RateUpdater
- func (account *Account) SendTx(recipientAddress string, amount coin.SendAmount, ...) error
- func (account *Account) SpendableOutputs() []*SpendableOutput
- func (account *Account) String() string
- func (account *Account) Transactions() ([]accounts.Transaction, error)
- func (account *Account) TxProposal(recipientAddress string, amount coin.SendAmount, ...) (coin.Amount, coin.Amount, coin.Amount, error)
- func (account *Account) VerifyAddress(addressID string) (bool, error)
- func (account *Account) VerifyExtendedPublicKey(index int) (bool, error)
- type AddressChain
- type Coin
- func (coin *Coin) BlockExplorerTransactionURLPrefix() string
- func (coin *Coin) Blockchain() blockchain.Interface
- func (coin *Coin) Code() string
- func (coin *Coin) Decimals(isFee bool) uint
- func (coin *Coin) DecodeAddress(address string) (btcutil.Address, error)
- func (coin *Coin) FormatAmount(amount coin.Amount, isFee bool) string
- func (coin *Coin) Headers() *headers.Headers
- func (coin *Coin) Initialize()
- func (coin *Coin) Net() *chaincfg.Params
- func (coin *Coin) SmallestUnit() string
- func (coin *Coin) String() string
- func (coin *Coin) ToUnit(amount coin.Amount, isFee bool) float64
- func (coin *Coin) Unit(bool) string
- type FeeTarget
- type ProposedTransaction
- type SpendableOutput
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignTransaction ¶
func SignTransaction( keystores *keystore.Keystores, txProposal *maketx.TxProposal, previousOutputs map[wire.OutPoint]*transactions.SpendableOutput, getAddress func(blockchain.ScriptHashHex) *addresses.AccountAddress, log *logrus.Entry, ) error
SignTransaction signs all inputs. It assumes all outputs spent belong to this wallet. previousOutputs must contain all outputs which are spent by the transaction.
func XPubVersionForScriptType ¶
func XPubVersionForScriptType(coin *Coin, scriptType signing.ScriptType) [4]byte
XPubVersionForScriptType returns the xpub version bytes for the given coin and script type.
Types ¶
type Account ¶
Account is a account whose addresses are derived from an xpub.
func NewAccount ¶
func NewAccount( coin *Coin, dbFolder string, code string, name string, getSigningConfiguration func() (*signing.Configuration, error), keystores *keystore.Keystores, getNotifier func(*signing.Configuration) accounts.Notifier, onEvent func(accounts.Event), log *logrus.Entry, rateUpdater *rates.RateUpdater, ) *Account
NewAccount creates a new account.
func (*Account) CanVerifyAddresses ¶
CanVerifyAddresses wraps Keystores().CanVerifyAddresses(), see that function for documentation.
func (*Account) CanVerifyExtendedPublicKey ¶
CanVerifyExtendedPublicKey returns the indices of the keystores that support secure verification
func (*Account) ConvertToLegacyAddress ¶
ConvertToLegacyAddress converts a ltc p2sh address to the legacy format (starting with '3'). Returns an error for non litecoin p2sh accounts.
func (*Account) FatalError ¶
FatalError returns true if the account had a fatal error.
func (*Account) FeeTargets ¶
func (account *Account) FeeTargets() ([]accounts.FeeTarget, accounts.FeeTargetCode)
FeeTargets returns the fee targets and the default fee target.
func (*Account) GetUnusedReceiveAddresses ¶
GetUnusedReceiveAddresses returns a number of unused addresses.
func (*Account) Initialize ¶
Initialize initializes the account.
func (*Account) Initialized ¶
Initialized indicates whether the account has loaded and finished the initial sync of the addresses.
func (*Account) RateUpdater ¶
func (account *Account) RateUpdater() *rates.RateUpdater
RateUpdater implements interface
func (*Account) SendTx ¶
func (account *Account) SendTx( recipientAddress string, amount coin.SendAmount, feeTargetCode accounts.FeeTargetCode, selectedUTXOs map[wire.OutPoint]struct{}, _ []byte, ) error
SendTx creates, signs and sends tx which sends `amount` to the recipient.
func (*Account) SpendableOutputs ¶
func (account *Account) SpendableOutputs() []*SpendableOutput
SpendableOutputs returns the utxo set, sorted by the value descending.
func (*Account) Transactions ¶
func (account *Account) Transactions() ([]accounts.Transaction, error)
Transactions wraps transaction.Transactions.Transactions()
func (*Account) TxProposal ¶
func (account *Account) TxProposal( recipientAddress string, amount coin.SendAmount, feeTargetCode accounts.FeeTargetCode, selectedUTXOs map[wire.OutPoint]struct{}, _ []byte, ) ( coin.Amount, coin.Amount, coin.Amount, error)
TxProposal creates a tx from the relevant input and returns information about it for display in the UI (the output amount and the fee). At the same time, it validates the input.
func (*Account) VerifyAddress ¶
VerifyAddress verifies a receive address on a keystore. Returns false, nil if no secure output exists.
func (*Account) VerifyExtendedPublicKey ¶
VerifyExtendedPublicKey verifies an account's public key. Returns false, nil if no secure output exists. index is the position of an xpub in the []*hdkeychain which corresponds to the particular keystore in []Keystore
type AddressChain ¶
type AddressChain interface { GetUnused() []*addresses.AccountAddress EnsureAddresses() []*addresses.AccountAddress LookupByScriptHashHex(blockchain.ScriptHashHex) *addresses.AccountAddress }
AddressChain is the interface for AddressChains
type Coin ¶
type Coin struct { observable.Implementation // contains filtered or unexported fields }
Coin models a Bitcoin-related coin.
func NewCoin ¶
func NewCoin( code string, unit string, net *chaincfg.Params, dbFolder string, servers []*rpc.ServerInfo, blockExplorerTxPrefix string, socksProxy socksproxy.SocksProxy, ) *Coin
NewCoin creates a new coin with the given parameters.
func (*Coin) BlockExplorerTransactionURLPrefix ¶
BlockExplorerTransactionURLPrefix implements coin.Coin.
func (*Coin) Blockchain ¶
func (coin *Coin) Blockchain() blockchain.Interface
Blockchain connects to a blockchain backend.
func (*Coin) DecodeAddress ¶
DecodeAddress decodes a btc/ltc address, checking that that the format matches the account coin type.
func (*Coin) FormatAmount ¶
FormatAmount implements coin.Coin.
func (*Coin) SmallestUnit ¶
SmallestUnit implements coin.Coin.
type FeeTarget ¶
type FeeTarget struct {
// contains filtered or unexported fields
}
FeeTarget contains the fee rate for a specific fee target.
func (*FeeTarget) Code ¶
func (feeTarget *FeeTarget) Code() accounts.FeeTargetCode
Code returns the btc fee target
type ProposedTransaction ¶
type ProposedTransaction struct { TXProposal *maketx.TxProposal PreviousOutputs map[wire.OutPoint]*transactions.SpendableOutput GetAddress func(blockchain.ScriptHashHex) *addresses.AccountAddress // Signatures collects the signatures (signatures[transactionInput][cosignerIndex]). Signatures [][]*btcec.Signature SigHashes *txscript.TxSigHashes }
ProposedTransaction contains all the info needed to sign a btc transaction.
type SpendableOutput ¶
type SpendableOutput struct { *transactions.SpendableOutput OutPoint wire.OutPoint }
SpendableOutput is an unspent coin.
type Status ¶
type Status string
Status indicates the connection and initialization status.
const ( // AccountSynced indicates that the account is synced. AccountSynced Status = "accountSynced" // AccountNotSynced indicates that the account is initialized, but not yet fully synced. AccountNotSynced Status = "accountNotSynced" // AccountDisabled indicates that the account has not yet been initialized. AccountDisabled Status = "accountDisabled" // OfflineMode indicates that the connection to the blockchain network could not be established. OfflineMode Status = "offlineMode" // FatalError indicates that there was a fatal error in handling the account. When this happens, // an error is shown to the user and the account is made unusable. FatalError Status = "fatalError" )