@taquito/taquito
Version:
High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.
53 lines • 2.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TxRollupBatchOperation = void 0;
const bignumber_js_1 = require("bignumber.js");
const operations_1 = require("./operations");
/**
* @description TxRollupBatchOperation provides utility functions to fetch a newly issued operation of kind tx_rollup_submit_batch
*/
class TxRollupBatchOperation 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 txrollupBatchOp = Array.isArray(this.results) &&
this.results.find((op) => op.kind === 'tx_rollup_submit_batch');
const result = txrollupBatchOp && txrollupBatchOp.metadata && txrollupBatchOp.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 content() {
return this.params.content;
}
get fee() {
return this.params.fee;
}
get gasLimit() {
return this.params.gas_limit;
}
get storageLimit() {
return 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.TxRollupBatchOperation = TxRollupBatchOperation;
//# sourceMappingURL=tx-rollup-batch-operation.js.map