Skip to content

Commit

Permalink
add fundingUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAlec committed Aug 9, 2024
1 parent d99ba5b commit 7dee5ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wallet/components/WalletDropdownFundLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ export function WalletDropdownFundLink({
return icon;
}
}, [icon]);

const currentURL = window.location.href;
const tabName = document.title;
const fundingUrl = `http://keys.coinbase.com/funding?dappName=${tabName}&dappUrl=${currentURL}&onchainkit=${version}`;
const windowSizes: Record<
's' | 'm' | 'l',
{
Expand All @@ -38,12 +39,11 @@ export function WalletDropdownFundLink({

const handleClick = (e: React.MouseEvent) => {
e.preventDefault();
const url = `http://keys.coinbase.com/funding?dappName=${tabName}&dappUrl=${currentURL}&onchainkit=${version}`;
const { width, height } = windowSizes[windowSize];
const left = (window.screen.width - width) / 2;
const top = (window.screen.height - height) / 2;
const windowFeatures = `width=${width},height=${height},resizable,scrollbars=yes,status=1,left=${left},top=${top}`;
window.open(url, 'Coinbase Fund Wallet', windowFeatures);
window.open(fundingUrl, 'Coinbase Fund Wallet', windowFeatures);
};

const commonClassName = cn(
Expand All @@ -65,7 +65,7 @@ export function WalletDropdownFundLink({
return (
<a
className={commonClassName}
href={`http://keys.coinbase.com/funding?dappName=${tabName}&dappUrl=${currentURL}`}
href={fundingUrl}
target={target}
rel={rel}
>
Expand Down

0 comments on commit 7dee5ad

Please sign in to comment.