Skip to content

Commit a258e7e

Browse files
[SDK] feat: Redesign token selection flow in PayEmbed (#6268)
1 parent e386ac9 commit a258e7e

File tree

18 files changed

+601
-603
lines changed

18 files changed

+601
-603
lines changed

apps/playground-web/src/app/insight/utils.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,22 @@ export async function fetchBlueprintSpec(params: {
5555
}
5656

5757
export async function fetchAllBlueprints() {
58-
// fetch list
59-
const blueprintSpecs = await fetchBlueprintList();
60-
61-
// fetch all blueprints
62-
const blueprints = await Promise.all(
63-
blueprintSpecs.map((spec) =>
64-
fetchBlueprintSpec({
65-
blueprintId: spec.id,
66-
}),
67-
),
68-
);
69-
70-
return blueprints;
58+
try {
59+
// fetch list
60+
const blueprintSpecs = await fetchBlueprintList();
61+
62+
// fetch all blueprints
63+
const blueprints = await Promise.all(
64+
blueprintSpecs.map((spec) =>
65+
fetchBlueprintSpec({
66+
blueprintId: spec.id,
67+
}),
68+
),
69+
);
70+
71+
return blueprints;
72+
} catch (error) {
73+
console.error(error);
74+
return [];
75+
}
7176
}

apps/playground-web/src/components/pay/direct-payment.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
2-
3-
import { sepolia } from "thirdweb/chains";
2+
import { base } from "thirdweb/chains";
43
import { PayEmbed, getDefaultToken } from "thirdweb/react";
54
import { THIRDWEB_CLIENT } from "../../lib/client";
65
import { StyledConnectButton } from "../styled-connect-button";
@@ -16,9 +15,9 @@ export function BuyMerchPreview() {
1615
payOptions={{
1716
mode: "direct_payment",
1817
paymentInfo: {
19-
amount: "0.1",
20-
chain: sepolia,
21-
token: getDefaultToken(sepolia, "USDC"),
18+
amount: "2",
19+
chain: base,
20+
token: getDefaultToken(base, "USDC"),
2221
sellerAddress: "0xEb0effdFB4dC5b3d5d3aC6ce29F3ED213E95d675",
2322
},
2423
metadata: {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useTheme } from "next-themes";
44
import { getContract } from "thirdweb";
5-
import { base, sepolia } from "thirdweb/chains";
5+
import { base, polygon } from "thirdweb/chains";
66
import { transfer } from "thirdweb/extensions/erc20";
77
import { claimTo, getNFT } from "thirdweb/extensions/erc1155";
88
import {
@@ -21,12 +21,12 @@ const nftContract = getContract({
2121
client: THIRDWEB_CLIENT,
2222
});
2323

24-
const USDC = getDefaultToken(sepolia, "USDC");
24+
const USDC = getDefaultToken(polygon, "USDC");
2525

2626
const usdcContract = getContract({
2727
// biome-ignore lint/style/noNonNullAssertion: its there
2828
address: USDC!.address,
29-
chain: sepolia,
29+
chain: polygon,
3030
client: THIRDWEB_CLIENT,
3131
});
3232

@@ -55,6 +55,7 @@ export function PayTransactionPreview() {
5555
to: account?.address || "",
5656
}),
5757
metadata: nft?.metadata,
58+
buyWithFiat: false,
5859
}}
5960
/>
6061
)}
@@ -69,6 +70,7 @@ export function PayTransactionButtonPreview() {
6970
return (
7071
<>
7172
<StyledConnectButton />
73+
<div className="h-10" />
7274
{account && (
7375
<div className="flex flex-col items-center justify-center gap-2">
7476
<div className="flex items-center gap-2">

0 commit comments

Comments
 (0)