Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
feruzm committed Apr 17, 2023
1 parent e3cb6aa commit 4a29352
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/server/handlers/xapi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,22 @@ export default async (req: express.Request, res: express.Response) => {
if (result === undefined) {
// const method_type:any = (mapping[0].param_type && mapping[0].param_type === 'params') ? params : query;
let method_type: any = mapping[0].isArray ? params : query;

// custom handling of account history, filter with operations
if (method == 'get_account_history') {
const ops = utils.operationOrders;
const {operation_type} = method_type;
const mops = operation_type.split(',');
let filters;

if (mops.length === 1) {
const filters = utils.makeBitMaskFilter([ops[`${mops[0]}`]]);
method_type.operation_filter_low = Number(filters[0]);
method_type.operation_filter_high = filters[1];
delete method_type.operation_type;
filters = utils.makeBitMaskFilter([ops[`${mops[0]}`]]);
} else {
const filters = utils.makeBitMaskFilter(mops.map((x: string) => ops[`${x}`]));
method_type.operation_filter_low = Number(filters[0]);
method_type.operation_filter_high = filters[1];
delete method_type.operation_type;
filters = utils.makeBitMaskFilter(mops.map((x: string) => ops[`${x}`]));
}
method_type.operation_filter_low = Number(filters[0]);
method_type.operation_filter_high = filters[1];
delete method_type.operation_type;
}
result = await client.call(mapping[0].api, method, method_type);
}
Expand Down

0 comments on commit 4a29352

Please sign in to comment.