Skip to content

Commit be97e08

Browse files
Version Packages
1 parent 5c55314 commit be97e08

File tree

4 files changed

+48
-47
lines changed

4 files changed

+48
-47
lines changed

.changeset/stupid-buses-wink.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

.changeset/wild-games-vanish.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/thirdweb/CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# thirdweb
22

3+
## 5.73.0
4+
5+
### Minor Changes
6+
7+
- [#5457](https://github.com/thirdweb-dev/js/pull/5457) [`57fa96b`](https://github.com/thirdweb-dev/js/commit/57fa96b268671f19c7f57fa2208fb83e2b0e75b5) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add 2 new Pay functions: convertFiatToCrypto and convertCryptoToFiat
8+
9+
Examples:
10+
11+
### Convert fiat (USD) to crypto
12+
13+
```ts
14+
import { convertFiatToCrypto } from "thirdweb/pay";
15+
import { ethereum } from "thirdweb/chains";
16+
17+
// Convert 2 cents to ETH
18+
const result = await convertFiatToCrypto({
19+
from: "USD",
20+
// the token address. For native token, use NATIVE_TOKEN_ADDRESS
21+
to: "0x...",
22+
// the chain (of the chain where the token belong to)
23+
chain: ethereum,
24+
// 2 cents
25+
fromAmount: 0.02,
26+
});
27+
// Result: 0.0000057 (a number)
28+
```
29+
30+
### Convert crypto to fiat (USD)
31+
32+
```ts
33+
import { convertCryptoToFiat } from "thirdweb/pay";
34+
35+
// Get Ethereum price
36+
const result = convertCryptoToFiat({
37+
fromTokenAddress: NATIVE_TOKEN_ADDRESS,
38+
to: "USD",
39+
chain: ethereum,
40+
fromAmount: 1,
41+
});
42+
43+
// Result: 3404.11 (number)
44+
```
45+
46+
### Patch Changes
47+
48+
- [#5531](https://github.com/thirdweb-dev/js/pull/5531) [`1e9a6c7`](https://github.com/thirdweb-dev/js/commit/1e9a6c7d8ae28012956b688f6e0af6f94c075181) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Handle 0 value for maxPriorityFeePerGas in 712 transactions
49+
350
## 5.72.0
451

552
### Minor Changes

packages/thirdweb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "thirdweb",
3-
"version": "5.72.0",
3+
"version": "5.73.0",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/thirdweb-dev/js.git#main"

0 commit comments

Comments
 (0)