Skip to content

Commit

Permalink
pass shares to withdraw in megavault withdrawal query rest endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
tqin7 committed Oct 30, 2024
1 parent f6101a3 commit 46d73e7
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 113 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, QueryMegavaultAllOwnerSharesRequest, QueryMegavaultAllOwnerSharesResponseSDKType, QueryVaultParamsRequest, QueryVaultParamsResponseSDKType, QueryMegavaultWithdrawalInfoRequest, QueryMegavaultWithdrawalInfoResponseSDKType } from "./query";
import { QueryParamsRequest, QueryParamsResponseSDKType, QueryVaultRequest, QueryVaultResponseSDKType, QueryAllVaultsRequest, QueryAllVaultsResponseSDKType, QueryMegavaultTotalSharesRequest, QueryMegavaultTotalSharesResponseSDKType, QueryMegavaultOwnerSharesRequest, QueryMegavaultOwnerSharesResponseSDKType, QueryMegavaultAllOwnerSharesRequest, QueryMegavaultAllOwnerSharesResponseSDKType, QueryVaultParamsRequest, QueryVaultParamsResponseSDKType } from "./query";
export class LCDQueryClient {
req: LCDClient;

Expand All @@ -17,7 +17,6 @@ export class LCDQueryClient {
this.megavaultOwnerShares = this.megavaultOwnerShares.bind(this);
this.megavaultAllOwnerShares = this.megavaultAllOwnerShares.bind(this);
this.vaultParams = this.vaultParams.bind(this);
this.megavaultWithdrawalInfo = this.megavaultWithdrawalInfo.bind(this);
}
/* Queries the Params. */

Expand Down Expand Up @@ -88,20 +87,5 @@ export class LCDQueryClient {
const endpoint = `dydxprotocol/vault/params/${params.type}/${params.number}`;
return await this.req.get<QueryVaultParamsResponseSDKType>(endpoint);
}
/* Queries withdrawal info for megavault. */


async megavaultWithdrawalInfo(params: QueryMegavaultWithdrawalInfoRequest): Promise<QueryMegavaultWithdrawalInfoResponseSDKType> {
const options: any = {
params: {}
};

if (typeof params?.sharesToWithdraw !== "undefined") {
options.params.shares_to_withdraw = params.sharesToWithdraw;
}

const endpoint = `dydxprotocol/vault/megavault/withdrawal_info`;
return await this.req.get<QueryMegavaultWithdrawalInfoResponseSDKType>(endpoint, options);
}

}
6 changes: 4 additions & 2 deletions proto/dydxprotocol/vault/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ service Query {
// Queries withdrawal info for megavault.
rpc MegavaultWithdrawalInfo(QueryMegavaultWithdrawalInfoRequest)
returns (QueryMegavaultWithdrawalInfoResponse) {
option (google.api.http).get =
"/dydxprotocol/vault/megavault/withdrawal_info";
option (google.api.http) = {
post: "/dydxprotocol/vault/megavault/withdrawal_info"
body: "*"
};
}
}

Expand Down
164 changes: 82 additions & 82 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.

Loading

0 comments on commit 46d73e7

Please sign in to comment.