{"_id":"@digicat/ethereum-finality-watcher","_rev":"10-331b31b7334d5a8db16a0bbd2267b707","name":"@digicat/ethereum-finality-watcher","description":"Observes blocks on a web3.js-compatible Ethereum network, providing callbacks for when a block is considered final","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@digicat/ethereum-finality-watcher","version":"1.0.0","description":"Observes blocks on a web3.js-compatible Ethereum network, providing callbacks for when a block is considered final","main":"index.js","files":["index.js","lib"],"engines":{"node":">=8.6"},"scripts":{"coverage":"nyc npm test","lint":"as-i-preach","posttest":"as-i-preach","test":"ava"},"repository":{"type":"git","url":"git+https://github.com/CDECatapult/ethereum-finality-watcher.git"},"author":{"name":"Digital Catapult","url":"https://www.digitalcatapultcentre.org.uk/"},"license":"Apache-2.0","bugs":{"url":"https://github.com/CDECatapult/ethereum-finality-watcher/issues"},"homepage":"https://github.com/CDECatapult/ethereum-finality-watcher#readme","keywords":["blockchain","contract","ethereum","transaction","web3"],"dependencies":{"lru-cache":"^4.1.1","web3":"^0.19.1"},"devDependencies":{"@novemberborn/as-i-preach":"^10.1.0","ava":"^0.22.0","codecov":"^2.3.1","delay":"^2.0.0","ganache-core":"github:CDECatapult/ganache-core#64ee0a3d8d4f46020480f20eae335754b4fb9290","lolex":"^2.1.2","memdown":"^1.4.0","nyc":"^11.2.1","testdouble":"^3.2.6"},"nyc":{"reporter":["html","lcov","text"]},"standard-engine":"@novemberborn/as-i-preach","gitHead":"2a574574eea214289fca7b3cec1cc795c33028b1","_id":"@digicat/ethereum-finality-watcher@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"novemberborn","email":"mark@novemberborn.net"},"dist":{"integrity":"sha512-nz+MqlQN/3N2uPhgVSZDMoT3XFVcGIDrB1IFIyz9LDBYw2Ah5+EPjsjQJ9XibMurgRFyczk4MH5li/jflSW6OA==","shasum":"4e21ee3436835eb23dd05a1b7eba8912ef4ab416","tarball":"https://registry.npmjs.org/@digicat/ethereum-finality-watcher/-/ethereum-finality-watcher-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBzlSQ8dvasAvnfbsa/GJ3L+eqwoYKLqBG633bzyTwQYAiAuPUrmf21Fs2ceqXzY+eu721kCgqbghyQW1QRd8YnoWQ=="}]},"maintainers":[{"name":"novemberborn","email":"mark@novemberborn.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ethereum-finality-watcher-1.0.0.tgz_1508252751181_0.13979783444665372"},"directories":{}}},"readme":"# @digicat/ethereum-finality-watcher\n\nThis package can observe blocks on a\n[web3.js](https://github.com/ethereum/web3.js/)-compatible\n[Ethereum](https://ethereum.org/) network, providing callbacks for when a block\nis considered final. Requires [Node.js](https://nodejs.org/en/) 8 or newer.\n\n## Usage\n\n```js\nconst FinalityWatcher = require('@digicat/ethereum-finality-watcher')\n\nconst watcher = new FinalityWatcher({\n  // Number of blocks that need to be added before an earlier block is\n  // considered final. Defaults to 0.\n  blockchainConfirmationDelay: 0,\n  ethereumNode: 'http://localhost:8545',\n  interval: 30000, // Interval on which we check for finality. Default is 30s.\n\n  onError (err) {\n    // Called when an error occurred. Expected to be synchronous.\n  },\n\n  wrapWeb3Error (err) {\n    // Allows for underlying Web3 errors to be wrapped in another Error class.\n    // By default returns the error as-is.\n    return err\n  }\n})\n\n// Checks if the hash for the given block number, once that block is final,\n// equals the given hash.\n//\n// Returns a promise that is fulfilled with the `true` if the final hash is\n// indeed the same, `false` otherwise. The promise never rejects, and if the\n// watcher is stopped the promise will remain pending.\nconst result = await watcher.isFinal(42, '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3')\n\n// Stops the watcher.\nwatcher.stop()\n```\n","maintainers":[{"email":"it-ops@digicatapult.org.uk","name":"digiops"},{"email":"david.blane@digicatapult.org.uk","name":"dhblane"},{"email":"matthew.dean@digicatapult.org.uk","name":"mattdean-digicatapult"}],"time":{"modified":"2022-06-30T11:12:56.270Z","created":"2017-10-17T15:05:52.140Z","1.0.0":"2017-10-17T15:05:52.140Z"},"homepage":"https://github.com/CDECatapult/ethereum-finality-watcher#readme","keywords":["blockchain","contract","ethereum","transaction","web3"],"repository":{"type":"git","url":"git+https://github.com/CDECatapult/ethereum-finality-watcher.git"},"author":{"name":"Digital Catapult","url":"https://www.digitalcatapultcentre.org.uk/"},"bugs":{"url":"https://github.com/CDECatapult/ethereum-finality-watcher/issues"},"license":"Apache-2.0","readmeFilename":"README.md"}