Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function handleV2SendOne(req: express.Request) {
const bitgo = req.bitgo;
const coin = bitgo.coin(req.params.coin);
const reqId = new RequestTracer();
const wallet = await coin.wallets().get({ id: req.params.id, reqId });
req.body.reqId = reqId;
let result;
try {
result = await wallet.send(req.body);
} catch (err) {
err.status = 400;
throw err;
}
if (result.status === 'pendingApproval') {
throw apiResponse(202, result);
}
return result;
}
async function handleV2SendMany(req: express.Request) {
const bitgo = req.bitgo;
const coin = bitgo.coin(req.params.coin);
const reqId = new RequestTracer();
const wallet = await coin.wallets().get({ id: req.params.id, reqId });
req.body.reqId = reqId;
let result;
try {
result = await wallet.sendMany(req.body);
} catch (err) {
err.status = 400;
throw err;
}
if (result.status === 'pendingApproval') {
throw apiResponse(202, result);
}
return result;
}