From adcdb89004608f31b505164f326cd731b08cb108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sim=C3=A3o?= Date: Wed, 13 Nov 2024 13:58:48 +0000 Subject: [PATCH] feat(evm): add 3rd party bridge superbridge (#301) --- .../src/app/[lang]/(bridge)/bridge/Bridge.tsx | 6 +- .../components/BridgeForm/BridgeForm.tsx | 2 +- .../ExternalBridgeForm/ExternalBridgeCard.tsx | 52 +++++++++++-- .../ExternalBridgeForm/ExternalBridgeForm.tsx | 13 +++- .../components/ExternalBridgeForm/FBTC.tsx | 73 +++++++++++++++++++ .../components/ExternalBridgeForm/Gas.tsx | 31 ++++++++ .../ExternalBridgeForm/Stargate.tsx | 39 ---------- .../ExternalBridgeForm/Superbridge.tsx | 15 ++++ 8 files changed, 176 insertions(+), 55 deletions(-) create mode 100644 apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/FBTC.tsx create mode 100644 apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Gas.tsx delete mode 100644 apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Stargate.tsx create mode 100644 apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Superbridge.tsx diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/Bridge.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/Bridge.tsx index b5727d29d..b92457023 100644 --- a/apps/evm/src/app/[lang]/(bridge)/bridge/Bridge.tsx +++ b/apps/evm/src/app/[lang]/(bridge)/bridge/Bridge.tsx @@ -53,11 +53,7 @@ const Bridge = ({ searchParams }: Props) => { const initialChain = useMemo(() => { const network = urlSearchParams.get('network'); - if (!network) { - return L1_CHAIN; - } - - if (network === 'bitcoin') { + if (!network || network === 'bitcoin') { return 'BTC'; } diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/components/BridgeForm/BridgeForm.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/components/BridgeForm/BridgeForm.tsx index f988c0951..5ac47e686 100644 --- a/apps/evm/src/app/[lang]/(bridge)/bridge/components/BridgeForm/BridgeForm.tsx +++ b/apps/evm/src/app/[lang]/(bridge)/bridge/components/BridgeForm/BridgeForm.tsx @@ -48,8 +48,8 @@ type BridgeFormProps = { }; const allNetworks = [ - L1_CHAIN, 'BTC', + L1_CHAIN, ChainId.ARBITRUM_ONE, ChainId.BASE, ChainId.OP, diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeCard.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeCard.tsx index 0a450219c..2e9119282 100644 --- a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeCard.tsx +++ b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeCard.tsx @@ -1,31 +1,45 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { ArrowTopRightOnSquare, Avatar, Card, Flex, Link, P } from '@gobob/ui'; import { Trans } from '@lingui/macro'; import { Meson } from './Meson'; import { Owl } from './Owl'; import { Relay } from './Relay'; -import { Stargate } from './Stargate'; +import { Superbridge } from './Superbridge'; +import { Gas } from './Gas'; +import { FBTC } from './FBTC'; import { TransactionDirection } from '@/types'; -type ExternalBridges = 'stargate' | 'relay' | 'meson' | 'orbiter-finance' | 'owlto-finance'; +type ExternalBridges = + | 'superbridge' + | 'relay' + | 'meson' + | 'orbiter-finance' + | 'owlto-finance' + | 'gas' + | 'free' + | 'fbtc'; // TODO: add missing links const bridges: Record< ExternalBridges, { - // eslint-disable-next-line @typescript-eslint/no-explicit-any icon: any | string; href: string | { [TransactionDirection.L1_TO_L2]: string; [TransactionDirection.L2_TO_L1]: string }; name: string; disabled: boolean; } > = { - stargate: { - href: 'https://stargate.finance/transfer', - icon: Stargate, - name: 'Stargate', - disabled: true + superbridge: { + href: 'https://superbridge.app/', + name: 'Superbridge', + icon: (props: any) => ( + + + + ), + disabled: false }, relay: { href: 'https://relay.link/bridge/bob/', @@ -53,6 +67,28 @@ const bridges: Record< icon: Owl, name: 'Owlto Finance', disabled: false + }, + fbtc: { + icon: (props: any) => ( + + + + ), + href: 'https://fbtc.com/bridge', + name: 'FBTC', + disabled: false + }, + free: { + icon: 'https://raw.githubusercontent.com/CodeToFree/free-tunnel/refs/heads/main/public/free.png', + name: 'Free Tech', + disabled: false, + href: 'https://app.free.tech/?token=SolvBTC' + }, + gas: { + icon: Gas, + name: 'Gas.zip', + disabled: false, + href: 'https://www.gas.zip/?chainIds=60808' } }; diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeForm.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeForm.tsx index e1ffccc35..17b5c43d9 100644 --- a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeForm.tsx +++ b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/ExternalBridgeForm.tsx @@ -1,5 +1,5 @@ -import { Flex } from '@gobob/ui'; import { ChainId } from '@gobob/chains'; +import { Flex } from '@gobob/ui'; import { ExternalBridgeCard, ExternalBridges } from './ExternalBridgeCard'; @@ -10,7 +10,16 @@ type ExternalBridgeFormProps = { chain: ChainId | 'BTC'; }; -const defaultBridges: ExternalBridges[] = ['meson', 'orbiter-finance', 'owlto-finance', 'relay', 'stargate']; +const defaultBridges: ExternalBridges[] = [ + 'meson', + 'orbiter-finance', + 'owlto-finance', + 'gas', + 'free', + 'fbtc', + 'relay', + 'superbridge' +]; const availableBridges: Partial> = { [ChainId.MERLIN]: ['owlto-finance'], diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/FBTC.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/FBTC.tsx new file mode 100644 index 000000000..11e021d6f --- /dev/null +++ b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/FBTC.tsx @@ -0,0 +1,73 @@ +import { forwardRef } from 'react'; +import { Icon, IconProps } from '@gobob/ui'; + +const FBTC = forwardRef((props, ref) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +)); + +FBTC.displayName = 'FBTC'; + +export { FBTC }; diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Gas.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Gas.tsx new file mode 100644 index 000000000..ce339edd4 --- /dev/null +++ b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Gas.tsx @@ -0,0 +1,31 @@ +import { forwardRef } from 'react'; +import { Icon, IconProps } from '@gobob/ui'; + +const Gas = forwardRef((props, ref) => ( + + + + + + + + + +)); + +Gas.displayName = 'Gas'; + +export { Gas }; diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Stargate.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Stargate.tsx deleted file mode 100644 index ba7e32fa5..000000000 --- a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Stargate.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { forwardRef } from 'react'; -import { Icon, IconProps } from '@gobob/ui'; - -const Stargate = forwardRef((props, ref) => ( - - - - - - - - - -)); - -Stargate.displayName = 'Stargate'; - -export { Stargate }; diff --git a/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Superbridge.tsx b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Superbridge.tsx new file mode 100644 index 000000000..22ca8cf79 --- /dev/null +++ b/apps/evm/src/app/[lang]/(bridge)/bridge/components/ExternalBridgeForm/Superbridge.tsx @@ -0,0 +1,15 @@ +import { forwardRef } from 'react'; +import { Icon, IconProps } from '@gobob/ui'; + +const Superbridge = forwardRef((props, ref) => ( + + + +)); + +Superbridge.displayName = 'Superbridge'; + +export { Superbridge };