-
Notifications
You must be signed in to change notification settings - Fork 104
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
[Feature]: decode a slice of FieldElement
into a list of Token
#318
base: master
Are you sure you want to change the base?
[Feature]: decode a slice of FieldElement
into a list of Token
#318
Conversation
I like where you're going with this PR. My suggestion is to add a new trait for encoding and decoding Starknet types. pub trait AbiEncode {
/// Encode type to a token.
// TODO: should it consume the type or should take a reference?
fn encode(self) -> Token;
}
pub trait AbiDecode {
type Error;
fn decode(tokens: impl AsRef<[Token]>) -> Result<Self, Self::Error>;
} Then it's possible to implement the encoder and decoder for all rust builtin types like numbers ( |
@xJonathanLEI can you please take a look here and tell us what do you think ? I added a macro that auto generates a |
I wen with Now, after I introduced |
@haroune-mohammedi @fracek it could be awesome to have your feedbacks on #475 related to this! As this one may be closed due to the overlap. 👍 |
This PR addresses issue #286
We implemented a
decode
fucntionWhere: