diff --git a/src/api.ts b/src/api.ts index 70b9369..263f751 100644 --- a/src/api.ts +++ b/src/api.ts @@ -72,10 +72,18 @@ router.post('/', async (req, res) => { }); } + let address; + try { + address = getAddress(req.body.address); + } catch (e: any) { + return res.status(400).json({ + error: 'Invalid address' + }); + } + try { const msg = req.body.data.message; const msgHash = snapshot.utils.getHash(req.body.data); - const address = getAddress(req.body.address); const env = 'livenet'; let network = env === 'livenet' ? '1' : '5'; if (!req.body.data.types.Space && !msg.settings)