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

General cleanup/consolidation #14

Merged
merged 1 commit into from
Mar 20, 2024
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axiom-scaffold-nextjs",
"version": "0.2.4",
"version": "0.2.5",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
10 changes: 3 additions & 7 deletions src/components/prove/SubmitQuery.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
"use client";

import { Constants } from "@/shared/constants";
import { useEffect, useState } from "react";
import {
useWatchContractEvent,
useWriteContract,
useSimulateContract,
} from "wagmi";
import Button from "../ui/Button";
import Decimals from "../ui/Decimals";
import { useRouter } from "next/navigation";
import { formatEther, formatUnits } from "viem";
import Link from "next/link";
import { useAxiomCircuit } from '@axiom-crypto/react';
import Decimals from "../ui/Decimals";
import { WebappSettings } from "@/lib/webappSettings";

export default function SubmitQuery() {
Expand All @@ -23,11 +22,8 @@ export default function SubmitQuery() {
// Prepare hook for the sendQuery transaction
// Note: builtQuery should not be null because we check this in BuildQuery.tsx
const { data } = useSimulateContract({
...builtQuery!,
address: builtQuery!.address as `0x${string}`,
abi: builtQuery!.abi,
functionName: builtQuery!.functionName,
value: builtQuery!.value,
args: builtQuery!.args,
});
const { writeContract, isSuccess, isError, isPending } = useWriteContract();

Expand Down Expand Up @@ -90,7 +86,7 @@ export default function SubmitQuery() {
return null;
}
return (
<Link href={`${Constants.EXPLORER_BASE_URL}/query/${builtQuery?.queryId}`} target="_blank">
<Link href={`${WebappSettings.explorerBaseUrl}/query/${builtQuery?.queryId}`} target="_blank">
View status on Axiom Explorer
</Link>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/AdvanceStepButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { classes } from "@/lib/utils";
import Link from "next/link";
import ConnectWallet from '@/components/web3/ConnectWallet'
import { useAccount, useSwitchChain } from "wagmi";
import { Constants } from "@/shared/constants";
import SwitchChainButton from "../web3/SwitchChainButton";
import Button from "./Button";
import { WebappSettings } from "@/lib/webappSettings";

export default function AdvanceStepButton({ label, href, selected, disabled }:{
label: string,
Expand All @@ -19,7 +19,7 @@ export default function AdvanceStepButton({ label, href, selected, disabled }:{
if (!isConnected) {
return <ConnectWallet />
}
if (chainId !== Constants.CHAIN_ID_SEPOLIA) {
if (chainId !== Number(WebappSettings.chainId)) {
return <SwitchChainButton switchChain={switchChain} />
}
return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/web3/SwitchChainButton.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use client";

import { Constants } from "@/shared/constants"
import Button from "../ui/Button"
import { SwitchChainMutate } from "wagmi/query";
import { Config } from "wagmi";
import { WebappSettings } from "@/lib/webappSettings";

export default function SwitchChainButton({ switchChain }: {
switchChain: SwitchChainMutate<Config, unknown>;
}) {
return (
<Button onClick={() => switchChain({ chainId: Constants.CHAIN_ID_SEPOLIA })}>
<Button onClick={() => switchChain({ chainId: Number(WebappSettings.chainId) })}>
Switch to Sepolia
</Button>
)
Expand Down
1 change: 1 addition & 0 deletions src/lib/webappSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export const WebappSettings = {
chainId: "11155111",
callbackTarget: "0x50F2D5c9a4A35cb922a631019287881f56A00ED5",
callbackAbi: AverageBalanceAbi,
explorerBaseUrl: "https://explorer.axiom.xyz/v2/sepolia",
}
4 changes: 0 additions & 4 deletions src/shared/constants.ts

This file was deleted.

Loading