Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add declare function to the generated Contract type #3

Open
glihm opened this issue Dec 19, 2023 · 0 comments
Open

Add declare function to the generated Contract type #3

glihm opened this issue Dec 19, 2023 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@glihm
Copy link
Collaborator

glihm commented Dec 19, 2023

To ease the declaration of a class, the generated Contract type may expose a declare function.

abigen!(MyContract, "/path/sierra.json");

fn main() {
    // init provider and account

    let class_hash = MyContract::declare(...args).await?;
}

There are two possible strategies:

  1. Taking only the Sierra class as input, but this enforce to re-compile the CASM class to compute the class hash (simpler interface).
  2. We can accept the CASM class as optional parameter, to have the hash out of the box (faster).

Example for the declare can be taken here on Starkli.

The fees must be configurable.
We also may want to check if the class is not already declared, to accelerate the process in the case it is.

In the code, this is located in the rs crate here where a new file may be added for this, to be expanded in the contract type here.

@glihm glihm added the help wanted Extra attention is needed label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant