Skip to content

Instantly share code, notes, and snippets.

View GeoffMahugu's full-sized avatar
:octocat:
Fullstack Software Developer | DevOps Engineer

Geoffrey Mahugu GeoffMahugu

:octocat:
Fullstack Software Developer | DevOps Engineer
View GitHub Profile
/**
* Main Project - https://ravenfable.com/
* This is a react component that rewards users with points after achieving certain tasks.
* The project is an NFT project that will reward its users 50 points for every social media connection and also alow users to access whitelist posts.
* The integrations include:
* - Firebase (Twitter social link Connect)
* - Discord (social link connect)
* - Blockchain / ETH Chain (Metamask connect)
* */
@GeoffMahugu
GeoffMahugu / Readme_NFT_IPFS_Setup.md
Last active May 18, 2022 13:52
This is a doc containing info on how to generate metadata for your NFT collection.

NFT Metadata & IPFS

This doc contains details on how to setup your NFT metadata.

1. Metadata generation.

Once you download the HashLips Art Engine, you will proceed to update the ./src/config file.

@GeoffMahugu
GeoffMahugu / vanilla_ethers_minting_website.html
Last active May 13, 2022 14:24
This is a sample code for minting using ether.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
@GeoffMahugu
GeoffMahugu / disconnect.js
Created December 13, 2021 17:06
This the disconnect function of the react web3
async function disconnect() {
try {
deactivate()
} catch (ex) {
console.log(ex)
}
}
@GeoffMahugu
GeoffMahugu / mint_button.js
Created December 13, 2021 16:53
this is the mint button
<button type="button" disabled={minting} onClick={mint} className="main-mint-btn">
{(minting) ? 'Waiting confirmation.' : 'Mint'}
</button>
@GeoffMahugu
GeoffMahugu / transact_function.js
Last active December 13, 2021 17:03
This is the transact function for react web3
// Import useState from react
import { useState } from "react";
function App() {
// Add minting toggle listener
const [minting, setMinting] = useState(false);
// Minting Function
async function mint() {
@GeoffMahugu
GeoffMahugu / button.js
Last active December 13, 2021 16:33
This is the button logic for auth users
{(active) ?
<button className="main-mint-btn">Mint</button>
: <button type="button" onClick={connect} className="main-mint-btn">Connect Wallet To Mint</button>
}
@GeoffMahugu
GeoffMahugu / connect.js
Created December 13, 2021 16:13
Connect to web3 react app
async function connect() {
try {
await activate(injected);
} catch (ex) {
console.log(ex)
}
}
@GeoffMahugu
GeoffMahugu / index.js
Created December 13, 2021 15:53
This is the index.js file for react web3 app.
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { Web3ReactProvider } from '@web3-react/core'
import Web3 from 'web3'
function getLibrary(provider) {
return new Web3(provider)
@GeoffMahugu
GeoffMahugu / Connector.js
Created December 13, 2021 15:41
This is the react web3 connector code.
import { InjectedConnector } from '@web3-react/injected-connector'
export const injected = new InjectedConnector({
supportedChainIds: [1, 3, 4, 5, 42],
});