Skip to content

Commit

Permalink
use pnpm. update chakra to v3. add dark mode. remove eoa switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelis0x committed Dec 23, 2024
1 parent 1dc66c9 commit 51e0571
Show file tree
Hide file tree
Showing 24 changed files with 8,945 additions and 5,976 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules
yarn.lock
27 changes: 0 additions & 27 deletions apps/feeling-lucky/app/components/EoaModeSelector.tsx

This file was deleted.

66 changes: 0 additions & 66 deletions apps/feeling-lucky/app/components/TokenSelector.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions apps/feeling-lucky/app/components/Watchers.tsx

This file was deleted.

33 changes: 2 additions & 31 deletions apps/feeling-lucky/app/config.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,9 @@
import { extendTheme } from "@chakra-ui/react";
import { createSystem, defaultConfig } from "@chakra-ui/react";
import { createConfig } from "@privy-io/wagmi";
import { base } from "viem/chains";
import { http } from "viem";

export const chakraTheme = extendTheme({
components: {
Badge: {
baseStyle: {
borderRadius: "full",
},
},
Button: {
variants: {
solid: {
bg: "gray.700",
color: "white",
_hover: {
bg: "blackAlpha.800",
},
_disabled: {
bg: "gray.200",
color: "gray.400",
},
},
outline: {
borderColor: "gray.200",
_hover: {
bg: "gray.50",
},
},
},
},
},
});
export const chakraTheme = createSystem(defaultConfig, {});

export const wagmiConfig = createConfig({
chains: [base], // Pass your required chains as an array
Expand Down
6 changes: 1 addition & 5 deletions apps/feeling-lucky/app/hooks/common.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useMemo } from "react";
import { isEoaMode } from "../util";
import { Address } from "@enso/shared/types";
import { useQuery } from "@tanstack/react-query";
import { ETH_ADDRESS, ETH_TOKEN } from "../constants";

type Token = {
export type Token = {
address: Address;
name: string;
symbol: string;
Expand All @@ -30,8 +28,6 @@ export const useOneInchTokenList = () =>
queryFn: getOneInchTokenList,
});

export const useIsEoaEnabled = () => useMemo(isEoaMode, []);

export const useTokenFromList = (tokenAddress: Address) => {
const { data } = useGeckoList();

Expand Down
34 changes: 1 addition & 33 deletions apps/feeling-lucky/app/hooks/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useWallets } from "@privy-io/react-auth";
import { useSetActiveWallet } from "@privy-io/wagmi";
import { BaseError } from "viem";
import { useQueryClient } from "@tanstack/react-query";
import { useIsEoaEnabled, useTokenFromList } from "./common";
import { useTokenFromList } from "./common";
import erc20Abi from "../../erc20Abi.json";
import { useEnsoRouterData } from "./enso";
import { formatNumber, normalizeValue } from "@enso/shared/util";
Expand Down Expand Up @@ -246,38 +246,6 @@ export const useNetworkId = () => {
return +activeWallet?.chainId.split(":")[1];
};

export const useSetValidWagmiAddress = () => {
const { address } = useAccount();
const { wallets } = useWallets();
const { setActiveWallet } = useSetActiveWallet();
const { disconnect } = useDisconnect();
const isEoaEnabled = useIsEoaEnabled();

// set wagmi active address depending on if eoa mode is enabled
useEffect(() => {
const targetAddress = wallets.find(
(wallet) =>
wallet.connectorType === (isEoaEnabled ? "embedded" : "injected"),
);

// disconnect EOA from wagmi if EOA mode is disabled
// if (!isEoaEnabled)
// wallets.forEach((wallet) => {
// if (wallet.connectorType === "embedded" && wallet.address === address) {
// console.log("Disconnecting EOA wallet");
// disconnect();
// }
// });

if (targetAddress?.address !== address) {
console.log(`Setting active wallet to ${targetAddress?.address}`);
setActiveWallet(targetAddress || undefined).then(() =>
console.log("Active wallet set"),
);
}
}, [address, wallets]);
};

export const useSendEnsoTransaction = (
amountIn: string,
tokenOut: Address,
Expand Down
Loading

0 comments on commit 51e0571

Please sign in to comment.