{"id":20392388,"url":"https://github.com/wiseplat/meteor-package-blocks","last_synced_at":"2025-07-03T05:04:49.860Z","repository":{"id":122792511,"uuid":"120949150","full_name":"WISEPLAT/meteor-package-blocks","owner":"WISEPLAT","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-09T19:58:33.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-10T13:33:38.104Z","etag":null,"topics":[],"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/WISEPLAT.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-09T19:53:58.000Z","updated_at":"2018-02-09T19:58:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"e82f8059-5216-45d2-94df-168cf81f9c6c","html_url":"https://github.com/WISEPLAT/meteor-package-blocks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WISEPLAT/meteor-package-blocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fmeteor-package-blocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fmeteor-package-blocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fmeteor-package-blocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fmeteor-package-blocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WISEPLAT","download_url":"https://codeload.github.com/WISEPLAT/meteor-package-blocks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WISEPLAT%2Fmeteor-package-blocks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263264640,"owners_count":23439247,"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":[],"created_at":"2024-11-15T03:43:35.722Z","updated_at":"2025-07-03T05:04:49.814Z","avatar_url":"https://github.com/WISEPLAT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wiseplat blocks\n\nProvides you with an `WshBlocks` collection, which stores the last 50 blocks.\n\nYou can query blocks like any other Meteor collection.\n\n## Installation\n\n    $ meteor add wiseplat:blocks\n\n## Usage\n\nInitialize Blocks on the start of your application, as soon as you have a wiseplat connection:\n\n```js\nWshBlocks.init();\n```\n\n### Last block\n\nTo get the latest block use:\n\n```js\nWshBlocks.latest;\n```\n\nNote this property is reactive, so it will re-run your reactive functions, e.g. when used in template helpers.\n\nIn case you want to update the latest block you can change properties as follows:\n\n```js\nWshBlocks.latest = {hash: '12345'};\n```\n\nThis would only change the hash property of the latest block, but leave all other properties as is.\n\n### Current gas price\n\nAdditionally all blocks get the current gasprice add:\n\n```js\nWshBlocks.latest.gasPrice; // '1136672632018' (wei)\n```\n\n### Detecting forks\n\nYou can call `Blocks.detectFork(callback)` to detect chain re-organisation (forks), while your applications is running.\nThis detection, is checking the new incoming blocks `parentHash`, with the last known block you have.\n\n**Note** The fork detection can currently be wrong, when you're importing blocks, as they can come in different orders.\n\n```js\nWshBlocks.detectFork(function(oldBlock, newBlock){\n  // this callback will be fired with the old block we knew and the new block.\n});\n```\n\nNote you can call `WshBlocks.detectFork(cb)` mutliple times, to add multiple callbacks.\n\n\n### Clear all stored blocks\n\nIf you switch to a chain, which has a lower block number WshBlocks will reset your interally cache of the last 50 blocks.\nIf you want to do that manually call:\n\n```js\nWshBlocks.clear();\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseplat%2Fmeteor-package-blocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiseplat%2Fmeteor-package-blocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiseplat%2Fmeteor-package-blocks/lists"}