Skip to content

Commit dda57ce

Browse files
fariedtzone117x
authored andcommitted
style: cleanup for lint
In several cases, the request handlers are marked async. Since the code inside them is not implemented in this PR (waiting on the types PR), the linter cannot find an "await" keyword inside the request handlers, and errors out. This temporarily fixes it so lint is happy.
1 parent 3ff3ab1 commit dda57ce

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

src/api/init.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,11 @@ export async function startApiServer(datastore: DataStore): Promise<ApiServer> {
100100
);
101101

102102
// Validation middleware for Rosetta API
103-
app.use('/rosetta/v1', async (req, res, next) => {
103+
app.use('/rosetta/v1', (req, res, next) => {
104104
// await validateRequest(req.originalUrl, req.body);
105105
next();
106106
});
107107

108-
109108
// Setup error handler (must be added at the end of the middleware stack)
110109
app.use(((error, req, res, next) => {
111110
if (error && !res.headersSent) {

src/api/routes/rosetta/account.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export function createRAccountRouter(db: DataStore): RouterWithAsync {
66
const router = addAsync(express.Router());
77
router.use(express.json());
88

9-
router.postAsync('/balance', async (req, res) => {
10-
res.json({status: 'ready'});
9+
router.post('/balance', (req, res) => {
10+
res.json({ status: 'ready' });
1111
});
1212

1313
return router;
14-
};
14+
}

src/api/routes/rosetta/block.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { DataStore } from '../../../datastore/common';
55
export function createRBlockRouter(db: DataStore): RouterWithAsync {
66
const router = addAsync(express.Router());
77

8-
router.postAsync('/', async (req, res) => {
9-
res.json({status: 'ready'});
8+
router.post('/', (req, res) => {
9+
res.json({ status: 'ready' });
1010
});
1111

12-
router.postAsync('/transaction', async (req, res) => {
13-
res.json({status: 'ready'});
12+
router.post('/transaction', (req, res) => {
13+
res.json({ status: 'ready' });
1414
});
1515

1616
return router;
17-
};
17+
}

src/api/routes/rosetta/mempool.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { DataStore } from '../../../datastore/common';
55
export function createRMempoolRouter(db: DataStore): RouterWithAsync {
66
const router = addAsync(express.Router());
77

8-
router.postAsync('/', async (req, res) => {
9-
res.json({status: 'ready'});
8+
router.post('/', (req, res) => {
9+
res.json({ status: 'ready' });
1010
});
1111

12-
router.postAsync('/transaction', async (req, res) => {
13-
res.json({status: 'ready'});
12+
router.post('/transaction', (req, res) => {
13+
res.json({ status: 'ready' });
1414
});
1515

1616
return router;
17-
};
17+
}

src/api/routes/rosetta/network.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
export function createRNetworkRouter(db: DataStore): RouterWithAsync {
1212
const router = addAsync(express.Router());
1313

14-
router.postAsync('/list', async (_req, res) => {
14+
router.post('/list', (_req, res) => {
1515
const response = {
1616
network_identifiers: [
1717
{
@@ -24,11 +24,11 @@ export function createRNetworkRouter(db: DataStore): RouterWithAsync {
2424
res.json(response);
2525
});
2626

27-
router.postAsync('/status', async (req, res) => {
28-
res.json({status: 'ready'});
27+
router.post('/status', (req, res) => {
28+
res.json({ status: 'ready' });
2929
});
3030

31-
router.postAsync('/options', async (_req, res) => {
31+
router.post('/options', (_req, res) => {
3232
const response = {
3333
version: {
3434
rosetta_version: RosettaConstants.rosettaVersion,

0 commit comments

Comments
 (0)