Skip to content

Instantly share code, notes, and snippets.

View ximxim's full-sized avatar
🏠
Working from home

Azim Ahmed ximxim

🏠
Working from home
View GitHub Profile
@ximxim
ximxim / index.tsx
Created October 24, 2021 20:14
Minting Contract frontend consumption with MetaMask
/**
* Import ethers package and destructure ethers object
*/
import { ethers } from "ethers";
import type { NextPage } from "next";
import Head from "next/head";
import { useState, useCallback, useEffect } from "react";
import styles from "../styles/Home.module.css";
import MintingContract from "../MintingContract.json";
@ximxim
ximxim / deploy.js
Created October 24, 2021 15:43
Deploy script Basic Minting Contract
/**
* We require the Hardhat Runtime Environment explicitly here. This is optional
* but useful for running the script in a standalone fashion through `node <script>`.
*
* When running the script with `npx hardhat run <script>` you'll find the Hardhat
* Runtime Environment's members available in the global scope.
*
* Check: https://hardhat.org/guides/scripts.html#standalone-scripts-using-hardhat-as-a-library
*/
const hre = require("hardhat");
@ximxim
ximxim / hardhat.config.js
Created October 24, 2021 15:32
Hardhat deploy setup to rinkeby
/**
* importing secrets file that contains secret keys
*/
const secret = require('./secrets.json');
require("@nomiclabs/hardhat-waffle");
/**
* This is a sample Hardhat task. To learn how to create your own go to
* https://hardhat.org/guides/create-task.html
*/
@ximxim
ximxim / run.js
Created October 24, 2021 04:09
MintingContract run hardhat script
/**
* We require the Hardhat Runtime Environment explicitly here. This is optional
* but useful for running the script in a standalone fashion through `node <script>`.
*
* When running the script with `npx hardhat run <script>` you'll find the Hardhat
* Runtime Environment's members available in the global scope.
*
* Check: https://hardhat.org/guides/scripts.html#standalone-scripts-using-hardhat-as-a-library
*/
const hre = require("hardhat");
@ximxim
ximxim / MintingContract.sol
Last active October 24, 2021 14:12
Minting Contract Complete
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "hardhat/console.sol";
contract MintingContract is ERC721URIStorage {
/*
State variable tokenCount is used as unique identifier to generate unique number
@ximxim
ximxim / [id].ts
Created October 24, 2021 01:15
Nextjs handler api/tokens/[id] to send static NFT metadata
import type { NextApiRequest, NextApiResponse } from "next";
/**
*
* @param req
* @param res
*
* This endpoint will return success response with an object that complies
* with OpenSea NFT standard. The object contains an image link to a giphy
* and the name of the asset.
@ximxim
ximxim / index.tsx
Last active October 24, 2021 00:58
Starting point of NFT minting project front end
import type { NextPage } from "next";
import Head from "next/head";
import { useState, useCallback, useEffect } from "react";
import styles from "../styles/Home.module.css";
const Home: NextPage = () => {
/**
* comments state will be used as console log
*/
@ximxim
ximxim / run.js
Created October 24, 2021 00:25
Solidity contract run script explained
* We require the Hardhat Runtime Environment explicitly here. This is optional
* but useful for running the script in a standalone fashion through `node <script>`.
*
* When running the script with `npx hardhat run <script>` you'll find the Hardhat
* Runtime Environment's members available in the global scope.
*
* Check: https://hardhat.org/guides/scripts.html#standalone-scripts-using-hardhat-as-a-library
*/
const hre = require("hardhat");
@ximxim
ximxim / MintingContract.sol
Created October 24, 2021 00:23
Basic NFT minting contract init
/*
Since your contract code will be publicly available, this line
will let the readers know if you are cool with letting them use
your code. I have seen UNLICENSED and MIT so far.
*/
// SPDX-License-Identifier: UNLICENSED
/*
This line is important to let solidity know which version of the
language would this contract run on.
@ximxim
ximxim / app.tsx
Last active October 9, 2021 00:11
Adding custom setting to each route to trigger a dev action
import React, {FunctionComponent} from 'react';
import {DevSettings, Alert} from 'react-native';
import {enableScreens} from 'react-native-screens';
import {NavigationContainer} from '@react-navigation/native';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {useFocusEffect} from '@react-navigation/native';
import {CenteredView} from './components';