We should split the provider in two components: a public provider used for non-authenticated requests, and a wallet client for interactions that require a wallet.
Background
At the moment, Starknet React deals with only a single instance of the provider. If the user didn't connect their wallet, the library uses the provider provided by the user (either a gateway provider or a jsonrpc provider). If the user connects their wallet, the library uses the provider provided by the wallet.
Problem
With the deprecation of the gateway and the switch to json-rpc, the current pattern is an issue because wallets shouldn't pay for dapps rpc calls.
On the other hand, decoupling the provider from the wallet means we need another mechanism for creating a provider based on the currently connected network.
Summary
We should split the provider in two components: a public provider used for non-authenticated requests, and a wallet client for interactions that require a wallet.
Background
At the moment, Starknet React deals with only a single instance of the provider. If the user didn't connect their wallet, the library uses the provider provided by the user (either a gateway provider or a jsonrpc provider). If the user connects their wallet, the library uses the provider provided by the wallet.
Problem
With the deprecation of the gateway and the switch to json-rpc, the current pattern is an issue because wallets shouldn't pay for dapps rpc calls.
On the other hand, decoupling the provider from the wallet means we need another mechanism for creating a provider based on the currently connected network.
Proposal
I propose to follow wagmi approach.
usePublicProvider
so that the dapp can display an error message