Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate RelayKit SwapWidget #122

Open
wants to merge 57 commits into
base: eclipse-apps
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4c010fa
Merge pull request #55 from Eclipse-Laboratories-Inc/fixes
dandlezzz Sep 23, 2024
1e01ff9
Merge pull request #60 from Eclipse-Laboratories-Inc/fixes
hkey0 Sep 27, 2024
869aa65
fix: extend metadata
hkey0 Sep 30, 2024
646d5be
Merge branch 'fixes'
hkey0 Sep 30, 2024
06ea85b
add nightly wallet
hkey0 Oct 1, 2024
e9a54b6
update rpc
hkey0 Oct 8, 2024
eb5ceee
fix: update banner
hkey0 Oct 16, 2024
ae6bd67
fix: update fetch balance
hkey0 Oct 16, 2024
f58a1d1
Update mobile experience (#83)
hkey0 Oct 17, 2024
a93f6f0
update mobile & update rpc (#94)
hkey0 Oct 24, 2024
c9580f1
Create LRT Popup (#100)
hkey0 Oct 30, 2024
f54376e
fixes (#105)
hkey0 Oct 31, 2024
f750267
fix: update security param
hkey0 Nov 6, 2024
8a78d1e
update rpc
hkey0 Nov 8, 2024
6008a3d
Upgrade dynamic, add reservoirkit, and other dependencies
pedromcunha Nov 8, 2024
f3a59eb
Fix conflicts
pedromcunha Nov 8, 2024
72201b9
Resolve conflicts
pedromcunha Nov 8, 2024
896e940
Bare bones working integration of RelayKit Swap Widget
pedromcunha Nov 8, 2024
b5bdabc
Disable solana and enable eclipse sol wallets
pedromcunha Nov 11, 2024
9d8c588
fix: build error
hkey0 Nov 11, 2024
69a9619
Revert gas station
pedromcunha Nov 12, 2024
513a545
Merge branch 'eclipse-apps' of github.com:pedromcunha/eclipse-bridge-…
pedromcunha Nov 12, 2024
fcbafee
Fix build errors
pedromcunha Nov 12, 2024
7bedf25
Fix bug with flashing screen when loading chains, tweak theme to bett…
pedromcunha Nov 12, 2024
3e01029
Update relaykit widget theme and css
pedromcunha Nov 25, 2024
77baa85
Fix hardcoded decimals
pedromcunha Nov 26, 2024
377e74a
Resolve conflicts
pedromcunha Dec 2, 2024
053aab3
fix: upgrade anchor version to fix IDL problem. add sepolia
hkey0 Dec 3, 2024
bbfa327
fix: css fixes
hkey0 Dec 4, 2024
f4b7615
fix: remove package-lock file
hkey0 Dec 4, 2024
feb8f08
fix: resolve conflicts
hkey0 Dec 4, 2024
a193517
fix: resolve conflicts
hkey0 Dec 4, 2024
86e34ca
fix: update button states
hkey0 Dec 4, 2024
01877b3
fix: update button font
hkey0 Dec 4, 2024
ae0bd50
fix: set ethereum mainnet as the default from chain
hkey0 Dec 4, 2024
b4fba30
fix: sort activity objects by timestamp
hkey0 Dec 10, 2024
519017c
feat: instant deposit modal
hkey0 Dec 12, 2024
601a247
feat: instant deposit modal
hkey0 Dec 12, 2024
e531c56
feat: downgrade typescript version
hkey0 Dec 12, 2024
9207752
fix: conflicts
hkey0 Dec 12, 2024
0b48016
fix: set key props
hkey0 Dec 12, 2024
cda3eac
fix: downgrade react types version
hkey0 Dec 12, 2024
c81a962
feat(InstantTransactionDetails): add copy animation for wallet addres…
hkey0 Dec 12, 2024
22e810d
fix: add unknown token icon. filter relay transaction history to show…
hkey0 Dec 17, 2024
6a9a1ef
fix: fetch balances properly, fix styling issues
hkey0 Dec 24, 2024
0d76369
fix: build issue
hkey0 Dec 24, 2024
d93ac8a
fix: build issue
hkey0 Dec 24, 2024
a57f1d9
fix: remove phantom
hkey0 Dec 24, 2024
010be25
fix: weird overflow issue
hkey0 Dec 24, 2024
29229e1
fix: update eclipse explorer url
hkey0 Dec 24, 2024
3cafa8e
fix: weird overflow issue
hkey0 Dec 24, 2024
1af197e
fix: use url parameters to set active tab
hkey0 Dec 25, 2024
d84eee2
fix: use url parameters to set active tab
hkey0 Dec 25, 2024
8330f44
fix: use url parameters to set active tab
hkey0 Dec 25, 2024
e7896c3
fix: use url parameters to set active tab
hkey0 Dec 25, 2024
75f6d48
fix: remove unnecessary file
hkey0 Dec 27, 2024
91a5d79
fix: fix conflicts
hkey0 Jan 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/node_modules
/.pnp
.pnp.js
package-lock.json

# testing
/coverage
Expand Down
221 changes: 39 additions & 182 deletions app/client-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,204 +1,61 @@
'use client';
"use client";
import "./globals.css";
import {
DynamicContextProvider,
EthereumWalletConnectors,
SolanaWalletConnectors,
} from "@/lib/dynamic";
import { Providers } from "@/app/providers";
import { usePathname } from 'next/navigation';
import { IBM_Plex_Sans } from 'next/font/google';
import { mergeNetworks } from '@dynamic-labs/sdk-react-core';
import { ETHERSCAN_TESTNET_URL } from "./components/constants";
import "@reservoir0x/relay-kit-ui/styles.css";
import { Providers } from "@/app/providers/providers";
import { usePathname } from "next/navigation";
import { IBM_Plex_Sans } from "next/font/google";
import { Suspense } from "react";
import { WagmiProvider } from "@/app/providers/wagmiProvider";
import { DynamicProvider } from "@/app/providers/DynamicProvider";
import { WalletFilterProvider } from "@/app/providers/WalletFilterProvider";
import { GasProviders } from "@/app/providers/GasProviders";

const ibmPlexSans = IBM_Plex_Sans({
subsets: ['latin'],
weight: ['400', '500', '700'],
subsets: ["latin"],
weight: ["400", "500", "600", "700"],
});

// TODO: maybe we can read it from a file
const cssOverrides = `
@media (min-width: 640px) {
.modal {
margin-left: var(--sidebar-width);
}
}

div { font-family: 'IBM Plex Sans', sans-serif; }
img[data-testid='iconic-solana'] {
content: url('/eclipse.png');
}

.wallet-progress-stepper, .accordion-item {
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 27px;
background: rgb(5, 5, 5);
}

.wallet-progress-stepper {border-radius: 20px;}
.wallet-progress-stepper div:first-of-type { background: transparent; }
.wallet-list-item__tile, .list-tile {
background: rgba(255, 255, 255, 0.03);
}

.wallet-list-item__tile:hover, .list-tile:hover {
background-color: rgba(255, 255, 255, 0.05)!important;
}

.accordion-item, .default-footer__footer {background: rgb(5, 5, 5);}
.button {background: rgba(161, 254, 160, 1); }
.button span {color: black; font-size: 15px;}
.button--padding-large {
padding: 14px 20px;
}
.stepper {
background: rgba(255, 255, 255, 0.03);
padding: 8px;
border-radius: 10px;
padding-inline: 16px;
}
.badge__container {
background: rgba(255, 255, 255, 0.03);
color: rgba(71, 121, 255, 1);
}
.badge__dot {background-color: rgba(71, 121, 255, 1);}

.tos-and-pp__link {color: rgba(161, 254, 160, 1)!important;}
.tos-and-pp__text {color: white; font-size: 12px; font-weight: 500;}
.dynamic-shadow-dom-content div {
transition: none;
}

.bridge-welcome-layout__body {
gap: 20px;
padding: 0 20px 20px;
}
.bridge-welcome-layout__message-container { gap: 6px; }
.portal__backdrop { display: none!important; }
.modal-header--align-content-bottom {
border-bottom: none!important;
margin-bottom: 0!important;
}
.modal-header {
border-bottom: 1px rgba(255, 255, 255, 0.1) solid;
margin-bottom: 16px;
padding: 20px;
}
.step__icon--done {
background-color: #4779ff!important;
}
`

// sepolia
const evmNetworks = [{
blockExplorerUrls: [ETHERSCAN_TESTNET_URL],
chainId: 11155111,
chainName: 'Ethereum Sepolia',
iconUrls: ['https://app.dynamic.xyz/assets/networks/eth.svg'],
name: 'Ethereum',
nativeCurrency: {
decimals: 18,
name: 'Ether',
symbol: 'ETH',
},
networkId: 11155111,
rpcUrls: ['https://ethereum-sepolia.publicnode.com'],
vanityName: 'Sepolia',
}];
const eclipseWallets = ["backpacksol", "nightlysol"]

export default function ClientLayout({
children,
}: {
children: React.ReactNode;
}) {
const pathname = usePathname();
const passGlobalLayout = pathname === "/gas-station"

const passGlobalLayout = pathname === "/gas-station";
if (passGlobalLayout) {
return (
<Providers>
<body className={ibmPlexSans.className}>{children}</body>
</Providers>
<WagmiProvider>
{() => {
return (
<GasProviders>
<body className={ibmPlexSans.className}>{children}</body>
</GasProviders>
);
}}
</WagmiProvider>
);
}

return (
<html lang="en">
<html lang="en" className="dark">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<Providers>
<DynamicContextProvider
settings={{
events: {
onWalletRemoved: (args) => {
if (args.wallet.chain === "EVM") {
const client: any = args.wallet.connector.getWalletClient();
client.request({ "method": "wallet_revokePermissions", "params": [{"eth_accounts": {}}]});
}
},
onAuthFlowOpen: () => {
const depositBox = document.getElementsByClassName("deposit-container")[0] as HTMLElement;
depositBox.style.transform = "scale(0.9)";

// const submitButton = document.getElementsByClassName("submit-button")[0] as HTMLElement;
// if (submitButton) submitButton.className += " disabled";

const mainContent = document.getElementById("main-content") as HTMLElement;
mainContent.style.filter = "blur(3px)"
},
onAuthFlowClose: () => {
const depositBox = document.getElementsByClassName("deposit-container")[0] as HTMLElement;
depositBox.style.transform = "";

// const submitButton = document.getElementsByClassName("submit-button")[0] as HTMLElement;
// if (submitButton) submitButton.className = submitButton.className.replace("disabled", "");

const mainContent = document.getElementById("main-content") as HTMLElement;
mainContent.style.filter = ""
},
onWalletAdded: (args) => {
if (args.wallet.key === "backpacksol") {
//@ts-ignore
window.backpack.connect({chainGenesisHash: "EAQLJCV2mh23BsK2P9oYpV5CHVLDNHTxY"})
}
}
},
walletsFilter: (wallets) => wallets.filter((w) => w.walletConnector.supportedChains.includes("EVM") || eclipseWallets.includes(w.key)),
environmentId: process.env.NEXT_PUBLIC_ENVIRONMENT_ID || '',
walletConnectors: [EthereumWalletConnectors, SolanaWalletConnectors],
mobileExperience: "redirect",
recommendedWallets: [
{ walletKey: 'backpacksol', label: 'Recommended' }
],
initialAuthenticationMode: 'connect-only',
displaySiweStatement: true,
privacyPolicyUrl: "https://www.eclipse.xyz/privacy-policy",
termsOfServiceUrl: "https://www.eclipse.xyz/terms",
overrides: {
evmNetworks: (networks) => mergeNetworks(evmNetworks, networks),
chainDisplayValues: {
solana: {
displayName: 'Eclipse'
}
}
},
cssOverrides,
bridgeChains: [
{
chain: "EVM",
},
{
chain: "SOL",
},
],
}}
>
<body className={ibmPlexSans.className}>{children}</body>
</DynamicContextProvider>
</Providers>
<Suspense>
<WalletFilterProvider>
<WagmiProvider>
{({ chains }) => {
return (
<DynamicProvider chains={chains}>
<body className={ibmPlexSans.className}>
<Providers chains={chains}>{children}</Providers>
</body>
</DynamicProvider>
);
}}
</WagmiProvider>
</WalletFilterProvider>
</Suspense>
</html>
);

}
2 changes: 1 addition & 1 deletion app/components/ConnectedWallets/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, forwardRef, useMemo, useCallback } from 'react';
import React, { useEffect, useState, forwardRef, useMemo, useCallback, useContext } from 'react';
import { useDynamicContext, DynamicConnectButton } from '@dynamic-labs/sdk-react-core';
import { mainnet, sepolia } from "viem/chains";
import { createPublicClient, formatEther, http } from 'viem';
Expand Down
Loading