A Pen by Krishna Gupta on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as chains from "wagmi/chains"; | |
// Base chain | |
export const base = { | |
id: 8453, | |
network: "base", | |
name: "Base", | |
nativeCurrency: { name: "Base", symbol: "ETH", decimals: 18 }, | |
rpcUrls: { | |
default: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { NextPage } from "next"; | |
import { MetaHeader } from "~~/components/MetaHeader"; | |
import { gql } from "@apollo/client"; | |
import { useQuery } from "@apollo/client"; | |
import { Address } from "~~/components/scaffold-eth"; | |
export const GET_MESSAGES = gql` | |
{ | |
sendMessages(first: 5) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
import ipfsHttpClient from 'ipfs-http-client'; | |
const IPFSUploader: React.FC = () => { | |
const [name, setName] = useState<string>(''); | |
const [description, setDescription] = useState<string>(''); | |
const [budget, setBudget] = useState<number>(0); | |
const [image, setImage] = useState<File | null>(null); | |
const [ipfsResponse, setIPFSResponse] = useState<any | null>(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PostCreated @entity(immutable: true) { | |
id: Bytes! | |
ownerId: BigInt! | |
contentURI: String! | |
timestamp: BigInt! | |
} | |
type PostContent @entity(immutable: true) { | |
id: Bytes! | |
hash: String! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Bytes, | |
dataSource, | |
DataSourceContext, | |
DataSourceTemplate, | |
log, | |
ipfs, | |
json, | |
} from "@graphprotocol/graph-ts"; | |
import { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use client"; | |
import { useState } from "react"; | |
import { gql } from "@apollo/client"; | |
import { useQuery } from "@apollo/client"; | |
import type { NextPage } from "next"; | |
import { useAccount } from "wagmi"; | |
import { Address, AddressInput, Balance } from "~~/components/scaffold-eth"; | |
import { | |
useAccountBalance, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Link from "next/link"; | |
import type { NextPage } from "next"; | |
import { BugAntIcon, MagnifyingGlassIcon, SparklesIcon } from "@heroicons/react/24/outline"; | |
import { MetaHeader } from "~~/components/MetaHeader"; | |
import { gql } from '@apollo/client'; | |
import { useQuery } from '@apollo/client'; | |
export const GET_MESSAGES = gql` | |
{ | |
messages(first: 10, orderBy: createdAt, orderDirection: asc) { |
Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!
The advantages of versions 0.8.*
over <0.8.0
are:
- Safemath by default from
0.8.0
(can be more gas efficient than some library based safemath.) - Low level inliner from
0.8.2
, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import csv | |
# zip code api variables | |
API_URL = 'https://api.zip-codes.com/ZipCodesAPI.svc/1.0/CalculateDistance/ByZip?' | |
ZIPS = ["T5T 4J2", "J3V 5K1", "H9R 1C4", "G1V 2L1", "H7T 1C8", "H3B 5K4", "H3P 3E9", "J4Y 0L1", "H1M 1W9", "J1L 1K1", "G2K 1N4"] | |
# API Key | |
APIKEY = 'HIDDEN' |
NewerOlder