apibara / starknet-react

A collection of React providers and hooks for StarkNet
https://starknet-react.com
MIT License
369 stars 147 forks source link

Split between public provider and wallet client #289

Closed fracek closed 1 year ago

fracek commented 1 year ago

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.

fracek commented 1 year ago

This in now done in v2