apibara/starknet-react

Expose useStarknet from the context

WiseMrMusa opened this issue · 5 comments

Expose useStarknet from the context so there will be an API to get the configuration used for the starknet app

The cupported chains and connectors can easily be got from this

If it's approved, I can work on it. it's just a little change

That hook is supposed to be internal and subject to change. What information do you need that's not available by other hooks?

I need to get the chains and connectors configured by the user

The API is exposed by wagmi with WagmiContext and I can also use it to validate that a component is wrapped inside the StarknetProvider

even the useStarknet (it's consumed version) that gives some contexts information too is not exposed and the two APIs are exposed in wagmi which is used in designing wallet connectors

Wagmi can expose it because they have wagmi core that abstract everything away, but starknet react doesn't.

You can get configured chains with useNetwork. For connectors: all available connectors are available in useConnect. Do you need the configured connectors (e.g. connectors configured by the dapp but maybe not available).

alright then. Thanks

If you find you need user provided connectors (not just detected connectors) feel free to reopen (describing the use case) and i think we can add a hook just for that.