Open ifavo opened 4 months ago
If we were able to initiate connex without the genesis block this wouldn't be a problem, as we could then (async) fetch the genesis block prior to making the wallet interaction.
Automatically detecting the network could also have a potential problem. Its an async action, as we have to fetch the genesis block. If the dapp were to automatically request a wallet interaction on page load (weird use case, but possible), that could potentially request the action before the network is detected.
One approach could be to fetch the genesis inside the DAppKitProvider
and don't return the child components until we have the genesis, but this could lead to lead to a bad UX if the API call fails.
I understand the impact on the UI, I would not want to delay a render, while a re-render might be acceptable.
In my scenario a transaction is built, which is where I am willing to pay for an additional network request before its requested for signing in the wallet.
Is the genesis id needed in other situations where a network request is not possible to lazily detect the id?
When setting up a DAppKitProvider with react using only the nodeUrl, it will switch VeWorld to MainNet.
Example:
useConnex()
will automatically switch to MainNet.genesis="test"
, it will switch to TestNet.My personal expected behavior is that it will automatically detect the network/genesis and use it, according to the
nodeUrl
.If this is correct behavior, may I suggest to either detect the genesis id automatically using the given
nodeUrl
or make thegenesis
mandatory, to prevent confusion during setup?