@safe-global/safe-react-hooks
Version:
A collection of React Hooks that facilitates the interaction of React apps with Safe Smart Accounts
20 lines • 851 B
JavaScript
import { isHash } from 'viem';
import { useTransaction as useTransactionWagmi } from 'wagmi';
import { useSafeTransaction } from './useSafeTransaction.js';
/**
* Hook to get the status of a specific transaction.
* @param params Parameters to customize the hook behavior.
* @param params.config SafeConfig to use instead of the one provided by `SafeProvider`.
* @param params.safeTxHash Hash of Safe transaction to be fetched.
* @param params.ethereumTxHash Hash of Ethereum transaction to be fetched.
* @returns Query result object containing the transaction object.
*/
export function useTransaction(params) {
if ('safeTxHash' in params && isHash(params.safeTxHash)) {
return useSafeTransaction(params);
}
return useTransactionWagmi({
hash: params.ethereumTxHash
});
}
//# sourceMappingURL=useTransaction.js.map