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

Unsupported type u256 #57

Open
beeb opened this issue Mar 30, 2024 · 1 comment
Open

Unsupported type u256 #57

beeb opened this issue Mar 30, 2024 · 1 comment

Comments

@beeb
Copy link

beeb commented Mar 30, 2024

Hello,

I just came across this project and would love to use it for one my usecases. However, the IDL I have access to defines some arguments with type u256. Although the generation works fine, the generated crate has errors cannot find type u256 in this scope.

I know that Anchor has support for this type, so I was wondering what do I need to do to support it?

Thanks in advance

@beeb
Copy link
Author

beeb commented Apr 1, 2024

I managed to work around the issue by adding a dependency to the uint crate and adding the following in typedefs.rs:

construct_uint! {
    #[derive(BorshDeserialize, BorshSerialize)]
    #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
    pub struct U256(4);
}

Then replacing all instances of u256 with U256 in instructions.rs

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

1 participant