stellar-plus
Version:
beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain
27 lines (26 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtractFeeChargedPlugin = void 0;
const tslib_1 = require("tslib");
const types_1 = require("../../../../../../stellar-plus/core/pipelines/soroban-get-transaction/types");
class ExtractFeeChargedPlugin {
constructor(callback) {
this.type = types_1.SorobanGetTransactionPipelineType.id;
this.name = 'ExtractFeeChargedPlugin';
this.callback = callback;
}
postProcess(item, _meta) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { response, output } = item;
const feeCharged = response.resultXdr.feeCharged().toString();
const pluginOutput = {
feeCharged,
};
if (this.callback) {
this.callback(pluginOutput, _meta.itemId);
}
return Object.assign(Object.assign({}, item), { output: Object.assign(Object.assign({}, output), pluginOutput) });
});
}
}
exports.ExtractFeeChargedPlugin = ExtractFeeChargedPlugin;