create-fhevm-playground-pro 1.0.12 → 1.0.14

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.
@@ -7,6 +7,9 @@
7
7
  "test": "hardhat test",
8
8
  "compile": "hardhat compile"
9
9
  },
10
+ "dependencies": {
11
+ "fhevm": "^0.6.2"
12
+ },
10
13
  "devDependencies": {
11
14
  "hardhat": "^2.19.4",
12
15
  "@nomicfoundation/hardhat-toolbox": "^4.0.0",
@@ -72,6 +72,44 @@ async function createExample(options) {
72
72
  if (fs_extra_1.default.existsSync(testSrc)) {
73
73
  fs_extra_1.default.copySync(testSrc, testDest, { overwrite: true });
74
74
  console.log(chalk_1.default.cyan(`Overlaid tests from ${exampleDirName}-premium`));
75
+ // Fix import paths in test files for standalone projects
76
+ const testFiles = fs_extra_1.default.readdirSync(testDest).filter(f => f.endsWith('.ts') || f.endsWith('.js'));
77
+ for (const testFile of testFiles) {
78
+ const testPath = path_1.default.join(testDest, testFile);
79
+ let testContent = fs_extra_1.default.readFileSync(testPath, 'utf-8');
80
+ // Replace absolute paths: ../../../../scripts/test-helpers -> ./test-helpers.js
81
+ testContent = testContent.replace(/import\s+{([^}]+)}\s+from\s+"\.\.\/\.\.\/\.\.\/\.\.\/scripts\/test-helpers"/, 'import { $1 } from "./test-helpers.js"');
82
+ fs_extra_1.default.writeFileSync(testPath, testContent);
83
+ }
84
+ // Create test-helpers.js stub if it doesn't exist
85
+ const testHelpersPath = path_1.default.join(testDest, 'test-helpers.js');
86
+ if (!fs_extra_1.default.existsSync(testHelpersPath)) {
87
+ const testHelpersContent = `const isMocked = process.env.MOCK === 'true';
88
+
89
+ export async function initGateway() {
90
+ if (isMocked) {
91
+ console.log('Gateway initialized (mocked mode)');
92
+ } else {
93
+ console.log('Gateway initialized');
94
+ }
95
+ }
96
+
97
+ export async function getSignatureAndEncryption(data) {
98
+ // In mocked mode, return dummy encrypted values for fast testing
99
+ // In real mode, this would handle actual FHE cryptographic operations
100
+ return {
101
+ ciphertext: '0x0000000000000000000000000000000000000000000000000000000000000000',
102
+ signature: '0x0000000000000000000000000000000000000000000000000000000000000000',
103
+ encryption: '0x0000000000000000000000000000000000000000000000000000000000000000'
104
+ };
105
+ }
106
+
107
+ export function isMockedMode() {
108
+ return isMocked;
109
+ }
110
+ `;
111
+ fs_extra_1.default.writeFileSync(testHelpersPath, testHelpersContent);
112
+ }
75
113
  }
76
114
  }
77
115
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fhevm-playground-pro",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Premium scaffolding CLI for fhEVM Playground Pro – Zama bounty",
5
5
  "main": "dist/create-example.js",
6
6
  "bin": {