A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/ui/hooks/useApproveTransaction.js

27 lines
760 B

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
* @param {Object} transactionGroup
* @return {[boolean, Function]}
*/
export function useApproveTransaction() {
const [showCustomizeGasPopover, setShowCustomizeGasPopover] = useState(false);
const closeCustomizeGasPopover = () => setShowCustomizeGasPopover(false);
const approveTransaction = useCallback(() => {
return setShowCustomizeGasPopover(true);
}, []);
return {
approveTransaction,
showCustomizeGasPopover,
closeCustomizeGasPopover,
};
}