Skip to content

Releases: thirdweb-dev/js

[email protected]

11 Dec 07:56
46b2071
Compare
Choose a tag to compare

Patch Changes

  • #5688 da5d8ec Thanks @joaquim-verges! - Autoconnect previously linked wallets

  • #5682 5b24faf Thanks @gregfromstl! - Fix ecosystem wallet AA detection in Pay modal

  • #5674 8020bdb Thanks @devfelipenunes! - This pull request adds the complete Portuguese (Brazil) translation for the wallet connection module. It includes translations for connecting a wallet, sending/receiving funds, network management, and other wallet-related actions. This improves the user experience for Portuguese-speaking users.

[email protected]

10 Dec 02:40
5158def
Compare
Choose a tag to compare

Minor Changes

  • #5533 43fbcac Thanks @kien-ngo! - The Connected-details button now shows USD value next to the token balance.

    Breaking change to the AccountBalance

    The formatFn props now takes in an object of type AccountBalanceInfo. The old formatFn was inflexible because it only allowed you to format the balance value.
    With this new version, you have access to both the balance and symbol.

    import { AccountBalance, type AccountBalanceInfo } from "thirdweb/react";
    
    <AccountBalance
      // Show the symbol in lowercase, before the balance
      formatFn={(props: AccountBalanceInfo) =>
        `${props.symbol.toLowerCase()} ${props.balance}`
      }
    />;

    AccountBalance now supports showing the token balance in fiat value (only USD supported at the moment)

    <AccountBalance showBalanceInFiat="USD" />

    The formatFn prop now takes in an object of type AccountBalanceInfo and outputs a string

    import { AccountBalance, type AccountBalanceInfo } from "thirdweb/react";
    
    <AccountBalance
      formatFn={(props: AccountBalanceInfo) =>
        `${props.balance}---${props.symbol.toLowerCase()}`
      }
    />;
    
    // Result: 11.12---eth

    ConnectButton also supports displaying balance in fiat since it uses AccountBalance internally

    <ConnectButton
      // Show USD value on the button
      detailsButton={{
        showBalanceInFiat: "USD",
      }}
      // Show USD value on the modal
      detailsModal={{
        showBalanceInFiat: "USD",
      }}
    />

    Export utils functions:

    formatNumber: Round up a number to a certain decimal place

    import { formatNumber } from "thirdweb/utils";
    const value = formatNumber(12.1214141, 1); // 12.1

    shortenLargeNumber: Shorten the string for large value. Mainly used for the AccountBalance's formatFn

    import { shortenLargeNumber } from "thirdweb/utils";
    const numStr = shortenLargeNumber(1_000_000_000);

    Fix to ConnectButton

    The social image of the Details button now display correctly for non-square image.

    Massive test coverage improvement for the Connected-button components

  • #5655 f69d1aa Thanks @kien-ngo! - Improve NFT Components

    • Add custom resolver methods to NFTMedia, NFTName and NFTDescription
    • Add caching for the NFT-info-getter method to improve performance
    • Small fix to handle falsy values for NFT media src, name and description
    • Improve test coverage by extracting internal logics and testing them

Patch Changes

@thirdweb-dev/[email protected]

10 Dec 02:40
5158def
Compare
Choose a tag to compare

Patch Changes

[email protected]

07 Dec 00:33
15eb6bd
Compare
Choose a tag to compare

Minor Changes

Patch Changes

  • #5639 ed0886a Thanks @jnsdls! - default account components to not retry on failure

  • #5640 5070e76 Thanks @jnsdls! - accept react 19 as peer explicitly

  • #5487 5574c15 Thanks @joaquim-verges! - BETA support for 7579 modular smart accounts

    You can now create modular smart wallets using the 7579 preset.

    Keep in mind that this is in BETA, and there might be breaking API changes.

    import { sepolia } from "thirdweb/chains";
    import { smartWallet, Config } from "thirdweb/wallets/smart";
     const modularSmartWallet = smartWallet(
      Config.erc7579({
        chain: sepolia,
        sponsorGas: true,
        factoryAddress: "0x...", // the 7579 factory address
        validatorAddress: "0x...", // the default validator module address
      }),
    });
  • #5630 0aa2416 Thanks @kien-ngo! - Add erc20Value to buyFromListing transaction

  • #5641 d1716fc Thanks @joaquim-verges! - Support ERC6492 for smart account signatures

[email protected]

05 Dec 21:59
f98365c
Compare
Choose a tag to compare

Minor Changes

  • #5634 d1aa380 Thanks @joaquim-verges! - ERC20 Token Paymaster support

    You can now use ERC20 Token Paymasters with Smart Wallets.

    import { base } from "thirdweb/chains";
    import { TokenPaymaster, smartWallet } from "thirdweb/wallets";
    
    const wallet = smartWallet({
      chain: base,
      sponsorGas: true, // only sponsor gas for the first ERC20 approval
      overrides: {
        tokenPaymaster: TokenPaymaster.BASE_USDC,
      },
    });

Patch Changes

[email protected]

03 Dec 08:54
4f19f77
Compare
Choose a tag to compare

Minor Changes

  • #5457 57fa96b Thanks @kien-ngo! - Add 2 new Pay functions: convertFiatToCrypto and convertCryptoToFiat

    Examples:

    Convert fiat (USD) to crypto

    import { convertFiatToCrypto } from "thirdweb/pay";
    import { ethereum } from "thirdweb/chains";
    
    // Convert 2 cents to ETH
    const result = await convertFiatToCrypto({
      from: "USD",
      // the token address. For native token, use NATIVE_TOKEN_ADDRESS
      to: "0x...",
      // the chain (of the chain where the token belong to)
      chain: ethereum,
      // 2 cents
      fromAmount: 0.02,
    });
    // Result: 0.0000057 (a number)

    Convert crypto to fiat (USD)

    import { convertCryptoToFiat } from "thirdweb/pay";
    
    // Get Ethereum price
    const result = convertCryptoToFiat({
      fromTokenAddress: NATIVE_TOKEN_ADDRESS,
      to: "USD",
      chain: ethereum,
      fromAmount: 1,
    });
    
    // Result: 3404.11 (number)

Patch Changes

@thirdweb-dev/[email protected]

03 Dec 08:54
4f19f77
Compare
Choose a tag to compare

Patch Changes

[email protected]

02 Dec 01:55
1d80944
Compare
Choose a tag to compare

Minor Changes

  • #5495 d1845f3 Thanks @kien-ngo! - Add headless components: ChainProvider, ChainIcon & ChainName

  • #5529 7488102 Thanks @gregfromstl! - Adds LoyaltyCard extensions and support for ERC721 deployment.

    import { deployERC721Contract } from "thirdweb/deploys";
    
    const loyaltyCardContractAddress = await deployERC721Contract({
      chain: "your-chain-id", // replace with your chain ID
      client: yourThirdwebClient, // replace with your Thirdweb client instance
      account: yourAccount, // replace with your account details
      type: "LoyaltyCard",
      params: {
        name: "MyLoyaltyCard",
        symbol: "LOYAL",
        description: "A loyalty card NFT contract",
        image: "path/to/image.png", // replace with your image path
        defaultAdmin: "0xYourAdminAddress", // replace with your admin address
        royaltyRecipient: "0xYourRoyaltyRecipient", // replace with your royalty recipient address
        royaltyBps: 500n, // 5% royalty
        trustedForwarders: ["0xTrustedForwarderAddress"], // replace with your trusted forwarder addresses
        saleRecipient: "0xYourSaleRecipient", // replace with your sale recipient address
        platformFeeBps: 200n, // 2% platform fee
        platformFeeRecipient: "0xYourPlatformFeeRecipient", // replace with your platform fee recipient address
      },
    });

Patch Changes

@thirdweb-dev/[email protected]

02 Dec 01:55
1d80944
Compare
Choose a tag to compare

Patch Changes

[email protected]

23 Nov 04:28
de2a7ba
Compare
Choose a tag to compare

Minor Changes

  • #5501 ac42c45 Thanks @gregfromstl! - Added new deployment utility functions to help manage infrastructure contracts and initialization:

    • getInitializeTransaction: Prepare initialization transaction for contract deployment
    • getOrDeployInfraForPublishedContract: Get or deploy required infrastructure for published contracts
    import {
      getInitializeTransaction,
      getOrDeployInfraForPublishedContract,
    } from "thirdweb";
    
    // Get initialization transaction
    const initTx = await getInitializeTransaction({
      client,
      chain,
      account,
      implementationContract,
      deployMetadata,
      initializeParams: {
        name: "My Contract",
        symbol: "CNTRCT",
      },
    });
    
    // Get or deploy infrastructure
    const infra = await getOrDeployInfraForPublishedContract({
      chain,
      client,
      account,
      contractId: "MyContract",
      constructorParams: params,
    });