Skip to content

Releases: thirdweb-dev/js

[email protected]

22 Oct 23:48
9a4b1cb

Choose a tag to compare

Patch Changes

[email protected]

22 Oct 01:37
e0ace73

Choose a tag to compare

Minor Changes

  • #8289 b30369f Thanks @jnsdls! - ### getContractMetadata() now returns a record with unknown values instead of any.

    before:

    const metadata = await getContractMetadata({ contract });
    metadata; // Record<string, any>
    metadata.name; // string
    metadata.symbol; // string

    after:

    const metadata = await getContractMetadata({ contract });
    metadata; // Record<string, unknown>
    metadata.name; // string | null
    metadata.symbol; // string | null

    Metadata is not (and was never) strictly defined outside of name and symbol and may contain any type of data in the record.
    This is not a runtime change but it may break type inference in existing apps that relied on the previous return type.

    Recommended fix:
    You should type-guard any key you access from "metadata".

    const metadata = await getContractMetadata({ contract });
    if ("foo" in metadata && typeof metadata.foo === "string") {
      metadata.foo; // string
    }

    Quick fix:
    If adding type assertions is not something you can do in the short term you can also assert the type directly.
    This is as "unsafe" as the type was before.

    const metadata = await getContractMetadata({ contract });
    const foo = metadata.foo as string;

Patch Changes

  • #8280 ceba683 Thanks @MananTank! - Fix process not defined error when using "thirdweb/contract" import in Vite

@thirdweb-dev/[email protected]

22 Oct 23:49
9a4b1cb

Choose a tag to compare

@thirdweb-dev/[email protected]

22 Oct 01:37
e0ace73

Choose a tag to compare

@thirdweb-dev/[email protected]

22 Oct 23:49
9a4b1cb

Choose a tag to compare

@thirdweb-dev/[email protected]

22 Oct 01:37
e0ace73

Choose a tag to compare

Patch Changes

@thirdweb-dev/[email protected]

22 Oct 01:37
e0ace73

Choose a tag to compare

Patch Changes

[email protected]

20 Oct 01:38
b33c1a3

Choose a tag to compare

Patch Changes

@thirdweb-dev/[email protected]

20 Oct 01:38
b33c1a3

Choose a tag to compare

@thirdweb-dev/[email protected]

20 Oct 01:38
b33c1a3

Choose a tag to compare

Patch Changes