Documentation ¶
Index ¶
- Constants
- Variables
- func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool, ...) int
- func NormalizeCurrencyCode(currencyCode string) string
- func SumOutputSerializeSizes(outputs []*wire.TxOut) (serializeSize int)
- type BitfinexDecoder
- type BittrexDecoder
- type ExchangeRateDecoder
- type ExchangeRateProvider
- type InputType
- type KrakenDecoder
- type LitecoinPriceFetcher
- func (z *LitecoinPriceFetcher) GetAllRates(cacheOK bool) (map[string]float64, error)
- func (z *LitecoinPriceFetcher) GetExchangeRate(currencyCode string) (float64, error)
- func (z *LitecoinPriceFetcher) GetLatestRate(currencyCode string) (float64, error)
- func (z *LitecoinPriceFetcher) UnitsPerCoin() int64
- type LitecoinWallet
- func (w *LitecoinWallet) AddTransactionListener(callback func(wi.TransactionCallback))
- func (w *LitecoinWallet) AddWatchedAddresses(addrs ...btcutil.Address) error
- func (w *LitecoinWallet) AddWatchedScript(script []byte) error
- func (w *LitecoinWallet) AddressToScript(addr btcutil.Address) ([]byte, error)
- func (w *LitecoinWallet) AssociateTransactionWithOrder(cb wi.TransactionCallback)
- func (w *LitecoinWallet) Balance() (wi.CurrencyValue, wi.CurrencyValue)
- func (w *LitecoinWallet) Broadcast(tx *wire.MsgTx) error
- func (w *LitecoinWallet) BumpFee(txid chainhash.Hash) (*chainhash.Hash, error)
- func (w *LitecoinWallet) ChainTip() (uint32, chainhash.Hash)
- func (w *LitecoinWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey bool) (*hd.ExtendedKey, error)
- func (w *LitecoinWallet) Close()
- func (w *LitecoinWallet) CreateMultisigSignature(ins []wi.TransactionInput, outs []wi.TransactionOutput, key *hd.ExtendedKey, ...) ([]wi.Signature, error)
- func (w *LitecoinWallet) CurrencyCode() string
- func (w *LitecoinWallet) CurrentAddress(purpose wi.KeyPurpose) btcutil.Address
- func (w *LitecoinWallet) DecodeAddress(addr string) (btcutil.Address, error)
- func (w *LitecoinWallet) DumpTables(wr io.Writer)
- func (w *LitecoinWallet) EstimateFee(ins []wi.TransactionInput, outs []wi.TransactionOutput, feePerByte big.Int) big.Int
- func (w *LitecoinWallet) EstimateSpendFee(amount big.Int, feeLevel wi.FeeLevel) (big.Int, error)
- func (w *LitecoinWallet) ExchangeRates() wi.ExchangeRates
- func (w *LitecoinWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, ...) (addr btcutil.Address, redeemScript []byte, err error)
- func (w *LitecoinWallet) GetConfirmations(txid chainhash.Hash) (uint32, uint32, error)
- func (w *LitecoinWallet) GetFeePerByte(feeLevel wi.FeeLevel) big.Int
- func (w *LitecoinWallet) GetTransaction(txid chainhash.Hash) (wi.Txn, error)
- func (w *LitecoinWallet) HasKey(addr btcutil.Address) bool
- func (w *LitecoinWallet) IsDust(amount big.Int) bool
- func (w *LitecoinWallet) MasterPrivateKey() *hd.ExtendedKey
- func (w *LitecoinWallet) MasterPublicKey() *hd.ExtendedKey
- func (w *LitecoinWallet) Multisign(ins []wi.TransactionInput, outs []wi.TransactionOutput, sigs1 []wi.Signature, ...) ([]byte, error)
- func (w *LitecoinWallet) NewAddress(purpose wi.KeyPurpose) btcutil.Address
- func (w *LitecoinWallet) Params() *chaincfg.Params
- func (w *LitecoinWallet) ReSyncBlockchain(fromTime time.Time)
- func (w *LitecoinWallet) ScriptToAddress(script []byte) (btcutil.Address, error)
- func (w *LitecoinWallet) Spend(amount big.Int, addr btcutil.Address, feeLevel wi.FeeLevel, referenceID string, ...) (*chainhash.Hash, error)
- func (w *LitecoinWallet) Start()
- func (w *LitecoinWallet) SweepAddress(ins []wi.TransactionInput, address *btcutil.Address, key *hd.ExtendedKey, ...) (*chainhash.Hash, error)
- func (w *LitecoinWallet) Transactions() ([]wi.Txn, error)
- type PoloniexDecoder
Constants ¶
View Source
const ( // RedeemP2PKHSigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a compressed P2PKH output. // It is calculated as: // // - OP_DATA_73 // - 72 bytes DER signature + 1 byte sighash // - OP_DATA_33 // - 33 bytes serialized compressed pubkey RedeemP2PKHSigScriptSize = 1 + 73 + 1 + 33 // RedeemP2SHMultisigSigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a 2 of 3 P2SH multisig output with compressed keys. // It is calculated as: // // - OP_0 // - OP_DATA_72 // - 72 bytes DER signature // - OP_DATA_72 // - 72 bytes DER signature // - OP_PUSHDATA // - OP_2 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP3 // - OP_CHECKMULTISIG RedeemP2SH2of3MultisigSigScriptSize = 1 + 1 + 72 + 1 + 72 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 33 + 1 + 1 // RedeemP2SH1of2MultisigSigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a 1 of 2 P2SH multisig output with compressed keys. // It is calculated as: // // - OP_0 // - OP_DATA_72 // - 72 bytes DER signature // - OP_PUSHDATA // - OP_1 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP2 // - OP_CHECKMULTISIG RedeemP2SH1of2MultisigSigScriptSize = 1 + 1 + 72 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 1 // RedeemP2SHMultisigTimelock1SigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a compressed P2SH timelocked multisig using the timeout. // It is calculated as: // // - OP_DATA_72 // - 72 bytes DER signature // - OP_0 // - OP_PUSHDATA // - OP_IF // - OP_2 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP3 // - OP_CHECKMULTISIG // - OP_ELSE // - OP_PUSHDATA // - 2 byte block height // - OP_CHECKSEQUENCEVERIFY // - OP_DROP // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_CHECKSIG // - OP_ENDIF RedeemP2SHMultisigTimelock1SigScriptSize = 1 + 72 + 1 + 1 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 33 + 1 + 1 + 1 + 1 + 2 + 1 + 1 + 1 + 33 + 1 + 1 // RedeemP2SHMultisigTimelock2SigScriptSize is the worst case (largest) serialize size // of a transaction input script that redeems a compressed P2SH timelocked multisig without using the timeout. // It is calculated as: // // - OP_0 // - OP_DATA_72 // - 72 bytes DER signature // - OP_DATA_72 // - 72 bytes DER signature // - OP_1 // - OP_PUSHDATA // - OP_IF // - OP_2 // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP3 // - OP_CHECKMULTISIG // - OP_ELSE // - OP_PUSHDATA // - 2 byte block height // - OP_CHECKSEQUENCEVERIFY // - OP_DROP // - OP_DATA_33 // - 33 bytes serialized compressed pubkey // - OP_CHECKSIG // - OP_ENDIF RedeemP2SHMultisigTimelock2SigScriptSize = 1 + 1 + 72 + +1 + 72 + 1 + 1 + 1 + 1 + 1 + 33 + 1 + 33 + 1 + 33 + 1 + 1 + 1 + 1 + 2 + 1 + 1 + 1 + 33 + 1 + 1 // P2PKHPkScriptSize is the size of a transaction output script that // pays to a compressed pubkey hash. It is calculated as: // // - OP_DUP // - OP_HASH160 // - OP_DATA_20 // - 20 bytes pubkey hash // - OP_EQUALVERIFY // - OP_CHECKSIG P2PKHPkScriptSize = 1 + 1 + 1 + 20 + 1 + 1 // RedeemP2PKHInputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2PKH output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - signature script // - 4 bytes sequence RedeemP2PKHInputSize = 32 + 4 + 1 + RedeemP2PKHSigScriptSize + 4 // RedeemP2SH2of3MultisigInputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2SH 2 of 3 multisig output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SH2of3MultisigInputSize = 32 + 4 + 1 + 4 + (RedeemP2SH2of3MultisigSigScriptSize / 4) // RedeemP2SH1of2MultisigInputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2SH 2 of 3 multisig output. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SH1of2MultisigInputSize = 32 + 4 + 1 + 4 + (RedeemP2SH1of2MultisigSigScriptSize / 4) // RedeemP2SHMultisigTimelock1InputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed p2sh timelocked multig output with using the timeout. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SHMultisigTimelock1InputSize = 32 + 4 + 1 + 4 + (RedeemP2SHMultisigTimelock1SigScriptSize / 4) // RedeemP2SHMultisigTimelock2InputSize is the worst case (largest) serialize size of a // transaction input redeeming a compressed P2SH timelocked multisig output without using the timeout. It is // calculated as: // // - 32 bytes previous tx // - 4 bytes output index // - 1 byte script len // - 4 bytes sequence /// - witness discounted signature script RedeemP2SHMultisigTimelock2InputSize = 32 + 4 + 1 + 4 + (RedeemP2SHMultisigTimelock2SigScriptSize / 4) // P2PKHOutputSize is the serialize size of a transaction output with a // P2PKH output script. It is calculated as: // // - 8 bytes output value // - 1 byte compact int encoding value 25 // - 25 bytes P2PKH output script P2PKHOutputSize = 8 + 1 + P2PKHPkScriptSize )
Worst case script and input/output size estimates.
Variables ¶
View Source
var (
LitecoinCurrencyDefinition = wi.CurrencyDefinition{
Code: "LTC",
Divisibility: 8,
}
)
Functions ¶
func EstimateSerializeSize ¶
func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool, inputType InputType) int
EstimateSerializeSize returns a worst case serialize size estimate for a signed transaction that spends inputCount number of compressed P2PKH outputs and contains each transaction output from txOuts. The estimated size is incremented for an additional P2PKH change output if addChangeOutput is true.
func NormalizeCurrencyCode ¶
NormalizeCurrencyCode standardizes the format for the given currency code
func SumOutputSerializeSizes ¶
SumOutputSerializeSizes sums up the serialized size of the supplied outputs.
Types ¶
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 LitecoinPriceFetcher ¶
func NewLitecoinPriceFetcher ¶
func NewLitecoinPriceFetcher(dialer proxy.Dialer) *LitecoinPriceFetcher
func (*LitecoinPriceFetcher) GetAllRates ¶
func (z *LitecoinPriceFetcher) GetAllRates(cacheOK bool) (map[string]float64, error)
func (*LitecoinPriceFetcher) GetExchangeRate ¶
func (z *LitecoinPriceFetcher) GetExchangeRate(currencyCode string) (float64, error)
func (*LitecoinPriceFetcher) GetLatestRate ¶
func (z *LitecoinPriceFetcher) GetLatestRate(currencyCode string) (float64, error)
func (*LitecoinPriceFetcher) UnitsPerCoin ¶
func (z *LitecoinPriceFetcher) UnitsPerCoin() int64
type LitecoinWallet ¶
type LitecoinWallet struct {
// contains filtered or unexported fields
}
func NewLitecoinWallet ¶
func (*LitecoinWallet) AddTransactionListener ¶
func (w *LitecoinWallet) AddTransactionListener(callback func(wi.TransactionCallback))
func (*LitecoinWallet) AddWatchedAddresses ¶
func (w *LitecoinWallet) AddWatchedAddresses(addrs ...btcutil.Address) error
func (*LitecoinWallet) AddWatchedScript ¶
func (w *LitecoinWallet) AddWatchedScript(script []byte) error
func (*LitecoinWallet) AddressToScript ¶
func (w *LitecoinWallet) AddressToScript(addr btcutil.Address) ([]byte, error)
func (*LitecoinWallet) AssociateTransactionWithOrder ¶
func (w *LitecoinWallet) AssociateTransactionWithOrder(cb wi.TransactionCallback)
AssociateTransactionWithOrder used for ORDER_PAYMENT message
func (*LitecoinWallet) Balance ¶
func (w *LitecoinWallet) Balance() (wi.CurrencyValue, wi.CurrencyValue)
func (*LitecoinWallet) Broadcast ¶
func (w *LitecoinWallet) Broadcast(tx *wire.MsgTx) error
Build a client.Transaction so we can ingest it into the wallet service then broadcast
func (*LitecoinWallet) ChildKey ¶
func (w *LitecoinWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey bool) (*hd.ExtendedKey, error)
func (*LitecoinWallet) Close ¶
func (w *LitecoinWallet) Close()
func (*LitecoinWallet) CreateMultisigSignature ¶
func (w *LitecoinWallet) CreateMultisigSignature(ins []wi.TransactionInput, outs []wi.TransactionOutput, key *hd.ExtendedKey, redeemScript []byte, feePerByte big.Int) ([]wi.Signature, error)
func (*LitecoinWallet) CurrencyCode ¶
func (w *LitecoinWallet) CurrencyCode() string
func (*LitecoinWallet) CurrentAddress ¶
func (w *LitecoinWallet) CurrentAddress(purpose wi.KeyPurpose) btcutil.Address
func (*LitecoinWallet) DecodeAddress ¶
func (w *LitecoinWallet) DecodeAddress(addr string) (btcutil.Address, error)
func (*LitecoinWallet) DumpTables ¶
func (w *LitecoinWallet) DumpTables(wr io.Writer)
func (*LitecoinWallet) EstimateFee ¶
func (w *LitecoinWallet) EstimateFee(ins []wi.TransactionInput, outs []wi.TransactionOutput, feePerByte big.Int) big.Int
func (*LitecoinWallet) EstimateSpendFee ¶
func (*LitecoinWallet) ExchangeRates ¶
func (w *LitecoinWallet) ExchangeRates() wi.ExchangeRates
func (*LitecoinWallet) GenerateMultisigScript ¶
func (w *LitecoinWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, timeoutKey *hd.ExtendedKey) (addr btcutil.Address, redeemScript []byte, err error)
func (*LitecoinWallet) GetConfirmations ¶
func (*LitecoinWallet) GetFeePerByte ¶
func (w *LitecoinWallet) GetFeePerByte(feeLevel wi.FeeLevel) big.Int
func (*LitecoinWallet) GetTransaction ¶
func (*LitecoinWallet) MasterPrivateKey ¶
func (w *LitecoinWallet) MasterPrivateKey() *hd.ExtendedKey
func (*LitecoinWallet) MasterPublicKey ¶
func (w *LitecoinWallet) MasterPublicKey() *hd.ExtendedKey
func (*LitecoinWallet) Multisign ¶
func (w *LitecoinWallet) Multisign(ins []wi.TransactionInput, outs []wi.TransactionOutput, sigs1 []wi.Signature, sigs2 []wi.Signature, redeemScript []byte, feePerByte big.Int, broadcast bool) ([]byte, error)
func (*LitecoinWallet) NewAddress ¶
func (w *LitecoinWallet) NewAddress(purpose wi.KeyPurpose) btcutil.Address
func (*LitecoinWallet) Params ¶
func (w *LitecoinWallet) Params() *chaincfg.Params
func (*LitecoinWallet) ReSyncBlockchain ¶
func (w *LitecoinWallet) ReSyncBlockchain(fromTime time.Time)
func (*LitecoinWallet) ScriptToAddress ¶
func (w *LitecoinWallet) ScriptToAddress(script []byte) (btcutil.Address, error)
func (*LitecoinWallet) Start ¶
func (w *LitecoinWallet) Start()
func (*LitecoinWallet) SweepAddress ¶
func (w *LitecoinWallet) SweepAddress(ins []wi.TransactionInput, address *btcutil.Address, key *hd.ExtendedKey, redeemScript *[]byte, feeLevel wi.FeeLevel) (*chainhash.Hash, error)
func (*LitecoinWallet) Transactions ¶
func (w *LitecoinWallet) Transactions() ([]wi.Txn, error)
type PoloniexDecoder ¶
type PoloniexDecoder struct{}
Click to show internal directories.
Click to hide internal directories.