apibara / starknet-react

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

Add optional chain argument to starknet.id hooks #420

Open rsodre opened 7 months ago

rsodre commented 7 months ago

For a better testnet dapp experience, and to enable access to starknet.id on L3s, it is required to fetch starknet.id from mainnet instead of the connected chain.

Suggestion: Add an optional chainId argument (e.g. SN_MAIN) to useStarkAddress (), useStarkName () and useStarkProfile()

fracek commented 7 months ago

Yes, happy to accept a contribution for this. The hooks should accept a new optional argument chainId?: bigint and use that to lookup which contracts to use.

raizo07 commented 7 months ago

Hello @fracek I'm open to work on this.

fracek commented 7 months ago

Hey @raizo07 I assigned the issue to you.

raizo07 commented 7 months ago

Alright, I'm on it.

On Sun, Mar 24, 2024, 7:48 PM Francesco Ceccon @.***> wrote:

Hey @raizo07 https://github.com/raizo07 I assigned the issue to you.

— Reply to this email directly, view it on GitHub https://github.com/apibara/starknet-react/issues/420#issuecomment-2016903572, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATKSYSWV3DTHISDFBL5T77TYZ4NX3AVCNFSM6AAAAABFB7Y4VSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJWHEYDGNJXGI . You are receiving this because you were mentioned.Message ID: @.***>

raizo07 commented 7 months ago

Hi @fracek based on this documentation chainId is to be a string. "A 0x-prefixed hexadecimal string".

But in the comment above you suggested we use a bigint. Should I proceed with a bigint or a string

fracek commented 7 months ago

Hey, yes starknet-react uses a bigint as chainid because IMHO it works much better than hex-encoded values. To test the hook you can use a chainid from @starknet-react/chains, e.g. mainnet.id.

rsodre commented 5 months ago

is there any progress on this?