create-fhevm-playground-pro 1.0.30 → 1.0.32

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.
@@ -3,7 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Base template for fhEVM example projects",
5
5
  "scripts": {
6
- "test": "hardhat compile && (ls test/*.test.* >/dev/null 2>&1 && mocha --require ts-node/register --require hardhat/register 'test/**/*.test.ts' || echo 'No test files found')",
6
+ "test": "hardhat compile && (ls test/*.test.* >/dev/null 2>&1 && TS_NODE_TRANSPILE_ONLY=true mocha -r ts-node/register/transpile-only -r hardhat/register 'test/**/*.test.ts' || echo 'No test files found')",
7
7
  "compile": "hardhat compile"
8
8
  },
9
9
  "dependencies": {
@@ -0,0 +1,22 @@
1
+ export function initGateway() {
2
+ return Promise.resolve({ gateway: 'stub' });
3
+ }
4
+
5
+ export function getSignatureAndEncryption(value?: number) {
6
+ // Return an object matching the shape expected by tests
7
+ return {
8
+ ciphertext: value !== undefined ? `0x${value.toString(16).padStart(64, '0')}` : '0x0',
9
+ signature: '0x' + '00'.repeat(32),
10
+ encryption: '0x' + '00'.repeat(32),
11
+ };
12
+ }
13
+
14
+ export function isMockedMode() {
15
+ return true;
16
+ }
17
+
18
+ export default {
19
+ initGateway,
20
+ getSignatureAndEncryption,
21
+ isMockedMode,
22
+ };
@@ -7,12 +7,13 @@
7
7
  "declaration": true,
8
8
  "outDir": "./dist",
9
9
  "rootDir": "./",
10
- "strict": true,
10
+ "strict": false,
11
11
  "esModuleInterop": true,
12
12
  "skipLibCheck": true,
13
13
  "resolveJsonModule": true,
14
+ "typeRoots": ["./types", "./node_modules/@types"],
14
15
  "forceConsistentCasingInFileNames": true
15
16
  },
16
- "include": ["**/*.ts"],
17
+ "include": ["**/*.ts", "types/**/*.d.ts"],
17
18
  "exclude": ["node_modules", "dist"]
18
19
  }
@@ -0,0 +1,11 @@
1
+ declare const ethers: any;
2
+ declare const hre: any;
3
+ declare const network: any;
4
+ declare const expect: any;
5
+ declare function describe(name: string, fn: (...args: any[]) => any): any;
6
+ declare function it(name: string, fn: (...args: any[]) => any): any;
7
+
8
+ declare module 'hardhat' {
9
+ const anything: any;
10
+ export = anything;
11
+ }
@@ -105,34 +105,29 @@ async function createExample(options) {
105
105
  testContent = testContent.replace(/import\s*{\s*ethers\s*}\s*from\s*["']hardhat["']\s*;?\n/g, '');
106
106
  fs_extra_1.default.writeFileSync(testPath, testContent);
107
107
  }
108
- // Create test-helpers.js stub if it doesn't exist
109
- const testHelpersPath = path_1.default.join(testDest, 'test-helpers.js');
110
- if (!fs_extra_1.default.existsSync(testHelpersPath)) {
111
- const testHelpersContent = `const isMocked = process.env.MOCK === 'true';
112
-
113
- export async function initGateway() {
114
- if (isMocked) {
115
- console.log('Gateway initialized (mocked mode)');
116
- } else {
117
- console.log('Gateway initialized');
118
- }
108
+ // Ensure `scripts/test-helpers.ts` exists so tests importing
109
+ // `../scripts/test-helpers` resolve in the scaffolded project.
110
+ const scriptsDir = path_1.default.join(projectDir, 'scripts');
111
+ if (!fs_extra_1.default.existsSync(scriptsDir)) {
112
+ fs_extra_1.default.mkdirSync(scriptsDir, { recursive: true });
113
+ }
114
+ const scriptHelpersTs = path_1.default.join(scriptsDir, 'test-helpers.ts');
115
+ if (!fs_extra_1.default.existsSync(scriptHelpersTs)) {
116
+ const helpersTsContent = `export async function initGateway() {
117
+ // stubbed gateway init for scaffolded projects
118
+ return Promise.resolve({ gateway: 'stub' });
119
119
  }
120
120
 
121
- export async function getSignatureAndEncryption(data) {
122
- // In mocked mode, return dummy encrypted values for fast testing
123
- // In real mode, this would handle actual FHE cryptographic operations
124
- return {
125
- ciphertext: '0x0000000000000000000000000000000000000000000000000000000000000000',
126
- signature: '0x0000000000000000000000000000000000000000000000000000000000000000',
127
- encryption: '0x0000000000000000000000000000000000000000000000000000000000000000'
128
- };
121
+ export function getSignatureAndEncryption() {
122
+ return { signature: 'stub-signature', encryption: 'stub-encryption' };
129
123
  }
130
124
 
131
125
  export function isMockedMode() {
132
- return isMocked;
126
+ return true;
133
127
  }
134
128
  `;
135
- fs_extra_1.default.writeFileSync(testHelpersPath, testHelpersContent);
129
+ fs_extra_1.default.writeFileSync(scriptHelpersTs, helpersTsContent, 'utf-8');
130
+ console.log(chalk_1.default.gray('Added scripts/test-helpers.ts stub to scaffold'));
136
131
  }
137
132
  }
138
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fhevm-playground-pro",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Premium scaffolding CLI for fhEVM Playground Pro – Zama bounty",
5
5
  "main": "dist/create-example.js",
6
6
  "bin": {