You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In sway, 2 types produce a void () value. These are Option::None() and native enums. Both encode to just the case bytes, meaning the value itself is empty.
Internally this is picked up by the TupleCoder due to the bracket regex match, and as it has no children it correctly encodes to empty bytes. However to anyone trying to build this out themselves without using the AbiCoder would have to do this:
This seems pretty hacky and not immediately obvious to anyone attempting to debug option and native enum problems. We should provide a VoidCoder that does an exact match on the void type for this scenario to provide a better experience for working with void values.
This is a feature but more an implementation detail of our internal encoding, as the VoidCoder itself should not be exported from @fuel-ts/abi-coder.
The text was updated successfully, but these errors were encountered:
In sway, 2 types produce a void
()
value. These areOption::None()
and native enums. Both encode to just the case bytes, meaning the value itself is empty.Internally this is picked up by the
TupleCoder
due to the bracket regex match, and as it has no children it correctly encodes to empty bytes. However to anyone trying to build this out themselves without using theAbiCoder
would have to do this:This seems pretty hacky and not immediately obvious to anyone attempting to debug option and native enum problems. We should provide a
VoidCoder
that does an exact match on the void type for this scenario to provide a better experience for working with void values.This is a feature but more an implementation detail of our internal encoding, as the
VoidCoder
itself should not be exported from@fuel-ts/abi-coder
.The text was updated successfully, but these errors were encountered: