floBlockchainAPI v2.3.3d
- renamed sender and receiver options to senders and receivers (bug fix)
This commit is contained in:
parent
d21db616da
commit
bffb130bd4
@ -1,4 +1,4 @@
|
|||||||
(function (EXPORTS) { //floBlockchainAPI v2.3.3c
|
(function (EXPORTS) { //floBlockchainAPI v2.3.3d
|
||||||
/* FLO Blockchain Operator to send/receive data from blockchain using API calls*/
|
/* FLO Blockchain Operator to send/receive data from blockchain using API calls*/
|
||||||
'use strict';
|
'use strict';
|
||||||
const floBlockchainAPI = EXPORTS;
|
const floBlockchainAPI = EXPORTS;
|
||||||
@ -485,8 +485,8 @@
|
|||||||
floBlockchainAPI.readData = function (addr, options = {}) {
|
floBlockchainAPI.readData = function (addr, options = {}) {
|
||||||
options.limit = options.limit || 0;
|
options.limit = options.limit || 0;
|
||||||
options.ignoreOld = options.ignoreOld || 0;
|
options.ignoreOld = options.ignoreOld || 0;
|
||||||
if (typeof options.sender === "string") options.sender = [options.sender];
|
if (typeof options.senders === "string") options.senders = [options.senders];
|
||||||
if (typeof options.receiver === "string") options.receiver = [options.receiver];
|
if (typeof options.receivers === "string") options.receivers = [options.receivers];
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
promisedAPI(`api/addrs/${addr}/txs?from=0&to=1`).then(response => {
|
promisedAPI(`api/addrs/${addr}/txs?from=0&to=1`).then(response => {
|
||||||
var newItems = response.totalItems - options.ignoreOld;
|
var newItems = response.totalItems - options.ignoreOld;
|
||||||
@ -521,10 +521,10 @@
|
|||||||
}
|
}
|
||||||
if (!flag) continue;
|
if (!flag) continue;
|
||||||
}
|
}
|
||||||
if (Array.isArray(options.sender)) {
|
if (Array.isArray(options.senders)) {
|
||||||
let flag = false;
|
let flag = false;
|
||||||
for (let vin of response.items[i].vin)
|
for (let vin of response.items[i].vin)
|
||||||
if (options.sender.includes(vin.addr)) {
|
if (options.senders.includes(vin.addr)) {
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -539,10 +539,10 @@
|
|||||||
}
|
}
|
||||||
if (!flag) continue;
|
if (!flag) continue;
|
||||||
}
|
}
|
||||||
if (Array.isArray(options.receiver)) {
|
if (Array.isArray(options.receivers)) {
|
||||||
let flag = false;
|
let flag = false;
|
||||||
for (let vout of response.items[i].vout)
|
for (let vout of response.items[i].vout)
|
||||||
if (options.receiver.includes(vout.scriptPubKey.addresses[0])) {
|
if (options.receivers.includes(vout.scriptPubKey.addresses[0])) {
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
(function(EXPORTS) { //floTokenAPI v1.0.3b
|
(function (EXPORTS) { //floTokenAPI v1.0.3c
|
||||||
/* Token Operator to send/receive tokens via blockchain using API calls*/
|
/* Token Operator to send/receive tokens via blockchain using API calls*/
|
||||||
'use strict';
|
'use strict';
|
||||||
const tokenAPI = EXPORTS;
|
const tokenAPI = EXPORTS;
|
||||||
|
|
||||||
const DEFAULT = {
|
const DEFAULT = {
|
||||||
apiURL: floGlobals.tokenURL || "https://ranchimallflo.duckdns.org/",
|
apiURL: floGlobals.tokenURL || "https://ranchimallflo.duckdns.org/",
|
||||||
currency: "rupee"
|
currency: floGlobals.currency || "rupee"
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.defineProperties(tokenAPI, {
|
Object.defineProperties(tokenAPI, {
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
const fetch_api = tokenAPI.fetch = function (apicall) {
|
const fetch_api = tokenAPI.fetch = function (apicall) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log(DEFAULT.apiURL + apicall);
|
console.debug(DEFAULT.apiURL + apicall);
|
||||||
fetch(DEFAULT.apiURL + apicall).then(response => {
|
fetch(DEFAULT.apiURL + apicall).then(response => {
|
||||||
if (response.ok)
|
if (response.ok)
|
||||||
response.json().then(data => resolve(data));
|
response.json().then(data => resolve(data));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user