-
Notifications
You must be signed in to change notification settings - Fork 9
/
ethereum_node.go
43 lines (39 loc) · 1.29 KB
/
ethereum_node.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
package reader
import (
"math/big"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/core/types"
"github.com/tranvictor/jarvis/common"
)
type EthereumNode interface {
NodeName() string
NodeURL() string
EstimateGas(
from, to string,
priceGwei float64,
value *big.Int,
data []byte,
) (gas uint64, err error)
GetCode(address string) (code []byte, err error)
GetBalance(address string) (balance *big.Int, err error)
GetMinedNonce(address string) (nonce uint64, err error)
GetPendingNonce(address string) (nonce uint64, err error)
TransactionReceipt(txHash string) (receipt *types.Receipt, err error)
TransactionByHash(txHash string) (tx *common.Transaction, isPending bool, err error)
// Call(result interface{}, method string, args ...interface{}) error
GetGasPriceSuggestion() (*big.Int, error)
SuggestedGasPrice() (*big.Int, error)
SuggestedGasTipCap() (*big.Int, error)
ReadContractToBytes(
atBlock int64,
from string,
caddr string,
abi *abi.ABI,
method string,
args ...interface{},
) ([]byte, error)
StorageAt(atBlock int64, caddr string, slot string) ([]byte, error)
HeaderByNumber(number int64) (*types.Header, error)
GetLogs(fromBlock, toBlock int, addresses []string, topic string) ([]types.Log, error)
CurrentBlock() (uint64, error)
}