Skip to content

Commit

Permalink
feat: clean airdropABI import error
Browse files Browse the repository at this point in the history
  • Loading branch information
yum0e committed Jul 25, 2023
1 parent 4626325 commit 16b9b16
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion front/script/register-root/latest-root.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0x1e66c7019d3ee0187b65d1cbd242fa5f9d2cea21d5d38661fc73b30258e30d3e
0x04377750dde97e90a959fdf4cc762702199b43214ed250836b1fbd7bf9820715
1 change: 0 additions & 1 deletion front/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useConnectModal } from "@rainbow-me/rainbowkit";
import { formatEther } from "viem";
import {
formatError,
getAuthRequestsAndClaimRequestsFromSismoConnectRequest,
getProofDataForAuth,
getProofDataForClaim,
getUserIdFromHex,
Expand Down
6 changes: 0 additions & 6 deletions front/src/utils/misc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { decodeAbiParameters, encodeAbiParameters } from "viem";
import { abi as AirdropABI } from "../../../abi/Airdrop.json";
import { errorsABI } from "./errorsABI";
import {
AuthRequest,
AuthType,
Expand All @@ -19,10 +17,6 @@ export function removeDashAndCapitalizeFirstLetter(str: string) {
return str.replace(/-/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
}

export const baseContractInputs = {
abi: [...AirdropABI, ...errorsABI],
};

export const signMessage = (address: `0x${string}`) => {
if (!address) return "";

Expand Down
8 changes: 5 additions & 3 deletions front/src/utils/useContract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import {
} from "viem";
import { useAccount, useNetwork, useSwitchNetwork, useWalletClient } from "wagmi";
import { waitForTransaction, getPublicClient } from "@wagmi/core";
import { abi as AirdropABI } from "../../../abi/Airdrop.json";
import Airdrop from "../../../abi/Airdrop.json";
import { errorsABI } from "./errorsABI";
import { formatError } from "./misc";
import { fundMyAccountOnLocalFork } from "./fundMyAccountOnLocalFork";
import { transactions } from "../../../broadcast/Airdrop.s.sol/5151111/run-latest.json";

export const airdropABI = [...Airdrop.abi, ...errorsABI] as const;

export type ContractClaim = {
airdropContract: GetContractReturnType<typeof AirdropABI, PublicClient, WalletClient>;
airdropContract: GetContractReturnType<typeof airdropABI, PublicClient, WalletClient>;
switchNetworkAsync: ((chainId?: number | undefined) => Promise<Chain>) | undefined;
waitingForTransaction: (hash: `0x${string}`) => Promise<TransactionReceipt | undefined>;
error: string;
Expand All @@ -40,7 +42,7 @@ export default function useContract({

const airdropContract = getContract({
address: transactions[0].contractAddress as `0x${string}`,
abi: [...AirdropABI, ...errorsABI],
abi: airdropABI,
publicClient,
walletClient: walletClient as WalletClient,
});
Expand Down

0 comments on commit 16b9b16

Please sign in to comment.