@bandprotocol/bandchain.js
Version:
TypeScript library for Cosmos SDK and BandChain
69 lines (68 loc) • 4.26 kB
JavaScript
import { BinaryReader } from "../../../binary";
import { MsgCreateTunnel, MsgCreateTunnelResponse, MsgUpdateRoute, MsgUpdateRouteResponse, MsgUpdateSignalsAndInterval, MsgUpdateSignalsAndIntervalResponse, MsgWithdrawFeePayerFunds, MsgWithdrawFeePayerFundsResponse, MsgActivateTunnel, MsgActivateTunnelResponse, MsgDeactivateTunnel, MsgDeactivateTunnelResponse, MsgTriggerTunnel, MsgTriggerTunnelResponse, MsgDepositToTunnel, MsgDepositToTunnelResponse, MsgWithdrawFromTunnel, MsgWithdrawFromTunnelResponse, MsgUpdateParams, MsgUpdateParamsResponse } from "./tx";
export class MsgClientImpl {
rpc;
constructor(rpc) {
this.rpc = rpc;
this.createTunnel = this.createTunnel.bind(this);
this.updateRoute = this.updateRoute.bind(this);
this.updateSignalsAndInterval = this.updateSignalsAndInterval.bind(this);
this.withdrawFeePayerFunds = this.withdrawFeePayerFunds.bind(this);
this.activateTunnel = this.activateTunnel.bind(this);
this.deactivateTunnel = this.deactivateTunnel.bind(this);
this.triggerTunnel = this.triggerTunnel.bind(this);
this.depositToTunnel = this.depositToTunnel.bind(this);
this.withdrawFromTunnel = this.withdrawFromTunnel.bind(this);
this.updateParams = this.updateParams.bind(this);
}
createTunnel(request) {
const data = MsgCreateTunnel.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "CreateTunnel", data);
return promise.then(data => MsgCreateTunnelResponse.decode(new BinaryReader(data)));
}
updateRoute(request) {
const data = MsgUpdateRoute.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "UpdateRoute", data);
return promise.then(data => MsgUpdateRouteResponse.decode(new BinaryReader(data)));
}
updateSignalsAndInterval(request) {
const data = MsgUpdateSignalsAndInterval.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "UpdateSignalsAndInterval", data);
return promise.then(data => MsgUpdateSignalsAndIntervalResponse.decode(new BinaryReader(data)));
}
withdrawFeePayerFunds(request) {
const data = MsgWithdrawFeePayerFunds.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "WithdrawFeePayerFunds", data);
return promise.then(data => MsgWithdrawFeePayerFundsResponse.decode(new BinaryReader(data)));
}
activateTunnel(request) {
const data = MsgActivateTunnel.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "ActivateTunnel", data);
return promise.then(data => MsgActivateTunnelResponse.decode(new BinaryReader(data)));
}
deactivateTunnel(request) {
const data = MsgDeactivateTunnel.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "DeactivateTunnel", data);
return promise.then(data => MsgDeactivateTunnelResponse.decode(new BinaryReader(data)));
}
triggerTunnel(request) {
const data = MsgTriggerTunnel.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "TriggerTunnel", data);
return promise.then(data => MsgTriggerTunnelResponse.decode(new BinaryReader(data)));
}
depositToTunnel(request) {
const data = MsgDepositToTunnel.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "DepositToTunnel", data);
return promise.then(data => MsgDepositToTunnelResponse.decode(new BinaryReader(data)));
}
withdrawFromTunnel(request) {
const data = MsgWithdrawFromTunnel.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "WithdrawFromTunnel", data);
return promise.then(data => MsgWithdrawFromTunnelResponse.decode(new BinaryReader(data)));
}
updateParams(request) {
const data = MsgUpdateParams.encode(request).finish();
const promise = this.rpc.request("band.tunnel.v1beta1.Msg", "UpdateParams", data);
return promise.then(data => MsgUpdateParamsResponse.decode(new BinaryReader(data)));
}
}