From cc2d4f8248032543ec6f30b65f34b1edc208e20e Mon Sep 17 00:00:00 2001 From: sairajzero Date: Sun, 27 Sep 2020 03:21:43 +0530 Subject: [PATCH] Mark feature --- standard_Operations.html | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/standard_Operations.html b/standard_Operations.html index 0a25e3c..a99e6b5 100644 --- a/standard_Operations.html +++ b/standard_Operations.html @@ -8252,8 +8252,42 @@ Bitcoin.Util = { this.util.singleRequest(delreq.requestorID, delreq).then(result => { let success = [], failed = []; - result.forEach(r => r.status === 'fulfilled' ? - success.push(r.value): failed.push(r.reason)); + result.forEach(r => r.status === 'fulfilled' ? + success.push(r.value) : failed.push(r.reason)); + resolve({ + success, + failed + }) + }).catch(error => reject(error)) + }) + }, + + markApplicationData: function (mark, options = {}) { + return new Promise((resolve, reject) => { + if (!floGlobals.subAdmins.includes(myFloID)) + return reject("Only subAdmins can mark data") + if (typeof mark !== "object") { + if (!Array.isArray(mark)) mark = [mark]; + let tmp = {} + mark.forEach(vc => tmp[vc] = true) + mark = tmp; + } + var markreq = { + receiverID: options.receiverID || floGlobals.adminID, + requestorID: myFloID, + pubKey: myPubKey, + time: Date.now(), + mark: mark, + application: options.application || floGlobals.application + } + let hashcontent = ["time", "application"] + .map(d => markreq[d]).join("|") + JSON.stringify(markreq.mark) + markreq.sign = floCrypto.signData(hashcontent, myPrivKey) + this.util.singleRequest(markreq.requestorID, markreq).then(result => { + let success = [], + failed = []; + result.forEach(r => r.status === 'fulfilled' ? + success.push(r.value) : failed.push(r.reason)); resolve({ success, failed