-
Notifications
You must be signed in to change notification settings - Fork 17
/
interface.go
40 lines (36 loc) · 1.43 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package btcclient
import (
"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/babylonchain/vigilante/types"
)
type BTCClient interface {
Stop()
WaitForShutdown()
MustSubscribeBlocks()
BlockEventChan() <-chan *types.BlockEvent
GetBestBlock() (*chainhash.Hash, uint64, error)
GetBlockByHash(blockHash *chainhash.Hash) (*types.IndexedBlock, *wire.MsgBlock, error)
FindTailBlocksByHeight(height uint64) ([]*types.IndexedBlock, error)
GetBlockByHeight(height uint64) (*types.IndexedBlock, *wire.MsgBlock, error)
SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (*chainhash.Hash, error)
}
type BTCWallet interface {
Stop()
GetWalletName() string
GetWalletPass() string
GetWalletLockTime() int64
GetNetParams() *chaincfg.Params
GetTxFee(txSize uint64) uint64 // in the unit of satoshi
GetMaxTxFee() uint64 // in the unit of satoshi
GetMinTxFee() uint64 // in the unit of satoshi
ListUnspent() ([]btcjson.ListUnspentResult, error)
ListReceivedByAddress() ([]btcjson.ListReceivedByAddressResult, error)
SendRawTransaction(tx *wire.MsgTx, allowHighFees bool) (*chainhash.Hash, error)
GetRawChangeAddress(account string) (btcutil.Address, error)
WalletPassphrase(passphrase string, timeoutSecs int64) error
DumpPrivKey(address btcutil.Address) (*btcutil.WIF, error)
}