import type { TransactionState } from '../types'; import { type Transaction, type TransactionReceipt } from 'nftx.js'; type Fn = (args: any) => Promise; export type UseTransactionOptions> = { description?: string; onSuccess?: (data: { transaction: Transaction; receipt: TransactionReceipt; }, args: A) => void | Promise; onError?: (error: any) => void; }; export type UseTransactionMeta = { status: TransactionState; error: any; reset: () => void; data: { transaction?: Transaction; receipt?: TransactionReceipt; }; isIdle: boolean; isPending: boolean; isException: boolean; isFail: boolean; isMining: boolean; isSuccess: boolean; isLoading: boolean; isError: boolean; }; /** * Wraps a function with some common Contract transaction logic * The function is wrapped in notification logic * The returned status is only set to loading once the transaction is being mined * aka after confirming via metamask. * The transaction's .wait() method is automatically called * The return value is the transaction receipt * */ declare const useTransaction: (fn: F, opts?: UseTransactionOptions[0]> | undefined) => readonly [(args: Parameters[0]) => Promise, UseTransactionMeta]; export default useTransaction;