Concordium / concordium-dapp-libraries

A coherent set of building blocks for making it as easy as possible for developers to build web-based dApps.
Apache License 2.0
7 stars 5 forks source link

react-components: Migrate 'useModuleSchemaRpc' from contractupdate sample #46

Closed bisgardo closed 5 months ago

bisgardo commented 1 year ago

The sample contractupdate has some nice utilities for resolving the on-chain schema of a smart contract. It handles the greasy details of what wasm sections to check (in which order) for the different module versions. This is error prone and not something a dApp developer would want to mess with themselves.

This PR moves moves these utils into a hook useModuleSchemaRpc as part of react-components. As we don't use Result in that package, the functions have been rewritten to use exceptions instead.