epicNFT/client/src/lib/eth.js
2022-04-11 06:01:09 -04:00

16 lines
397 B
JavaScript

const getEth = () => {
const {ethereum} = window;
if (!ethereum) {
alert("Wallet not detected. Make sure you have Metamask extension installed and activated.");
}
return ethereum;
};
export const withEth = (f) => async (props) => {
try {
const ethereum = getEth();
await f(ethereum, props);
} catch (error) {
console.error(error);
}
};