bitcoin

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitcoinWallet

type BitcoinWallet interface {

	// Start the wallet
	Start()

	// Returns the type of crytocurrency this wallet implements
	CurrencyCode() string

	// Get the master private key
	MasterPrivateKey() *hd.ExtendedKey

	// Get the master public key
	MasterPublicKey() *hd.ExtendedKey

	// Get the current address for the given purpose
	CurrentAddress(purpose spvwallet.KeyPurpose) btc.Address

	// Get the confirmed and unconfirmed balances
	Balance() (confirmed, unconfirmed int64)

	// Get the height of the blockchain
	ChainTip() uint32

	// Send bitcoins to an external wallet
	Spend(amount int64, addr btc.Address, feeLevel spvwallet.FeeLevel) error

	// Return the network parameters
	Params() *chaincfg.Params

	// Add a callback for incoming transactions
	AddTransactionListener(func(spvwallet.TransactionCallback))

	// Generate a multisig script from public keys
	GenerateMultisigScript(keys []hd.ExtendedKey, threshold int) (addr btc.Address, redeemScript []byte, err error)

	// Add a script to the wallet and get notifications back when coins are received or spent from it
	AddWatchedScript(script []byte) error

	// Use this to re-download merkle blocks in case of missed transactions
	ReSyncBlockchain(fromHeight int32)

	// Cleanly disconnect from the wallet
	Close()
}

type ExchangeRates

type ExchangeRates interface {

	// Fetch the exchange rate for the given currency
	// It's OK if this returns from a cache.
	GetExchangeRate(currencyCode string) (float64, error)

	// Update the prices with the current exchange rate before returning.
	GetLatestRate(currencyCode string) (float64, error)

	// Return the number of currency units per coin. For example, in bitcoin
	// this is 100m satoshi per BTC. This is used when converting from fiat
	// to the smaller currency unit.
	UnitsPerCoin() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL