Update btcwire path import paths to new location.

This commit is contained in:
Dave Collins 2015-02-05 15:50:03 -06:00
parent 20ff0689d8
commit ed821410cb
6 changed files with 107 additions and 107 deletions

View file

@ -9,9 +9,9 @@ import (
"encoding/hex"
"encoding/json"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcjson"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire"
)
// FutureGetBestBlockHashResult is a future promise to deliver the result of a
@ -20,7 +20,7 @@ type FutureGetBestBlockHashResult chan *response
// Receive waits for the response promised by the future and returns the hash of
// the best block in the longest block chain.
func (r FutureGetBestBlockHashResult) Receive() (*btcwire.ShaHash, error) {
func (r FutureGetBestBlockHashResult) Receive() (*wire.ShaHash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -32,7 +32,7 @@ func (r FutureGetBestBlockHashResult) Receive() (*btcwire.ShaHash, error) {
if err != nil {
return nil, err
}
return btcwire.NewShaHashFromStr(txHashStr)
return wire.NewShaHashFromStr(txHashStr)
}
// GetBestBlockHashAsync returns an instance of a type that can be used to get
@ -52,7 +52,7 @@ func (c *Client) GetBestBlockHashAsync() FutureGetBestBlockHashResult {
// GetBestBlockHash returns the hash of the best block in the longest block
// chain.
func (c *Client) GetBestBlockHash() (*btcwire.ShaHash, error) {
func (c *Client) GetBestBlockHash() (*wire.ShaHash, error) {
return c.GetBestBlockHashAsync().Receive()
}
@ -82,7 +82,7 @@ func (r FutureGetBlockResult) Receive() (*btcutil.Block, error) {
}
// Deserialize the block and return it.
var msgBlock btcwire.MsgBlock
var msgBlock wire.MsgBlock
err = msgBlock.Deserialize(bytes.NewReader(serializedBlock))
if err != nil {
return nil, err
@ -95,7 +95,7 @@ func (r FutureGetBlockResult) Receive() (*btcutil.Block, error) {
// returned instance.
//
// See GetBlock for the blocking version and more details.
func (c *Client) GetBlockAsync(blockHash *btcwire.ShaHash) FutureGetBlockResult {
func (c *Client) GetBlockAsync(blockHash *wire.ShaHash) FutureGetBlockResult {
hash := ""
if blockHash != nil {
hash = blockHash.String()
@ -114,7 +114,7 @@ func (c *Client) GetBlockAsync(blockHash *btcwire.ShaHash) FutureGetBlockResult
//
// See GetBlockVerbose to retrieve a data structure with information about the
// block instead.
func (c *Client) GetBlock(blockHash *btcwire.ShaHash) (*btcutil.Block, error) {
func (c *Client) GetBlock(blockHash *wire.ShaHash) (*btcutil.Block, error) {
return c.GetBlockAsync(blockHash).Receive()
}
@ -144,7 +144,7 @@ func (r FutureGetBlockVerboseResult) Receive() (*btcjson.BlockResult, error) {
// the returned instance.
//
// See GetBlockVerbose for the blocking version and more details.
func (c *Client) GetBlockVerboseAsync(blockHash *btcwire.ShaHash, verboseTx bool) FutureGetBlockVerboseResult {
func (c *Client) GetBlockVerboseAsync(blockHash *wire.ShaHash, verboseTx bool) FutureGetBlockVerboseResult {
hash := ""
if blockHash != nil {
hash = blockHash.String()
@ -163,7 +163,7 @@ func (c *Client) GetBlockVerboseAsync(blockHash *btcwire.ShaHash, verboseTx bool
// about a block given its hash.
//
// See GetBlock to retrieve a raw block instead.
func (c *Client) GetBlockVerbose(blockHash *btcwire.ShaHash, verboseTx bool) (*btcjson.BlockResult, error) {
func (c *Client) GetBlockVerbose(blockHash *wire.ShaHash, verboseTx bool) (*btcjson.BlockResult, error) {
return c.GetBlockVerboseAsync(blockHash, verboseTx).Receive()
}
@ -256,7 +256,7 @@ type FutureGetBlockHashResult chan *response
// Receive waits for the response promised by the future and returns the hash of
// the block in the best block chain at the given height.
func (r FutureGetBlockHashResult) Receive() (*btcwire.ShaHash, error) {
func (r FutureGetBlockHashResult) Receive() (*wire.ShaHash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -268,7 +268,7 @@ func (r FutureGetBlockHashResult) Receive() (*btcwire.ShaHash, error) {
if err != nil {
return nil, err
}
return btcwire.NewShaHashFromStr(txHashStr)
return wire.NewShaHashFromStr(txHashStr)
}
// GetBlockHashAsync returns an instance of a type that can be used to get the
@ -288,7 +288,7 @@ func (c *Client) GetBlockHashAsync(blockHeight int64) FutureGetBlockHashResult {
// GetBlockHash returns the hash of the block in the best block chain at the
// given height.
func (c *Client) GetBlockHash(blockHeight int64) (*btcwire.ShaHash, error) {
func (c *Client) GetBlockHash(blockHeight int64) (*wire.ShaHash, error) {
return c.GetBlockHashAsync(blockHeight).Receive()
}
@ -298,7 +298,7 @@ type FutureGetRawMempoolResult chan *response
// Receive waits for the response promised by the future and returns the hashes
// of all transactions in the memory pool.
func (r FutureGetRawMempoolResult) Receive() ([]*btcwire.ShaHash, error) {
func (r FutureGetRawMempoolResult) Receive() ([]*wire.ShaHash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -312,9 +312,9 @@ func (r FutureGetRawMempoolResult) Receive() ([]*btcwire.ShaHash, error) {
}
// Create a slice of ShaHash arrays from the string slice.
txHashes := make([]*btcwire.ShaHash, 0, len(txHashStrs))
txHashes := make([]*wire.ShaHash, 0, len(txHashStrs))
for _, hashStr := range txHashStrs {
txHash, err := btcwire.NewShaHashFromStr(hashStr)
txHash, err := wire.NewShaHashFromStr(hashStr)
if err != nil {
return nil, err
}
@ -343,7 +343,7 @@ func (c *Client) GetRawMempoolAsync() FutureGetRawMempoolResult {
//
// See GetRawMempoolVerbose to retrieve data structures with information about
// the transactions instead.
func (c *Client) GetRawMempool() ([]*btcwire.ShaHash, error) {
func (c *Client) GetRawMempool() ([]*wire.ShaHash, error) {
return c.GetRawMempoolAsync().Receive()
}
@ -531,7 +531,7 @@ func (r FutureGetTxOutResult) Receive() (*btcjson.GetTxOutResult, error) {
// the returned instance.
//
// See GetTxOut for the blocking version and more details.
func (c *Client) GetTxOutAsync(txHash *btcwire.ShaHash, index int, mempool bool) FutureGetTxOutResult {
func (c *Client) GetTxOutAsync(txHash *wire.ShaHash, index int, mempool bool) FutureGetTxOutResult {
hash := ""
if txHash != nil {
hash = txHash.String()
@ -547,6 +547,6 @@ func (c *Client) GetTxOutAsync(txHash *btcwire.ShaHash, index int, mempool bool)
// GetTxOut returns the transaction output info if it's unspent and
// nil, otherwise.
func (c *Client) GetTxOut(txHash *btcwire.ShaHash, index int, mempool bool) (*btcjson.GetTxOutResult, error) {
func (c *Client) GetTxOut(txHash *wire.ShaHash, index int, mempool bool) (*btcjson.GetTxOutResult, error) {
return c.GetTxOutAsync(txHash, index, mempool).Receive()
}

View file

@ -10,9 +10,9 @@ import (
"path/filepath"
"time"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcrpcclient"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire"
)
func main() {
@ -21,10 +21,10 @@ func main() {
// for notifications. See the documentation of the btcrpcclient
// NotificationHandlers type for more details about each handler.
ntfnHandlers := btcrpcclient.NotificationHandlers{
OnBlockConnected: func(hash *btcwire.ShaHash, height int32) {
OnBlockConnected: func(hash *wire.ShaHash, height int32) {
log.Printf("Block connected: %v (%d)", hash, height)
},
OnBlockDisconnected: func(hash *btcwire.ShaHash, height int32) {
OnBlockDisconnected: func(hash *wire.ShaHash, height int32) {
log.Printf("Block disconnected: %v (%d)", hash, height)
},
}

View file

@ -9,9 +9,9 @@ import (
"encoding/json"
"fmt"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcjson"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire"
"github.com/btcsuite/btcws"
)
@ -160,7 +160,7 @@ type FutureGetBestBlockResult chan *response
// Receive waits for the response promised by the future and returns the hash
// and height of the block in the longest (best) chain.
func (r FutureGetBestBlockResult) Receive() (*btcwire.ShaHash, int32, error) {
func (r FutureGetBestBlockResult) Receive() (*wire.ShaHash, int32, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, 0, err
@ -174,7 +174,7 @@ func (r FutureGetBestBlockResult) Receive() (*btcwire.ShaHash, int32, error) {
}
// Convert hash string.
hash, err := btcwire.NewShaHashFromStr(bestBlock.Hash)
hash, err := wire.NewShaHashFromStr(bestBlock.Hash)
if err != nil {
return nil, 0, err
}
@ -200,7 +200,7 @@ func (c *Client) GetBestBlockAsync() FutureGetBestBlockResult {
// chain.
//
// NOTE: This is a btcd extension.
func (c *Client) GetBestBlock() (*btcwire.ShaHash, int32, error) {
func (c *Client) GetBestBlock() (*wire.ShaHash, int32, error) {
return c.GetBestBlockAsync().Receive()
}
@ -210,7 +210,7 @@ type FutureGetCurrentNetResult chan *response
// Receive waits for the response promised by the future and returns the network
// the server is running on.
func (r FutureGetCurrentNetResult) Receive() (btcwire.BitcoinNet, error) {
func (r FutureGetCurrentNetResult) Receive() (wire.BitcoinNet, error) {
res, err := receiveFuture(r)
if err != nil {
return 0, err
@ -223,7 +223,7 @@ func (r FutureGetCurrentNetResult) Receive() (btcwire.BitcoinNet, error) {
return 0, err
}
return btcwire.BitcoinNet(net), nil
return wire.BitcoinNet(net), nil
}
// GetCurrentNetAsync returns an instance of a type that can be used to get the
@ -243,7 +243,7 @@ func (c *Client) GetCurrentNetAsync() FutureGetCurrentNetResult {
// GetCurrentNet returns the network the server is running on.
//
// NOTE: This is a btcd extension.
func (c *Client) GetCurrentNet() (btcwire.BitcoinNet, error) {
func (c *Client) GetCurrentNet() (wire.BitcoinNet, error) {
return c.GetCurrentNetAsync().Receive()
}

View file

@ -13,9 +13,9 @@ import (
"sync"
"time"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcjson"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire"
"github.com/btcsuite/btcws"
)
@ -97,13 +97,13 @@ type NotificationHandlers struct {
// (best) chain. It will only be invoked if a preceding call to
// NotifyBlocks has been made to register for the notification and the
// function is non-nil.
OnBlockConnected func(hash *btcwire.ShaHash, height int32)
OnBlockConnected func(hash *wire.ShaHash, height int32)
// OnBlockDisconnected is invoked when a block is disconnected from the
// longest (best) chain. It will only be invoked if a preceding call to
// NotifyBlocks has been made to register for the notification and the
// function is non-nil.
OnBlockDisconnected func(hash *btcwire.ShaHash, height int32)
OnBlockDisconnected func(hash *wire.ShaHash, height int32)
// OnRecvTx is invoked when a transaction that receives funds to a
// registered address is received into the memory pool and also
@ -129,18 +129,18 @@ type NotificationHandlers struct {
// signaled on this notification, rather than relying on the return
// result of a rescan request, due to how btcd may send various rescan
// notifications after the rescan request has already returned.
OnRescanFinished func(hash *btcwire.ShaHash, height int32, blkTime time.Time)
OnRescanFinished func(hash *wire.ShaHash, height int32, blkTime time.Time)
// OnRescanProgress is invoked periodically when a rescan is underway.
// It will only be invoked if a preceding call to Rescan or
// RescanEndHeight has been made and the function is non-nil.
OnRescanProgress func(hash *btcwire.ShaHash, height int32, blkTime time.Time)
OnRescanProgress func(hash *wire.ShaHash, height int32, blkTime time.Time)
// OnTxAccepted is invoked when a transaction is accepted into the
// memory pool. It will only be invoked if a preceding call to
// NotifyNewTransactions with the verbose flag set to false has been
// made to register for the notification and the function is non-nil.
OnTxAccepted func(hash *btcwire.ShaHash, amount btcutil.Amount)
OnTxAccepted func(hash *wire.ShaHash, amount btcutil.Amount)
// OnTxAccepted is invoked when a transaction is accepted into the
// memory pool. It will only be invoked if a preceding call to
@ -399,7 +399,7 @@ func (e wrongNumParams) Error() string {
// parseChainNtfnParams parses out the block hash and height from the parameters
// of blockconnected and blockdisconnected notifications.
func parseChainNtfnParams(params []json.RawMessage) (*btcwire.ShaHash,
func parseChainNtfnParams(params []json.RawMessage) (*wire.ShaHash,
int32, error) {
if len(params) != 2 {
@ -421,7 +421,7 @@ func parseChainNtfnParams(params []json.RawMessage) (*btcwire.ShaHash,
}
// Create ShaHash from block sha string.
blockSha, err := btcwire.NewShaHashFromStr(blockShaStr)
blockSha, err := wire.NewShaHashFromStr(blockShaStr)
if err != nil {
return nil, 0, err
}
@ -461,7 +461,7 @@ func parseChainTxNtfnParams(params []json.RawMessage) (*btcutil.Tx,
if err != nil {
return nil, nil, err
}
var msgTx btcwire.MsgTx
var msgTx wire.MsgTx
err = msgTx.Deserialize(bytes.NewReader(serializedTx))
if err != nil {
return nil, nil, err
@ -469,13 +469,13 @@ func parseChainTxNtfnParams(params []json.RawMessage) (*btcutil.Tx,
// TODO: Change recvtx and redeemingtx callback signatures to use
// nicer types for details about the block (block sha as a
// btcwire.ShaHash, block time as a time.Time, etc.).
// wire.ShaHash, block time as a time.Time, etc.).
return btcutil.NewTx(&msgTx), block, nil
}
// parseRescanProgressParams parses out the height of the last rescanned block
// from the parameters of rescanfinished and rescanprogress notifications.
func parseRescanProgressParams(params []json.RawMessage) (*btcwire.ShaHash, int32, time.Time, error) {
func parseRescanProgressParams(params []json.RawMessage) (*wire.ShaHash, int32, time.Time, error) {
if len(params) != 3 {
return nil, 0, time.Time{}, wrongNumParams(len(params))
}
@ -502,7 +502,7 @@ func parseRescanProgressParams(params []json.RawMessage) (*btcwire.ShaHash, int3
}
// Decode string encoding of block hash.
hash, err := btcwire.NewShaHashFromStr(hashStr)
hash, err := wire.NewShaHashFromStr(hashStr)
if err != nil {
return nil, 0, time.Time{}, err
}
@ -512,7 +512,7 @@ func parseRescanProgressParams(params []json.RawMessage) (*btcwire.ShaHash, int3
// parseTxAcceptedNtfnParams parses out the transaction hash and total amount
// from the parameters of a txaccepted notification.
func parseTxAcceptedNtfnParams(params []json.RawMessage) (*btcwire.ShaHash,
func parseTxAcceptedNtfnParams(params []json.RawMessage) (*wire.ShaHash,
btcutil.Amount, error) {
if len(params) != 2 {
@ -534,7 +534,7 @@ func parseTxAcceptedNtfnParams(params []json.RawMessage) (*btcwire.ShaHash,
}
// Decode string encoding of transaction sha.
txSha, err := btcwire.NewShaHashFromStr(txShaStr)
txSha, err := wire.NewShaHashFromStr(txShaStr)
if err != nil {
return nil, 0, err
}
@ -740,7 +740,7 @@ func (c *Client) notifySpentInternal(outpoints []btcws.OutPoint) FutureNotifySpe
// See NotifySpent for the blocking version and more details.
//
// NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) NotifySpentAsync(outpoints []*btcwire.OutPoint) FutureNotifySpentResult {
func (c *Client) NotifySpentAsync(outpoints []*wire.OutPoint) FutureNotifySpentResult {
// Not supported in HTTP POST mode.
if c.config.HttpPostMode {
return newFutureError(ErrNotificationsNotSupported)
@ -772,7 +772,7 @@ func (c *Client) NotifySpentAsync(outpoints []*btcwire.OutPoint) FutureNotifySpe
// OnRedeemingTx.
//
// NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) NotifySpent(outpoints []*btcwire.OutPoint) error {
func (c *Client) NotifySpent(outpoints []*wire.OutPoint) error {
return c.NotifySpentAsync(outpoints).Receive()
}
@ -950,9 +950,9 @@ func (r FutureRescanResult) Receive() error {
// reconnect.
//
// NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) RescanAsync(startBlock *btcwire.ShaHash,
func (c *Client) RescanAsync(startBlock *wire.ShaHash,
addresses []btcutil.Address,
outpoints []*btcwire.OutPoint) FutureRescanResult {
outpoints []*wire.OutPoint) FutureRescanResult {
// Not supported in HTTP POST mode.
if c.config.HttpPostMode {
@ -1018,9 +1018,9 @@ func (c *Client) RescanAsync(startBlock *btcwire.ShaHash,
// reconnect.
//
// NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) Rescan(startBlock *btcwire.ShaHash,
func (c *Client) Rescan(startBlock *wire.ShaHash,
addresses []btcutil.Address,
outpoints []*btcwire.OutPoint) error {
outpoints []*wire.OutPoint) error {
return c.RescanAsync(startBlock, addresses, outpoints).Receive()
}
@ -1032,9 +1032,9 @@ func (c *Client) Rescan(startBlock *btcwire.ShaHash,
// See RescanEndBlock for the blocking version and more details.
//
// NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) RescanEndBlockAsync(startBlock *btcwire.ShaHash,
addresses []btcutil.Address, outpoints []*btcwire.OutPoint,
endBlock *btcwire.ShaHash) FutureRescanResult {
func (c *Client) RescanEndBlockAsync(startBlock *wire.ShaHash,
addresses []btcutil.Address, outpoints []*wire.OutPoint,
endBlock *wire.ShaHash) FutureRescanResult {
// Not supported in HTTP POST mode.
if c.config.HttpPostMode {
@ -1097,9 +1097,9 @@ func (c *Client) RescanEndBlockAsync(startBlock *btcwire.ShaHash,
// See Rescan to also perform a rescan through current end of the longest chain.
//
// NOTE: This is a btcd extension and requires a websocket connection.
func (c *Client) RescanEndHeight(startBlock *btcwire.ShaHash,
addresses []btcutil.Address, outpoints []*btcwire.OutPoint,
endBlock *btcwire.ShaHash) error {
func (c *Client) RescanEndHeight(startBlock *wire.ShaHash,
addresses []btcutil.Address, outpoints []*wire.OutPoint,
endBlock *wire.ShaHash) error {
return c.RescanEndBlockAsync(startBlock, addresses, outpoints,
endBlock).Receive()

View file

@ -9,9 +9,9 @@ import (
"encoding/hex"
"encoding/json"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcjson"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire"
)
// SigHashType enumerates the available signature hashing types that the
@ -83,7 +83,7 @@ func (r FutureGetRawTransactionResult) Receive() (*btcutil.Tx, error) {
}
// Deserialize the transaction and return it.
var msgTx btcwire.MsgTx
var msgTx wire.MsgTx
if err := msgTx.Deserialize(bytes.NewReader(serializedTx)); err != nil {
return nil, err
}
@ -95,7 +95,7 @@ func (r FutureGetRawTransactionResult) Receive() (*btcutil.Tx, error) {
// the returned instance.
//
// See GetRawTransaction for the blocking version and more details.
func (c *Client) GetRawTransactionAsync(txHash *btcwire.ShaHash) FutureGetRawTransactionResult {
func (c *Client) GetRawTransactionAsync(txHash *wire.ShaHash) FutureGetRawTransactionResult {
hash := ""
if txHash != nil {
hash = txHash.String()
@ -114,7 +114,7 @@ func (c *Client) GetRawTransactionAsync(txHash *btcwire.ShaHash) FutureGetRawTra
//
// See GetRawTransactionVerbose to obtain additional information about the
// transaction.
func (c *Client) GetRawTransaction(txHash *btcwire.ShaHash) (*btcutil.Tx, error) {
func (c *Client) GetRawTransaction(txHash *wire.ShaHash) (*btcutil.Tx, error) {
return c.GetRawTransactionAsync(txHash).Receive()
}
@ -146,7 +146,7 @@ func (r FutureGetRawTransactionVerboseResult) Receive() (*btcjson.TxRawResult, e
// function on the returned instance.
//
// See GetRawTransactionVerbose for the blocking version and more details.
func (c *Client) GetRawTransactionVerboseAsync(txHash *btcwire.ShaHash) FutureGetRawTransactionVerboseResult {
func (c *Client) GetRawTransactionVerboseAsync(txHash *wire.ShaHash) FutureGetRawTransactionVerboseResult {
hash := ""
if txHash != nil {
hash = txHash.String()
@ -165,7 +165,7 @@ func (c *Client) GetRawTransactionVerboseAsync(txHash *btcwire.ShaHash) FutureGe
// its hash.
//
// See GetRawTransaction to obtain only the transaction already deserialized.
func (c *Client) GetRawTransactionVerbose(txHash *btcwire.ShaHash) (*btcjson.TxRawResult, error) {
func (c *Client) GetRawTransactionVerbose(txHash *wire.ShaHash) (*btcjson.TxRawResult, error) {
return c.GetRawTransactionVerboseAsync(txHash).Receive()
}
@ -220,7 +220,7 @@ type FutureCreateRawTransactionResult chan *response
// Receive waits for the response promised by the future and returns a new
// transaction spending the provided inputs and sending to the provided
// addresses.
func (r FutureCreateRawTransactionResult) Receive() (*btcwire.MsgTx, error) {
func (r FutureCreateRawTransactionResult) Receive() (*wire.MsgTx, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -240,7 +240,7 @@ func (r FutureCreateRawTransactionResult) Receive() (*btcwire.MsgTx, error) {
}
// Deserialize the transaction and return it.
var msgTx btcwire.MsgTx
var msgTx wire.MsgTx
if err := msgTx.Deserialize(bytes.NewReader(serializedTx)); err != nil {
return nil, err
}
@ -271,7 +271,7 @@ func (c *Client) CreateRawTransactionAsync(inputs []btcjson.TransactionInput,
// CreateRawTransaction returns a new transaction spending the provided inputs
// and sending to the provided addresses.
func (c *Client) CreateRawTransaction(inputs []btcjson.TransactionInput,
amounts map[btcutil.Address]btcutil.Amount) (*btcwire.MsgTx, error) {
amounts map[btcutil.Address]btcutil.Amount) (*wire.MsgTx, error) {
return c.CreateRawTransactionAsync(inputs, amounts).Receive()
}
@ -283,7 +283,7 @@ type FutureSendRawTransactionResult chan *response
// Receive waits for the response promised by the future and returns the result
// of submitting the encoded transaction to the server which then relays it to
// the network.
func (r FutureSendRawTransactionResult) Receive() (*btcwire.ShaHash, error) {
func (r FutureSendRawTransactionResult) Receive() (*wire.ShaHash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -296,7 +296,7 @@ func (r FutureSendRawTransactionResult) Receive() (*btcwire.ShaHash, error) {
return nil, err
}
return btcwire.NewShaHashFromStr(txHashStr)
return wire.NewShaHashFromStr(txHashStr)
}
// SendRawTransactionAsync returns an instance of a type that can be used to get
@ -304,7 +304,7 @@ func (r FutureSendRawTransactionResult) Receive() (*btcwire.ShaHash, error) {
// the returned instance.
//
// See SendRawTransaction for the blocking version and more details.
func (c *Client) SendRawTransactionAsync(tx *btcwire.MsgTx, allowHighFees bool) FutureSendRawTransactionResult {
func (c *Client) SendRawTransactionAsync(tx *wire.MsgTx, allowHighFees bool) FutureSendRawTransactionResult {
txHex := ""
if tx != nil {
// Serialize the transaction and convert to hex string.
@ -326,7 +326,7 @@ func (c *Client) SendRawTransactionAsync(tx *btcwire.MsgTx, allowHighFees bool)
// SendRawTransaction submits the encoded transaction to the server which will
// then relay it to the network.
func (c *Client) SendRawTransaction(tx *btcwire.MsgTx, allowHighFees bool) (*btcwire.ShaHash, error) {
func (c *Client) SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (*wire.ShaHash, error) {
return c.SendRawTransactionAsync(tx, allowHighFees).Receive()
}
@ -337,7 +337,7 @@ type FutureSignRawTransactionResult chan *response
// Receive waits for the response promised by the future and returns the
// signed transaction as well as whether or not all inputs are now signed.
func (r FutureSignRawTransactionResult) Receive() (*btcwire.MsgTx, bool, error) {
func (r FutureSignRawTransactionResult) Receive() (*wire.MsgTx, bool, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, false, err
@ -357,7 +357,7 @@ func (r FutureSignRawTransactionResult) Receive() (*btcwire.MsgTx, bool, error)
}
// Deserialize the transaction and return it.
var msgTx btcwire.MsgTx
var msgTx wire.MsgTx
if err := msgTx.Deserialize(bytes.NewReader(serializedTx)); err != nil {
return nil, false, err
}
@ -370,7 +370,7 @@ func (r FutureSignRawTransactionResult) Receive() (*btcwire.MsgTx, bool, error)
// the returned instance.
//
// See SignRawTransaction for the blocking version and more details.
func (c *Client) SignRawTransactionAsync(tx *btcwire.MsgTx) FutureSignRawTransactionResult {
func (c *Client) SignRawTransactionAsync(tx *wire.MsgTx) FutureSignRawTransactionResult {
txHex := ""
if tx != nil {
// Serialize the transaction and convert to hex string.
@ -397,7 +397,7 @@ func (c *Client) SignRawTransactionAsync(tx *btcwire.MsgTx) FutureSignRawTransac
// private keys for the passed transaction which needs to be signed and uses the
// default signature hash type. Use one of the SignRawTransaction# variants to
// specify that information if needed.
func (c *Client) SignRawTransaction(tx *btcwire.MsgTx) (*btcwire.MsgTx, bool, error) {
func (c *Client) SignRawTransaction(tx *wire.MsgTx) (*wire.MsgTx, bool, error) {
return c.SignRawTransactionAsync(tx).Receive()
}
@ -406,7 +406,7 @@ func (c *Client) SignRawTransaction(tx *btcwire.MsgTx) (*btcwire.MsgTx, bool, er
// function on the returned instance.
//
// See SignRawTransaction2 for the blocking version and more details.
func (c *Client) SignRawTransaction2Async(tx *btcwire.MsgTx, inputs []btcjson.RawTxInput) FutureSignRawTransactionResult {
func (c *Client) SignRawTransaction2Async(tx *wire.MsgTx, inputs []btcjson.RawTxInput) FutureSignRawTransactionResult {
txHex := ""
if tx != nil {
// Serialize the transaction and convert to hex string.
@ -436,7 +436,7 @@ func (c *Client) SignRawTransaction2Async(tx *btcwire.MsgTx, inputs []btcjson.Ra
//
// See SignRawTransaction if the RPC server already knows the input
// transactions.
func (c *Client) SignRawTransaction2(tx *btcwire.MsgTx, inputs []btcjson.RawTxInput) (*btcwire.MsgTx, bool, error) {
func (c *Client) SignRawTransaction2(tx *wire.MsgTx, inputs []btcjson.RawTxInput) (*wire.MsgTx, bool, error) {
return c.SignRawTransaction2Async(tx, inputs).Receive()
}
@ -445,7 +445,7 @@ func (c *Client) SignRawTransaction2(tx *btcwire.MsgTx, inputs []btcjson.RawTxIn
// function on the returned instance.
//
// See SignRawTransaction3 for the blocking version and more details.
func (c *Client) SignRawTransaction3Async(tx *btcwire.MsgTx,
func (c *Client) SignRawTransaction3Async(tx *wire.MsgTx,
inputs []btcjson.RawTxInput,
privKeysWIF []string) FutureSignRawTransactionResult {
@ -486,9 +486,9 @@ func (c *Client) SignRawTransaction3Async(tx *btcwire.MsgTx,
// See SignRawTransaction if the RPC server already knows the input
// transactions and private keys or SignRawTransaction2 if it already knows the
// private keys.
func (c *Client) SignRawTransaction3(tx *btcwire.MsgTx,
func (c *Client) SignRawTransaction3(tx *wire.MsgTx,
inputs []btcjson.RawTxInput,
privKeysWIF []string) (*btcwire.MsgTx, bool, error) {
privKeysWIF []string) (*wire.MsgTx, bool, error) {
return c.SignRawTransaction3Async(tx, inputs, privKeysWIF).Receive()
}
@ -498,7 +498,7 @@ func (c *Client) SignRawTransaction3(tx *btcwire.MsgTx,
// function on the returned instance.
//
// See SignRawTransaction4 for the blocking version and more details.
func (c *Client) SignRawTransaction4Async(tx *btcwire.MsgTx,
func (c *Client) SignRawTransaction4Async(tx *wire.MsgTx,
inputs []btcjson.RawTxInput, privKeysWIF []string,
hashType SigHashType) FutureSignRawTransactionResult {
@ -541,9 +541,9 @@ func (c *Client) SignRawTransaction4Async(tx *btcwire.MsgTx,
// desired. Otherwise, see SignRawTransaction if the RPC server already knows
// the input transactions and private keys, SignRawTransaction2 if it already
// knows the private keys, or SignRawTransaction3 if it does not know both.
func (c *Client) SignRawTransaction4(tx *btcwire.MsgTx,
func (c *Client) SignRawTransaction4(tx *wire.MsgTx,
inputs []btcjson.RawTxInput, privKeysWIF []string,
hashType SigHashType) (*btcwire.MsgTx, bool, error) {
hashType SigHashType) (*wire.MsgTx, bool, error) {
return c.SignRawTransaction4Async(tx, inputs, privKeysWIF,
hashType).Receive()

View file

@ -8,10 +8,10 @@ import (
"encoding/json"
"strconv"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcjson"
"github.com/btcsuite/btcnet"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwire"
"github.com/btcsuite/btcws"
)
@ -46,7 +46,7 @@ func (r FutureGetTransactionResult) Receive() (*btcjson.GetTransactionResult, er
// the returned instance.
//
// See GetTransaction for the blocking version and more details.
func (c *Client) GetTransactionAsync(txHash *btcwire.ShaHash) FutureGetTransactionResult {
func (c *Client) GetTransactionAsync(txHash *wire.ShaHash) FutureGetTransactionResult {
hash := ""
if txHash != nil {
hash = txHash.String()
@ -64,7 +64,7 @@ func (c *Client) GetTransactionAsync(txHash *btcwire.ShaHash) FutureGetTransacti
// GetTransaction returns detailed information about a wallet transaction.
//
// See GetRawTransaction to return the raw transaction instead.
func (c *Client) GetTransaction(txHash *btcwire.ShaHash) (*btcjson.GetTransactionResult, error) {
func (c *Client) GetTransaction(txHash *wire.ShaHash) (*btcjson.GetTransactionResult, error) {
return c.GetTransactionAsync(txHash).Receive()
}
@ -309,7 +309,7 @@ func (r FutureListSinceBlockResult) Receive() (*btcjson.ListSinceBlockResult, er
// the returned instance.
//
// See ListSinceBlock for the blocking version and more details.
func (c *Client) ListSinceBlockAsync(blockHash *btcwire.ShaHash) FutureListSinceBlockResult {
func (c *Client) ListSinceBlockAsync(blockHash *wire.ShaHash) FutureListSinceBlockResult {
hash := ""
if blockHash != nil {
hash = blockHash.String()
@ -329,7 +329,7 @@ func (c *Client) ListSinceBlockAsync(blockHash *btcwire.ShaHash) FutureListSince
// minimum confirmations as a filter.
//
// See ListSinceBlockMinConf to override the minimum number of confirmations.
func (c *Client) ListSinceBlock(blockHash *btcwire.ShaHash) (*btcjson.ListSinceBlockResult, error) {
func (c *Client) ListSinceBlock(blockHash *wire.ShaHash) (*btcjson.ListSinceBlockResult, error) {
return c.ListSinceBlockAsync(blockHash).Receive()
}
@ -338,7 +338,7 @@ func (c *Client) ListSinceBlock(blockHash *btcwire.ShaHash) (*btcjson.ListSinceB
// function on the returned instance.
//
// See ListSinceBlockMinConf for the blocking version and more details.
func (c *Client) ListSinceBlockMinConfAsync(blockHash *btcwire.ShaHash, minConfirms int) FutureListSinceBlockResult {
func (c *Client) ListSinceBlockMinConfAsync(blockHash *wire.ShaHash, minConfirms int) FutureListSinceBlockResult {
hash := ""
if blockHash != nil {
hash = blockHash.String()
@ -358,7 +358,7 @@ func (c *Client) ListSinceBlockMinConfAsync(blockHash *btcwire.ShaHash, minConfi
// number of minimum confirmations as a filter.
//
// See ListSinceBlock to use the default minimum number of confirmations.
func (c *Client) ListSinceBlockMinConf(blockHash *btcwire.ShaHash, minConfirms int) (*btcjson.ListSinceBlockResult, error) {
func (c *Client) ListSinceBlockMinConf(blockHash *wire.ShaHash, minConfirms int) (*btcjson.ListSinceBlockResult, error) {
return c.ListSinceBlockMinConfAsync(blockHash, minConfirms).Receive()
}
@ -382,7 +382,7 @@ func (r FutureLockUnspentResult) Receive() error {
// returned instance.
//
// See LockUnspent for the blocking version and more details.
func (c *Client) LockUnspentAsync(unlock bool, ops []*btcwire.OutPoint) FutureLockUnspentResult {
func (c *Client) LockUnspentAsync(unlock bool, ops []*wire.OutPoint) FutureLockUnspentResult {
id := c.NextID()
outputs := make([]btcjson.TransactionInput, len(ops))
for i, op := range ops {
@ -416,7 +416,7 @@ func (c *Client) LockUnspentAsync(unlock bool, ops []*btcwire.OutPoint) FutureLo
// reversed (that is, LockUnspent(true, ...) locked the outputs), it has been
// left as unlock to keep compatibility with the reference client API and to
// avoid confusion for those who are already familiar with the lockunspent RPC.
func (c *Client) LockUnspent(unlock bool, ops []*btcwire.OutPoint) error {
func (c *Client) LockUnspent(unlock bool, ops []*wire.OutPoint) error {
return c.LockUnspentAsync(unlock, ops).Receive()
}
@ -426,7 +426,7 @@ type FutureListLockUnspentResult chan *response
// Receive waits for the response promised by the future and returns the result
// of all currently locked unspent outputs.
func (r FutureListLockUnspentResult) Receive() ([]*btcwire.OutPoint, error) {
func (r FutureListLockUnspentResult) Receive() ([]*wire.OutPoint, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -440,13 +440,13 @@ func (r FutureListLockUnspentResult) Receive() ([]*btcwire.OutPoint, error) {
}
// Create a slice of outpoints from the transaction input structs.
ops := make([]*btcwire.OutPoint, len(inputs))
ops := make([]*wire.OutPoint, len(inputs))
for i, input := range inputs {
sha, err := btcwire.NewShaHashFromStr(input.Txid)
sha, err := wire.NewShaHashFromStr(input.Txid)
if err != nil {
return nil, err
}
ops[i] = btcwire.NewOutPoint(sha, input.Vout)
ops[i] = wire.NewOutPoint(sha, input.Vout)
}
return ops, nil
@ -470,7 +470,7 @@ func (c *Client) ListLockUnspentAsync() FutureListLockUnspentResult {
// ListLockUnspent returns a slice of outpoints for all unspent outputs marked
// as locked by a wallet. Unspent outputs may be marked locked using
// LockOutput.
func (c *Client) ListLockUnspent() ([]*btcwire.OutPoint, error) {
func (c *Client) ListLockUnspent() ([]*wire.OutPoint, error) {
return c.ListLockUnspentAsync().Receive()
}
@ -517,7 +517,7 @@ type FutureSendToAddressResult chan *response
// Receive waits for the response promised by the future and returns the hash
// of the transaction sending the passed amount to the given address.
func (r FutureSendToAddressResult) Receive() (*btcwire.ShaHash, error) {
func (r FutureSendToAddressResult) Receive() (*wire.ShaHash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -530,7 +530,7 @@ func (r FutureSendToAddressResult) Receive() (*btcwire.ShaHash, error) {
return nil, err
}
return btcwire.NewShaHashFromStr(txHash)
return wire.NewShaHashFromStr(txHash)
}
// SendToAddressAsync returns an instance of a type that can be used to get the
@ -557,7 +557,7 @@ func (c *Client) SendToAddressAsync(address btcutil.Address, amount btcutil.Amou
//
// NOTE: This function requires to the wallet to be unlocked. See the
// WalletPassphrase function for more details.
func (c *Client) SendToAddress(address btcutil.Address, amount btcutil.Amount) (*btcwire.ShaHash, error) {
func (c *Client) SendToAddress(address btcutil.Address, amount btcutil.Amount) (*wire.ShaHash, error) {
return c.SendToAddressAsync(address, amount).Receive()
}
@ -593,7 +593,7 @@ func (c *Client) SendToAddressCommentAsync(address btcutil.Address,
//
// NOTE: This function requires to the wallet to be unlocked. See the
// WalletPassphrase function for more details.
func (c *Client) SendToAddressComment(address btcutil.Address, amount btcutil.Amount, comment, commentTo string) (*btcwire.ShaHash, error) {
func (c *Client) SendToAddressComment(address btcutil.Address, amount btcutil.Amount, comment, commentTo string) (*wire.ShaHash, error) {
return c.SendToAddressCommentAsync(address, amount, comment,
commentTo).Receive()
}
@ -606,7 +606,7 @@ type FutureSendFromResult chan *response
// Receive waits for the response promised by the future and returns the hash
// of the transaction sending amount to the given address using the provided
// account as a source of funds.
func (r FutureSendFromResult) Receive() (*btcwire.ShaHash, error) {
func (r FutureSendFromResult) Receive() (*wire.ShaHash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -619,7 +619,7 @@ func (r FutureSendFromResult) Receive() (*btcwire.ShaHash, error) {
return nil, err
}
return btcwire.NewShaHashFromStr(txHash)
return wire.NewShaHashFromStr(txHash)
}
// SendFromAsync returns an instance of a type that can be used to get the
@ -646,7 +646,7 @@ func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address, am
//
// NOTE: This function requires to the wallet to be unlocked. See the
// WalletPassphrase function for more details.
func (c *Client) SendFrom(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) (*btcwire.ShaHash, error) {
func (c *Client) SendFrom(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) (*wire.ShaHash, error) {
return c.SendFromAsync(fromAccount, toAddress, amount).Receive()
}
@ -676,7 +676,7 @@ func (c *Client) SendFromMinConfAsync(fromAccount string, toAddress btcutil.Addr
//
// NOTE: This function requires to the wallet to be unlocked. See the
// WalletPassphrase function for more details.
func (c *Client) SendFromMinConf(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount, minConfirms int) (*btcwire.ShaHash, error) {
func (c *Client) SendFromMinConf(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount, minConfirms int) (*wire.ShaHash, error) {
return c.SendFromMinConfAsync(fromAccount, toAddress, amount,
minConfirms).Receive()
}
@ -714,7 +714,7 @@ func (c *Client) SendFromCommentAsync(fromAccount string,
// WalletPassphrase function for more details.
func (c *Client) SendFromComment(fromAccount string, toAddress btcutil.Address,
amount btcutil.Amount, minConfirms int,
comment, commentTo string) (*btcwire.ShaHash, error) {
comment, commentTo string) (*wire.ShaHash, error) {
return c.SendFromCommentAsync(fromAccount, toAddress, amount,
minConfirms, comment, commentTo).Receive()
@ -728,7 +728,7 @@ type FutureSendManyResult chan *response
// Receive waits for the response promised by the future and returns the hash
// of the transaction sending multiple amounts to multiple addresses using the
// provided account as a source of funds.
func (r FutureSendManyResult) Receive() (*btcwire.ShaHash, error) {
func (r FutureSendManyResult) Receive() (*wire.ShaHash, error) {
res, err := receiveFuture(r)
if err != nil {
return nil, err
@ -741,7 +741,7 @@ func (r FutureSendManyResult) Receive() (*btcwire.ShaHash, error) {
return nil, err
}
return btcwire.NewShaHashFromStr(txHash)
return wire.NewShaHashFromStr(txHash)
}
// SendManyAsync returns an instance of a type that can be used to get the
@ -771,7 +771,7 @@ func (c *Client) SendManyAsync(fromAccount string, amounts map[btcutil.Address]b
//
// NOTE: This function requires to the wallet to be unlocked. See the
// WalletPassphrase function for more details.
func (c *Client) SendMany(fromAccount string, amounts map[btcutil.Address]btcutil.Amount) (*btcwire.ShaHash, error) {
func (c *Client) SendMany(fromAccount string, amounts map[btcutil.Address]btcutil.Amount) (*wire.ShaHash, error) {
return c.SendManyAsync(fromAccount, amounts).Receive()
}
@ -809,7 +809,7 @@ func (c *Client) SendManyMinConfAsync(fromAccount string,
// WalletPassphrase function for more details.
func (c *Client) SendManyMinConf(fromAccount string,
amounts map[btcutil.Address]btcutil.Amount,
minConfirms int) (*btcwire.ShaHash, error) {
minConfirms int) (*wire.ShaHash, error) {
return c.SendManyMinConfAsync(fromAccount, amounts, minConfirms).Receive()
}
@ -849,7 +849,7 @@ func (c *Client) SendManyCommentAsync(fromAccount string,
// WalletPassphrase function for more details.
func (c *Client) SendManyComment(fromAccount string,
amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
comment string) (*btcwire.ShaHash, error) {
comment string) (*wire.ShaHash, error) {
return c.SendManyCommentAsync(fromAccount, amounts, minConfirms,
comment).Receive()