Skip to content

Thirdweb changing return type of wagmi useAccount hook #6810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
encryptedDegen opened this issue Apr 22, 2025 · 4 comments
Open

Thirdweb changing return type of wagmi useAccount hook #6810

encryptedDegen opened this issue Apr 22, 2025 · 4 comments
Assignees

Comments

@encryptedDegen
Copy link

When implementing Thirdweb into my Next.js app, I had noticed unusual type errors. They were about type string not being assignable to type Address (0x${string}).
I checked the type of the address I was getting from wagmi's useAccount hook and it was returning string | uindefined which was not the case before.

After removing the <ThirdwebProvider> from my app it was back to returning the correct types.

I have not used thirdweb before, however, I am positive that this is not the intended behaviour, since the address should maintain the type set by wagmi & viem to maintain type safety. Many web3 libraries do support the Address type therefore I am unable to implement thirdweb into my application, and converting every instance of useAccount instance that returns the address top the Address type is not desired.

Package versions

Wagmi version: 2.14.16
viem cersion: 2.27.3
@thirdweb-dev/wagmi-adapter version: 0.2.58
thirdweb version: 5.95.2

Copy link

linear bot commented Apr 22, 2025

@jnsdls
Copy link
Member

jnsdls commented Apr 22, 2025

hi @encryptedDegen - thirdweb does use the option to override the internal types of AbiType

declare module "abitype" {
  export interface Register {
    AddressType: string;
  }
}

You can learn about that configuration here: https://abitype.dev/config

In the short term you should be able to add a similar declaration into your own app to do the opposite:

declare module "abitype" {
  export interface Register {
    AddressType: `0x${string}`;
  }
}

In the longer term we may re-visit this, but it would likely have to come with a major version bump to thirdweb.

-- Edit

Not closing this issue because it is useful to track the need / requirements for more/less strict types.

@0xDAEF0F

This comment has been minimized.

@0xDAEF0F

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants