From c70a3f32ccb526de1c4dd2a00d1c12438229fda8 Mon Sep 17 00:00:00 2001 From: Maximiliaan van Dijk Date: Sun, 15 Apr 2018 19:30:13 +0200 Subject: [PATCH 1/2] Added resteem functionality to Responder --- dist/responder.js | 27 +++++++++++++++++++++++++++ src/responder.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/dist/responder.js b/dist/responder.js index d38ea88..8fffe68 100644 --- a/dist/responder.js +++ b/dist/responder.js @@ -207,6 +207,33 @@ var Responder = function () { return _steem2.default.broadcast.voteAsync(wif, this.responderUsername, targetUsername, targetPermlink, votingWeight); } + }, { + key: 'resteem', + value: function resteem() { + var targetUsername = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.targetUsername; + var targetPermlink = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.targetPermlink; + + this._throwErrorIfNoKey(); + this._throwErrorIfNoPermlink(targetPermlink); + + var wif = this.postingKey || this.activeKey; + + var action = JSON.stringify(['reblog'], { + account: this.responserUsername, + author: targetUsername, + permlink: targetPermlink + }); + + return _steem2.default.broadcast.customJsonAsync(wif, [], [this.responderUsername], 'follow', action); + } + }, { + key: 'resteemOnMemo', + value: function resteemOnMemo() { + var customTargetUsername = extractUsernameFromLink(this.transferMemo); + var customTarget = extractPermlinkFromLink(this.transferMemo); + + return this.resteem(customTargetUsername, customTarget); + } }, { key: 'upvoteOnMemo', value: function upvoteOnMemo() { diff --git a/src/responder.js b/src/responder.js index 2d81cd6..c63aff3 100644 --- a/src/responder.js +++ b/src/responder.js @@ -219,6 +219,37 @@ export default class Responder { ); } + resteem( + targetUsername = this.targetUsername, + targetPermlink = this.targetPermlink + ) { + this._throwErrorIfNoKey(); + this._throwErrorIfNoPermlink(targetPermlink); + + const wif = this.postingKey || this.activeKey; + + const action = JSON.stringify(['reblog'], { + account: this.responserUsername, + author: targetUsername, + permlink: targetPermlink + }) + + return steem.broadcast.customJsonAsync( + wif, + [], + [this.responderUsername], + 'follow', + action + ) + } + + resteemOnMemo() { + const customTargetUsername = extractUsernameFromLink(this.transferMemo) + const customTarget = extractPermlinkFromLink(this.transferMemo) + + return this.resteem(customTargetUsername, customTarget) + } + upvoteOnMemo(votingPercentage = 100.0) { const customTargetUsername = extractUsernameFromLink(this.transferMemo); const customTargetPermlink = extractPermlinkFromLink(this.transferMemo); From a54fe192a97e93be0682a1dfe9398fdfdbe7147e Mon Sep 17 00:00:00 2001 From: Maximiliaan van Dijk Date: Mon, 16 Apr 2018 20:33:37 +0200 Subject: [PATCH 2/2] Fixed indent to 2 lines --- src/responder.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/responder.js b/src/responder.js index c63aff3..3c764c7 100644 --- a/src/responder.js +++ b/src/responder.js @@ -227,28 +227,28 @@ export default class Responder { this._throwErrorIfNoPermlink(targetPermlink); const wif = this.postingKey || this.activeKey; - - const action = JSON.stringify(['reblog'], { - account: this.responserUsername, - author: targetUsername, - permlink: targetPermlink - }) - - return steem.broadcast.customJsonAsync( - wif, - [], - [this.responderUsername], - 'follow', - action - ) + + const action = JSON.stringify(['reblog'], { + account: this.responserUsername, + author: targetUsername, + permlink: targetPermlink + }) + + return steem.broadcast.customJsonAsync( + wif, + [], + [this.responderUsername], + 'follow', + action + ) } - + resteemOnMemo() { - const customTargetUsername = extractUsernameFromLink(this.transferMemo) - const customTarget = extractPermlinkFromLink(this.transferMemo) + const customTargetUsername = extractUsernameFromLink(this.transferMemo) + const customTarget = extractPermlinkFromLink(this.transferMemo) - return this.resteem(customTargetUsername, customTarget) - } + return this.resteem(customTargetUsername, customTarget) + } upvoteOnMemo(votingPercentage = 100.0) { const customTargetUsername = extractUsernameFromLink(this.transferMemo);