Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/playground-web/src/hooks/useTokensData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { useQuery } from "@tanstack/react-query";
import type { TokenMetadata } from "@/lib/types";

async function fetchTokensFromApi(chainId?: number) {
const domain = process.env.NEXT_PUBLIC_BRIDGE_URL;
const url = new URL(`https://${domain}/v1/tokens`);
const domain = process.env.NEXT_PUBLIC_BRIDGE_URL || "bridge.thirdweb.com";
const url = new URL(
`${domain.includes("localhost") ? "http" : "https"}://${domain}/v1/tokens`,
);

if (chainId) {
url.searchParams.append("chainId", String(chainId));
Expand Down
13 changes: 12 additions & 1 deletion packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,18 @@
props.client,
NATIVE_TOKEN_ADDRESS,
props.chain.id,
);
).catch((err) => {
err.message.includes("not supported")
? undefined
: Promise.reject(err);
});
if (!ETH) {
return {
chain: props.chain,
tokenAddress: props.tokenAddress || NATIVE_TOKEN_ADDRESS,
type: "unsupported_token",
};
}

Check warning on line 326 in packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx#L315-L326

Added lines #L315 - L326 were not covered by tests
return {
data: {
destinationToken: ETH,
Expand Down
Loading