{"version":3,"sources":["components/Navbar.jsx","utils/index.js","components/VoteOption.jsx","components/VoteTally.jsx","components/Footer.jsx","components/Intro.jsx","components/VoteHistory.jsx","components/Main.jsx","App.js","reportWebVitals.js","index.js"],"names":["useStyles","makeStyles","theme","root","backgroundColor","boxShadow","toolbar","marginTop","spacing","marginBottom","justifyContent","Navbar","props","classes","AppBar","position","className","Container","maxWidth","Toolbar","src","alt","height","preflightCommitment","programID","PublicKey","idl","metadata","address","capitalize","string","charAt","toUpperCase","slice","percentize","decimal","min","max","isNaN","toFixed","toLocaleString","style","minimumFractionDigits","maximumFractionDigits","formatWithCommas","number","button","paddingLeft","paddingRight","paddingTop","paddingBottom","fontSize","VoteOption","side","handleVote","wallet","useWallet","Box","textAlign","Button","variant","onClick","disabled","connected","size","color","avatar","width","borderRadius","marginRight","marginLeft","progress","palette","primary","main","VoteTally","votes","display","alignItems","Avatar","join","Typography","LinearProgress","value","wheels","doors","borderTop","flexShrink","socialIcons","margin","Footer","votesCounterAddress","Link","underline","href","toString","visibility","green","connectedBubble","title","fontWeight","Intro","initializeVoting","component","gutterBottom","VoteHistory","voteTxHistory","length","List","map","txID","i","ListItem","Main","network","enqueueSnackbar","useSnackbar","useState","setVotes","setVoteTxHistory","setVotesCounterAddress","getProvider","a","connection","Connection","anchor","getProgram","provider","console","log","program","findProgramAddress","bytes","utf8","encode","programId","votesCounterPDA","tx","methods","initialize","accounts","user","publicKey","systemProgram","SystemProgram","rpc","account","votesCounter","fetch","votesCounterAccount","parseInt","voteOption","vote","pubkeys","keys","oldVoteTxHistory","useEffect","controller","AbortController","findVotesCounterAddress","abort","getVotes","flexDirection","flex","Grid","container","item","xs","clusterApiUrl","wallets","getPhantomWallet","createTheme","blue","secondary","orange","overrides","MuiButtonBase","MuiButton","textTransform","undefined","padding","startIcon","endIcon","label","MuiLink","AppWrappedWithProviders","onWalletError","useCallback","error","message","name","onError","autoConnect","App","ThemeProvider","endpoint","reportWebVitals","onPerfEntry","Function","then","getCLS","getF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,EAAON,GACPO,EAAQP,OCDdQ,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAACd,GAAD,MAEFe,SAASC,eAAe,SAM1Bb,O","file":"static/js/main.767c1417.chunk.js","sourcesContent":["import { AppBar, Container, makeStyles, Toolbar } from \"@material-ui/core\";\nimport { WalletMultiButton } from \"@solana/wallet-adapter-material-ui\";\nimport React from \"react\";\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n backgroundColor: \"transparent\",\n boxShadow: \"none\",\n },\n toolbar: {\n marginTop: theme.spacing(3),\n marginBottom: theme.spacing(3),\n justifyContent: \"space-between\",\n },\n}));\n\nexport default function Navbar(props) {\n const classes = useStyles();\n return (\n \n \n \n \"DoorsVsWheels\n \n \n \n \n );\n}\n","import {PublicKey} from \"@solana/web3.js\";\nimport idl from \"../idl.json\";\n\nexport const preflightCommitment = \"processed\";\nexport const programID = new PublicKey(idl.metadata.address);\n\nexport const capitalize = (string) => {\n if (typeof string !== \"string\") return \"\";\n return string.charAt(0).toUpperCase() + string.slice(1);\n};\n\nexport const percentize = (decimal, min, max) => {\n if (typeof decimal !== \"number\" || isNaN(decimal)) return \"\";\n return max === 0\n ? `${(decimal * 100).toFixed(0)}%`\n : `${(decimal * 100).toLocaleString(\"en-US\", {\n style: \"decimal\",\n minimumFractionDigits: min || 2,\n maximumFractionDigits: max || 2,\n })}%`;\n};\n\nexport const formatWithCommas = (number) =>\n typeof number === \"number\" ? number.toLocaleString(\"en-US\") : number;\n","import { Button, Box } from \"@material-ui/core\";\nimport { makeStyles } from \"@material-ui/styles\";\nimport { useWallet } from \"@solana/wallet-adapter-react\";\nimport React from \"react\";\nimport { capitalize } from \"../utils\";\n\nconst useStyles = makeStyles((theme) => ({\n button: {\n paddingLeft: theme.spacing(4),\n paddingRight: theme.spacing(4),\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n fontSize: \"1.2rem\",\n },\n}));\n\nexport default function VoteOption({ side, handleVote }) {\n const classes = useStyles();\n const wallet = useWallet();\n return (\n \n handleVote(side)}\n disabled={!wallet.connected}\n size=\"large\"\n color={side === \"smooth\" ? \"primary\" : \"secondary\"}\n className={classes.button}\n >\n {`Vote ${capitalize(side)}`}\n \n \n );\n}\n","import {\n Avatar,\n Box,\n LinearProgress,\n makeStyles,\n Typography,\n} from \"@material-ui/core\";\nimport React from \"react\";\nimport { formatWithCommas, percentize } from \"../utils\";\n\nconst useStyles = makeStyles((theme) => ({\n avatar: {\n height: 120,\n width: 120,\n borderRadius: \"initial\",\n \"&.left\": {\n marginRight: theme.spacing(0.5),\n },\n \"&.right\": {\n marginLeft: theme.spacing(0.5),\n },\n },\n progress: {\n backgroundColor: theme.palette.primary.main,\n height: 25,\n },\n}));\n\n// Show vote counts for each side\nexport default function VoteTally({ votes }) {\n const classes = useStyles();\n\n function getProgress() {\n if (\n typeof votes.wheels !== \"number\" ||\n typeof votes.doors !== \"number\" ||\n votes.wheels + votes.doors === 0\n ) {\n return 50;\n }\n return (votes.wheels / (votes.doors + votes.wheels)) * 100;\n }\n\n return (\n \n \n \n \n Wheels\n \n \n Doors\n \n \n \n \n \n \n \n {formatWithCommas(votes.wheels)}\n \n \n {percentize(votes.wheels / (votes.wheels + votes.doors))}\n \n \n \n {formatWithCommas(votes.doors)}\n \n {percentize(votes.doors / (votes.wheels + votes.doors))}\n \n \n \n \n );\n}\n","import {\n AppBar,\n Box,\n Container,\n Link,\n makeStyles,\n Toolbar,\n Typography,\n} from \"@material-ui/core\";\nimport React from \"react\";\nimport TwitterIcon from \"@material-ui/icons/Twitter\";\nimport GitHubIcon from \"@material-ui/icons/GitHub\";\nimport LinkedInIcon from \"@material-ui/icons/LinkedIn\";\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n backgroundColor: \"transparent\",\n boxShadow: \"none\",\n borderTop: \"1px solid #e6e6e5\",\n flexShrink: 0,\n marginTop: theme.spacing(2),\n },\n toolbar: {\n justifyContent: \"space-between\",\n },\n socialIcons: {\n margin: theme.spacing(1),\n },\n}));\n\nexport default function Footer({ programID, votesCounterAddress }) {\n const classes = useStyles();\n return (\n \n \n \n \n Version by {\" \"}\n \n Nicolas Francisquelo Tacca\n \n {\" | \"}\n Based on tutorials and code by {\" \"}\n \n Brian Friel\n \n {\" | \"}\n Powered by{\" \"}\n \n Solana\n \n {\" | \"}\n \n Program ID\n \n {\" | \"}\n \n Vote Account\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n","import { Box, Button, Link, Typography } from \"@material-ui/core\";\nimport { green } from \"@material-ui/core/colors\";\nimport { makeStyles } from \"@material-ui/styles\";\nimport { WalletMultiButton } from \"@solana/wallet-adapter-material-ui\";\nimport { useWallet } from \"@solana/wallet-adapter-react\";\nimport React from \"react\";\n\nconst useStyles = makeStyles((theme) => ({\n button: {\n marginTop: theme.spacing(1),\n \"&.hidden\": {\n visibility: \"hidden\",\n },\n },\n connected: {\n color: green[500],\n },\n connectedBubble: {\n backgroundColor: green[500],\n height: 12,\n width: 12,\n borderRadius: \"50%\",\n marginRight: theme.spacing(0.5),\n },\n title: {\n fontWeight: 700,\n },\n}));\n\nexport default function Intro({\n votes,\n initializeVoting,\n programID,\n votesCounterAddress,\n}) {\n const wallet = useWallet();\n const classes = useStyles();\n return (\n \n \n Doors or Wheels\n \n \n Are there more wheels or doors in the world?\n \n \n Send your vote to the{\" \"}\n \n Solana\n {\" \"}\n blockchain and help decide this once and for all!\n \n \n {wallet.connected ? (\n \n \n \n Connected\n \n \n ) : (\n \n To get started, connect your wallet below:\n \n )}\n \n

(Deployed to DEVNET)

\n
\n {(typeof votes.wheels !== \"number\" ||\n typeof votes.wheels !== \"number\") &&\n wallet.connected && (\n \n \n This{\" \"}\n \n program\n \n {\"'s \"}\n \n vote account\n {\" \"}\n has not been initialized yet:\n \n \n Initialize Program\n \n \n )}\n
\n );\n}\n","import { Box, Link, List, ListItem, Typography } from \"@material-ui/core\";\nimport React from \"react\";\n\n// If this user has voted during this session, show them their transaction history\nexport default function VoteHistory({ voteTxHistory }) {\n if (voteTxHistory.length < 1) {\n return ;\n }\n return (\n \n You voted!\n \n Thanks for making your voice heard on this important issue.\n \n \n Check out your recorded {voteTxHistory.length === 1 ? \"vote\" : \"votes\"}{\" \"}\n on the Solana blockchain:\n \n \n {voteTxHistory.map((txID, i) => (\n \n {`Vote ${i + 1}`}\n \n ))}\n \n \n );\n}\n","import React, {useEffect, useState} from \"react\";\nimport {useWallet} from \"@solana/wallet-adapter-react\";\nimport {Connection, PublicKey, SystemProgram} from \"@solana/web3.js\";\nimport * as anchor from \"@project-serum/anchor\";\nimport idl from \"../idl.json\";\nimport {Box, Container, Grid} from \"@material-ui/core\";\nimport Navbar from \"./Navbar\";\nimport VoteOption from \"./VoteOption\";\nimport VoteTally from \"./VoteTally\";\nimport Footer from \"./Footer\";\nimport Intro from \"./Intro\";\nimport {useSnackbar} from \"notistack\";\nimport VoteHistory from \"./VoteHistory\";\nimport {capitalize, preflightCommitment, programID} from \"../utils\";\n\nexport default function Main({network}) {\n const {enqueueSnackbar} = useSnackbar();\n const wallet = useWallet();\n\n const [votes, setVotes] = useState({\n wheels: null,\n doors: null,\n });\n const [voteTxHistory, setVoteTxHistory] = useState([]);\n const [votesCounterAddress, setVotesCounterAddress] = useState(null);\n\n useEffect(() => {\n const controller = new AbortController();\n findVotesCounterAddress();\n return () => controller.abort();\n }, []);\n\n useEffect(() => {\n console.log(\"getVotes useffect\");\n const controller = new AbortController();\n\n // Call Solana program for vote count\n async function getVotes() {\n console.log(\"getVotes\");\n try {\n const program = await getProgram();\n let votesCounterAccount = await program.account.votesCounter.fetch(votesCounterAddress);\n setVotes({\n wheels: parseInt(votesCounterAccount.wheels.toString()),\n doors: parseInt(votesCounterAccount.doors.toString()),\n });\n } catch (error) {\n console.log(\"could not getVotes: \", error);\n }\n }\n\n if (votesCounterAddress) {\n getVotes();\n }\n return () => controller.abort();\n }, [votesCounterAddress]);\n\n async function getProvider() {\n const connection = new Connection(network, preflightCommitment);\n return new anchor.AnchorProvider(connection,wallet,preflightCommitment);\n }\n\n async function getProgram() {\n const provider = await getProvider();\n return new anchor.Program(idl, programID, provider);\n }\n\n async function findVotesCounterAddress() {\n console.log(\"Finding votes counter PDA\");\n const program = await getProgram();\n const [votesCounterPDA, _bumpVotesCounter] = await PublicKey.findProgramAddress(\n [\n anchor.utils.bytes.utf8.encode(\"votes_counter\"),\n ],\n program.programId\n );\n setVotesCounterAddress(votesCounterPDA);\n }\n\n // Initialize the program if this is the first time its launched\n async function initializeVoting() {\n const provider = await getProvider();\n console.log(\"initializeVoting\",programID.toString());\n const program = new anchor.Program(idl, programID, provider);\n try {\n const tx = program.methods.initialize().accounts({\n user: provider.wallet.publicKey,\n systemProgram: SystemProgram.programId,\n });\n // const keys = await tx.pubkeys()\n await tx.rpc();\n const votesCounterAccount = await program.account.votesCounter.fetch(votesCounterAddress);\n setVotes({\n wheels: parseInt(votesCounterAccount.wheels.toString()),\n doors: parseInt(votesCounterAccount.doors.toString()),\n });\n enqueueSnackbar(\"Vote account initialized\", {variant: \"success\"});\n } catch (error) {\n console.log(\"Transaction error: \", error);\n console.log(error.toString());\n enqueueSnackbar(`Error: ${error.toString()}`, {variant: \"error\"});\n }\n }\n\n // Vote for either wheels or doors. Poll for updated vote count on completion\n async function handleVote(side) {\n const provider = await getProvider();\n const program = new anchor.Program(idl, programID, provider);\n try {\n const voteOption = side === \"wheels\" ? {wheels: {}} : {doors: {}};\n let tx = program.methods.vote(voteOption).accounts({\n user: provider.wallet.publicKey,\n systemProgram: SystemProgram.programId,\n votesCounter: votesCounterAddress,\n })\n const keys = await tx.pubkeys()\n tx = await tx.rpc();\n const votesCounterAccount = await program.account.votesCounter.fetch(keys.votesCounter);\n\n setVotes({\n wheels: parseInt(votesCounterAccount.wheels.toString()),\n doors: parseInt(votesCounterAccount.doors.toString()),\n });\n enqueueSnackbar(`Voted for ${capitalize(side)}!`, {variant: \"success\"});\n setVoteTxHistory((oldVoteTxHistory) => [...oldVoteTxHistory, tx]);\n } catch (error) {\n console.log(\"Transaction error: \", error);\n console.log(error.toString());\n enqueueSnackbar(`Error: ${error.toString()}`, {variant: \"error\"});\n }\n }\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n