|
1 | 1 | # thirdweb
|
2 | 2 |
|
| 3 | +## 5.76.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#5533](https://github.com/thirdweb-dev/js/pull/5533) [`43fbcac`](https://github.com/thirdweb-dev/js/commit/43fbcac25e9383743f1f42af9da7fe1c1eae12b4) Thanks [@kien-ngo](https://github.com/kien-ngo)! - The Connected-details button now shows USD value next to the token balance. |
| 8 | + |
| 9 | + ### Breaking change to the AccountBalance |
| 10 | + |
| 11 | + 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. |
| 12 | + With this new version, you have access to both the balance and symbol. |
| 13 | + |
| 14 | + ```tsx |
| 15 | + import { AccountBalance, type AccountBalanceInfo } from "thirdweb/react"; |
| 16 | + |
| 17 | + <AccountBalance |
| 18 | + // Show the symbol in lowercase, before the balance |
| 19 | + formatFn={(props: AccountBalanceInfo) => |
| 20 | + `${props.symbol.toLowerCase()} ${props.balance}` |
| 21 | + } |
| 22 | + />; |
| 23 | + ``` |
| 24 | + |
| 25 | + AccountBalance now supports showing the token balance in fiat value (only USD supported at the moment) |
| 26 | + |
| 27 | + ```tsx |
| 28 | + <AccountBalance showBalanceInFiat="USD" /> |
| 29 | + ``` |
| 30 | + |
| 31 | + The `formatFn` prop now takes in an object of type `AccountBalanceInfo` and outputs a string |
| 32 | + |
| 33 | + ```tsx |
| 34 | + import { AccountBalance, type AccountBalanceInfo } from "thirdweb/react"; |
| 35 | + |
| 36 | + <AccountBalance |
| 37 | + formatFn={(props: AccountBalanceInfo) => |
| 38 | + `${props.balance}---${props.symbol.toLowerCase()}` |
| 39 | + } |
| 40 | + />; |
| 41 | + |
| 42 | + // Result: 11.12---eth |
| 43 | + ``` |
| 44 | + |
| 45 | + ### ConnectButton also supports displaying balance in fiat since it uses AccountBalance internally |
| 46 | + |
| 47 | + ```tsx |
| 48 | + <ConnectButton |
| 49 | + // Show USD value on the button |
| 50 | + detailsButton={{ |
| 51 | + showBalanceInFiat: "USD", |
| 52 | + }} |
| 53 | + // Show USD value on the modal |
| 54 | + detailsModal={{ |
| 55 | + showBalanceInFiat: "USD", |
| 56 | + }} |
| 57 | + /> |
| 58 | + ``` |
| 59 | + |
| 60 | + ### Export utils functions: |
| 61 | + |
| 62 | + formatNumber: Round up a number to a certain decimal place |
| 63 | + |
| 64 | + ```tsx |
| 65 | + import { formatNumber } from "thirdweb/utils"; |
| 66 | + const value = formatNumber(12.1214141, 1); // 12.1 |
| 67 | + ``` |
| 68 | + |
| 69 | + shortenLargeNumber: Shorten the string for large value. Mainly used for the AccountBalance's `formatFn` |
| 70 | + |
| 71 | + ```tsx |
| 72 | + import { shortenLargeNumber } from "thirdweb/utils"; |
| 73 | + const numStr = shortenLargeNumber(1_000_000_000); |
| 74 | + ``` |
| 75 | + |
| 76 | + ### Fix to ConnectButton |
| 77 | + |
| 78 | + The social image of the Details button now display correctly for non-square image. |
| 79 | + |
| 80 | + ### Massive test coverage improvement for the Connected-button components |
| 81 | + |
| 82 | +### Patch Changes |
| 83 | + |
| 84 | +- [#5653](https://github.com/thirdweb-dev/js/pull/5653) [`df734ba`](https://github.com/thirdweb-dev/js/commit/df734baf97ec2e976fedb124ecfbac7119c0bc5f) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - More helpful error messages for enclave and userop errors |
| 85 | + |
| 86 | +- [#5656](https://github.com/thirdweb-dev/js/pull/5656) [`f680496`](https://github.com/thirdweb-dev/js/commit/f680496ccb1c639fab644fb54e9a962627cf3228) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix connecting to cb wallet browser extension when already on the same chain |
| 87 | + |
| 88 | +- [#5617](https://github.com/thirdweb-dev/js/pull/5617) [`c48e0c9`](https://github.com/thirdweb-dev/js/commit/c48e0c9320830aa69c0e9567d985ed8a94eeaaf1) Thanks [@gregfromstl](https://github.com/gregfromstl)! - Fix: Disconnect smart account when account signer is disconnected |
| 89 | + |
3 | 90 | ## 5.75.0
|
4 | 91 |
|
5 | 92 | ### Minor Changes
|
|
0 commit comments