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

update wagmi, viem, rainbowkit #580

Merged
merged 7 commits into from
Oct 23, 2023
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
4 changes: 4 additions & 0 deletions packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ const config: HardhatUserConfig = {
url: "https://sepolia-rpc.scroll.io",
accounts: [deployerPrivateKey],
},
scroll: {
url: "https://rpc.scroll.io",
accounts: [deployerPrivateKey],
},
},
verify: {
etherscan: {
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import Link from "next/link";
import { hardhat } from "wagmi/chains";
import { hardhat } from "viem/chains";
import { CurrencyDollarIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline";
import { HeartIcon } from "@heroicons/react/24/outline";
import { SwitchTheme } from "~~/components/SwitchTheme";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import { createPublicClient, http, toHex } from "viem";
import { hardhat } from "wagmi/chains";
import { hardhat } from "viem/chains";

const publicClient = createPublicClient({
chain: hardhat,
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/blockexplorer/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from "react";
import { useRouter } from "next/router";
import { isAddress, isHex } from "viem";
import { hardhat } from "viem/chains";
import { usePublicClient } from "wagmi";
import { hardhat } from "wagmi/chains";

export const SearchBar = () => {
const [searchInput, setSearchInput] = useState("");
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/scaffold-eth/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useEffect, useState } from "react";
import Link from "next/link";
import { CopyToClipboard } from "react-copy-to-clipboard";
import { isAddress } from "viem";
import { hardhat } from "viem/chains";
import { useEnsAvatar, useEnsName } from "wagmi";
import { hardhat } from "wagmi/chains";
import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline";
import { BlockieAvatar } from "~~/components/scaffold-eth";
import { getBlockExplorerAddressLink, getTargetNetwork } from "~~/utils/scaffold-eth";
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/scaffold-eth/Faucet.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import { Address as AddressType, createWalletClient, http, parseEther } from "viem";
import { hardhat } from "viem/chains";
import { useNetwork } from "wagmi";
import { hardhat } from "wagmi/chains";
import { BanknotesIcon } from "@heroicons/react/24/outline";
import { Address, AddressInput, Balance, EtherInput, getParsedError } from "~~/components/scaffold-eth";
import { useTransactor } from "~~/hooks/scaffold-eth";
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/scaffold-eth/FaucetButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";
import { createWalletClient, http, parseEther } from "viem";
import { hardhat } from "viem/chains";
import { useAccount, useNetwork } from "wagmi";
import { hardhat } from "wagmi/chains";
import { BanknotesIcon } from "@heroicons/react/24/outline";
import { useAccountBalance, useTransactor } from "~~/hooks/scaffold-eth";

Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from "react";
import { useEffectOnce, useLocalStorage, useReadLocalStorage } from "usehooks-ts";
import { hardhat } from "viem/chains";
import { Connector, useAccount, useConnect } from "wagmi";
import { hardhat } from "wagmi/chains";
import scaffoldConfig from "~~/scaffold.config";
import { burnerWalletId, defaultBurnerChainId } from "~~/services/web3/wagmi-burner/BurnerConnector";
import { getTargetNetwork } from "~~/utils/scaffold-eth";
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { useLocalStorage } from "usehooks-ts";
import { Hex, HttpTransport, PrivateKeyAccount, createWalletClient, http } from "viem";
import { Chain, Hex, HttpTransport, PrivateKeyAccount, createWalletClient, http } from "viem";
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
import { Chain, WalletClient, usePublicClient } from "wagmi";
import { WalletClient, usePublicClient } from "wagmi";

const burnerStorageKey = "scaffoldEth2.burnerWallet.sk";

Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/hooks/scaffold-eth/useFetchBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
walletActions,
webSocket,
} from "viem";
import { hardhat } from "wagmi/chains";
import { hardhat } from "viem/chains";
import { decodeTransactionData } from "~~/utils/scaffold-eth";

const BLOCKS_PER_PAGE = 20;
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Account, Address, Transport, getContract } from "viem";
import { Chain, PublicClient, usePublicClient } from "wagmi";
import { Account, Address, Chain, Transport, getContract } from "viem";
import { PublicClient, usePublicClient } from "wagmi";
import { GetWalletClientResult } from "wagmi/actions";
import { useDeployedContractInfo } from "~~/hooks/scaffold-eth";
import { Contract, ContractName } from "~~/utils/scaffold-eth/contract";
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/hooks/scaffold-eth/useTransactor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TxnNotification = ({ message, blockExplorerLink }: { message: string; bloc
<div className={`flex flex-col ml-1 cursor-default`}>
<p className="my-0">{message}</p>
{blockExplorerLink && blockExplorerLink.length > 0 ? (
<a href={blockExplorerLink} target="_blank" rel="noreferrer" className="block underline text-md">
<a href={blockExplorerLink} target="_blank" rel="noreferrer" className="block link text-md">
check out transaction
</a>
) : null}
Expand Down
6 changes: 3 additions & 3 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@ethersproject/providers": "^5.7.2",
"@heroicons/react": "^2.0.11",
"@rainbow-me/rainbowkit": "1.0.8",
"@rainbow-me/rainbowkit": "1.1.2",
"@uniswap/sdk-core": "^4.0.1",
"@uniswap/v2-sdk": "^3.0.1",
"blo": "^1.0.1",
Expand All @@ -30,8 +30,8 @@
"react-hot-toast": "^2.4.0",
"use-debounce": "^8.0.4",
"usehooks-ts": "^2.7.2",
"viem": "^1.6.7",
"wagmi": "1.3.10",
"viem": "^1.16.6",
"wagmi": "1.4.4",
"zustand": "^4.1.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/pages/blockexplorer/address/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from "fs";
import { GetServerSideProps } from "next";
import path from "path";
import { createPublicClient, http } from "viem";
import { hardhat } from "wagmi/chains";
import { hardhat } from "viem/chains";
import {
AddressCodeTab,
AddressLogsTab,
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/pages/blockexplorer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect } from "react";
import type { NextPage } from "next";
import { hardhat } from "wagmi/chains";
import { hardhat } from "viem/chains";
import { PaginationButton } from "~~/components/blockexplorer/PaginationButton";
import { SearchBar } from "~~/components/blockexplorer/SearchBar";
import { TransactionsTable } from "~~/components/blockexplorer/TransactionsTable";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import type { NextPage } from "next";
import { Transaction, TransactionReceipt, formatEther, formatUnits } from "viem";
import { hardhat } from "viem/chains";
import { usePublicClient } from "wagmi";
import { hardhat } from "wagmi/chains";
import { Address } from "~~/components/scaffold-eth";
import { decodeTransactionData, getFunctionDetails, getTargetNetwork } from "~~/utils/scaffold-eth";

Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/scaffold.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as chains from "wagmi/chains";
import * as chains from "viem/chains";

export type ScaffoldConfig = {
targetNetwork: chains.Chain;
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/services/web3/wagmi-burner/BurnerConnector.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StaticJsonRpcProvider } from "@ethersproject/providers";
import { HttpTransport, PrivateKeyAccount, WalletClient, createWalletClient, http } from "viem";
import { Chain, HttpTransport, PrivateKeyAccount, WalletClient, createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { Chain, Connector } from "wagmi";
import { Connector } from "wagmi";
import { loadBurnerSK } from "~~/hooks/scaffold-eth";
import { BurnerConnectorError, BurnerConnectorErrorList } from "~~/services/web3/wagmi-burner/BurnerConnectorErrors";
import { BurnerConnectorData, BurnerConnectorOptions } from "~~/services/web3/wagmi-burner/BurnerConnectorTypes";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Chain, Wallet } from "@rainbow-me/rainbowkit";
import { hardhat } from "wagmi/chains";
import { hardhat } from "viem/chains";
import scaffoldConfig from "~~/scaffold.config";
import {
BurnerConnector,
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/services/web3/wagmiConnectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
safeWallet,
walletConnectWallet,
} from "@rainbow-me/rainbowkit/wallets";
import * as chains from "viem/chains";
import { configureChains } from "wagmi";
import * as chains from "wagmi/chains";
import { alchemyProvider } from "wagmi/providers/alchemy";
import { publicProvider } from "wagmi/providers/public";
import scaffoldConfig from "~~/scaffold.config";
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/utils/scaffold-eth/decodeTxData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TransactionWithFunction } from "./block";
import { GenericContractsDeclaration } from "./contract";
import { Abi, decodeFunctionData, getAbiItem } from "viem";
import { hardhat } from "wagmi/chains";
import { hardhat } from "viem/chains";
import contractData from "~~/generated/deployedContracts";

type ContractsInterfaces = Record<string, Abi>;
Expand Down
6 changes: 3 additions & 3 deletions packages/nextjs/utils/scaffold-eth/networks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as chains from "wagmi/chains";
import * as chains from "viem/chains";
import scaffoldConfig from "~~/scaffold.config";

export type TChainAttributes = {
Expand Down Expand Up @@ -52,8 +52,8 @@ export const NETWORKS_EXTRA_DATA: Record<string, TChainAttributes> = {
color: "#1969ff",
},
[chains.scrollSepolia.id]: {
color: '#fbebd4'
}
color: "#fbebd4",
},
};

/**
Expand Down
Loading