Our great sponsors
-
turbo
Incremental bundler and build system optimized for JavaScript and TypeScript, written in Rust – including Turbopack and Turborepo.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
ganache
Discontinued :warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
-
truffle
Discontinued :warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
-
metamask-extension
:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
Workshop GitHub Repo
A mono repo using Turbo Incremental bundler/build system optimized for mono repos, JS & TS
Truffle & Ganache
Truffle & Ganache
React & NextJS
import Link from "next/link"; import { useListen } from "../hooks/useListen"; import { useMetaMask } from "../hooks/useMetaMask"; import { Button, FlexContainer, FlexItem, } from "./styledComponents/general"; import { NavigationView, Balance, RightNav, Logo } from "./styledComponents/navigation"; import { SiEthereum } from 'react-icons/si'; export default function Navigation() { const { dispatch, state: { status, isMetaMaskInstalled, wallet, balance }, } = useMetaMask(); const listen = useListen(); const showInstallMetaMask = status !== "pageNotLoaded" && !isMetaMaskInstalled; const showConnectButton = status !== "pageNotLoaded" && isMetaMaskInstalled && !wallet; const isConnected = status !== "pageNotLoaded" && typeof wallet === "string"; const handleConnect = async () => { dispatch({ type: "loading" }); const accounts = await window.ethereum.request({ method: "eth_requestAccounts", }); if (accounts.length > 0) { const balance = await window.ethereum!.request({ method: "eth_getBalance", params: [accounts[0], "latest"], }); dispatch({ type: "connect", wallet: accounts[0], balance }); // we can register an event listener for changes to the users wallet listen(); } }; const handleDisconnect = () => { dispatch({ type: "disconnect" }); }; const formatAddress = (addr: string) => { return `${addr.substr(0, 6)}...${addr.substr(-4)}` } return ( ETH Atlantis {showConnectButton && ( {status === "loading" ? "loading..." : "Connect Wallet"} )} {showInstallMetaMask && ( Install MetaMask )} {wallet && balance && ( <> {isConnected && Disconnect} {formatAddress(wallet)} {(parseInt(balance) / 1000000000000000000).toFixed(2)}{" "}ETH )} ); }