1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 16:18:07 +01:00
metamask-extension/ui/components/app/advanced-gas-fee-popover/context/advanceGasFeePopover.js

37 lines
985 B
JavaScript
Raw Normal View History

import React, { createContext, useContext, useState } from 'react';
import PropTypes from 'prop-types';
export const AdvanceGasFeePopoverContext = createContext({});
export const AdvanceGasFeePopoverContextProvider = ({ children }) => {
const [gasLimit, setGasLimit] = useState();
const [maxFeePerGas, setMaxFeePerGas] = useState();
const [maxPriorityFeePerGas, setMaxPriorityFeePerGas] = useState();
const [isDirty, setDirty] = useState();
return (
<AdvanceGasFeePopoverContext.Provider
value={{
gasLimit,
isDirty,
maxFeePerGas,
maxPriorityFeePerGas,
setDirty,
setGasLimit,
setMaxPriorityFeePerGas,
setMaxFeePerGas,
}}
>
{children}
</AdvanceGasFeePopoverContext.Provider>
);
};
export function useAdvanceGasFeePopoverContext() {
return useContext(AdvanceGasFeePopoverContext);
}
AdvanceGasFeePopoverContextProvider.propTypes = {
children: PropTypes.node.isRequired,
};