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

[TRA-461] define MsgWithdrawFromVault proto #1815

Merged
merged 14 commits into from
Jul 1, 2024
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Params, ParamsSDKType } from "./params";
import { VaultId, VaultIdSDKType, NumShares, NumSharesSDKType } from "./vault";
import { OwnerShare, OwnerShareSDKType } from "./query";
import { VaultId, VaultIdSDKType, NumShares, NumSharesSDKType, OwnerShare, OwnerShareSDKType } from "./vault";
import * as _m0 from "protobufjs/minimal";
import { DeepPartial } from "../../helpers";
/** GenesisState defines `x/vault`'s genesis state. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType, NumShares, NumSharesSDKType } from "./vault";
import { VaultType, VaultTypeSDKType, VaultId, VaultIdSDKType, OwnerShare, OwnerShareSDKType } from "./vault";
import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination";
import { Params, ParamsSDKType } from "./params";
import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount";
Expand Down Expand Up @@ -86,18 +86,6 @@ export interface QueryOwnerSharesRequestSDKType {
number: number;
pagination?: PageRequestSDKType;
}
/** OwnerShare is a type for owner shares in a vault. */

export interface OwnerShare {
owner: string;
shares?: NumShares;
}
/** OwnerShare is a type for owner shares in a vault. */

export interface OwnerShareSDKType {
owner: string;
shares?: NumSharesSDKType;
}
/** QueryOwnerSharesResponse is a response type for the OwnerShares RPC method. */

export interface QueryOwnerSharesResponse {
Expand Down Expand Up @@ -495,61 +483,6 @@ export const QueryOwnerSharesRequest = {

};

function createBaseOwnerShare(): OwnerShare {
return {
owner: "",
shares: undefined
};
}

export const OwnerShare = {
encode(message: OwnerShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.owner !== "") {
writer.uint32(10).string(message.owner);
}

if (message.shares !== undefined) {
NumShares.encode(message.shares, writer.uint32(18).fork()).ldelim();
}

return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): OwnerShare {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOwnerShare();

while (reader.pos < end) {
const tag = reader.uint32();

switch (tag >>> 3) {
case 1:
message.owner = reader.string();
break;

case 2:
message.shares = NumShares.decode(reader, reader.uint32());
break;

default:
reader.skipType(tag & 7);
break;
}
}

return message;
},

fromPartial(object: DeepPartial<OwnerShare>): OwnerShare {
const message = createBaseOwnerShare();
message.owner = object.owner ?? "";
message.shares = object.shares !== undefined && object.shares !== null ? NumShares.fromPartial(object.shares) : undefined;
return message;
}

};

function createBaseQueryOwnerSharesResponse(): QueryOwnerSharesResponse {
return {
ownerShares: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Rpc } from "../../helpers";
import * as _m0 from "protobufjs/minimal";
import { MsgDepositToVault, MsgDepositToVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
import { MsgDepositToVault, MsgDepositToVaultResponse, MsgWithdrawFromVault, MsgWithdrawFromVaultResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
/** Msg defines the Msg service. */

export interface Msg {
/** DepositToVault deposits funds into a vault. */
depositToVault(request: MsgDepositToVault): Promise<MsgDepositToVaultResponse>;
/** WithdrawFromVault attempts to withdraw funds from a vault. */

withdrawFromVault(request: MsgWithdrawFromVault): Promise<MsgWithdrawFromVaultResponse>;
/** UpdateParams updates the Params in state. */

updateParams(request: MsgUpdateParams): Promise<MsgUpdateParamsResponse>;
Expand All @@ -16,6 +19,7 @@ export class MsgClientImpl implements Msg {
constructor(rpc: Rpc) {
this.rpc = rpc;
this.depositToVault = this.depositToVault.bind(this);
this.withdrawFromVault = this.withdrawFromVault.bind(this);
this.updateParams = this.updateParams.bind(this);
}

Expand All @@ -25,6 +29,12 @@ export class MsgClientImpl implements Msg {
return promise.then(data => MsgDepositToVaultResponse.decode(new _m0.Reader(data)));
}

withdrawFromVault(request: MsgWithdrawFromVault): Promise<MsgWithdrawFromVaultResponse> {
const data = MsgWithdrawFromVault.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.vault.Msg", "WithdrawFromVault", data);
return promise.then(data => MsgWithdrawFromVaultResponse.decode(new _m0.Reader(data)));
}

updateParams(request: MsgUpdateParams): Promise<MsgUpdateParamsResponse> {
const data = MsgUpdateParams.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.vault.Msg", "UpdateParams", data);
Expand Down
Loading
Loading