create-izi-noir 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +55 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -172,7 +172,7 @@ var ProgressReporter = class {
|
|
|
172
172
|
const frame = pc2.cyan(frames[frameIndex]);
|
|
173
173
|
const phrase = THINKING_PHRASES[this.thinkingIndex % THINKING_PHRASES.length];
|
|
174
174
|
const dots = ".".repeat(dotCount % 4);
|
|
175
|
-
process.stdout.write(`\r${frame} ${pc2.dim(phrase)}${dots}
|
|
175
|
+
process.stdout.write(`\x1B[2K\r${frame} ${pc2.dim(phrase)}${dots}`);
|
|
176
176
|
frameIndex = (frameIndex + 1) % frames.length;
|
|
177
177
|
dotCount++;
|
|
178
178
|
if (dotCount % 12 === 0) {
|
|
@@ -243,7 +243,7 @@ var InstallProgress = class {
|
|
|
243
243
|
const bar = pc2.green("\u2588".repeat(filled)) + pc2.dim("\u2591".repeat(empty));
|
|
244
244
|
const pkg = this.packages[this.currentPackage % this.packages.length];
|
|
245
245
|
process.stdout.write(
|
|
246
|
-
`\r${frame} Installing dependencies ${bar} ${pc2.dim(pkg)}
|
|
246
|
+
`\x1B[2K\r${frame} Installing dependencies ${bar} ${pc2.dim(pkg)}`
|
|
247
247
|
);
|
|
248
248
|
frameIndex = (frameIndex + 1) % frames.length;
|
|
249
249
|
if (this.progress < 95) {
|
|
@@ -288,7 +288,7 @@ var GitProgress = class {
|
|
|
288
288
|
const frame = pc2.cyan(frames[frameIndex]);
|
|
289
289
|
const phase = this.phases[this.phaseIndex % this.phases.length];
|
|
290
290
|
const dots = ".".repeat(this.dotCount % 4);
|
|
291
|
-
process.stdout.write(`\r${frame} ${pc2.dim(phase)}${dots}
|
|
291
|
+
process.stdout.write(`\x1B[2K\r${frame} ${pc2.dim(phase)}${dots}`);
|
|
292
292
|
frameIndex = (frameIndex + 1) % frames.length;
|
|
293
293
|
this.dotCount++;
|
|
294
294
|
if (this.dotCount % 8 === 0) {
|
|
@@ -316,7 +316,7 @@ function createGitProgress() {
|
|
|
316
316
|
function generatePackageJson(options) {
|
|
317
317
|
const isSolana = options.provider === "arkworks";
|
|
318
318
|
const dependencies = {
|
|
319
|
-
"@izi-noir/sdk": "^0.1.
|
|
319
|
+
"@izi-noir/sdk": "^0.1.8",
|
|
320
320
|
"@noir-lang/acvm_js": "1.0.0-beta.13-1d260df.nightly",
|
|
321
321
|
"@noir-lang/noirc_abi": "1.0.0-beta.13-1d260df.nightly",
|
|
322
322
|
"react": "^18.3.1",
|
|
@@ -483,7 +483,7 @@ function generateReadme(options) {
|
|
|
483
483
|
const networkInfo = isSolana ? "- Deploy VK to Solana devnet\n- Verify proofs on-chain" : "- Local proof verification";
|
|
484
484
|
return `# ${options.projectName}
|
|
485
485
|
|
|
486
|
-
ZK proof demo built with [IZI-NOIR](https://github.com/izi-noir
|
|
486
|
+
ZK proof demo built with [IZI-NOIR](https://github.com/izi-noir) and React.
|
|
487
487
|
|
|
488
488
|
## Getting Started
|
|
489
489
|
|
|
@@ -543,7 +543,7 @@ After adding a new circuit:
|
|
|
543
543
|
|
|
544
544
|
## Learn More
|
|
545
545
|
|
|
546
|
-
- [IZI-NOIR Documentation](https://github.com/izi-noir
|
|
546
|
+
- [IZI-NOIR Documentation](https://github.com/izi-noir)
|
|
547
547
|
- [Noir Language](https://noir-lang.org)
|
|
548
548
|
- [Vite](https://vitejs.dev)
|
|
549
549
|
- [React](https://react.dev)
|
|
@@ -735,6 +735,16 @@ import { Chain, Network, getExplorerTxUrl, getExplorerAccountUrl } from '@izi-no
|
|
|
735
735
|
const [isVerifying, setIsVerifying] = useState(false);
|
|
736
736
|
const [verified, setVerified] = useState<boolean | null>(null);
|
|
737
737
|
const [verifyError, setVerifyError] = useState<string | null>(null);` : "";
|
|
738
|
+
const solanaCircuitResetCode = isSolana ? `
|
|
739
|
+
// Reset deploy state when circuit changes (VK will be different)
|
|
740
|
+
setVkAccount(null);
|
|
741
|
+
setDeployTx(null);
|
|
742
|
+
setVerified(null);` : "";
|
|
743
|
+
const solanaRecompileResetCode = isSolana ? `
|
|
744
|
+
// Reset deploy state since VK will change with recompilation
|
|
745
|
+
setVkAccount(null);
|
|
746
|
+
setDeployTx(null);
|
|
747
|
+
setVerified(null);` : "";
|
|
738
748
|
const solanaHandlers = isSolana ? `
|
|
739
749
|
// Deploy VK to Solana
|
|
740
750
|
const handleDeploy = async () => {
|
|
@@ -777,6 +787,12 @@ import { Chain, Network, getExplorerTxUrl, getExplorerAccountUrl } from '@izi-no
|
|
|
777
787
|
setIsVerifying(false);
|
|
778
788
|
}
|
|
779
789
|
};` : "";
|
|
790
|
+
const solanaVkWarning = isSolana ? `
|
|
791
|
+
{vkAccount && compiledNoirCode !== noirCode && (
|
|
792
|
+
<div className="warning">
|
|
793
|
+
Circuit code changed. Generating a new proof will require re-deploying the VK.
|
|
794
|
+
</div>
|
|
795
|
+
)}` : "";
|
|
780
796
|
const solanaDeploySection = isSolana ? `
|
|
781
797
|
{/* Deploy & Verify Section */}
|
|
782
798
|
{proof && (
|
|
@@ -923,8 +939,9 @@ function App() {
|
|
|
923
939
|
const [localVerified, setLocalVerified] = useState<boolean | null>(null);
|
|
924
940
|
const [publicInputs, setPublicInputs] = useState<string[] | null>(null);
|
|
925
941
|
|
|
926
|
-
// IziNoir instance
|
|
942
|
+
// IziNoir instance and compiled code tracking
|
|
927
943
|
const [iziInstance, setIziInstance] = useState<IziNoir | null>(null);
|
|
944
|
+
const [compiledNoirCode, setCompiledNoirCode] = useState<string | null>(null);
|
|
928
945
|
${solanaHooks}
|
|
929
946
|
${solanaState}
|
|
930
947
|
|
|
@@ -940,6 +957,9 @@ ${solanaState}
|
|
|
940
957
|
setLocalVerified(null);
|
|
941
958
|
setPublicInputs(null);
|
|
942
959
|
setNoirCode(null);
|
|
960
|
+
// Reset compiled instance (forces recompilation)
|
|
961
|
+
setIziInstance(null);
|
|
962
|
+
setCompiledNoirCode(null);${solanaCircuitResetCode}
|
|
943
963
|
}
|
|
944
964
|
}, [selectedCircuit]);
|
|
945
965
|
|
|
@@ -987,14 +1007,21 @@ ${solanaState}
|
|
|
987
1007
|
|
|
988
1008
|
const startTime = performance.now();
|
|
989
1009
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1010
|
+
// Reuse existing instance if circuit hasn't changed
|
|
1011
|
+
let izi = iziInstance;
|
|
1012
|
+
const needsRecompile = !izi || compiledNoirCode !== noirCode;
|
|
1013
|
+
|
|
1014
|
+
if (needsRecompile) {
|
|
1015
|
+
izi = await IziNoir.init({
|
|
1016
|
+
provider: Provider.${capitalizeFirst(options.provider)},${solanaProviderConfig}
|
|
1017
|
+
});
|
|
993
1018
|
|
|
994
|
-
|
|
1019
|
+
await izi.compile(noirCode);
|
|
1020
|
+
setIziInstance(izi);
|
|
1021
|
+
setCompiledNoirCode(noirCode);${solanaRecompileResetCode}
|
|
1022
|
+
}
|
|
995
1023
|
|
|
996
|
-
const proofResult = await izi
|
|
997
|
-
setIziInstance(izi);
|
|
1024
|
+
const proofResult = await izi!.prove(inputs);
|
|
998
1025
|
|
|
999
1026
|
// Get proof bytes
|
|
1000
1027
|
const proofBytes = 'bytes' in proofResult.proof
|
|
@@ -1005,7 +1032,7 @@ ${solanaState}
|
|
|
1005
1032
|
: proofResult.publicInputs;
|
|
1006
1033
|
|
|
1007
1034
|
// Local verification
|
|
1008
|
-
const verified = await izi
|
|
1035
|
+
const verified = await izi!.verify(proofBytes, publicInputsHex);
|
|
1009
1036
|
setLocalVerified(verified);
|
|
1010
1037
|
|
|
1011
1038
|
const endTime = performance.now();
|
|
@@ -1018,7 +1045,7 @@ ${solanaState}
|
|
|
1018
1045
|
} finally {
|
|
1019
1046
|
setIsGenerating(false);
|
|
1020
1047
|
}
|
|
1021
|
-
}, [noirCode, inputs]);
|
|
1048
|
+
}, [noirCode, inputs, iziInstance, compiledNoirCode]);
|
|
1022
1049
|
${solanaHandlers}
|
|
1023
1050
|
|
|
1024
1051
|
return (
|
|
@@ -1090,7 +1117,7 @@ ${solanaHandlers}
|
|
|
1090
1117
|
|
|
1091
1118
|
{/* Generate Proof */}
|
|
1092
1119
|
<div className="section">
|
|
1093
|
-
<h2>4. Generate Proof</h2
|
|
1120
|
+
<h2>4. Generate Proof</h2>${solanaVkWarning}
|
|
1094
1121
|
<button
|
|
1095
1122
|
onClick={handleGenerateProof}
|
|
1096
1123
|
disabled={isGenerating || !noirCode || !!transpileError}
|
|
@@ -1124,7 +1151,7 @@ ${solanaDeploySection}
|
|
|
1124
1151
|
</main>
|
|
1125
1152
|
|
|
1126
1153
|
<footer>
|
|
1127
|
-
<p>Built with <a href="https://github.com/izi-noir
|
|
1154
|
+
<p>Built with <a href="https://github.com/izi-noir" target="_blank">IZI-NOIR</a></p>
|
|
1128
1155
|
</footer>
|
|
1129
1156
|
</div>
|
|
1130
1157
|
);
|
|
@@ -1517,6 +1544,16 @@ main {
|
|
|
1517
1544
|
border-radius: 8px;
|
|
1518
1545
|
}
|
|
1519
1546
|
|
|
1547
|
+
.warning {
|
|
1548
|
+
padding: 0.75rem 1rem;
|
|
1549
|
+
background: rgba(255, 193, 7, 0.1);
|
|
1550
|
+
border: 1px solid rgba(255, 193, 7, 0.3);
|
|
1551
|
+
border-radius: 8px;
|
|
1552
|
+
color: #ffc107;
|
|
1553
|
+
font-size: 0.875rem;
|
|
1554
|
+
margin-bottom: 1rem;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1520
1557
|
/* ================================
|
|
1521
1558
|
Noir Code Details
|
|
1522
1559
|
================================ */
|
|
@@ -2905,7 +2942,7 @@ function printSuccessMessage(options) {
|
|
|
2905
2942
|
console.log(pc3.dim(" 3. Add it to CIRCUITS array in src/App.tsx"));
|
|
2906
2943
|
console.log();
|
|
2907
2944
|
console.log(
|
|
2908
|
-
pc3.dim("Learn more: ") + pc3.blue("https://github.com/izi-noir
|
|
2945
|
+
pc3.dim("Learn more: ") + pc3.blue("https://github.com/izi-noir")
|
|
2909
2946
|
);
|
|
2910
2947
|
console.log();
|
|
2911
2948
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-izi-noir",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "CLI to scaffold IZI-NOIR ZK projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "https://github.com/izi-noir
|
|
44
|
+
"url": "https://github.com/izi-noir.git",
|
|
45
45
|
"directory": "packages/create-izi-noir"
|
|
46
46
|
}
|
|
47
47
|
}
|