Skip to content

Commit

Permalink
Fix: update bridge UI dependencies (#165)
Browse files Browse the repository at this point in the history
* fix: update bridge UI dependencies

* fix: remove axios dependency
  • Loading branch information
VGau authored Oct 9, 2024
1 parent d86aa9a commit 7b61cfc
Show file tree
Hide file tree
Showing 4 changed files with 662 additions and 854 deletions.
49 changes: 24 additions & 25 deletions bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,47 @@
},
"dependencies": {
"@consensys/linea-sdk": "0.3.0",
"@headlessui/react": "2.1.2",
"@tanstack/react-query": "5.51.11",
"@wagmi/connectors": "5.1.0",
"@wagmi/core": "2.13.0",
"@web3modal/wagmi": "5.0.8",
"axios": "1.7.2",
"@headlessui/react": "2.1.9",
"@tanstack/react-query": "5.59.3",
"@wagmi/connectors": "5.1.15",
"@wagmi/core": "2.13.8",
"@web3modal/wagmi": "5.1.11",
"clsx": "^2.1.1",
"compare-versions": "6.1.1",
"date-fns": "3.6.0",
"framer-motion": "11.3.17",
"date-fns": "4.1.0",
"framer-motion": "11.11.4",
"joi": "17.13.3",
"loglevel": "1.9.1",
"next": "14.2.5",
"next-seo": "6.5.0",
"pino-pretty": "11.2.1",
"loglevel": "1.9.2",
"next": "14.2.15",
"next-seo": "6.6.0",
"pino-pretty": "11.2.2",
"react": "18.3.1",
"react-device-detect": "2.2.3",
"react-dom": "18.3.1",
"react-hook-form": "7.52.1",
"react-icons": "5.2.1",
"react-hook-form": "7.53.0",
"react-icons": "5.3.0",
"react-toastify": "10.0.5",
"sharp": "0.33.4",
"swiper": "11.1.7",
"tailwind-merge": "^2.5.2",
"viem": "2.18.0",
"wagmi": "2.12.0",
"sharp": "0.33.5",
"swiper": "11.1.14",
"tailwind-merge": "^2.5.3",
"viem": "2.21.19",
"wagmi": "2.12.17",
"zustand": "4.5.4"
},
"devDependencies": {
"@playwright/test": "1.45.3",
"@svgr/webpack": "^8.1.0",
"@synthetixio/synpress": "4.0.0-alpha.7",
"@types/fs-extra": "11.0.4",
"@types/react": "18.3.3",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.0",
"autoprefixer": "10.4.19",
"daisyui": "4.12.10",
"autoprefixer": "10.4.20",
"daisyui": "4.12.12",
"dotenv": "16.4.5",
"eslint-config-next": "14.2.5",
"eslint-config-next": "14.2.15",
"eslint-plugin-tailwindcss": "3.17.4",
"postcss": "8.4.40",
"postcss": "8.4.47",
"tailwind-scrollbar": "3.1.0",
"tailwindcss": "3.4.7"
"tailwindcss": "3.4.13"
}
}
2 changes: 1 addition & 1 deletion bridge-ui/src/components/layouts/footer/FooterLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const FooterLinks = ({ toggleMenu }: FooterLinksProps) => (
<div className="space-y-2 py-4">
<Link
className="flex items-center hover:text-primary"
href="https://support.linea.build/"
href="https://support.linea.build/bridging/how-to-bridge-to-linea"
passHref
target="_blank"
rel="noopener noreferrer"
Expand Down
29 changes: 18 additions & 11 deletions bridge-ui/src/services/tokenService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import axios, { AxiosResponse } from "axios";
import log from "loglevel";
import { Address } from "viem";
import { GetTokenReturnType, getToken } from "@wagmi/core";
Expand Down Expand Up @@ -32,27 +31,35 @@ export async function fetchERC20Image(name: string) {
throw new Error("Name is required");
}

const coinsResponse: AxiosResponse<CoinGeckoToken[]> = await axios.get(
"https://api.coingecko.com/api/v3/coins/list",
);
const coin = coinsResponse.data.find((coin: CoinGeckoToken) => coin.name === name);
const coinsResponse = await fetch("https://api.coingecko.com/api/v3/coins/list");

if (!coinsResponse.ok) {
throw new Error("Error in fetchERC20Image to get coins list");
}

const coinsData: CoinGeckoToken[] = await coinsResponse.json();
const coin = coinsData.find((coin: CoinGeckoToken) => coin.name === name);

if (!coin) {
throw new Error("Coin not found");
}

const coinId = coin.id;
const coinDataResponse: AxiosResponse<CoinGeckoTokenDetail> = await axios.get(
`https://api.coingecko.com/api/v3/coins/${coinId}`,
);
const coinDataResponse = await fetch(`https://api.coingecko.com/api/v3/coins/${coinId}`);

if (!coinDataResponse.ok) {
throw new Error("Error in fetchERC20Image to get coin data");
}

const coinData: CoinGeckoTokenDetail = await coinDataResponse.json();

if (!coinDataResponse.data.image.small) {
if (!coinData.image.small) {
throw new Error("Image not found");
}

const imageUrl = coinDataResponse.data.image.small.split("?")[0];
const imageUrl = coinData.image.small.split("?")[0];
// Test image URL
const response = await axios.get(imageUrl, { timeout: 5000 });
const response = await fetch(imageUrl);

if (response.status !== 200) {
return "/images/logo/noTokenLogo.svg";
Expand Down
Loading

0 comments on commit 7b61cfc

Please sign in to comment.