curaOS / source

Start a solid foundation of tools for creators+builders.
https://cura.run
15 stars 13 forks source link

Optimizing smart contract calls #207

Closed sekaiking closed 2 years ago

sekaiking commented 2 years ago

The goal from this PR is to optimizing the calling of smart contracts

  1. All view methods (nft_tokens, nft_metadata...), now are being called as a view method using the useNFTViewMethod

  2. useNFTViewMethod doesn't require user to be logged in, so it can allow us in the future to let users explore NFTs without having to connect and only ask for login if user is trying a call method.

  3. As requested, I tried to cache the contract called in useNFTViewMethod. The first time a user call a contract, it generates a new contract instance and save it to a global object in window. This will alow to store any amount of contracts for other calls in the same session.

  4. Added updateStatue to useNFTViewMethod because the frontend code already had it for useNFTMethod

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/curaos/frontend/7G8keYZzwvFtzkaDAtYNF7xzc3k8
✅ Preview: https://frontend-git-improvehooks-curaos.vercel.app

sekaiking commented 2 years ago

fix #102

github-actions[bot] commented 2 years ago

:tada: This PR is included in version @cura/hooks-v1.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: