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

Type 'core::integer::i128' is not defined. #1366

Closed
Ophiase opened this issue Jun 20, 2024 · 4 comments
Closed

Type 'core::integer::i128' is not defined. #1366

Ophiase opened this issue Jun 20, 2024 · 4 comments

Comments

@Ophiase
Copy link

Ophiase commented Jun 20, 2024

Feature Request

This type is properly defined in Cairo.
I have a contract that use it, but its not recognized by starknet.py.

@Ophiase
Copy link
Author

Ophiase commented Jun 20, 2024

I'm going to replace every occurrences of i128 in the ABI with u128 and see what happens.

contract = Contract(address=DEPLOYED_CONTRACT, abi=abi, provider=account)

@Ophiase
Copy link
Author

Ophiase commented Jun 20, 2024

def replace_i128_with_u128(data):
    if isinstance(data, dict):
        return {key: replace_i128_with_u128(value) for key, value in data.items()}
    elif isinstance(data, list):
        return [replace_i128_with_u128(item) for item in data]
    elif isinstance(data, str):
        return data.replace('i128', 'u128')
    else:
        return data

abi_as_u128 = replace_i128_with_u128(abi)

contract = Contract(address=DEPLOYED_CONTRACT, abi=abi_as_u128, provider=accounts)

Result :
ValueError: Make sure valid ABI is used to create a Contract instance

@franciszekjob
Copy link
Collaborator

franciszekjob commented Jun 25, 2024

Hi @Ophiase, replacing i128 with u128 in contract ABI may lead to potential issues. Could you please provide us with your contract address? This way we can help you and indicate source of the problem.

@franciszekjob
Copy link
Collaborator

Closing it, as there wasn't reply for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants