{"_id":"@asheliahut/hardhat-react","_rev":"3-da1823c47ea314aa7bbc55ffca7c7ac3","name":"@asheliahut/hardhat-react","dist-tags":{"latest":"0.4.2"},"versions":{"0.4.0":{"name":"@asheliahut/hardhat-react","version":"0.4.0","description":"A Hardhat plugin that generates a React hook component from your smart contracts. Hot reloaded into your React app. Deployed or not deployed. And everything typed and initialized.","repository":{"type":"git","url":"git+https://github.com/symfoni/hardhat-plugins.git"},"author":{"name":"Robertosnap"},"license":"MIT","main":"dist/src/index.js","types":"dist/src/index.d.ts","publishConfig":{"access":"public"},"keywords":["ethereum","smart-contracts","hardhat","hardhat-plugin"],"scripts":{"lint:fix":"prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}' && tslint --fix --config tslint.json --project tsconfig.json","lint":"tslint --config tslint.json --project tsconfig.json","test":"mocha --exit --recursive 'test/**/*.test.ts'","build":"tsc","watch":"tsc -w"},"devDependencies":{"@typechain/hardhat":"^2.0.1","@types/chai":"^4.2.18","@types/debug":"^4.1.5","@types/fs-extra":"^9.0.11","@types/mocha":"^8.2.2","@types/node":"^14.14.21","chai":"^4.2.0","debug":"^4.3.1","hardhat":"^2.0.8","hardhat-deploy":"^0.7.10","hardhat-deploy-ethers":"^0.3.0-beta.7","mocha":"^8.4.0","prettier":"^2.3.0","ts-morph":"^11.0.0","ts-node":"^10.0.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","tslint-plugin-prettier":"^2.3.0","typechain":"^5.0.0","typescript":"^4.3.2"},"peerDependencies":{"@typechain/hardhat":"^2.0.1","hardhat":"^2.3.0","hardhat-deploy":"^0.7.10","hardhat-deploy-ethers":"^0.3.0-beta.7","ts-morph":"^11.0.0","typechain":"^5.0.0"},"gitHead":"13eb4c42d127344cc52c1059283384ea365f25b4","bugs":{"url":"https://github.com/symfoni/hardhat-plugins/issues"},"homepage":"https://github.com/symfoni/hardhat-plugins#readme","_id":"@asheliahut/hardhat-react@0.4.0","_nodeVersion":"14.16.1","_npmVersion":"lerna/4.0.0/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-V7Qbha8z9eN8hhWGQm9aWhDWVnwcjXQpNRlT40xUJqDgtZ06QHuP/5nyykFytzr5PgOxifFDCmnW1BL+bPfN/w==","shasum":"bbb1c34a904dc4e636578c08e520cb4fd2a9f034","tarball":"https://registry.npmjs.org/@asheliahut/hardhat-react/-/hardhat-react-0.4.0.tgz","fileCount":28,"unpackedSize":153354,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguGGUCRA9TVsSAnZWagAA5mYP/jLRX8Ejwf40A2ufUKzF\nhfAvdSC2LCN46mCohxEb/l1c2aZwZvBxPsKrNV7YxgCzTqvnpCa0CdSAnjzW\nP/nDAdl4MDSZaUTLBgJm2ersyx4HdVhfUVNUR0Ej6B9nUCYxmp8Mz7wRVrDj\nnQhjvdpkjnY7CDl9ztmvzzyY86jomSAdolZkICiQsknmNjG65aZfMrfgxnRK\nj9YObzJWGE2WJVVnf98iy10x7RxaVylylPOMfsWmqIIVHCh73FeWxJ2Jd31H\n70NUZlF6M2YO6ghPGkCf3RCBuCzAULhzpgncD8w99RVy6/x7xLzpo0pxpV1r\nMinYptR/VFxOCT5T6pAZ0ydOBrPoSRP2gY41Lt0wNkhS9KlqbKnhNF+X0v60\nx+tVH/wZg8vAc949V3EgXj+7EJgVakvRgvPcXmqiDwMI2HMAOqG1LeQmac2O\n7C9nhmzjulKoOk384WgOWWUQkLu7+R7j0n4cA8pUeW7Na3QGl2SpeHntmyke\nGv189jq1LYwidZrG040SHLaVUPE1exA0oY6eB5z384q2iuqldf4jQyiHhjOR\n1zvPEnfLfG8NCQHx9SruHiZxc1bKMRp3YJzgz9cOskkT+qxEDarDSIOgRMD8\nag21HANdc0u6xpry5I9E4W0aJpHuRz7D3S8BC2HZqyiDuFo9iCyuuvhMjO72\nwl1p\r\n=LYgQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEcP8jxnxXG7By1nF1TolTRqttwggotyLIzfwQrbfEqeAiEAwJqEG49nyzpaDptmYlIkyR8GTXmQDU12+1g/kDsRR6g="}]},"_npmUser":{"name":"asheliahut","email":"asheliahut@gmail.com"},"directories":{},"maintainers":[{"name":"asheliahut","email":"asheliahut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hardhat-react_0.4.0_1622696339837_0.41332681488169576"},"_hasShrinkwrap":false},"0.4.1":{"name":"@asheliahut/hardhat-react","version":"0.4.1","description":"A Hardhat plugin that generates a React hook component from your smart contracts. Hot reloaded into your React app. Deployed or not deployed. And everything typed and initialized.","repository":{"type":"git","url":"git+https://github.com/symfoni/hardhat-plugins.git"},"author":{"name":"Robertosnap"},"license":"MIT","main":"dist/src/index.js","types":"dist/src/index.d.ts","publishConfig":{"access":"public"},"keywords":["ethereum","smart-contracts","hardhat","hardhat-plugin"],"scripts":{"lint:fix":"prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}' && tslint --fix --config tslint.json --project tsconfig.json","lint":"tslint --config tslint.json --project tsconfig.json","test":"mocha --exit --recursive 'test/**/*.test.ts'","build":"tsc","watch":"tsc -w"},"devDependencies":{"@typechain/hardhat":"^2.0.1","@types/chai":"^4.2.18","@types/debug":"^4.1.5","@types/fs-extra":"^9.0.11","@types/mocha":"^8.2.2","@types/node":"^14.14.21","chai":"^4.2.0","debug":"^4.3.1","hardhat":"^2.0.8","hardhat-deploy":"^0.7.10","hardhat-deploy-ethers":"^0.3.0-beta.7","mocha":"^8.4.0","prettier":"^2.3.0","ts-morph":"^11.0.0","ts-node":"^10.0.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","tslint-plugin-prettier":"^2.3.0","typechain":"^5.0.0","typescript":"^4.3.2"},"peerDependencies":{"@typechain/hardhat":"^2.0.1","hardhat":"^2.3.0","hardhat-deploy":"^0.7.10","hardhat-deploy-ethers":"^0.3.0-beta.7","ts-morph":"^11.0.0","typechain":"^5.0.0"},"gitHead":"93480916453bb9efdeedb6c666b4d81ed4c3221d","bugs":{"url":"https://github.com/symfoni/hardhat-plugins/issues"},"homepage":"https://github.com/symfoni/hardhat-plugins#readme","_id":"@asheliahut/hardhat-react@0.4.1","_nodeVersion":"14.16.1","_npmVersion":"lerna/4.0.0/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-JSYr0/ZpL4UEwGGLTVZwyPF3IT90as+L3/aoYBF9N+9TeXIlobq8wpkeX2ZdMtS2XiYHC91FojoESJRSRR04lA==","shasum":"116286f1cfbbf7b8e521abb55d3cea9b7b1fa437","tarball":"https://registry.npmjs.org/@asheliahut/hardhat-react/-/hardhat-react-0.4.1.tgz","fileCount":28,"unpackedSize":153325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguGQqCRA9TVsSAnZWagAAo38P/iq+AHAnAcft5kr5V+h7\n17TXOGC7cD0Gp5jwxFOvhS1M8vRbUlgOQfnhNlpPZHT6whb/z08g+bsSOm43\nMb8/OvCL/tqGpiEfFebYJDTjTvr3hvz0wAuDEW67/fJmpnXuu8VIL0zomTIK\nD0VJq4WxdoLZjMioipKx0JbNkGXJvN5VrSFg5EwK+3DxmNUr/lor/kjpei7N\nPUCBqcXN/21Q7Hr1aSFrR6QHW1xssZcacLg8kXryTrqxnUtz9JxMS9lirMUT\nPefO6soFtLmJO6nLNDRCLUhSmYwaz5phpHNGFqd17KBU7MhWOUigRa9wvsgj\nO12al6zRTBBFRWIzJtSmT+EkdE8uvciSDk+JTA0ZPCPLS3Tz9JS/WHsPcuM8\nZWAFh+7KYUEWgcfqLeTrJ8WJx5eXBwLices9711Khh4glAFWKBV4EAQwkl+E\n3bdhN7FVkRNLCVaP0AO3u85bTPkUP54+xUZOnm5IKGVWCP+JrSTasEMQHJM+\nY5jfNFWuhu2HkA8O0voeEcHAfw83hSfeaDPhNykmREu9Cqwn1WrPxb8lDzaB\n0xjq2CTgIS7SpETMq/utEFCHlb3ASQVv+5dtMOKxiwzfVZwv47cTfXguZOZo\nAowp7nXqBTOrfqqCDK/xFd3Lmn6NaCjbR+lsQsnCVZ4lwKe4GY6vIPz5/HvS\nKqma\r\n=U+NF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAhFg7exkedJfWZZDorme6c7+AG5yNUX+ED+Ar9LukDgIgG3kTWJfRpHk3z39O5kTowFtddO6yB8XlZovxdCSkTBI="}]},"_npmUser":{"name":"asheliahut","email":"asheliahut@gmail.com"},"directories":{},"maintainers":[{"name":"asheliahut","email":"asheliahut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hardhat-react_0.4.1_1622697002246_0.7387150132994835"},"_hasShrinkwrap":false},"0.4.2":{"name":"@asheliahut/hardhat-react","version":"0.4.2","description":"A Hardhat plugin that generates a React hook component from your smart contracts. Hot reloaded into your React app. Deployed or not deployed. And everything typed and initialized.","repository":{"type":"git","url":"git+https://github.com/symfoni/hardhat-plugins.git"},"author":{"name":"Robertosnap"},"license":"MIT","main":"dist/src/index.js","types":"dist/src/index.d.ts","publishConfig":{"access":"public"},"keywords":["ethereum","smart-contracts","hardhat","hardhat-plugin"],"scripts":{"lint:fix":"prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}' && tslint --fix --config tslint.json --project tsconfig.json","lint":"tslint --config tslint.json --project tsconfig.json","test":"mocha --exit --recursive 'test/**/*.test.ts'","build":"tsc","watch":"tsc -w"},"devDependencies":{"@typechain/hardhat":"^2.0.1","@types/chai":"^4.2.18","@types/debug":"^4.1.5","@types/fs-extra":"^9.0.11","@types/mocha":"^8.2.2","@types/node":"^14.14.21","chai":"^4.2.0","debug":"^4.3.1","hardhat":"^2.0.8","hardhat-deploy":"^0.7.10","hardhat-deploy-ethers":"^0.3.0-beta.7","mocha":"^8.4.0","prettier":"^2.3.0","ts-morph":"^11.0.0","ts-node":"^10.0.0","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","tslint-plugin-prettier":"^2.3.0","typechain":"^5.0.0","typescript":"^4.3.2"},"peerDependencies":{"@typechain/hardhat":"^2.0.1","hardhat":"^2.3.0","hardhat-deploy":"^0.7.10","hardhat-deploy-ethers":"^0.3.0-beta.7","ts-morph":"^11.0.0","typechain":"^5.0.0"},"gitHead":"e340ab9a6aeebcb98293c7fa90625a01d3888b8f","bugs":{"url":"https://github.com/symfoni/hardhat-plugins/issues"},"homepage":"https://github.com/symfoni/hardhat-plugins#readme","_id":"@asheliahut/hardhat-react@0.4.2","_nodeVersion":"14.16.1","_npmVersion":"lerna/4.0.0/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-KDwz4ScGd7eNmx6qFrzBUGyWs+8kJXneMc7k7e9uSSleG7s1OCC4MajM/mZr0YQKijiBjP8+JBG5rQQ/uQbGoQ==","shasum":"f55b483396eca99fb1a6c958f393f49070a5ceed","tarball":"https://registry.npmjs.org/@asheliahut/hardhat-react/-/hardhat-react-0.4.2.tgz","fileCount":28,"unpackedSize":153377,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguGYHCRA9TVsSAnZWagAAOgYP/1vX5z4qv6C4A2u4k1QM\nG3BgHnSKBv4KsCpYRddt8JNn4ynfo3TNGoBzBsmlpGm1nj/22pMmkuAoHyXk\nXrPryO4BCG2J7dot7xG59nupqc10YM9kDdncGteZzI1bc5OcQbhfLZ+xQTLq\ngkcNkqZwAs4LPjWTtaJGWxpH+ACHiiUO8vFwiB9pgSPqvfbSMwVkl69CnDi+\nxziD8YSy4nUVDYXDcSrPoMsxDqAaRklXBA6V610nF2N9VnVVK5/4Po1uqsi5\nbucU2N5qhFg2CYvPTKvZuRvsrV5ju6NXM9G1qBuM6Es88IyIXgHHyYgPFaLR\nQ94B0E6e772nITNJYhSg5tVfed1o7Qq5fhCntwSD3X9TfSueVNy0HjFf0jBg\nuXL4LGHBheamcFhBTZ9/BclLbxuuXLjT5IsMKTtgjGGqLUJ9oCuvWsy/4ygz\nUL5UT5MKm+zh2J9cTPEAd4gZG9taa3+R6of/8Huo1cxbm8xLxKzRQNVZnhAG\nO+O5KVzZ46iaY9PPekby1AatZleY0z5wnHNKj9iWr+SxJ47XU2vbNR/gFEo1\nJcWUDNw2isHd6EL3lQgY8lG6IC6W+XCby4OYck5YhPcuOJczUDsB/0DADUNQ\nn2pXC3HYZZMo/KoezdvJUgW/LoCfe6H1C1FA+r5p92v3sCKgHLAoru5oery3\nnKxK\r\n=thxl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAHR71G7862eJanFfe7MC5RVUrxKf/jfa/8mxsFCtqq7AiAdKIGLXuVksBqlOBn7RvpCfHMbDRvVizJzTWy6m5wBpQ=="}]},"_npmUser":{"name":"asheliahut","email":"asheliahut@gmail.com"},"directories":{},"maintainers":[{"name":"asheliahut","email":"asheliahut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hardhat-react_0.4.2_1622697479803_0.17124026575604367"},"_hasShrinkwrap":false}},"time":{"created":"2021-06-03T04:58:59.789Z","0.4.0":"2021-06-03T04:59:00.014Z","modified":"2022-04-04T15:45:23.400Z","0.4.1":"2021-06-03T05:10:02.401Z","0.4.2":"2021-06-03T05:17:59.942Z"},"maintainers":[{"name":"asheliahut","email":"asheliahut@gmail.com"}],"description":"A Hardhat plugin that generates a React hook component from your smart contracts. Hot reloaded into your React app. Deployed or not deployed. And everything typed and initialized.","homepage":"https://github.com/symfoni/hardhat-plugins#readme","keywords":["ethereum","smart-contracts","hardhat","hardhat-plugin"],"repository":{"type":"git","url":"git+https://github.com/symfoni/hardhat-plugins.git"},"author":{"name":"Robertosnap"},"bugs":{"url":"https://github.com/symfoni/hardhat-plugins/issues"},"license":"MIT","readme":"[![hardhat](https://hardhat.org/assets/img/Hardhat-logo.652a7049.svg?1)](https://hardhat.org)\n\n#### 👷‍ Join our team to contribute full-time to tools like Hardhat React!\n\nWe're hiring. If you're a full-stack dApp developer, we want you! 👈 This is an excellent opportunity to contribute full-time to the Ethereum ecosystem.\n\n**[Check out our job listing](https://www.notion.so/symfoni/Symfoni-jobs-0c2bdc029d2a4cf7b91864a5e68ed00f)**\n\n#### Part of contribution to the ETHOnline hackathon\n\n**Alpha release, interfaces will change.**\n\n**This version requires typechain 4.0**\n\n<img src=\"https://github.com/symfoni/hardhat-plugins/blob/hardhat/packages/hardhat-react/SymfoniHardhatReact.gif\" width=\"400\">\n\n# Hardhat React\n\nA Hardhat plugin that generates a React hook component from your smart contracts. Hot reloaded into your React app. Deployed or not deployed. And everything typed and initialized.\n\n- Uses deployments from **hardhat-deploy** to inject the latest instance of your smart contracts into the React app.\n- Uses **Typechain** so all your smart contracts are typed.\n- Uses **Ethers** so everything else is typed.\n- Runs alongside **hardhat-node** or hardhat-deploy --watch so any change you do in a smart contract is immediately injected into React app. Just start the hardhat runtime, and everything should be reflected.\n- Provision a connection to your blockchain node. Either with **Web3modal**, which supports many wallets, or directly to your hardhat node through HttpRPC.\n\n# Quick start\n\nIf you want to quickly get started with a new hardhat project and a react application. Try this [boilerplate](https://github.com/symfoni/hardhat-react-boilerplate).\n\n# Get started\n\n## Install plugin\n\n**Yarn:** `yarn add --dev @symfoni/hardhat-react`\n\n**NPM:** `npm install --save-dev @symfoni/hardhat-react`\n\n## Install peer dependencies\n\n**Yarn:** `yarn add --dev hardhat hardhat-deploy hardhat-deploy-ethers @typechain/hardhat ts-morph ts-node typescript ts-generator typechain@4.0.0 @typechain/ethers-v5`\n\n**NPM:** `npm install --save-dev hardhat hardhat-deploy hardhat-deploy-ethers @typechain/hardhat ts-morph ts-node typescript ts-generator typechain@4.0.0 @typechain/ethers-v5`\n\n## import plugins\n\nTo import plugins into your hardhat project.\n\nIf javascript project, hardhat.config.js\n\n```js\nrequire(\"@nomiclabs/hardhat-ethers\");\nrequire(\"hardhat-deploy-ethers\");\nrequire(\"hardhat-deploy\");\nrequire(\"@symfoni/hardhat-react\");\nrequire(\"@typechain/hardhat\");\nrequire(\"@typechain/ethers-v5\");\n```\n\nif typescript project, hardhat.config.ts\n\n```ts\nimport \"@nomiclabs/hardhat-waffle\";\nimport \"@nomiclabs/hardhat-ethers\";\nimport \"hardhat-deploy-ethers\";\nimport \"hardhat-deploy\";\nimport \"@symfoni/hardhat-react\";\nimport \"@typechain/hardhat\";\nimport \"@typechain/ethers-v5\";\n```\n\n# Runtime\n\nThe plugin will hooks into hardhat-deploy, which hooks into `npx hardhat node --watch`. Therefore, the plugin will run when you are starting up a node or making changes to a solidity file or deploy file.\n\nYou can run it manually with `npx hardhat react`. You probably need to run `npx hardhat typechain` and `npx hardhat deploy`first to have artifacts, deployments, and typechain files ready.\n\nThe React context uses the output from typechain and deployments. It generates a react context component as a typescript react file (SymfoniContext.tsx), which imports typechain. It then uses these files alongside Ethers and Web3Modal to set up a context for your connection and each smart contract (deployed or not deployed).\n\n<!-- # Deployment and .gitignore\n\nWe are still evaluating how to best handle deployments. For now we suggest to .gitignore the networks you develop on do versioning on deployments to shared networks.\n\n```bash\nfrontend/src/hardhat/deployments/hardhat\nfrontend/src/hardhat/deployments/localhost\n``` -->\n\n# Frontend\n\nThis plugin assumes that you are building your frontend inside a hardhat project (we later want to go away from this assumption). So we recommend you create a `frontend` folder inside your hardhat project where all your frontend code and packages reside. Take a look at https://github.com/symfoni/hardhat-react-boilerplate for a demonstration.\n\nMost frontend projects require all file dependencies to be inside that folder. Therefore we suggest (and default ) your typechain and deployments path to \"./frontend/src/hardhat/{deployments | typechain}\". The Hardhat context (a react component .tsx) file will also default to this folder. Though you are free to set whatever paths you like, and it should resolve relative to your config.paths.react folder.\n\n## Frontend dependencies\n\nYou will need to install these dependencies in your frontend.\n\n**Yarn:** `yarn add ethers web3modal`\n\n**NPM:** `npm install --save ethers web3modal`\n\n## Frontend \"framework\"\n\nYou are free to choose whatever React typescript \"framework\". We have only tested with Create React App for now.\n\nCreate React app can be initialized in your Hardhat root folder with:\n\n**NPX:** `npx create-react-app frontend --template typescript`\n\n## React component\n\nTo use the React component in a React application. Import the SymfoniContext.tsx file in your app.\n\n```ts\nimport { Symfoni } from \"./hardhat/SymfoniContext\";\n```\n\nThen wrap everything or the components in this context as a provider.\n\n```ts\n<Symfoni>\n  <SomeComponent></SomeComponent>\n  <SomeOtherComponent></SomeComponent>\n</Symfoni>\n```\n\nTo use a contract, import that context into the component that needs it.\n\n```ts\nimport { GreeterContext } from \"./../hardhat/SymfoniContext\";\n```\n\nThen use it as a state in that component.\n\n```ts\nconst greeter = useContext(GreeterContext);\n```\n\n## Contract context\n\nThe contract context gives you two properties.\n\n```ts\nexport interface ContractContext {\n  instance?: Contract;\n  factory?: ContractFactory;\n}\n```\n\nIf the Hardhat context successfully connected to a provider in your frontend (web3modal or Hardhat node) and\n\n- hardhat-deploy **deployed** an instance of your contract. The **ContractContext.instance** property will be initiated with this deployment address. Here you have access to all functions, events, and so on.\n- If an instance was NOT deployed by hardhat-deploy, it will be set to a zero address. This way makes it easier to connect with another contract address in you frontend with for example `erc20.instance?.attach(\"SOME_ADDRESS\")`\n- If the provider has sign() functionality. The **ContractContext.factory** will be available, and you can deploy a contract or connect to other instances.\n\n## Component examples\n\n### Symfoni context example\n\n```ts\nimport React from \"react\";\nimport logo from \"./logo.svg\";\nimport \"./App.css\";\nimport { Hardhat } from \"./hardhat/SymfoniContext\";\nimport { Greeter } from \"./components/Greeter\";\n\nfunction App() {\n  return (\n    <div className=\"App\">\n      <header className=\"App-header\">\n        <Symfoni>\n          <Greeter></Greeter>\n        </Symfoni>\n      </header>\n    </div>\n  );\n}\n\nexport default App;\n```\n\n### Contract context example\n\nThe contract is named Greeeter.sol\n\n```ts\nimport React, { useContext, useEffect, useState } from \"react\";\nimport { GreeterContext } from \"./../hardhat/SymfoniContext\";\n\ninterface Props {}\n\nexport const Greeter: React.FC<Props> = () => {\n  const greeter = useContext(GreeterContext);\n  const [message, setMessage] = useState(\"\");\n  const [inputGreeting, setInputGreeting] = useState(\"\");\n  useEffect(() => {\n    const doAsync = async () => {\n      if (!greeter.instance) return;\n      console.log(\"Greeter is deployed at \", greeter.instance.address);\n      setMessage(await greeter.instance.greet());\n    };\n    doAsync();\n  }, [greeter]);\n\n  const handleSetGreeting = async (\n    e: React.MouseEvent<HTMLButtonElement, MouseEvent>\n  ) => {\n    e.preventDefault();\n    if (!greeter.instance) throw Error(\"Greeter instance not ready\");\n    if (greeter.instance) {\n      const tx = await greeter.instance.setGreeting(inputGreeting);\n      console.log(\"setGreeting tx\", tx);\n      await tx.wait();\n      console.log(\n        \"New greeting mined, result: \",\n        await greeter.instance.greet()\n      );\n    }\n  };\n  return (\n    <div>\n      <p>{message}</p>\n      <input onChange={(e) => setInputGreeting(e.target.value)}></input>\n      <button onClick={(e) => handleSetGreeting(e)}>Set greeting</button>\n    </div>\n  );\n};\n```\n\n### Symfoni Provider\n\nYou can control when Hardhat context should try to connect with your providers. By default it will autoInit and show loading. If you dont want to show laoding it will start render all child components. You dont need to provide a loading component, in that case it has a native loading component that renders messages from provider connection.\n\n```ts\nimport { Symfoni } from \"./../hardhat/SymfoniContext\";\n...\n <Symfoni autoInit={true} loadingComponent={<h1>LOADING...</h1>}>\n  // ...<OtherComponents>\n</Symfoni>\n```\n\n### SymfoniContext\n\nThis context can be used down in your componens to trigger Symfoni context.\n\nBy contrast to other contexts, SymfoniContext returns an object with properties and functions. So pick whatever you want.\n\nThe init function will initate a connection to your provider based on the priority you have set in your Hardhat.config.ts. You can override this by specifying the provider you want to connect with. `init(\"roptsten\")` for example.\n\n```ts\nimport { SymfoniContext } from './../hardhat/SymfoniContext';\n...\n const {  init, messages, currentHardhatProvider, loading, providers  } = useContext(SymfoniContext)\n```\n\n### ProviderContext\n\nIt gives you a context to your current provider and the ability to change it.\n\n```ts\nimport { ProviderContext } from \"./../hardhat/SymfoniContext\";\n...\nconst [provider, setProvider] = useContext(ProviderContext)\n```\n\n### SignerContext\n\nIt gives you a context to your current signer and the ability to change it.\n\n```ts\nimport { SignerContext } from \"./../hardhat/SymfoniContext\";\n...\nconst [signer, setSigner] = useContext(SignerContext)\n```\n\n### CurrentAddressContext\n\nIt gives you a context to your current address and the ability to change it.\n\n```ts\nimport { CurrentAddressContext } from \"./../hardhat/SymfoniContext\";\n...\nconst [currentAddress, setCurrentAddress] = useContext(CurrentAddressContext)\n```\n\n# Configuration\n\nOur goal with this plugin was to make it easier for new developers to try out smart-contract development. Therefore we default the most needed configuration.\n\n## Accounts, private keys, and mnemonic.\n\n(This is simplified and in terms of Metamask to make it easier to get up developing)\nmnemonic: 12-word phrases that will correspond to many accounts(address and private key). You can only have one for each Metamask instance. [Use browser profiles to hold more than one.](https://metamask.zendesk.com/hc/en-us/articles/360015289952-How-to-Migrate-to-a-New-Seed-Phrase)\nprivateKey: corresponds to one address\n\nWhen developing locally on hardhat you are most probably using [\"hardhat-network\"](https://hardhat.org/hardhat-network/) locally as your blockchain. By default, this blockchain will only have funds on addresses connected to mnemonic `test test test test test test test test test test test junk`. You can configure \"hardhat-network\" to use another mnemonic or private key [here](https://hardhat.org/config/#hardhat-network).\n\n### Private key\n\n```JSON\n{\n  \"networks\": {\n    \"hardhat\": {\n      \"accounts\": [\n        {\n          \"balance\": \"10000000000000000000000\",\n          \"privateKey\": \"0xPRIVATE_KEY_GO_HERE\"\n        }\n      ]\n    }\n  }\n}\n```\n\n### mnemonic\n\n```JSON\n{\n  \"networks\": {\n    \"hardhat\": {\n      \"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.\n      \"accounts\": {\n        \"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\n      }\n    }\n  }\n}\n```\n\nThen when you point your wallet (Metamask) to your \"hardhat-network\" provider. This is usually `http://127.0.0.1:8545` you should see funds on your account so that you can make transactions while developing.\n\n### Inject mnemonic\n\n- Have not added inject for private keys yet. Create an issue if you would like to see this.\n- Cant inject mnemonic if the provider is set to \"mainnet\" or has \"live\" property.\n\n## Provider priority\n\nThe React context tries to connect the frontend up with an Ethereum provider. Here you can set that priority. In this scenario, the react context will try to connect with Web3modal(Metamask) first, then if that fails. Try to connect with your Hardhat node.\n\nIf you set a fallbackprovider, it will try to connect to that provider first. But only on first auto init (auto init must be true) and if the user has not connected with web3modal before (that is stored in the cache). If the user does not have any wallets and you try with web3modal first, it will require a click from the user to try another provider. Setting a fallback provider circuments this.\n\n```json\n{\n  \"react\": {\n    \"providerPriority\": [\"web3modal\", \"hardhat\"],\n    \"fallbackProvider\" : \"hardhat\",\n    ...\n  }\n}\n```\n\n`Later, we will add the possibility to set all config networks providers, URLs, etc. as provider priority.`\nWe stole this concept from [Embark](https://framework.embarklabs.io/docs/overview.html). Props to them.\n\n## Explicit / Implicit contract generation\n\nIf you have many contracts you can choose to be implicit or explicit for what contracts you want to create a context for.\n\n```json\n{\n  \"react\": {\n    \"skip\": [\"SimpleStorage2\"],\n    \"handle\": [\"SimpleStorage\"]\n    ...\n  }\n}\n```\n\n## Web3Modal providers\n\n### WalletConnect\n\nTo add WalletConnect as an otional web3modal provider add the following configuration to hardhard.config.\n\nYou MUST also install @walletconnect/web3-provider in your frontend project.\n\n```json\n{\n  \"react\": {\n     \"providerOptions\": {\n      \"walletconnect\": {\n        \"options\": {\n          \"infuraId\": \"c229331f1d044c8f95e03f54b0ea2f26\",\n        },\n      },\n    },\n    ...\n  }\n}\n```\n\n`npm i --save @walletconnect/web3-provider` or with Yarn `yarn add @walletconnect/web3-provider`\n\n## Paths React\n\nSymfoniContext.tsx (the React component) will be written to this path.\n\n```json\n{\n  \"paths\": {\n    \"react\": \"./frontend/src/hardhat\"\n  }\n}\n```\n\n## Defaults\n\nIf you don't set these configurations yourself, the hardhat-react plugin will default to this.\n\n```json\n{\n  \"react\": {\n    \"providerPriority\": [\"web3modal\", \"hardhat\"]\n  },\n  \"paths\": {\n    \"react\": \"./frontend/src/hardhat\"\n  },\n  \"namedAccounts\": {\n    \"deployer\": {\n      \"default\": 0\n    }\n  },\n  \"typechain\": {\n    \"outDir\": \"./frontend/src/hardhat/typechain\",\n    \"target\": \"ethers-v5\"\n  }\n}\n```\n\n## Contract instances\n\nReact generation will now try to resolve dangling deployments which are probably instances of an artifact. It will resolve based on name, so if you keep the basename of the artifact in the instance it should resolve correctly.\n\nHere is an example deploy typescript function that will create two instances of the SimpleStorage contract. Both instances will be available in frontend by its instance name and with its respective deployment.\n\n```ts\nimport { HardhatRuntimeEnvironment } from \"hardhat/types\";\nimport { DeployFunction } from \"hardhat-deploy/types\";\n\nconst func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {\n  const { deployments, getNamedAccounts } = hre;\n  const { deploy } = deployments;\n\n  const { deployer } = await getNamedAccounts();\n\n  await deploy(\"SimpleStorageA\", {\n    from: deployer,\n    contract: \"SimpleStorage\",\n    args: [],\n    log: true,\n  });\n  await deploy(\"SimpleStorageB\", {\n    from: deployer,\n    contract: \"SimpleStorage\",\n    args: [],\n    log: true,\n  });\n};\nexport default func;\n```\n\n# Projects\n\n- [hardhat-plugins](https://github.com/symfoni/hardhat-plugins) - Lerna repo containing a demo project and hardhat-react plugin.\n- [hardhat-react-boilerplate](https://github.com/symfoni/hardhat-react-boilerplate) - A boilerplate which contains barebones for a smart-contract and react app project. Where all smart contracts are compiled, deployed, and typed out to the react app.\n\n# Caveats\n\n## Invalid nonce.\n\n```bash\neth_sendRawTransaction\n  Invalid nonce. Expected X but got X.\n```\n\nReset your account in Metamask.\n\n## Why cant the react component be built as a package which I can import.\n\nWe don't know enough of the react build process to efficiently create a typescript react component which can be consumed by any other React build process. This is something we want to achieve!\n\n## Useing Gatsby\n\nMake sure transcript target is es6 or higher.\n\n# Development\n\nIf you want to develop this plugin in any way, we suggest you fork this Lerna repo; [hardhat-plugins](https://github.com/symfoni/hardhat-plugins).\n","readmeFilename":"README.md"}