Skip to content

Commit b96b758

Browse files
committed
GetBondDenom
1 parent 50ffbaf commit b96b758

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

rpc/backend/node_info.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
errorsmod "cosmossdk.io/errors"
2424
sdkmath "cosmossdk.io/math"
2525
distributiontypes "cosmossdk.io/x/distribution/types"
26+
stakingtypes "cosmossdk.io/x/staking/types"
2627
cmttypes "github.com/cometbft/cometbft/types"
2728
"github.com/cosmos/cosmos-sdk/client/flags"
2829
"github.com/cosmos/cosmos-sdk/client/tx"
@@ -278,8 +279,12 @@ func (b *Backend) SetGasPrice(gasPrice hexutil.Big) bool {
278279

279280
// use default base denom in case it's not currently defined on the node config
280281
if len(minGasPrices) == 0 || minGasPrices.Empty() {
281-
// mmsqe stakingKeeper.BondDenom
282-
unit = ethermint.AttoPhoton
282+
params, err := b.queryClient.Staking.Params(b.ctx, &stakingtypes.QueryParamsRequest{})
283+
if err != nil {
284+
b.logger.Debug("could not get the denom of smallest unit registered", "error", err.Error())
285+
return false
286+
}
287+
unit = params.Params.GetBondDenom()
283288
} else {
284289
unit = minGasPrices[0].Denom
285290
}

rpc/backend/node_info_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (suite *BackendTestSuite) TestSetGasPrice() {
8686
suite.backend.clientCtx.Viper = viper.New()
8787
},
8888
*defaultGasPrice,
89-
false, //mmsqe
89+
false,
9090
},
9191
{
9292
"pass - cannot find coin denom",

rpc/types/query_client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
"github.com/cosmos/cosmos-sdk/client"
2727

28+
stakingtypes "cosmossdk.io/x/staking/types"
2829
evmtypes "github.com/evmos/ethermint/x/evm/types"
2930
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
3031
)
@@ -37,6 +38,7 @@ type QueryClient struct {
3738
tx.ServiceClient
3839
evmtypes.QueryClient
3940
FeeMarket feemarkettypes.QueryClient
41+
Staking stakingtypes.QueryClient
4042
}
4143

4244
// NewQueryClient creates a new gRPC query client
@@ -45,6 +47,7 @@ func NewQueryClient(clientCtx client.Context) *QueryClient {
4547
ServiceClient: tx.NewServiceClient(clientCtx),
4648
QueryClient: evmtypes.NewQueryClient(clientCtx),
4749
FeeMarket: feemarkettypes.NewQueryClient(clientCtx),
50+
Staking: stakingtypes.NewQueryClient(clientCtx),
4851
}
4952
}
5053

0 commit comments

Comments
 (0)