{"id":23545547,"url":"https://github.com/bh2smith/ganache-snapshot","last_synced_at":"2025-04-24T03:13:40.937Z","repository":{"id":44112716,"uuid":"195074597","full_name":"bh2smith/ganache-snapshot","owner":"bh2smith","description":"Simple package intended to make and revert snapshots of a ganache database.","archived":false,"fork":false,"pushed_at":"2022-12-10T21:21:59.000Z","size":394,"stargazers_count":3,"open_issues_count":9,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-24T03:13:34.618Z","etag":null,"topics":["devtools","ethereum","ganache","ganache-cli","snapshot","testing-tools"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bh2smith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-03T14:49:14.000Z","updated_at":"2023-10-14T08:43:04.000Z","dependencies_parsed_at":"2023-01-26T09:00:55.500Z","dependency_job_id":null,"html_url":"https://github.com/bh2smith/ganache-snapshot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bh2smith%2Fganache-snapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bh2smith%2Fganache-snapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bh2smith%2Fganache-snapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bh2smith%2Fganache-snapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bh2smith","download_url":"https://codeload.github.com/bh2smith/ganache-snapshot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250552075,"owners_count":21449165,"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":["devtools","ethereum","ganache","ganache-cli","snapshot","testing-tools"],"created_at":"2024-12-26T08:18:48.591Z","updated_at":"2025-04-24T03:13:40.917Z","avatar_url":"https://github.com/bh2smith.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/bh2smith/ganache-snapshot.svg?branch=master)](https://travis-ci.com/bh2smith/ganache-snapshot)\n[![npm version](https://badge.fury.io/js/ganache-snapshot.svg)](https://badge.fury.io/js/ganache-snapshot)\n\n# Ganache Snapshot\n\nThis plugin provides an easy and robut way to make and revert ganache snapshots for smart contract development.\nGenerally speaking, this is a development tool for testing long sequences of transactions.\n\n## Installing the Plugin\n\nTo install the latest stable version from NPM:\n\n```console\n$ npm install -g ganache-snapshot\n```\n\n\n## Configuration \u0026 Usage\nCurrently, the plugin must be activated on a per-project basis. If `ganache-snapshot` was installed to the Truffle project root, it will attempty to automatically include itself into `truffle-config.js`. If installed globally, you will need to manually add the following to `truffle-config.js` in the root directory of your Truffle project to enable the plugin:\n\n\n```javascript\nmodule.exports = {\n    plugins: [ \"ganache-snapshot\" ]\n};\n```\n\nNote also that, currently, the `development` network of the truffle configuration should be uncommented.\nThat is, development network is the hardcoded web3Provider and is expected to be declared.\n\n### Usage Example - CLI\n\n```bash\n# Make sure that Ganache is running (in a separate terminal)\n\nSNAP_ID=$(truffle run snapshot make)\n# send some transaction...\ntruffle run snapshot revert $SNAP_ID\n```\n\n### Usage Example - truffle test\n\nAn example contract has been provided here and the use case is found in `test/example.js` with description.\nEssentially, the recipe to follow is;\n\n```js\nconst myContract = artifacts.require(\"SomeContract\")\nconst { makeSnapshot, revertSnapshot } = require(\"ganache-snapshot\")\n\nconst example = await myContract.new()           // Deploy contract\nconst snapID = (await makeSnapshot(web3)).result // Take a snapshot and keep returned ID\nawait example.sendTranaction()                   // Send TX\nawait revertSnapshot(snapID, web3)               // revert snapshot (by ID)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbh2smith%2Fganache-snapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbh2smith%2Fganache-snapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbh2smith%2Fganache-snapshot/lists"}