Skip to content

Instantly share code, notes, and snippets.

View dabit3's full-sized avatar
🎡
probably nothing

Nader Dabit dabit3

🎡
probably nothing
View GitHub Profile
@dabit3
dabit3 / App.js
Created August 11, 2021 15:44
Sign in with Ethereum & Decentralized Identity with Ceramic, IDX, React, and 3ID Connect
import './App.css';
import { useState } from 'react'
import CeramicClient from '@ceramicnetwork/http-client'
import ThreeIdResolver from '@ceramicnetwork/3id-did-resolver'
import { EthereumAuthProvider, ThreeIdConnect } from '@3id/connect'
import { DID } from 'dids'
import { IDX } from '@ceramicstudio/idx'
@dabit3
dabit3 / App.js
Created August 4, 2021 13:42
Querying The Graph with URQL & React
import './App.css';
import { createClient } from 'urql'
import { useEffect, useState } from 'react'
const APIURL = ""
const query = `
query {
tokens(
first: 5
@dabit3
dabit3 / creator-dashboard.js
Last active January 20, 2022 23:14
Metaverse Marketplace pages/creator-dashboard.js
/* pages/creator-dashboard.js */
import { ethers } from 'ethers'
import { useEffect, useState } from 'react'
import axios from 'axios'
import Web3Modal from "web3modal"
import {
nftmarketaddress, nftaddress
} from '../config'
@dabit3
dabit3 / my-assets.js
Last active July 14, 2021 03:51
Metaverse Marketplace pages/my-assets.js
*/ pages/my-assets.js */
import { ethers } from 'ethers'
import { useEffect, useState } from 'react'
import axios from 'axios'
import Web3Modal from "web3modal"
import {
nftmarketaddress, nftaddress
} from '../config'
@dabit3
dabit3 / create-item.js
Last active March 28, 2022 19:34
Metaverse Marketplace pages/create-item.js
/* pages/create-item.js */
import { useState } from 'react'
import { ethers } from 'ethers'
import { create as ipfsHttpClient } from 'ipfs-http-client'
import { useRouter } from 'next/router'
import Web3Modal from 'web3modal'
const client = ipfsHttpClient('https://ipfs.infura.io:5001/api/v0')
import {
@dabit3
dabit3 / index.js
Last active February 17, 2022 00:46
Metaverse Marketplace pages/index.js
/* pages/index.js */
import { ethers } from 'ethers'
import { useEffect, useState } from 'react'
import axios from 'axios'
import Web3Modal from "web3modal"
import {
nftaddress, nftmarketaddress
} from '../config'
@dabit3
dabit3 / _app.js
Last active September 20, 2021 02:24
Metaverse Marketplace pages/_app.js
/* pages/_app.js */
import '../styles/globals.css'
import Link from 'next/link'
function Marketplace({ Component, pageProps }) {
return (
<div>
<nav className="border-b p-6">
<p className="text-4xl font-bold">Metaverse Marketplace</p>
<div className="flex mt-4">
@dabit3
dabit3 / sample-test.js
Last active April 30, 2022 22:58
Testing the Metaverse Marketplace contract
/* test/sample-test.js */
describe("NFTMarket", function() {
it("Should create and execute market sales", async function() {
/* deploy the marketplace */
const Market = await ethers.getContractFactory("NFTMarket")
const market = await Market.deploy()
await market.deployed()
const marketAddress = market.address
/* deploy the NFT contract */
@dabit3
dabit3 / hardhat.config.js
Last active August 10, 2022 22:18
Initial hardhat configuration - Polygon tutorial
/* hardhat.config.js */
require("@nomiclabs/hardhat-waffle")
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 1337
},
// mumbai: {
@dabit3
dabit3 / Market.sol
Last active May 18, 2022 21:06
Metaverse Marketplace Smart Contract
// contracts/Market.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";