@@ -39,6 +39,8 @@ import (
3939 "google.golang.org/grpc"
4040 "google.golang.org/grpc/credentials/insecure"
4141
42+ erc20types "github.com/InjectiveLabs/sdk-go/chain/erc20/types"
43+ evmtypes "github.com/InjectiveLabs/sdk-go/chain/evm/types"
4244 exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types"
4345 exchangev2types "github.com/InjectiveLabs/sdk-go/chain/exchange/types/v2"
4446 permissionstypes "github.com/InjectiveLabs/sdk-go/chain/permissions/types"
@@ -452,6 +454,20 @@ type ChainClient interface {
452454 FetchTxFeesParams (ctx context.Context ) (* txfeestypes.QueryParamsResponse , error )
453455 FetchEipBaseFee (ctx context.Context ) (* txfeestypes.QueryEipBaseFeeResponse , error )
454456
457+ // ERC20 module
458+ FetchAllTokenPairs (ctx context.Context ) (* erc20types.QueryAllTokenPairsResponse , error )
459+ FetchTokenPairByDenom (ctx context.Context , bankDenom string ) (* erc20types.QueryTokenPairByDenomResponse , error )
460+ FetchTokenPairByERC20Address (ctx context.Context , erc20Address string ) (* erc20types.QueryTokenPairByERC20AddressResponse , error )
461+
462+ // EVM module
463+ FetchEVMAccount (ctx context.Context , evmAddress string ) (* evmtypes.QueryAccountResponse , error )
464+ FetchEVMCosmosAccount (ctx context.Context , address string ) (* evmtypes.QueryCosmosAccountResponse , error )
465+ FetchEVMValidatorAccount (ctx context.Context , consAddress string ) (* evmtypes.QueryValidatorAccountResponse , error )
466+ FetchEVMBalance (ctx context.Context , address string ) (* evmtypes.QueryBalanceResponse , error )
467+ FetchEVMStorage (ctx context.Context , address string , key * string ) (* evmtypes.QueryStorageResponse , error )
468+ FetchEVMCode (ctx context.Context , address string ) (* evmtypes.QueryCodeResponse , error )
469+ FetchEVMBaseFee (ctx context.Context ) (* evmtypes.QueryBaseFeeResponse , error )
470+
455471 CurrentChainGasPrice () int64
456472 SetGasPrice (gasPrice int64 )
457473
@@ -492,6 +508,8 @@ type chainClient struct {
492508 chainStreamClient chainstreamtypes.StreamClient
493509 chainStreamV2Client chainstreamv2types.StreamClient
494510 distributionQueryClient distributiontypes.QueryClient
511+ erc20QueryClient erc20types.QueryClient
512+ evmQueryClient evmtypes.QueryClient
495513 exchangeQueryClient exchangetypes.QueryClient
496514 exchangeV2QueryClient exchangev2types.QueryClient
497515 ibcChannelQueryClient ibcchanneltypes.QueryClient
@@ -596,6 +614,8 @@ func NewChainClient(
596614 chainStreamClient : chainstreamtypes .NewStreamClient (chainStreamConn ),
597615 chainStreamV2Client : chainstreamv2types .NewStreamClient (chainStreamConn ),
598616 distributionQueryClient : distributiontypes .NewQueryClient (conn ),
617+ erc20QueryClient : erc20types .NewQueryClient (conn ),
618+ evmQueryClient : evmtypes .NewQueryClient (conn ),
599619 exchangeQueryClient : exchangetypes .NewQueryClient (conn ),
600620 exchangeV2QueryClient : exchangev2types .NewQueryClient (conn ),
601621 ibcChannelQueryClient : ibcchanneltypes .NewQueryClient (conn ),
@@ -3586,6 +3606,94 @@ func (c *chainClient) GetNetwork() common.Network {
35863606 return c .network
35873607}
35883608
3609+ // ERC20 module
3610+
3611+ func (c * chainClient ) FetchAllTokenPairs (ctx context.Context ) (* erc20types.QueryAllTokenPairsResponse , error ) {
3612+ req := & erc20types.QueryAllTokenPairsRequest {}
3613+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .erc20QueryClient .AllTokenPairs , req )
3614+
3615+ return res , err
3616+ }
3617+
3618+ func (c * chainClient ) FetchTokenPairByDenom (ctx context.Context , bankDenom string ) (* erc20types.QueryTokenPairByDenomResponse , error ) {
3619+ req := & erc20types.QueryTokenPairByDenomRequest {
3620+ BankDenom : bankDenom ,
3621+ }
3622+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .erc20QueryClient .TokenPairByDenom , req )
3623+
3624+ return res , err
3625+ }
3626+
3627+ func (c * chainClient ) FetchTokenPairByERC20Address (ctx context.Context , erc20Address string ) (* erc20types.QueryTokenPairByERC20AddressResponse , error ) {
3628+ req := & erc20types.QueryTokenPairByERC20AddressRequest {
3629+ Erc20Address : erc20Address ,
3630+ }
3631+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .erc20QueryClient .TokenPairByERC20Address , req )
3632+
3633+ return res , err
3634+ }
3635+
3636+ // EVM module
3637+
3638+ func (c * chainClient ) FetchEVMAccount (ctx context.Context , address string ) (* evmtypes.QueryAccountResponse , error ) {
3639+ req := & evmtypes.QueryAccountRequest {
3640+ Address : address ,
3641+ }
3642+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .evmQueryClient .Account , req )
3643+ return res , err
3644+ }
3645+
3646+ func (c * chainClient ) FetchEVMCosmosAccount (ctx context.Context , address string ) (* evmtypes.QueryCosmosAccountResponse , error ) {
3647+ req := & evmtypes.QueryCosmosAccountRequest {
3648+ Address : address ,
3649+ }
3650+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .evmQueryClient .CosmosAccount , req )
3651+ return res , err
3652+ }
3653+
3654+ func (c * chainClient ) FetchEVMValidatorAccount (ctx context.Context , consAddress string ) (* evmtypes.QueryValidatorAccountResponse , error ) {
3655+ req := & evmtypes.QueryValidatorAccountRequest {
3656+ ConsAddress : consAddress ,
3657+ }
3658+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .evmQueryClient .ValidatorAccount , req )
3659+ return res , err
3660+ }
3661+
3662+ func (c * chainClient ) FetchEVMBalance (ctx context.Context , address string ) (* evmtypes.QueryBalanceResponse , error ) {
3663+ req := & evmtypes.QueryBalanceRequest {
3664+ Address : address ,
3665+ }
3666+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .evmQueryClient .Balance , req )
3667+ return res , err
3668+ }
3669+
3670+ func (c * chainClient ) FetchEVMStorage (ctx context.Context , address string , key * string ) (* evmtypes.QueryStorageResponse , error ) {
3671+ req := & evmtypes.QueryStorageRequest {
3672+ Address : address ,
3673+ }
3674+
3675+ if key != nil {
3676+ req .Key = * key
3677+ }
3678+
3679+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .evmQueryClient .Storage , req )
3680+ return res , err
3681+ }
3682+
3683+ func (c * chainClient ) FetchEVMCode (ctx context.Context , address string ) (* evmtypes.QueryCodeResponse , error ) {
3684+ req := & evmtypes.QueryCodeRequest {
3685+ Address : address ,
3686+ }
3687+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .evmQueryClient .Code , req )
3688+ return res , err
3689+ }
3690+
3691+ func (c * chainClient ) FetchEVMBaseFee (ctx context.Context ) (* evmtypes.QueryBaseFeeResponse , error ) {
3692+ req := & evmtypes.QueryBaseFeeRequest {}
3693+ res , err := common .ExecuteCall (ctx , c .network .ChainCookieAssistant , c .evmQueryClient .BaseFee , req )
3694+ return res , err
3695+ }
3696+
35893697// SyncBroadcastMsg sends Tx to chain and waits until Tx is included in block.
35903698func (c * chainClient ) SyncBroadcastMsg (msgs ... sdk.Msg ) (* txtypes.BroadcastTxResponse , error ) {
35913699 req , res , err := c .BroadcastMsg (txtypes .BroadcastMode_BROADCAST_MODE_SYNC , msgs ... )
0 commit comments