Skip to content

Commit abdb47c

Browse files
committed
Merge branch 'main' into greg/tool-4864-handle-sponsored-gas-in-new-widgets
2 parents 134573f + e814248 commit abdb47c

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PayEmbedSection.tsx

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,47 @@
22

33
import { useTheme } from "next-themes";
44
import type { Chain, ThirdwebClient } from "thirdweb";
5-
import { PayEmbed } from "thirdweb/react";
6-
import { getSDKTheme } from "../../../../../../../../../@/utils/sdk-component-theme";
5+
import { BuyWidget } from "thirdweb/react";
6+
import {
7+
reportAssetBuyFailed,
8+
reportAssetBuySuccessful,
9+
} from "@/analytics/report";
10+
import { parseError } from "@/utils/errorParser";
11+
import { getSDKTheme } from "@/utils/sdk-component-theme";
712

813
export function BuyTokenEmbed(props: {
914
client: ThirdwebClient;
1015
chain: Chain;
11-
tokenSymbol: string;
12-
tokenName: string;
1316
tokenAddress: string;
1417
}) {
1518
const { theme } = useTheme();
1619
return (
17-
<PayEmbed
20+
<BuyWidget
21+
amount="1"
22+
chain={props.chain}
1823
className="!rounded-xl !w-full"
1924
client={props.client}
2025
connectOptions={{
2126
autoConnect: false,
2227
}}
23-
payOptions={{
24-
metadata: {
25-
name: `Buy ${props.tokenSymbol}`,
26-
},
27-
mode: "fund_wallet",
28-
prefillBuy: {
29-
allowEdits: {
30-
amount: true,
31-
chain: false,
32-
token: false,
33-
},
34-
amount: "1",
35-
chain: props.chain,
36-
token: {
37-
address: props.tokenAddress,
38-
name: props.tokenName,
39-
symbol: props.tokenSymbol,
40-
},
41-
},
28+
onError={(e) => {
29+
const errorMessage = parseError(e);
30+
reportAssetBuyFailed({
31+
assetType: "coin",
32+
chainId: props.chain.id,
33+
contractType: "DropERC20",
34+
error: errorMessage,
35+
});
36+
}}
37+
onSuccess={() => {
38+
reportAssetBuySuccessful({
39+
assetType: "coin",
40+
chainId: props.chain.id,
41+
contractType: "DropERC20",
42+
});
4243
}}
4344
theme={getSDKTheme(theme === "light" ? "light" : "dark")}
45+
tokenAddress={props.tokenAddress as `0x${string}`}
4446
/>
4547
);
4648
}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/contract-analytics/contract-analytics.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function ContractAnalyticsOverview(props: {
3939
</div>
4040
<ThirdwebAreaChart
4141
cardContentClassName="p-0"
42-
chartClassName="aspect-[1.5] lg:aspect-[3]"
42+
chartClassName="aspect-[1.2] lg:aspect-[2.6]"
4343
className="border-none bg-background p-0"
4444
config={{
4545
events: {

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/erc20.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ function BuyEmbed(props: {
152152
chain={props.clientContract.chain}
153153
client={props.clientContract.client}
154154
tokenAddress={props.clientContract.address}
155-
tokenName={props.tokenName}
156-
tokenSymbol={props.tokenSymbol}
157155
/>
158156
);
159157
}

0 commit comments

Comments
 (0)