@mavrykdynamics/taquito
Version:
High level functionality that builds upon the other packages in the Mavryk Typescript Library Suite.
50 lines (49 loc) • 1.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateConsensusKeyOperation = void 0;
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 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;