Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet" />
<title>Static Exchange</title>
</head>
<body>
<body class="bg-canvas font-sans">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
Expand Down
47 changes: 39 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
import {
ConnectionProvider,
WalletProvider,
} from "@solana/wallet-adapter-react";
import { createWeb3Modal, defaultConfig } from "@web3modal/ethers/react";

import Chain from "./Chain";
import {
CoinbaseWalletAdapter,
LedgerWalletAdapter,
SolflareWalletAdapter,
} from "@solana/wallet-adapter-wallets";
import { BackpackWalletAdapter } from "@solana/wallet-adapter-backpack";
import Swap from "./Swap";
import { Toaster } from "react-hot-toast";
import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";
import { WalletModalProvider } from "@solana/wallet-adapter-react-ui";
import { clusterApiUrl } from "@solana/web3.js";
import { useMemo } from "react";

require("@solana/wallet-adapter-react-ui/styles.css");

// 1. Get projectId at https://cloud.walletconnect.com
const projectId = process.env.REACT_APP_WALLET_CONNECT_PROJECT_ID as string;

// 2. Set chains
const polygon = {
chainId: 137,
name: "Polygon",
Expand All @@ -16,7 +30,6 @@ const polygon = {
rpcUrl: "https://rpc-mainnet.maticvigil.com",
};

// 3. Create modal
const metadata = {
name: "Static Exchange",
description: "",
Expand All @@ -31,19 +44,37 @@ createWeb3Modal({
});

const HOST = "https://dev-static-api.ap.ngrok.io";
// const HOST = "http://localhost:8911";
const STATIC_GRAPHQL_URI = `${HOST}/graphql`;
const c = new ApolloClient({
uri: STATIC_GRAPHQL_URI,
cache: new InMemoryCache(),
});

function App() {
const network = WalletAdapterNetwork.Mainnet;
const endpoint = useMemo(() => clusterApiUrl(network), [network]);
const wallets = useMemo(
() => [
new BackpackWalletAdapter(),
new CoinbaseWalletAdapter(),
new LedgerWalletAdapter(),
new SolflareWalletAdapter(),
],
// eslint-disable-next-line react-hooks/exhaustive-deps
[network]
);

return (
<div className="App">
<div className="min-h-screen bg-canvas pt-10">
<ApolloProvider client={c}>
<Toaster />
<Chain />
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} autoConnect>
<WalletModalProvider>
<Toaster />
<Swap />
</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
</ApolloProvider>
</div>
);
Expand Down
56 changes: 0 additions & 56 deletions src/Chain.tsx

This file was deleted.

49 changes: 0 additions & 49 deletions src/Connect.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default function Loading() {
<div role="status">
<svg
aria-hidden="true"
className="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
className="w-8 h-8 text-gray-200 animate-spin fill-walnut"
viewBox="0 0 100 101"
fill="none"
>
Expand Down
Loading