Skip to content

Commit 78b9c8e

Browse files
authored
[SDK] Fix: stringify bigint erc20Value in useTransactionDetails (#7360)
1 parent a5163c0 commit 78b9c8e

File tree

5 files changed

+20
-48
lines changed

5 files changed

+20
-48
lines changed

.changeset/fluffy-paws-slide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix setting explicit amount on TransactionWidget

apps/playground-web/src/components/pay/transaction-button.tsx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,20 @@ export function PayTransactionPreview() {
4040
});
4141

4242
return (
43-
<>
44-
<StyledConnectButton />
45-
<div className="h-10" />
46-
{account && (
47-
<TransactionWidget
48-
client={THIRDWEB_CLIENT}
49-
theme={theme === "light" ? "light" : "dark"}
50-
transaction={claimTo({
51-
contract: nftContract,
52-
quantity: 1n,
53-
tokenId: 2n,
54-
to: account?.address || "",
55-
})}
56-
title={nft?.metadata?.name}
57-
description={nft?.metadata?.description}
58-
image={nft?.metadata?.image}
59-
/>
60-
)}
61-
</>
43+
<TransactionWidget
44+
client={THIRDWEB_CLIENT}
45+
theme={theme === "light" ? "light" : "dark"}
46+
transaction={claimTo({
47+
contract: nftContract,
48+
quantity: 1n,
49+
tokenId: 2n,
50+
to: account?.address || "",
51+
})}
52+
amount={100n}
53+
title={nft?.metadata?.name}
54+
description={nft?.metadata?.description}
55+
image={nft?.metadata?.image}
56+
/>
6257
);
6358
}
6459

packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function useTransactionDetails({
5757
"transaction-details",
5858
transaction.to,
5959
transaction.chain.id,
60-
transaction.erc20Value,
60+
transaction.erc20Value?.toString(),
6161
],
6262
queryFn: async (): Promise<TransactionDetails> => {
6363
// Create contract instance for metadata fetching

packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,6 @@ type UIOptionsResult =
198198
* />
199199
* ```
200200
*
201-
* ### Enable/Disable payment methods
202-
*
203-
* You can use `disableOnramps` to prevent the use of onramps in the widget.
204-
*
205-
* ```tsx
206-
* <CheckoutWidget
207-
* client={client}
208-
* disableOnramps
209-
* />
210-
* ```
211-
*
212201
* ### Customize the UI
213202
*
214203
* You can customize the UI of the `CheckoutWidget` component by passing a custom theme object to the `theme` prop.

packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -201,23 +201,6 @@ type UIOptionsResult =
201201
* />
202202
* ```
203203
*
204-
* ### Enable/Disable payment methods
205-
*
206-
* You can use `disableOnramps` to prevent the use of onramps in the widget.
207-
*
208-
* ```tsx
209-
* <TransactionWidget
210-
* client={client}
211-
* transaction={prepareTransaction({
212-
* to: "0x...",
213-
* chain: ethereum,
214-
* client: client,
215-
* value: toUnits("0.001", 18),
216-
* })}
217-
* disableOnramps
218-
* />
219-
* ```
220-
*
221204
* ### Customize the UI
222205
*
223206
* You can customize the UI of the `TransactionWidget` component by passing a custom theme object to the `theme` prop.

0 commit comments

Comments
 (0)