Open ermvrs opened 2 months ago
Example types
Abiwan supports all of Cairo types, here's the mapping between Cairo types and Typescript 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 |
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 |
Please also tracking page for which types we support completely
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.