Skip to content

Commit

Permalink
add megavault owner shares query (#2323)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqin7 authored Sep 23, 2024
1 parent 79db31a commit 0601feb
Show file tree
Hide file tree
Showing 9 changed files with 1,359 additions and 139 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { setPaginationParams } from "../../helpers";
import { LCDClient } from "@osmonauts/lcd";
import { QueryParamsRequest, QueryParamsResponseSDKType, QueryVaultRequest, QueryVaultResponseSDKType, QueryAllVaultsRequest, QueryAllVaultsResponseSDKType, QueryMegavaultTotalSharesRequest, QueryMegavaultTotalSharesResponseSDKType, QueryMegavaultOwnerSharesRequest, QueryMegavaultOwnerSharesResponseSDKType, QueryVaultParamsRequest, QueryVaultParamsResponseSDKType, QueryMegavaultWithdrawalInfoRequest, QueryMegavaultWithdrawalInfoResponseSDKType } from "./query";
import { QueryParamsRequest, QueryParamsResponseSDKType, QueryVaultRequest, QueryVaultResponseSDKType, QueryAllVaultsRequest, QueryAllVaultsResponseSDKType, QueryMegavaultTotalSharesRequest, QueryMegavaultTotalSharesResponseSDKType, QueryMegavaultOwnerSharesRequest, QueryMegavaultOwnerSharesResponseSDKType, QueryMegavaultAllOwnerSharesRequest, QueryMegavaultAllOwnerSharesResponseSDKType, QueryVaultParamsRequest, QueryVaultParamsResponseSDKType, QueryMegavaultWithdrawalInfoRequest, QueryMegavaultWithdrawalInfoResponseSDKType } from "./query";
export class LCDQueryClient {
req: LCDClient;

Expand All @@ -15,6 +15,7 @@ export class LCDQueryClient {
this.allVaults = this.allVaults.bind(this);
this.megavaultTotalShares = this.megavaultTotalShares.bind(this);
this.megavaultOwnerShares = this.megavaultOwnerShares.bind(this);
this.megavaultAllOwnerShares = this.megavaultAllOwnerShares.bind(this);
this.vaultParams = this.vaultParams.bind(this);
this.megavaultWithdrawalInfo = this.megavaultWithdrawalInfo.bind(this);
}
Expand Down Expand Up @@ -59,9 +60,16 @@ export class LCDQueryClient {
/* Queries owner shares of megavault. */


async megavaultOwnerShares(params: QueryMegavaultOwnerSharesRequest = {
async megavaultOwnerShares(params: QueryMegavaultOwnerSharesRequest): Promise<QueryMegavaultOwnerSharesResponseSDKType> {
const endpoint = `dydxprotocol/vault/megavault/owner_shares/${params.address}`;
return await this.req.get<QueryMegavaultOwnerSharesResponseSDKType>(endpoint);
}
/* Queries all owner shares of megavault. */


async megavaultAllOwnerShares(params: QueryMegavaultAllOwnerSharesRequest = {
pagination: undefined
}): Promise<QueryMegavaultOwnerSharesResponseSDKType> {
}): Promise<QueryMegavaultAllOwnerSharesResponseSDKType> {
const options: any = {
params: {}
};
Expand All @@ -70,8 +78,8 @@ export class LCDQueryClient {
setPaginationParams(options, params.pagination);
}

const endpoint = `dydxprotocol/vault/megavault/owner_shares`;
return await this.req.get<QueryMegavaultOwnerSharesResponseSDKType>(endpoint, options);
const endpoint = `dydxprotocol/vault/megavault/all_owner_shares`;
return await this.req.get<QueryMegavaultAllOwnerSharesResponseSDKType>(endpoint, options);
}
/* Queries vault params of a vault. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
import { QueryParamsRequest, QueryParamsResponse, QueryVaultRequest, QueryVaultResponse, QueryAllVaultsRequest, QueryAllVaultsResponse, QueryMegavaultTotalSharesRequest, QueryMegavaultTotalSharesResponse, QueryMegavaultOwnerSharesRequest, QueryMegavaultOwnerSharesResponse, QueryVaultParamsRequest, QueryVaultParamsResponse, QueryMegavaultWithdrawalInfoRequest, QueryMegavaultWithdrawalInfoResponse } from "./query";
import { QueryParamsRequest, QueryParamsResponse, QueryVaultRequest, QueryVaultResponse, QueryAllVaultsRequest, QueryAllVaultsResponse, QueryMegavaultTotalSharesRequest, QueryMegavaultTotalSharesResponse, QueryMegavaultOwnerSharesRequest, QueryMegavaultOwnerSharesResponse, QueryMegavaultAllOwnerSharesRequest, QueryMegavaultAllOwnerSharesResponse, QueryVaultParamsRequest, QueryVaultParamsResponse, QueryMegavaultWithdrawalInfoRequest, QueryMegavaultWithdrawalInfoResponse } from "./query";
/** Query defines the gRPC querier service. */

export interface Query {
Expand All @@ -18,7 +18,10 @@ export interface Query {
megavaultTotalShares(request?: QueryMegavaultTotalSharesRequest): Promise<QueryMegavaultTotalSharesResponse>;
/** Queries owner shares of megavault. */

megavaultOwnerShares(request?: QueryMegavaultOwnerSharesRequest): Promise<QueryMegavaultOwnerSharesResponse>;
megavaultOwnerShares(request: QueryMegavaultOwnerSharesRequest): Promise<QueryMegavaultOwnerSharesResponse>;
/** Queries all owner shares of megavault. */

megavaultAllOwnerShares(request?: QueryMegavaultAllOwnerSharesRequest): Promise<QueryMegavaultAllOwnerSharesResponse>;
/** Queries vault params of a vault. */

vaultParams(request: QueryVaultParamsRequest): Promise<QueryVaultParamsResponse>;
Expand All @@ -36,6 +39,7 @@ export class QueryClientImpl implements Query {
this.allVaults = this.allVaults.bind(this);
this.megavaultTotalShares = this.megavaultTotalShares.bind(this);
this.megavaultOwnerShares = this.megavaultOwnerShares.bind(this);
this.megavaultAllOwnerShares = this.megavaultAllOwnerShares.bind(this);
this.vaultParams = this.vaultParams.bind(this);
this.megavaultWithdrawalInfo = this.megavaultWithdrawalInfo.bind(this);
}
Expand Down Expand Up @@ -66,14 +70,20 @@ export class QueryClientImpl implements Query {
return promise.then(data => QueryMegavaultTotalSharesResponse.decode(new _m0.Reader(data)));
}

megavaultOwnerShares(request: QueryMegavaultOwnerSharesRequest = {
pagination: undefined
}): Promise<QueryMegavaultOwnerSharesResponse> {
megavaultOwnerShares(request: QueryMegavaultOwnerSharesRequest): Promise<QueryMegavaultOwnerSharesResponse> {
const data = QueryMegavaultOwnerSharesRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.vault.Query", "MegavaultOwnerShares", data);
return promise.then(data => QueryMegavaultOwnerSharesResponse.decode(new _m0.Reader(data)));
}

megavaultAllOwnerShares(request: QueryMegavaultAllOwnerSharesRequest = {
pagination: undefined
}): Promise<QueryMegavaultAllOwnerSharesResponse> {
const data = QueryMegavaultAllOwnerSharesRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.vault.Query", "MegavaultAllOwnerShares", data);
return promise.then(data => QueryMegavaultAllOwnerSharesResponse.decode(new _m0.Reader(data)));
}

vaultParams(request: QueryVaultParamsRequest): Promise<QueryVaultParamsResponse> {
const data = QueryVaultParamsRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.vault.Query", "VaultParams", data);
Expand Down Expand Up @@ -107,10 +117,14 @@ export const createRpcQueryExtension = (base: QueryClient) => {
return queryService.megavaultTotalShares(request);
},

megavaultOwnerShares(request?: QueryMegavaultOwnerSharesRequest): Promise<QueryMegavaultOwnerSharesResponse> {
megavaultOwnerShares(request: QueryMegavaultOwnerSharesRequest): Promise<QueryMegavaultOwnerSharesResponse> {
return queryService.megavaultOwnerShares(request);
},

megavaultAllOwnerShares(request?: QueryMegavaultAllOwnerSharesRequest): Promise<QueryMegavaultAllOwnerSharesResponse> {
return queryService.megavaultAllOwnerShares(request);
},

vaultParams(request: QueryVaultParamsRequest): Promise<QueryVaultParamsResponse> {
return queryService.vaultParams(request);
},
Expand Down
Loading

0 comments on commit 0601feb

Please sign in to comment.