Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
nerderlyne committed Feb 26, 2024
1 parent 05e05ec commit 92b74d1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ui/components/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Account = () => {
Connected to{" "}
<select
defaultValue={chain?.id}
className="text-black"
className="text-black bg-white rounded-none"
onChange={(e) => switchChain({ chainId: Number(e.target.value) })}
>
{chains.map((chain) => (
Expand Down
44 changes: 42 additions & 2 deletions ui/components/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,54 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { WagmiProvider } from "wagmi";
import { arbitrum, mainnet, sepolia } from "wagmi/chains";
import { getDefaultConfig, RainbowKitProvider } from "@rainbow-me/rainbowkit";
import {
Chain,
getDefaultConfig,
RainbowKitProvider,
} from "@rainbow-me/rainbowkit";
import { siteConfig } from "@/lib/site";

const ANKR_API_KEY = process.env.NEXT_PUBLIC_ANKR_KEY;

if (!ANKR_API_KEY) {
throw new Error("Missing ANKR_API_KEY");
}

const chains = [
{
...mainnet,
rpcUrls: {
default: {
http: ["https://rpc.ankr.com/eth/" + ANKR_API_KEY],
webSocket: ["wss://rpc.ankr.com/eth/ws/" + ANKR_API_KEY],
},
},
},
{
...arbitrum,
rpcUrls: {
default: {
http: ["https://rpc.ankr.com/arbitrum/" + ANKR_API_KEY],
webSocket: ["wss://rpc.ankr.com/arbitrum/ws/" + ANKR_API_KEY],
},
},
},
{
...sepolia,
rpcUrls: {
default: {
http: ["https://rpc.ankr.com/eth_sepolia/" + ANKR_API_KEY],
webSocket: ["wss://rpc.ankr.com/eth_sepolia/ws/" + ANKR_API_KEY],
},
},
},
] as const satisfies Chain[];

const config = getDefaultConfig({
appName: siteConfig.name,
appDescription: siteConfig.description,
projectId: process.env.NEXT_PUBLIC_WC_ID!,
chains: [mainnet, sepolia, arbitrum],
chains,
ssr: true,
});

Expand Down
12 changes: 8 additions & 4 deletions ui/components/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ export const Shell = () => {
};

const addError = (error: Error) => {
addLine(<p className="text-[red]">{error.message}</p>);
addLine(<p className="text-[orange]">{error.message}</p>);
};

const addPreview = (preview: any) => {
addLine(<p>Preview: {serialize(preview)}</p>);
};

async function handleArbCommand(command: string) {
Expand All @@ -102,7 +106,7 @@ export const Shell = () => {
});
const previewedToken = preview[3];

addLine(<p>Preview: {serialize(preview)}</p>);
addPreview(preview);

if (isAddressEqual(previewedToken, zeroAddress)) {
// invalid token
Expand Down Expand Up @@ -180,7 +184,7 @@ export const Shell = () => {
confirmations: 1,
});

addLine(<p>Command Executed. Receipt: {JSON.stringify(commandReceipt)}</p>);
addLine(<p>Command Executed. Receipt: {serialize(commandReceipt)}</p>);
}

async function handleMainnetCommand(command: string) {
Expand Down Expand Up @@ -276,7 +280,7 @@ export const Shell = () => {
confirmations: 1,
});

addLine(<p>Command Executed. Receipt: {JSON.stringify(commandReceipt)}</p>);
addLine(<p>Command Executed. Receipt: {serialize(commandReceipt)}</p>);
}

async function onSubmit({ command }: z.infer<typeof formSchema>) {
Expand Down

0 comments on commit 92b74d1

Please sign in to comment.