-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchainclient_context_inf.go
31 lines (27 loc) · 1.18 KB
/
chainclient_context_inf.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
package chainclient
import (
"context"
"crypto/ecdsa"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"math/big"
"time"
)
type Context interface {
SetPrivateKey(*ecdsa.PrivateKey)
GetPrivateKey() *ecdsa.PrivateKey
GetPublicKey() *ecdsa.PublicKey
GetAddress() ethcommon.Address
GetClient() *ethclient.Client
BlockNumber(timeoutCtx context.Context) (uint64, error)
PendingNonceAt(timeoutCtx context.Context) (uint64, error)
SuggestGasPrice(timeoutCtx context.Context) (*big.Int, error)
EstimateGas(timeoutCtx context.Context, to ethcommon.Address, data []byte) (uint64, error)
CallContract(timeoutCtx context.Context, to ethcommon.Address, data []byte) ([]byte, error)
BuildTxOpts(value, gasLimit uint64) (*bind.TransactOpts, error)
WaitReceipt(timeoutCtx context.Context, txHash ethcommon.Hash, interval time.Duration) *ethtypes.Receipt
GetLog(timeoutCtx context.Context, toAddr ethcommon.Address, blockNo *big.Int) ([]ethtypes.Log, error)
//GetLogs(timeoutCtx context.Context, toAddr common.Address, blockNo *big.Int) []*types.Log
}