import Fox from './assets/metamask-fox.svg' // import LaunchBackground from './assets/undraw_To_the_stars_qhyy.svg' import LaunchBackground from './assets/undraw_relaunch_day_902d-fixed.svg' import './App.css' import { useState, useEffect } from 'react' import { getAddress, useAddress, useTotalSupply, useContract } from './modules/web3' import { log } from './modules/helpers' function App() { // /////////////////////////////// // States // /////////////////////////////// const [ loading, setLoading ] = useState( 'Detecting metamask...' ) const [ error, setError ] = useState( undefined ) const totalSupply = useTotalSupply( ) const address = useAddress() // Handle contract interactions const contract = useContract() // /////////////////////////////// // Functions // /////////////////////////////// // Handle user login interaction async function metamasklogin( e ) { e.preventDefault() try { setLoading( 'Connecting to Metamask' ) const address = await getAddress() log( 'Received: ', address ) } catch( e ) { setError( `Metamask error: ${ e.message || JSON.stringify( e ) }. Please reload the page.` ) } finally { setLoading( false ) } } async function mintRocketeer( e ) { e.preventDefault() try { if( !address ) setError( 'No destination address selected' ) setLoading( 'Confirm transaction in metamask' ) const response = await contract.spawnRocketeer( address ) log( 'Successful mint with: ', response ) } catch( e ) { log( 'Minting error: ', e ) } finally { setLoading( false ) } } // /////////////////////////////// // Lifecycle // /////////////////////////////// // Check for metamask on load useEffect( f => window.ethereum ? setLoading( false ) : setError( 'No web3 provider detected, please install metamask' ), [] ) // /////////////////////////////// // Rendering // /////////////////////////////// // Initialisation interface if( error || loading || !address ) return
{ error &&

{ error }

} { loading &&

{ loading }

} { !address && ( !error && !loading ) &&

Rocketeer Minter

This interface is used to mint new Rocketeer NFTs. Minting is free, except for the gas fees. After minting you can view your new Rocketeer and its attributes on Opensea.

metamask fox Connect wallet
}
// Render main interface return (

Rocketeer Minter

We are ready to mint! There are currently { totalSupply } minted Rocketeers.

{ contract && metamask fox Mint new Rocketeer }
Launching rocket
); } export default App;