Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (verified === false) {
res.status(403);
res.json({ message: 'Signature is not valid' });
}
const recipient = process.env.NETWORK === 'testnet' ? address(process.env.SPONSOR_SEED, 'T') : address(process.env.SPONSOR_SEED);
const signedTranserTx = transfer({
amount: 1,
recipient: recipient,
assetId: process.env.ASSET_ID,
feeAssetId: process.env.ASSET_ID,
chainId: process.env.NETWORK === 'testnet' ? 'T' : 'W',
attachment: Base58.encode(Buffer.from(ipfsHash))
}, process.env.SPONSOR_SEED);
broadcast(signedTranserTx, process.env.NODE_URL)
.then(tx => {
res.json({tx: tx});
})
.catch(e => {
console.log('Error', e);
res.status(400)
res.json({'error': e.message});
})
});