Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const golos = require('golos');
- //const golos = require('steem');
- const app = express();
- var username = 'nikitavelesevich',
- password = 'P5JhQ13gpGf1C7kutZfardugM1NTKwiWf552LtJfZJDNyt72okM3';
- var wif = 'GLS5KtEb9UCjyhErj6AEoYDcb76oaDTjXX6qJ9bLf9rweNW1QoFFc'; //golos.auth.toWif(username, password, 'posting');
- var keys = golos.auth.generateKeys(username, password, ['posting'])
- /**
- * comment() add a post
- * @param {Base58} wif - private posting key
- * @param {String} parentAuthor - for add a post, empty field
- * @param {String} parentPermlink - main tag
- * @param {String} author - author of the post
- * @param {String} permlink - url-address of the post
- * @param {String} title - header of the post
- * @param {String} body - text of the post
- * @param {String} jsonMetadata - meta-data of the post (images etc.)
- */
- golos.api.getBlock('29404', function(err, result) {
- console.log(err, result);
- });
- var wif = '5J7hT52s4yYLop5JMNu4oRLoBVtNABG74XbG88m7t7VvpD7f1pS';//keys['posting'];
- var parentAuthor = '';
- var parentPermlink = 'vox-populi';
- var author = username;
- var permlink = 'test-url';
- var title = 'test';
- var body = 'test2';
- var jsonMetadata = '{}';
- var commentPermlink = golos.formatter.commentPermlink(parentAuthor, parentPermlink).toLowerCase();
- console.log(commentPermlink);
- // => 're-ned-a-selfie-20170621t080403765z'
- golos.broadcast.comment(wif, parentAuthor, parentPermlink, author, commentPermlink, title, body, jsonMetadata, function(err, result) {
- //console.log(err, result);
- if (!err) {
- console.log('comment', result);
- }
- else console.error(err);
- });
- app.get('/', (req, res) => res.send('Hello World!'));
- app.listen(8000, () => console.log('Example app listening on port 8000!'))
- /*
- 29404
- re--vox-populi-20180225t003631495z
- Example app listening on port 8000!
- comment { ref_block_num: 29672,
- ref_block_prefix: 1199962799,
- expiration: '2018-02-25T00:36:46',
- operations: [ [ 'comment', [Object] ] ],
- extensions: [],
- signatures:
- [ '1f5144b71bbda6e77dab5647e110bc7d0c8c913ced7c500b9dd2addcf5f6ba87ed0cb0e985a388d927eb986d51ecccb64b3e68ce279699b0bd1bdcccf14040adab' ] }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement