starknet-react icon indicating copy to clipboard operation
starknet-react copied to clipboard

Add optional chain argument to starknet.id hooks

Open rsodre opened this issue 1 year ago • 7 comments

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()

rsodre avatar Mar 21 '24 18:03 rsodre

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.

fracek avatar Mar 22 '24 16:03 fracek

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

raizo07 avatar Mar 23 '24 03:03 raizo07

Hey @raizo07 I assigned the issue to you.

fracek avatar Mar 24 '24 18:03 fracek

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 avatar Mar 25 '24 09:03 raizo07

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

raizo07 avatar Mar 25 '24 17:03 raizo07

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.

fracek avatar Mar 26 '24 14:03 fracek