diff --git a/integrations/arweave/components/form-new-post/hook.ts b/integrations/arweave/components/form-new-post/hook.ts
index ef33871d..dce3dd1a 100644
--- a/integrations/arweave/components/form-new-post/hook.ts
+++ b/integrations/arweave/components/form-new-post/hook.ts
@@ -51,7 +51,7 @@ const useCreateArweavePostAPI = () => {
export const useArweavePostForm = () => {
const { wallet } = useArweaveWallet()
- const { mutate, data, isLoading, isError, error, isSuccess } =
+ const { mutate, data, isPending, isError, error, isSuccess } =
useCreateArweavePostAPI()
const txSchema = z.object({
data: z.string(),
@@ -128,7 +128,7 @@ export const useArweavePostForm = () => {
error,
data,
isError,
- isLoading,
+ isPending,
isSuccess,
txSchema,
form,
diff --git a/integrations/arweave/components/form-new-post/index.tsx b/integrations/arweave/components/form-new-post/index.tsx
index 1c4de373..95263791 100644
--- a/integrations/arweave/components/form-new-post/index.tsx
+++ b/integrations/arweave/components/form-new-post/index.tsx
@@ -30,7 +30,7 @@ export const FormNewPost = () => {
const {
onSubmit,
form,
- isLoading,
+ isPending,
isError,
isSuccess,
error,
@@ -155,13 +155,12 @@ export const FormNewPost = () => {
{isError ? (
- (error as { insufficientBalance: boolean })
- .insufficientBalance ? (
+ (error as any).insufficientBalance ? (
) : (
diff --git a/integrations/connext/components/form-connext-xtransfer.tsx b/integrations/connext/components/form-connext-xtransfer.tsx
index c048551b..5c9ec38e 100644
--- a/integrations/connext/components/form-connext-xtransfer.tsx
+++ b/integrations/connext/components/form-connext-xtransfer.tsx
@@ -5,13 +5,12 @@ import Image from "next/image"
import { motion } from "framer-motion"
import { MdOutlineSwapHoriz } from "react-icons/md"
import { RxCross2 } from "react-icons/rx"
-import { formatUnits, parseUnits } from "viem"
+import { Address, formatUnits, parseUnits } from "viem"
import {
useAccount,
useBalance,
- useNetwork,
useSendTransaction,
- useSwitchNetwork,
+ useSwitchChain,
} from "wagmi"
import { FADE_DOWN_ANIMATION_VARIANTS } from "@/config/design"
@@ -53,9 +52,8 @@ export function FormConnextXTransfer({
isMainnet,
setIsMainnet,
}: FormConnextXTransferProps) {
- const { chain } = useNetwork()
- const { address } = useAccount()
- const { isLoading: isSwitchingChain, switchNetwork } = useSwitchNetwork()
+ const { address, chain } = useAccount()
+ const { isPending: isSwitchingChain, switchChain } = useSwitchChain()
const [originChain, setOriginChain] = useState(optimismDomainId)
const [destinationChain, setDestinationChain] = useState(arbitrumDomainId)
@@ -80,7 +78,6 @@ export function FormConnextXTransfer({
(contract) => contract.chain_id === getChain(originChain)?.chain_id
)?.contract_address as `0x${string}`,
chainId: getChain(originChain)?.chain_id ?? 1,
- watch: true,
})
const { data: destinationBalance } = useBalance({
address,
@@ -88,7 +85,6 @@ export function FormConnextXTransfer({
(contract) => contract.chain_id === getChain(destinationChain)?.chain_id
)?.contract_address as `0x${string}`,
chainId: getChain(destinationChain)?.chain_id ?? 1,
- watch: true,
})
const transferSupported = useSupportedTransfer({
@@ -157,17 +153,17 @@ export function FormConnextXTransfer({
const transfers = useLatestTransfers(isMainnet)
const {
- isLoading: txLoading,
+ isPending: txLoading,
isSuccess: txSuccess,
reset: txReset,
sendTransaction,
- } = useSendTransaction(xcallRequest)
+ } = useSendTransaction()
const {
- isLoading: approveTxLoading,
+ isPending: approveTxLoading,
isSuccess: approveTxSuccess,
reset: approveTxReset,
sendTransaction: approveSendTransaction,
- } = useSendTransaction(approveRequest)
+ } = useSendTransaction()
const isInOriginChain = () => {
return chain?.id === getChain(originChain)?.chain_id
@@ -192,10 +188,20 @@ export function FormConnextXTransfer({
const sendTx = () => {
if (approveRequest && !contractApproved) {
setContractApproved(true)
- return approveSendTransaction?.()
+ return approveSendTransaction?.({
+ to: approveRequest?.to as Address,
+ value: approveRequest?.value,
+ data: approveRequest?.data,
+ chainId: getChain(originChain)?.chain_id,
+ })
}
if (xcallRequest) {
- sendTransaction?.()
+ sendTransaction?.({
+ to: xcallRequest?.to as Address,
+ value: xcallRequest?.value,
+ data: xcallRequest?.data,
+ chainId: getChain(originChain)?.chain_id,
+ })
}
}
@@ -259,7 +265,7 @@ export function FormConnextXTransfer({
const originChainData = getChain(originChain)
if (!isInOriginChain()) {
- switchNetwork?.(originChainData?.chain_id)
+ switchChain?.({ chainId: originChainData?.chain_id! })
}
}
diff --git a/integrations/connext/hooks/use-approve-if-needed.ts b/integrations/connext/hooks/use-approve-if-needed.ts
index 6454607f..930b5789 100644
--- a/integrations/connext/hooks/use-approve-if-needed.ts
+++ b/integrations/connext/hooks/use-approve-if-needed.ts
@@ -42,13 +42,17 @@ export const useApproveIfNeeded = ({
return data.txRequest
}
- const { data: request, isLoading } = useQuery(
- ["approveIfNeeded", isMainnet, originDomain, assetAddress, amount],
- {
- queryFn: fetchData,
- enabled: !!originDomain && !!assetAddress && !!amount, // only fetch if all params are truthy
- }
- )
+ const { data: request, isLoading } = useQuery({
+ queryKey: [
+ "approveIfNeeded",
+ isMainnet,
+ originDomain,
+ assetAddress,
+ amount,
+ ],
+ queryFn: fetchData,
+ enabled: !!originDomain && !!assetAddress && !!amount, // only fetch if all params are truthy
+ })
return { request, isLoading }
}
diff --git a/integrations/connext/hooks/use-estimated-amount.ts b/integrations/connext/hooks/use-estimated-amount.ts
index 3dcccbe1..2c108d62 100644
--- a/integrations/connext/hooks/use-estimated-amount.ts
+++ b/integrations/connext/hooks/use-estimated-amount.ts
@@ -38,8 +38,8 @@ export const useEstimatedAmount = ({
}
const { data: { amount: estimatedAmount, isFastPath } = {}, isLoading } =
- useQuery(
- [
+ useQuery({
+ queryKey: [
"estimatedAmount",
isMainnet,
originDomain,
@@ -47,15 +47,13 @@ export const useEstimatedAmount = ({
originTokenAddress,
amount,
],
- {
- queryFn: fetchData,
- enabled:
- !!originDomain &&
- !!destinationDomain &&
- !!originTokenAddress &&
- !!amount, // only fetch if all params are truthy
- }
- )
+ queryFn: fetchData,
+ enabled:
+ !!originDomain &&
+ !!destinationDomain &&
+ !!originTokenAddress &&
+ !!amount, // only fetch if all params are truthy
+ })
return {
estimatedAmount: estimatedAmount || "0",
diff --git a/integrations/connext/hooks/use-estimated-relayer-fee.ts b/integrations/connext/hooks/use-estimated-relayer-fee.ts
index 75af0182..5eda52f8 100644
--- a/integrations/connext/hooks/use-estimated-relayer-fee.ts
+++ b/integrations/connext/hooks/use-estimated-relayer-fee.ts
@@ -30,13 +30,16 @@ export const useEstimatedRelayerFee = ({
return data
}
- const { data: { relayerFee } = {} } = useQuery(
- ["estimatedRelayerFee", isMainnet, originDomain, destinationDomain],
- {
- queryFn: fetchData,
- enabled: !!originDomain && !!destinationDomain, // only fetch if both params are truthy
- }
- )
+ const { data: { relayerFee } = {} } = useQuery({
+ queryKey: [
+ "estimatedRelayerFee",
+ isMainnet,
+ originDomain,
+ destinationDomain,
+ ],
+ queryFn: fetchData,
+ enabled: !!originDomain && !!destinationDomain, // only fetch if both params are truthy
+ })
return relayerFee || "0"
}
diff --git a/integrations/connext/hooks/use-latest-transfers.ts b/integrations/connext/hooks/use-latest-transfers.ts
index cc33e8e2..71b46fb7 100644
--- a/integrations/connext/hooks/use-latest-transfers.ts
+++ b/integrations/connext/hooks/use-latest-transfers.ts
@@ -24,13 +24,11 @@ export const useLatestTransfers = (isMainnet: boolean) => {
return data.transfers
}
- const { data: transfers = [] } = useQuery(
- ["latestTransfers", isMainnet, address],
- {
- queryFn: fetchTransfers,
- refetchInterval: 10000, // Refetch data every 10 seconds
- }
- )
+ const { data: transfers = [] } = useQuery({
+ queryKey: ["latestTransfers", isMainnet, address],
+ queryFn: fetchTransfers,
+ refetchInterval: 10000, // Refetch data every 10 seconds
+ })
return transfers
}
diff --git a/integrations/connext/hooks/use-xcall.ts b/integrations/connext/hooks/use-xcall.ts
index ad100e9d..52a0b6e7 100644
--- a/integrations/connext/hooks/use-xcall.ts
+++ b/integrations/connext/hooks/use-xcall.ts
@@ -33,8 +33,8 @@ export const useXcall = ({
}: XCallArgs): IXCall => {
const { address } = useAccount()
- const { data, isLoading } = useQuery
(
- [
+ const { data, isLoading } = useQuery({
+ queryKey: [
"xcall",
isMainnet,
origin,
@@ -45,33 +45,31 @@ export const useXcall = ({
relayerFee,
address,
],
- {
- queryFn: async () => {
- const response = await axios.post(
- `/api/connext/xcall`,
- {
- environment: isMainnet ? "mainnet" : "testnet",
- origin,
- destination,
- to,
- asset,
- amount,
- signer: address,
- relayerFee,
- slippage: "300",
- }
- )
- return response.data.txRequest
- },
- enabled:
- !!origin &&
- !!destination &&
- !!to &&
- !!asset &&
- !!amount &&
- relayerFee !== "0",
- }
- )
+ queryFn: async () => {
+ const response = await axios.post(
+ `/api/connext/xcall`,
+ {
+ environment: isMainnet ? "mainnet" : "testnet",
+ origin,
+ destination,
+ to,
+ asset,
+ amount,
+ signer: address,
+ relayerFee,
+ slippage: "300",
+ }
+ )
+ return response.data.txRequest
+ },
+ enabled:
+ !!origin &&
+ !!destination &&
+ !!to &&
+ !!asset &&
+ !!amount &&
+ relayerFee !== "0",
+ })
return { request: data, isLoading }
}
diff --git a/integrations/defi-llama/hooks/coins/use-chart.ts b/integrations/defi-llama/hooks/coins/use-chart.ts
index 46a7be30..8f9f6c67 100644
--- a/integrations/defi-llama/hooks/coins/use-chart.ts
+++ b/integrations/defi-llama/hooks/coins/use-chart.ts
@@ -55,7 +55,7 @@ export function useChart({
searchWidth = DEFAULT_SEARCH_WIDTH,
spanDataPoints,
period,
- cacheTime = DEFAULT_CACHE_TIME,
+ gcTime = DEFAULT_CACHE_TIME,
enabled,
...options
}: UseChartProps) {
@@ -67,7 +67,8 @@ export function useChart({
Array.isArray(coins) ? coins : [coins]
)
- return useQuery(["defi-llama", "chart", coins], {
+ return useQuery({
+ queryKey: ["defi-llama", "chart", coins],
queryFn: async () => {
const url = new URL(`${DEFI_LLAMA_API_URL}/chart/${formattedCoins}`)
const params = new URLSearchParams()
diff --git a/integrations/defi-llama/hooks/coins/use-current-token-price.ts b/integrations/defi-llama/hooks/coins/use-current-token-price.ts
index 6dc44166..239ae619 100644
--- a/integrations/defi-llama/hooks/coins/use-current-token-price.ts
+++ b/integrations/defi-llama/hooks/coins/use-current-token-price.ts
@@ -39,7 +39,7 @@ interface UseCurrentTokenPriceProps extends QueryOptions {
export function useCurrentTokenPrice({
coins,
searchWidth = DEFAULT_SEARCH_WIDTH,
- cacheTime = DEFAULT_CACHE_TIME,
+ gcTime = DEFAULT_CACHE_TIME,
enabled,
...options
}: UseCurrentTokenPriceProps) {
@@ -74,7 +74,8 @@ export function useCurrentTokenPrice({
}
}
- return useQuery(["defi-llama", "current-price", coins, searchWidth], {
+ return useQuery({
+ queryKey: ["defi-llama", "current-price", coins, searchWidth],
queryFn: fetcher,
enabled: !!coins && enabled,
...options,
diff --git a/integrations/defi-llama/hooks/coins/use-historical-token-price.ts b/integrations/defi-llama/hooks/coins/use-historical-token-price.ts
index a5eb6325..1bc14f76 100644
--- a/integrations/defi-llama/hooks/coins/use-historical-token-price.ts
+++ b/integrations/defi-llama/hooks/coins/use-historical-token-price.ts
@@ -41,7 +41,7 @@ interface UseHistoricalTokenPriceProps extends QueryOptions {
export function useHistoricalTokenPrice({
coins,
searchWidth = DEFAULT_SEARCH_WIDTH,
- cacheTime = DEFAULT_CACHE_TIME,
+ gcTime = DEFAULT_CACHE_TIME,
enabled,
timestamp,
...options
@@ -77,14 +77,12 @@ export function useHistoricalTokenPrice({
}
}
- return useQuery(
- ["defi-llama", "historical-price", coins, searchWidth, timestamp],
- {
- queryFn: fetcher,
- enabled: !!coins && enabled,
- ...options,
- }
- )
+ return useQuery({
+ queryKey: ["defi-llama", "historical-price", coins, searchWidth, timestamp],
+ queryFn: fetcher,
+ enabled: !!coins && enabled,
+ ...options,
+ })
}
interface UseHistoricalNativeTokenPriceProps
diff --git a/integrations/defi-llama/hooks/coins/use-token-percentage-change.ts b/integrations/defi-llama/hooks/coins/use-token-percentage-change.ts
index 5981db36..e39a0490 100644
--- a/integrations/defi-llama/hooks/coins/use-token-percentage-change.ts
+++ b/integrations/defi-llama/hooks/coins/use-token-percentage-change.ts
@@ -40,7 +40,7 @@ export function useTokenPercentageChange({
period = "1d",
lookForward = false,
timestamp = Date.now() / 1000,
- cacheTime = DEFAULT_CACHE_TIME,
+ gcTime = DEFAULT_CACHE_TIME,
enabled,
...options
}: UseTokenPercentageChangeProps) {
@@ -72,8 +72,8 @@ export function useTokenPercentageChange({
}
}
- return useQuery(
- [
+ return useQuery({
+ queryKey: [
"defi-llama",
"percentage-change-price",
coins,
@@ -81,12 +81,10 @@ export function useTokenPercentageChange({
lookForward,
timestamp,
],
- {
- queryFn: fetcher,
- enabled: !!coins && enabled,
- ...options,
- }
- )
+ queryFn: fetcher,
+ enabled: !!coins && enabled,
+ ...options,
+ })
}
interface UseNativeTokenPercentageChangeProps
diff --git a/integrations/disco/components/disco-profile-basic.tsx b/integrations/disco/components/disco-profile-basic.tsx
index b668e571..f1cb5ddb 100644
--- a/integrations/disco/components/disco-profile-basic.tsx
+++ b/integrations/disco/components/disco-profile-basic.tsx
@@ -2,7 +2,7 @@ import { HTMLAttributes } from "react"
import Image from "next/image"
import { LuExternalLink } from "react-icons/lu"
import ReactMarkdown from "react-markdown"
-import type { Address } from "wagmi"
+import type { Address } from "viem"
import { useUser } from "@/lib/hooks/use-user"
import { cn } from "@/lib/utils"
@@ -49,8 +49,8 @@ export const DiscoProfileBasic = ({
alt="Profile Avatar"
className="mx-auto max-w-full rounded-lg border-4 shadow-xl lg:ml-0"
height={240}
- loader={() => data?.profile?.avatar}
- src={data?.profile?.avatar}
+ loader={() => data?.profile?.avatar || ""}
+ src={data?.profile?.avatar || ""}
width={240}
/>
)}
diff --git a/integrations/disco/components/disco-profile-credentials.tsx b/integrations/disco/components/disco-profile-credentials.tsx
index 4b46f6b8..2fd73e74 100644
--- a/integrations/disco/components/disco-profile-credentials.tsx
+++ b/integrations/disco/components/disco-profile-credentials.tsx
@@ -1,5 +1,5 @@
import { HTMLAttributes } from "react"
-import type { Address } from "wagmi"
+import type { Address } from "viem"
import { useUser } from "@/lib/hooks/use-user"
import { cn } from "@/lib/utils"
diff --git a/integrations/disco/components/form-issue-proof-of-hack/hook.ts b/integrations/disco/components/form-issue-proof-of-hack/hook.ts
index c5482d2d..b4c65a3f 100644
--- a/integrations/disco/components/form-issue-proof-of-hack/hook.ts
+++ b/integrations/disco/components/form-issue-proof-of-hack/hook.ts
@@ -5,7 +5,7 @@ import { z } from "zod"
import { useDiscoIssueProofOfHack } from "../../hooks/use-disco-issue-proof-of-hack"
export const useDiscoIssueForm = () => {
- const { mutate, data, isLoading, isError, error, isSuccess } =
+ const { mutate, data, isPending, isError, error, isSuccess } =
useDiscoIssueProofOfHack()
const discoSchema = z.object({
eventDate: z.string().transform((value) => {
@@ -69,7 +69,7 @@ export const useDiscoIssueForm = () => {
error,
data,
isError,
- isLoading,
+ isPending,
isSuccess,
discoSchema,
form,
diff --git a/integrations/disco/components/form-issue-proof-of-hack/index.tsx b/integrations/disco/components/form-issue-proof-of-hack/index.tsx
index 00bdfec1..391f8ad2 100644
--- a/integrations/disco/components/form-issue-proof-of-hack/index.tsx
+++ b/integrations/disco/components/form-issue-proof-of-hack/index.tsx
@@ -19,7 +19,7 @@ import { issueProofOfHackFormControls } from "./controls"
import { useDiscoIssueForm } from "./hook"
export function FormCredentialIssuanceProofOfHack() {
- const { onSubmit, form, isLoading, isError, isSuccess, error, data } =
+ const { onSubmit, form, isPending, isError, isSuccess, error, data } =
useDiscoIssueForm()
const { handleSubmit, register } = form
const { toast, dismiss } = useToast()
@@ -77,9 +77,9 @@ export function FormCredentialIssuanceProofOfHack() {
diff --git a/integrations/disco/hooks/use-disco-get-credentials-from-did.ts b/integrations/disco/hooks/use-disco-get-credentials-from-did.ts
index 913b4e2a..c369f507 100644
--- a/integrations/disco/hooks/use-disco-get-credentials-from-did.ts
+++ b/integrations/disco/hooks/use-disco-get-credentials-from-did.ts
@@ -1,9 +1,10 @@
-import { useQuery } from "wagmi"
+import { useQuery } from "@tanstack/react-query"
import { appDiscoGetCredentialsFromDID } from "@/integrations/disco/routes/get-credentials-from-did/client"
export const useDiscoGetCredentialsFromDID = (did?: string, queryKey?: any) => {
- return useQuery(["discoCredentialsFromDID", did, queryKey], () =>
- appDiscoGetCredentialsFromDID(did)
- )
+ return useQuery({
+ queryKey: ["discoCredentialsFromDID", did, queryKey],
+ queryFn: () => appDiscoGetCredentialsFromDID(did),
+ })
}
diff --git a/integrations/disco/hooks/use-disco-get-profile-from-address.ts b/integrations/disco/hooks/use-disco-get-profile-from-address.ts
index e1ace9d2..55208ce5 100644
--- a/integrations/disco/hooks/use-disco-get-profile-from-address.ts
+++ b/integrations/disco/hooks/use-disco-get-profile-from-address.ts
@@ -1,5 +1,5 @@
import { useQuery } from "@tanstack/react-query"
-import type { Address } from "wagmi"
+import type { Address } from "viem"
import { appDiscoGetProfileFromAddress } from "@/integrations/disco/routes/get-profile-from-address/client"
@@ -7,7 +7,8 @@ export const useDiscoGetProfileFromAddress = (
address?: Address,
queryKey?: any
) => {
- return useQuery(["discoProfileFromAddress", address, queryKey], async () =>
- appDiscoGetProfileFromAddress(address)
- )
+ return useQuery({
+ queryKey: ["discoProfileFromAddress", address, queryKey],
+ queryFn: () => appDiscoGetProfileFromAddress(address),
+ })
}
diff --git a/integrations/disco/hooks/use-disco-get-profile-from-did.ts b/integrations/disco/hooks/use-disco-get-profile-from-did.ts
index 2dfa2e1e..18e4d84a 100644
--- a/integrations/disco/hooks/use-disco-get-profile-from-did.ts
+++ b/integrations/disco/hooks/use-disco-get-profile-from-did.ts
@@ -1,9 +1,10 @@
-import { useQuery } from "wagmi"
+import { useQuery } from "@tanstack/react-query"
import { appDiscoGetCredentialsFromDID } from "@/integrations/disco/routes/get-credentials-from-did/client"
export const useDiscoGetProfileFromDID = (did?: string, queryKey?: any) => {
- return useQuery(["discoProfileFromDID", did, queryKey], () =>
- appDiscoGetCredentialsFromDID(did)
- )
+ return useQuery({
+ queryKey: ["discoProfileFromDID", did, queryKey],
+ queryFn: () => appDiscoGetCredentialsFromDID(did),
+ })
}
diff --git a/integrations/disco/routes/get-profile-from-address/client.ts b/integrations/disco/routes/get-profile-from-address/client.ts
index 33faddbc..89f94c03 100644
--- a/integrations/disco/routes/get-profile-from-address/client.ts
+++ b/integrations/disco/routes/get-profile-from-address/client.ts
@@ -1,5 +1,5 @@
import axios from "axios"
-import type { Address } from "wagmi"
+import type { Address } from "viem"
import { Profile } from "../../utils/types"
diff --git a/integrations/disco/routes/get-profile-from-did/client.ts b/integrations/disco/routes/get-profile-from-did/client.ts
index 9510bfa4..852a27ce 100644
--- a/integrations/disco/routes/get-profile-from-did/client.ts
+++ b/integrations/disco/routes/get-profile-from-did/client.ts
@@ -1,5 +1,5 @@
import axios from "axios"
-import type { Address } from "wagmi"
+import type { Address } from "viem"
import { Profile } from "../../utils/types"
diff --git a/integrations/erc1155/components/erc1155-contract-uri.tsx b/integrations/erc1155/components/erc1155-contract-uri.tsx
index 741d1025..7aafc949 100644
--- a/integrations/erc1155/components/erc1155-contract-uri.tsx
+++ b/integrations/erc1155/components/erc1155-contract-uri.tsx
@@ -1,4 +1,4 @@
-import { useErc1155ContractUri } from "../generated/erc1155-wagmi"
+import { useReadErc1155ContractUri } from "../generated/erc1155-wagmi"
import { ERC1155Props } from "../utils/types"
export function ERC1155ContractUri({
@@ -7,7 +7,7 @@ export function ERC1155ContractUri({
className,
...props
}: ERC1155Props) {
- const { data } = useErc1155ContractUri({
+ const { data } = useReadErc1155ContractUri({
address,
chainId,
})
diff --git a/integrations/erc1155/components/erc1155-deploy-test.tsx b/integrations/erc1155/components/erc1155-deploy-test.tsx
index ac4b2cbb..f0e88628 100644
--- a/integrations/erc1155/components/erc1155-deploy-test.tsx
+++ b/integrations/erc1155/components/erc1155-deploy-test.tsx
@@ -26,6 +26,7 @@ export function Erc1155DeployTest() {
let hash: `0x${string}` | undefined
try {
+ // @ts-ignore
hash = await walletClient.deployContract({
abi: erc1155ABI,
bytecode: erc1155ByteCode,
@@ -37,6 +38,7 @@ export function Erc1155DeployTest() {
setIsSigning(false)
setIsWaitingTransaction(true)
try {
+ // @ts-ignore
const receipt = await publicClient.waitForTransactionReceipt({ hash })
if (!receipt.contractAddress) return
diff --git a/integrations/erc1155/components/erc1155-deploy.tsx b/integrations/erc1155/components/erc1155-deploy.tsx
index efc1d268..bca9ac4b 100644
--- a/integrations/erc1155/components/erc1155-deploy.tsx
+++ b/integrations/erc1155/components/erc1155-deploy.tsx
@@ -1,4 +1,5 @@
import { FormEvent, useState } from "react"
+import { deployContract, waitForTransactionReceipt } from "viem/actions"
import { usePublicClient, useWalletClient } from "wagmi"
import { Card, CardContent, CardFooter } from "@/components/ui/card"
@@ -28,7 +29,8 @@ export function Erc1155Deploy() {
let hash: `0x${string}` | undefined
try {
- hash = await walletClient.deployContract({
+ // @ts-ignore
+ hash = await deployContract(walletClient, {
abi: erc1155ABI,
bytecode: erc1155ByteCode,
args: [name, symbol],
@@ -40,7 +42,10 @@ export function Erc1155Deploy() {
setIsSigning(false)
setIsWaitingTransaction(true)
try {
- const receipt = await publicClient.waitForTransactionReceipt({ hash })
+ if (!publicClient || !hash) return
+ const receipt = await waitForTransactionReceipt(publicClient, {
+ hash,
+ })
if (!receipt.contractAddress) return
setIsWaitingTransaction(false)
diff --git a/integrations/erc1155/components/erc1155-name.tsx b/integrations/erc1155/components/erc1155-name.tsx
index ccab47ef..46c268b4 100644
--- a/integrations/erc1155/components/erc1155-name.tsx
+++ b/integrations/erc1155/components/erc1155-name.tsx
@@ -1,4 +1,4 @@
-import { useErc1155Name } from "../generated/erc1155-wagmi"
+import { useReadErc1155Name } from "../generated/erc1155-wagmi"
import { ERC1155Props } from "../utils/types"
export function Erc1155Name({
@@ -7,7 +7,7 @@ export function Erc1155Name({
className,
...props
}: ERC1155Props) {
- const { data } = useErc1155Name({
+ const { data } = useReadErc1155Name({
address,
chainId,
})
diff --git a/integrations/erc1155/components/erc1155-owner-of.tsx b/integrations/erc1155/components/erc1155-owner-of.tsx
index b0b99b96..75dfa7f0 100644
--- a/integrations/erc1155/components/erc1155-owner-of.tsx
+++ b/integrations/erc1155/components/erc1155-owner-of.tsx
@@ -1,4 +1,4 @@
-import { useErc1155AccountsByToken } from "../generated/erc1155-wagmi"
+import { useReadErc1155AccountsByToken } from "../generated/erc1155-wagmi"
import { ERC1155Props } from "../utils/types"
interface ERC1155OwnerOfProps extends ERC1155Props {
@@ -12,11 +12,10 @@ export function Erc1155OwnerOf({
tokenId,
...props
}: ERC1155OwnerOfProps) {
- const { data } = useErc1155AccountsByToken({
+ const { data } = useReadErc1155AccountsByToken({
address,
chainId,
args: [tokenId],
- watch: true,
})
return (
diff --git a/integrations/erc1155/components/erc1155-read.tsx b/integrations/erc1155/components/erc1155-read.tsx
index 9fc49abd..d872b9bf 100644
--- a/integrations/erc1155/components/erc1155-read.tsx
+++ b/integrations/erc1155/components/erc1155-read.tsx
@@ -1,5 +1,5 @@
import React, { useState } from "react"
-import type { Address } from "wagmi"
+import type { Address } from "viem"
import { Card, CardContent, CardFooter } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
diff --git a/integrations/erc1155/components/erc1155-symbol.tsx b/integrations/erc1155/components/erc1155-symbol.tsx
index dd7ab036..e9049e09 100644
--- a/integrations/erc1155/components/erc1155-symbol.tsx
+++ b/integrations/erc1155/components/erc1155-symbol.tsx
@@ -1,4 +1,4 @@
-import { useErc1155Symbol } from "../generated/erc1155-wagmi"
+import { useReadErc1155Symbol } from "../generated/erc1155-wagmi"
import { ERC1155Props } from "../utils/types"
export function Erc1155Symbol({
@@ -7,7 +7,7 @@ export function Erc1155Symbol({
className,
...props
}: ERC1155Props) {
- const { data } = useErc1155Symbol({
+ const { data } = useReadErc1155Symbol({
address,
chainId,
})
diff --git a/integrations/erc1155/components/erc1155-token-total-supply.tsx b/integrations/erc1155/components/erc1155-token-total-supply.tsx
index 75ad2675..4b6482ec 100644
--- a/integrations/erc1155/components/erc1155-token-total-supply.tsx
+++ b/integrations/erc1155/components/erc1155-token-total-supply.tsx
@@ -1,4 +1,4 @@
-import { useErc1155TotalSupply } from "../generated/erc1155-wagmi"
+import { useReadErc1155TotalSupply } from "../generated/erc1155-wagmi"
import { ERC1155Props } from "../utils/types"
interface ERC1155TotalSupplyProps extends ERC1155Props {
@@ -12,11 +12,10 @@ export function ERC1155TokenTotalSupply({
tokenId,
...props
}: ERC1155TotalSupplyProps) {
- const { data } = useErc1155TotalSupply({
+ const { data } = useReadErc1155TotalSupply({
address,
chainId,
args: [tokenId],
- watch: true,
})
return (
diff --git a/integrations/erc1155/components/erc1155-token-uri.tsx b/integrations/erc1155/components/erc1155-token-uri.tsx
index fbde1df1..f33969ea 100644
--- a/integrations/erc1155/components/erc1155-token-uri.tsx
+++ b/integrations/erc1155/components/erc1155-token-uri.tsx
@@ -1,4 +1,4 @@
-import { useErc1155Uri } from "../generated/erc1155-wagmi"
+import { useReadErc1155Uri } from "../generated/erc1155-wagmi"
import { ERC1155Props } from "../utils/types"
interface ERC1155TokenUriProps extends ERC1155Props {
@@ -12,7 +12,7 @@ export function ERC1155TokenUri({
tokenId,
...props
}: ERC1155TokenUriProps) {
- const { data: tokenUriData } = useErc1155Uri({
+ const { data: tokenUriData } = useReadErc1155Uri({
address,
chainId,
args: [tokenId],
diff --git a/integrations/erc1155/components/erc1155-write-approve-for-all.tsx b/integrations/erc1155/components/erc1155-write-approve-for-all.tsx
index ed53588e..0494a787 100644
--- a/integrations/erc1155/components/erc1155-write-approve-for-all.tsx
+++ b/integrations/erc1155/components/erc1155-write-approve-for-all.tsx
@@ -1,7 +1,7 @@
import { useForm } from "react-hook-form"
import { useDebounce } from "usehooks-ts"
-import { BaseError } from "viem"
-import { Address, useWaitForTransaction } from "wagmi"
+import { type Address, type BaseError } from "viem"
+import { useWaitForTransactionReceipt } from "wagmi"
import { Card, CardContent, CardFooter } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
@@ -9,8 +9,8 @@ import { ContractWriteButton } from "@/components/blockchain/contract-write-butt
import { TransactionStatus } from "@/components/blockchain/transaction-status"
import {
- useErc1155SetApprovalForAll,
- usePrepareErc1155SetApprovalForAll,
+ useSimulateErc1155SetApprovalForAll,
+ useWriteErc1155SetApprovalForAll,
} from "../generated/erc1155-wagmi"
interface Erc1155WriteSetApprovalForAllProps {
@@ -26,27 +26,33 @@ export function Erc1155WriteApproveForAll({
const debouncedToAddress = useDebounce(watchToAddress, 500)
const debouncedShouldApproved = useDebounce(watchShouldApproved, 500)
- const { config, error, isError } = usePrepareErc1155SetApprovalForAll({
+ const {
+ data: config,
+ error,
+ isError,
+ } = useSimulateErc1155SetApprovalForAll({
address,
args:
debouncedToAddress && debouncedShouldApproved
? [debouncedToAddress, debouncedShouldApproved]
: undefined,
- enabled: Boolean(debouncedToAddress && debouncedShouldApproved),
+ query: {
+ enabled: Boolean(debouncedToAddress && debouncedShouldApproved),
+ },
})
const {
data,
- write,
- isLoading: isLoadingWrite,
- } = useErc1155SetApprovalForAll(config)
+ writeContract,
+ isPending: isLoadingWrite,
+ } = useWriteErc1155SetApprovalForAll()
- const { isLoading: isLoadingTx, isSuccess } = useWaitForTransaction({
- hash: data?.hash,
+ const { isLoading: isLoadingTx, isSuccess } = useWaitForTransactionReceipt({
+ hash: data,
})
const onSubmit = () => {
- write?.()
+ writeContract?.(config!.request)
}
return (
@@ -66,13 +72,13 @@ export function Erc1155WriteApproveForAll({
isLoadingWrite={isLoadingWrite}
loadingTxText="Approving..."
type="submit"
- write={!!write}
+ write={!!writeContract}
>
Approve For All
{
- write?.()
+ writeContract?.(config!.request)
}
return (
@@ -65,13 +75,13 @@ export function Erc1155WriteApprove({ address }: Erc1155WriteApproveProps) {
isLoadingWrite={isLoadingWrite}
loadingTxText="Approving..."
type="submit"
- write={!!write}
+ write={!!writeContract}
>
Approve
{
- write?.()
+ writeContract?.(config!.request)
}
return (
@@ -147,13 +153,13 @@ export function Erc1155WriteBatchTransfer({
isLoadingWrite={isLoadingWrite}
loadingTxText="Transferring..."
type="submit"
- write={!!write}
+ write={!!writeContract}
>
Batch Transfer
{
- write?.()
+ writeContract?.(config!.request)
}
return (
@@ -89,13 +99,13 @@ export function Erc1155WriteMint({ address }: Erc1155WriteMintProps) {
isLoadingWrite={isLoadingWrite}
loadingTxText="Minting..."
type="submit"
- write={!!write}
+ write={!!writeContract}
>
Mint
{
- write?.()
+ writeContract?.(config!.request)
}
return (
@@ -98,13 +104,13 @@ export function Erc1155WriteTransfer({ address }: Erc1155WriteTransferProps) {
isLoadingWrite={isLoadingWrite}
loadingTxText="Transferring..."
type="submit"
- write={!!write}
+ write={!!writeContract}
>
Transfer
>(
- config: Omit, 'abi'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, ...config } as UseContractReadConfig)
-}
+export const useReadErc1155AccountsByToken =
+ /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'accountsByToken',
+ })
/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"Fungible"`.
- */
-export function useErc1155Fungible>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'Fungible', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"allowance"`
+ */
+export const useReadErc1155Allowance = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'allowance',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"balanceOf"`
+ */
+export const useReadErc1155BalanceOf = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'balanceOf',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"balanceOfBatch"`
+ */
+export const useReadErc1155BalanceOfBatch = /*#__PURE__*/ createUseReadContract(
+ { abi: erc1155Abi, functionName: 'balanceOfBatch' },
+)
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"contractURI"`
+ */
+export const useReadErc1155ContractUri = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'contractURI',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"isApprovedForAll"`
+ */
+export const useReadErc1155IsApprovedForAll =
+ /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'isApprovedForAll',
+ })
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"name"`
+ */
+export const useReadErc1155Name = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'name',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"owner"`
+ */
+export const useReadErc1155Owner = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'owner',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"supportsInterface"`
+ */
+export const useReadErc1155SupportsInterface =
+ /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'supportsInterface',
+ })
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"symbol"`
+ */
+export const useReadErc1155Symbol = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'symbol',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"tokensByAccount"`
+ */
+export const useReadErc1155TokensByAccount =
+ /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'tokensByAccount',
+ })
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"NonFungible"`.
- */
-export function useErc1155NonFungible>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'NonFungible', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"NonFungible2nd"`.
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"totalHolders"`
+ */
+export const useReadErc1155TotalHolders = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'totalHolders',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"totalSupply"`
+ */
+export const useReadErc1155TotalSupply = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'totalSupply',
+})
+
+/**
+ * Wraps __{@link useReadContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"uri"`
+ */
+export const useReadErc1155Uri = /*#__PURE__*/ createUseReadContract({
+ abi: erc1155Abi,
+ functionName: 'uri',
+})
+
+/**
+ * Wraps __{@link useWriteContract}__ with `abi` set to __{@link erc1155Abi}__
+ */
+export const useWriteErc1155 = /*#__PURE__*/ createUseWriteContract({
+ abi: erc1155Abi,
+})
+
+/**
+ * Wraps __{@link useWriteContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"approve"`
+ */
+export const useWriteErc1155Approve = /*#__PURE__*/ createUseWriteContract({
+ abi: erc1155Abi,
+ functionName: 'approve',
+})
+
+/**
+ * Wraps __{@link useWriteContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"mint"`
*/
-export function useErc1155NonFungible2nd>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'NonFungible2nd', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"accountsByToken"`.
+export const useWriteErc1155Mint = /*#__PURE__*/ createUseWriteContract({
+ abi: erc1155Abi,
+ functionName: 'mint',
+})
+
+/**
+ * Wraps __{@link useWriteContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"mintBatch"`
*/
-export function useErc1155AccountsByToken<
- TFunctionName extends 'accountsByToken',
- TSelectData = ReadContractResult
->(config: Omit, 'abi' | 'functionName'> = {} as any) {
- return useContractRead({ abi: erc1155ABI, functionName: 'accountsByToken', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"allowance"`.
+export const useWriteErc1155MintBatch = /*#__PURE__*/ createUseWriteContract({
+ abi: erc1155Abi,
+ functionName: 'mintBatch',
+})
+
+/**
+ * Wraps __{@link useWriteContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"renounceOwnership"`
*/
-export function useErc1155Allowance>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'allowance', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"balanceOf"`.
+export const useWriteErc1155RenounceOwnership =
+ /*#__PURE__*/ createUseWriteContract({
+ abi: erc1155Abi,
+ functionName: 'renounceOwnership',
+ })
+
+/**
+ * Wraps __{@link useWriteContract}__ with `abi` set to __{@link erc1155Abi}__ and `functionName` set to `"safeBatchTransferFrom"`
*/
-export function useErc1155BalanceOf>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'balanceOf', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"balanceOfBatch"`.
- */
-export function useErc1155BalanceOfBatch>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'balanceOfBatch', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"contractURI"`.
- */
-export function useErc1155ContractUri>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'contractURI', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"isApprovedForAll"`.
- */
-export function useErc1155IsApprovedForAll<
- TFunctionName extends 'isApprovedForAll',
- TSelectData = ReadContractResult
->(config: Omit, 'abi' | 'functionName'> = {} as any) {
- return useContractRead({ abi: erc1155ABI, functionName: 'isApprovedForAll', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"name"`.
- */
-export function useErc1155Name>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'name', ...config } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"owner"`.
- */
-export function useErc1155Owner>(
- config: Omit, 'abi' | 'functionName'> = {} as any
-) {
- return useContractRead({ abi: erc1155ABI, functionName: 'owner', ...config } as UseContractReadConfig<
- typeof erc1155ABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link erc1155ABI}__ and `functionName` set to `"supportsInterface"`.
- */
-export function useErc1155SupportsInterface<
- TFunctionName extends 'supportsInterface',
- TSelectData = ReadContractResult