From fa2c996195cada345e92612c9616829ae988ec89 Mon Sep 17 00:00:00 2001 From: Howo <drov.fr@protonmail.com> Date: Fri, 4 Jun 2021 11:29:10 +0000 Subject: [PATCH] Support for recurrent transfer op --- doc/README.md | 20 ++++++++++++++++++++ package.json | 2 +- src/auth/serializer/src/operations.js | 13 +++++++++++++ src/broadcast/operations.js | 13 +++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index c2da520..2c2deab 100644 --- a/doc/README.md +++ b/doc/README.md @@ -2044,6 +2044,26 @@ hive.broadcast.transfer(wif, from, to, amount, memo, function(err, result) { |amount|Amount of of asset to transfer|String|"X.XXX ASSET" must have 3 decimal places. e.g. "5.150 HBD"| |function()|Your callback|function|| +See also: [recurrentTransfer](#recurrent-transfer) + +### Recurrent Transfer +Transfers assets, such as HIVE or HBD, from one account to another. +```js +hive.broadcast.recurrentTransfer(wif, from, to, amount, memo, recurrence, executions, extensions, function(err, result) { + console.log(err, result); +}); +``` + +|Parameter|Description|Datatype|Notes| +|---|---|---|---| +|wif|Active private key for the `from` account|String|| +|from|Account name to take asset from|String|No leading @ symbol| +|to|Account name to place asset into|String|No leading @ symbol| +|amount|Amount of of asset to transfer|String|"X.XXX ASSET" must have 3 decimal places. e.g. "5.150 HBD"| +|recurrence|How often will the payment be triggered|Integer|e.g. 48 - unit: hours| +|executions|The times the recurrent payment will be executed|Integer|e.g. 10 - one tranfer per recurrence| +|function()|Your callback|function|| + See also: [transferToVesting](#transfer-to-vesting) ### Transfer To Vesting diff --git a/package.json b/package.json index 16fee65..6f38aa1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hiveio/hive-js", - "version": "0.8.13", + "version": "0.8.14", "description": "Hive.js the JavaScript API for Hive blockchain", "main": "lib/index.js", "scripts": { diff --git a/src/auth/serializer/src/operations.js b/src/auth/serializer/src/operations.js index 8881c2c..cc60f93 100644 --- a/src/auth/serializer/src/operations.js +++ b/src/auth/serializer/src/operations.js @@ -733,6 +733,18 @@ let update_proposal = new Serializer( } ); +let recurrent_transfer = new Serializer( + "recurrent_transfer", { + from: string, + to: string, + amount: asset, + memo: string, + recurrence: uint16, + executions: uint16, + extensions: set(future_extensions) + } +); + let claim_reward_balance2 = new Serializer( "claim_reward_balance2", { account: string, @@ -1008,6 +1020,7 @@ operation.st_operations = [ remove_proposal, update_proposal, collateralized_convert, + recurrent_transfer, claim_reward_balance2, vote2, smt_setup, diff --git a/src/broadcast/operations.js b/src/broadcast/operations.js index 5fa6d59..c3c80c8 100644 --- a/src/broadcast/operations.js +++ b/src/broadcast/operations.js @@ -510,6 +510,19 @@ module.exports = [ "extensions" ] }, + { + "roles": ["active", "owner"], + "operation": "recurrent_transfer", + "params": [ + "from", + "to", + "amount", + "memo", + "recurrence", + "executions", + "extensions" + ] + }, { "roles": ["posting", "active", "owner"], "operation": "claim_reward_balance2", -- GitLab