Skip to content

Commit

Permalink
Finalizing
Browse files Browse the repository at this point in the history
  • Loading branch information
adriandelgg committed Jan 27, 2022
1 parent 680ef9a commit 01ae726
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bin/installDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
[ -d hardhat ] && cd hardhat && yarn install && cd ..

# Renames .example.env files to .env
find . -type f -name .example.env -execdir mv {} .env ";"
find . -type f -name .example.env -execdir mv {} .env ";"
13 changes: 8 additions & 5 deletions frontend/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import type { NextPage } from "next";
import Head from "next/head";
import type { NextPage } from 'next';
import Head from 'next/head';

const Home: NextPage = () => {
return (
<Head>
<link rel="icon" href="/favicon.ico" />
</Head>
<>
<Head>
<link rel="icon" href="/favicon.ico" />
</Head>
<h1 className="text-center text-2xl">Good luck building those Dapps!</h1>
</>
);
};

Expand Down
19 changes: 19 additions & 0 deletions frontend/src/hooks/useFormChange.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useState, ChangeEvent } from "react";

export function useFormChange<T extends Record<string, unknown>>(
formValues: T
) {
const [values, setValues] = useState(formValues);

function handleChange({
currentTarget
}: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) {
const { name, value } = currentTarget;

setValues(prev => ({ ...prev, [name]: value }));
}

const resetForm = () => setValues(formValues);

return [values, handleChange, resetForm, setValues] as const;
}
35 changes: 17 additions & 18 deletions hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* @type import('hardhat/config').HardhatUserConfig
*/
import { task } from "hardhat/config";
import "dotenv/config";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-waffle";
import "@nomiclabs/hardhat-solhint";
import "@typechain/hardhat";
import "@typechain/ethers-v5";
import "hardhat-gas-reporter";
import "hardhat-contract-sizer";
import "solidity-coverage";
import "@openzeppelin/hardhat-upgrades";
import { task } from 'hardhat/config';
import 'dotenv/config';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-solhint';
import '@typechain/hardhat';
import '@typechain/ethers-v5';
import 'hardhat-gas-reporter';
import 'hardhat-contract-sizer';
import 'solidity-coverage';
import '@openzeppelin/hardhat-upgrades';

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
task('accounts', 'Prints the list of accounts', async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();

for (const account of accounts) {
Expand All @@ -26,19 +26,18 @@ task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const INFURA_KEY = process.env.INFURA_API_KEY;
const PRIVATE_KEY =
process.env.PRIVATE_KEY || // This is the private key for test account #0
"ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
'ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';

// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
module.exports = {
defaultNetwork: "localhost",
gasReporter: {
currency: "USD",
currency: 'USD',
coinmarketcap: process.env.COINMARKETCAP_API_KEY ? true : false,
maxMethodDiff: 10,
enabled: process.env.REPORT_GAS ? true : false,
excludeContracts: [],
src: "./contracts"
src: './contracts'
},
contractSizer: {
alphaSort: true,
Expand Down Expand Up @@ -99,7 +98,7 @@ module.exports = {
solidity: {
compilers: [
{
version: "0.8.7",
version: '0.8.7',
settings: {
optimizer: {
enabled: true,
Expand All @@ -108,7 +107,7 @@ module.exports = {
}
},
{
version: "0.6.12",
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
Expand Down
8 changes: 4 additions & 4 deletions hardhat/scripts/typechain-copy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
npx hardhat typechain
[ -d ../frontend ] && cp -r typechain-types ../frontend/lib \
&& echo "Copied typechain types to frontend"
[ -d ../backend ] && cp -r typechain-types ../backend \
&& echo "Copied typechain types to backend"
[ -d ../frontend ] && cp -r typechain-types ../frontend/lib &&
echo "Copied typechain types to frontend"
[ -d ../backend ] && cp -r typechain-types ../backend &&
echo "Copied typechain types to backend"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-ether-dapp",
"description": "A template for building Full-Stack Blockchain Dapps using Next.js (React), TypeScript, Tailwind CSS, Hardhat, Solidity, and many more!",
"version": "1.1.6",
"version": "1.1.61",
"author": "Adrian Delgado",
"license": "MIT",
"bin": "./bin/index.js",
Expand Down

0 comments on commit 01ae726

Please sign in to comment.