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
Last active November 16, 2022 05:46
Persisting a keypair for reading across clients
/*
* this file includes both a node.js script for creating a keypair
* as well as the client code for using it
*/
/* createKeypair.js */
const fs = require('fs')
const anchor = require("@project-serum/anchor");
const web3 = require('@solana/web3.js')
const account = anchor.web3.Keypair.generate();
@dabit3
dabit3 / App.js
Created September 11, 2021 14:24
Solana + Anchor Counter front end (for example from docs)
import './App.css';
import { useEffect, useState } from 'react';
import {
Program,
Provider,
BN,
web3,
} from '@project-serum/anchor'
import {
Connection,
@dabit3
dabit3 / App.js
Last active December 16, 2024 19:03
Working example of Solana and Anchor on JavaScript Client - React
import './App.css';
import { useEffect } from 'react';
import {
Program,
Provider,
BN,
web3,
} from '@project-serum/anchor'
import {
Connection,
@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">