Documentation ¶
Index ¶
- Constants
- Variables
- func CheckDecode(input string) (result []byte, version []byte, err error)
- func CheckEncode(input []byte, version []byte) string
- func DecodeAddress(addr string, defaultNet *chaincfg.Params) (btcutil.Address, error)
- func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (btcutil.Address, error)
- func GetCredentials(repoPath string) (username, password string, err error)
- func PayToAddrScript(addr btcutil.Address) ([]byte, error)
- type AddressPubKeyHash
- type AddressScriptHash
- type BitfinexDecoder
- type BittrexDecoder
- type ExchangeRateDecoder
- type ExchangeRateProvider
- type KrakenDecoder
- type NetID
- type OpenBazaarDecoder
- type PoloniexDecoder
- type ZcashPriceFetcher
- type ZcashdWallet
- func (w *ZcashdWallet) AddTransactionListener(callback func(wallet.TransactionCallback))
- func (w *ZcashdWallet) AddWatchedScript(script []byte) error
- func (w *ZcashdWallet) AddressToScript(addr btc.Address) ([]byte, error)
- func (w *ZcashdWallet) Balance() (confirmed, unconfirmed int64)
- func (w *ZcashdWallet) BuildArguments(rescan bool) []string
- func (w *ZcashdWallet) BumpFee(txid chainhash.Hash) (*chainhash.Hash, error)
- func (w *ZcashdWallet) ChainTip() (uint32, chainhash.Hash)
- func (w *ZcashdWallet) Close()
- func (w *ZcashdWallet) CreateMultisigSignature(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, ...) ([]wallet.Signature, error)
- func (w *ZcashdWallet) CurrencyCode() string
- func (w *ZcashdWallet) CurrentAddress(purpose wallet.KeyPurpose) btc.Address
- func (w *ZcashdWallet) DecodeAddress(addr string) (btc.Address, error)
- func (w *ZcashdWallet) EstimateFee(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, ...) uint64
- func (w *ZcashdWallet) EstimateSpendFee(amount int64, feeLevel wallet.FeeLevel) (uint64, error)
- func (w *ZcashdWallet) FindHeightBeforeTime(ts time.Time) (int32, error)
- func (w *ZcashdWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, ...) (addr btc.Address, redeemScript []byte, err error)
- func (w *ZcashdWallet) GetBlockHeight(hash *chainhash.Hash) (int32, error)
- func (w *ZcashdWallet) GetConfirmations(txid chainhash.Hash) (uint32, uint32, error)
- func (w *ZcashdWallet) GetFeePerByte(feeLevel wallet.FeeLevel) uint64
- func (w *ZcashdWallet) GetTransaction(txid chainhash.Hash) (wallet.Txn, error)
- func (w *ZcashdWallet) HasKey(addr btc.Address) bool
- func (w *ZcashdWallet) InitChan() chan struct{}
- func (w *ZcashdWallet) IsDust(amount int64) bool
- func (w *ZcashdWallet) MasterPrivateKey() *hd.ExtendedKey
- func (w *ZcashdWallet) MasterPublicKey() *hd.ExtendedKey
- func (w *ZcashdWallet) Multisign(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, ...) ([]byte, error)
- func (w *ZcashdWallet) NewAddress(purpose wallet.KeyPurpose) btc.Address
- func (w *ZcashdWallet) Params() *chaincfg.Params
- func (w *ZcashdWallet) ReSyncBlockchain(fromDate time.Time)
- func (w *ZcashdWallet) ScriptToAddress(script []byte) (btc.Address, error)
- func (w *ZcashdWallet) Spend(amount int64, addr btc.Address, feeLevel wallet.FeeLevel) (*chainhash.Hash, error)
- func (w *ZcashdWallet) Start()
- func (w *ZcashdWallet) SweepAddress(utxos []wallet.Utxo, address *btc.Address, key *hd.ExtendedKey, ...) (*chainhash.Hash, error)
- func (w *ZcashdWallet) Transactions() ([]wallet.Txn, error)
Constants ¶
const (
Account = "OpenBazaar"
)
Variables ¶
var ( // ErrChecksumMismatch describes an error where decoding failed due // to a bad checksum. ErrChecksumMismatch = errors.New("checksum mismatch") // ErrUnknownAddressType describes an error where an address can not // decoded as a specific address type due to the string encoding // begining with an identifier byte unknown to any standard or // registered (via chaincfg.Register) network. ErrUnknownAddressType = errors.New("unknown address type") // ErrAddressCollision describes an error where an address can not // be uniquely determined as either a pay-to-pubkey-hash or // pay-to-script-hash address since the leading identifier is used for // describing both address kinds, but for different networks. Rather // than assuming or defaulting to one or the other, this error is // returned and the caller must decide how to decode the address. ErrAddressCollision = errors.New("address collision") // ErrInvalidFormat describes an error where decoding failed due to invalid version ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing") NetIDs map[string]NetID )
Functions ¶
func CheckDecode ¶
CheckDecode decodes a string that was encoded with CheckEncode and verifies the checksum.
func CheckEncode ¶
CheckEncode prepends a version byte and appends a four byte checksum.
func DecodeAddress ¶
DecodeAddress decodes the string encoding of an address and returns the Address if addr is a valid encoding for a known address type.
The zcash network the address is associated with is extracted if possible.
func ExtractPkScriptAddrs ¶
ExtractPkScriptAddrs returns the type of script, addresses and required signatures associated with the passed PkScript. Note that it only works for 'standard' transaction script types. Any data such as public keys which are invalid are omitted from the results.
func GetCredentials ¶
Types ¶
type AddressPubKeyHash ¶
type AddressPubKeyHash struct {
// contains filtered or unexported fields
}
AddressPubKeyHash is an Address for a pay-to-pubkey-hash (P2PKH) transaction.
func NewAddressPubKeyHash ¶
func NewAddressPubKeyHash(pkHash []byte, net *chaincfg.Params) (*AddressPubKeyHash, error)
NewAddressPubKeyHash returns a new AddressPubKeyHash. pkHash mustbe 20 bytes.
func (*AddressPubKeyHash) EncodeAddress ¶
func (a *AddressPubKeyHash) EncodeAddress() string
EncodeAddress returns the string encoding of a pay-to-pubkey-hash address. Part of the Address interface.
func (*AddressPubKeyHash) Hash160 ¶
func (a *AddressPubKeyHash) Hash160() *[ripemd160.Size]byte
Hash160 returns the underlying array of the pubkey hash. This can be useful when an array is more appropiate than a slice (for example, when used as map keys).
func (*AddressPubKeyHash) IsForNet ¶
func (a *AddressPubKeyHash) IsForNet(net *chaincfg.Params) bool
IsForNet returns whether or not the pay-to-pubkey-hash address is associated with the passed zcash network.
func (*AddressPubKeyHash) ScriptAddress ¶
func (a *AddressPubKeyHash) ScriptAddress() []byte
ScriptAddress returns the bytes to be included in a txout script to pay to a pubkey hash. Part of the Address interface.
func (*AddressPubKeyHash) String ¶
func (a *AddressPubKeyHash) String() string
String returns a human-readable string for the pay-to-pubkey-hash address. This is equivalent to calling EncodeAddress, but is provided so the type can be used as a fmt.Stringer.
type AddressScriptHash ¶
type AddressScriptHash struct {
// contains filtered or unexported fields
}
AddressScriptHash is an Address for a pay-to-script-hash (P2SH) transaction.
func NewAddressScriptHash ¶
func NewAddressScriptHash(serializedScript []byte, net *chaincfg.Params) (*AddressScriptHash, error)
NewAddressScriptHash returns a new AddressScriptHash.
func NewAddressScriptHashFromHash ¶
func NewAddressScriptHashFromHash(scriptHash []byte, net *chaincfg.Params) (*AddressScriptHash, error)
NewAddressScriptHashFromHash returns a new AddressScriptHash. scriptHash must be 20 bytes.
func (*AddressScriptHash) EncodeAddress ¶
func (a *AddressScriptHash) EncodeAddress() string
EncodeAddress returns the string encoding of a pay-to-script-hash address. Part of the Address interface.
func (*AddressScriptHash) Hash160 ¶
func (a *AddressScriptHash) Hash160() *[ripemd160.Size]byte
Hash160 returns the underlying array of the script hash. This can be useful when an array is more appropiate than a slice (for example, when used as map keys).
func (*AddressScriptHash) IsForNet ¶
func (a *AddressScriptHash) IsForNet(net *chaincfg.Params) bool
IsForNet returns whether or not the pay-to-script-hash address is associated with the passed zcash network.
func (*AddressScriptHash) ScriptAddress ¶
func (a *AddressScriptHash) ScriptAddress() []byte
ScriptAddress returns the bytes to be included in a txout script to pay to a script hash. Part of the Address interface.
func (*AddressScriptHash) String ¶
func (a *AddressScriptHash) String() string
String returns a human-readable string for the pay-to-script-hash address. This is equivalent to calling EncodeAddress, but is provided so the type can be used as a fmt.Stringer.
type BitfinexDecoder ¶
type BitfinexDecoder struct{}
type BittrexDecoder ¶
type BittrexDecoder struct{}
type ExchangeRateDecoder ¶
type ExchangeRateDecoder interface {
// contains filtered or unexported methods
}
type ExchangeRateProvider ¶
type ExchangeRateProvider struct {
// contains filtered or unexported fields
}
type KrakenDecoder ¶
type KrakenDecoder struct{}
type OpenBazaarDecoder ¶
type OpenBazaarDecoder struct{}
type PoloniexDecoder ¶
type PoloniexDecoder struct{}
type ZcashPriceFetcher ¶
func NewZcashPriceFetcher ¶
func NewZcashPriceFetcher(dialer proxy.Dialer) *ZcashPriceFetcher
func (*ZcashPriceFetcher) GetAllRates ¶
func (z *ZcashPriceFetcher) GetAllRates(cacheOK bool) (map[string]float64, error)
func (*ZcashPriceFetcher) GetExchangeRate ¶
func (z *ZcashPriceFetcher) GetExchangeRate(currencyCode string) (float64, error)
func (*ZcashPriceFetcher) GetLatestRate ¶
func (z *ZcashPriceFetcher) GetLatestRate(currencyCode string) (float64, error)
func (*ZcashPriceFetcher) UnitsPerCoin ¶
func (z *ZcashPriceFetcher) UnitsPerCoin() int
type ZcashdWallet ¶
type ZcashdWallet struct {
// contains filtered or unexported fields
}
func NewZcashdWallet ¶
func (*ZcashdWallet) AddTransactionListener ¶
func (w *ZcashdWallet) AddTransactionListener(callback func(wallet.TransactionCallback))
func (*ZcashdWallet) AddWatchedScript ¶
func (w *ZcashdWallet) AddWatchedScript(script []byte) error
func (*ZcashdWallet) AddressToScript ¶
func (w *ZcashdWallet) AddressToScript(addr btc.Address) ([]byte, error)
func (*ZcashdWallet) Balance ¶
func (w *ZcashdWallet) Balance() (confirmed, unconfirmed int64)
func (*ZcashdWallet) BuildArguments ¶
func (w *ZcashdWallet) BuildArguments(rescan bool) []string
func (*ZcashdWallet) Close ¶
func (w *ZcashdWallet) Close()
func (*ZcashdWallet) CreateMultisigSignature ¶
func (w *ZcashdWallet) CreateMultisigSignature(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, key *hd.ExtendedKey, redeemScript []byte, feePerByte uint64) ([]wallet.Signature, error)
func (*ZcashdWallet) CurrencyCode ¶
func (w *ZcashdWallet) CurrencyCode() string
func (*ZcashdWallet) CurrentAddress ¶
func (w *ZcashdWallet) CurrentAddress(purpose wallet.KeyPurpose) btc.Address
func (*ZcashdWallet) DecodeAddress ¶
func (w *ZcashdWallet) DecodeAddress(addr string) (btc.Address, error)
func (*ZcashdWallet) EstimateFee ¶
func (w *ZcashdWallet) EstimateFee(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, feePerByte uint64) uint64
func (*ZcashdWallet) EstimateSpendFee ¶
func (w *ZcashdWallet) EstimateSpendFee(amount int64, feeLevel wallet.FeeLevel) (uint64, error)
func (*ZcashdWallet) FindHeightBeforeTime ¶
func (w *ZcashdWallet) FindHeightBeforeTime(ts time.Time) (int32, error)
func (*ZcashdWallet) GenerateMultisigScript ¶
func (w *ZcashdWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, timeoutKey *hd.ExtendedKey) (addr btc.Address, redeemScript []byte, err error)
func (*ZcashdWallet) GetBlockHeight ¶
func (w *ZcashdWallet) GetBlockHeight(hash *chainhash.Hash) (int32, error)
func (*ZcashdWallet) GetConfirmations ¶
func (*ZcashdWallet) GetFeePerByte ¶
func (w *ZcashdWallet) GetFeePerByte(feeLevel wallet.FeeLevel) uint64
func (*ZcashdWallet) GetTransaction ¶
func (w *ZcashdWallet) GetTransaction(txid chainhash.Hash) (wallet.Txn, error)
func (*ZcashdWallet) InitChan ¶
func (w *ZcashdWallet) InitChan() chan struct{}
func (*ZcashdWallet) IsDust ¶
func (w *ZcashdWallet) IsDust(amount int64) bool
func (*ZcashdWallet) MasterPrivateKey ¶
func (w *ZcashdWallet) MasterPrivateKey() *hd.ExtendedKey
func (*ZcashdWallet) MasterPublicKey ¶
func (w *ZcashdWallet) MasterPublicKey() *hd.ExtendedKey
func (*ZcashdWallet) NewAddress ¶
func (w *ZcashdWallet) NewAddress(purpose wallet.KeyPurpose) btc.Address
func (*ZcashdWallet) Params ¶
func (w *ZcashdWallet) Params() *chaincfg.Params
func (*ZcashdWallet) ReSyncBlockchain ¶
func (w *ZcashdWallet) ReSyncBlockchain(fromDate time.Time)
func (*ZcashdWallet) ScriptToAddress ¶
func (w *ZcashdWallet) ScriptToAddress(script []byte) (btc.Address, error)
func (*ZcashdWallet) Start ¶
func (w *ZcashdWallet) Start()
func (*ZcashdWallet) SweepAddress ¶
func (w *ZcashdWallet) SweepAddress(utxos []wallet.Utxo, address *btc.Address, key *hd.ExtendedKey, redeemScript *[]byte, feeLevel wallet.FeeLevel) (*chainhash.Hash, error)
func (*ZcashdWallet) Transactions ¶
func (w *ZcashdWallet) Transactions() ([]wallet.Txn, error)