UNPKG

@taquito/taquito

Version:

High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.

59 lines (58 loc) 2.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateConsensusKeyOperation = void 0; const core_1 = require("@taquito/core"); const operations_1 = require("./operations"); /** * * @description UpdateConsensusKeyOperation provides utility to fetch properties for Operation of kind UpdateConsensusKey * */ class UpdateConsensusKeyOperation extends operations_1.Operation { constructor(hash, params, source, raw, results, context) { super(hash, raw, results, context); this.params = params; this.source = source; } get operationResults() { const updateConsensusKeyOp = Array.isArray(this.results) && this.results.find((op) => op.kind === 'update_consensus_key'); const result = updateConsensusKeyOp && updateConsensusKeyOp.metadata && updateConsensusKeyOp.metadata.operation_result; return result ? result : undefined; } get status() { var _a, _b; return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown'; } get fee() { return Number(this.params.fee); } get gasLimit() { return Number(this.params.gas_limit); } get storageLimit() { return Number(this.params.storage_limit); } get pk() { return this.params.pk; } get proof() { if (this.params.proof) { return this.params.proof; } else { throw new core_1.ProhibitedActionError('Only updating consensus key to a BLS account has proof'); } } get consumedMilliGas() { var _a; return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas; } get errors() { var _a; return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors; } } exports.UpdateConsensusKeyOperation = UpdateConsensusKeyOperation;