UNPKG

@steeveproject/ngx-steem-keychain

Version:
104 lines 2.9 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ import { InvalidArgumentsError } from './errors/invalid-arguments-error'; /* * Operation represents a blockchain operation, * which has a name and some parameters. */ var /* * Operation represents a blockchain operation, * which has a name and some parameters. */ Operation = /** @class */ (function () { function Operation(name, params) { this.name = name; this.params = params; } /* * fromArray can be used to convert [operationName, operationParams] into an Operation. */ /* * fromArray can be used to convert [operationName, operationParams] into an Operation. */ /** * @param {?} operation * @return {?} */ Operation.fromArray = /* * fromArray can be used to convert [operationName, operationParams] into an Operation. */ /** * @param {?} operation * @return {?} */ function (operation) { if (!operation) { throw new InvalidArgumentsError('operation array is unset'); } if (operation.length !== 2) { throw new InvalidArgumentsError('operation array length invalid (must be 2)'); } var name = operation[0], params = operation[1]; if (typeof name !== 'string') { throw new InvalidArgumentsError('operation[0] (operation name) must be a string'); } if (typeof params !== 'object') { throw new InvalidArgumentsError('operation[1] (operation params) must be an object'); } return new Operation(name, params); }; /* * toArray turns [operationName, operationParams]. */ /* * toArray turns [operationName, operationParams]. */ /** * @return {?} */ Operation.prototype.toArray = /* * toArray turns [operationName, operationParams]. */ /** * @return {?} */ function () { return [this.name, this.params]; }; /* * toJSON implements custom JSON serialization. * It simply calls toArray() and returns the result. */ /* * toJSON implements custom JSON serialization. * It simply calls toArray() and returns the result. */ /** * @return {?} */ Operation.prototype.toJSON = /* * toJSON implements custom JSON serialization. * It simply calls toArray() and returns the result. */ /** * @return {?} */ function () { return this.toArray(); }; return Operation; }()); /* * Operation represents a blockchain operation, * which has a name and some parameters. */ export { Operation }; if (false) { /** @type {?} */ Operation.prototype.name; /** @type {?} */ Operation.prototype.params; } //# sourceMappingURL=operation.js.map