diff --git a/packages/buidler/contracts/Signchain.sol b/packages/buidler/contracts/Signchain.sol
index 474ecdf..a6200c8 100644
--- a/packages/buidler/contracts/Signchain.sol
+++ b/packages/buidler/contracts/Signchain.sol
@@ -54,4 +54,14 @@ contract Signchain is DocumentRegistry, SigningModule {
}
+ function saveNotarizeDoc(bytes32 documentHash, address notary) public payable{
+ require(msg.value == notaryFee, "Invalid Notary Fee");
+ notarizedDocs[documentHash] = Notarize(notary, msg.value, false);
+ }
+
+ function notarizeDoc(bytes32 documentHash) public {
+ notarizedDocs[documentHash].notarized = true;
+ payable(address(msg.sender)).transfer(notarizedDocs[documentHash].notaryFee);
+ emit DocumentNatarized(documentHash, now, msg.sender);
+ }
}
diff --git a/packages/react-app/src/App.jsx b/packages/react-app/src/App.jsx
index 3948614..88bc656 100644
--- a/packages/react-app/src/App.jsx
+++ b/packages/react-app/src/App.jsx
@@ -85,7 +85,7 @@ function App() {
loadWeb3Modal();
}
if(address){
- init(address).then(data => console.log(idx))
+ //init(address).then(data => console.log(idx))
}
}, [loadWeb3Modal, address]);
diff --git a/packages/react-app/src/components/Documents.js b/packages/react-app/src/components/Documents.js
index e8a2742..5ef8fc4 100644
--- a/packages/react-app/src/components/Documents.js
+++ b/packages/react-app/src/components/Documents.js
@@ -2,7 +2,7 @@
import React, { useEffect, useState } from "react";
import { Button, Icon, Loader, Table, Modal, Step } from "semantic-ui-react";
import { Badge } from "antd";
-import {authorizeUser, getAllUsers, getAllFile, downloadFiles} from "../lib/threadDb";
+import {authorizeUser, getAllUsers, getAllFile, downloadFiles, attachSignature, notarizeDoc} from "../lib/threadDb";
const index = require("../lib/e2ee");
@@ -52,7 +52,7 @@ export default function Documents(props) {
const getAllDoc = async (client) => {
setLoading(true);
const userInfo = JSON.parse(loggedUser)
- const doc = await getAllFile(client,userInfo.publicKey, props.tx, props.writeContracts, props.address)
+ const doc = await getAllFile(client,userInfo.publicKey, props.address, props.tx, props.writeContracts)
if (doc.length > 0) {
setDocs(doc);
}
@@ -62,18 +62,17 @@ export default function Documents(props) {
const downloadFile = (name, key, location) => {
setDownloading(name);
console.log("docment:",location)
- downloadFiles(name, key, userInfo.email, location, password)
+ downloadFiles(name, key, userInfo.address, location, password)
.then(result => {setDownloading(null)});
};
- const signDocument = async docHash => {
- const result = await index.attachSignature(docHash, props.tx, props.writeContracts,
- props.userProvider.getSigner());
+ const signDocument = async (docHash, docId) => {
+ const result = await attachSignature(docId, props.userProvider.getSigner(), caller, docHash, dbClient);
};
- const notarizeDocument = async docHash => {
- const result = await index.notarizeDoc(docHash, props.tx, props.writeContracts,
- props.userProvider.getSigner());
+ const notarizeDocument = async (docId, docHash) => {
+ const result = await notarizeDoc(docId, docHash, props.tx, props.writeContracts, props.userProvider.getSigner(),
+ caller, dbClient);
};
return (
@@ -111,7 +110,7 @@ export default function Documents(props) {
-
{new Date(value.timestamp).toDateString()}
+ {value.timestamp}
{" "}
@@ -129,12 +128,14 @@ export default function Documents(props) {
{value.notary === caller.address && !value.notarySigned ? (
-