{"id":13733969,"url":"https://github.com/bitshares/bitsharesjs-ws","last_synced_at":"2025-05-13T12:52:54.578Z","repository":{"id":16150827,"uuid":"79458433","full_name":"bitshares/bitsharesjs-ws","owner":"bitshares","description":"Javascript websocket interface for BitShares","archived":false,"fork":false,"pushed_at":"2025-02-19T15:47:57.000Z","size":1259,"stargazers_count":30,"open_issues_count":2,"forks_count":119,"subscribers_count":14,"default_branch":"develop","last_synced_at":"2025-05-05T18:22:50.850Z","etag":null,"topics":["bitshares","blockchain","javascript","js-library","reactjs","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/bitshares.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-01-19T13:57:49.000Z","updated_at":"2025-02-19T15:47:57.000Z","dependencies_parsed_at":"2023-01-13T18:43:20.831Z","dependency_job_id":"4df03eb8-52a3-4bc4-abb9-dc279c88ade3","html_url":"https://github.com/bitshares/bitsharesjs-ws","commit_stats":{"total_commits":126,"total_committers":16,"mean_commits":7.875,"dds":0.6428571428571428,"last_synced_commit":"ea4eeb79a6688d16f59cab32ed48c19328f6c8ea"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitsharesjs-ws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitsharesjs-ws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitsharesjs-ws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitsharesjs-ws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitshares","download_url":"https://codeload.github.com/bitshares/bitsharesjs-ws/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253947844,"owners_count":21988945,"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":["bitshares","blockchain","javascript","js-library","reactjs","websocket"],"created_at":"2024-08-03T03:00:51.391Z","updated_at":"2025-05-13T12:52:54.547Z","avatar_url":"https://github.com/bitshares.png","language":"JavaScript","funding_links":[],"categories":["Libraries"],"sub_categories":["JavaScript Libraries"],"readme":"# Bitshares websocket interface (bitsharesjs-ws)\n\nPure JavaScript Bitshares websocket library for node.js and browsers. Can be used to easily connect to and obtain data from the Bitshares blockchain via public apis or local nodes.\n\nCredit for the original implementation goes to [jcalfeee](https://github.com/jcalfee).\n\n[![npm version](https://img.shields.io/npm/v/bitsharesjs-ws.svg?style=flat-square)](https://www.npmjs.com/package/bitsharesjs-ws)\n[![npm downloads](https://img.shields.io/npm/dm/bitsharesjs-ws.svg?style=flat-square)](https://www.npmjs.com/package/bitsharesjs-ws)\n\n\n## Setup\n\nThis library can be obtained through npm:\n```\nnpm install bitsharesjs-ws\n```\n\n## Usage\n\nSeveral examples are available in the /examples folder, and the tests in /test also show how to use the library.\n\nBrowser bundles are provided in /build/, for testing purposes you can access this from rawgit:\n\n```\n\u003cscript type=\"text/javascript\" src=\"https://cdn.rawgit.com/bitshares/bitsharesjs-ws/build/bitsharesjs-ws.js\" /\u003e\n```\n\nA variable bitshares_ws will be available in window.\n\nFor use in a webpack/browserify context, see the example below for how to open a websocket connection to the Openledger API and subscribe to any object updates:\n\n```\nvar {Apis} = require(\"bitsharesjs-ws\");\nApis.instance(\"wss://bitshares.openledger.info/ws\", true).init_promise.then((res) =\u003e {\n    console.log(\"connected to:\", res[0].network);\n    Apis.db.set_subscribe_callback( updateListener, true )\n});\n\nfunction updateListener(object) {\n    console.log(\"set_subscribe_callback:\\n\", object);\n}\n```\nThe `set_subscribe_callback` callback (updateListener) will be called whenever an object on the blockchain changes or is removed. This is very powerful and can be used to listen to updates for specific accounts, assets or most anything else, as all state changes happen through object updates. Be aware though that you will receive quite a lot of data this way.\n\n# Witness node endpoints\nThis is a non-exhaustive list of endpoints available from the witness_node executable, which provides the API server of Bitshares.\n\n## Public API \nPlease see all available methods in the [official documentation](http://docs.bitshares.dev/en/master/api/blockchain_api.html).\n\n### Database API\n\nTo access the [Database API](http://docs.bitshares.dev/en/master/api/blockchain_api/database.html), you can use the `Apis.db` object.\n\n__Usage example__\n`Apis.db.get_objects([\"1.3.0\", \"2.0.0\", \"2.1.0\"])`\n\n### History API\n\nTo access the [Account History API](http://docs.bitshares.dev/en/master/api/blockchain_api/history.html), you can use the `Apis.history` object.\n\n__Usage example__\n`Apis.history.get_account_history(\"1.2.849826\", \"1.11.0\", 10, \"1.11.0\")`\n\n## Tests\n\nThe tests show several use cases, to run, simply type `npm run test`. The tests require a local witness node to be running, as well as an active internet connection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitshares%2Fbitsharesjs-ws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitshares%2Fbitsharesjs-ws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitshares%2Fbitsharesjs-ws/lists"}