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

docs: ABI for all possible data types #181

Open
ermvrs opened this issue Aug 14, 2024 · 2 comments
Open

docs: ABI for all possible data types #181

ermvrs opened this issue Aug 14, 2024 · 2 comments
Assignees

Comments

@ermvrs
Copy link
Collaborator

ermvrs commented Aug 14, 2024

Add a document md file for all possible abis from starknet and ethereum. In starknet, it has to have both return and parameters.

The most important data types are complex types. We already have basic type conversions. We need documentation for types like an array of basic types, an array of arrays, an array of custom structs, custom structs, bytes31, and bytes array.

This documentation lets us show the most idiomatic way to approach converting custom data types to basic types, then we can convert to Ethereum type.

Add an MD file to the docs folder.

@ermvrs
Copy link
Collaborator Author

ermvrs commented Aug 14, 2024

Example types

 Supported Cairo Types

Abiwan supports all of Cairo types, here's the mapping between Cairo types and Typescript types

Primitive Types

Cairo TypeScript
felt252 string | number | bigint
u8 - u32 number | bigint 
u64 - u256 number | bigint | U256 
ContractAddress  string
EthAddress  string
ClassHash  string
bytes31  string
ByteArray  string
bool boolean 
()  void

 Complex Types

Cairo TypeScript
Option<T> T | undefined
Array<T> T[]
Span<T> T[]
tuple (T1, T2, ..., Tn) [T1, T2, ..., Tn] 
struct  an object where keys are struct member names
enum a union of objects, each enum variant is an object 

@ermvrs
Copy link
Collaborator Author

ermvrs commented Aug 14, 2024

Please also tracking page for which types we support completely

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