floBlockchainAPI v2.4.4

- Updated writeDataMultiple: use options (bool: preserveRatio, float: sendAmt)
- Updated default values to reduce flo spent during tx
This commit is contained in:
sairajzero 2023-03-20 19:44:52 +05:30
parent b16473f982
commit 0ab284b41b
2 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,4 @@
(function (EXPORTS) { //floBlockchainAPI v2.4.3
(function (EXPORTS) { //floBlockchainAPI v2.4.4
/* FLO Blockchain Operator to send/receive data from blockchain using API calls*/
'use strict';
const floBlockchainAPI = EXPORTS;
@ -9,9 +9,9 @@
FLO: ['https://flosight.duckdns.org/', 'https://flosight.ranchimall.net/'],
FLO_TEST: ['https://testnet-flosight.duckdns.org', 'https://testnet.flocha.in/']
},
sendAmt: 0.001,
fee: 0.0005,
minChangeAmt: 0.0005,
sendAmt: 0.0003,
fee: 0.0002,
minChangeAmt: 0.0002,
receiverID: floGlobals.adminID
};
@ -261,11 +261,11 @@
* @param {boolean} preserveRatio (optional) preserve ratio or equal contribution
* @return {Promise}
*/
floBlockchainAPI.writeDataMultiple = function (senderPrivKeys, data, receivers = [DEFAULT.receiverID], preserveRatio = true) {
floBlockchainAPI.writeDataMultiple = function (senderPrivKeys, data, receivers = [DEFAULT.receiverID], options = {}) {
return new Promise((resolve, reject) => {
if (!Array.isArray(senderPrivKeys))
return reject("Invalid senderPrivKeys: SenderPrivKeys must be Array");
if (!preserveRatio) {
if (options.preserveRatio === false) {
let tmp = {};
let amount = (DEFAULT.sendAmt * receivers.length) / senderPrivKeys.length;
senderPrivKeys.forEach(key => tmp[key] = amount);
@ -275,7 +275,7 @@
return reject("Invalid receivers: Receivers must be Array");
else {
let tmp = {};
let amount = DEFAULT.sendAmt;
let amount = options.sendAmt || DEFAULT.sendAmt;
receivers.forEach(floID => tmp[floID] = amount);
receivers = tmp
}

View File

@ -1,4 +1,4 @@
(function (EXPORTS) { //floCrypto v2.3.6
(function (EXPORTS) { //floCrypto v2.3.6a
/* FLO Crypto Operators */
'use strict';
const floCrypto = EXPORTS;
@ -155,7 +155,6 @@
hashID: {
value: (str) => {
let bytes = ripemd160(Crypto.SHA256(str, { asBytes: true }), { asBytes: true });
console.debug(bytes);
bytes.unshift(bitjs.pub);
var hash = Crypto.SHA256(Crypto.SHA256(bytes, {
asBytes: true