Skip to content

Commit

Permalink
use correct fallbacks in fetch price from uniswap
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Oct 9, 2024
1 parent 1cf80a9 commit 07c21ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { Pair, Route } from "@uniswap/v2-sdk";
import { Address, createPublicClient, fallback, http, parseAbi } from "viem";
import { mainnet } from "viem/chains";

const alchemyHttpUrl = getAlchemyHttpUrl(mainnet.id);
const rpcFallbacks = alchemyHttpUrl ? [http(alchemyHttpUrl), http()] : [http()];
const publicClient = createPublicClient({
chain: mainnet,
transport: fallback([http(getAlchemyHttpUrl(mainnet.id)), http()]),
transport: fallback(rpcFallbacks),
});

const ABI = parseAbi([
Expand Down

0 comments on commit 07c21ea

Please sign in to comment.