aptos-labs / aptos-core

Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
https://aptosfoundation.org
Other
6.19k stars 3.66k forks source link

[Feature Request] Add SDK support for creating and passing Option<T>, FixedPoint32, and FixedPoint 64 as entry and view function args #8711

Open movekevin opened 1 year ago

movekevin commented 1 year ago

Devs currently have to manually create these types. It'd be great to have proper SDK support for all of these new types for both entry function and view function calls (separate APIs) as well as simulation

gregnazario commented 1 year ago

Currently, Option and Object are supported in entry functions (to be released). Need to double check for view functions, and FixedPoint support

gregnazario commented 1 year ago

Update:

  1. FixedPoint doesn't work as output, as there is no JSON conversion for it.
  2. Object works an an input, but as an output it does the ugly JSON of ``` {"inner": "0x12345"}
  3. Option works as an output, but does not work as an input, this may be a limitation at the API level. The SDK needs to do the fun conversion of undefined -> none, etc., but it doesn't work even with array notation
  4. Structs, and nested structs, along with all numbers and vectors of u8 and u64 work great. Nested nested vectors, unsure at this moment.

Testing methodology here: https://github.com/gregnazario/aptos-wallet-tester/tree/view-functions