Skip to content

Commit

Permalink
Version Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 7, 2024
1 parent 43fbcac commit d61d64c
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 73 deletions.
67 changes: 0 additions & 67 deletions .changeset/fair-plants-pretend.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/strong-meals-remain.md

This file was deleted.

83 changes: 83 additions & 0 deletions packages/thirdweb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,88 @@
# thirdweb

## 5.76.0

### Minor Changes

- [#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.

### 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.

```tsx
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)

```tsx
<AccountBalance showBalanceInFiat="USD" />
```

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

```tsx
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

```tsx
<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

```tsx
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`

```tsx
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

### Patch Changes

- [#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

## 5.75.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/thirdweb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thirdweb",
"version": "5.75.0",
"version": "5.76.0",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"
Expand Down

0 comments on commit d61d64c

Please sign in to comment.