Skip to content

Thirdweb changing return type of wagmi useAccount hook #6810

Closed as not planned

Description

@encryptedDegen

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

Activity

  1. jnsdls commented on Apr 22, 2025

    @jnsdls
    Contributor

    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.

  2. 0xDAEF0F commented on Apr 24, 2025

    @0xDAEF0F
  3. 0xDAEF0F commented on Apr 25, 2025

    @0xDAEF0F
  4. github-actions commented on May 3, 2025

    @github-actions
    Contributor

    This issue has been inactive for 7 days. It is now marked as stale and will be closed in 2 days if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions