From e37aae1b46d543f98bd7bcc0d60b3d52fa855311 Mon Sep 17 00:00:00 2001 From: Mahdi Yari Date: Wed, 15 May 2024 17:48:33 +0330 Subject: [PATCH 1/6] add lowercase to letters --- src/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.js b/src/utils.js index eecb4d8..218c629 100644 --- a/src/utils.js +++ b/src/utils.js @@ -41,17 +41,17 @@ export function validateAccountName(value) { for (i = 0, len = ref.length; i < len; i++) { label = ref[i]; if (!/^[a-z]/.test(label)) { - return suffix + "start with a letter."; + return suffix + "start with a lowercase letter."; } if (!/^[a-z0-9-]*$/.test(label)) { - return suffix + "have only letters, digits, or dashes."; + return suffix + "have only lowercase letters, digits, or dashes."; } // Multiple dashes in a row is VALID // if (/--/.test(label)) { // return suffix + "have only one dash in a row."; // } if (!/[a-z0-9]$/.test(label)) { - return suffix + "end with a letter or digit."; + return suffix + "end with a lowercase letter or digit."; } if (!(label.length >= 3)) { return suffix + "be longer"; -- GitLab From ba3f1c7ce5ffc9ba937ac7410a771d92d3925653 Mon Sep 17 00:00:00 2001 From: Mahdi Yari Date: Wed, 15 May 2024 17:48:39 +0330 Subject: [PATCH 2/6] v2.0.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf538cf..d6bab19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hiveio/hive-js", - "version": "2.0.7", + "version": "2.0.8", "description": "Hive.js the JavaScript API for Hive blockchain", "main": "lib/index.js", "scripts": { -- GitLab From 7e0a68a75df290420aa5fc3bb76b33035ef25621 Mon Sep 17 00:00:00 2001 From: Howo Date: Wed, 19 Nov 2025 16:09:43 -0500 Subject: [PATCH 3/6] Added support for recurrent transfers pair_id --- package.json | 2 +- src/auth/serializer/src/operations.js | 12 +++++++----- src/auth/serializer/src/types.js | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d6bab19..5b28732 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hiveio/hive-js", - "version": "2.0.8", + "version": "2.0.9", "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 cc60f93..e4a0692 100644 --- a/src/auth/serializer/src/operations.js +++ b/src/auth/serializer/src/operations.js @@ -733,17 +733,19 @@ let update_proposal = new Serializer( } ); -let recurrent_transfer = new Serializer( - "recurrent_transfer", { +let recurrent_transfer_pair_id = new Serializer(1, { + pair_id: uint8 +}); + +let recurrent_transfer = new Serializer("recurrent_transfer", { from: string, to: string, amount: asset, memo: string, recurrence: uint16, executions: uint16, - extensions: set(future_extensions) - } -); + extensions: set(static_variant([future_extensions, recurrent_transfer_pair_id])) +}); let claim_reward_balance2 = new Serializer( "claim_reward_balance2", { diff --git a/src/auth/serializer/src/types.js b/src/auth/serializer/src/types.js index 0296773..c4a4ba5 100644 --- a/src/auth/serializer/src/types.js +++ b/src/auth/serializer/src/types.js @@ -729,8 +729,18 @@ Types.set = function(st_operation){ return this.validate(((() => { var result = []; for (var i = 0, o; i < object.length; i++) { - o = object[i]; - result.push(st_operation.toObject(o, debug)); + o = object[i]; + var obj = st_operation.toObject(o, debug); + // Convert static_variant array format [type, value] to object format {type, value} ONLY for recurrent_transfer extensions + // Detect recurrent_transfer_pair_id by checking if it's a 2-element array with numeric type index 1 + var isRecurrentTransferExtension = Array.isArray(obj) && obj.length === 2 && obj[0] === 1 && + typeof obj[1] === 'object' && obj[1] !== null && 'pair_id' in obj[1]; + if (isRecurrentTransferExtension) { + obj = { type: obj[0], value: obj[1] }; + result.push(obj); + } else { + result.push(o); + } } return result; })())); -- GitLab From f15788aba9e9029602f086e13d701035f5032143 Mon Sep 17 00:00:00 2001 From: Mahdi Yari <16903082+mahdiyari@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:31:17 +0330 Subject: [PATCH 4/6] revert to original non-patched version --- src/auth/serializer/src/types.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/auth/serializer/src/types.js b/src/auth/serializer/src/types.js index c4a4ba5..0296773 100644 --- a/src/auth/serializer/src/types.js +++ b/src/auth/serializer/src/types.js @@ -729,18 +729,8 @@ Types.set = function(st_operation){ return this.validate(((() => { var result = []; for (var i = 0, o; i < object.length; i++) { - o = object[i]; - var obj = st_operation.toObject(o, debug); - // Convert static_variant array format [type, value] to object format {type, value} ONLY for recurrent_transfer extensions - // Detect recurrent_transfer_pair_id by checking if it's a 2-element array with numeric type index 1 - var isRecurrentTransferExtension = Array.isArray(obj) && obj.length === 2 && obj[0] === 1 && - typeof obj[1] === 'object' && obj[1] !== null && 'pair_id' in obj[1]; - if (isRecurrentTransferExtension) { - obj = { type: obj[0], value: obj[1] }; - result.push(obj); - } else { - result.push(o); - } + o = object[i]; + result.push(st_operation.toObject(o, debug)); } return result; })())); -- GitLab From 32e47582e710de898d6fe76a3c9211fbc683e219 Mon Sep 17 00:00:00 2001 From: Mahdi Yari <16903082+mahdiyari@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:32:29 +0330 Subject: [PATCH 5/6] Set correct format for pair_id in recurrent transfers e.g. extensions: [{ type: 1, value: { pair_id: 3 } }] --- src/auth/serializer/src/operations.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/auth/serializer/src/operations.js b/src/auth/serializer/src/operations.js index e4a0692..1043c88 100644 --- a/src/auth/serializer/src/operations.js +++ b/src/auth/serializer/src/operations.js @@ -733,8 +733,9 @@ let update_proposal = new Serializer( } ); -let recurrent_transfer_pair_id = new Serializer(1, { - pair_id: uint8 +let recurrent_transfer_pair_id = new Serializer(0,{ + type: uint8, + value: new Serializer(0, { pair_id: uint8 }) }); let recurrent_transfer = new Serializer("recurrent_transfer", { @@ -744,7 +745,7 @@ let recurrent_transfer = new Serializer("recurrent_transfer", { memo: string, recurrence: uint16, executions: uint16, - extensions: set(static_variant([future_extensions, recurrent_transfer_pair_id])) + extensions: set(recurrent_transfer_pair_id) }); let claim_reward_balance2 = new Serializer( -- GitLab From 4683f3118d244a2c1da3680b574892bee3a9c122 Mon Sep 17 00:00:00 2001 From: Mahdi Yari <16903082+mahdiyari@users.noreply.github.com> Date: Sun, 30 Nov 2025 21:41:33 +0330 Subject: [PATCH 6/6] Update docs - add example extensions with pair_id --- doc/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/README.md b/doc/README.md index fe1efe3..e9faef7 100644 --- a/doc/README.md +++ b/doc/README.md @@ -2062,6 +2062,7 @@ hive.broadcast.recurrentTransfer(wif, from, to, amount, memo, recurrence, execut |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| +|extensions|Optionally can be used to set a pair_id|Array[object]|e.g. `[{ type: 1, value: { pair_id: 3 } }]` or `[]`| |function()|Your callback|function|| See also: [transferToVesting](#transfer-to-vesting) -- GitLab