{"_id":"@boutvalentin/dhive","name":"@boutvalentin/dhive","dist-tags":{"latest":"1.2.8"},"versions":{"1.2.8":{"name":"@boutvalentin/dhive","version":"1.2.8","description":"Hive blockchain RPC client library","author":{"name":"hive-network"},"license":"BSD-3-Clause-No-Military-License","main":"./lib/index-node","typings":"./lib/index","browser":{"./lib/index-node":"./dist/dhive.js","./src/index-node":"./dist/dhive.js","./src/version":"./lib/version.js"},"repository":{"type":"git","url":"https://gitlab.syncad.com/hive/dhive"},"scripts":{"lint":"make lint","test":"make ci-test","prepublish":"make all"},"keywords":["blockchain","client","rpc","hive","dhive"],"dependencies":{"bigi":"^1.4.2","bs58":"^4.0.1","bytebuffer":"^5.0.1","core-js":"^3.6.4","cross-fetch":"^3.0.4","ecurve":"^1.0.6","https":"^1.0.0","jsbi":"^3.1.4","node-fetch":"^2.6.0","ripemd160":"^2.0.2","secp256k1":"^3.8.0","verror":"^1.10.0","whatwg-fetch":"^3.0.0"},"devDependencies":{"@babel/core":"^7.1.6","@babel/preset-env":"^7.1.6","@types/bytebuffer":"^5.0.33","@types/mocha":"^5.2.5","@types/node":"^13.9.2","@types/verror":"^1.10.3","@typescript-eslint/eslint-plugin":"^2.24.0","@typescript-eslint/eslint-plugin-tslint":"^2.24.0","@typescript-eslint/parser":"^2.24.0","babelify":"^10.0.0","browserify":"^16.2.3","coveralls":"^3.0.11","derequire":"^2.0.6","dts-generator":"^2.1.0","encoding":"^0.1.12","eslint":"^6.8.0","eslint-plugin-import":"^2.20.1","eslint-plugin-prefer-arrow":"^1.1.7","karma":"^4.4.1","karma-browserify":"^5.1.1","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","karma-sauce-launcher":"^1.2.0","lorem-ipsum":"^1.0.6","mocha":"^7.1.1","nyc":"^15.0.0","regenerator-runtime":"^0.13.1","ts-node":"^8.7.0","tsify":"^4.0.0","tslint":"^5.11.0","typedoc":"^0.17.1","typescript":"^3.8.3","uglify-js":"^3.4.9","watchify":"^3.11.0"},"_id":"@boutvalentin/dhive@1.2.8","gitHead":"a0ff5dfbd53c48e174c1ab1e38b1043f8a6aa59d","_nodeVersion":"18.17.1","_npmVersion":"10.0.0","dist":{"integrity":"sha512-w+8QRSPVDvJ+aeS1yUj3ZiYzSzaV/DMfwH2PKowSOY/btuwd5NA1kUtiKCs2avAGQjfNlgL2XXQe+Stw3gTyvg==","shasum":"59f90019999690a77101a2add4ed0cfc71a2316c","tarball":"https://registry.npmjs.org/@boutvalentin/dhive/-/dhive-1.2.8.tgz","fileCount":61,"unpackedSize":2409650,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMuh6GJZHtZquhbCxXN794FySWprQCfHohkUbo+S5ZugIhALKBLtP9PSyOuYSELjp+gWZqCYlIs6A24fd4feq/exqz"}]},"_npmUser":{"name":"boutvalentin","email":"valentin.bout.pro@gmail.com"},"directories":{},"maintainers":[{"name":"boutvalentin","email":"valentin.bout.pro@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dhive_1.2.8_1703884903313_0.18828020135631518"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-29T21:21:43.241Z","1.2.8":"2023-12-29T21:21:43.559Z","modified":"2023-12-29T21:21:43.815Z"},"maintainers":[{"name":"boutvalentin","email":"valentin.bout.pro@gmail.com"}],"description":"Hive blockchain RPC client library","keywords":["blockchain","client","rpc","hive","dhive"],"repository":{"type":"git","url":"https://gitlab.syncad.com/hive/dhive"},"author":{"name":"hive-network"},"license":"BSD-3-Clause-No-Military-License","readme":"# [dhive](https://github.com)\n\nRobust hive client library that runs in both node.js and the browser.\n\nNeeds test net urls, chain id\n\n---\n\n**note** As of version 0.7.0 WebSocket support has been removed. The only transport provided now is HTTP(2). For most users the only change required is to swap `wss://` to `https://` in the address. If you run your own full node make sure to set the proper [CORS headers](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) if you plan to access it from a browser.\n\n---\n\n## Browser compatibility\n\n[![Build Status](https://saucelabs.com/browser-matrix/feruzm-dhive.svg)](https://saucelabs.com/open_sauce/user/feruzm-dhive)\n\n## Installation\n\n### Via npm\n\nFor node.js or the browser with [browserify](https://github.com/substack/node-browserify) or [webpack](https://github.com/webpack/webpack).\n\n```\nnpm install @hiveio/dhive\n```\n\n### From cdn or self-hosted script\n\nGrab `dist/dhive.js` from git and include in your html:\n\n```html\n<script src=\"@hiveio/dhive.js\"></script>\n```\n\nOr from the [unpkg](https://unpkg.com) cdn:\n\n```html\n<script src=\"https://unpkg.com/@hiveio/dhive@latest/dist/dhive.js\"></script>\n```\n\nMake sure to set the version you want when including from the cdn, you can also use `dhive@latest` but that is not always desirable. See [unpkg.com](https://unpkg.com) for more information.\n\n## Usage\n\n### In the browser\n\n```html\n<script src=\"https://unpkg.com/@hiveio/dhive@latest/dist/dhive.js\"></script>\n<script>\n  var client = new dhive.Client([\"https://api.hive.blog\", \"https://api.hivekings.com\", \"https://anyx.io\", \"https://api.openhive.network\"]);\n  client.database\n    .getDiscussions(\"trending\", { tag: \"writing\", limit: 1 })\n    .then(function(discussions) {\n      document.body.innerHTML += \"<h1>\" + discussions[0].title + \"</h1>\";\n      document.body.innerHTML += \"<h2>by \" + discussions[0].author + \"</h2>\";\n      document.body.innerHTML +=\n        '<pre style=\"white-space: pre-wrap\">' + discussions[0].body + \"</pre>\";\n    });\n</script>\n```\n\nSee the [demo source](https://github.com/openhive-network/dhive/tree/master/examples/comment-feed) for an example on how to setup a livereloading TypeScript pipeline with [wintersmith](https://github.com/jnordberg/wintersmith) and [browserify](https://github.com/substack/node-browserify).\n\n### In node.js\n\nWith TypeScript:\n\n```typescript\nimport { Client } from \"@hiveio/dhive\";\n\nconst client = new Client([\"https://api.hive.blog\", \"https://api.hivekings.com\", \"https://anyx.io\", \"https://api.openhive.network\"]);\n\nfor await (const block of client.blockchain.getBlocks()) {\n  console.log(`New block, id: ${block.block_id}`);\n}\n```\n\nWith JavaScript:\n\n```javascript\nvar dhive = require(\"@hiveio/dhive\");\n\nvar client = new dhive.Client([\"https://api.hive.blog\", \"https://api.hivekings.com\", \"https://anyx.io\", \"https://api.openhive.network\"]);\nvar key = dhive.PrivateKey.fromLogin(\"username\", \"password\", \"posting\");\n\nclient.broadcast\n  .vote(\n    {\n      voter: \"username\",\n      author: \"almost-digital\",\n      permlink: \"dhive-is-the-best\",\n      weight: 10000\n    },\n    key\n  )\n  .then(\n    function(result) {\n      console.log(\"Included in block: \" + result.block_num);\n    },\n    function(error) {\n      console.error(error);\n    }\n  );\n```\n\nWith ES2016 (node.js 7+):\n\n```javascript\nconst { Client } = require(\"@hiveio/dhive\");\n\nconst client = new Client([\"https://api.hive.blog\", \"https://api.hivekings.com\", \"https://anyx.io\", \"https://api.openhive.network\"]);\n\nasync function main() {\n  const props = await client.database.getChainProperties();\n  console.log(`Maximum blocksize consensus: ${props.maximum_block_size} bytes`);\n  client.disconnect();\n}\n\nmain().catch(console.error);\n```\n\nWith node.js streams:\n\n```javascript\nvar dhive = require(\"@hiveio/dhive\");\nvar es = require(\"event-stream\"); // npm install event-stream\nvar util = require(\"util\");\n\nvar client = new dhive.Client([\"https://api.hive.blog\", \"https://api.hivekings.com\", \"https://anyx.io\", \"https://api.openhive.network\"]);\n\nvar stream = client.blockchain.getBlockStream();\n\nstream\n  .pipe(\n    es.map(function(block, callback) {\n      callback(null, util.inspect(block, { colors: true, depth: null }) + \"\\n\");\n    })\n  )\n  .pipe(process.stdout);\n```\n\n## Bundling\n\nThe easiest way to bundle dhive (with browserify, webpack etc.) is to just `npm install @hiveio/dhive` and `require('@hiveio/dhive')` which will give you well-tested (see browser compatibility matrix above) pre-bundled code guaranteed to JustWork™. However, that is not always desirable since it will not allow your bundler to de-duplicate any shared dependencies dhive and your app might have.\n\nTo allow for deduplication you can `require('@hiveio/dhive/lib/index-browser')`, or if you plan to provide your own polyfills: `require('@hiveio/dhive/lib/index')`. See `src/index-browser.ts` for a list of polyfills expected.\n\n---\n\n_Share and Enjoy!_\n","readmeFilename":"README.md"}