@bandprotocol/bandchain.js
Version:
TypeScript library for Cosmos SDK and BandChain
27 lines (26 loc) • 1.21 kB
JavaScript
import { BinaryReader } from "../../../binary";
import { MsgStake, MsgStakeResponse, MsgUnstake, MsgUnstakeResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
export class MsgClientImpl {
rpc;
constructor(rpc) {
this.rpc = rpc;
this.stake = this.stake.bind(this);
this.unstake = this.unstake.bind(this);
this.updateParams = this.updateParams.bind(this);
}
stake(request) {
const data = MsgStake.encode(request).finish();
const promise = this.rpc.request("band.restake.v1beta1.Msg", "Stake", data);
return promise.then(data => MsgStakeResponse.decode(new BinaryReader(data)));
}
unstake(request) {
const data = MsgUnstake.encode(request).finish();
const promise = this.rpc.request("band.restake.v1beta1.Msg", "Unstake", data);
return promise.then(data => MsgUnstakeResponse.decode(new BinaryReader(data)));
}
updateParams(request) {
const data = MsgUpdateParams.encode(request).finish();
const promise = this.rpc.request("band.restake.v1beta1.Msg", "UpdateParams", data);
return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data)));
}
}