@@ -20,6 +20,7 @@ import (
2020 sdkclient "github.com/cosmos/cosmos-sdk/client"
2121 "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
2222 "github.com/cosmos/cosmos-sdk/client/tx"
23+ "github.com/cosmos/cosmos-sdk/codec"
2324 codectypes "github.com/cosmos/cosmos-sdk/codec/types"
2425 sdk "github.com/cosmos/cosmos-sdk/types"
2526 "github.com/cosmos/cosmos-sdk/types/query"
@@ -42,10 +43,8 @@ import (
4243
4344 erc20types "github.com/InjectiveLabs/sdk-go/chain/erc20/types"
4445 evmtypes "github.com/InjectiveLabs/sdk-go/chain/evm/types"
45- exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types"
4646 exchangev2types "github.com/InjectiveLabs/sdk-go/chain/exchange/types/v2"
4747 permissionstypes "github.com/InjectiveLabs/sdk-go/chain/permissions/types"
48- chainstreamtypes "github.com/InjectiveLabs/sdk-go/chain/stream/types"
4948 chainstreamv2types "github.com/InjectiveLabs/sdk-go/chain/stream/types/v2"
5049 tokenfactorytypes "github.com/InjectiveLabs/sdk-go/chain/tokenfactory/types"
5150 txfeestypes "github.com/InjectiveLabs/sdk-go/chain/txfees/types"
@@ -342,12 +341,10 @@ type chainClientV2 struct {
342341 authQueryClient authtypes.QueryClient
343342 authzQueryClient authztypes.QueryClient
344343 bankQueryClient banktypes.QueryClient
345- chainStreamClient chainstreamtypes.StreamClient
346344 chainStreamV2Client chainstreamv2types.StreamClient
347345 distributionQueryClient distributiontypes.QueryClient
348346 erc20QueryClient erc20types.QueryClient
349347 evmQueryClient evmtypes.QueryClient
350- exchangeQueryClient exchangetypes.QueryClient
351348 exchangeV2QueryClient exchangev2types.QueryClient
352349 ibcChannelQueryClient ibcchanneltypes.QueryClient
353350 ibcClientQueryClient ibcclienttypes.QueryClient
@@ -396,13 +393,28 @@ func NewChainClientV2(
396393 }
397394
398395 // init grpc connection
396+ protoCodec , ok := ctx .Codec .(* codec.ProtoCodec )
397+ if ! ok {
398+ return nil , errors .New ("codec is not a proto codec" )
399+ }
400+
399401 var conn * grpc.ClientConn
400402 var err error
401403 stickySessionEnabled := true
402404 if opts .TLSCert != nil {
403- conn , err = grpc .NewClient (network .ChainGrpcEndpoint , grpc .WithTransportCredentials (opts .TLSCert ), grpc .WithContextDialer (common .DialerFunc ))
405+ conn , err = grpc .NewClient (
406+ network .ChainGrpcEndpoint ,
407+ grpc .WithTransportCredentials (opts .TLSCert ),
408+ grpc .WithContextDialer (common .DialerFunc ),
409+ grpc .WithDefaultCallOptions (grpc .ForceCodec (protoCodec .GRPCCodec ())),
410+ )
404411 } else {
405- conn , err = grpc .NewClient (network .ChainGrpcEndpoint , grpc .WithTransportCredentials (insecure .NewCredentials ()), grpc .WithContextDialer (common .DialerFunc ))
412+ conn , err = grpc .NewClient (
413+ network .ChainGrpcEndpoint ,
414+ grpc .WithTransportCredentials (insecure .NewCredentials ()),
415+ grpc .WithContextDialer (common .DialerFunc ),
416+ grpc .WithDefaultCallOptions (grpc .ForceCodec (protoCodec .GRPCCodec ())),
417+ )
406418 stickySessionEnabled = false
407419 }
408420 if err != nil {
@@ -412,9 +424,20 @@ func NewChainClientV2(
412424
413425 var chainStreamConn * grpc.ClientConn
414426 if opts .TLSCert != nil {
415- chainStreamConn , err = grpc .NewClient (network .ChainStreamGrpcEndpoint , grpc .WithTransportCredentials (opts .TLSCert ), grpc .WithContextDialer (common .DialerFunc ))
427+ chainStreamConn , err = grpc .NewClient (
428+ network .ChainStreamGrpcEndpoint ,
429+ grpc .WithTransportCredentials (opts .TLSCert ),
430+ grpc .WithContextDialer (common .DialerFunc ),
431+ grpc .WithDefaultCallOptions (grpc .ForceCodec (protoCodec .GRPCCodec ())),
432+ )
433+
416434 } else {
417- chainStreamConn , err = grpc .NewClient (network .ChainStreamGrpcEndpoint , grpc .WithTransportCredentials (insecure .NewCredentials ()), grpc .WithContextDialer (common .DialerFunc ))
435+ chainStreamConn , err = grpc .NewClient (
436+ network .ChainStreamGrpcEndpoint ,
437+ grpc .WithTransportCredentials (insecure .NewCredentials ()),
438+ grpc .WithContextDialer (common .DialerFunc ),
439+ grpc .WithDefaultCallOptions (grpc .ForceCodec (protoCodec .GRPCCodec ())),
440+ )
418441 }
419442 if err != nil {
420443 err = errors .Wrapf (err , "failed to connect to the chain stream gRPC: %s" , network .ChainStreamGrpcEndpoint )
@@ -448,12 +471,10 @@ func NewChainClientV2(
448471 authQueryClient : authtypes .NewQueryClient (conn ),
449472 authzQueryClient : authztypes .NewQueryClient (conn ),
450473 bankQueryClient : banktypes .NewQueryClient (conn ),
451- chainStreamClient : chainstreamtypes .NewStreamClient (chainStreamConn ),
452474 chainStreamV2Client : chainstreamv2types .NewStreamClient (chainStreamConn ),
453475 distributionQueryClient : distributiontypes .NewQueryClient (conn ),
454476 erc20QueryClient : erc20types .NewQueryClient (conn ),
455477 evmQueryClient : evmtypes .NewQueryClient (conn ),
456- exchangeQueryClient : exchangetypes .NewQueryClient (conn ),
457478 exchangeV2QueryClient : exchangev2types .NewQueryClient (conn ),
458479 ibcChannelQueryClient : ibcchanneltypes .NewQueryClient (conn ),
459480 ibcClientQueryClient : ibcclienttypes .NewQueryClient (conn ),
@@ -918,7 +939,7 @@ func (c *chainClientV2) runBatchBroadcast() {
918939}
919940
920941func (c * chainClientV2 ) GetGasFee () (string , error ) {
921- gasPrices := strings .Trim (c .opts .GasPrices , "inj" )
942+ gasPrices := strings .TrimSuffix (c .txFactory .GasPrices (). String (), client . InjDenom )
922943
923944 gas , err := strconv .ParseFloat (gasPrices , 64 )
924945
0 commit comments