asyn wait fn returned by previous versions of useWaitTransactions #535
Unanswered
luckyOdisetti
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use wagmi for multiple projects and have context that exposes contract interactions (internally using wagmi) to handle transactions and toaster notifications for in progress, error, success states.
Previously we could do
const {_, wait} = useWaitForTransaction()
since we don't have the hash yet at the time creating a context, refetch also seems to be different. The docs also aren't very clear about what fetching loading and success states are.Below is with prev versions
`export const useHandleTransaction = (): {
doHandleTransaction: (T: TxParams) => Promise
} => {
const toast= useToast()
const [_, wait] = useWaitForTransaction({
skip: true,
})
const doHandleTransaction = async ({
hash,
toastBody,
}: TxParams) => {
const waitForApproval = await wait({ confirmations: 1, hash })
result && toast({...toastOptions})
}`
Beta Was this translation helpful? Give feedback.
All reactions