1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00
metamask-extension/ui/hooks/useApproveTransaction.js

27 lines
728 B
JavaScript
Raw Normal View History

import { useCallback, useState } from 'react';
/**
* Determine whether a transaction can be approved and provide a method to
* kick off the approval process.
*
* Provides a reusable hook that, given a transactionGroup, will manage
* the process of editing gas for approvals
*
* @returns {[boolean, Function]}
*/
export function useApproveTransaction() {
const [showCustomizeGasPopover, setShowCustomizeGasPopover] = useState(false);
const closeCustomizeGasPopover = () => setShowCustomizeGasPopover(false);
const approveTransaction = useCallback(() => {
return setShowCustomizeGasPopover(true);
}, []);
return {
approveTransaction,
showCustomizeGasPopover,
closeCustomizeGasPopover,
};
}