Skip to content

Commit

Permalink
register vault http queries (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqin7 authored Apr 3, 2024
1 parent be1b8ef commit 1104c18
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export class LCDQueryClient {


async params(_params: QueryParamsRequest = {}): Promise<QueryParamsResponseSDKType> {
const endpoint = `dydxprotocol/v4/vault/params`;
const endpoint = `dydxprotocol/vault/params`;
return await this.req.get<QueryParamsResponseSDKType>(endpoint);
}
/* Queries a Vault by type and number. */


async vault(params: QueryVaultRequest): Promise<QueryVaultResponseSDKType> {
const endpoint = `dydxprotocol/v4/vault/vaults/${params.type}/${params.number}`;
const endpoint = `dydxprotocol/vault/vault/${params.type}/${params.number}`;
return await this.req.get<QueryVaultResponseSDKType>(endpoint);
}

Expand Down
5 changes: 2 additions & 3 deletions proto/dydxprotocol/vault/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/vault/types";
service Query {
// Queries the Params.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/dydxprotocol/v4/vault/params";
option (google.api.http).get = "/dydxprotocol/vault/params";
}
// Queries a Vault by type and number.
rpc Vault(QueryVaultRequest) returns (QueryVaultResponse) {
option (google.api.http).get =
"/dydxprotocol/v4/vault/vaults/{type}/{number}";
option (google.api.http).get = "/dydxprotocol/vault/vault/{type}/{number}";
}
}

Expand Down
7 changes: 6 additions & 1 deletion protocol/x/vault/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ 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) {}
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
// generate new transactions containing messages defined in the module.
Expand Down
66 changes: 33 additions & 33 deletions protocol/x/vault/types/query.pb.go

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

4 changes: 2 additions & 2 deletions protocol/x/vault/types/query.pb.gw.go

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

0 comments on commit 1104c18

Please sign in to comment.