{"id":18913785,"url":"https://github.com/ethers-io/ext-provider-ganache","last_synced_at":"2025-04-15T08:31:00.311Z","repository":{"id":182390804,"uuid":"653470461","full_name":"ethers-io/ext-provider-ganache","owner":"ethers-io","description":"Ethers extension for the GanacheProvider which provides a simple interface to a Ganache in-memory Ethereum instance.","archived":false,"fork":false,"pushed_at":"2023-08-21T00:47:58.000Z","size":42,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-11T05:06:21.993Z","etag":null,"topics":["ethers","ethersjs","ganache","testing"],"latest_commit_sha":null,"homepage":"https://ethers.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethers-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"ethers-io"}},"created_at":"2023-06-14T05:53:51.000Z","updated_at":"2025-04-04T20:23:59.000Z","dependencies_parsed_at":"2023-11-10T14:33:12.117Z","dependency_job_id":null,"html_url":"https://github.com/ethers-io/ext-provider-ganache","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.0625,"last_synced_commit":"335566b563b0a48844e2427ff9e3cd809e37d2b8"},"previous_names":["ethers-io/ext-provider-ganache"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethers-io%2Fext-provider-ganache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethers-io%2Fext-provider-ganache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethers-io%2Fext-provider-ganache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethers-io%2Fext-provider-ganache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethers-io","download_url":"https://codeload.github.com/ethers-io/ext-provider-ganache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248651141,"owners_count":21139762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethers","ethersjs","ganache","testing"],"created_at":"2024-11-08T10:08:56.477Z","updated_at":"2025-04-15T08:31:00.274Z","avatar_url":"https://github.com/ethers-io.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ethers-io"],"categories":[],"sub_categories":[],"readme":"Ethers: GanacheProvider\n=======================\n\nThe **GanacheProvider** uses an in-memory Ethereum instance (via\n[Ganache](https://github.com/trufflesuite/ganache)) which can be\nused for testing allowing free transactions and performing\nexplicit operations against an account not normally possible on a\nreal network.\n\nInstalling\n----------\n\n```shell\n/home/ricmoo\u003e npm install @ethers-ext/provider-ganache\n```\n\nUsage\n-----\n\n```javascript\nimport { GanacheProvider } from \"@ethers-ext/provider-ganache\";\n\n// Create a new in-memory GanacheProvider\nconst provider = new GanacheProvider();\n\n\n///////////////////\n// Snapshots\nconst revert = await provider.snapshot();\n\n// ... perform operations\n\n// Revert back to the snapshot state\nawait revert();\n\n\n///////////////////\n// Account State\n\nawait provider.setAccount(addr, {\n    balance: 1000000000000000000n,\n    nonce: 5,\n    code: \"0x00\"\n});\n\nawait provider.setStorageAt(addr, 123, data);\n```\n\nAPI\n---\n\n### `new GanacheProvider(optionsOrGanache?)`\n\nWhen constructing a GanacheProvider, either the standard options\nnormally passed to Ganache may be used or an existing Ganache\ninstance created with the desired configuration.\n\n### `provider.snapshot() =\u003e Promise\u003c() =\u003e void\u003e`\n\nTakes a snapshot of the current state and resolves to a function, that\nwhen called will revert the Provider to the state at the time `snapshot`\nwas called.\n\n### `provider.setAccount(address, state) =\u003e Promise\u003cvoid\u003e`\n\nSets account state for `address`. The `state` can include any of the\nproperties `balance`, `code` or `nonce`.\n\n### `provider.setStorageAt(address, slot, value) =\u003e Promise\u003cvoid\u003e`\n\nSets the storage for `address` at `slot` to `value`.\n\n### `provider.mine() =\u003e Promise\u003cvoid\u003e`\n\nMines a block.\n\n\nLicense\n-------\n\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethers-io%2Fext-provider-ganache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethers-io%2Fext-provider-ganache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethers-io%2Fext-provider-ganache/lists"}