@@ -6,40 +6,50 @@ import (
66 "strings"
77
88 "github.com/ava-labs/avalanchego/api/info"
9+ "github.com/ava-labs/avalanchego/ids"
910 "github.com/ava-labs/avalanchego/utils/rpc"
10- ethtypes "github.com/ava-labs/coreth/core/types"
11+ "github.com/ava-labs/coreth/core/types"
1112 "github.com/ava-labs/coreth/interfaces"
12- ethcommon "github.com/ethereum/go-ethereum/common"
13+ "github.com/ava-labs/coreth/plugin/evm"
14+ "github.com/ethereum/go-ethereum/common"
15+
16+ "github.com/ava-labs/avalanche-rosetta/constants"
1317)
1418
1519// Interface compliance
1620var _ Client = & client {}
1721
1822type Client interface {
19- IsBootstrapped (context.Context , string , ... rpc.Option ) (bool , error )
23+ // info.Client methods
24+ InfoClient
25+
2026 ChainID (context.Context ) (* big.Int , error )
21- BlockByHash (context.Context , ethcommon .Hash ) (* ethtypes .Block , error )
22- BlockByNumber (context.Context , * big.Int ) (* ethtypes .Block , error )
23- HeaderByHash (context.Context , ethcommon .Hash ) (* ethtypes .Header , error )
24- HeaderByNumber (context.Context , * big.Int ) (* ethtypes .Header , error )
25- TransactionByHash (context.Context , ethcommon .Hash ) (* ethtypes .Transaction , bool , error )
26- TransactionReceipt (context.Context , ethcommon .Hash ) (* ethtypes .Receipt , error )
27+ BlockByHash (context.Context , common .Hash ) (* types .Block , error )
28+ BlockByNumber (context.Context , * big.Int ) (* types .Block , error )
29+ HeaderByHash (context.Context , common .Hash ) (* types .Header , error )
30+ HeaderByNumber (context.Context , * big.Int ) (* types .Header , error )
31+ TransactionByHash (context.Context , common .Hash ) (* types .Transaction , bool , error )
32+ TransactionReceipt (context.Context , common .Hash ) (* types .Receipt , error )
2733 TraceTransaction (context.Context , string ) (* Call , []* FlatCall , error )
2834 TraceBlockByHash (context.Context , string ) ([]* Call , [][]* FlatCall , error )
29- SendTransaction (context.Context , * ethtypes .Transaction ) error
30- BalanceAt (context.Context , ethcommon .Address , * big.Int ) (* big.Int , error )
31- NonceAt (context.Context , ethcommon .Address , * big.Int ) (uint64 , error )
35+ SendTransaction (context.Context , * types .Transaction ) error
36+ BalanceAt (context.Context , common .Address , * big.Int ) (* big.Int , error )
37+ NonceAt (context.Context , common .Address , * big.Int ) (uint64 , error )
3238 SuggestGasPrice (context.Context ) (* big.Int , error )
3339 EstimateGas (context.Context , interfaces.CallMsg ) (uint64 , error )
3440 TxPoolContent (context.Context ) (* TxPoolContent , error )
35- GetNetworkName (context.Context , ... rpc.Option ) (string , error )
36- Peers (context.Context , ... rpc.Option ) ([]info.Peer , error )
37- GetContractInfo (ethcommon.Address , bool ) (string , uint8 , error )
41+ GetContractInfo (common.Address , bool ) (string , uint8 , error )
3842 CallContract (context.Context , interfaces.CallMsg , * big.Int ) ([]byte , error )
43+ IssueTx (ctx context.Context , txBytes []byte , options ... rpc.Option ) (ids.ID , error )
44+ GetAtomicUTXOs (ctx context.Context , addrs []ids.ShortID , sourceChain string , limit uint32 , startAddress ids.ShortID , startUTXOID ids.ID , options ... rpc.Option ) ([][]byte , ids.ShortID , ids.ID , error )
45+ EstimateBaseFee (ctx context.Context ) (* big.Int , error )
3946}
4047
48+ type EvmClient evm.Client
49+
4150type client struct {
4251 info.Client
52+ EvmClient
4353 * EthClient
4454 * ContractClient
4555}
@@ -53,8 +63,9 @@ func NewClient(ctx context.Context, endpoint string) (Client, error) {
5363 return nil , err
5464 }
5565
56- return client {
66+ return & client {
5767 Client : info .NewClient (endpoint ),
68+ EvmClient : evm .NewClient (endpoint , constants .CChain .String ()),
5869 EthClient : eth ,
5970 ContractClient : NewContractClient (eth .Client ),
6071 }, nil
0 commit comments