Skip to content

Instantly share code, notes, and snippets.

@cryptowen
Last active September 30, 2022 07:12
Show Gist options
  • Save cryptowen/d5ada0da54dd4adef1c8c2f85634732c to your computer and use it in GitHub Desktop.
Save cryptowen/d5ada0da54dd4adef1c8c2f85634732c to your computer and use it in GitHub Desktop.
SUI development suggestions

Support View Functions and Associated Query API

If we want to query the state of a module, the only way now is to do that is query related objects and read the data.

There are some cases we want to store some data, but get calculated results based on the stored data.

For example, we have a complex mechanism to calculate reward based on many parameters, and it changes according to time. Since there is no such view functions in sui Move and associated query API, we have to implement the calculation methods in both the contract and the frontend.

More Efficient Objects Queries

The current objects query API just returns all the objects simply, e.g. sui_getObjectsOwnedByAddress.

It might be a frontend performance issue when users get a lot of objects.

It's better to add some filter parameters, e.g. type_, and pagination mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment