-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BTC Client mocks. Drop old interface/mocks
- Loading branch information
Showing
6 changed files
with
841 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
types "github.com/btcsuite/btcd/btcjson" | ||
"github.com/btcsuite/btcd/btcutil" | ||
hash "github.com/btcsuite/btcd/chaincfg/chainhash" | ||
"github.com/btcsuite/btcd/rpcclient" | ||
"github.com/btcsuite/btcd/wire" | ||
) | ||
|
||
// client represents interface version of Client. | ||
// It's unexported on purpose ONLY for mock generation. | ||
// | ||
//go:generate mockery --name client --structname BitcoinClient --filename bitcoin_client.go --output ../../../testutils/mocks | ||
type client interface { | ||
Ping(ctx context.Context) error | ||
Healthcheck(ctx context.Context, tssAddress btcutil.Address) (time.Time, error) | ||
GetNetworkInfo(ctx context.Context) (*types.GetNetworkInfoResult, error) | ||
|
||
GetBlockCount(ctx context.Context) (int64, error) | ||
GetBlockHash(ctx context.Context, blockHeight int64) (*hash.Hash, error) | ||
GetBlockHeader(ctx context.Context, hash *hash.Hash) (*wire.BlockHeader, error) | ||
GetBlockVerbose(ctx context.Context, hash *hash.Hash) (*types.GetBlockVerboseTxResult, error) | ||
|
||
GetTransaction(ctx context.Context, hash *hash.Hash) (*types.GetTransactionResult, error) | ||
GetRawTransaction(ctx context.Context, hash *hash.Hash) (*btcutil.Tx, error) | ||
GetRawTransactionVerbose(ctx context.Context, hash *hash.Hash) (*types.TxRawResult, error) | ||
GetRawTransactionResult( | ||
ctx context.Context, | ||
hash *hash.Hash, | ||
res *types.GetTransactionResult, | ||
) (types.TxRawResult, error) | ||
|
||
GetTransactionFeeAndRate(ctx context.Context, tx *types.TxRawResult) (int64, int64, error) | ||
|
||
SendRawTransaction(ctx context.Context, tx *wire.MsgTx, allowHighFees bool) (*hash.Hash, error) | ||
|
||
EstimateSmartFee( | ||
ctx context.Context, | ||
confTarget int64, | ||
mode *types.EstimateSmartFeeMode, | ||
) (*types.EstimateSmartFeeResult, error) | ||
|
||
ListUnspent(ctx context.Context) ([]types.ListUnspentResult, error) | ||
ListUnspentMinMaxAddresses( | ||
ctx context.Context, | ||
minConf, maxConf int, | ||
addresses []btcutil.Address, | ||
) ([]types.ListUnspentResult, error) | ||
|
||
CreateWallet(ctx context.Context, name string, opts ...rpcclient.CreateWalletOpt) (*types.CreateWalletResult, error) | ||
GetBalance(ctx context.Context, account string) (btcutil.Amount, error) | ||
GetNewAddress(ctx context.Context, account string) (btcutil.Address, error) | ||
GenerateToAddress( | ||
ctx context.Context, | ||
numBlocks int64, | ||
address btcutil.Address, | ||
maxTries *int64, | ||
) ([]*hash.Hash, error) | ||
|
||
GetBlockVerboseByStr(ctx context.Context, blockHash string) (*types.GetBlockVerboseTxResult, error) | ||
GetBlockHeightByStr(ctx context.Context, blockHash string) (int64, error) | ||
GetTransactionByStr(ctx context.Context, hash string) (*hash.Hash, *types.GetTransactionResult, error) | ||
GetRawTransactionByStr(ctx context.Context, hash string) (*btcutil.Tx, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.