mirror of
https://github.com/selfxyz/self.git
synced 2026-02-19 02:24:25 -05:00
update app
This commit is contained in:
@@ -222,37 +222,37 @@ const MainScreen: React.FC = () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (cscaProof && (modalProofStep === ModalProofSteps.MODAL_SERVER_SUCCESS)) {
|
||||
console.log('CSCA Proof received:', cscaProof);
|
||||
if ((cscaProof !== null) && (localProof !== null)) {
|
||||
const sendTransaction = async () => {
|
||||
const sigAlgFormatted = formatSigAlgNameForCircuit(passportData.signatureAlgorithm, passportData.pubKey.exponent);
|
||||
const sigAlgIndex = SignatureAlgorithm[sigAlgFormatted as keyof typeof SignatureAlgorithm]
|
||||
console.log("local proof already generated, sending transaction");
|
||||
const provider = new ethers.JsonRpcProvider(RPC_URL);
|
||||
const serverResponse = await sendRegisterTransaction(localProof, cscaProof, sigAlgIndex)
|
||||
const txHash = serverResponse?.data.hash;
|
||||
const receipt = await provider.waitForTransaction(txHash);
|
||||
console.log('receipt status:', receipt?.status);
|
||||
if (receipt?.status === 0) {
|
||||
throw new Error("Transaction failed");
|
||||
}
|
||||
setRegistered(true);
|
||||
setSelectedTab("app");
|
||||
setStep(Steps.REGISTERED);
|
||||
toast.show('✅', {
|
||||
message: "Registered",
|
||||
customData: {
|
||||
type: "success",
|
||||
},
|
||||
})
|
||||
}
|
||||
sendTransaction();
|
||||
}
|
||||
// useEffect(() => {
|
||||
// if (cscaProof && (modalProofStep === ModalProofSteps.MODAL_SERVER_SUCCESS)) {
|
||||
// console.log('CSCA Proof received:', cscaProof);
|
||||
// if ((cscaProof !== null) && (localProof !== null)) {
|
||||
// const sendTransaction = async () => {
|
||||
// const sigAlgFormatted = formatSigAlgNameForCircuit(passportData.signatureAlgorithm, passportData.pubKey.exponent);
|
||||
// const sigAlgIndex = SignatureAlgorithm[sigAlgFormatted as keyof typeof SignatureAlgorithm]
|
||||
// console.log("local proof already generated, sending transaction");
|
||||
// const provider = new ethers.JsonRpcProvider(RPC_URL);
|
||||
// const serverResponse = await sendRegisterTransaction(localProof, cscaProof, sigAlgIndex)
|
||||
// const txHash = serverResponse?.data.hash;
|
||||
// const receipt = await provider.waitForTransaction(txHash);
|
||||
// console.log('receipt status:', receipt?.status);
|
||||
// if (receipt?.status === 0) {
|
||||
// throw new Error("Transaction failed");
|
||||
// }
|
||||
// setRegistered(true);
|
||||
// setSelectedTab("app");
|
||||
// setStep(Steps.REGISTERED);
|
||||
// toast.show('✅', {
|
||||
// message: "Registered",
|
||||
// customData: {
|
||||
// type: "success",
|
||||
// },
|
||||
// })
|
||||
// }
|
||||
// sendTransaction();
|
||||
// }
|
||||
|
||||
}
|
||||
}, [modalProofStep]);
|
||||
// }
|
||||
// }, [modalProofStep]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -112,7 +112,7 @@ const ProveScreen: React.FC<ProveScreenProps> = ({ setSheetRegisterIsOpen }) =>
|
||||
setProofStatus('Generating proof...');
|
||||
socket.emit('proof_generation_start', { sessionId: selectedApp.userId });
|
||||
|
||||
const tree = await getTreeFromTracker();
|
||||
// const tree = await getTreeFromTracker();
|
||||
|
||||
// const inputs = generateCircuitInputsDisclose(
|
||||
// secret,
|
||||
@@ -149,6 +149,7 @@ const ProveScreen: React.FC<ProveScreenProps> = ({ setSheetRegisterIsOpen }) =>
|
||||
|
||||
// Send the proof via WebSocket
|
||||
const formattedLocalProof = {
|
||||
dsc: passportData.dsc,
|
||||
proof: {
|
||||
pi_a: [
|
||||
localProof.proof.a[0],
|
||||
@@ -170,7 +171,8 @@ const ProveScreen: React.FC<ProveScreenProps> = ({ setSheetRegisterIsOpen }) =>
|
||||
},
|
||||
publicSignals: (localProof as any).pub_signals
|
||||
};
|
||||
// console.log("formattedLocalProof", formattedLocalProof);
|
||||
console.log("formattedLocalProof", formattedLocalProof);
|
||||
|
||||
socket.emit('proof_generated', { sessionId: selectedApp.userId, proof: formattedLocalProof });
|
||||
|
||||
// Wait for verification result
|
||||
|
||||
@@ -196,10 +196,10 @@ const handleResponseIOS = async (
|
||||
false
|
||||
);
|
||||
|
||||
sendCSCARequest(inputs_csca, setModalProofStep);
|
||||
|
||||
useNavigationStore.getState().setStep(Steps.NEXT_SCREEN);
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
//sendCSCARequest(inputs_csca, setModalProofStep);
|
||||
useNavigationStore.getState().setStep(Steps.REGISTERED);
|
||||
useUserStore.getState().setRegistered(true);
|
||||
useNavigationStore.getState().setSelectedTab("app");
|
||||
} catch (e: any) {
|
||||
console.log('error during parsing:', e);
|
||||
useNavigationStore.getState().setStep(Steps.MRZ_SCAN_COMPLETED);
|
||||
@@ -306,7 +306,8 @@ const handleResponseAndroid = async (
|
||||
max_cert_bytes,
|
||||
false
|
||||
);
|
||||
sendCSCARequest(inputs_csca, setModalProofStep);
|
||||
useNavigationStore.getState().setStep(Steps.NEXT_SCREEN);
|
||||
useNavigationStore.getState().setSelectedTab("next");
|
||||
//sendCSCARequest(inputs_csca, setModalProofStep);
|
||||
useUserStore.getState().setRegistered(true);
|
||||
useNavigationStore.getState().setStep(Steps.REGISTERED);
|
||||
useNavigationStore.getState().setSelectedTab("app");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user