{"_id":"eth-testing","_rev":"44-6dfe7a51e64e0eb92fb75d24750a715d","name":"eth-testing","dist-tags":{"latest":"1.14.0","alpha":"1.1.0-alpha.23"},"versions":{"1.0.1-alpha":{"name":"eth-testing","version":"1.0.1-alpha","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/ethtesting","repository":{"type":"git","url":"git+https://github.com/VGLoic/ethtesting.git"},"bugs":{"url":"https://github.com/VGLoic/ethtesting/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","test:example":"cd example && npm run test","format":"prettier src example/src --write","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"engines":{"node":"^12 || ^14 || ^15","npm":">=6"},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"gitHead":"b04e405e81bc8b4bbd26a121bcd76e9a3655cf5b","_id":"eth-testing@1.0.1-alpha","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-fqxStGJHVVGrvAXRDRhOIEAxm1QSA9RaEtiUJh6DUcsdQsaumVPAvMhrXOaUOEClWcerLml2MQoKuBPUws8mug==","shasum":"3659b5c543d0e5c0068c3df080844a2f7fe91a8f","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.0.1-alpha.tgz","fileCount":26,"unpackedSize":43612,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhMhbRCRA9TVsSAnZWagAAlpsP/1lMaqMsR0YSWGm2glCQ\n2uWITugdHGRqew/YgFcKzNzuLD7IZRYaCGm1fy8QIiSFUi8MaIjpAAvbWkSf\nvrvUL69mSyIceGOAX52GAlpRSqMiyNl396J1wFZfLZ8dd4LvFhf+yP5nXp+A\njSQGySMMw8bhfsL9Hz6CcICNaj7L+NPBS0/UYoRda4LgSYIK1m8Ix0yfGQXm\n45Izv+0zgLJIJLlF7wC3bFNv67tqBYr5FAUqLGe2IvcI6TD/rcnDeY0Fw7e3\n4V6siMIPu+OTMfzyLpri05jgWem66hAjKQ1br1N7wnKYZZ7AAR9N8xHN/U2t\nwpTlIU1X1IoRH8eGDQoaCwxN8AYHQMNDinTcf93eewWBA0+pjEZVHCaYKmFA\nzcpl4ykSM/0BE/wKqatp70zJrkrBwD/gW3gsVge5H0v1LB37dw1g7axmHDS5\ngvr36kikMm5SijdlLD4Wut+Xh81Y3nLMvFbSuRqDOQNlKQLILvNlIjb+AxLx\nUeUSRtva1PNliR57gM+EgaF0aApVteh55VaM/mtrS0kN6ssNfT3tvgjdz0p3\nezkGpN9y0rZeqERA+XXN8qo/5iLF/rhsFm1PrNxCgANjijWEUnZM6aqDFswE\nSXKEvIlos/JM+0Fts7OoaPeYAm1WMcQa9USRO+N1TVMy6OEI462NQ5CJiUWT\nohFK\r\n=UyKG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID47zCbCl1NPh0mFwdqz5vuCDO6trFrfCpts+/j72qm3AiBvsIGpFr/8E8wO3p7sZ9IDPb1XxP78+qM4Vi3RDbvaAw=="}]},"_npmUser":{"name":"vincentgenod","email":"loic.vincent-genod@consensys.net"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"loic.vincent-genod@consensys.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.0.1-alpha_1630672593140_0.5120400983755651"},"_hasShrinkwrap":false},"1.0.2-alpha":{"name":"eth-testing","version":"1.0.2-alpha","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","test:example":"cd example && npm run test","format":"prettier src example/src --write","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"engines":{"node":"^12 || ^14 || ^15","npm":">=6"},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"gitHead":"54b4dc0186e95721f14ce4c20aa2a7abac4eeebd","_id":"eth-testing@1.0.2-alpha","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-us/TMBQijKM8gtvKFtDsoiYPlkTkIVpB86HW1lMGtVPTKWzQmq9pvC+jlC39tS9Of/THMtADgv4Kh6ZXj2wpQg==","shasum":"b2071301004ebebd32562ab2b98a24582882636d","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.0.2-alpha.tgz","fileCount":26,"unpackedSize":43615,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhMhelCRA9TVsSAnZWagAAJXcP/A7FVBwztIysm4jkq0V+\nV8kCOd6Q5zO7MkrAZbqawyIq8DN7Ui7QDORvDvqcY0cHLIuBa1481kG8ED/d\n4101T0o92FhZuv+tCC+ZLy40K8mTjYbZg1vUp+/45D3ET4I4EMVaUAD4inwE\nwUuTjaC1zQBsFHEKaqcY2X/IUd6IIwh24qIfKqopUuEFFLiQDX+QmJKE/m4F\nArbNvifKnocuHGt4w+DbcLLToXlDAMRGCuNo78+5oIXZN8ixSsI/0ooP1+VZ\npOap9NqLyKpD6R57ppj4RPy6PNlaNFZJ5wXs/xT9JFI/vx5AHqUclI1eb3OS\n4TmKBQ1NmLZ4/Agn4Wq0UPReRHWIS3xz0DlNNG0dPtGjuD0Pn24AE8l4Bcib\nXFnraJwOPBQ1CK4iaXMG3rXKE4CnVTxgURApQBFrVicWt5CDN6xRffqP+h9g\n2gMmZNNtDsD4gMX01KBG/lyj0fXKetCVar0w02Yj5nxzdja8iaX6+SF6FdUe\nHCrxgUO2rU/EvIpvLiPxTHgiUu3Rb6+MT24syJ5p6sg8iyiDMFbge/AHsHLf\nH/4S6Xft305wcPA/HZNnv1q+ckLBcseIRiXNnCfODW4YLwvHMJd/v/cDb91c\nFXmFrixfQ0DB3r1RxFrmQdp5vdXRtXXmddQvtqatHuTKi8Qg748DsYp827AN\njFRH\r\n=XFXG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1ZEiAfBOwq9ESZvQQd9q4tlPogCcFIjtm6H4WnP83JgIgQVajarYghyVL1hICvqzws+w0SwIIKg0XCw6w6Lr6LkU="}]},"_npmUser":{"name":"vincentgenod","email":"loic.vincent-genod@consensys.net"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"loic.vincent-genod@consensys.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.0.2-alpha_1630672805110_0.7643946170620133"},"_hasShrinkwrap":false},"1.0.0-alpha.1":{"name":"eth-testing","version":"1.0.0-alpha.1","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","test:example":"cd example && npm run test","format":"prettier src example/src --write","prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint","version":"npm run format && git add -A src","postversion":"git push && git push --tags"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing --dev\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"691d71c14d7907c2cc2edeff0c2f06bd89ca731e","_id":"eth-testing@1.0.0-alpha.1","_nodeVersion":"14.18.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-vUTQzyzWxAUn3R0RlMipC3QHdD9WYXVKFFpX9YG2frEl7nIgEGh1lnNqrTALB0ANXWA9OIzrXEjVBkGRBpXKhg==","shasum":"7cafb9a9b3a1541dea79534d78cce793d9a51602","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.0.0-alpha.1.tgz","fileCount":24,"unpackedSize":40612,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhq5HICRA9TVsSAnZWagAAAuYP/1Z0nfiza+e5jaN3e2cE\nXJURruNEf3z3W5ZIz6F78dRi5fwstJwI85KwvI2l3zXTccn9j0WL4RFEULLQ\nPNzieitDOMu9kR6iY1eHpoeISoV4j/h9KOvcy99D4EmmU/VgNcEGrBI3jnrE\nSz+NjfzgA1tFjslglmC5UTUYn05n9D1wlSHLoDebHm4YJ4QqbNGlAo74UM2V\nK29BN3ZJ7CWMwRt8D0Q787huVqZhYUkrwbXbAR9t7en4wbWFWF2I66L2ppqd\ncvZP+JKsjk2HlAZQJr1/RTnlLjh0pWLrq2uJButpfmmwKaI7Q7BeBjPVCqVL\nSLRnlwqzb7rb8S17LkvPoQMZ1GlRgDyLbEFWcJBGlbmMjuK8Z9q6wdvmd0nO\nNuzDO0qKQCvzJAva59qujIuGRdR5MF31kRClXGhjZN/1Jh/oxw6EYUVBxWoy\n5mhWQvS+HpcPslVvL8JgxEpJKRB4/87Q7KSDNUyFJjgNWgHytTrVtB3eDTDw\n13AiDZdKjomeSm30ifWs5kQSO0VN+J7aNBKkFvzcY9/2dRZSuCc3yjX4J1rG\nP3S1dC+uUu6iYIJWZaYQmv5cx62wEbNdifqWv9pE4t6ghK+fGX0aHjDZenlE\nw6Fvy/Z1qdyG507EiB5dCDgMLucqs7qce6vkw+jNHhqagXXhmzuhMsg48FaJ\nWEZS\r\n=GlTZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA24lVrzkGX80fN6W7JSPz33gW3nESY/p+X7wC/lV4PgAiBbWNs2iUSei6wBf239HI/5EAibS2i+Zh3Sc2T2fzYE7A=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.0.0-alpha.1_1638633928032_0.7776825650796249"},"_hasShrinkwrap":false},"1.0.2-alpha.1":{"name":"eth-testing","version":"1.0.2-alpha.1","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing --dev\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"c11bdca858ad0e8fc8f7225be705472d4f9bcd01","_id":"eth-testing@1.0.2-alpha.1","_nodeVersion":"16.13.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-8uXn5bRRVRpgiN8BBJB5UUS9/G8xsBLmXeFZcYe20b/E1zg2Aun4Ztxj18prjN8PhTyfJK79Vrs1YXVTfRYrrA==","shasum":"bd9882adf96bcca2f9ca93cc222a7356a099d834","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.0.2-alpha.1.tgz","fileCount":10,"unpackedSize":18990,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhq6IICRA9TVsSAnZWagAASAIP/RxkTIGdEqdSn3IR6vVS\njDTeVVpAGi8LQ35B4sZaMqnf5p8K1EGEiakXYBZXzFt77Y/WuHSs72A+5/Sd\na/vM5ZUgrC9Cv/6Wm0Sm4zOeQubWToqDr/LMkMyVGt7La5NULmHbE0SGHnuf\nbOpt5otnseQIv/xtM2+DsJbEb9Wcr5q6A8Vw5j/6sPX9iAa5yWCpz4flnGgN\nnJYXSPGDPv4UD0JWEBWPT7SaW1a6B8E434mHT/Oe9jacat7eauWQSBZ6qrHB\nGRU/wvdEk3BHGGM8jx5kFa4XP+hFHlMc4Rnc2/dmH+9FNuIjwjijt7gYky8k\nEQeRwVKo57Al3taB5l5EsgcB9mo4006KaPmGXuKVvnlKjiQXziiKh912iHXG\nDEDVV++yVXur/ShEVDWwE0g8P9R6jS6IWurYV+4MH1kTXoWO6f/qNaBFzB6N\nSmnN+gCWN64PxqZGbR5jMpqN7Bc6Ln4FUdSfBC/vuhC4xOg4PpbPf2cQ028s\n7xhwRC7GnMXTMirQRfdXO0vyBPxqNZYxs4ZO5NlVhmajE0iVFAtZI97pbxtK\nIx2MGUC5kS3xyNgn/Omu63tLbPfesOKldocEcnnQ35NtpXe4e/UgAkhUVwra\n6jFL7By7l5pdlVbBc4eZSr3CEztxBEEsHlIMk9PckKwCLF3LA4ylA5d1VN/z\n/M0o\r\n=fNlV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDtEit3d3sLLUHuXJGsSy+IQP1Ya10LuNQV7F1PJPlNbgIgXpVblADo5B9AnFynZS4KXfgHuhsnYEgk2tUT5oK12LE="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.0.2-alpha.1_1638638088839_0.9568375077599187"},"_hasShrinkwrap":false},"1.1.0-alpha.1":{"name":"eth-testing","version":"1.1.0-alpha.1","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing --dev\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"a9db8176041879e273679823e9cc1d388195f4b2","_id":"eth-testing@1.1.0-alpha.1","_nodeVersion":"16.13.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-CTY4btf225FLKGo0RW4s1KCScc3G3MCgNCagOX6NOGTK+GaJvRDSrPIdoIDwyb6xu6HxfRGIQwkWV/1OVtKo5Q==","shasum":"e321226767a6373d542443238d26206a42542794","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.1.tgz","fileCount":11,"unpackedSize":19455,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhtiBoCRA9TVsSAnZWagAAnIMP/308+SHdctH977JvfgmU\nLE+6sYZL0oZPlfsAGsypf8l6L+FTK1Ltp1/JfpXCbHHis/N4ZjCfREtexTZ3\nYSDwp/jyr1p0zWCKqUsdYQSbtkvy/iRfnwpzmXhphQX8na1qYjVKNAiVJy7T\nKvHlx0b7+OwBsNOTk8x0qg3xFlG4uKYU/a4vtlq7JOAmyMNr4NXG57jXtABb\nv4zUumiT+WRG6KJCKE37RO7VM6+rAgFAyOtfogF1BODjIRMpoAi44h/Uibiv\nJV41b0iLiwccNqqJB383y5FBc+R8R7zSdYQvxTgobhGjNB8X+f3F77pEp0D0\nduM56Ur2GvCwONl0Oylsrc2b2irupPOamZigHVAOcTok8SCdERB1Gg9JXfed\ne42v2/xxcSX2PtrZYyxNCls7u4Ozn4TpwlMSygyWVeUra+pWbVE0dYJam2CU\nmMharfMUMj4PQAlWoiFZRs+DtoJ0DJ/pLdv9qnyUn+1ZQKlNtIlH+7b6hZKf\nX8WA0AUIt0E+rEslgcJHlB/cY9pQkKzIApSW/xFIiBJapNvu9YzoIdXbpQcq\naF/tsY7lCgz8+FWj16h/5XgKInh4h1VJHIcIwNi/qkY5c7Qp46hmXBYUOKUi\nP4xfmDH5IkT8xnUTH2P6YJH2GywlVyPp26MukAmw4Eky9XkO+JeoUnk9It3n\n1Mm5\r\n=hrOD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDpXKlLfgNYrmc4MfO8FX/aRK+N+eNN+jSHKB6VOcLA3AiBrW9xNydHD+UlamOFjNxH9F7eQ7CKdllJdna2wqsLODg=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.1_1639325800652_0.33247939353011025"},"_hasShrinkwrap":false},"1.1.0-alpha.2":{"name":"eth-testing","version":"1.1.0-alpha.2","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing --dev\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"8fc7d49ea6ec55ac64c519534f6b6bf26e04de1c","_id":"eth-testing@1.1.0-alpha.2","_nodeVersion":"16.13.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-fTb+C2tNYxyCbdVHU18K2lx+c2gH+CS5Eebk9uEsn2DIWdWqOUFFH5fKZp0sC3t4WJVGjL7kzzzdHL0wmEwlkQ==","shasum":"54c794c7581280118405de3d7653fd16439bafb8","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.2.tgz","fileCount":27,"unpackedSize":45627,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhtib2CRA9TVsSAnZWagAAU5gP/R1V+KEs5oa7P9Rcl00g\nrR1/VWxWb1V4xAB0oRkz1rDXS9ijDjKNtSx9kaz5pfBeYkLB5IuUi/iKL1yi\nYtP7mAu+X+H+hCtLw0g1xpBXlPUdxFJBPJUyihqh81AS9j34I5Nms/+gzefV\npbIyJLyoXpcTJMLihuZ4Dk/N7VHkSoGWPJkBP39DLdSWV2monlDLlBaaTPxD\nRTEJoc8n79Gz1uvUxGLzcuq3PTQ/ad0ZYK7NwjL1pXIo2/KVpnoSSBST73iv\nnIPQpogaZ/PsQDCPsximv5vOQjHCZNXJ7E588LzqNOYoOLz7gi/fAphWpLJd\nU8/lpRDa3d6e3hUEmdPBZg3cpVDuEVz9JkAzDby5fO4AJeKKzQHV+aZC8Iki\nip9bxF8bnEQavTXMNNTAcQsDzLqDR2AUQFIzrHcf1SvK6gREYR6b2/Qyy2Wc\ngu0o69CU/UY6Ij1sHhEUechrQ3CN2lfGpBFiYVd4MZEI8pD1pefSmuKMWij5\nVtFusikfmbgAw6s4SOHiSSwAV8gKcwfsp9j0qzVRYzk4L1MJss+/orImI7SJ\nb4WE/wRs+xHKJcB73sfpmmfMSZYpLtz+eNjAntC9TugJkT6hcp+khq7qSEpa\nDfv4h06Gvd52J4hBENoD+PqDazcY0VP7iOTGh1NGOGjGmxzDf1dWOQUuuggx\n/ywO\r\n=45bB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCqkOsb2sDeV8SXomHQX6jgjhbtjl92kEIuiXyPObDoCAIgaefUHZQN1WuY6n757xdXKmhIIItFoWgdE1Ny02qoZ8c="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.2_1639327478818_0.007995747453484636"},"_hasShrinkwrap":false},"1.1.0-alpha.3":{"name":"eth-testing","version":"1.1.0-alpha.3","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing --dev\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"4e9859b99202620a4be7c3da31131df8d420d1c4","_id":"eth-testing@1.1.0-alpha.3","_nodeVersion":"16.13.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-Ickfnum+DSs/NniXY7oDd306gM5QXhK21T9ZcXukNufljYlXx/7GJqQ7w1tlbdulYD5jY5TMMS4nybwRgd2Wrw==","shasum":"dfe64917d121f8cbed18ca08e40f9337fe5716f7","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.3.tgz","fileCount":27,"unpackedSize":46577,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2adzCRA9TVsSAnZWagAAE2wQAJFKWKx/8lrQEw3r3470\nhBHQbcCl3CyLHc+wLRW9Eg0ycCDqajY0SFadWnBzn/OZkY4vXK7Iupt+vcVM\nReC7Ygx6nw/kXhaea7rm6xdrOPNer7WyUypI1ZQuMvEy4wJlBJzkoSqrNEAj\n4iOidObMZXO1PduRH05oAnyYDwKWXVPHOFAuFRQAn6QnveTPBiUE26WWzU3I\nqPLgkmcU17PcpJr57AtaJKx7RXT1EYGMvFzzlPq7t4tJX3XhqYrqaX6tUyO1\neN2SffKajE7RsWkBIRfBxJBEA0oSxvI9n2Fg3F6sdOQLnGR0XM9Qhecd6yof\nt+8peU1gZnDuBhdzArBRPaEpb7LRnlB0C4I6GXK0APCj5j+AkdDTBj4aB1OG\nKrFQZbwljX6EdeByH1nzKRrM1vkfsQLzkyIA85BaqqyDkVlkeHX9b7Ka655t\nH8Tltrti+LfJB6H7/cWHhIReqBMZTSJ7HQjpEkkoKUIV6r+VVAdqLuC7ukE6\nEJbO8RwbePUpf2ENEjkL+fFRsohkcZTT0U5Yy8qvzZA2UkO9pZ3VZ1kNeBp7\nDKOjxoogmpD+gvWBFVtHfLRGQPq6BjrcYBfuc0KUdD8aQqKRzAbE6+f/yshF\nKSQ9FZp8cE2Fjo5cOBGEdo19jBSAOfmteh5GJ1gvh22ykLjibezFIxOwDnsq\nFVVQ\r\n=YaFy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB0fcylVCPu1NwqeXHn0NjPwRFZOs42GdP/O1JcIsz6fAiEAmlbCivjIfmtApsasIJ9L8KeeDPk2oZWqN+GZf8iaBQI="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.3_1641654130868_0.14379936155528816"},"_hasShrinkwrap":false},"1.1.0-alpha.4":{"name":"eth-testing","version":"1.1.0-alpha.4","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing --dev\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"1190dd2b2192fc54ebc63219d2876c8185054b6f","_id":"eth-testing@1.1.0-alpha.4","_nodeVersion":"16.13.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-rOIVsizQb+T7RPn85IkCR60U+6sJGyixw14WBYZKeRFVtmV9s9hQDRgV0KnKFp0H529InKDGtlkPoL5bFui+WA==","shasum":"296f3ca66e9195e0cbadae8ce06f8a76dea8825d","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.4.tgz","fileCount":27,"unpackedSize":46651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2cMyCRA9TVsSAnZWagAAh70QAItmxhQy+NcyouJgguz8\nXnd0GqWq/a33UFoyakkuPHIQw1qUa8w8ZPOnnuKir0fSx+IDGXLALUmehsvY\n8eJKrkgDVK3o4Rt/6R9j25nfysl9QZoOop8MNXqtVDnstbmRzcUCtPXQIxvm\nC/kqGkNPQsCt7sFfZphzSSzCcSAQkBcO77jA++E1ubAwcSu0TDT0NhiDpNZP\nQsJWUIgyxnEhnbDtsyDt0TZYFSuKXNqQKpoaLp4IOakL2Eua1L+BhLSWYUUs\n/IGzjHyOLG37DSxdf5H7FUGE0m2289LW2uAzm5lwCme52F9W9jjpuZNDaSQB\nROVdCMUkuUwDsQ1zKPYurmJkTk4ARRPiGTHmZCtVqUpcbqCO9P0ysc6fPNom\nVotYyoNMWxqIPF3FL/R2TbgMRFyxdVvg0xarI/3lfwq1SN0cJ/32TleLhu+X\n6nhVo7PFqeusQEPvZETIbFYmQV/NwA7LHkErXjA24DeHbXBoQrFdbxSjmquS\nrUV9HDnM99NB/HS4O4f0gSLixmlHIYecY2/40NVxQUMVQtVzfhXnbB8QXjKh\nj4Bi0nW4jFgwiTLy4wRX8jkJgKUWQKmUfWWHSp4oBLUQkULHTWtwkBGnwT0T\n3xLxlTkEotMWAgcEj7oZCCd/QSPtm8DLbheirOX8AUrd6gxZ57atTm02M6jP\nlYHu\r\n=EmkD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAG6uXXK/EVgFMBKpHJilfAHiTmYCWRvDcFDK74XTfV5AiBETTzmHlFBhnfUlCYlmtfJbMC3S3RSn9l8vxh1Jsbv4A=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.4_1641661234457_0.7483596869309785"},"_hasShrinkwrap":false},"1.1.0-alpha.5":{"name":"eth-testing","version":"1.1.0-alpha.5","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"c700e0ed561a48ecd9837c20fee1d82a450ed7ca","_id":"eth-testing@1.1.0-alpha.5","_nodeVersion":"16.13.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-9+jL/uWOGJOAa2JzOwXRO3gXrv/GOnwpqFzc5Bnyn3hqBG7fpT3EN/JNS1OjbU5DbMLEq9d0V68QIQVjKC1wCA==","shasum":"bbee094468b6d336dd81c62a61a9aeb5b916ea64","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.5.tgz","fileCount":27,"unpackedSize":46663,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh9roqCRA9TVsSAnZWagAAPg0QAJi+ysJDBMBEF2Lx0rDV\no1znyioXL8/QTXiEqQopNgG57fcLMTAlTuqprKRRq7LnD4HWxF9SSwuBetN5\nr50EXEQB/PaT/jXaethAuXV2t4MUtDjMThuJloMsBqf6EJ9QxD0XkmiHhXuQ\nlXijBm9YKFUvqAdO3BDocGiME5cJovpGMoWA2oTQnARb8Q98S1CIsDn+exMj\noeZvTW8lAs+IdpkkbpNuEMHvBBpt+KoIUR9A9f/iq4BXhtIz4BTk4MTyWBAm\nThy6pss7+a00AOXLc1XNXejRoaqxe6CSbLpdArwhBR4AH7Y8q2NS+fCIn3bA\nLlhY4fgvkHxb+8TVWP5gfFGpvmBmiV3oOkM+35lDnz8q7dG+7K3eU2lxP5nw\nzB4nn2axxs2zMHVsHsetlQEKFVtmrQjy830WkTQSjcz5EaJk7Npn77t2LBya\nr76ws+Br1mzKH1924yWfvXmJE4CNUSd1wNJTz0PtjCEp4KA1UXTNMfS1YqIr\n4gpCXWwKyR3NqyPB5gm8X7QeoNXdzRl03Qu5rDTHNENGLyUzwa8rs7REWOeE\ntH4KPp39jiK7THPzDDHxKN9PLSUYcSfL0MWMVh3dM0++lJF51AbIfIpuM7WX\njEi0Wi/1kI1N2Nm21ICSIDtYq/zQ+ZCzvlyd2PWJO1SBhwdRsTQO7geZ9bZ2\nq39N\r\n=PAlC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDSVVu1kcgJI+d0VALHec+4aJozSvhRvWCCwmCZGRzsTAiEA7df0ZLRV9IqTy/d/vABQJfpt3i2Pmo6+3Gagpw6gbaI="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.5_1643559466145_0.2798255843738049"},"_hasShrinkwrap":false},"1.1.0-alpha.6":{"name":"eth-testing","version":"1.1.0-alpha.6","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"7a73f20f8d549e87f18e133f2cda8a50c1e31f72","_id":"eth-testing@1.1.0-alpha.6","_nodeVersion":"16.13.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-k12ZC8li12snBVoYSdvm7ZE8fGZMtJgM8KnE/v9U/CTTGV5TZavbELT36PhDD8gbC9h0+w2khP1JE0/p7IRBvQ==","shasum":"798a7dc6ce4a969c78ccf7c24b45ae151741cdf8","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.6.tgz","fileCount":27,"unpackedSize":52442,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAYicCRA9TVsSAnZWagAANTYP/2zOkykAC+uakfwfruNf\nTMfmDTyzVqYRTSXF4DzE/QxXJNqTT3CcW7LCGmaCzp8UadQqQEEAFJGtX50W\n9avv5hW04iuiAwUsuXrA8tx1PRqzWLNGLPZKufnfUl6vfxt56RjPav1VenuZ\nY4ZiaNulGZxv2rzMSYmnfFwZbOlwr7eg7oSGCFu0yNlqsZuRt/XtNKOXA22C\nlOxWfyrWWWOkkcpzrk7Lb7UJCx/dtYy/mKOQEL7vwqk4Mc8xQ6uyugK+HTI0\niVOAsRMYg9ZONbA43ajH6iBpZsH6MZjDpAPk0KmikmZIDFdW9ardhZqXiTms\nGdX8ksHEXMXxNh/lWrY6xzgaPgkxyBP4+OrCQ33Der+lpKgqM9AuyTKLh+ln\nAkQXxssZuBEDVEU/QV/Awy65Rea9GRuaedD378cjjCFDuKppAoFXxMcHbkII\nkA8bEPSSbs7k5eB5uVMiiiuRXK7lqnBFzDPF2BNk4miwNXhtfjLFbUsus0qy\nlpy5eBuaa2i9+NUbFeOdDwGmzTvs2CyOWhCjtPAzQ1LL2YJV1ea7K9KfZU/E\nJEL3iaw+ynX87IwX+yohD1KGKsqYOBfZk/mEDHUKZsx6ncE2/00+bL+nVpXu\ncH90Fde8IWDR7xjL34YwtejaZPKTlLDgMg5x05NvQgbyEiLmP4bhzx0MgWmH\nx7dW\r\n=PZKL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAYj4PVHUjculuaAdeT1bV5He1XQlH8ACwT2TSo/UHxpAiEA5JoUR6i+u8hnCOO/Q4Bdrj7RFXNBIqU9HVOask7VwXE="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.6_1644267676773_0.16824249345072828"},"_hasShrinkwrap":false},"1.1.0-alpha.7":{"name":"eth-testing","version":"1.1.0-alpha.7","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"b21aa81ef6545d816d008ba3c551522700f17582","_id":"eth-testing@1.1.0-alpha.7","_nodeVersion":"16.13.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-wBjCgzwYajAFE4+UyNNiOTsA2hb803RCErQW9uDehUH/ktEpppEOIFqi68XFIvcfLLtC5zSqE1GucCimA16xnw==","shasum":"a50b6953c588f36b1e845a760c403c476e0e0491","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.7.tgz","fileCount":27,"unpackedSize":52570,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiC8DSCRA9TVsSAnZWagAAPtcP/24MUXSzBjaIcJs+Bd/3\nj+RX5NvpTcCtvFvL0yuJm2FhS4+xnBfcck6BW3uFGMsa6PPR4uhAhXOUkJS8\npAFuG/lEyElcvcK3iAMnlWyhRfgc4RUiUCberlLs2FXWXarXh8ixvDKdw4kM\nVsRUiXbE3uf/Cgnh68UfDyqrrqEPyw2fSdIFjZfAXvJWD0rsxivIZqTK8ftY\ntCtOAt+ZyxpDXuXO2SntEq2JSk8kY26VxRr4ODk+BtAtyfHuJdG5uiFTF+ij\n3nM2kKsicoWh44UvtOfmxhGRgmpTas9l7LiXww8FrK91mPrnRGrxAjkky3Za\nDHKewMgQlrE9oAQ6xQ7lwlYt4nn+c+WzkYOaKi74bZCv3wFbkHWKKn0r6YOY\nPrutAcyu3hG/YsD8xd5y1m8rfRREHdEDJ8qwBq91O/FoPNeHyGo8JqYONP+5\nAD1ALtSkmQPvDc2PsOsob2OO3dMJFutupnoK/JEfeYyCqPZq2xM3UurpZ2Vt\na7UBSAWCr/vX3GLUuyyx1Yy3FY0bwkiMXHcbec+GHF1dBE+2WZtjJRzRzExQ\ny85qF9YwPkqJkRsV9z+JV8YK5fNdLBtR274gz7rRsM498WNREg8H3Pv3rQ7y\n1+xI6+J2gmV2CsIMKQAOCQDPPzHx5aFley/Is3lUCwDNvwM4REZwnjY7BtpL\nN6Zq\r\n=JIt7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG++jYE+JJnC7y8v8N0rU3S2cXMjClHVPfqcH0GdujPNAiAKXy1FxcE/EHlOIe3KfQltJRkltb7Pd0r77icLezLEyg=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.7_1644937425989_0.21646097042533352"},"_hasShrinkwrap":false},"1.1.0-alpha.8":{"name":"eth-testing","version":"1.1.0-alpha.8","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"d53ca2084fec50774897cd137f244802852e227b","_id":"eth-testing@1.1.0-alpha.8","_nodeVersion":"16.13.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-uj9brQ6I6X3ygkuuFNU+7WPY49zscDINenylecklr3dbfbpj2Lz6pN1WerzIS7D8HCy2qGeUF8+YoaIwAo08PA==","shasum":"f9c94b3d6e2644c71bffcc49e966422c0bab22a4","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.8.tgz","fileCount":27,"unpackedSize":53147,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiDOeaCRA9TVsSAnZWagAA3QEP+wUlsoSbI0HuKYbl8NWi\nnHM+brchA0Pw+ul05pwtggzQ0TMzCFWM0FNU3PPw/GvdJM+3zwORSRc7FPFY\ngoPNpXxEUmpV/NEiEMzfGFJOGXtVphiTbL/tJY30YTSX5eowd9SQ44qYHbym\nsm5mCg0oRVAd06VtWhXN+w8ROaZicVbn7p6JEW2QT3Dc3EcfrY2OCLE57wCx\nQtQJfW2bwh843daXA06rqWEWm2SLkM8CERH13v4Nyq4mRAyXUIcbqwJJYyE5\nLhRxBDMPe5iHQUFf0e35jzZ2hWqt1FkenNPfMXclAGe9DXwjEEvwK82nY9IW\nN3jIp6Vn/mlq1n9I/Lr7+wiMMGw+TX7tYoKfoXeXw3j3LcfgB/ClsElgOKri\nHSnvXxkind7HLazXn26b19GbOPNIn3uPRG5Us1ktDQN9DMDRHM0YBGoaaMv1\n/PtZKJVYqZE2ntwXztx7ar4HXuNSWQHk3ix/JzLvf8DrQyizEXe5SnAb7Cux\njrwbIBrWylIY/nxZub4hFj48K1IJDwfm06irmgiIdVgf+5EM7Y8/8XmZbY6E\nBaqmg47vyVnFrMUQn8j/gklisH4SR1756Wvoee/5w8RWhMuZxYwSxmezX3Pp\nqFKK73YEEI3Ap4S5ARxk9VobhgVCetO9CoOtaIeUd/g/oAgvjJcP1r4lZaFw\nM1mO\r\n=m0U2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDkcKXjKo4qqRr50JQKtCIsxJDBAvIhDNaZYggksDiYHwIhAK1QV5J75seBs28GLFKj/ltA3ApUPpDJUp9Ux3JUsdMt"}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.8_1645012889997_0.2694875579084164"},"_hasShrinkwrap":false},"1.1.0-alpha.9":{"name":"eth-testing","version":"1.1.0-alpha.9","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils,\n    generateContractUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the setup and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"18ce4bf6d52b6f6562dc73b546c93d2f62a32d94","_id":"eth-testing@1.1.0-alpha.9","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-Rc62zSaUqdVOFZLNiyMQaQ7xw51PVGvm5n5CeY85sIXtEUIRhhxOVRTjjTi14msStMgV85FavonSfz21fm7h1A==","shasum":"84c7f2d22797bd2d83234c414033012973010fcd","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.9.tgz","fileCount":27,"unpackedSize":55385,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiETDvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqNFg//fu3FHY6DZqml9mSub+BFaweKGay2Y/pX0ovTCTF2L2/gf9M+\r\ngcaUocOAZ/xpI5IsrLD6YCzNlw4ubhfgyXkobdP0llA7iV9utc0QQ1tnsuUg\r\nbYzooJZrehzADKv22EZTiLY9jPGsdkkEZcdykLvQcCsSOn0hmxdd49e3II3O\r\nvGXzh5f6jqO1kQpCaebeWQ9JGcUukmmGwqC2q189vU+cHNDrSQFFq/6x+pVA\r\n6PIBNMcYFXldEyLLAE64XLN2cACqGVoDVFnhiZbXfrZzonra/xhxU27PGdS7\r\nGhE9141A7PnTS80h1jRoKd06EexHia5E0VULn1km/gxbvGfWkUCKTvU+Q1ci\r\ndXhCrroGiu1WFuNDzj0oWoLWRm5GMaEG5urzYRgEeGqmlL5kPNOA+1oR1+Fp\r\nZo3vWq7rIPRF+k1C0QqQkVrZE/IqQxmEfOG8osgg8rF4I3UnU+Ha/3KEMkSx\r\nGMWlPTNI6V6QdtI6zpJVbAuQRf+5/rRyGPr7OsUbA2Ec7LDjKE63ine6Nmba\r\nDTH58z2s5tMdb0TyJrmldE5SAMLl01t+9FSL6BkPGmKTgU4DLN6yLqf767fM\r\nbtnBmvjKnfSrJFiRPv9MBVSUmD0Fy4dKo9s3aGDQ1W74NCoYgJALOSZy2hpz\r\nwcy9eAlemv/sn/cW4GYT9NCr6BqMK5CpVy8=\r\n=crPU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDk4VghTetV70+Ee7556VdrTcmdnoV5ENyW8UYXTkbGyAIgR4VQdHesBUIj4Fn53NddBu7r8zmz7FWe+3RCZhc0Vak="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.9_1645293807159_0.5504098417991978"},"_hasShrinkwrap":false},"1.1.0-alpha.10":{"name":"eth-testing","version":"1.1.0-alpha.10","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"2fffaf3467b916bc1d24580704fe970b8c95e82c","_id":"eth-testing@1.1.0-alpha.10","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-y4Tpxl0AMTJpU0D2SWieiTza83eZvOlzmuCMCino+LCFvReFlN1LHAslcURVAKmE7LQK3OZuu441FFIhvDLYgQ==","shasum":"67382e9996e316aa6a6ceccd86859b5e96046c03","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.10.tgz","fileCount":36,"unpackedSize":69334,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiEkVqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrcLw/+OHRK4s7ZdR9IGMxh+WgBxQrWTV/B0wy6X8tKsuQsfvdIOKUd\r\nRtBMP7cuOMmjev5uLo+NrMdF2ePHGUR0EhNw+A6bfdYCKekKEBoeMyP8IEZN\r\nyEb88h5oYYxs9kM9pXXrU/hdlGHoZVmd79NDC0cBj2XzaBfDcmVUsy1ta87T\r\nCXy1KeiVRdpQLZ6Kd9lFHLiacc4z6AFb+e+zqslDv5fPdLRboskbIzO1Ax6l\r\nxrzBJFfmhPoMSCMSOAg+z2XH+FAyP4E5G45pQl6fmJ2EP9aP0giYV4qAPuiK\r\nl2EBsy6gBEvNSBGcpcbKIqDzsqjGf0/ZjWJEEcqUnaL/VFzjssBz5XUH1ENJ\r\nhSAHR3qxp07b6V1MlGhbkyuW5WivdIAL2FwvEOTKt03pHI/vlsyL8nIsa1oy\r\nz7WIpDxvsoZkghsl4oBmG/i8rkuGY7lBo4/XMjcFFsIetlxzl5BtBWKOFFVq\r\naAbQaloTWmzDDoMbp0Im2U92w1ZP/blEQZsb+u328lBfcYVwDuPtTQD6zXZG\r\nHGWZb2VEmcjR0isJEsEVbhYWZB3zqN2+h7MADa0N3H2CGu/mOpw1bjG4CpHi\r\nEBEwtdRR4vfY2w1r9lsaxQRlGDPfrarr+cwIHKWNc24MJadZkbbAku962F2t\r\nfpx7g3BPCD/VJeROVLh8MADw3niAvEXLIKE=\r\n=tiZm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCfSYsZP5gHFAApC2nL7Kr6XfSVbDxLIrm8U90OgFB3twIhAJOaSi847Q5qKEjlewzt2e8FaFQYeMaX+atCj7YBLGsI"}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.10_1645364586104_0.46831622473201273"},"_hasShrinkwrap":false},"1.1.0-alpha.11":{"name":"eth-testing","version":"1.1.0-alpha.11","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"@ethersproject/abi":"^5.4.0","@ethersproject/contracts":"^5.4.1","@ethersproject/transactions":"^5.4.0"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"10df662286d2d0e62b3e017541adf0a1656ca41c","_id":"eth-testing@1.1.0-alpha.11","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-T4ycnYgdzXb0ORZqbeeWJKu8VGEWRdpwioEsS9rttrHIfGk6xtYjX2q/bZOpQQfkyR2DsFO2Ah4k+CzR5XzxGg==","shasum":"bb210c4bd634322321f6887a71695810115e5ac7","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.11.tgz","fileCount":36,"unpackedSize":69400,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiEks4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+1g/5AWJVObgjl8dKjAIcyO52e4zHHgNFDwR+ZAZ4n9zP+cfegYdl\r\ner4JS1k/Hgis9z4QbbOWOdDq8LFsnRyKseVfe4EdYR9iyCuLx8ouhsopy4Di\r\neLvR+eP1H8AByx6rjglo45PomsLDQ//CaUiN1Qn1d0li+E9kQFOnS9uIEkGn\r\n893VaIyfuLB2ONyi2pK1L0oIcq627QOjuyJ9Tbb/KKcmH5ASX+IXBgu8amPR\r\nvOvz/Ug862Qt86KmDB51n8HSoTyu7hgKvAtNbepfar/B7PouM5rV3sBLD1QY\r\n1CO+yGcwmyTiGZg7YLjD7KrKPyWwOiF0duAnnDQZuukcylcWIcR9LrFOHH+/\r\nm8v7xxdLs2sWowsIHq+uIqVrLPkgT7DbYz5fkuMIjAfvOyUs8sWNGoguTD9A\r\nZeaU2bRv3t8FjdHvkXqxHuxv4ETu6tac1dO5GFqVsEY60f6340FicAqsrZbO\r\nTjlGYvEpuCIOjWL2N0lOXEauyKa4QSCqkuq/kbfyQz3Q6WX9fMKykFafJ/C2\r\nuBn0dxGPVcfkjPoXkjLD7ZGepbuL7m7eQZ1pmkaGWShVvBHTtdLCml6PSAKf\r\nOBDb9Vwa3363KODPCeOUxTRutqII/J+l7yBNnve2W859A4aSgesrbcE8a/kA\r\nNKhmGpHmYb3/JCCdUB2dZxSfu2631qfk+2I=\r\n=1ug1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGd1944Lxf+67YLkOu6RhVzdBBHYVtMi0pz3a27DBWx6AiEA3f1cNOjRpNC5/Zd/j8Txlxv+l1VzwqEnBXPJtRN5CBY="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.11_1645366072126_0.0439297832569423"},"_hasShrinkwrap":false},"1.1.0-alpha.12":{"name":"eth-testing","version":"1.1.0-alpha.12","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"c1e6af3ca45af4d84dfddf7f40c2c59d5228acf4","_id":"eth-testing@1.1.0-alpha.12","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-a0RRamRbpo89Wa8mUe0MyjFgZZKY6MMC/zgYaoRupeuVGB5qTP+gHMhvqDXcyqDFuLzJ3pwonm2QmIbLdDcviQ==","shasum":"c559a9fdadd9154cbdebb0abe1144162947b2959","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.12.tgz","fileCount":36,"unpackedSize":74308,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiEmLbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpP9g//dflZnrhIG1s9vafvcgxPzfXD9+p65nTsFpVAxC5Ul1iQrbuA\r\nvqAO7FVGzx+gJeTf1osSZssaNoxlBanbXfD/0EETiZ61vfbjAn9LgFLQpSHX\r\nlm774HrELkAcOMMI/Qvi62v7POQTinhrf6lPEIabnBmocDsu6/Ly7tM0xouB\r\nfKl1L4qOcWKi4R1relqfkIRM/6uDDo8mm0lC6rrt5gmRP12/WZV7Y2NM7+eg\r\nvgPrpXU4USsIK5hjf32Fd8LvVYBkAvD/lJaW+cO7EMN2HyX9Wa+5zJx4YiPY\r\n8ccNRAi7hTWSl5sku/chBoPt2XjQ2uTkUyCp9GtBLkH+faG8jU7pFK6dMtgZ\r\nIE8RBr+Sw4XjOJmnchDEyNpzTZGhHmwHSC99uZS5wdLAJ7qtRWXq9NulCQQh\r\noEsWvc1Nzfyq/u7sVpcaqw6EOiKEwxlA/RDEQSoV7z2HqucG0QWiCKS/G7Mg\r\nj0GsrjtDH7fAjTbqup7+ireA2oTNranD/qxrton4uCRvy6JTVbM5v3BQBP64\r\nYr/RN3XJZx4ZsxbqPdMsXAus+wkJJmhNJodVtwCidysq3+mc5mdHKb1WtLvu\r\ndklEylSm++PLivrNt2PNI4ULVrrVYFJw3q+SKX08XD4lz6DUa5a3VWLqmq88\r\nw0y7nojwVOGfSRAJGEAGS0lhNDlRdQth/Qc=\r\n=Cgwb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoyV+VSnApi5zW5aR62XXcKNeoAdHR5/MD6nFu4nDuhQIgIwPI8C63SyrYsPQJMJv41k3GAr1bD24iyNlr8UShJEc="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.12_1645372123440_0.8297513048379026"},"_hasShrinkwrap":false},"1.1.0-alpha.13":{"name":"eth-testing","version":"1.1.0-alpha.13","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"e7e3f78dca8c253aa8279d599ae208a76830b674","_id":"eth-testing@1.1.0-alpha.13","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-H1Qrj5HoykFUOWF1K1rlFk6k0UXgXJs9XQIvvgUYus2WHgxkc2E53lFzJ9/2eLugWN0wgEiFX3YOBOhahmeAtA==","shasum":"40c7903005c119d9c6c10a2f4e68e8b54f84431f","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.13.tgz","fileCount":36,"unpackedSize":74346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiEmf5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrL3Q//fO8a/xmNsXZKNf9oPA+8JLI3ErKxyWwagSi1YIBLtPpvv19o\r\ndCsy4wAq/is53nGkslr32dFj/wTXoTqIoC+h1Fz12BJThp9QU99SPYcuaJ7i\r\nJ9OsfvnQP+6+f0ODS3PX0e2EZkdsdPGbAXBXd2LR91nuyLLydXC81Kpg6ISH\r\n54G9CSYH06HSYsa5jVxX+4YzgLHroQj3XIoKEkVGy7w4iwxQqsQU06xEQphp\r\nDmtIMKi7ZWlDQBTzV1RU5oljlHRq2qWgUwQaSRccx9C9Izlzv6K+53kWDhFZ\r\nz3Cuth3AZ0mwtu4eCUi98d9MvRauPqE1WZsTn1IWG2Vmtz8fNcEo8Wh9aJY3\r\nTVyozs1psgIiqwjQmWcXeUmk9qqQ52rCuMS+xJG9MuNxl1k31YHw7nlKxPrf\r\njsvZAD9JUQfQ9w2qIkBAHiHkKFvuTAd1ZnSOs5WH9z+kcavZsyxV1Zy3EUz2\r\nz8u+jFrDdNY045Gh0e9LbEAc6CzDoH0oz+D8iBWrmFCP1Zsu6owwSXLWy6Ub\r\nHdSoNv0OGTbzTDq/l7zaFw7dfHEp/Q6mJQXVsw9cXb/WgW3w7JOA1nLH7vdP\r\n+tUGKkPt6tnztqQx3Ghxipak+UYRUtYrlNZqDZtP32OWL38M6f3Ux1fTTM+N\r\nhQEAZtvudRSopXySwLdpkiSUMlK62M56RYI=\r\n=MuIC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCHdKVgzDIIEq2xq/0sNsC9nlGy1zfg8IbKpkackIINcwIga9/+O9b8gNLhCfua1Q/hWukRiB6MM+hfQiGldMi+6Jo="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.13_1645373433219_0.3905537697626609"},"_hasShrinkwrap":false},"1.1.0-alpha.14":{"name":"eth-testing","version":"1.1.0-alpha.14","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"4ec931ae37b3660eb58558e88b1ba174d1f43450","_id":"eth-testing@1.1.0-alpha.14","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-C89FyPgBsb3Fp+MIx4QBxLyKBOrYgAUo0dr3bSybh3CcQo2L/DN0DEMemNLVmpTaMG0hzVwq3XtblqYrfiIsbg==","shasum":"f1ae73a15ad2193cad4c02660df675a10cb03282","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.14.tgz","fileCount":36,"unpackedSize":94864,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiFg9qACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpJ7A//YsyqrvkDc8dSGzGoTmt8UN7hFbsJH4j4pltIOjIXUnymVSx8\r\nosMgtiB47+RaAQsLvr4DnP29UP+R894LjJspCLfBtGA5tuz1HiynxV9NGJiD\r\nhaBhat2p1nWJ31/WCGYfQouE9+y9axlDA0VMeHpMT3hCHZcAtOJu0R3BaOrD\r\nNDG4et8bczJccHT9B6QDxj6qHw1LY0ZaPwrrDPtUAVWRPllZ0G9LKqFJWtu9\r\n3Jv1DU3cVOvLqlke0lmvAGuHi6Z02sgS9s8NKNydFecEjbkkd9HhngXNe5Ln\r\nVAv/zNEE5HeWQ7XTEsvJ45k35ytl02n2CzGtjkKq/gkCa0nooagaEqZp7t8Q\r\nu4gyIg86oSOWGl9g10y7v9pXWbAh0QuAPx8FEUJYr8/98YE3glcD9T8fMGWj\r\n80Xh6xhXQflKFyVmDJ+F3j9CDDxtSt+DtdZHf4bwG027QnumUop4zlDJrRvB\r\nR1FjmFRbUHtsoW0b+iXHeyxKBwN2O/nCZGVABIQYTGhpnpc5tUF7kqdAWusz\r\nCLP/0vKma90Ndl4kvX1trNGs25XVxfee4KiPRi0ycYN1ns4WwMVqiLZeU+jJ\r\nTtmteUnrwtArCvMJDWjiZ6eBkI3lx1leGaIZfgU6I8lV8Rq+oUFSphQH0tu/\r\nyyjX5FTWC2536o52r0QOIh9KhTaWdUuDf8s=\r\n=qoJE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC856B7sK9dfq7P9CZvVm7oWi9aTcQ1fV3HufRr8xyuWAiEA9WpUACUF+mp6mDFaJLBVPYLJZ11LUKwPKFhU/XxVJU0="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.14_1645612906047_0.2137213359697463"},"_hasShrinkwrap":false},"1.1.0-alpha.15":{"name":"eth-testing","version":"1.1.0-alpha.15","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"27d02b2ffe4c4c27fb408ad571db3b8778e693cd","_id":"eth-testing@1.1.0-alpha.15","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-2LNK5XRbGEQdgX9FUisFmHSClALpvBsR471o209HqALdp1kxbhsdCcCthiLzLEflcU5bv0XkKZ39sKjZPx8yNw==","shasum":"05315045573df4e6b9bc69768d00af74a5135a55","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.15.tgz","fileCount":36,"unpackedSize":95016,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiFhOXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoiag//bGKjZN8nuRKoUNC1esVzkimLfgn0a+UC0Na7EIquAEq/9JJg\r\ni8OInZWn7zSLEnGPDE+CU2auOZ/uQDewVbA0vQ3uYnziCVCctkwBxpDLTzTS\r\niRE4CYtECe7crRRT/Pz9BpUBvZLfYOztawstsVRt3axzqE8IFD4vZMAZp287\r\nitPWUT2OEPPmkOS5/SKmNk957rCZ1Oxv5f5Wv0/HRD9h+v6DOpNH+18FG+0R\r\nxTrOfAElM74redaEUmA8TCm9aJr8P72s1IViXl4ENI6oH6nYOHU3+HRegiPO\r\n0kfMRTRPk2CklgjzV/Edqhojshmnt5VHhRUY9vuZPp8TJYHSzbS641ouNAbF\r\nUKawPcIXyGmR/f6X7UokAei0LbpPZOLAvuSe3xhnTfPSyeuc0FXl3SjiiU5y\r\n0Jm5Jhr+ZO+wAjoogrRluRYT+TT8XC4sWo2NDU64ParyLUdErNhHzU6TfmXS\r\nEKhxZktYWXCdGL+xudNhZIsPIoGwMzcP/C9BY0seUj7wAHdQGzL6NpDZNiTP\r\nkmNFGp23QxPYiocFXKiCD/lBouL65OYEjGW/RcK6yHZjjCLug9YHwsY+62Tg\r\ndTaucG2V6cvq+2M8kAgIjyM9bqghNih+AozRt9ORfuLk8TvQ/lTLG90+1Srl\r\nURj9UvuRbLNd5NLuM3Oii+7NKxQsbkbtzuI=\r\n=M80B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHfLiQ4gKnCNxmpwBUqa98mshg0xm3XIRbZpPsmR7laiAiBhltdoBx9AAxEOTB2JVxkLT4mL33UiwuIYahrP/N+SPg=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.15_1645613975481_0.7350844974346213"},"_hasShrinkwrap":false},"1.1.0-alpha.16":{"name":"eth-testing","version":"1.1.0-alpha.16","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"223da6c6ef33ff8756b2b7ab5c4de6c12732c014","_id":"eth-testing@1.1.0-alpha.16","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-oSRqTXl2NxcBz2Low5BSblQ5v2k4pNDTEiQn6sxS4gjQ3NC2KQglVPcMHCzlOp97dkxNj6CheecCJKX3N1gMjA==","shasum":"4cb97f54898d52dfd2b0164b722d22649032b74f","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.16.tgz","fileCount":36,"unpackedSize":96992,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiFmTDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpGhBAAhxy5v2a8aYF3IApmNc8QEQL8pY0lzwu3HX0/BbJNQPmF48SN\r\nxllxh0Qi49VwNsUPq0IootZsgWtnQCQ0qK8L+3dtkFqM2wGQPfYIxVDQhbRu\r\nT59niav+S18AXMZdTejHPPi0j2FNJseWUzO6k7lcrkGWUc9KqCM1ULKEsr7R\r\n/qi2LIkAOo8M//rxArRfUq7+5v36k34S6lCVhq28mXkNPQkH+BMDbQY+sqgo\r\nWaQPvGUWgLy2YOMN2Ej7gzz3y9LS9kdOWiI93JKNBp0V23gCsixGLwl5reCA\r\nxse2DzgiDVgJvQ0+i/i5a15qG8W0wEVV6Ya9z3o6kHpVbIwD5RM0p3N9W/HZ\r\nCACkK9lXZxxtDZZCOBkSB/SSeylxOTbapdT0CT3M5TduimEkEVIwUyQvIXlt\r\nuqvbXsquwH2fH6vf82FFyhWR+u0QTwb5xy2ys9c1VQ3GT9IY5/2f2hkOWmxV\r\nPKhflyc1ubDKs7SDrUUmxEfpPrljhbzxJh/lbUyOIoWxwi/Tbo+k9N1JcmBh\r\nge2WyPofWjR0ZeKzWKqjcjX2dhj+w+G/NXbzjD7fOUDhDjpP1tz4Q2NhXMtj\r\nJNmKn6uR4pdOoFdO6uRkPTh4vhBk3oARG9C6CJqn1nwz1PYQUJdAojiEs7MT\r\n98L7mRtYm2bVtKPuUNYLrH4IP7FpZ8er4Zo=\r\n=88L6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDf6CGsy0SBXRhBWSOgXQWL5Cr8V/NoqXEiX3vk4f474AiBY0KXyLfag8la3UaOA4Qr7O5W8YOHjmzzgsR1ZFmtlvg=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.16_1645634755272_0.3584234689559498"},"_hasShrinkwrap":false},"1.1.0-alpha.17":{"name":"eth-testing","version":"1.1.0-alpha.17","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"b1c32c583ae3e05aa3f5ebc34d83a1b3d26409bd","_id":"eth-testing@1.1.0-alpha.17","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-zBb6NzxnULjWc8p1TLET2+2Zwxw/0ch6JScyM6FqILqjYzqJ2TsRWTEoV8Xp3FFxD60Ou95Sq9fM9ldMxGgAwg==","shasum":"a0b31999fa93dbf630d81c86639e14e4246b68de","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.17.tgz","fileCount":36,"unpackedSize":98283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiGNyFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpp3A/9EpQ6U7QOwceFbfTw3AHCh6guh8r+0qjUqt3PtY/EJDSkmAJX\r\n+W6LvaJQ0zZn01ahOYYzL0cszkIE0XeD6RX9kH4EUzYXypKRJ7nv6ybu75DE\r\nhF3kRt1BhhTBBXoUxF4q4+2N4iR7xOAllJwfXTM8ezXnqef8Xzs1mneLjpGs\r\ngQxsPN9OZaBoo5e4kgOT+fot2YA8We2SZyS2ZZrzLknG8ijTiuwLnVXIbc2C\r\nV0+znOCydq8XnAV8VxTAXIKWPnzraghm75RNhW9PyvLETWxte6hKsf8ERUv8\r\nc8ncYdT/LKvTkjlwWeuOBs4VmscxyLlwZ3wfpsvnunf1sCqQdvkAfw57yudz\r\nZlYqlHryS6bYrPxl08JQVQE9Kd15SaYc010IMEm/xdg1MFxrvWSsB5Q94BdE\r\nxg22m91HRGzPFBBCXlDym5Gz1VI9a2tmVp3Ei6Oh0XdatASy8Rp+Ij5zjAQE\r\nclfLMEl0xRChs/voJY5bSJFKxABHVe7DRSeu5IM7dwy8ZdRGR4n9rP5CW2mE\r\niiP9HMNVATUDUrdQL722w3g8N1ob5FwM3JY3r7taq/DF95nW3slyl2j0Yx1y\r\nNbmkatTQbvoB71g/ShaAwDR6UdRkwWftL8AKnGAVZJb70T4XAe37ntF6EElM\r\n5gcGUBF6XRPh2ghng60PeWpgIDzqCZuvrzo=\r\n=SDdb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG9kv3sIiHnrUGFXVURzp+NG6nNjMSembUfoGhvbhF9HAiEAwtinUOV0lI7eKQbeMCPapErOdvXAXxet9T9PIQS6fE4="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.17_1645796484881_0.535085217344158"},"_hasShrinkwrap":false},"1.1.0-alpha.18":{"name":"eth-testing","version":"1.1.0-alpha.18","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.\n\nThe goal is to directly mock the web3 provider level, it implies that it does not make any assumption on what other libraries/packages, such as `web3.js` or `ethers`, are used in order to interact with the remote blockchain.\n\n**❗❗ This is an alpha version ❗❗ Use it at your own risk ❗❗**\n\n## Example\n\nAn example of a simple decentralized React application is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Installation\n\nThe recommend way to use Eth-Testing with an application is to install it a development dependency:\n```shell\n# If you use npm:\nnpm install eth-testing@alpha --save-dev\n\n# Or if you use Yarn:\nyarn add eth-testing@alpha --dev\n```\n\n## Example preview\n\nThe `example` folder contains a fully tested simple application. It allows a user to connect with MetaMask and interact with a smart contract. The test of the loading of the full app is shown as an example.\n```TypeScript\ntest(\"user is able to connect by clicking on the connect button, the wallet informations and smart contract values are shown\", async () => {\n    const contractTestingUtils = testingUtils.generateContractUtils(ABI);\n\n    // Start with no accounts - the wallet is not connected\n    testingUtils.mockAccounts([]);\n\n    // After the eth_requestAccounts has finished\n    // - the account will be \"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\",\n    // - the chain will be \"0x1\",\n    // - the call to the `value` method of the smart contract will resolved with 100\n    testingUtils.mockRequestAccounts(\n        [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"],\n        {\n            chainId: \"0x1\",\n            triggerCallback: () => {\n                contractTestingUtils.mockCall(\"value\", [\"100\"]);\n            }\n        }\n    );\n\n    render(<App />);\n\n    const connectButton = screen.getByRole(\"button\", { name: /connect/i });\n    userEvent.click(connectButton);\n\n    await waitForElementToBeRemoved(() => screen.getByRole(\"button\", { name: /connect/i }));\n\n    const accountElement = screen.getByText(/account/i);\n    const chainIdElement = screen.getByText(/chain id/i);\n\n    expect(accountElement).toHaveTextContent(\"Account:\");\n    expect(chainIdElement).toHaveTextContent(\"Chain ID:\");\n\n    const contractBoxValueElement = screen.getByText(/current value/i);\n    expect(contractBoxValueElement).toHaveTextContent(\"Current value:\");\n\n    await waitFor(() => {\n        expect(accountElement).toHaveTextContent(\n            \"Account: 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"\n        );\n        expect(chainIdElement).toHaveTextContent(\"Chain ID: 0x1\");\n    });\n\n    await waitFor(() => {\n        expect(contractBoxValueElement).toHaveTextContent(\"Current value: 100\");\n    });\n})\n```\n\n## Usage and API description\n\nThe first step is to generate the utils\n```TypeScript\nconst {\n    provider,\n    testingUtils\n} = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the two choices for now are `\"MetaMask\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```TypeScript\nbeforeAll(() => {\n    global.window.ethereum = provider;\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```TypeScript\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe available functions for now are described below:\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```TypeScript\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```TypeScript\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```TypeScript\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\nAdditionally, the `generateContractUtils` is exposed from the `testingUtils` object and allows to generate high level utils for contract interactions based on their ABI.\n```TypeScript\nconst abi = [...];\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    function setValue(uint newValue) public {\n        value = newValue;\n    }\n}\n```\n\nThese utils expose two functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```TypeScript\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```TypeScript\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it at your own risk.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```TypeScript\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```TypeScript\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n","readmeFilename":"README.md","gitHead":"0866dd48dd11bf070f95c3ae493b9336ae8ee3bc","_id":"eth-testing@1.1.0-alpha.18","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-N8AKpOCJkCtr/9qE5/EpMPbShluvG7j7CQr/POFohJc88W5vTC4vJXtZYmnsXUl2cnclRkocrnhc0+mgLMmJKg==","shasum":"ae2e5d151075f29b18ca28370ac21bac8ff87c3d","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.18.tgz","fileCount":36,"unpackedSize":100015,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiGPYdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/5BAAkBumgzKcVSoQxiET0ZFA7pQqcguLmd2+Kdf0Dk4nFjLZKT6k\r\nHlUFiVvX5d3ikODe+U+JCb8lKrLbEb5L4Zvmgj5xAeJpsS73Cd/RGywZYBe6\r\nGghNb6ohohe1NAvy9Q0YUnKRqtEQBUe+QI3AVoNKQEgvtX7jvZzCgn4CE9tI\r\nd7KYfNLiPRffBq9rJWlJWsd5mt0gRRqEuH+lpGRTzSZlEno/kabrsmfNP5UF\r\nTL7jUwfG6gqpHWU4coO16Rn5wgvUxNGEt8CWzFbvBE8u1pThUlFFdKPrQj2D\r\njoiyY8GafdmVXgUTfkpuIfDKd8OFZDd2wbf1cNkwrKzOcc/b1xO/MNbWKfPm\r\n1DRllenQyYqE8SZriqijQtAcJVnI6NN59DKklSpM7xCOu3mMsfivw6yxrAgv\r\nzmevoTQZuxuO0IMjn6ju2Edd4kZcSVIR0JYOZQtm4QLIqieKkWxvm8D4W0aI\r\n6Lw+pjIf+fL7SJkmxcBXK+BSfnl1egV1tBpOdNS+HOSwrIhfZ2ZMfS+I8ibW\r\nBSjqtU3wJo+LmrmDxGqAxKRhV6DAz5ufbtgh0miXAg6SNhRFMc3+MZwh0wyB\r\n5XLuSPbTAe3jvFfvt+NgJbvhZ317QagRffd814+V8wjBq2CrhCFcDV+Lk85z\r\n1Eb2UxzH5IkaMo6ej/4ZKQmSShnJzzdBmwI=\r\n=a5dT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE410+ohpLBsY7GGNdjxLUta0kFdXkleopG+EK767zKXAiEArCzbO7AmTziQ+n1i+Jn+9oH6kKGj1Z72CqZz/73QCdU="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.18_1645803037307_0.6612658712267139"},"_hasShrinkwrap":false},"1.1.0-alpha.19":{"name":"eth-testing","version":"1.1.0-alpha.19","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mocked Web3 Provider and simulate blockchain interactions in tests.\n\nBecause the mocking happens at the level of the JSON-RPC requests, the core functionnalities of this package do not make any assumptions on what other libraries or packages, such as [web3.js](https://web3js.readthedocs.io/en/v1.7.0/) or [ethers](https://docs.ethers.io/v5/), are used in order to interact with the blockchain.\n\nIn this spirit, this package tries at best to expose testing utilitaries that are not tied to an external library.\n\n**:warning: The package is quite recent, any contributions, issues or feedbacks are welcome :warning:**\n\n## Get started\n\nThe recommended way to use Eth-Testing with an application is to install it a development dependency:\n\nUsing `npm`\n```console\nnpm install eth-testing@alpha --save-dev\n```\nOr using `yarn`\n```console\nyarn add eth-testing@alpha --dev\n```\n\nAs a very simple example, let us consider a React app using [metamask-react](https://github.com/VGLoic/metamask-react) for handling MetaMask and tested using [React Testing Library](https://testing-library.com/docs/react-testing-library/intro).\n```ts\n// App.tsx\nfunction App() {\n    const { status, connect, account, chainId } = useMetaMask();\n\n    if (status !== \"connected\") return <button onClick={connect}>Connect</button>\n\n    return <div>Connected account {account} on chain ID {chainId}</div>\n}\n\n// app.test.tsx\nimport { setupEthTesting } from \"eth-testing\";\nimport { render, screen, waitForElementToBeRemoved } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport App from \"App\";\n...\ndescribe(\"app connection\", () => {\n    const testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n    beforeAll(() => {\n        // Manually inject the mocked provider in the window as MetaMask does\n        global.window.ethereum = testingUtils.getProvider();\n    })\n    afterEach(() => {\n        // Clear all mocks between tests\n        testingUtils.clearAllMocks();\n    })\n    test(\"a user should be able to connect using MetaMask\", async () => {\n        // Start with not connected wallet\n        testingUtils.mockNotConnectedWallet();\n        // Mock the connection request of MetaMask\n        testingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n        const connectButton = await screen.findByRole(\"button\", { name: /connect/i });\n        // Click on the button\n        userEvent.click(connectButton);\n\n        await waitForElementToBeRemoved(connectButton);\n\n        expect(screen.getByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/)).toBeInTheDocument();\n    });\n    test(\"a connected user should be able to see the wallet informations\", async () => {\n        // Start with a connected wallet\n        testingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n\n        await screen.findByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/);\n    });\n})\n```\n\n## Examples\n\nAs a next step, an example of a simple React application with contract interactions is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\nFor a more serious application with more complete features and tests, one can take a look at the [Rainbow Token](https://github.com/VGLoic/rainbow-token-frontend).\n\n\n## Usage and API description\n\nThe first step is to generate the utils\n```ts\nconst testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the three choices for now are `\"MetaMask\"`, `\"WalletConnect\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```ts\nbeforeAll(() => {\n    global.window.ethereum = testingUtils.getProvider();\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```ts\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe main functions are described below:\n- `mockConnectedWallet`: allows to mock the connected accounts, the chain ID / network and the block number\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"], options);\n```\n- `mockReadonlyProvider`: allows to mock the chain ID / network and the block number, the accounts are mocked to an empty array\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockReadonlyProvider(options);\n```\n- `mockNotConnectedWallet`: allows to mock the accounts as an empty array\n```ts\ntestingUtils.mockNotConnectedWallet(options);\n```\n- `mockBalance`: allows to mock the balance of an account\n```ts\n// Mock balance of 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf to 1 ether\ntestingUtils.mockBalance(\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\", \"0xde0b6b3a7640000\");\n```\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockBlockNumber`: allows to mock the block number\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockBlockNumber(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```ts\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```ts\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Testing contract interactions\n\nMost of the application interacts with deployed contracts, interactions are generally more complex with contracts, hence a dedicated object has been created for it.\n\nThe testing utils expose a `generateContractUtils` method, it allows to generate high level utils for contract interactions based on their ABI.\n```ts\nconst abi = [...];\n// An address may be optionally given as second argument, advised in case of multiple similar contracts\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    event ValueUpdated(uint value);\n\n    constructor() {\n        emit ValueUpdated(0);\n    }\n\n    function setValue(uint newValue) public {\n        value = newValue;\n        emit ValueUpdated(newValue);\n    }\n}\n```\n\nThese utils expose multiple functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```ts\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```ts\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n- `mockGetLogs`: allows to mock the next retrieval of the logs for a particular event type\n```ts\n// Two events will be retrieved with value \"0\" and \"12\"\ncontractTestingUtils.mockGetLogs(\"ValueUpdated\", [[\"0\"], [\"12\"]]);\n```\n- `mockEmitLog`: allows to mock the emission of a a log for a particular event type. :warning: there is a difference of usage between `web3.js` and `ethers`\n```ts\n// With ethers\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"]);\n// With web3.js\n// Needs to be done before the test or before the subcription happens\ntestingUtils.mockSubscribe(\"0x123\");\n...\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"], \"0x123\");\n```\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it if you are confident with JSON-RPC requests.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```ts\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Mock options\n\nSome methods allows to specify the mock options, or part of the mock options.\n\n```ts\ntype MockCondition = (params: unknown[]) => boolean;\n\ntype MockOptions = {\n  // If true, the mock will not be cleared after being used \n  persistent?: boolean;\n  // If true, the request will throw, the data field will be used as error\n  shouldThrow?: boolean;\n  // Timeout in milliseconds for the resolve or the reject\n  timeout?: number;\n  // Condition for the mock to be triggered\n  condition?: MockCondition;\n  // Callback that is triggered once the mock has been used, it is particularly useful when mocks needs to be triggered after certain user actions, like a transaction or a wallet connection\n  triggerCallback?: (data?: unknown, params?: unknown[]) => void\n};\n```\n\n### Verbose mode\n\nIt is sometimes handy to display which JSON-RPC requests are triggered and for each, show the associated mock if it exists. For that, the setup function allows to set the utils in *verbose* mode\n```ts\nconst testingUtils = setupEthTesting({ verbose: true });\n```","readmeFilename":"README.md","gitHead":"84010b4477e3d793052c76c2af2cbf0ea38fa93c","_id":"eth-testing@1.1.0-alpha.19","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-BwhurC7hJyRHR3PauPNBPrNZ3wKipWCCBEJiJ5na0RyOv8I/+N5KzpCY0Z5fHfzUNY9+egIsMmruoMGo3k4Z5Q==","shasum":"36d5d5face1283feb4dae963e45fe83c1476a636","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.19.tgz","fileCount":36,"unpackedSize":104107,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiGklKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrBwg/9GaJNKV9c+/xgoHByajQ4zlPAc3nL9EJmiz4LTRR3rI3OrQzj\r\npvoL9O6xl00BWIOt/By0bsPt0BiQfdDF/BHSXaXuhlzyJnKGDdOGTCWflGp2\r\nI3BaO6nCEbaMzXjBgNshUEX3NcLgibnZJ5lW+CaMO+SUk2FmVK+09Kg4rOLe\r\nqbqs+XqnyQT0b+MG5e8hJWFaE1M+d5tsAtVxD5GU9OVa4O5eln8H6A85hJ5X\r\nZJH2WQqxsXJihAfgYfi9sYnN9/m9Kx0HjGZR7hx+cykvDbYEVJUQmgw8nCP+\r\nwz6g55WVtS8eSYEvFzMXg1Z+h0HzvuZ7w8nrZ8EC8PrG7wJ7Nt7BgpZ14YM8\r\nUmFkPXOt42pHdKH4zUXUpf6yK97bSMGYY6t0jQTwchbI+aiO6QmQ8DQPU7Oa\r\nm6RYN9es7Sg0iJd9JsvZWpGMXV0gja3GCI457RWEoA1f0P7U9AmKfMYSNl2R\r\n8qq89I6Fui5H+6GOYj6gZUKvSi1nIDPzgPLKqkvU4MMHBKb+jqzqVMKzg+WI\r\noj8Lkrnf0Dnc+SMhZdJpeYqggb2lTWzHVjAevn7m3AW5XpxuIxV+GD7Oqknz\r\n6TiHg0hEDpTnzoVATDHOIszEZVq87t5dAFSu786/ZplXALxaH3s6mMv2vokI\r\noK08WZiRuCFDPtQZY3DGmlU0Lfr+V9wnTmg=\r\n=3J1V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICCFVfAOnexjFxsTVvoSwBcxTWP0jpD4rRhtKaI+GYKxAiBcocOvPaC/9fuJMDywvSVEgmTmYLOcL+g7k1H21iDPeg=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.19_1645889866241_0.2966460385267986"},"_hasShrinkwrap":false},"1.1.0-alpha.20":{"name":"eth-testing","version":"1.1.0-alpha.20","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mocked Web3 Provider and simulate blockchain interactions in tests.\n\nBecause the mocking happens at the level of the JSON-RPC requests, the core functionnalities of this package do not make any assumptions on what other libraries or packages, such as [web3.js](https://web3js.readthedocs.io/en/v1.7.0/) or [ethers](https://docs.ethers.io/v5/), are used in order to interact with the blockchain.\n\nIn this spirit, this package tries at best to expose testing utilitaries that are not tied to an external library.\n\n**:warning: The package is quite recent, any contributions, issues or feedbacks are welcome :warning:**\n\n## Get started\n\nThe recommended way to use Eth-Testing with an application is to install it a development dependency:\n\nUsing `npm`\n```console\nnpm install eth-testing@alpha --save-dev\n```\nOr using `yarn`\n```console\nyarn add eth-testing@alpha --dev\n```\n\nAs a very simple example, let us consider a React app using [metamask-react](https://github.com/VGLoic/metamask-react) for handling MetaMask and tested using [React Testing Library](https://testing-library.com/docs/react-testing-library/intro).\n```ts\n// App.tsx\nfunction App() {\n    const { status, connect, account, chainId } = useMetaMask();\n\n    if (status !== \"connected\") return <button onClick={connect}>Connect</button>\n\n    return <div>Connected account {account} on chain ID {chainId}</div>\n}\n\n// app.test.tsx\nimport { setupEthTesting } from \"eth-testing\";\nimport { render, screen, waitForElementToBeRemoved } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport App from \"App\";\n...\ndescribe(\"app connection\", () => {\n    const testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n    beforeAll(() => {\n        // Manually inject the mocked provider in the window as MetaMask does\n        global.window.ethereum = testingUtils.getProvider();\n    })\n    afterEach(() => {\n        // Clear all mocks between tests\n        testingUtils.clearAllMocks();\n    })\n    test(\"a user should be able to connect using MetaMask\", async () => {\n        // Start with not connected wallet\n        testingUtils.mockNotConnectedWallet();\n        // Mock the connection request of MetaMask\n        testingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n        const connectButton = await screen.findByRole(\"button\", { name: /connect/i });\n        // Click on the button\n        userEvent.click(connectButton);\n\n        await waitForElementToBeRemoved(connectButton);\n\n        expect(screen.getByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/)).toBeInTheDocument();\n    });\n    test(\"a connected user should be able to see the wallet informations\", async () => {\n        // Start with a connected wallet\n        testingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n\n        await screen.findByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/);\n    });\n})\n```\n\n## Examples\n\nAs a next step, an example of a simple React application with contract interactions is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\nFor a more serious application with more complete features and tests, one can take a look at the [Rainbow Token](https://github.com/VGLoic/rainbow-token-frontend).\n\n\n## Usage and API description\n\nThe first step is to generate the utils\n```ts\nconst testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the three choices for now are `\"MetaMask\"`, `\"WalletConnect\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```ts\nbeforeAll(() => {\n    global.window.ethereum = testingUtils.getProvider();\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```ts\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe main functions are described below:\n- `mockConnectedWallet`: allows to mock the connected accounts, the chain ID / network and the block number\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"], options);\n```\n- `mockReadonlyProvider`: allows to mock the chain ID / network and the block number, the accounts are mocked to an empty array\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockReadonlyProvider(options);\n```\n- `mockNotConnectedWallet`: allows to mock the accounts as an empty array\n```ts\ntestingUtils.mockNotConnectedWallet(options);\n```\n- `mockBalance`: allows to mock the balance of an account\n```ts\n// Mock balance of 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf to 1 ether\ntestingUtils.mockBalance(\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\", \"0xde0b6b3a7640000\");\n```\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockBlockNumber`: allows to mock the block number\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockBlockNumber(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```ts\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```ts\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Testing contract interactions\n\nMost of the application interacts with deployed contracts, interactions are generally more complex with contracts, hence a dedicated object has been created for it.\n\nThe testing utils expose a `generateContractUtils` method, it allows to generate high level utils for contract interactions based on their ABI.\n```ts\nconst abi = [...];\n// An address may be optionally given as second argument, advised in case of multiple similar contracts\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    event ValueUpdated(uint value);\n\n    constructor() {\n        emit ValueUpdated(0);\n    }\n\n    function setValue(uint newValue) public {\n        value = newValue;\n        emit ValueUpdated(newValue);\n    }\n}\n```\n\nThese utils expose multiple functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```ts\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```ts\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n- `mockGetLogs`: allows to mock the next retrieval of the logs for a particular event type\n```ts\n// Two events will be retrieved with value \"0\" and \"12\"\ncontractTestingUtils.mockGetLogs(\"ValueUpdated\", [[\"0\"], [\"12\"]]);\n```\n- `mockEmitLog`: allows to mock the emission of a a log for a particular event type. :warning: there is a difference of usage between `web3.js` and `ethers`\n```ts\n// With ethers\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"]);\n// With web3.js\n// Needs to be done before the test or before the subcription happens\ntestingUtils.mockSubscribe(\"0x123\");\n...\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"], \"0x123\");\n```\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it if you are confident with JSON-RPC requests.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```ts\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Mock options\n\nSome methods allows to specify the mock options, or part of the mock options.\n\n```ts\ntype MockCondition = (params: unknown[]) => boolean;\n\ntype MockOptions = {\n  // If true, the mock will not be cleared after being used \n  persistent?: boolean;\n  // If true, the request will throw, the data field will be used as error\n  shouldThrow?: boolean;\n  // Timeout in milliseconds for the resolve or the reject\n  timeout?: number;\n  // Condition for the mock to be triggered\n  condition?: MockCondition;\n  // Callback that is triggered once the mock has been used, it is particularly useful when mocks needs to be triggered after certain user actions, like a transaction or a wallet connection\n  triggerCallback?: (data?: unknown, params?: unknown[]) => void\n};\n```\n\n### Verbose mode\n\nIt is sometimes handy to display which JSON-RPC requests are triggered and for each, show the associated mock if it exists. For that, the setup function allows to set the utils in *verbose* mode\n```ts\nconst testingUtils = setupEthTesting({ verbose: true });\n```\n\n## Contributing :rocket:\n\nContributions are welcome! Please follow the guidelines in the [contributing document](/CONTRIBUTING.md).","readmeFilename":"README.md","gitHead":"2877dacee3e23ba0f2f05c432432cb63e0a0c93d","_id":"eth-testing@1.1.0-alpha.20","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-RkJYIL3D5UkJkTqzf5kEZVLQuzgeLkdxHbQDUSMlO1ilg9wofgUttQOkCwEuwhzHeqtWFX1z4lwDxpGrMnnzEQ==","shasum":"83495a5dc17f657bd9cf87194f931848e65eeafa","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.20.tgz","fileCount":42,"unpackedSize":155462,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHJY0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoSchAAgx9OAhKK7QYJltTD/V1ZheTP6BjPZRNJMYMo6EslYETIbddQ\r\nUs/PexgmHB39WwrMTAqXoXmxTmq4H6vdg300BoONXP6sAAXonK4AJDg2OnDK\r\nFP49xZPzvjca5ctjDNMqKV1O52u94bq2eqttwvjBQp7yDcP9Icoj93h+jQmL\r\nWmIauCiX7mEpZaJKY+rQwFfa4xSdUaH1BcIEmcehtD/hTuanma8TvK4iqSC3\r\nbxQ6q2wt44BQYEBMRVhL2TGzCXj+LU87CE2ZuKw+VQGwCWHv0S+E0ZNqIjcG\r\ndCOLGB6msGwI9ayVuScrew3VKaMIMMOvYKz/X968oydwKY5ht+NL1AJ7anPP\r\ni2QKXsxeORISrV+I0GTNksRAcRueidS+a9r16qoDsSTvhyqeItfSb0MP5/bb\r\nt1uy5Pry24zXdhLu2gz53vxEZCwHH5wCBw8bBr1PTVKDrUUGpXzRAhmkkB5j\r\nTeaoZSstGemy7RCNKgqjQTRL3IbAEZvgWp27SPZpzITUtioluhhu8oucGmJY\r\nETABdFnoowz8cqttCHX/wJ7lRcipXV9U46qFkXK+FArZ735QjgXpMRDzDkHU\r\nCi3iITGzmDXWuoqjKJ4gY4ZWDZb+r54KGya9HAj5KN3/mkGhhzW+3EBHSjDY\r\nL0H6HOD7tpB8Q7aWMNdu8Cp3HypnYxoV9GI=\r\n=S4Oc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAr49Ip9f65RvuAhjH8zvtn7vJ3uwMrQ5dwTq8HTAJYMAiEAwUncz4TeREk1MZAjtQMuWcIIw2Cq+UIzxfBJwclpHLc="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.20_1646040627982_0.3783489165113163"},"_hasShrinkwrap":false},"1.1.0-alpha.21":{"name":"eth-testing","version":"1.1.0-alpha.21","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:example":"cd example && npm install","test:example":"cd example && npm run test","format":"prettier src example/src --write"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"dependencies":{"ethers":"^5.5.4"},"readme":"# Eth Testing\n\nA set of tools in order to generate a mocked Web3 Provider and simulate blockchain interactions in tests.\n\nBecause the mocking happens at the level of the JSON-RPC requests, the core functionnalities of this package do not make any assumptions on what other libraries or packages, such as [web3.js](https://web3js.readthedocs.io/en/v1.7.0/) or [ethers](https://docs.ethers.io/v5/), are used in order to interact with the blockchain.\n\nIn this spirit, this package tries at best to expose testing utilitaries that are not tied to an external library.\n\n**:warning: The package is quite recent, any contributions, issues or feedbacks are welcome :warning:**\n\n## Get started\n\nThe recommended way to use Eth-Testing with an application is to install it a development dependency:\n\nUsing `npm`\n```console\nnpm install eth-testing@alpha --save-dev\n```\nOr using `yarn`\n```console\nyarn add eth-testing@alpha --dev\n```\n\nAs a very simple example, let us consider a React app using [metamask-react](https://github.com/VGLoic/metamask-react) for handling MetaMask and tested using [React Testing Library](https://testing-library.com/docs/react-testing-library/intro).\n```ts\n// App.tsx\nfunction App() {\n    const { status, connect, account, chainId } = useMetaMask();\n\n    if (status !== \"connected\") return <button onClick={connect}>Connect</button>\n\n    return <div>Connected account {account} on chain ID {chainId}</div>\n}\n\n// app.test.tsx\nimport { setupEthTesting } from \"eth-testing\";\nimport { render, screen, waitForElementToBeRemoved } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport App from \"App\";\n...\ndescribe(\"app connection\", () => {\n    const testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n    beforeAll(() => {\n        // Manually inject the mocked provider in the window as MetaMask does\n        global.window.ethereum = testingUtils.getProvider();\n    })\n    afterEach(() => {\n        // Clear all mocks between tests\n        testingUtils.clearAllMocks();\n    })\n    test(\"a user should be able to connect using MetaMask\", async () => {\n        // Start with not connected wallet\n        testingUtils.mockNotConnectedWallet();\n        // Mock the connection request of MetaMask\n        testingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n        const connectButton = await screen.findByRole(\"button\", { name: /connect/i });\n        // Click on the button\n        userEvent.click(connectButton);\n\n        await waitForElementToBeRemoved(connectButton);\n\n        expect(screen.getByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/)).toBeInTheDocument();\n    });\n    test(\"a connected user should be able to see the wallet informations\", async () => {\n        // Start with a connected wallet\n        testingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n\n        await screen.findByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/);\n    });\n})\n```\n\n## Examples\n\nAs a next step, an example of a simple React application with contract interactions is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\nFor a more serious application with more complete features and tests, one can take a look at the [Rainbow Token](https://github.com/VGLoic/rainbow-token-frontend).\n\n\n## Usage and API description\n\nThe first step is to generate the utils\n```ts\nconst testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the three choices for now are `\"MetaMask\"`, `\"WalletConnect\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```ts\nbeforeAll(() => {\n    global.window.ethereum = testingUtils.getProvider();\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```ts\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe main functions are described below:\n- `mockConnectedWallet`: allows to mock the connected accounts, the chain ID / network and the block number\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"], options);\n```\n- `mockReadonlyProvider`: allows to mock the chain ID / network and the block number, the accounts are mocked to an empty array\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockReadonlyProvider(options);\n```\n- `mockNotConnectedWallet`: allows to mock the accounts as an empty array\n```ts\ntestingUtils.mockNotConnectedWallet(options);\n```\n- `mockBalance`: allows to mock the balance of an account\n```ts\n// Mock balance of 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf to 1 ether\ntestingUtils.mockBalance(\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\", \"0xde0b6b3a7640000\");\n```\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockBlockNumber`: allows to mock the block number\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockBlockNumber(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```ts\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```ts\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Testing contract interactions\n\nMost of the application interacts with deployed contracts, interactions are generally more complex with contracts, hence a dedicated object has been created for it.\n\nThe testing utils expose a `generateContractUtils` method, it allows to generate high level utils for contract interactions based on their ABI.\n```ts\nconst abi = [...];\n// An address may be optionally given as second argument, advised in case of multiple similar contracts\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    event ValueUpdated(uint value);\n\n    constructor() {\n        emit ValueUpdated(0);\n    }\n\n    function setValue(uint newValue) public {\n        value = newValue;\n        emit ValueUpdated(newValue);\n    }\n}\n```\n\nThese utils expose multiple functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```ts\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```ts\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n- `mockGetLogs`: allows to mock the next retrieval of the logs for a particular event type\n```ts\n// Two events will be retrieved with value \"0\" and \"12\"\ncontractTestingUtils.mockGetLogs(\"ValueUpdated\", [[\"0\"], [\"12\"]]);\n```\n- `mockEmitLog`: allows to mock the emission of a a log for a particular event type. :warning: there is a difference of usage between `web3.js` and `ethers`\n```ts\n// With ethers\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"]);\n// With web3.js\n// Needs to be done before the test or before the subcription happens\ntestingUtils.mockSubscribe(\"0x123\");\n...\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"], \"0x123\");\n```\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it if you are confident with JSON-RPC requests.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```ts\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Mock options\n\nSome methods allows to specify the mock options, or part of the mock options.\n\n```ts\ntype MockCondition = (params: unknown[]) => boolean;\n\ntype MockOptions = {\n  // If true, the mock will not be cleared after being used \n  persistent?: boolean;\n  // If true, the request will throw, the data field will be used as error\n  shouldThrow?: boolean;\n  // Timeout in milliseconds for the resolve or the reject\n  timeout?: number;\n  // Condition for the mock to be triggered\n  condition?: MockCondition;\n  // Callback that is triggered once the mock has been used, it is particularly useful when mocks needs to be triggered after certain user actions, like a transaction or a wallet connection\n  triggerCallback?: (data?: unknown, params?: unknown[]) => void\n};\n```\n\n### Verbose mode\n\nIt is sometimes handy to display which JSON-RPC requests are triggered and for each, show the associated mock if it exists. For that, the setup function allows to set the utils in *verbose* mode\n```ts\nconst testingUtils = setupEthTesting({ verbose: true });\n```\n\n## Contributing :rocket:\n\nContributions are welcome! Please follow the guidelines in the [contributing document](/CONTRIBUTING.md).","readmeFilename":"README.md","gitHead":"2a0cfa3198e8ecb6768f5fdcf0b9355928c1ec41","_id":"eth-testing@1.1.0-alpha.21","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-wCEoi87SdP8y90ivmkLhVpy5IFyqaNdY3OmKfysDmWPOye3fHWUpnZogiJPi3Q3gelPpfy73q+cqYsSbXjx0Ag==","shasum":"d888119cce7bcc90b27aec930c84dc6356effff9","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.21.tgz","fileCount":42,"unpackedSize":157131,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHKdeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoWpA/8DUKXl1FcZhC0FnGOchDfdbm6ZCbrfNNUmKwsdHwzROqDwIyC\r\nAa7CHsGWnlccvWRzMuupHyYoyQvhfS6qJigMN+YwPxqDvRBxd4Sa308xOyy7\r\nW+WCvZjP5dj/Qumd1HHIy1PZJN8/qke0c2rOUQTaWhaJr3LtuVJO3ZP3y6qc\r\nmHFeqtlPLxbmPsWr8JVJpvShvxDQb9o2oYf64mjTElzRu0fcMhuXs/mIsxjH\r\nkn1HccJQfYdOcivSbtgGRMDzymL3fmy8XMqy44/Xy26iXfvtksdOX95BqAfm\r\nY5lo0g5EAQSB/vq5zXROM433G5knlXS2ZRpJQes6nn+xMr+i/7NqrHUZTmPO\r\ndYfkhFH8n/sEp5Xe1OemQxIQfM7kpUIyuo+vD6FdLHpja5X1ZFBYSvum8qjL\r\nXtHDt4WteZuapBJEBfs9bo7Cyl2g+B/jtPMtwJUQ7tVokTr93aFT2CX1hu1C\r\nielG9LPz8cmh/kB3sHJRL2txk1Sh+1HdckNwvJw4Mksz9qjY1zPDWaKM+IMF\r\nymYesVnol1zomN+0v5STAH44DP2vVr1E7ZVuoNk8GVQwA2wvnvm4gVEPMk5e\r\nr2wNrO1Yqm2tnEHBuySNtYWtxavnVhVIek0GeJZNFU015/dwmctm5lX59dGX\r\nuOU8G2DYDlu0m6pbWBDuy9qDvis2rEiKDlU=\r\n=bpVW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCT9sT4OAH3KnC1+O5q20JxCiZSk9lciX34LVO0Z/jm6AIhAIzgbZcpcoLvThGR6/VCv0Ok3c+5MRWEGdznPW3fmUIg"}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.21_1646045022708_0.3677038953001004"},"_hasShrinkwrap":false},"1.1.0-alpha.22":{"name":"eth-testing","version":"1.1.0-alpha.22","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"readme":"# Eth Testing\n\nA set of tools in order to generate a mocked Web3 Provider and simulate blockchain interactions in tests.\n\nBecause the mocking happens at the level of the JSON-RPC requests, the core functionnalities of this package do not make any assumptions on what other libraries or packages, such as [web3.js](https://web3js.readthedocs.io/en/v1.7.0/) or [ethers](https://docs.ethers.io/v5/), are used in order to interact with the blockchain.\n\nIn this spirit, this package tries at best to expose testing utilitaries that are not tied to an external library.\n\n**:warning: The package is quite recent, any contributions, issues or feedbacks are welcome :warning:**\n\n## Get started\n\nThe recommended way to use Eth-Testing with an application is to install it a development dependency:\n\nUsing `npm`\n```console\nnpm install eth-testing@alpha --save-dev\n```\nOr using `yarn`\n```console\nyarn add eth-testing@alpha --dev\n```\n\nAs a very simple example, let us consider a React app using [metamask-react](https://github.com/VGLoic/metamask-react) for handling MetaMask and tested using [React Testing Library](https://testing-library.com/docs/react-testing-library/intro).\n```ts\n// App.tsx\nfunction App() {\n    const { status, connect, account, chainId } = useMetaMask();\n\n    if (status !== \"connected\") return <button onClick={connect}>Connect</button>\n\n    return <div>Connected account {account} on chain ID {chainId}</div>\n}\n\n// app.test.tsx\nimport { setupEthTesting } from \"eth-testing\";\nimport { render, screen, waitForElementToBeRemoved } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport App from \"App\";\n...\ndescribe(\"app connection\", () => {\n    const testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n    beforeAll(() => {\n        // Manually inject the mocked provider in the window as MetaMask does\n        global.window.ethereum = testingUtils.getProvider();\n    })\n    afterEach(() => {\n        // Clear all mocks between tests\n        testingUtils.clearAllMocks();\n    })\n    test(\"a user should be able to connect using MetaMask\", async () => {\n        // Start with not connected wallet\n        testingUtils.mockNotConnectedWallet();\n        // Mock the connection request of MetaMask\n        testingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n        const connectButton = await screen.findByRole(\"button\", { name: /connect/i });\n        // Click on the button\n        userEvent.click(connectButton);\n\n        await waitForElementToBeRemoved(connectButton);\n\n        expect(screen.getByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/)).toBeInTheDocument();\n    });\n    test(\"a connected user should be able to see the wallet informations\", async () => {\n        // Start with a connected wallet\n        testingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n\n        await screen.findByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/);\n    });\n})\n```\n\n## Examples\n\nAs a next step, an example of a simple React application with contract interactions is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Real World Application\n\nFor a more serious application with more complete features and tests, one can take a look at the [Rainbow Token application](https://github.com/VGLoic/rainbow-token-frontend).\n\n## Usage and API description\n\nThe first step is to generate the utils\n```ts\nconst testingUtils = setupEthTesting({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the three choices for now are `\"MetaMask\"`, `\"WalletConnect\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```ts\nbeforeAll(() => {\n    global.window.ethereum = testingUtils.getProvider();\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```ts\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe main functions are described below:\n- `mockConnectedWallet`: allows to mock the connected accounts, the chain ID / network and the block number\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"], options);\n```\n- `mockReadonlyProvider`: allows to mock the chain ID / network and the block number, the accounts are mocked to an empty array\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockReadonlyProvider(options);\n```\n- `mockNotConnectedWallet`: allows to mock the accounts as an empty array\n```ts\ntestingUtils.mockNotConnectedWallet(options);\n```\n- `mockBalance`: allows to mock the balance of an account\n```ts\n// Mock balance of 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf to 1 ether\ntestingUtils.mockBalance(\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\", \"0xde0b6b3a7640000\");\n```\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockBlockNumber`: allows to mock the block number\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockBlockNumber(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```ts\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```ts\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Testing contract interactions\n\nMost of the application interacts with deployed contracts, interactions are generally more complex with contracts, hence a dedicated object has been created for it.\n\nThe testing utils expose a `generateContractUtils` method, it allows to generate high level utils for contract interactions based on their ABI.\n```ts\nconst abi = [...];\n// An address may be optionally given as second argument, advised in case of multiple similar contracts\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    event ValueUpdated(uint value);\n\n    constructor() {\n        emit ValueUpdated(0);\n    }\n\n    function setValue(uint newValue) public {\n        value = newValue;\n        emit ValueUpdated(newValue);\n    }\n}\n```\n\nThese utils expose multiple functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```ts\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```ts\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n- `mockGetLogs`: allows to mock the next retrieval of the logs for a particular event type\n```ts\n// Two events will be retrieved with value \"0\" and \"12\"\ncontractTestingUtils.mockGetLogs(\"ValueUpdated\", [[\"0\"], [\"12\"]]);\n```\n- `mockEmitLog`: allows to mock the emission of a a log for a particular event type. :warning: there is a difference of usage between `web3.js` and `ethers`\n```ts\n// With ethers\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"]);\n// With web3.js\n// Needs to be done before the test or before the subcription happens\ntestingUtils.mockSubscribe(\"0x123\");\n...\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"], \"0x123\");\n```\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it if you are confident with JSON-RPC requests.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```ts\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Mock options\n\nSome methods allows to specify the mock options, or part of the mock options.\n\n```ts\ntype MockCondition = (params: unknown[]) => boolean;\n\ntype MockOptions = {\n  // If true, the mock will not be cleared after being used \n  persistent?: boolean;\n  // If true, the request will throw, the data field will be used as error\n  shouldThrow?: boolean;\n  // Timeout in milliseconds for the resolve or the reject\n  timeout?: number;\n  // Condition for the mock to be triggered\n  condition?: MockCondition;\n  // Callback that is triggered once the mock has been used, it is particularly useful when mocks needs to be triggered after certain user actions, like a transaction or a wallet connection\n  triggerCallback?: (data?: unknown, params?: unknown[]) => void\n};\n```\n\n### Verbose mode\n\nIt is sometimes handy to display which JSON-RPC requests are triggered and for each, show the associated mock if it exists. For that, the setup function allows to set the utils in *verbose* mode\n```ts\nconst testingUtils = setupEthTesting({ verbose: true });\n```\n\n## Contributing :rocket:\n\nContributions are welcome! Please follow the guidelines in the [contributing document](/CONTRIBUTING.md).","readmeFilename":"README.md","gitHead":"42fe8322c0d9dfcaf3b52aa6c9517dab0478a858","_id":"eth-testing@1.1.0-alpha.22","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-2yIkl1HrWQAkxtBk9BLaxKjhwU/I1FilYg126KBBoh4+4Q2zGJu6PX9wOdhguEVzx0HiK1wLG2CA3o6G7bARdg==","shasum":"7445efc55dcb739e57c514263171ae00f3a8776d","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.22.tgz","fileCount":43,"unpackedSize":167508,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIOBEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqkaw//R0QlC67T05UjHy02aiBjJ74PEKZf+6JmlsyHBRit4e5sWc5x\r\nHgsTBpCFXwRC1XikdMfBTO1bS6DNmj4+B67xgf5mNxlITpmNTmBnqxqPPMvI\r\nvDT+hsfoyh1esWHuTi+OgGqqVwfxYX8o1M3RMNCe6rUxzP6OCDytu35M/rUG\r\n8knCXw8c9rYdcfiUyp8MX3dav/i9tiu24B1m++NgdqK0pNzUpqY7DDnTEnNw\r\nghU7pEQm0UUgYlWtt7KoCcSxCeJmVy5yzfstCt/EPfmuH1/1dxglHsKtG5n6\r\n7x1fYhGogRXp41nhiNfgKGANFeAwx+SyyGWmBxSj86YGnuF8dpYqPWqsc+I6\r\n4QOQuA0KKoZ1sveQatXyHWKkT3KMqBCuyMS+DGubv0EVqqazY76Ga16pFCV8\r\nYj9XWG34YuXRonO8DS/MznjPovlsbZG+C7Eg8mkCRBMNX/iDAqR0ho9UbhnA\r\nTDIn1AFefkTni3DQLgELPypxT8QGmCET+NkTvqS+LGyBVV5sDqft3TYZtpLI\r\nveko5bk3NqvXnxMRlVJAhGHxqwshDP2s3GQvIlh3I9yBuIZ4w3INT7/ovgwi\r\nBW20DIZJBzlBQHVC8OEBl2A+9Bv9Y2/5fG/9szMOdmM1eC8rj5graiVHmdAS\r\njwRjqntJe0O1JbcF3NdnFq3DenIeZrwUpj4=\r\n=5f+v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbvgHLKq0gx8hmInomeIWXm9WiBMgGsJzQg5aOZRdYvwIgCVEg4idMgr/cuZnbwUzTh50obXiFIw7ECdDQyiYIBY4="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.22_1646321731969_0.4165428875005468"},"_hasShrinkwrap":false},"1.1.0-alpha.23":{"name":"eth-testing","version":"1.1.0-alpha.23","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"readme":"# Eth Testing\n\nA set of tools in order to generate a mocked Web3 Provider and simulate blockchain interactions in tests.\n\nBecause the mocking happens at the level of the JSON-RPC requests, the core functionnalities of this package do not make any assumptions on what other libraries or packages, such as [web3.js](https://web3js.readthedocs.io/en/v1.7.0/) or [ethers](https://docs.ethers.io/v5/), are used in order to interact with the blockchain.\n\nIn this spirit, this package tries at best to expose testing utilitaries that are not tied to an external library.\n\n**:warning: The package is quite recent, any contributions, issues or feedbacks are welcome :warning:**\n\n## Get started\n\nThe recommended way to use Eth-Testing with an application is to install it a development dependency:\n\nUsing `npm`\n```console\nnpm install eth-testing --save-dev\n```\nOr using `yarn`\n```console\nyarn add eth-testing --dev\n```\n\nAs a very simple example, let us consider a React app using [metamask-react](https://github.com/VGLoic/metamask-react) for handling MetaMask and tested using [React Testing Library](https://testing-library.com/docs/react-testing-library/intro).\n```ts\n// App.tsx\nfunction App() {\n    const { status, connect, account, chainId } = useMetaMask();\n\n    if (status !== \"connected\") return <button onClick={connect}>Connect</button>\n\n    return <div>Connected account {account} on chain ID {chainId}</div>\n}\n\n// app.test.tsx\nimport { generateTestingUtils } from \"eth-testing\";\nimport { render, screen, waitForElementToBeRemoved } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport App from \"App\";\n...\ndescribe(\"app connection\", () => {\n    const testingUtils = generateTestingUtils({ providerType: \"MetaMask\" });\n    beforeAll(() => {\n        // Manually inject the mocked provider in the window as MetaMask does\n        global.window.ethereum = testingUtils.getProvider();\n    })\n    afterEach(() => {\n        // Clear all mocks between tests\n        testingUtils.clearAllMocks();\n    })\n    test(\"a user should be able to connect using MetaMask\", async () => {\n        // Start with not connected wallet\n        testingUtils.mockNotConnectedWallet();\n        // Mock the connection request of MetaMask\n        testingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n        const connectButton = await screen.findByRole(\"button\", { name: /connect/i });\n        // Click on the button\n        userEvent.click(connectButton);\n\n        await waitForElementToBeRemoved(connectButton);\n\n        expect(screen.getByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/)).toBeInTheDocument();\n    });\n    test(\"a connected user should be able to see the wallet informations\", async () => {\n        // Start with a connected wallet\n        testingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n\n        render(<App />);\n\n        await screen.findByText(/connected account 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf on chain id 0x1/);\n    });\n})\n```\n\n## Examples\n\nAs a next step, an example of a simple React application with contract interactions is available in the `example/` folder. It uses `jest` and `@testing-library` for the tests. \n\n## Real World Application\n\nFor a more serious application with more complete features and tests, one can take a look at the [Rainbow Token application](https://github.com/VGLoic/rainbow-token-frontend).\n\n## Usage and API description\n\nThe first step is to generate the utils\n```ts\nconst testingUtils = generateTestingUtils({ providerType: \"MetaMask\" });\n```\nThe argument is only the provider type, the three choices for now are `\"MetaMask\"`, `\"WalletConnect\"` or `\"default\"`.\n\nThe provider will then need to be injected in the application, this mechanism depends on the implementation details of the application. As an example for MetaMask, provider is injected in the `window` object so as an example, using `jest` hooks one may inject the mock provider as\n```ts\nbeforeAll(() => {\n    global.window.ethereum = testingUtils.getProvider();\n});\n```\n\nIt is strongly advised to clean the mocks between each tests, this may be done using the `clearAllMocks` function exposed through the `testingUtils` object. Again, using `jest` hooks, this can be done as\n```ts\nafterEach(() => {\n    testingUtils.clearAllMocks();\n});\n```\n\n### High levels mocks\n\nHigh level mocking functions allows anyone, even without a knowledge of the underlying mechanics to properly mock the interactions with the provider/blockchain. This is the advised way to perform mocking.\n\nThe main functions are described below:\n- `mockConnectedWallet`: allows to mock the connected accounts, the chain ID / network and the block number\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockConnectedWallet([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"], options);\n```\n- `mockReadonlyProvider`: allows to mock the chain ID / network and the block number, the accounts are mocked to an empty array\n```ts\n// The chain ID and block number can be set in the options\n// They default to \"0x1\" (Ethereum main net) and the block number to \"0x1\"\ntestingUtils.mockReadonlyProvider(options);\n```\n- `mockNotConnectedWallet`: allows to mock the accounts as an empty array\n```ts\ntestingUtils.mockNotConnectedWallet(options);\n```\n- `mockBalance`: allows to mock the balance of an account\n```ts\n// Mock balance of 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf to 1 ether\ntestingUtils.mockBalance(\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\", \"0xde0b6b3a7640000\");\n```\n- `mockChainId`: allows to mock the chain ID / network to which the provider is connected\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockChainId(\"0x1\");\n```\n- `mockBlockNumber`: allows to mock the block number\n```ts\n// Mock the network to Ethereum main net\ntestingUtils.mockBlockNumber(\"0x1\");\n```\n- `mockAccounts`: allows to mock the accounts with which the provider is connected\n```ts\n// Mock the connected account as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockAccounts([\"0x138071e4e810f34265bd833be9c5dd96f01bd8a5\"]);\n```\n- `mockChainChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change to the Ropsten network\ntestingUtils.mockChainChanged(\"0x3\");\n```\n- `mockAccountsChanged`: allows to simulate a change in the chain ID / network\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.mockAccountsChanged([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequestAccounts`: this is a special utils created in the case of MetaMask, it allows to mock the connection request. The accounts will automatically be mocked to the input value once the connection has been simulated.\n```ts\n// Mock the next request to eth_requestAccounts as 0x138071e4e810f34265bd833be9c5dd96f01bd8a5\ntestingUtils.mockRequestAccounts([\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Testing contract interactions\n\nMost of the application interacts with deployed contracts, interactions are generally more complex with contracts, hence a dedicated object has been created for it.\n\nThe testing utils expose a `generateContractUtils` method, it allows to generate high level utils for contract interactions based on their ABI.\n```ts\nconst abi = [...];\n// An address may be optionally given as second argument, advised in case of multiple similar contracts\nconst contractTestingUtils = testingUtils.generateContractUtils(abi);\n```\n\nLet us consider a very simple contract\n```Solidity\ncontract Storage {\n    uint public value;\n\n    event ValueUpdated(uint value);\n\n    constructor() {\n        emit ValueUpdated(0);\n    }\n\n    function setValue(uint newValue) public {\n        value = newValue;\n        emit ValueUpdated(newValue);\n    }\n}\n```\n\nThese utils expose multiple functions\n- `mockCall`: allows to mock the result of a call to a contract using the name of the function to be called and the orderered list of values to be returned\n```ts\n// Mock a call to the \"value\" function of the contract and returning the uint 100\ncontractTestingUtils.mockCall(\"value\", [\"100\"]);\n```\n- `mockTransaction`: allows to mock the result of a transaction from a contract method using the name of the function to be called\n```ts\n// Mock a transaction based from the `setValue` function of the contract\ncontractTestingUtils.mockTransaction(\"setValue\");\n```\n- `mockGetLogs`: allows to mock the next retrieval of the logs for a particular event type\n```ts\n// Two events will be retrieved with value \"0\" and \"12\"\ncontractTestingUtils.mockGetLogs(\"ValueUpdated\", [[\"0\"], [\"12\"]]);\n```\n- `mockEmitLog`: allows to mock the emission of a a log for a particular event type. :warning: there is a difference of usage between `web3.js` and `ethers`\n```ts\n// With ethers\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"]);\n// With web3.js\n// Needs to be done before the test or before the subcription happens\ntestingUtils.mockSubscribe(\"0x123\");\n...\ncontractTestingUtils.mockEmitLog(\"ValueUpdated\", [\"13\"], \"0x123\");\n```\n### Low levels mocks\n\nThese functions handles mock at a lower level, use it if you are confident with JSON-RPC requests.\n- `emit`: emits a notification for the provider, associated subscribers will be triggered\n```ts\n// Simulate a change of account to 0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\ntestingUtils.lowLevel.emit(\"accountsChanged\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n- `mockRequest`: registers a mock for a JSON-RPC request\n```ts\n// Simulate 0x138071e4e810f34265bd833be9c5dd96f01bd8a5 as connected account\ntestingUtils.lowLevel.mockRequest(\"eth_accounts\", [\"0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf\"]);\n```\n\n### Mock options\n\nSome methods allows to specify the mock options, or part of the mock options.\n\n```ts\ntype MockCondition = (params: unknown[]) => boolean;\n\ntype MockOptions = {\n  // If true, the mock will not be cleared after being used \n  persistent?: boolean;\n  // If true, the request will throw, the data field will be used as error\n  shouldThrow?: boolean;\n  // Timeout in milliseconds for the resolve or the reject\n  timeout?: number;\n  // Condition for the mock to be triggered\n  condition?: MockCondition;\n  // Callback that is triggered once the mock has been used, it is particularly useful when mocks needs to be triggered after certain user actions, like a transaction or a wallet connection\n  triggerCallback?: (data?: unknown, params?: unknown[]) => void\n};\n```\n\n### Verbose mode\n\nIt is sometimes handy to display which JSON-RPC requests are triggered and for each, show the associated mock if it exists. For that, the setup function allows to set the utils in *verbose* mode\n```ts\nconst testingUtils = generateTestingUtils({ verbose: true });\n```\n\n## Contributing :rocket:\n\nContributions are welcome! Please follow the guidelines in the [contributing document](/CONTRIBUTING.md).","readmeFilename":"README.md","gitHead":"0826cfd83a5a6ea193896bcc15ad88aa501466bc","_id":"eth-testing@1.1.0-alpha.23","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-KSXE6NeTcNz5xMlGqsxFPXXGPfuShrN55pA1cwBFNetslmCrrAVIY40XjYR5kVCZ6s4Gix3OSGFFaMhONjZBzA==","shasum":"a819fd719133a26310fa6e10d6477ef08bf93c87","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0-alpha.23.tgz","fileCount":43,"unpackedSize":167597,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIO5PACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBww//VoJq6wll+7HW+437zNhwUu95VUW85SqxGPVd5YHPpRckI8yL\r\n2CdRmmqGviyX9xKDyehUliU/vk9THS5H9AGOuGrIhZnZFaasJcXJcKqbNxEF\r\ncAvQsV8YZiqw3QCFd9L+X+PxMZ1PHnPCgwo1B8gxfgbuC/D+3sjGYViqFtKu\r\njYCE3XhruExNTVUwyGnOdwLtA6GA382lQWuY8pk7y+rnSS24To/UFSOjo+Ns\r\nc2+h2R5hiOPDE1P22sWUzSq/cxbUlqiEV9cf27e44Q4ZCWiKBd6+k6S/wyZl\r\n7HI9379bBXKlYgp8klhAnJO93j382AIyhFKiM9VFq1wMjBbNNv9ywGfbfUQ9\r\nfpmpzxvsoTolP362SMBypiHrjJ0qBrMp0tuYFZcyU7s8O9c8q6xbydNRVna7\r\nnc8+PnSCvp2rCnD4QMsLVHpWkSCNHm83UAEk0gO9p6pROdiViSXKNk+adwzg\r\nl5jtwri8wydbwc2HieDR7MBl8u2mcdb6F2j7GM08RIjoER76f/M9Zx3Rwg26\r\nhV26OV6DPwM+540ZG6Iq52QjxPEJTyFY5NV0YVztlXHzJxEt7Eua0UX0FNTL\r\n706AdSQkWmqidUO3Lr9aQLKWLtBIdETuf1ZealgMgjUgjmRRJPVNtq9Ms+qP\r\n7uQz/302TmkI+FmlzmreZDwV34PgkE4Z9eM=\r\n=aNXV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA6QgxG4p+B9tqB231wobahIkse6GJ9s14AUJCSJlDy0AiBOSKyO1vZRTwM12sxLUKiNEjN8PVNWMhRYp4aAV21r3w=="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0-alpha.23_1646325327795_0.19857135852401875"},"_hasShrinkwrap":false},"1.0.0":{"name":"eth-testing","version":"1.0.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^26.0.20","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","jest":"26.6.0","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^26.4.4","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"60dffa09ed6c7d04333e88d20647e585da9274ad","_id":"eth-testing@1.0.0","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-HaMC1EukC1e47cqV3apZhkeO7N0qQLHGKsyCG1x1yw36w5Tud+yCSgyft5+8eEZ5oytAZV8aVTuw0LR93/ks1w==","shasum":"7020da1e4c873fec84cd2c437f8cd277b6b2d6e1","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.0.0.tgz","fileCount":43,"unpackedSize":167588,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIPLpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrC1Q/8CnL++hRzQ0UIBuycz4KWaNU4CbYCGbS34nJwT/do9CeCQ4WU\r\nD67/CCk9SeTN0kk5NAjT3x61NesXsBsOKor1uhxS42+i2doxlWFJ9pzqW/1W\r\noGIcvvHW1MSu5aMJGM8Jw9G4a9p4oYQPXKRxZIdFyas9zj8r+GqI0iX1pZ3h\r\n0iqM9/SLmjFNBG2J64NpNjlhBAbHl8n62dCH0DI99ZjvEec6BMtdjG6aESIw\r\nI8jIU9oHz2kSTdKZn8YzULMtmoUZ6cq1zbyiBmMtTgGh6kvqfpeauX/PMVDm\r\nIogqlk/XZ6xTsio5Gd7hQ1esFJKStpoe5lbWvI3cQBsayIzkDc0w7/inlKVv\r\nTsy96zrEO8QnbssT6CERuglYL79bOTaYNfG9fCvuYdMVR3Lo7N11r2MYc0dw\r\n6P9FeuJgxiDXPBNyWHFaVDwUI4qbcrauGNCIq7iqmf/PW4U1FUQUsesQhES2\r\n+ArOewZThAtWe7FxnYyT7pnVSL1EOUG2Nbf7k30C/kgNF6f6ElOjhOxLtx19\r\nrM5RSTvR7kg6KmtCZ/2fYnkrAVAOj/KUQHXK3Z91B5X7g4RmXVEBrqjKiIFG\r\nYmtG7jTd9IKnm5QschyQk3uqnF8mvs1o2JQwQZePk1bCBjKOV/7ahsGohOzr\r\nU3i41o7Kxjyvoy/ZLWy5sqoEJQFXkGQmYQM=\r\n=kcW3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGzwLQDFOUrEAhOglaOyL/dCw11Mj3FCVJxIqFxs1gyQAiEAkmSiX+sa4Qj15xYhDG54glrSjPFOJ0O0Z1mOBywWWw4="}]},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.0.0_1646326504716_0.8237569171197683"},"_hasShrinkwrap":false},"1.1.0":{"name":"eth-testing","version":"1.1.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^4.12.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"c87dde0e57665e71c40a0e9b665fd73b76f4d92a","_id":"eth-testing@1.1.0","_nodeVersion":"16.15.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-t0WHfdWVDBwWtqcNs3GG1/qguH48H19TWt2/KRBEfrb1I4XAbI2K4gD//f9z6IgzzfidC+BY+Rej9KNjv7MvEA==","shasum":"4f798af26402cee8f2acbe583af0dec03f2b3dae","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.0.tgz","fileCount":43,"unpackedSize":166479,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCbKgFoRZuzHJB5mW/3jZc9yCST9ZyRhUQn4tV28EMIbAIhANuuZY5gQxPSOIPakTcCJiMab0E4NdBhdascgZbx2pHw"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJigRmnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqX9Q/+KfHb7ckLGfvRIPUQSxqBTKX6/wrnBfCePxmtGij5K/vtoQ+O\r\nEgdiJF01PDz+aLLaoctjoddYg5ZdST4yWen83+hl9m+f7ZVjsGy0T7NKf4bh\r\nqb2I4ZRRpe+EX+b4O4fUR6LQ/UxjK9t5DgVOVeEjz91z8jhfF21C770GHXAB\r\n8akhZWJh/DGNgfsOho3Bjlj/o7voptqS7+2p94QUkEtPddj6W1zr4+Ja969G\r\nI1aI5eBHrWtLVz1CrldM3ckSgfV/y+9yQb7+Cv90hhARz5mMxQAsYpb20u5p\r\naeDSvDEGa+raGZP/VrxMdC2+uyUPBrE9RXLb3I7qD7UuoZpgZaN+ItE3L+FM\r\nmOWo0zSM+PZlM1EwcpjQd7rS45AVo/hx8QgsU8LV2r44vwnH/lh+rubsWnWQ\r\nl1BrczF1F6C4BS3FrbLOTJc13oTqYPdBfwax0Q8hvcmp1QwGl1ndN3/ISXQa\r\nOW+Z5uwisL9vcnUWpxEvUkcROKQtwf7pUKlHAzvCQFVvYxOzDmbv2/dXzkH6\r\n9Nqrcf7mXjaC49DoK2MuG0ilB3OqYvoJLKna3J+RH5tyOY3X5ZzEEi0CmBZY\r\nKf/sBHbPQ0GNN5exenDai6RMiXzXcVXZq4+GYMnGi+wv96xCcHEcrhqLbxQo\r\n+4M1X6avgFkeCN7CMROlI0kKb3wwiKgNRaw=\r\n=PmKg\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.0_1652627879713_0.49315566430671764"},"_hasShrinkwrap":false},"1.1.1":{"name":"eth-testing","version":"1.1.1","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"3773041c49cf11665cab08ae26de88498905cc70","_id":"eth-testing@1.1.1","_nodeVersion":"16.15.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-MUmtWw6BRqkB3hO8q9LBwEkL/yucAQpSh+vICTXwIkcKeITmlPy+zf1mMsbeJclr1IqVVD9shXXr5mqQVvZ1DA==","shasum":"dc068510554d9665bc8857d61786c1274db35ad0","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.1.1.tgz","fileCount":43,"unpackedSize":166478,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC6+wcW99FdccrOrFwJRyVQ2Jl4IhiHaQy1pUm0ezR5nAiBgpiejtUgfxKQJI6weNUCal+Vdj/AVeoScn2Eexhif7A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiw+QXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpSShAAijjWz7vfpOVRXvMRkyQYFlpyR0u+X/fVoV7c0L7wLsektRDJ\r\nf35JSc+cXCeM9mcTvSFzCBcHdtW5Bjf3uze6kuIoSbI89Jceakdla05TBZMu\r\nWpFMBrtO5uJxqjCGi/BNcV5BXqTxTjO/e+jK7SdBypNEMjCCn98eKWrPy9kC\r\nbEifMHKw2hVFFuFcnaENoseUGZ7wO61M3KPSgJAtGcP0975xCJdfpkdX//h+\r\nVPuMODwFN/Ayt71KtN+srsvngTBqWEORQx1WVUK4jUJBaBbwHaA8geMoaBWu\r\nCAqL/a70ad4PhEhHm5Pg7XtPBZHXiSLzlX1Q78EKMcO9atRVXkU9UMvH7mAV\r\nkIw1hESQeGNeUmhjMcXnZQbNFWKi54ogldGC+7ds6BUfL2OZ/kf9SV3Qxuek\r\nfBn6dSPICAjbzJAV+1D9x0y7maYsELBXm1TF9sI/Ex8CGOKqyddVhofqR67p\r\n6tLGEbKcl3xplz596/uB5O/RNXDnK46MsdL0oSXzlJSFndZkEHQ+qE/891PE\r\nzZcVeV8giwodI7ua4JXGHYm2ptTnR0Bs3UfQrVD6tKHAA6YsRq70ZOs38hQu\r\nIlj5FUPpmZgedrjTQBPOYVoUsSyoXS6AxWErq8m1z6pK0HCzVKZ7aPPwX/pu\r\ni1VDK5+K+sz06n8AYy4X7tuLlVI+TeooBrc=\r\n=oKwx\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.1.1_1657005079237_0.12347647175713528"},"_hasShrinkwrap":false},"1.2.0":{"name":"eth-testing","version":"1.2.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"613ac0ef9204a77ee22003fd23ff054d2960f2e4","_id":"eth-testing@1.2.0","_nodeVersion":"16.15.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-BmA8EEKxA2Tbt8vd2x2B4tJlFW9mtZIsq09s805Wm2hI4+N1eCVbrQebsJnNOIGyroUS7h8CTJXb97brSChuCw==","shasum":"b3f1faab72b7600369588d25e78ca2b3a732f472","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.2.0.tgz","fileCount":43,"unpackedSize":168290,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcdmUzSA+tgqzbjkKs21khdpzsNkxH408VhJ1f7lgAeQIgFM9nPD13wl8BHvXK2c+i3O9oQwo9xYUztElE9mka7iM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJixoqTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr8QQ//WY5M3YW2fQBxHoNzGHKORPNnC9PptlfYOCnHy9ttScS23Fan\r\n/lLk1O40KanDzmZ2upXBwG4WMa2bAd+o28YC+3z16Yle59QO5PDqPbSWnLjD\r\nv7AxxxVBf6ybSXSYIgoYz2XsJd81St27uZusiHRGyycdm7tzomXdk1N/+e0G\r\ne4tHgXF26rQ84lGKoAtIBNnM01daAi6+tNX9NkUhPzxeImbJrEKlUVaIx734\r\nLwX4rPJkka0eczI6Xnyxae4j4BFJmUTw4+RoY0pGIlob/tXc6TkSAmR9qazu\r\naaF3mVv4ZnyeOsytPm8AX2NxAJadegofK5cfzrb9VKf6IkSfkvla7ot5n/Np\r\nDIj7a6J95HNgUCclvS0HtTMYEKTznTVh6i+U6P4MwYR8ixZdIPNZO4ulasM1\r\nip39Ef9Xyh8IBAxNYHXkXE8d0dbibkdXaCaNwEGO+QhruJnsnayYfMVUTEvV\r\n1+BiZoYBoG/GXZuVu84l2vUDBMGNIi5d6f1wOhJrlR8mJf2kYEjadX98WjU2\r\nXmL4/YOlPbNySH7UoektAhsXTb5nUB2McR8PHK2vMba0z4e4aikxNJNsd4hi\r\nMvLjoHmB3fNuoRFBlEBbpyJePcCh3Z10ge3/jHsmKfmOFwkmQNHmkbDvUbi3\r\nG+0WYUuQz8CpA8Yw4xMApjAwYHWheg1mtSc=\r\n=yAsr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.2.0_1657178771262_0.912488999631589"},"_hasShrinkwrap":false},"1.3.0":{"name":"eth-testing","version":"1.3.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"4bf9a680c38a0ca186c7a31039cc908b8a383c5a","_id":"eth-testing@1.3.0","_nodeVersion":"16.16.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-2Jxo/u7IKr1/rZPXdDFNNiyBcrtQkk69lDLKd93RX5brocRRFpH3P2cvm1HpND5H/0iZHkO0OK6fJbkKs+Gvzg==","shasum":"03fef3d65b3cdb86c53fbdf5e74b3b1fa5828ccc","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.3.0.tgz","fileCount":43,"unpackedSize":169182,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBrj1r3GTxLUaWf+bCxk4JktroEiDBmAuDnwYIb/VIE5AiEAjtZlfyQrCyJIDlszO/1SlJNddo7J6/QTn1iTuWgpTwU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2UcTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoeBxAAlkSoeWdcTczjbiuw5WjB1u46c6L8/5dO6o3m4arpT1xVBa24\r\nZ1JYyguHx45NVpdgvj/BYs0Ffw78htHbPmXcFEnxntFmEO4h5MUKpajnB1RR\r\nlp65kznDLQU0jbQ0+tUzzr4ikh+fgNpqUrFno+3SM24zfZ2BD4XRP04L6Glx\r\n8YpNvsOLvlYaDcyfsQvn1ehMD86sNNaAV5NIIuwihVr9Ls1O66a145lr5v1t\r\n+psee0bnEp9LxN9qoc6MeNeWzThT2bULdBMNa6kj/+yExDd4YKgLP0/XVoNB\r\nITM0Ut+AlvHCCNahpLb42a0usg+msbKupiby6XzULiLZCOPmwmjyqNyp0wv+\r\nO7sRoeOBUZN4960ke2OY7di7hChbtw4XGPCKGACMpBNACCdRra5mC7B1F2w1\r\nrfEZvjkEO72OQXzGAa0E5TDfkPsnt9hxDJFyKIkXUJHl0WEE4EjeXHr8bG3y\r\nZ91+uF0K88z82L/VNtYwTjEsO6UQ4VL7ozwDkvzbHjPvbdwgyHiixM2pkC39\r\nmkpD3gM4FxPbEpv7ma+6V697RS1AUwkw/RnuavwwkLBdvflPDOwjDb9v6TKy\r\n/X8WvV+6yVC+iVeAbkuopM4ePTD50bS/KS4fYcWXoWu1QqXd23ZuUGv/8DzH\r\nYmL1DbtzNFYvTToXAzjKsly/siGgGDEJwwE=\r\n=XkWG\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.3.0_1658406674911_0.9507058675865097"},"_hasShrinkwrap":false},"1.4.0":{"name":"eth-testing","version":"1.4.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"77f23539ec1c774777a5ab79bfe5ed5946bccef8","_id":"eth-testing@1.4.0","_nodeVersion":"16.16.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-vmqxtIAbsPyIXPqlMK+S+/pgEnqNrQ1N+sUpvyFxoSrmE8043ZzrBPNTlLlmjGVSDlZZmAIsRSjEi4HVXB/raQ==","shasum":"4041a9a6409f358b83755aeef9e0da09a101e0fb","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.4.0.tgz","fileCount":43,"unpackedSize":169181,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBDAwlrwyFjfMyCoNQUgJsBCNDLdArYUQMv9eaJ/uZIAAiAGRonFWonccz8rSiourX1eLG3SiGvsILCYF86Io44XpA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi46LrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp8MQ//Zg1MRx8v7N9xkkZJQpg/+0yvUJuKBbQ/rJeEx3CMnkUaFarl\r\nHxUfjfW9OOnUMCUdJwd2PRH2xG+xd5UxZcqxLpBTexZIs2F/MOWbhT6zNb/V\r\n6Jk151iht2LsmwK8ZmZSBVtWbPjL5orDWZD1k7JGNmWfO3+sZ2cvpApZIJ+z\r\nHFkCebecwoVulZHQ2Xx2aZOKnOLHyyLySPlnz4v9YC/9DDloRashcAbi0SVR\r\ndHi3BZLV4UANrtLqd3dEN09RdVR0gfu5iBRhASgJyW1PIua5sBVkCr90EcB5\r\nZ4XIB4rU7YnB+1Bc+ko+mBu01EQuARiNpCnBwdKW4JQ8DdTriJPajdf2ShIh\r\nL83TBT+z8V2eoOb2h+Aj5G3daht6T5bu+KduVXHk3Eo5wj0UmkCXgp2nK9GK\r\nO0eFgb93/O9AhfUnOm3ckPxPQCKM10G7RHkd687MCLTOj6D0T4aP/DlHPMvq\r\npv5A9rml3p57BuNxk8px3EMFdf2p96wsEM8GifbZh7PKYJiZpbulU/uF0fl/\r\nEpY47633Hi4ArOeWjtiHvREjWk6Scg1cIImULSDlq6QWdtzEs613Mk0xxQ/U\r\nun4rDrsjgud20KCvTFQTntzvebMclUr0O1P31p5F2Z3YWqvHS/YNfuraGBR9\r\nyMd7rlB0qwFXPFardJX0X17CcrOX2mzqwQA=\r\n=fJT6\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.4.0_1659085546868_0.25419714318685216"},"_hasShrinkwrap":false},"1.5.0":{"name":"eth-testing","version":"1.5.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"974850480b0a6a8e27415fd23d28cb847159ab9f","_id":"eth-testing@1.5.0","_nodeVersion":"16.16.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-q9SpEloxSxeBfmjJqEpU0MQudyPJWkOZmcPjKOZJ3p8QQYYj1NjnK+C37twLwqc4pOci0kn4YY4M5QHD6fTEZw==","shasum":"59a3fa7801de7b19704343dafe07bc0b73657206","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.5.0.tgz","fileCount":43,"unpackedSize":171153,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDzRwJcZgMjY8GIlLsSk/IRqADJD1eg7xlHVIN8en706AIhAIp4wa+o8IkzTEuviZH8UP05g2iXaZ33XOpPCFsk7RtJ"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi5WdAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkuQ//euKllbhtsVFeOtP8b5n1Pju2RWzabjZ9P4TaDBtWYkKhNw1w\r\nXCX+faZk5Z2TlsxIc5qRRzo/yhfKqkGaPJcGaaj87M9SG0e5mFSSk9P8JqCs\r\ntBHQrZ1LRg7mwB0/LI9w/SjEgS+d+ENGcUs68ud+1ROanRDuakcJmO62AZfn\r\nXRUi2/PssHTrls2a65DpNh6BTEJ5r+Q0clfcdMl1x6bspSMs8oDfDGwZtKk7\r\nAJSpHsR1+KHgr7H02/8+6BzMr1A5yMdwfcTUK3YCrKMAfQHlUOa2Pdy2lba2\r\npWbyKV0O5dr3pkDVlYusVrFQqUGRXQ1jJGSxbfhNtAMZz5/DdCZsjR2Xt9er\r\n9NI5cuwXLpPLjQ9sT997ZUvFO52NSGo6elM5IL9/iwKLF/jAucj7V72Ike8Q\r\nMDHssTie2nNU7yTxmJx5lop04n/3D8E0GUYaFnn6mSh5zQll6gHFaf/gQMuD\r\nsmobTpxbn0U8eGk3q2UUVReWE5Zw05cC+Zd5KH3ZI4COGHn4Q0OsthDrrHS4\r\n8azhFTREvaBe/IUZ//YsxQ8YpLBSllkZ/Kfjl8huDVOpW5OZ59J7YvmPVgzW\r\n5TXcnBYfUJGwzBNr5VgO4tdHxaZN/n6OkOQrVrj5Jc/LL18VJYWoBx6ix8hH\r\nGarphRbw8waJO/dW6cfIhJLWKQuboAKKICE=\r\n=nsI0\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.5.0_1659201344596_0.5956985549937501"},"_hasShrinkwrap":false},"1.6.0":{"name":"eth-testing","version":"1.6.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"32c3b46aa7afe9b6bf0ed991a6fcfd4b86a02825","_id":"eth-testing@1.6.0","_nodeVersion":"16.17.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-j30sIBT6VKIKjqMstwe6p6X/K5WZD0/L+nAXszD6mr6m+33ws55erG6hIa7xQvckfa5lrniug04cfyupCcVZ4A==","shasum":"38eef97435dd269963785a995c69107ce4dc8424","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.6.0.tgz","fileCount":43,"unpackedSize":200951,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrwBOW0x8HV7MLHcYgNBdalr5M2OUYG6gaH3HKxmmhFgIhAIiOiolrMjdTyzX/c/GvqR2BlAw2CCUDVBuaLhScMrAp"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjTlBCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq33Q//auMdCGqFTo1GE9Uw7TR/z5hOqy8y2tV2LAshk4P1dn6QU+JS\r\nKZ9uOIMVknIfvShmM7ihzoAQMws5MlOvKcqYnlSaWeB+I3TejX19BobzRQoy\r\neBVwdKo5j/1N7Ha6QdlhXTDb0dNkQa6df4E0WMmSKPYvOv7UtjA4tkpAdeTS\r\n0F9Db1FbB+sQ8MbsCGbGeT43nT4tiSoWPfrGGfUAjMRMUB38/Wf8fhLEZD4y\r\nR2dnPh4vM27YqeSqO954PxaFee4M4tCLL6ldQVYz4C6I7aXiZNpsAwSqL0op\r\n04nMV58h7O0lNG0hNS2ZSJb8Y8x+twDEFSfBevLwXcfrbHV7NWoKzJJG9pCd\r\n2G60txN+AgvdKKpoAkEj/V2Ypuwdfs3Vuge879JS4070zqv5IYhUgWABXTTL\r\nJLwXzp08VtTC3MNFv72WRY8sxzLjfv/JL27lHAHOZ3CYzWBPwZwr0q2V4bHu\r\noBngm+492XhA2eIdxZIZ3K21CnR5uFm29PN88ggEljaONIuKcSWkWpY/nZY2\r\nsOt6VrkvRJ0dUrt7FpeQABsSGsDeBEo7h6ZSMTqZusAmuMPOWlUYi58n5Uks\r\nT+t51pqTC4Fc5M05s5LnkAmbR89ykJDShzFWGqFPTGpT4vzlSNM3xMSBaGIS\r\nputvrDL3zOjF7p+j9R5YSMc9+MHF7QCJtRU=\r\n=N/fD\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.6.0_1666076737947_0.10205214489617931"},"_hasShrinkwrap":false},"1.7.0":{"name":"eth-testing","version":"1.7.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"0907b9255d3b79b5ed662f3fb080f69d9265cb20","_id":"eth-testing@1.7.0","_nodeVersion":"16.17.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-Y17utbMerznpaovArqCAK3nxQRkTU40xD16L2c5vZAMkcgiI1yYg5AlikuSTvxeHlAxmxsM1g2wzchIT4zDa5g==","shasum":"20aa401497cc1f4929f0f6c98cd06a77ff05253a","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.7.0.tgz","fileCount":43,"unpackedSize":202233,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDTg2a1bd46hRhpZ6RNgH+kHvCT6J6C05lT6iuuFR/sCAIhAP9SbfigTMcJES6PALG0U7/9C+zibRToVwXSW2z/dQ3r"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjTlKQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpzAw//dHVZTczMxo1BmYq/z53jt8lexi23mdnCuqBLLUUs6WmQ94W/\r\nhKIr5EAnlIijoOAXqgVSeZEy+aAY0w54WNaJoCG9TOAdxuD/nSO6Iau2B8rJ\r\nL3iiBN27YDtOrAhGfAsTd4KoznHw/loK3GIVaH2nMp7gtosggCThIRdaw4KZ\r\nC/p6M/2K3DNwj6vR75zDLdoXqI+Q3arSM9DStwWuqw9gn518x0hxRBitvZKc\r\nhCaHpm/3Gs/LMPWAbwDkz49WcWW0G5qIYxZmhSuQxF2ORrDsn78M/O5jfNNu\r\ns/XIRfiQEwD9NaXMBhNifMfWqt5DxnfFFYX0TOVP3nDLwJKiyk+LOhycIeiG\r\nyG4ol2Xr+C94sCstB39mi0GujWK6cHx5a2eWHkbw8YPwTaN8WSPbwWGSaOe9\r\nzl8t/c+pl7Olr397avgxBzH5dpfxNIn5I1r+07uECS2GG3+2M4f8s+hA4nBk\r\nDdciN8zfKjUdhHaPrRGLQGCfKrRgKmk7DzJOenE1+zkdAEKNpcQc8igvRwAI\r\nA78/fMSmr1r1A/Rou+tNSx3pBAxdkDcbj9Xeet++pSp9tl/pI6UAuOJ8c0/x\r\niFVSaZDCQ+f9+3swMLIbCK/nVKxBADEZjugGHu36osl5JZlR59xromAfGvNm\r\nt9/eDANLbCKaKSxER/lOjK5KTyDThluKpIw=\r\n=+W0f\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.7.0_1666077328226_0.36568233172741493"},"_hasShrinkwrap":false},"1.8.0":{"name":"eth-testing","version":"1.8.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"fffb5fd29915459d5ad874b8747ac91763d94a27","_id":"eth-testing@1.8.0","_nodeVersion":"16.17.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-70+A1YXv1q0kdGiM6WsWyhzu+edYsId6ICKKMM2jrjD9hcGqYaGmEeH1I3oTtEoq24xapjiGptsjMTSftGgrhg==","shasum":"7b31e21ed1536f22cea1331978abbae11c9b6de6","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.8.0.tgz","fileCount":46,"unpackedSize":225186,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB5FlZ5r1As+AF6A0VhBrddqq4rko2bGXL+jhvvQAeV0AiEA+KyPpOTGIDjP6iu/tC81xfpGdH6Tp7wz3EDQ4HsQb+4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjVVwUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7jA/6AoUcW/VxMAEj10rlR75U265iuxfMPc90kJ0CcMAkVBlVefS0\r\nqInPjyqsNUHbvVR7I2/NE+kEZNmPXrPkeoX9Yb+ArVMtCIOPDAGc0Hmm/VYL\r\nP+s0ffBXZXLlyDVGeup1KKvsnrUmHLvm3uEYo+V+xAu91w0KxkWdo83U2DgD\r\nJnIh9SZwE2X7zC7xVfS0wm7TQ4WPeypqYX/IbYqd5IlAZFUZmB6LGZyozZ+v\r\nTHtBSInA6BYAGOOYkWFsBPRGmRE3I8o4RIBLKxAP559qsGbDwGNW63DMbLA4\r\nBSyL0E/jGw0Uoro+bsQoF2eFqY8sTOs/wqyO1cKD77KeLejR83crd4t2bqyd\r\nJ4H0CoP4QmbigXU0JZf677wslebtLJ9VvNmJLYWzgOBkcfYzunUis/uuv6q3\r\nVPsauy/oBzwEgiokAqN4FXm1POxsiVCgDOqWmuXbtP9u4G2nHXD+LJaheZlS\r\n/CN1Vfx72U5oNzBxXm5Frzl/NLnPYBm4CP1ykTrc419B4RxqiiCYLRn4PUsg\r\nQhLzmbRl75QvJIzz5MSS6DKfEfGOkdQluDnVCgU9xJnTixtbnETmftaUDWZU\r\nIn0nkipnjwlV5MHtn5JYqnYpyV+O4IzwjYoozFoqflodeqltdkaCbVYuplh6\r\neWN404nv24421o0EE4wCp8kErqseHLEXFD4=\r\n=rsA3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.8.0_1666538516107_0.9055701011683832"},"_hasShrinkwrap":false},"1.9.0":{"name":"eth-testing","version":"1.9.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"8fe1b27fc0ca2385c7e9632915162c9a950576ce","_id":"eth-testing@1.9.0","_nodeVersion":"16.17.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-VD5Ys/KiSIiatL3eUsX+yGbuQEI5jP3dOJbJEp9Ml/hhhn3NXIdUH/4icGIw+NDKLGLAZo+Z22VIzsR+OzNpwA==","shasum":"81743f224445b543015d55e48fe151f270270095","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.9.0.tgz","fileCount":46,"unpackedSize":225981,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBHhoOtqOtHSe9usVtyMOrX3ou9h5mT7NaLkUIU9RyzxAiEA6Ic3Ov1cwQ26GJzC9yJnR+9O85SWVXeJn05+9nTHeS0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjW8YeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmplQA//eX6XfIv18oed2dBSywUQjyoTK0zUFSDZxsR7TgfmJvtr/DSq\r\nUfTTSEEBNPMMefmg2ztuCIVUiiQxC+qZmnGs14U9xo/jsiGl6XkWZvQvu3Nb\r\n1JBBOXrTKIN5I1SBSGBy+WCPpLT/QQOWxL3p4lTQhcZpQxjOdkGqa8hI/yB5\r\nTK2xfoO3HvETCBJ8JJKoijuWl8HZWKmP9y9dQCyTo8ue8aPHWnVa5JNv0axQ\r\nmogIuIWwACB9GcYg763J7h1lryEQcBwCLf4+4oMEeaf23MKd9tc4Ow4/ChbN\r\nzv2d2YoZKHDMHLnboiOgyflUzIZSkoqAMj5sQ04PA01U967w9dnfRo/nEZF7\r\nKYMWXjGgEDYODvDK+d3COBdl6okBK1/v50Bzwp9VFLakIiFC7aSanV7pv5aI\r\nbTyTr3kKi5XBJz01/+Vk23uxGC4TSswbhCxnJeLsQTsWj2w/xhnAHumPhN3y\r\nJO+7n9QcSzKDQQOCTzDOK4D+PXrUbwNoumErjux2imwcbCo5ZTQPX/PvI2n3\r\nV7Di45A4MUcqe5Ydifag24NA2nvsP/I/pAUhyGogHSatpxR2rqeZIfPY1Lc/\r\nna1dpY5f4dMbBSte9nrkQ7fYuIoNQJBRALzy7v21X3PFjEOy4TgShYK08HFQ\r\nmzS7AU+QfQDdNRzEFcHE0dKjj/EXpqKwdYM=\r\n=xQJU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.9.0_1666958878125_0.38748252086452095"},"_hasShrinkwrap":false},"1.9.1":{"name":"eth-testing","version":"1.9.1","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"15e4d39fe176d4034703fbbf56c32094e6d90ae4","_id":"eth-testing@1.9.1","_nodeVersion":"16.18.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-1lM4c8kNtgdYYiOZIq7R2P+Rs6hqf+VDQP7/wjqDCUyncdqSSeF5QsmhUqxfOW0qngbow6Y9oWz24ETRwwKNrA==","shasum":"7cbd2ea4f9789c69476fbcbf601d7c65dc5c7eaa","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.9.1.tgz","fileCount":46,"unpackedSize":228342,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFFvGMmN2+OEkjYwlKuXQ0DpbUerHzagwqMoXtZ6lg4ZAiEA9JA3G2YDgX/SyUd/dji/XoaIE2oYErQyHbI86YC5mFA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjcoSoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpJwBAAhbHSmWJnQMT0drL16sM3RSBMarVJ/GiKGHmDMlvfpDmW8mUK\r\nu004wMU2e/i8zSufVyjgBbj6HaS2UBa2iT9eC2cVKbZ4gBeNxye1VhU2D+Zn\r\nCmsz17UtTjGz6Ty+UddayoFexD1KOJDpazVoDkMiKllgK50NScVFlq47SKtn\r\nyLYK2pQDOo3Xzit+qeSWliqWTYhHxRuJpEzRH/U0A9voP8WPdYGLcr8CrmML\r\n2mtG+mHoe7xwafSu6LOM9F8lCyNKvyuZItnWInoNNlL1feW2j0Wf1hKNuKr6\r\nGwhpDIoHWjeY6WykOIuLOF8ovkC+OS6lsypbQ2Ajhw5EdCkcSsRxJO/xRbAG\r\nC2RpkAv02vAoz/Grb054Aakse1sjdac8vi83KcYu5k5DOcfzgnNu0BarAuYL\r\nx74ltNeAMmvaM/nruNxR1omQeZ2mj95d0g/rH2QwBXq0Q1rfVPgaimbFi8Z8\r\nNBZYvG9uqMMUAVFZDvzFn1e1GTkmw5bT/uvkC4mYEcTstilN2Ic+sW8KkXGb\r\n+anKk8rbEvaVwN8j7SE7s7XEVYIzQozJDGUCZQFjRb4xuiLKsMYQTjHmc0pK\r\nG/4M0Zhjyx/74Ci11Q7P09pxunzr2Fk6viUr3jh/KPnbU3UtD+Eo/lfrvwVB\r\ncEYrk/MsSBorWjNHW4zLCDnNLWnLnL6QXL4=\r\n=pWlw\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.9.1_1668449448584_0.7147619634020348"},"_hasShrinkwrap":false},"1.10.0":{"name":"eth-testing","version":"1.10.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples":"cd examples/react-apps && npm install","test:examples":"cd examples/react-apps && npm run test","format":"prettier src examples/react-apps/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"c3c0eb0b13101ca72cf35c364031dec15e84b3ca","_id":"eth-testing@1.10.0","_nodeVersion":"16.18.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-MkU+8jpjzKrrcMVTp2NevWwjED14pzdYsVx7l6is5WI+Xt60NCPsE0cKY0wwm4axMf57bK1W5/IXRTbkvIuhVA==","shasum":"4d0de42aaff32f103a5a1cabed5e723b6f920c8b","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.10.0.tgz","fileCount":49,"unpackedSize":231186,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF8WA2WufA6hSwrNYw8Tr10vFmD/TS456Cwp/GnD9rfhAiEAuZXoqkqAlDAB3WY+9sDjkSkIbyrsD4NaZtPxEWL+fT4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjnJ87ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2rg/8CMshYYKpPQ/0cFNAYJ8f+JXoezFSnUYfhbdO4brAX2+DLm0w\r\n/Cf0D4IosgFKLrUFDKfYG+FTZDiUb2I7sia3Fj8ItHWrNcasvKZFzi/5huLc\r\n0l+jOWShVVhXfu49LlFdOhTYrWsbbEnYyPCkM/LEhWEl4mRftT1Onx7KNHjR\r\nay7hK88v52vvZvqpXEinFeuoQo2y6hRAfV+oMNWM3VrCr9MYNi9CswDeNI7W\r\nnU7U/4nzmQhCH2FDVnjsVagnef6Pv0UK+9q8Uo9GjN3h0q/vH3RLi9KXXzvU\r\nSNJrOQAc8tAXVrstAlWZ2EEUXyi3SGu7uTW6KnefxyI4D676jZ5QNzvNPaSL\r\nAGBSA+gh2vS7r/UMhCEUSXqhAs8MKrC81cvnLoXG9I4A0kW2FbgwyKCApubW\r\n929Bm4tAa5oC5RZnW0kwuCE85y215Qn1nKzFMIkm6nvfIbPuzwiV/VczIThr\r\na3bGsCxLk8fd5dcIh9V0NBBe59B/wX7gUjJ6k6Tw0x+NUp4jl3LEKtlfTv69\r\nVD0wC9n8qJKJEqEusChxeLwFwT0Xc/KPLkVxgz+KlcQIV6o00wphGJPtLplU\r\n69jpQc960+obk/MdW19ZTf/xDeSirzamcRRfPrs2wvysaJbYiLzf3YQ1S49r\r\nsmyzHklIFu3myGRqkMtkIqd+We0C/ZSccLA=\r\n=w+aK\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.10.0_1671208763499_0.7470358724226838"},"_hasShrinkwrap":false},"1.11.0":{"name":"eth-testing","version":"1.11.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples:react":"cd examples/react-apps && npm install","test:examples:react":"cd examples/react-apps && npm run test","install:examples:node":"cd examples/node-app && npm install","test:examples:node":"cd examples/node-app && npm run test","format":"prettier src examples/react-apps/src examples/node-app/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"6335347f3d41cab975d1b8e9075a4588557790bd","_id":"eth-testing@1.11.0","_nodeVersion":"16.18.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-3Y6b/dlvVbNvljCQ6K/FJwsADceolpXTG9v3VL7fihOpj7Ewx3Fcr1dw6MMPaDw8X1DtmDh7LpJRt2NDtzxmyw==","shasum":"1238dce624133021f91a527a4a588d7ecbb2ae48","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.11.0.tgz","fileCount":49,"unpackedSize":242903,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHe3MpGbMeUmuurWMDxBr3zD95v6JCaPv/EbCkicaI9sAiAiHV3QP6P7qO202ld7AE7LFWUnMT3Lsiuf3i8jdDijWQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqc8dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrHSBAAmG6QEx0Bd357QtDOLLde1aT5tHaETQ3BiY7CwRsHA4PZo7pP\r\nnaMQWVw6zPzIItgMlJ9+GADiDJplet1ofFRRFs2hzQ3cASL8ZfI3geMq8Boq\r\nJiYgM1RQEysWsXAlBfwlhBAg5eU1fq9AMjWC41MtmJjsyQfStPX6ufE0EEo7\r\naqIujef+8vPQuwgJBXRI2XLzjqKXUY3Zy/l3u4m2FU0bzAzgRbMxUFGTUN1G\r\nbrY1b1TtZhi23h3oFhsQmvJAaziLimUZb58hK73uU4UtlcH8eqzyB9bbf/L8\r\nUexI7kY4ilCUPCV+P/U2ISmJz/iPnuLALsrv2nAX3YdVvDdwcXOMVb0BZT37\r\nUYReINvwHKizp+R5bb0WU0igz6vpHBM5VDX7zcscaFWTLLHRBEBceg645DCk\r\nm53doBIcZzEw3JCP6q6DRVItViVQ1O8dPGlzTkvBHwMD/YZ1JzaU+0a7uMMp\r\n/Hk7h6V5wrnvdgjL5NgXEcdWu97oeaJ6g2m527Nt8AVaRP0J11da+eiZ4jsL\r\nc0CdRn4oMrMSxwzAiBImiEbC+RfrNLJHuyY8gsZHAjcgCD8ICEIUb7zi8X5Q\r\nagfu4R+1G43U7dtgQHCFJ1a76yD5Zgu1e5+BI5C+9M/QGdairmp0rHh9h1H9\r\nuN2cPnQ5QhEEhZzagBjhSsifO7vs2zn8/6g=\r\n=/TAq\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.11.0_1672072989588_0.29778542450680723"},"_hasShrinkwrap":false},"1.12.0":{"name":"eth-testing","version":"1.12.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples:react":"cd examples/react-apps && npm install","test:examples:react":"cd examples/react-apps && npm run test","install:examples:node":"cd examples/node-app && npm install","test:examples:node":"cd examples/node-app && npm run test","format":"prettier src examples/react-apps/src examples/node-app/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"3dcb81afeed59598919947132fd9c037b2fca25a","_id":"eth-testing@1.12.0","_nodeVersion":"16.18.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-YuvWfxIRfer208Ya8ANcGEoQc2Msey9yS/fNx1gKkQ7u6DeYUyosb6YnUzNhgNRPgWTlj5EnMuXUHWjXEyh9Mg==","shasum":"573bea828129f2eed172c6dd3fdea359d8b7f6f6","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.12.0.tgz","fileCount":49,"unpackedSize":248846,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKg5/kDkUyECQO6fLvZ03QlxfhLUTNe1n4tAZPKJPuNwIhAMnjXPf+pK9qvBhHtj4SjXbSHrS5LnyIPbnQNbRpMs2T"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrMMqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxEA/8DUFYY8KN9mupVDLknwdQlOYpo30l77jXkNRF2EUU1x2seu1n\r\nEai+pvhtCtVtpLel/c3W3pwR54Xn8AZOpFMsxlICen/9gA9JWjUx7+Z8oxFn\r\nlAMeOLrxr3w0S+XZXTCB0qdnvvmONVTVUGh/E64K3BaIXmhjykyfgZGFClx/\r\nmFYWfk2v34Zaro9ydGnrgDY0tH5KNGo2HKT4bHE89FCvJ1c5DPYbvfq4k/zi\r\nGNSLCv8CsP8Txbe1GSu6l0y7Fm/iNnsKD56+juvFV1zNrZurpiSMRADrMPJ6\r\nonfXr/Bx1r9cct+7nxluQtwntZb1O+/satvS5dKiMNmx4QFnIQrggb+/yy1g\r\ndriEigaHCqu70u3fZpDM0zERPUdzTjbXAT2LJhPyU4u19Bqe8YMYCWigoEr4\r\n89MklHeMfL+RXuKRp2Yk76yd4EZGMzPV1s7mBai50CoL+0mq82GnrvDZxY1B\r\nsKVnwVsyTlYvoaLQ4r3G+rWsWnmtIlFmtMzqxxwilGoPB5pmq4MsAeUOEARw\r\naZXEUJzbUyuKkizDYF80Drlu8/zL8a9R6ffAaehGAItZDhYHRCDObkxBtooJ\r\n2KjHx3skkkIQxIJso//STdEXr+shNUqX6RV1cidc0jjUVdcQJPjBNQu6lQnw\r\nOJRoyg695gCSogUXmx1OpE0xyZxBoEBjej8=\r\n=04MJ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.12.0_1672266538522_0.9574091365955639"},"_hasShrinkwrap":false},"1.13.0":{"name":"eth-testing","version":"1.13.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","lint":"eslint src","test":"jest","test:cover":"jest --coverage","install:examples:react":"cd examples/react-apps && npm install","test:examples:react":"cd examples/react-apps && npm run test","install:examples:node":"cd examples/node-app && npm install","test:examples:node":"cd examples/node-app && npm run test","format":"prettier src examples/react-apps/src examples/node-app/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","husky":"^4.3.7","lint-staged":"^10.5.3","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","typescript":"^4.1.3"},"lint-staged":{"src/**/*.{ts,tsx,js,jsx}":["eslint --max-warnings=0"],"src/**/*.{ts,tsx,js,jsx,json,css,md,yml,yaml}":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"bd9fc7cf938b5c8c876c63c240ce6a406b103660","_id":"eth-testing@1.13.0","_nodeVersion":"16.19.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-DTu2vyFso3/E7yjTOmjX10R6oGC/g6W3YLhVhcp3ipA4ncsPWT0yvS2gkCcd65NHBIZeJ6OCqKSj2ypPfX0PiA==","shasum":"278653a4c75ea0ba15066dc983f9d561798cdd16","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.13.0.tgz","fileCount":49,"unpackedSize":248973,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHEt+JKpAxUofKOg/dvtuEhqxt58fwHWF9bDC44vBOKWAiBh+UPziNJ6hJEANwn6vMMpRgVBBwxlq5CGmKNXFuWlhg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+3O0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmogXg//eCGVlgBxkttJF538YZO9nambj/UIBzuBrpRjP7NkK6y3Qwe8\r\nj9l3LJoMIobWuGAcUMti9DOye4es6pG1pAPjlZd4bmqadtbrvRuDRVyR7C3O\r\n76Z2xL/YJ3X/QlEVmQCf9/yzqiUr+0WwSvGNA5XIvR7AAZHYgF9/ZqFz62BC\r\nZkSxx7YT9wr6oxUe53bqZXbh7xj2vHRCCv28ovA20fcgU5oWqy21gC3gwX65\r\nJFT/GXaB6mGL+G5BGEhNCykoC6x+1CuJdTZbw81WGCOaMDztwJbSqE2Y5L0C\r\nVf2AEHJQimJLzZIaAb8n0IhgxD/N590zLonopwbzhK1ghnJAI8hM1x/YqM+i\r\no1hVtzO9+fjVAPWnDZuClUQ1brl4v10xk1QfoTyaT8PKY3t5wRylBYbDlfRs\r\nWPqh+1f8GQ4o6ZWxYOJHe7x8pTHmwAC72yXJ1IrQpoQBG5YbjxP4uVMKhTsD\r\nveImqKBhAZEfkVoB+w6azL1iI9Z8OqfgrQH+rasIO5ep1t4TRgxzzxGXG07X\r\nsmOnOJRq9gbXsn3Hcupu9FlB768NAey8ti+qXcPAJE4qmUMz9EzqmBe8+SLS\r\n8V0x7k9MTu8HLyPzxseR0PA1hf1mDfi/tghiqfabJCw8x8OEVikbQvyWn59G\r\nb4MBsVDg1+r8lu+jRyhS//XKQOyns+PBCVI=\r\n=uuuv\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.13.0_1677423540634_0.38806232836653964"},"_hasShrinkwrap":false},"1.14.0":{"name":"eth-testing","version":"1.14.0","description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","keywords":["test","web3"],"license":"MIT","author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"homepage":"https://github.com/VGLoic/eth-testing","repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","scripts":{"lint":"tsc && eslint src --ext .js,.jsx,.ts,.tsx","build":"tsup src/ --dts --format cjs,esm","test":"jest","test:cover":"jest --coverage","install:examples:react":"cd examples/react-apps && npm install","test:examples:react":"cd examples/react-apps && npm run test","install:examples:node":"cd examples/node-app && npm install","test:examples:node":"cd examples/node-app && npm run test","format":"prettier src examples/react-apps/src examples/node-app/src --write"},"dependencies":{"abitype":"^0.1.6","ethers":"^5.5.4"},"devDependencies":{"@types/jest":"^27.5.0","@typescript-eslint/eslint-plugin":"^4.12.0","@typescript-eslint/parser":"^4.12.0","babel-eslint":"^10.1.0","eslint":"^7.17.0","eslint-config-prettier":"^7.1.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.3","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-react":"^7.25.1","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.0","prettier":"^2.2.1","semantic-release":"^18.0.1","ts-jest":"^28.0.2","tsup":"^6.6.3","typescript":"^4.9.5"},"publishConfig":{"access":"public"},"engines":{"npm":">=6.0.0","node":">=16.0.0"},"gitHead":"a7c818ffcc4ee0c73a9299e819e1e647430d512a","_id":"eth-testing@1.14.0","_nodeVersion":"16.19.1","_npmVersion":"8.19.4","dist":{"integrity":"sha512-KRVSXHogM4byUUqoGlUK0ce3U4GsZcf/BAbY/L1LzMPPVntWfm12XQP3pxy0OPTSgvvP7sDGz41qifAZeVRUeQ==","shasum":"cdbeb02a19495942c60bdf27d046a54c40db24cd","tarball":"https://registry.npmjs.org/eth-testing/-/eth-testing-1.14.0.tgz","fileCount":86,"unpackedSize":3233111,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC3h3DU5wTvsTFQi0x4rQfSO8yEsubKgBTCKwvTmr9V9QIhAJ9JU9j+xM+qQ8EFdDZvVmMoLyAXVtCCHLKTsyhPdWDp"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBKc8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoNzRAAiLdL8SIPrVZYZcPlHn3MjKeShHSIAWSgJqiX6Mgw+xDpt/3s\r\n52tyKSDrPla7IbgSK4vxz6sW9BFZ7gWro6RTNauM8uHK17r6R0p1aSv489l3\r\np2TN1umDUxB6pzFWG2TmkMl16mmZ7PUY4/TymTwM5FfzUpYvVlQQbQ6zjJ3v\r\nNXRIaFOPt/OlhFNHKW3xRAy6ADaY/yco0ZJZtfYiz4OjMg3GsdQQZRoXJzQt\r\n1CUjM0ohfVLaoefTt1EETgXhipA5my0N1POttu+OH8q5T9XUvKJtb3bbg/cc\r\nwmW4vwrlVUFpMC9PdLySmj/CClaEMju0gLYuNl+n8r+mO83CB3VTbPu5QUtc\r\nWLcyCqf6gZ/YCZ3hFtjoC+NbnNEAKdjejkzc8i9F0Xd3Sv5FAJZ4L10dNT5Z\r\nudzfy5By8Qx4STH1LcsVhV7Nn1SQujJtdiqg2CUzW7DuqoKLjes68FoBQww6\r\nc0QGOMif8wvHpzuTnpuIb9ednis86tVEz6rMMj306bkLGhDqMXSWMAgitfsb\r\n3utrAkuUTppDkQFT2/6pzYHSTft0SJnDSJAxhdSddZefZIfAHrSd8SBfFsiP\r\nn/LV76XTgVg8B6WEnZszrFSOXyhLWnMiHRtyyTn8EoPg2ffWU8+Gdxbhof5k\r\n2ouAI6PNYOPtC99BkKr6J8DDaC3bkRkzLV0=\r\n=U4BG\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"},"directories":{},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eth-testing_1.14.0_1678026556547_0.32478909085613816"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-03T12:36:33.140Z","1.0.1-alpha":"2021-09-03T12:36:33.277Z","modified":"2023-03-05T14:29:16.830Z","1.0.2-alpha":"2021-09-03T12:40:05.265Z","1.0.0-alpha.1":"2021-12-04T16:05:28.216Z","1.0.2-alpha.1":"2021-12-04T17:14:48.980Z","1.1.0-alpha.1":"2021-12-12T16:16:40.819Z","1.1.0-alpha.2":"2021-12-12T16:44:38.981Z","1.1.0-alpha.3":"2022-01-08T15:02:11.079Z","1.1.0-alpha.4":"2022-01-08T17:00:34.596Z","1.1.0-alpha.5":"2022-01-30T16:17:46.304Z","1.1.0-alpha.6":"2022-02-07T21:01:16.921Z","1.1.0-alpha.7":"2022-02-15T15:03:46.338Z","1.1.0-alpha.8":"2022-02-16T12:01:30.158Z","1.1.0-alpha.9":"2022-02-19T18:03:27.332Z","1.1.0-alpha.10":"2022-02-20T13:43:06.329Z","1.1.0-alpha.11":"2022-02-20T14:07:52.272Z","1.1.0-alpha.12":"2022-02-20T15:48:43.631Z","1.1.0-alpha.13":"2022-02-20T16:10:33.391Z","1.1.0-alpha.14":"2022-02-23T10:41:46.200Z","1.1.0-alpha.15":"2022-02-23T10:59:35.658Z","1.1.0-alpha.16":"2022-02-23T16:45:55.399Z","1.1.0-alpha.17":"2022-02-25T13:41:25.023Z","1.1.0-alpha.18":"2022-02-25T15:30:37.458Z","1.1.0-alpha.19":"2022-02-26T15:37:46.362Z","1.1.0-alpha.20":"2022-02-28T09:30:28.163Z","1.1.0-alpha.21":"2022-02-28T10:43:42.881Z","1.1.0-alpha.22":"2022-03-03T15:35:32.158Z","1.1.0-alpha.23":"2022-03-03T16:35:27.940Z","1.0.0":"2022-03-03T16:55:05.315Z","1.1.0":"2022-05-15T15:17:59.913Z","1.1.1":"2022-07-05T07:11:19.368Z","1.2.0":"2022-07-07T07:26:11.408Z","1.3.0":"2022-07-21T12:31:15.070Z","1.4.0":"2022-07-29T09:05:47.038Z","1.5.0":"2022-07-30T17:15:44.766Z","1.6.0":"2022-10-18T07:05:38.224Z","1.7.0":"2022-10-18T07:15:28.679Z","1.8.0":"2022-10-23T15:21:56.291Z","1.9.0":"2022-10-28T12:07:58.353Z","1.9.1":"2022-11-14T18:10:48.778Z","1.10.0":"2022-12-16T16:39:23.741Z","1.11.0":"2022-12-26T16:43:09.790Z","1.12.0":"2022-12-28T22:28:58.724Z","1.13.0":"2023-02-26T14:59:00.792Z","1.14.0":"2023-03-05T14:29:16.724Z"},"maintainers":[{"name":"vincentgenod","email":"vincent.genod.loic@gmail.com"}],"description":"A set of tools in order to generate a mock Web3 Provider and simulate blockchain interactions in tests.","homepage":"https://github.com/VGLoic/eth-testing","keywords":["test","web3"],"repository":{"type":"git","url":"git+https://github.com/VGLoic/eth-testing.git"},"author":{"name":"Loïc Vincent-Genod","url":"https://github.com/VGLoic"},"bugs":{"url":"https://github.com/VGLoic/eth-testing/issues"},"license":"MIT","readme":"ERROR: No README data found!","readmeFilename":""}