Skip to content
Snippets Groups Projects
Commit a37a7542 authored by Mahdi Yari's avatar Mahdi Yari
Browse files

Update examples

parent cb8c2337
No related branches found
No related tags found
1 merge request!4Fix browserbuild and readme
const steem = require('../lib');
const hive = require('../lib');
/* Generate private active WIF */
const username = process.env.STEEM_USERNAME;
const password = process.env.STEEM_PASSWORD;
const privActiveWif = steem.auth.toWif(username, password, 'active');
const username = process.env.HIVE_USERNAME;
const password = process.env.HIVE_PASSWORD;
const privActiveWif = hive.auth.toWif(username, password, 'active');
/** Add posting key auth */
steem.broadcast.addKeyAuth({
hive.broadcast.addKeyAuth({
signingKey: privActiveWif,
username,
authorizedKey: 'STM88CPfhCmeEzCnvC1Cjc3DNd1DTjkMcmihih8SSxmm4LBqRq5Y9',
......
......@@ -2,22 +2,22 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Steem.js Broadcast</title>
<title>Hive.js Broadcast</title>
</head>
<body>
<script src="../dist/steem.min.js"></script>
<script src="../dist/hive.min.js"></script>
<script>
/** Configure your account */
var username = 'guest123';
var postingWif = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg';
/** Broadcast a vote */
steem.broadcast.vote(
hive.broadcast.vote(
postingWif,
username, // Voter
'firepower', // Author
'steemit-veni-vidi-vici-steemfest-2016-together-we-made-it-happen-thank-you-steemians', // Permlink
'hiveio', // Author
'announcing-the-launch-of-hive-blockchain', // Permlink
10000, // Weight (10000 = 100%)
function(err, result) {
console.log(err, result);
......@@ -27,7 +27,7 @@
/** Broadcast a comment */
var permlink = new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase();
steem.broadcast.comment(
hive.broadcast.comment(
postingWif,
'siol', // Parent Author
'test', // Parent Permlink
......@@ -35,7 +35,7 @@
permlink, // Permlink
'', // Title
'This is a test!', // Body
{ tags: ['test'], app: 'steemjs/examples' }, // Json Metadata
{ tags: ['test'], app: 'hivejs/examples' }, // Json Metadata
function(err, result) {
console.log(err, result);
}
......@@ -44,7 +44,7 @@
/** Broadcast a post */
var permlink = new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase();
steem.broadcast.comment(
hive.broadcast.comment(
postingWif,
'', // Leave parent author empty
'photography', // Main tag
......@@ -52,7 +52,7 @@
permlink + '-post', // Permlink
'This is just a test!', // Title
'Nothing to see here', // Body
{ tags: ['test'], app: 'steemjs/examples' }, // Json Metadata
{ tags: ['test'], app: 'hivejs/examples' }, // Json Metadata
function(err, result) {
console.log(err, result);
}
......@@ -60,7 +60,7 @@
/** Follow an user */
var follower = username; // Your username
var following = 'steemjs'; // User to follow
var following = 'hiveio'; // User to follow
var json = JSON.stringify(
['follow', {
......@@ -70,7 +70,7 @@
}]
);
steem.broadcast.customJson(
hive.broadcast.customJson(
postingWif,
[], // Required_auths
[follower], // Required Posting Auths
......@@ -90,7 +90,7 @@
}]
);
steem.broadcast.customJson(
hive.broadcast.customJson(
postingWif,
[], // Required_auths
[follower], // Required Posting Auths
......@@ -103,4 +103,4 @@
</script>
</body>
</html>
\ No newline at end of file
</html>
const steem = require('../lib');
const hive = require('../lib');
const resultP = steem.api.getContentAsync('yamadapc', 'test-1-2-3-4-5-6-7-9');
const resultP = hive.api.getContentAsync('hiveio', 'announcing-the-launch-of-hive-blockchain');
resultP.then(result => console.log(result));
......@@ -2,19 +2,19 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Steem.js</title>
<title>Hive.js</title>
</head>
<body>
<script src="../dist/steem.min.js"></script>
<script src="../dist/hive.min.js"></script>
<script>
steem.api.getConfig(function(err, response){
hive.api.getConfig(function(err, response){
console.log(err, response);
});
steem.api.getAccounts(['ned', 'dan'], function(err, response){
hive.api.getAccounts(['hiveio', 'mahdiyari'], function(err, response){
console.log(err, response);
});
steem.api.getAccountCount(function(err, response){
hive.api.getAccountCount(function(err, response){
console.log(err, response);
});
</script>
......
const steem = require('../lib');
const hive = require('../lib');
const privWif1 = '5K2LA2ucS8b1GuFvVgZK6itKNE6fFMbDMX4GDtNHiczJESLGRd8';
const privWif2 = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg';
steem.broadcast.send({
hive.broadcast.send({
extensions: [],
operations: [
['vote', {
......
var steem = require('../lib');
var hive = require('../lib');
steem.api.getAccountCount(function(err, result) {
hive.api.getAccountCount(function(err, result) {
console.log(err, result);
});
steem.api.getAccounts(['dan'], function(err, result) {
hive.api.getAccounts(['hiveio'], function(err, result) {
console.log(err, result);
var reputation = steem.formatter.reputation(result[0].reputation);
var reputation = hive.formatter.reputation(result[0].reputation);
console.log(reputation);
});
steem.api.getState('trending/steemit', function(err, result) {
hive.api.getState('trending/hive', function(err, result) {
console.log(err, result);
});
steem.api.getFollowing('ned', 0, 'blog', 10, function(err, result) {
hive.api.getFollowing('hiveio', 0, 'blog', 10, function(err, result) {
console.log(err, result);
});
steem.api.getFollowers('dan', 0, 'blog', 10, function(err, result) {
hive.api.getFollowers('hiveio', 0, 'blog', 10, function(err, result) {
console.log(err, result);
});
steem.api.streamOperations(function(err, result) {
hive.api.streamOperations(function(err, result) {
console.log(err, result);
});
steem.api.getDiscussionsByActive({
hive.api.getDiscussionsByActive({
limit: 10,
start_author: 'thecastle',
start_permlink: 'this-week-in-level-design-1-22-2017'
......
......@@ -2,13 +2,13 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Steem.js Stream</title>
<title>Hive.js Stream</title>
</head>
<body>
<script src="../dist/steem.min.js"></script>
<script src="../dist/hive.min.js"></script>
<script>
steem.api.streamOperations(function (err, operations) {
hive.api.streamOperations(function (err, operations) {
operations.forEach(function (operation) {
console.log(operation);
});
......
const steem = require('../lib');
const hive = require('../lib');
const username = 'guest123';
const wif = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg';
steem
hive
.broadcast
.vote(
wif,
......
# `steem-js` webpack configuration example
This is a demo of `steem-js` and webpack usage targetting both the Web and
# `hive-js` webpack configuration example
This is a demo of `hive-js` and webpack usage targetting both the Web and
Node.js platforms.
## Compiling the example
......
{
"name": "steem-js-webpack-example",
"name": "hive-js-webpack-example",
"scripts": {
"build": "npm run build-web && npm run build-node",
"build-web": "webpack",
......@@ -10,6 +10,6 @@
"webpack": "^3.0.0"
},
"dependencies": {
"steem": "^0.5.20"
"hive": "^0.0.5"
}
}
const steem = require('steem/lib/browser');
const hive = require('hive/lib/browser');
console.log('Getting post content...');
const resultP = steem.api.getContentAsync('yamadapc', 'test-1-2-3-4-5-6-7-9');
const resultP = hive.api.getContentAsync('yamadapc', 'test-1-2-3-4-5-6-7-9');
resultP.then(result => console.log(result));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment