feat: CairoTypeOption CairoTypeResult CairoTypeCustomEnum and others#1484
feat: CairoTypeOption CairoTypeResult CairoTypeCustomEnum and others#1484PhilippeR26 wants to merge 19 commits intostarknet-io:cairotypes/allfrom
Conversation
|
Added a commit to solve problems of recursive decompose. |
|
Added a commit to solve several problems of recursive encoding. |
|
@tabaktoni
|
|
@tabaktoni |
…ser files. adapt parseEvent
|
Ready for review. |
| } | ||
|
|
||
| toDecimalString() { | ||
| return addHexPrefix(this.toBigInt().toString(10)); |
There was a problem hiding this comment.
| return addHexPrefix(this.toBigInt().toString(10)); | |
| return this.toBigInt().toString(10); |
|
|
||
| toApiRequest(): string[] { | ||
| return addCompiledFlag([this.toHexString()]); | ||
| return addCompiledFlag([this.toDecimalString()]); |
There was a problem hiding this comment.
What is the reason for the hex to decimal swap?
There was a problem hiding this comment.
Because test suite is expecting everywhere decimalString for a Calldata.
| data: bigint; | ||
|
|
||
| static abiSelector = 'core::integer::u96'; | ||
| static abiSelector = |
There was a problem hiding this comment.
Would it make sense to stop supporting u96?
There was a problem hiding this comment.
Cairo language u96 is still supported, but in abi it's not named 'core::integer::u96' ; it's named 'core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>'
|
I performed local tests of encoding/decoding of Cairo 0 & cairo V1.1 contracts. |
Motivation and Resolution
In the frame of the new parsing strategy, implementation of Cairo option & Cairo result type.
Usage related changes
No user change.
Development related changes
Current
CairoOption,CairoResult&CairoCustomEnumclasses remains unchanged, and is used by users.New
CairoTypeOption,CairoTypeResult&CairoTypeCustomEnumclasses are created in conformity with theCairoTypeinterface, and are used to encode/decode to Starknet API. Can be used by user, or is automatically created from aCairoOption.Added also CairoNonZero, CairoEth, CairoEthAddress, CairoBool classes, CairoStruct.
Also handling of ContractAddress & ClassHash (are in fact just felt252).
Checklist: