thirdweb@5.76.0
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 oldformatFn
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 typeAccountBalanceInfo
and outputs a stringimport { 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
-
#5660
d5a68c8
Thanks @gregfromstl! - Fix: Correctly cleans the "Custom Auth" profile type label -
#5672
3b53732
Thanks @gregfromstl! - Fix ox hardset version -
#5653
df734ba
Thanks @joaquim-verges! - More helpful error messages for enclave and userop errors -
#5656
f680496
Thanks @joaquim-verges! - Fix connecting to cb wallet browser extension when already on the same chain -
#5671
dcd5822
Thanks @joaquim-verges! - Allow signature minting for LoyaltyCard contracts by passing the contractType -
#5673
c55f02f
Thanks @ElasticBottle! - always include gas price information even if it's 0 for enclave wallets -
#5617
c48e0c9
Thanks @gregfromstl! - Fix: Disconnect smart account when account signer is disconnected -
#5668
485dcc6
Thanks @joaquim-verges! - Fix add chain not triggering for certain wallets