diff options
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/routes/payments.js b/routes/payments.js index 38611d19..307e8ef6 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -348,5 +348,29 @@ export default { } else fail("Card payment failed"); res.send({ status }); + }, + + async proxy({ body: { method, params } }, res) { + try { + let whitelist = [ + "getblock", + "getblockhash", + "estimatesmartfee", + "echo", + "getblockchaininfo", + "getnetworkinfo" + ]; + + if (!whitelist.includes(method)) fail("unsupported method"); + + if (method === "estimatesmartfee" || method === "getblockhash") + params[0] = parseInt(params[0]); + + if (method === "getblock") params[1] = parseInt(params[1]); + + res.send(await bc[method](...params)); + } catch (e) { + bail(res, e.message); + } } }; |
