Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Error message when starknet-class-hash command do not work as expected #908

Merged
1 change: 0 additions & 1 deletion src/starknetCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export function compileCairo(
.join(' ')}`,
{ stdio: 'inherit' },
);

return { success: true, resultPath, abiPath, solAbiPath, classHash: undefined };
} catch (e) {
if (e instanceof Error) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/setupVenv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function runVenvSetup(options: IInstallOptions) {
execSync(`${warpVenv} ${options.python}`, { stdio: options.verbose ? 'inherit' : 'pipe' });
} catch {
logError(
'Try using --python option for warp install and specify the path to python3.7 e.g "warp install --python /usr/bin/python3.7"',
'Try using --python option for warp install and specify the path to python3.9 e.g "warp install --python /usr/bin/python3.9"',
);
}
}
12 changes: 11 additions & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,17 @@ export function getSourceFromLocations(
export function runStarkNetClassHash(filePath: string): string {
const warpVenvPrefix = `PATH=${path.resolve(__dirname, '..', '..', 'warp_venv', 'bin')}:$PATH`;

const classHash = execSync(`${warpVenvPrefix} starknet-class-hash ${filePath}`).toString().trim();
let classHash: string;
try {
classHash = execSync(`${warpVenvPrefix} starknet-class-hash ${filePath}`).toString().trim();
AlejandroLabourdette marked this conversation as resolved.
Show resolved Hide resolved
} catch (error) {
throw new TranspileFailedError(
`starknet-class-hash command do not work as expected.
Please make sure you are using the required version of starknet by executing 'warp install' command.
Execute 'warp install --help' to know more about it.`,
);
}

if (classHash === undefined) {
throw new Error(`starknet-class-hash failed`);
}
Expand Down