symfoni / hardhat-react-boilerplate Goto Github PK
View Code? Open in Web Editor NEWWrite smart-contracts that are typed, deployed, instantiated and connected to provider in React app.
Write smart-contracts that are typed, deployed, instantiated and connected to provider in React app.
Figured it out, will send a PR later!
Hi team, thank you for making this template! I cloned, installed, and started the hardhat node per instructions, but 'yarn start' triggers the following build error:
./src/hardhat/SymfoniContext.tsx
SyntaxError: /symfoni/frontend/src/hardhat/SymfoniContext.tsx: Identifier 'GreeterDeployment' has already been declared (8:7)
6 | import Web3Modal, { IProviderOptions } from "web3modal";
7 | import GreeterDeployment from "./deployments/localhost/Greeter.json";
> 8 | import GreeterDeployment from "./deployments/localhost/Greeter.json";
| ^
9 | import { Greeter } from "./typechain/Greeter";
10 | import { Greeter__factory } from "./typechain/factories/Greeter__factory";
Investigating SymfoniContext.tsx shows more instances where a Greeter line of code is repeated 2x:
export const GreeterContext = React.createContext<SymfoniGreeter>(emptyContract);
export const GreeterContext = React.createContext<SymfoniGreeter>(emptyContract);
const [Greeter, setGreeter] = useState<SymfoniGreeter>(emptyContract);
const [Greeter, setGreeter] = useState<SymfoniGreeter>(emptyContract);
const getGreeter = (_provider: providers.Provider, _signer?: Signer) => {
const getGreeter = (_provider: providers.Provider, _signer?: Signer) => {
Since this is an autogenerated filed, I suspect something is wrong in the build path. What do you think?
I had npx hardhat node --watch
working fine, and I've also changed providerPriority to ["hardhat", "web3modal"]
.
I'm trying to build a project that interacts with Uniswap and found that mainnet forking seems to be the way to go about it.
When running npx hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/<api key>
it seems to be a breaking change:
Error HH604: Error running JSON-RPC server: Error: ERROR processing /Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/deploy/Greeter.ts:
Error: Invalid signature v value
at Object.exports.ecrecover (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/node_modules/ethereumjs-util/src/signature.ts:46:11)
at new ForkTransaction (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/src/internal/hardhat-network/provider/fork/ForkTransaction.ts:32:26)
at ForkBlockchain._processRemoteBlock (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts:243:9)
at ForkBlockchain._getBlockByNumber (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts:219:17)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at ForkBlockchain.getLatestBlock (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts:40:19)
at HardhatNode.getLatestBlockNumber (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:460:20)
at EthModule._estimateGasAction (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:379:25)
at HardhatNetworkProvider.request (/Users/ar4s/dev/consensys/blockchain-bootcamp-final-project/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:102:18)
Here is my hardhat config:
const config: HardhatUserConfig = {
react: {
providerPriority: ["hardhat", "web3modal"],
},
networks: {
hardhat: {
chainId: 1337,
inject: false, // optional. If true, it will EXPOSE your mnemonic in your frontend code. Then it would be available as an "in-page browser wallet" / signer which can sign without confirmation.
accounts: {
mnemonic: "test test test test test test test test test test test junk", // test test test test test test test test test test test junk
} (....)
I've tried toggling the chainId to mainnet and removing it altogether, and google doesn't have any matches for this particular error.
packages/hardhat-react/src/TsMorhProject.ts:95
const relativeDeploymentsPath = path.relative(
this.hre.config.paths.react,
this.hre.config.paths.deployments + "/" + currentNetwork
);
packages/hardhat-react/src/TsMorhProject.ts:179
deploymentFile: deploymentFile
? `${relativeDeploymentsPath}/${deploymentFile}`
: undefined,
Does not work in Windows.
Need to try and create a fix and run it on windows.
Fix needs to be created in
https://github.com/symfoni/hardhat-plugins
Hi team,
Our team is trying to run this project, but we get the same error all the time after following all the steps required in the Readme:
/home/victor/dev/MyProject/frontend/src/hardhat/SymfoniContext.tsx
TypeScript error in /home/victor/dev/MyProject/frontend/src/hardhat/SymfoniContext.tsx(117,17):
Type 'JsonRpcSigner' is not assignable to type 'Signer'.
The types returned by 'provider.getGasPrice()' are incompatible between these types.
Type 'Promise<import("/home/victor/dev/MyProject/frontend/node_modules/@ethersproject/contracts/node_modules/@ethersproject/bignumber/lib/bignumber").BigNumber>' is not assignable to type 'Promise<import("/home/victor/dev/MyProject/frontend/node_modules/@ethersproject/bignumber/lib/bignumber").BigNumber>'. TS2322
115 | case "web3modal":
116 | const web3provider = _provider as ethers.providers.Web3Provider
> 117 | return await web3provider.getSigner()
| ^
118 | case "hardhat":
119 | return ethers.Wallet.fromMnemonic("test test test test test test test test test test test junk").connect(_provider)
120 | default:
Is this boilerplate project actually working? I got it from the documentation: https://hardhat.org/plugins/hardhat-react.html
Starting from scratch and trying to follow the documentation without the boilerplate project was unsuccessful for everyone that tried on our end too. :\
chainID is incorrect as 31337, should be chainID 1337
Currently, when you spin up the blockchain it is run in watch mode (hh node --watch), which generated sympfoni context files. However, if I want to deploy my application on a testnet (e.g ropsten) the application doesn't generate symfoni files hence, the application fails to run. How can I generate these files on any other blockchain?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.