Skip to content

Commit

Permalink
chore(core-api): custom entity fees for register/update/resign (#4029)
Browse files Browse the repository at this point in the history
  • Loading branch information
air1one committed Sep 15, 2020
1 parent 64b63b5 commit ed835c2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
9 changes: 3 additions & 6 deletions __tests__/integration/core-api/handlers/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,9 @@ describe("API 2.0 - Transactions", () => {
vote: "100000000",
},
"2": {
bridgechainRegistration: "5000000000",
bridgechainResignation: "5000000000",
bridgechainUpdate: "5000000000",
businessRegistration: "5000000000",
businessResignation: "5000000000",
businessUpdate: "5000000000",
entityRegistration: "5000000000",
entityResignation: "500000000",
entityUpdate: "500000000",
},
});
});
Expand Down
28 changes: 27 additions & 1 deletion packages/core-api/src/handlers/node/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,33 @@ export class NodeController extends Controller {
};
}

return { meta: { days: request.query.days }, data: groupedByTypeGroup };
return {
meta: { days: request.query.days },
data: {
...groupedByTypeGroup,
// TODO remove below in 3.0 and extend api response from magistrate
"2": {
entityRegistration: {
avg: "5000000000",
max: "5000000000",
min: "5000000000",
sum: "0",
},
entityResignation: {
avg: "500000000",
max: "500000000",
min: "500000000",
sum: "0",
},
entityUpdate: {
avg: "500000000",
max: "500000000",
min: "500000000",
sum: "0",
},
},
},
};
}

public async debug(request: Hapi.Request, h) {
Expand Down
12 changes: 11 additions & 1 deletion packages/core-api/src/handlers/transactions/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,17 @@ export class TransactionsController extends Controller {
typeGroups[typeGroup][key] = constructor.staticFee({ height: currentHeight }).toFixed();
}

return { data: typeGroups };
return {
data: {
...typeGroups,
// TODO remove below in 3.0 and extend api response from magistrate
"2": {
entityRegistration: "5000000000",
entityResignation: "500000000",
entityUpdate: "500000000",
},
},
};
} catch (error) {
return Boom.badImplementation(error);
}
Expand Down

0 comments on commit ed835c2

Please sign in to comment.