@taquito/taquito
Version:
High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.
56 lines • 2.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegisterGlobalConstantOperation = void 0;
const bignumber_js_1 = require("bignumber.js");
const operations_1 = require("./operations");
/**
* @description RegisterGlobalConstantOperation provides utility functions to fetch a newly issued operation of kind register_global_constant
*/
class RegisterGlobalConstantOperation extends operations_1.Operation {
constructor(hash, params, source, raw, results, context) {
super(hash, raw, results, context);
this.params = params;
this.source = source;
this.globalConstantHash = this.operationResults && this.operationResults.global_address;
}
get operationResults() {
const registerGlobalConstantOp = Array.isArray(this.results) &&
this.results.find((op) => op.kind === 'register_global_constant');
const result = registerGlobalConstantOp &&
registerGlobalConstantOp.metadata &&
registerGlobalConstantOp.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 registeredExpression() {
return this.params.value;
}
get fee() {
return Number(this.params.fee);
}
get gasLimit() {
return Number(this.params.gas_limit);
}
get storageLimit() {
return Number(this.params.storage_limit);
}
get errors() {
var _a;
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
}
get consumedGas() {
bignumber_js_1.BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.BigNumber.ROUND_UP });
return this.consumedMilliGas
? new bignumber_js_1.BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
: undefined;
}
get consumedMilliGas() {
var _a;
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
}
}
exports.RegisterGlobalConstantOperation = RegisterGlobalConstantOperation;
//# sourceMappingURL=register-global-constant-operation.js.map