Skip to content

Instantly share code, notes, and snippets.

@linux08
Created November 4, 2018 23:32
Show Gist options
  • Save linux08/6b45b2c62da0eabce588637dff3fda85 to your computer and use it in GitHub Desktop.
Save linux08/6b45b2c62da0eabce588637dff3fda85 to your computer and use it in GitHub Desktop.
exports.postData = async (req, res, next) => {
try {
const { hash } = req.data[0];
const accounts = await web3.eth.getAccounts();
const resp = await SavingContract.methods.saveHash(hash)
.send({
from: accounts[0],
});
const data = Object.assign({ ipfsHash: hash }, resp);
req.data = data;
next();
} catch (err) {
res.status(500).send(err.message);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment