import { ethers } from 'ethers' ; declare let window ; const query = async ( ) => { try { const provider = new ethers . providers . Web3Provider ( window . ethereum ) ; const networkName = await provider . getNetwork ( ) . then ( ( res ) => { return res . name ; } ) ; const chainId = undefined ; const blockHeight = undefined ; const gasPriceAsGwei = undefined ; const blockInfo = undefined ; if ( ! chainId || ! blockHeight || ! gasPriceAsGwei || ! blockInfo ) { throw new Error ( 'Please complete the code' ) ; } return { data : { networkName , chainId , blockHeight , gasPriceAsGwei , blockInfo , } , } ; } catch ( error ) { return { error : error . message , } ; } } ; export default query ;