In starknet.js v6.7.0, it is necessary to supply both the sierra and sierra casm compilation outputs to a declare transaction as shown here.
The declare method uses the artifact field to compute the class_hash, and the casm field to compute the compiled_class_hash.
For V2 and V3 declare transactions, both the class_hash and compiled_class_hash are required to construct the tx hash:
- V3 declare transaction docs
- V2 declare transaction docs
- Side note: even though V2 is deprecated, I'm still including it bc
starknet.jsdefaults to transaction version 2 for backwards compatibility in v6.7.0
- Side note: even though V2 is deprecated, I'm still including it bc
If you attempt to pass only the casm artifact alone or the sierra artifact alone, this causes an error like the one below:
"Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash"