xJonathanLEI / starkli

Starkli (/ˈstɑːrklaɪ/), a ⚡ blazing ⚡ fast ⚡ CLI tool for Starknet powered by 🦀 starknet-rs 🦀
https://book.starkli.rs
Apache License 2.0
155 stars 43 forks source link

issue: Declaring and calculating a class hash of a declared class retrieved from a public network #53

Closed odednaor closed 6 months ago

odednaor commented 6 months ago

After getting a class using starkli class-by-hash, when trying to calculate the class hash on that class using starkli class-hash or when trying to declare the same class on a different chain using starkli declare results in an Error: failed to parse contract artifact.

This error is shown for both Cairo 0 and Cairo contracts.

xJonathanLEI commented 6 months ago

The issue here is that the JSON-RPC representation of a class is slightly different from what you actually get off the compiler. To solve this exact issue, a new option --parse has been added for the class-by-hash command (https://github.com/xJonathanLEI/starkli/commit/08b9571029a8860975e1fef6aad17593f18ff1b1). Simply add this option and you'll get the recovered class artifact instead, which looks exactly like the ones you'd get from compiling.

Will close this issue once it's released.

xJonathanLEI commented 6 months ago

Released in v0.2.0.

learnfortime commented 4 months ago

starkli declare --account ~/.starkli-wallets/deployer/account.json target/dev/hellow_world.sierra.json is declare contract command, but error is Error: failed to parse contract artifact, what solution is it ?

xJonathanLEI commented 4 months ago

@learnfortime Please open a new issue unless you're in the exact same scenario as OP: trying to declare the result from class-by-hash.