Open davidyuk opened 1 year ago
I'm not sure I get it? You're asking to handle a custom type that's not a buildin into Sophia ?
Yep! For js developers' convenience 🙂 I'm not sure how this feature is important. The thing is that BigInt is not very handy. For example, it complains if mixed with numbers (1 * 1n
), and it can't be serialized to JSON (JSON.stirngify({ a: 1n })
). A developer may need to convert BigInts to Numbers by himself, and I'm proposing to have an agreement instead.
Was initially discussed in https://github.com/aeternity/aesophia/issues/351
I propose to decode returned value to
Number
instead ofBigInt
if calldata finds ashortint
(not sure about name) aliased toint
while type resolving.For example for the contract
ACI would be
And it looks like ACI preserves enough info to track
int
alias even in complex structures. Of course, this feature is not urgent.