software-mansion / starknet.py

✨ 🐍 Python SDK for Starknet.
https://starknetpy.rtfd.io/
MIT License
260 stars 81 forks source link

Implement tools that help with reading compiled contracts #1455

Closed kkawula closed 1 week ago

kkawula commented 2 months ago

Add a class/methods that helps with importing scarb output. It gives you everything needed to declare the contract.

Additionally, add an example in docs.

For reference our implementation for test purposes load_contract.

ShantelPeters commented 2 months ago

Hi @kkawula can i please be assigned to this issue?

kkawula commented 2 months ago

Hi @ShantelPeters yes, you can take it. Can you give pr this week? FYI: we have similar functionality in our test, so that can inspire you. load_contract

ShantelPeters commented 2 months ago

Thank you ser 🫡 @kkawula

kkawula commented 2 months ago

Hi @ShantelPeters, can you create a pull request this week?

ShantelPeters commented 2 months ago

Okay sir @kkawula

Constantine234 commented 2 months ago

I have an Idea on how to do this i dont know if i can contribute to this

kkawula commented 2 months ago

Hi @Constantine234! Currently someone is working on this issue, so at this time you can't, but we have a few issues labeled as good first issue so feel free to choose something for yourself.

kkawula commented 2 months ago

Hi @Constantine234 this issue is free to take, are you still interested in it?

Constantine234 commented 2 months ago

yes sir I am interested @kkawula

Constantine234 commented 2 months ago

@kkawula when will you want this to be ready?

kkawula commented 2 months ago

It would be great if manage to open pull request in one week and request me for the first review

Constantine234 commented 2 months ago

okay so that is to say it should be done before next week right ? @kkawula

kkawula commented 2 months ago

yes, something like that

Constantine234 commented 2 months ago

then trust me on this is done I will start working on it tomorrow to Wednesday @kkawula

Constantine234 commented 2 months ago

@kkawula Pull request will be done tomorrow thank you

Constantine234 commented 2 months ago

@kkawula i have done the PR this is the code #1472 you can go check it thank you and if there is any changes let me know

ManvithaMolakala commented 2 months ago

Hi @kkawula, i would like to contribute to this issue if noone else is working on it. Also, can we connect on telegram to discuss?

onlydustapp[bot] commented 2 months ago

Hey @ManvithaMolakala! Thanks for showing interest. We've created an application for you to contribute to starknet.py. Go check it out on OnlyDust!

onlydustapp[bot] commented 2 months ago

Hey @ManvithaMolakala! Thanks for showing interest. We've created an application for you to contribute to Starknet SDK for Python. Go check it out on OnlyDust!

KXYWISE commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Intermediate in Python and Java.

How I plan on tackling this issue

Initialization:The class takes in file paths for the Sierra, CASM, and ABI files.Methods:read_sierra(): Loads the Sierra file.read_casm(): Loads the CASM file.read_abi(): Loads the ABI file.calculate_compiled_contract_casm(): Uses the loaded data to compute a unique value for the compiled contract (this is a placeholder and should be replaced with the actual computation).Usage:Create an instance of ScarbOutputImporter, provide the file paths, and call load_all() to load all the data.Then, call calculate_compiled_contract_casm() to compute the result.This structure should give you everything needed to handle importing the Scarb output and computing the required values for declaring the contract. You can extend the placeholder logic in calculate_compiled_contract_casm() based on how the contract declaration process is defined in Starknet.

tumutech commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have been implemented tools using Python and i can borrow concepts from similar implementations to handle this issue.

How I plan on tackling this issue

I will use inspiration from the https://github.com/software-mansion/starknet.py/blob/development/starknet_py/tests/e2e/fixtures/misc.py#L72C5-L72C18 , then i will test the implementation solution if it solves the problem i will go ahead and write a documentation on how the tool can be used.

ManvithaMolakala commented 1 month ago

Hi @kkawula

Please confirm the following approach for this issue: I will add the function load_contract that takes input as contract_name, package name and outputs casm, sierra in contract_utils.py.

kkawula commented 1 month ago

Hi @ManvithaMolakala Yes, it sounds good, remember that Scarb generates artifacts file in target/dev, where we can find paths to outputs and casm isn't always generated, it must be marked as true in Scarb.toml

[[target.starknet-contract]]
casm = true
sierra = true