![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@rishi556/dhive
Advanced tools
Robust Hive client library that runs in both node.js and the browser.
For node.js or the browser with browserify or webpack.
npm install @hiveio/dhive
Grab dist/dhive.js
from git and include in your html:
<script src="dhive.js"></script>
Or from the unpkg cdn:
<script src="https://unpkg.com/@hiveio/dhive@latest/dist/dhive.js"></script>
Make 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 for more information.
<script src="https://unpkg.com/@hiveio/dhive@latest/dist/dhive.js"></script>
<script>
var client = new dhive.Client(["https://api.hive.blog", "https://api.hivekings.com", "https://anyx.io", "https://api.openhive.network"]);
client.database
.getDiscussions("trending", { tag: "writing", limit: 1 })
.then(function(discussions) {
document.body.innerHTML += "<h1>" + discussions[0].title + "</h1>";
document.body.innerHTML += "<h2>by " + discussions[0].author + "</h2>";
document.body.innerHTML +=
'<pre style="white-space: pre-wrap">' + discussions[0].body + "</pre>";
});
</script>
See the demo source for an example on how to setup a livereloading TypeScript pipeline with wintersmith and browserify.
With TypeScript:
import { Client } from "@hiveio/dhive";
const client = new Client(["https://api.hive.blog", "https://api.hivekings.com", "https://anyx.io", "https://api.openhive.network"]);
for await (const block of client.blockchain.getBlocks()) {
console.log(`New block, id: ${block.block_id}`);
}
With JavaScript:
var dhive = require("@hiveio/dhive");
var client = new dhive.Client(["https://api.hive.blog", "https://api.hivekings.com", "https://anyx.io", "https://api.openhive.network"]);
var key = dhive.PrivateKey.fromLogin("username", "password", "posting");
client.broadcast
.vote(
{
voter: "username",
author: "almost-digital",
permlink: "dhive-is-the-best",
weight: 10000
},
key
)
.then(
function(result) {
console.log("Included in block: " + result.block_num);
},
function(error) {
console.error(error);
}
);
With ES2016 (node.js 7+):
const { Client } = require("@hiveio/dhive");
const client = new Client(["https://api.hive.blog", "https://api.hivekings.com", "https://anyx.io", "https://api.openhive.network"]);
async function main() {
const props = await client.database.getChainProperties();
console.log(`Maximum blocksize consensus: ${props.maximum_block_size} bytes`);
client.disconnect();
}
main().catch(console.error);
With node.js streams:
var dhive = require("@hiveio/dhive");
var es = require("event-stream"); // npm install event-stream
var util = require("util");
var client = new dhive.Client(["https://api.hive.blog", "https://api.hivekings.com", "https://anyx.io", "https://api.openhive.network"]);
var stream = client.blockchain.getBlockStream();
stream
.pipe(
es.map(function(block, callback) {
callback(null, util.inspect(block, { colors: true, depth: null }) + "\n");
})
)
.pipe(process.stdout);
The 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.
To 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.
Documentation available at https://hive.pages.syncad.com/dhive/
Share and Enjoy!
FAQs
Hive blockchain RPC client library
The npm package @rishi556/dhive receives a total of 1 weekly downloads. As such, @rishi556/dhive popularity was classified as not popular.
We found that @rishi556/dhive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.