UNPKG

@glitterprotocol/glitter-sdk

Version:

The JavaScript SDK for Glitter

91 lines 3.56 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 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.SQLMsg = void 0; var json_1 = require("../../util/json"); var any_1 = require("@glitterprotocol/glitter.proto/google/protobuf/any"); //import { MsgVerifyInvariant as MsgVerifyInvariant_pb } from '@glitterprotocol/glitter.proto/cosmos/crisis/v1beta1/tx'; var tx_1 = require("@glitterprotocol/glitter.proto/index/tx"); /** * Executes a market swap between 2 denominations at the exchange rate registered by the * Oracle module. The account will lose the amount of coins offered, and receive funds * in the requested denomination after a swap fee has been applied. */ var SQLMsg = /** @class */ (function (_super) { __extends(SQLMsg, _super); /** * @param value SQLExecRequest */ function SQLMsg(uid, sql, args) { var _this = _super.call(this) || this; _this.uid = uid; _this.sql = sql; _this.args = args; return _this; } SQLMsg.fromAmino = function (data, _) { var _a = data.value, uid = _a.uid, sql = _a.sql, args = _a.arguments; return new SQLMsg(uid, sql, args); }; SQLMsg.prototype.toAmino = function (_) { var _a = this, uid = _a.uid, sql = _a.sql, args = _a.args; return { type: 'sql/SQLMsg', value: { uid: uid, sql: sql, arguments: args || [], }, }; }; SQLMsg.fromProto = function (proto, _) { return new SQLMsg(proto.uid, proto.sql, proto.arguments); }; SQLMsg.prototype.toProto = function (_) { var _a = this, uid = _a.uid, sql = _a.sql, args = _a.args; return tx_1.SQLExecRequest.fromPartial({ uid: uid, sql: sql, arguments: args || [], }); }; SQLMsg.prototype.packAny = function (isClassic) { return any_1.Any.fromPartial({ typeUrl: '/blockved.glitterchain.index.SQLExecRequest', value: tx_1.SQLExecRequest.encode(this.toProto(isClassic)).finish(), }); }; SQLMsg.unpackAny = function (msgAny, isClassic) { return SQLMsg.fromProto(tx_1.SQLExecRequest.decode(msgAny.value), isClassic); }; SQLMsg.fromData = function (data, _) { var uid = data.uid, sql = data.sql, args = data.arguments; return new SQLMsg(uid, sql, args); }; SQLMsg.prototype.toData = function (_) { var _a = this, uid = _a.uid, sql = _a.sql, args = _a.args; return { '@type': '/blockved.glitterchain.index.SQLExecRequest', uid: uid, sql: sql, arguments: args || [], }; }; return SQLMsg; }(json_1.JSONSerializable)); exports.SQLMsg = SQLMsg; //# sourceMappingURL=SqlMsg.js.map