Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. event documentAdded(
  2. uint id
  3. );
  4.  
  5. function sendDocument(
  6. string memory _ipfsLocation,
  7. uint256 _uploadDate
  8. )
  9. public
  10. {
  11. documentCount ++;
  12. ListOfDocuments[documentCount] = documentStore(documentCount, _ipfsLocation, msg.sender, _uploadDate);
  13. emit documentAdded(documentCount);
  14. }
  15.  
  16. var event = storehash.events.documentAdded()
  17.  
  18. event.watch(
  19. function(error, result) {
  20. if (!error)
  21. this.setState({idForBlockchain: result.args.id.toString()})
  22. }
  23. );
  24.  
  25.  
  26. //call the smart contract method to create a new document
  27. const documentId = await storehash.methods.sendDocument(this.state.IPFSlink, newDate).send({from: this.state.account})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement