UNPKG

@pokt-network/pocket-js

Version:

Pocket-js core package with the main functionalities to interact with the Pocket Network.

69 lines 2.65 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.MsgProtoAppUnstake = void 0; var tx_signer_1 = require("./../proto/generated/tx-signer"); var any_1 = require("../proto/generated/google/protobuf/any"); var tx_msg_1 = require("./tx-msg"); var utils_1 = require("./../../../utils"); /** * Model representing a MsgAppStake to unstake an Application in the Pocket Network */ var MsgProtoAppUnstake = /** @class */ (function (_super) { __extends(MsgProtoAppUnstake, _super); /** * The address hex of the Application to unstake for * @param {string} appAddress - Application address */ function MsgProtoAppUnstake(appAddress) { var _this = _super.call(this) || this; _this.KEY = "/x.apps.MsgBeginUnstake"; _this.AMINO_KEY = "apps/MsgAppBeginUnstake"; _this.appAddress = appAddress; var errorOrUndefined = utils_1.validateAddressHex(_this.appAddress); if (utils_1.typeGuard(errorOrUndefined, Error)) { throw errorOrUndefined; } return _this; } /** * Converts an Msg Object to StdSignDoc * @returns {object} - Msg type key value. * @memberof MsgAppUnstake */ MsgProtoAppUnstake.prototype.toStdSignDocMsgObj = function () { return { type: this.AMINO_KEY, value: { application_address: this.appAddress.toLowerCase() } }; }; /** * Converts an Msg Object to StdSignDoc * @returns {any} - Msg type key value. * @memberof MsgAppUnstake */ MsgProtoAppUnstake.prototype.toStdTxMsgObj = function () { var data = { Address: Buffer.from(this.appAddress, "hex") }; return any_1.Any.fromJSON({ "typeUrl": this.KEY, "value": Buffer.from(tx_signer_1.MsgBeginUnstake.encode(data).finish()).toString("base64") }); }; return MsgProtoAppUnstake; }(tx_msg_1.TxMsg)); exports.MsgProtoAppUnstake = MsgProtoAppUnstake; //# sourceMappingURL=msg-proto-app-unstake.js.map