From 2d10b0d8aa6b99e4b1de472161e6b9795811eb6e Mon Sep 17 00:00:00 2001 From: sehyunc <41171808+sehyunc@users.noreply.github.com> Date: Fri, 18 Oct 2024 09:36:08 -0700 Subject: [PATCH] add token search param to external link to arb bridge --- components/dialogs/transfer/bridge-prompt.tsx | 10 ++++----- components/dialogs/transfer/default-form.tsx | 22 ++++++++----------- components/dialogs/transfer/helpers.ts | 8 ++++++- components/dialogs/transfer/usdc-form.tsx | 2 +- components/dialogs/transfer/weth-form.tsx | 2 +- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/components/dialogs/transfer/bridge-prompt.tsx b/components/dialogs/transfer/bridge-prompt.tsx index 9ff4e549..a07c483f 100644 --- a/components/dialogs/transfer/bridge-prompt.tsx +++ b/components/dialogs/transfer/bridge-prompt.tsx @@ -12,13 +12,13 @@ import { import { cn } from "@/lib/utils" export function BridgePrompt({ - baseToken, + token, formattedL1Balance, }: { - baseToken?: Token + token?: Token formattedL1Balance: string }) { - if (!baseToken) return null + if (!token) return null return ( @@ -26,7 +26,7 @@ export function BridgePrompt({ className={cn( "group flex gap-4 border p-4 transition-colors hover:cursor-pointer hover:border-primary", )} - href={constructArbitrumBridgeUrl(formattedL1Balance)} + href={constructArbitrumBridgeUrl(formattedL1Balance, token.address)} rel="noopener noreferrer" target="_blank" > @@ -49,7 +49,7 @@ export function BridgePrompt({ {`To deposit into Renegade, you must first bridge - your ${baseToken.ticker} to Arbitrum`} + your ${token.ticker} to Arbitrum`} ) diff --git a/components/dialogs/transfer/default-form.tsx b/components/dialogs/transfer/default-form.tsx index 105a06a4..b38a8771 100644 --- a/components/dialogs/transfer/default-form.tsx +++ b/components/dialogs/transfer/default-form.tsx @@ -585,7 +585,7 @@ export function DefaultForm({
@@ -597,12 +597,7 @@ export function DefaultForm({ Ethereum
- + @@ -631,12 +627,12 @@ export function DefaultForm({
diff --git a/components/dialogs/transfer/helpers.ts b/components/dialogs/transfer/helpers.ts index cf8c49c1..2ad6a029 100644 --- a/components/dialogs/transfer/helpers.ts +++ b/components/dialogs/transfer/helpers.ts @@ -92,11 +92,17 @@ export function isMaxBalance({ } } -export function constructArbitrumBridgeUrl(amount: string) { +export function constructArbitrumBridgeUrl( + amount: string, + mint?: `0x${string}`, +) { const base = new URL("https://bridge.arbitrum.io/") base.searchParams.set("amount", amount) base.searchParams.set("destinationChain", "arbitrum-one") base.searchParams.set("sourceChain", "ethereum") + if (mint) { + base.searchParams.set("token", mint) + } return base.toString() } diff --git a/components/dialogs/transfer/usdc-form.tsx b/components/dialogs/transfer/usdc-form.tsx index 3f5f5567..d10351e3 100644 --- a/components/dialogs/transfer/usdc-form.tsx +++ b/components/dialogs/transfer/usdc-form.tsx @@ -780,8 +780,8 @@ export function USDCForm({ })} >
diff --git a/components/dialogs/transfer/weth-form.tsx b/components/dialogs/transfer/weth-form.tsx index 085b5b2e..dfff10e2 100644 --- a/components/dialogs/transfer/weth-form.tsx +++ b/components/dialogs/transfer/weth-form.tsx @@ -879,8 +879,8 @@ export function WETHForm({ })} >