From a37a7542ea27d1462483a801c0ab24cefa78c6c1 Mon Sep 17 00:00:00 2001 From: Mahdi Yari <m.yary16@gmail.com> Date: Mon, 27 Apr 2020 16:58:18 +0430 Subject: [PATCH] Update examples --- examples/add-key-auth.js | 10 +++++----- examples/broadcast.html | 26 +++++++++++++------------- examples/get-post-content.js | 4 ++-- examples/index.html | 10 +++++----- examples/multisig.js | 4 ++-- examples/server.js | 18 +++++++++--------- examples/stream.html | 6 +++--- examples/test-vote.js | 4 ++-- examples/webpack-example/README.md | 4 ++-- examples/webpack-example/package.json | 4 ++-- examples/webpack-example/src/index.js | 4 ++-- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/examples/add-key-auth.js b/examples/add-key-auth.js index 9aff8d0..9d5969e 100644 --- a/examples/add-key-auth.js +++ b/examples/add-key-auth.js @@ -1,12 +1,12 @@ -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', diff --git a/examples/broadcast.html b/examples/broadcast.html index 170b652..3e63ecf 100644 --- a/examples/broadcast.html +++ b/examples/broadcast.html @@ -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> diff --git a/examples/get-post-content.js b/examples/get-post-content.js index 7e7ee39..dfe3a2a 100644 --- a/examples/get-post-content.js +++ b/examples/get-post-content.js @@ -1,4 +1,4 @@ -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)); diff --git a/examples/index.html b/examples/index.html index 2da043f..dd5b851 100644 --- a/examples/index.html +++ b/examples/index.html @@ -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> diff --git a/examples/multisig.js b/examples/multisig.js index a5dfbdb..4c5020e 100644 --- a/examples/multisig.js +++ b/examples/multisig.js @@ -1,9 +1,9 @@ -const steem = require('../lib'); +const hive = require('../lib'); const privWif1 = '5K2LA2ucS8b1GuFvVgZK6itKNE6fFMbDMX4GDtNHiczJESLGRd8'; const privWif2 = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg'; -steem.broadcast.send({ +hive.broadcast.send({ extensions: [], operations: [ ['vote', { diff --git a/examples/server.js b/examples/server.js index 71e35c5..334c23a 100644 --- a/examples/server.js +++ b/examples/server.js @@ -1,32 +1,32 @@ -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' diff --git a/examples/stream.html b/examples/stream.html index ba6fae9..5af5eea 100644 --- a/examples/stream.html +++ b/examples/stream.html @@ -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); }); diff --git a/examples/test-vote.js b/examples/test-vote.js index 6a70567..c7151f3 100644 --- a/examples/test-vote.js +++ b/examples/test-vote.js @@ -1,9 +1,9 @@ -const steem = require('../lib'); +const hive = require('../lib'); const username = 'guest123'; const wif = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg'; -steem +hive .broadcast .vote( wif, diff --git a/examples/webpack-example/README.md b/examples/webpack-example/README.md index b2a6ba4..7052ad3 100644 --- a/examples/webpack-example/README.md +++ b/examples/webpack-example/README.md @@ -1,5 +1,5 @@ -# `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 diff --git a/examples/webpack-example/package.json b/examples/webpack-example/package.json index 12ccc88..7f1a2fe 100644 --- a/examples/webpack-example/package.json +++ b/examples/webpack-example/package.json @@ -1,5 +1,5 @@ { - "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" } } diff --git a/examples/webpack-example/src/index.js b/examples/webpack-example/src/index.js index 0c4ed6a..cfd0a25 100644 --- a/examples/webpack-example/src/index.js +++ b/examples/webpack-example/src/index.js @@ -1,5 +1,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)); -- GitLab