Get merkle proof when generating certificate
This commit is contained in:
parent
e87383c441
commit
22310a5846
@ -26,6 +26,7 @@ import DocumentTypeService from "src/common/Api/LeCoffreApi/sdk/DocumentTypeServ
|
|||||||
import FileService from "src/common/Api/LeCoffreApi/sdk/FileService";
|
import FileService from "src/common/Api/LeCoffreApi/sdk/FileService";
|
||||||
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||||
import PdfService, { CertificateData, Metadata } from "@Front/Services/PdfService";
|
import PdfService, { CertificateData, Metadata } from "@Front/Services/PdfService";
|
||||||
|
import MessageBus from "src/sdk/MessageBus";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
customerUid: string;
|
customerUid: string;
|
||||||
@ -184,7 +185,8 @@ export default function DocumentTables(props: IProps) {
|
|||||||
commitmentId: "N/A",
|
commitmentId: "N/A",
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
documentUid: "N/A",
|
documentUid: "N/A",
|
||||||
documentType: "N/A"
|
documentType: "N/A",
|
||||||
|
merkleProof: "N/A"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -197,7 +199,7 @@ export default function DocumentTables(props: IProps) {
|
|||||||
const documentProcesses = await DocumentService.getDocuments();
|
const documentProcesses = await DocumentService.getDocuments();
|
||||||
documentProcesses.filter((process: any) => process.processData.folder.uid === folderUid);
|
documentProcesses.filter((process: any) => process.processData.folder.uid === folderUid);
|
||||||
|
|
||||||
console.log('[DocumentTables] onDownloadCertificate: documentProcesses', documentProcesses);
|
// console.log('[DocumentTables] onDownloadCertificate: documentProcesses', documentProcesses);
|
||||||
|
|
||||||
for (const document of documentProcesses) {
|
for (const document of documentProcesses) {
|
||||||
for (const file of document.processData.files) {
|
for (const file of document.processData.files) {
|
||||||
@ -205,6 +207,9 @@ export default function DocumentTables(props: IProps) {
|
|||||||
console.log('[DocumentTables] onDownloadCertificate: fileProcess', res);
|
console.log('[DocumentTables] onDownloadCertificate: fileProcess', res);
|
||||||
const hash = res.lastUpdatedFileState.pcd_commitment.file_blob;
|
const hash = res.lastUpdatedFileState.pcd_commitment.file_blob;
|
||||||
certificateData.documentHash = hash;
|
certificateData.documentHash = hash;
|
||||||
|
|
||||||
|
MessageBus.getInstance().generateMerkleProof(res.lastUpdatedFileState, 'file_blob').then((proof) => {
|
||||||
|
console.log('[DocumentTables] onDownloadCertificate: proof', proof);
|
||||||
const metadata: Metadata = {
|
const metadata: Metadata = {
|
||||||
fileName: res.processData.file_name,
|
fileName: res.processData.file_name,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
@ -212,9 +217,11 @@ export default function DocumentTables(props: IProps) {
|
|||||||
commitmentId: res.lastUpdatedFileState.commited_in,
|
commitmentId: res.lastUpdatedFileState.commited_in,
|
||||||
createdAt: new Date(res.processData.created_at),
|
createdAt: new Date(res.processData.created_at),
|
||||||
documentUid: doc.document_type.uid,
|
documentUid: doc.document_type.uid,
|
||||||
documentType: doc.document_type.name
|
documentType: doc.document_type.name,
|
||||||
|
merkleProof: proof
|
||||||
};
|
};
|
||||||
certificateData.metadata = metadata;
|
certificateData.metadata = metadata;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user