From 2efad0066c88a348ecdd5e9f13ef249db4e386eb Mon Sep 17 00:00:00 2001 From: Bartek Date: Wed, 15 Jan 2025 15:46:49 +0100 Subject: [PATCH] feat: add deBridge fast bridge (#2192) --- .../public/images/bridge/deBridge.svg | 13 +++++++++++++ .../TransferPanel/WithdrawalConfirmationDialog.tsx | 1 + .../src/components/common/BridgesTable.tsx | 2 +- .../arb-token-bridge-ui/src/util/fastBridges.ts | 12 +++++++++++- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 packages/arb-token-bridge-ui/public/images/bridge/deBridge.svg diff --git a/packages/arb-token-bridge-ui/public/images/bridge/deBridge.svg b/packages/arb-token-bridge-ui/public/images/bridge/deBridge.svg new file mode 100644 index 0000000000..783e2d23f9 --- /dev/null +++ b/packages/arb-token-bridge-ui/public/images/bridge/deBridge.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/WithdrawalConfirmationDialog.tsx b/packages/arb-token-bridge-ui/src/components/TransferPanel/WithdrawalConfirmationDialog.tsx index eda5f9edda..0acfeac024 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/WithdrawalConfirmationDialog.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/WithdrawalConfirmationDialog.tsx @@ -64,6 +64,7 @@ export function WithdrawalConfirmationDialog( from: childChain.id, to: parentChain.id, tokenSymbol: selectedToken?.symbol ?? nativeCurrency.symbol, + tokenAddress: selectedToken?.address, amount: props.amount }) diff --git a/packages/arb-token-bridge-ui/src/components/common/BridgesTable.tsx b/packages/arb-token-bridge-ui/src/components/common/BridgesTable.tsx index 0049f2cf2c..3e99cb02a1 100644 --- a/packages/arb-token-bridge-ui/src/components/common/BridgesTable.tsx +++ b/packages/arb-token-bridge-ui/src/components/common/BridgesTable.tsx @@ -56,7 +56,7 @@ export function BridgesTable(props: { return 1 } - if (a.name < b.name) { + if (a.name.toLowerCase() < b.name.toLowerCase()) { return -1 } else { return 1 diff --git a/packages/arb-token-bridge-ui/src/util/fastBridges.ts b/packages/arb-token-bridge-ui/src/util/fastBridges.ts index 45f17f6c77..51a10cdc04 100644 --- a/packages/arb-token-bridge-ui/src/util/fastBridges.ts +++ b/packages/arb-token-bridge-ui/src/util/fastBridges.ts @@ -9,6 +9,7 @@ import Synapse from '@/images/bridge/synapse.png' import Wormhole from '@/images/bridge/wormhole.svg' // import LIFI from '@/images/bridge/lifi.webp' import Router from '@/images/bridge/router.webp' +import deBridge from '@/images/bridge/deBridge.svg' import { ChainId } from '../types/ChainId' import { USDC_LEARN_MORE_LINK } from '../constants' @@ -22,7 +23,8 @@ export enum FastBridgeNames { Synapse = 'Synapse', Wormhole = 'Wormhole', LIFI = 'LI.FI', - Router = 'Router' + Router = 'Router', + deBridge = 'deBridge' } export enum SpecialTokenSymbol { @@ -39,11 +41,13 @@ export function getFastBridges({ from, to, tokenSymbol, + tokenAddress = '', amount }: { from: ChainId to: ChainId tokenSymbol: string + tokenAddress?: string amount: string }): FastBridgeInfo[] { function chainIdToSlug(chainId: ChainId): string { @@ -77,6 +81,8 @@ export function getFastBridges({ return `https://stargate.finance/transfer?srcChain=${chainIdToSlug( from )}&dstChain=${chainIdToSlug(to)}&srcToken=${tokenSymbol}` + case FastBridgeNames.deBridge: + return `https://app.debridge.finance/?inputChain=${from}&outputChain=${to}&amount=${amount}&inputCurrency=${tokenAddress}` case FastBridgeNames.Synapse: // We can't specify the input chain for Synapse, as it will use whatever the user is connected to. // We make sure to prompt a network switch to Arbitrum prior to showing this. @@ -118,6 +124,10 @@ export function getFastBridges({ [FastBridgeNames.Synapse]: { imageSrc: Synapse, href: getBridgeDeepLink(FastBridgeNames.Synapse) + }, + [FastBridgeNames.deBridge]: { + imageSrc: deBridge, + href: getBridgeDeepLink(FastBridgeNames.deBridge) } }