forked from decred/dcrdex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallet.go
51 lines (47 loc) · 2.12 KB
/
wallet.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
41
42
43
44
45
46
47
48
49
50
51
package btc
import (
"context"
"sync"
"time"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
)
type Wallet interface {
RawRequester
connect(ctx context.Context, wg *sync.WaitGroup) error
estimateSmartFee(confTarget int64, mode *btcjson.EstimateSmartFeeMode) (*btcjson.EstimateSmartFeeResult, error)
sendRawTransaction(tx *wire.MsgTx) (*chainhash.Hash, error)
getTxOut(txHash *chainhash.Hash, index uint32, pkScript []byte, startTime time.Time) (*wire.TxOut, uint32, error)
getBlockHash(blockHeight int64) (*chainhash.Hash, error)
getBlockHeight(*chainhash.Hash) (int32, error)
getBestBlockHash() (*chainhash.Hash, error)
getBestBlockHeight() (int32, error)
balances() (*GetBalancesResult, error)
listUnspent() ([]*ListUnspentResult, error)
lockUnspent(unlock bool, ops []*output) error
listLockUnspent() ([]*RPCOutpoint, error)
changeAddress() (btcutil.Address, error)
addressPKH() (btcutil.Address, error)
addressWPKH() (btcutil.Address, error)
signTx(inTx *wire.MsgTx) (*wire.MsgTx, error)
privKeyForAddress(addr string) (*btcec.PrivateKey, error)
walletUnlock(pw []byte) error
walletLock() error
sendToAddress(address string, value, feeRate uint64, subtract bool) (*chainhash.Hash, error)
locked() bool
syncStatus() (*syncStatus, error)
peerCount() (uint32, error)
swapConfirmations(txHash *chainhash.Hash, vout uint32, contract []byte, startTime time.Time) (confs uint32, spent bool, err error)
getBlockHeader(blockHash *chainhash.Hash) (*blockHeader, error)
ownsAddress(addr btcutil.Address) (bool, error)
getWalletTransaction(txHash *chainhash.Hash) (*GetTransactionResult, error)
searchBlockForRedemptions(ctx context.Context, reqs map[outPoint]*findRedemptionReq, blockHash chainhash.Hash) (discovered map[outPoint]*findRedemptionResult)
findRedemptionsInMempool(ctx context.Context, reqs map[outPoint]*findRedemptionReq) (discovered map[outPoint]*findRedemptionResult)
getBlock(h chainhash.Hash) (*wire.MsgBlock, error)
}
type tipNotifier interface {
tipFeed() <-chan *block
}