Skip to main content
Version: 11.x

Function: computeLegacyContractClassHash()

computeLegacyContractClassHash(contract): string

Defined in: src/utils/hash/classHash/cairo0.ts:66

Computes the class hash for legacy compiled contract (Cairo 0)

Parameters​

contract​

string | LegacyCompiledContract

legacy compiled contract content

Returns​

string

hex-string of class hash

Example​

const compiledCairo0 = json.parse(fs.readFileSync("./cairo0contract.json").toString("ascii"));
const result=hash.computeLegacyContractClassHash(compiledCairo0);
// result = "0x4a5cae61fa8312b0a3d0c44658b403d3e4197be80027fd5020ffcdf0c803331"