stellar-plus
Version:
beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain
28 lines (27 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtractAuthEntriesFromSimulationPlugin = void 0;
const tslib_1 = require("tslib");
const types_1 = require("../../../../../../stellar-plus/core/pipelines/simulate-transaction/types");
class ExtractAuthEntriesFromSimulationPlugin {
constructor() {
this.type = types_1.SimulateTransactionPipelineType.id;
this.name = 'ExtractAuthEntriesPlugin';
}
postProcess(item, _meta) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { response, output } = item;
if (!response.result) {
// TODO:
// implement error handling here and migrate older CE Error
// throw CEError.simulationMissingResult(simulated)
throw new Error('simulationMissingResult');
}
const auth = response.result.auth;
const pluginOutput = { auth };
const updatedItem = Object.assign(Object.assign({}, item), { output: Object.assign(Object.assign({}, output), pluginOutput) });
return updatedItem;
});
}
}
exports.ExtractAuthEntriesFromSimulationPlugin = ExtractAuthEntriesFromSimulationPlugin;