Get merkle proof when generating certificate
This commit is contained in:
parent
deca1c8eaf
commit
31ca61963a
@ -26,6 +26,7 @@ import FileService from "src/common/Api/LeCoffreApi/sdk/FileService";
|
||||
import LoaderService from "src/common/Api/LeCoffreApi/sdk/Loader/LoaderService";
|
||||
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||
import PdfService, { CertificateData, Metadata } from "@Front/Services/PdfService";
|
||||
import MessageBus from "src/sdk/MessageBus";
|
||||
|
||||
type IProps = {
|
||||
customerUid: string;
|
||||
@ -204,7 +205,8 @@ export default function DocumentTables(props: IProps) {
|
||||
commitmentId: "N/A",
|
||||
createdAt: new Date(),
|
||||
documentUid: "N/A",
|
||||
documentType: "N/A"
|
||||
documentType: "N/A",
|
||||
merkleProof: "N/A"
|
||||
}
|
||||
};
|
||||
|
||||
@ -217,7 +219,7 @@ export default function DocumentTables(props: IProps) {
|
||||
const documentProcesses = await DocumentService.getDocuments();
|
||||
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 file of document.processData.files) {
|
||||
@ -225,16 +227,21 @@ export default function DocumentTables(props: IProps) {
|
||||
console.log('[DocumentTables] onDownloadCertificate: fileProcess', res);
|
||||
const hash = res.lastUpdatedFileState.pcd_commitment.file_blob;
|
||||
certificateData.documentHash = hash;
|
||||
const metadata: Metadata = {
|
||||
fileName: res.processData.file_name,
|
||||
isDeleted: false,
|
||||
updatedAt: new Date(res.processData.updated_at),
|
||||
commitmentId: res.lastUpdatedFileState.commited_in,
|
||||
createdAt: new Date(res.processData.created_at),
|
||||
documentUid: doc.document_type.uid,
|
||||
documentType: doc.document_type.name
|
||||
};
|
||||
certificateData.metadata = metadata;
|
||||
|
||||
MessageBus.getInstance().generateMerkleProof(res.lastUpdatedFileState, 'file_blob').then((proof) => {
|
||||
console.log('[DocumentTables] onDownloadCertificate: proof', proof);
|
||||
const metadata: Metadata = {
|
||||
fileName: res.processData.file_name,
|
||||
isDeleted: false,
|
||||
updatedAt: new Date(res.processData.updated_at),
|
||||
commitmentId: res.lastUpdatedFileState.commited_in,
|
||||
createdAt: new Date(res.processData.created_at),
|
||||
documentUid: doc.document_type.uid,
|
||||
documentType: doc.document_type.name,
|
||||
merkleProof: proof
|
||||
};
|
||||
certificateData.metadata = metadata;
|
||||
});
|
||||
}
|
||||
)}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user