/
gas_price.go
35 lines (29 loc) · 967 Bytes
/
gas_price.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
package v2
import (
"context"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/gogo/protobuf/grpc"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
)
// Querier
// Deprecated
type Querier struct{}
var _ QueryServer = Querier{}
// GetGasPrice
// Deprecated
func (q Querier) GetGasPrice(c context.Context, _ *GetGasPriceRequest) (*GetGasPriceResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
var gasPrices sdk.Coins
for _, coin := range ctx.MinGasPrices() {
gasPrices = append(gasPrices, sdk.NewCoin(coin.Denom, coin.Amount.TruncateInt()))
}
return &GetGasPriceResponse{GasPrices: gasPrices}, nil
}
// RegisterGRPCGatewayRoutes
// Deprecated
func RegisterGRPCGatewayRoutes(clientConn grpc.ClientConn, mux *runtime.ServeMux) {
if err := RegisterQueryHandlerClient(context.Background(), mux, NewQueryClient(clientConn)); err != nil {
panic(fmt.Sprintf("failed to %s register grpc gateway routes: %s", "legacy gas price", err.Error()))
}
}