Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GRPC gateway route for listing module and add hard cap setting (backport #2489) #2490

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LCDClient } from "@osmonauts/lcd";
import { QueryListingVaultDepositParams, QueryListingVaultDepositParamsResponseSDKType } from "./query";
import { QueryMarketsHardCap, QueryMarketsHardCapResponseSDKType, QueryListingVaultDepositParams, QueryListingVaultDepositParamsResponseSDKType } from "./query";
export class LCDQueryClient {
req: LCDClient;

Expand All @@ -9,8 +9,16 @@ export class LCDQueryClient {
requestClient: LCDClient;
}) {
this.req = requestClient;
this.marketsHardCap = this.marketsHardCap.bind(this);
this.listingVaultDepositParams = this.listingVaultDepositParams.bind(this);
}
/* Queries for the hard cap number of listed markets */


async marketsHardCap(_params: QueryMarketsHardCap = {}): Promise<QueryMarketsHardCapResponseSDKType> {
const endpoint = `dydxprotocol/listing/markets_hard_cap`;
return await this.req.get<QueryMarketsHardCapResponseSDKType>(endpoint);
}
/* Queries the listing vault deposit params */


Expand Down
5 changes: 4 additions & 1 deletion proto/dydxprotocol/listing/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/listing/types";
// Query defines the gRPC querier service.
service Query {
// Queries for the hard cap number of listed markets
rpc MarketsHardCap(QueryMarketsHardCap) returns (QueryMarketsHardCapResponse);
rpc MarketsHardCap(QueryMarketsHardCap)
returns (QueryMarketsHardCapResponse) {
option (google.api.http).get = "/dydxprotocol/listing/markets_hard_cap";
}

// Queries the listing vault deposit params
rpc ListingVaultDepositParams(QueryListingVaultDepositParams)
Expand Down
5 changes: 5 additions & 0 deletions protocol/x/listing/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package listing

import (
"context"
"encoding/json"
"fmt"

Expand Down Expand Up @@ -76,6 +77,10 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {
panic(err)
}
}

// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to
Expand Down
23 changes: 12 additions & 11 deletions protocol/x/listing/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions protocol/x/listing/types/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading