-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheth_client_shim.go
38 lines (30 loc) · 1.12 KB
/
eth_client_shim.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
package walletutils
import (
"context"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
)
type EthClientShimMethods interface {
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
SendTransaction(ctx context.Context, tx *types.Transaction) error
GetOuterTxHash(tx common.Hash) common.Hash
}
type EthClientShim struct {
*ethclient.Client
shim EthClientShimMethods
}
func (c *EthClientShim) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) {
return c.shim.PendingNonceAt(ctx, account)
}
func (c *EthClientShim) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error) {
return c.shim.EstimateGas(ctx, call)
}
func (c *EthClientShim) SendTransaction(ctx context.Context, tx *types.Transaction) error {
return c.shim.SendTransaction(ctx, tx)
}
func (c *EthClientShim) GetOuterTxHash(innerHash common.Hash) common.Hash {
return c.shim.GetOuterTxHash(innerHash)
}