@pioneer-platform/utxo-network 8.3.11 → 8.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +362 -656
- package/lib/sochain-api.js +60 -145
- package/lib/types/common.d.ts +0 -1
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +135 -211
- package/package.json +8 -7
- package/tsconfig.json +19 -8
package/lib/index.js
CHANGED
|
@@ -42,84 +42,58 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
42
42
|
}) : function(o, v) {
|
|
43
43
|
o["default"] = v;
|
|
44
44
|
});
|
|
45
|
-
var __importStar = (this && this.__importStar) || function (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
63
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
64
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
65
|
-
function step(op) {
|
|
66
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
67
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
68
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
69
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
70
|
-
switch (op[0]) {
|
|
71
|
-
case 0: case 1: t = op; break;
|
|
72
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
73
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
74
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
75
|
-
default:
|
|
76
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
77
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
78
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
79
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
80
|
-
if (t[2]) _.ops.pop();
|
|
81
|
-
_.trys.pop(); continue;
|
|
82
|
-
}
|
|
83
|
-
op = body.call(thisArg, _);
|
|
84
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
85
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
86
|
-
}
|
|
87
|
-
};
|
|
45
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
46
|
+
var ownKeys = function(o) {
|
|
47
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
48
|
+
var ar = [];
|
|
49
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
50
|
+
return ar;
|
|
51
|
+
};
|
|
52
|
+
return ownKeys(o);
|
|
53
|
+
};
|
|
54
|
+
return function (mod) {
|
|
55
|
+
if (mod && mod.__esModule) return mod;
|
|
56
|
+
var result = {};
|
|
57
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
58
|
+
__setModuleDefault(result, mod);
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
})();
|
|
88
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
63
|
+
const TAG = " | utxo-api | ";
|
|
64
|
+
const Axios = require('axios');
|
|
65
|
+
const https = require('https');
|
|
66
|
+
const axios = Axios.create({
|
|
93
67
|
httpsAgent: new https.Agent({
|
|
94
68
|
rejectUnauthorized: false
|
|
95
69
|
})
|
|
96
70
|
});
|
|
97
|
-
|
|
98
|
-
|
|
71
|
+
const log = require('@pioneer-platform/loggerdog')();
|
|
72
|
+
const BitcoinRpc = require('bitcoin-rpc-promise');
|
|
99
73
|
// import { Blockbook } from 'blockbook-client'
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
74
|
+
let Unchained = require("@pioneer-platform/unchained");
|
|
75
|
+
const blockbook = require('@pioneer-platform/blockbook');
|
|
76
|
+
const sochain = __importStar(require("./sochain-api"));
|
|
77
|
+
const Utils = __importStar(require("./utils"));
|
|
78
|
+
let coins = [
|
|
105
79
|
'TBTC',
|
|
106
80
|
'BCH'
|
|
107
81
|
//'BTC',
|
|
108
82
|
//'DOGE','DASH','DGB','BCH','LTC'
|
|
109
83
|
];
|
|
110
|
-
|
|
111
|
-
for (
|
|
112
|
-
|
|
113
|
-
|
|
84
|
+
let nodeMap = {};
|
|
85
|
+
for (let i = 0; i < coins.length; i++) {
|
|
86
|
+
let coin = coins[i];
|
|
87
|
+
let connString = 'https://user:hunter2@' + process.env[coin + '_RPC_HOST'];
|
|
114
88
|
nodeMap[coin] = new BitcoinRpc(connString);
|
|
115
89
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
90
|
+
const URL_BLOCKCHAIN_INFO = "http://blockchain.info";
|
|
91
|
+
const URL_BLOCKBOOK_BTC = "";
|
|
92
|
+
let { shortListNameToCaip, shortListSymbolToCaip, evmCaips } = require("@pioneer-platform/pioneer-caip");
|
|
93
|
+
let RUNTIME = 'pioneer';
|
|
94
|
+
const ONLINE = [];
|
|
95
|
+
const OFFLINE = [];
|
|
96
|
+
let unchained;
|
|
123
97
|
module.exports = {
|
|
124
98
|
init: function (servers) {
|
|
125
99
|
return init_network(servers);
|
|
@@ -163,12 +137,8 @@ module.exports = {
|
|
|
163
137
|
// txsByHeight: function (height,address) {
|
|
164
138
|
// return get_txs_by_height(height,address);
|
|
165
139
|
// },
|
|
166
|
-
getBlockHeight: function (coin) {
|
|
167
|
-
return
|
|
168
|
-
return __generator(this, function (_a) {
|
|
169
|
-
return [2 /*return*/, nodeMap[coin].getBlockCount()];
|
|
170
|
-
});
|
|
171
|
-
});
|
|
140
|
+
getBlockHeight: async function (coin) {
|
|
141
|
+
return nodeMap[coin].getBlockCount();
|
|
172
142
|
},
|
|
173
143
|
getTransaction: function (coin, txid, format) {
|
|
174
144
|
return get_transaction(coin, txid, format);
|
|
@@ -213,179 +183,109 @@ module.exports = {
|
|
|
213
183
|
// return get_validators();
|
|
214
184
|
// }
|
|
215
185
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
//log.debug(tag,"unchainedServers: ",unchainedServers)
|
|
246
|
-
unchained = _a.sent();
|
|
247
|
-
return [3 /*break*/, 6];
|
|
248
|
-
case 4: return [4 /*yield*/, Unchained.init()];
|
|
249
|
-
case 5:
|
|
250
|
-
unchained = _a.sent();
|
|
251
|
-
_a.label = 6;
|
|
252
|
-
case 6:
|
|
253
|
-
//log.debug("unchained: ",unchained)
|
|
254
|
-
//figure out what is online, and if can meet blockchain requirements
|
|
255
|
-
//return online servers
|
|
256
|
-
return [2 /*return*/, true];
|
|
257
|
-
case 7:
|
|
258
|
-
e_1 = _a.sent();
|
|
259
|
-
log.error(tag, 'Error: ', e_1);
|
|
260
|
-
throw e_1;
|
|
261
|
-
case 8: return [2 /*return*/];
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
});
|
|
186
|
+
let init_network = async function (servers) {
|
|
187
|
+
let tag = ' | init_network | ';
|
|
188
|
+
try {
|
|
189
|
+
log.debug(tag, "checkpoint: ");
|
|
190
|
+
let output = [];
|
|
191
|
+
// @TODO
|
|
192
|
+
// const blockbooks = servers.filter((server: { type: string; }) => server.type === 'blockbook');
|
|
193
|
+
// log.debug(tag,"blockbooks: ",blockbooks)
|
|
194
|
+
await blockbook.init();
|
|
195
|
+
// @TODO
|
|
196
|
+
//load daemon servers
|
|
197
|
+
//load unchained servers
|
|
198
|
+
if (servers) {
|
|
199
|
+
const unchainedServers = servers.filter((server) => server.type === 'unchained');
|
|
200
|
+
//log.debug(tag,"unchainedServers: ",unchainedServers)
|
|
201
|
+
unchained = await Unchained.init();
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
unchained = await Unchained.init();
|
|
205
|
+
}
|
|
206
|
+
//log.debug("unchained: ",unchained)
|
|
207
|
+
//figure out what is online, and if can meet blockchain requirements
|
|
208
|
+
//return online servers
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
catch (e) {
|
|
212
|
+
log.error(tag, 'Error: ', e);
|
|
213
|
+
throw e;
|
|
214
|
+
}
|
|
265
215
|
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
return [4 /*yield*/, blockbook.getPubkeyInfo(coin, xpub)];
|
|
277
|
-
case 2:
|
|
278
|
-
output = _a.sent();
|
|
279
|
-
log.debug(tag, "output: ", output);
|
|
280
|
-
return [2 /*return*/, output];
|
|
281
|
-
case 3:
|
|
282
|
-
e_2 = _a.sent();
|
|
283
|
-
console.error(tag, e_2);
|
|
284
|
-
return [3 /*break*/, 4];
|
|
285
|
-
case 4: return [2 /*return*/];
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
216
|
+
let get_pubkey_info = async function (coin, xpub) {
|
|
217
|
+
let tag = TAG + " | get_pubkey_info | ";
|
|
218
|
+
try {
|
|
219
|
+
let output = await blockbook.getPubkeyInfo(coin, xpub);
|
|
220
|
+
log.debug(tag, "output: ", output);
|
|
221
|
+
return output;
|
|
222
|
+
}
|
|
223
|
+
catch (e) {
|
|
224
|
+
console.error(tag, e);
|
|
225
|
+
}
|
|
289
226
|
};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return [4 /*yield*/, get_fees_with_rates(memo)];
|
|
301
|
-
case 2:
|
|
302
|
-
fees = (_a.sent()).fees;
|
|
303
|
-
return [2 /*return*/, fees];
|
|
304
|
-
case 3:
|
|
305
|
-
e_3 = _a.sent();
|
|
306
|
-
console.error(tag, e_3);
|
|
307
|
-
return [3 /*break*/, 4];
|
|
308
|
-
case 4: return [2 /*return*/];
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
});
|
|
227
|
+
let get_fees_with_memo = async function (coin, memo) {
|
|
228
|
+
let tag = TAG + " | get_fees_with_memo | ";
|
|
229
|
+
try {
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
const { fees } = await get_fees_with_rates(memo);
|
|
232
|
+
return fees;
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
console.error(tag, e);
|
|
236
|
+
}
|
|
312
237
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
average: Utils.calcFee(rates.average, memo),
|
|
337
|
-
fastest: Utils.calcFee(rates.fastest, memo),
|
|
338
|
-
};
|
|
339
|
-
return [2 /*return*/, { fees: fees, rates: rates }];
|
|
340
|
-
case 3:
|
|
341
|
-
e_4 = _a.sent();
|
|
342
|
-
console.error(tag, e_4);
|
|
343
|
-
throw e_4;
|
|
344
|
-
case 4: return [2 /*return*/];
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
});
|
|
238
|
+
let get_fees_with_rates = async function (coin, memo) {
|
|
239
|
+
let tag = TAG + " | get_fees_with_rates | ";
|
|
240
|
+
try {
|
|
241
|
+
let output = {};
|
|
242
|
+
const txFee = await sochain.getSuggestedTxFee(coin.toLowerCase());
|
|
243
|
+
console.log("txFee: ", txFee);
|
|
244
|
+
const rates = {
|
|
245
|
+
fastest: txFee * 5, //holy fuck
|
|
246
|
+
fast: txFee * 1,
|
|
247
|
+
average: txFee * 0.5,
|
|
248
|
+
};
|
|
249
|
+
const fees = {
|
|
250
|
+
type: 'byte',
|
|
251
|
+
fast: Utils.calcFee(rates.fast, memo),
|
|
252
|
+
average: Utils.calcFee(rates.average, memo),
|
|
253
|
+
fastest: Utils.calcFee(rates.fastest, memo),
|
|
254
|
+
};
|
|
255
|
+
return { fees, rates };
|
|
256
|
+
}
|
|
257
|
+
catch (e) {
|
|
258
|
+
console.error(tag, e);
|
|
259
|
+
throw e;
|
|
260
|
+
}
|
|
348
261
|
};
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
// console.log("fee.rates: ",fee.fees.rates)
|
|
377
|
-
if (fee && fee.rates)
|
|
378
|
-
output = fee.rates;
|
|
379
|
-
_a.label = 5;
|
|
380
|
-
case 5: return [2 /*return*/, output];
|
|
381
|
-
case 6:
|
|
382
|
-
e_5 = _a.sent();
|
|
383
|
-
console.error(tag, e_5);
|
|
384
|
-
return [3 /*break*/, 7];
|
|
385
|
-
case 7: return [2 /*return*/];
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
});
|
|
262
|
+
let get_fee = async function (coin) {
|
|
263
|
+
let tag = TAG + " | get_fee | ";
|
|
264
|
+
try {
|
|
265
|
+
let output = {};
|
|
266
|
+
log.debug(tag, "coin: ", coin);
|
|
267
|
+
log.debug(tag, "caip: ", shortListSymbolToCaip[coin]);
|
|
268
|
+
//get caip for symbol
|
|
269
|
+
// @ts-ignore
|
|
270
|
+
if (unchained[shortListSymbolToCaip[coin]]) {
|
|
271
|
+
let result = await unchained[shortListSymbolToCaip[coin]].GetNetworkFees();
|
|
272
|
+
//console.log("result: ",result.data)
|
|
273
|
+
output = result.data;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
let fee = await get_fees_with_rates(coin);
|
|
277
|
+
console.log("fee: ", fee);
|
|
278
|
+
// console.log("fee.rates: ",fee.fees)
|
|
279
|
+
// console.log("fee.rates: ",fee.fees.rates)
|
|
280
|
+
if (fee && fee.rates)
|
|
281
|
+
output = fee.rates;
|
|
282
|
+
//@TODO fall back to node
|
|
283
|
+
}
|
|
284
|
+
return output;
|
|
285
|
+
}
|
|
286
|
+
catch (e) {
|
|
287
|
+
console.error(tag, e);
|
|
288
|
+
}
|
|
389
289
|
};
|
|
390
290
|
/*
|
|
391
291
|
TODO - this is a mess
|
|
@@ -402,327 +302,168 @@ var get_fee = function (coin) {
|
|
|
402
302
|
push too all
|
|
403
303
|
first txid returns success
|
|
404
304
|
*/
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
if (responseBroadcast.resp.data.result) {
|
|
428
|
-
output.txid = responseBroadcast.resp.data.result;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
else if (responseBroadcast.error) {
|
|
432
|
-
output.error = responseBroadcast.error;
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
output.error = "unknown error";
|
|
436
|
-
output.debug = responseBroadcast;
|
|
437
|
-
}
|
|
438
|
-
//Jesus fuck
|
|
439
|
-
// try{
|
|
440
|
-
// //TODO use for non-bitcoin? wtf why bitcoin blockbook broke?
|
|
441
|
-
// let responseBroadcast
|
|
442
|
-
// if(coin === 'BTC'){
|
|
443
|
-
// log.debug(tag,"BTC detected!")
|
|
444
|
-
// let url = "https://api.bitcoin.shapeshift.com/api/v1/send"
|
|
445
|
-
// let body = {
|
|
446
|
-
// url,
|
|
447
|
-
// method: 'POST',
|
|
448
|
-
// json:false,
|
|
449
|
-
// data:{hex:tx},
|
|
450
|
-
// }
|
|
451
|
-
// let output:any = {
|
|
452
|
-
// success:false
|
|
453
|
-
// }
|
|
454
|
-
// try{
|
|
455
|
-
// responseBroadcast = await axios(body)
|
|
456
|
-
// responseBroadcast = responseBroadcast.data
|
|
457
|
-
// log.debug(tag,'responseBroadcast: ',responseBroadcast)
|
|
458
|
-
// output.txid = responseBroadcast
|
|
459
|
-
// if(output.txid)output.success = true
|
|
460
|
-
//
|
|
461
|
-
// }catch(e:any){
|
|
462
|
-
// // log.debug(tag,"error: ",e)
|
|
463
|
-
// // log.debug(tag,"data0: ",e)
|
|
464
|
-
// // log.debug(tag,"resp: ",resp)
|
|
465
|
-
// // log.debug(tag,"data0: ",Object.keys(e))
|
|
466
|
-
// // log.debug(tag,"data1: ",e.response.req)
|
|
467
|
-
// log.debug(tag,"data2: ",e.response.data)
|
|
468
|
-
// log.debug(tag,"data2: ",e.response.data.message)
|
|
469
|
-
// // log.debug(tag,"error3: ",e.toJSON().request)
|
|
470
|
-
// // log.debug(tag,"erro4: ",e.toJSON().data)
|
|
471
|
-
// // log.debug(tag,"error5: ",e.toJSON().code)
|
|
472
|
-
// if(e.response.data.message){
|
|
473
|
-
// log.debug(tag,"saving message! ")
|
|
474
|
-
// output.error = e.response.data.message
|
|
475
|
-
// }else{
|
|
476
|
-
// output.error = e
|
|
477
|
-
// }
|
|
478
|
-
// }
|
|
479
|
-
// log.debug(tag,"output: ",output)
|
|
480
|
-
// return output
|
|
481
|
-
// } else {
|
|
482
|
-
// responseBroadcast = await blockbook.broadcast(coin,tx)
|
|
483
|
-
// log.debug(tag,'responseBroadcast: ',responseBroadcast)
|
|
484
|
-
// if(responseBroadcast.success && responseBroadcast.success !== false){
|
|
485
|
-
// output.success = true
|
|
486
|
-
// if(responseBroadcast.txid){
|
|
487
|
-
// output.txid = responseBroadcast.resp.data.result
|
|
488
|
-
// }
|
|
489
|
-
// if(responseBroadcast.resp.data.result){
|
|
490
|
-
// output.txid = responseBroadcast.resp.data.result
|
|
491
|
-
// }
|
|
492
|
-
// } else if(responseBroadcast.error) {
|
|
493
|
-
// output.error = responseBroadcast.error
|
|
494
|
-
// } else {
|
|
495
|
-
// output.error = "unknown error"
|
|
496
|
-
// output.debug = responseBroadcast
|
|
497
|
-
// }
|
|
498
|
-
// return output
|
|
499
|
-
// }
|
|
500
|
-
//
|
|
501
|
-
// //use nodes
|
|
502
|
-
// // log.debug(tag,'nodeMap: ',nodeMap)
|
|
503
|
-
// // let responseBroadcast = await nodeMap[coin].sendRawTransaction(tx)
|
|
504
|
-
// // log.debug(tag,'responseBroadcast: ',responseBroadcast)
|
|
505
|
-
//
|
|
506
|
-
//
|
|
507
|
-
// }catch(e){
|
|
508
|
-
// //TODO handle errors
|
|
509
|
-
// if(!output.error)output.error = e
|
|
510
|
-
// return output
|
|
511
|
-
// }
|
|
512
|
-
return [2 /*return*/, output];
|
|
513
|
-
case 3:
|
|
514
|
-
e_6 = _a.sent();
|
|
515
|
-
console.error(tag, e_6);
|
|
516
|
-
throw e_6;
|
|
517
|
-
case 4: return [2 /*return*/];
|
|
305
|
+
let broadcast_transaction = async function (coin, tx) {
|
|
306
|
+
let tag = TAG + " | broadcast_transaction | ";
|
|
307
|
+
try {
|
|
308
|
+
let output = {
|
|
309
|
+
success: false
|
|
310
|
+
};
|
|
311
|
+
try {
|
|
312
|
+
let responseBroadcast = await blockbook.broadcast(coin, tx);
|
|
313
|
+
log.info(tag, 'responseBroadcast: ', responseBroadcast);
|
|
314
|
+
if (responseBroadcast.success && responseBroadcast.success !== false) {
|
|
315
|
+
output.success = true;
|
|
316
|
+
// Handle different response structures defensively
|
|
317
|
+
if (responseBroadcast.txid) {
|
|
318
|
+
output.txid = responseBroadcast.txid;
|
|
319
|
+
}
|
|
320
|
+
else if (responseBroadcast.resp?.data?.result) {
|
|
321
|
+
output.txid = responseBroadcast.resp.data.result;
|
|
322
|
+
}
|
|
323
|
+
else if (responseBroadcast.result) {
|
|
324
|
+
output.txid = responseBroadcast.result;
|
|
325
|
+
}
|
|
518
326
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
};
|
|
522
|
-
var get_balance_by_addresses = function (coin, addresses) {
|
|
523
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
524
|
-
var tag, query, i, address, balanceInfo, e_7;
|
|
525
|
-
return __generator(this, function (_a) {
|
|
526
|
-
switch (_a.label) {
|
|
527
|
-
case 0:
|
|
528
|
-
tag = TAG + " | get_balance_by_address | ";
|
|
529
|
-
_a.label = 1;
|
|
530
|
-
case 1:
|
|
531
|
-
_a.trys.push([1, 3, , 4]);
|
|
532
|
-
query = URL_BLOCKCHAIN_INFO + "/multiaddr?active=";
|
|
533
|
-
for (i = 0; i < addresses.length; i++) {
|
|
534
|
-
address = addresses[i];
|
|
535
|
-
query = query + address + "|";
|
|
536
|
-
}
|
|
537
|
-
console.log(query);
|
|
538
|
-
return [4 /*yield*/, axios({ method: 'GET', url: query })
|
|
539
|
-
//https://blockchain.info/multiaddr?active=$address|$address
|
|
540
|
-
];
|
|
541
|
-
case 2:
|
|
542
|
-
balanceInfo = _a.sent();
|
|
543
|
-
//https://blockchain.info/multiaddr?active=$address|$address
|
|
544
|
-
return [2 /*return*/, balanceInfo.data];
|
|
545
|
-
case 3:
|
|
546
|
-
e_7 = _a.sent();
|
|
547
|
-
console.error(tag, e_7);
|
|
548
|
-
return [3 /*break*/, 4];
|
|
549
|
-
case 4: return [2 /*return*/];
|
|
327
|
+
else if (responseBroadcast.error) {
|
|
328
|
+
output.error = responseBroadcast.error;
|
|
550
329
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
var get_balance_by_address = function (coin, address) {
|
|
555
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
556
|
-
var tag, balanceInfo, e_8;
|
|
557
|
-
return __generator(this, function (_a) {
|
|
558
|
-
switch (_a.label) {
|
|
559
|
-
case 0:
|
|
560
|
-
tag = TAG + " | get_balance_by_address | ";
|
|
561
|
-
_a.label = 1;
|
|
562
|
-
case 1:
|
|
563
|
-
_a.trys.push([1, 3, , 4]);
|
|
564
|
-
return [4 /*yield*/, axios({ method: 'GET', url: URL_BLOCKBOOK_BTC + '/address/' + address })];
|
|
565
|
-
case 2:
|
|
566
|
-
balanceInfo = _a.sent();
|
|
567
|
-
return [2 /*return*/, balanceInfo.data.balance];
|
|
568
|
-
case 3:
|
|
569
|
-
e_8 = _a.sent();
|
|
570
|
-
console.error(tag, e_8);
|
|
571
|
-
return [3 /*break*/, 4];
|
|
572
|
-
case 4: return [2 /*return*/];
|
|
330
|
+
else {
|
|
331
|
+
output.error = "unknown error";
|
|
332
|
+
output.debug = responseBroadcast;
|
|
573
333
|
}
|
|
574
|
-
}
|
|
575
|
-
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
console.log(tag, "e: ", e);
|
|
337
|
+
console.log(tag, "e: ", e.toString());
|
|
338
|
+
output.error = e.toString();
|
|
339
|
+
}
|
|
340
|
+
return output;
|
|
341
|
+
}
|
|
342
|
+
catch (e) {
|
|
343
|
+
console.error(tag, e);
|
|
344
|
+
throw e;
|
|
345
|
+
}
|
|
576
346
|
};
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
log.debug(tag, "output: ", output);
|
|
595
|
-
return [3 /*break*/, 5];
|
|
596
|
-
case 4:
|
|
597
|
-
e_9 = _a.sent();
|
|
598
|
-
output.error = e_9;
|
|
599
|
-
return [3 /*break*/, 5];
|
|
600
|
-
case 5:
|
|
601
|
-
// if(unchained[shortListSymbolToCaip[coin]]){
|
|
602
|
-
// log.info('USING UNCHAINED!@!!!!!! ')
|
|
603
|
-
// log.info("unchained[SYMBOL_TshortListSymbolToCaipO_CAIP[coin]]: ",unchained[shortListSymbolToCaip[coin]])
|
|
604
|
-
// let result = await unchained[shortListSymbolToCaip[coin]].GetUtxos({pubkey:xpub})
|
|
605
|
-
// //console.log("result: ",result.data)
|
|
606
|
-
// output = result.data
|
|
607
|
-
// } else {
|
|
608
|
-
// try{
|
|
609
|
-
// output = await blockbook.utxosByXpub(coin,xpub)
|
|
610
|
-
// log.debug(tag,"output: ",output)
|
|
611
|
-
// //@TODO fall back to node
|
|
612
|
-
// }catch(e){
|
|
613
|
-
// output.error = e
|
|
614
|
-
// }
|
|
615
|
-
// }
|
|
616
|
-
return [2 /*return*/, output];
|
|
617
|
-
case 6:
|
|
618
|
-
e_10 = _a.sent();
|
|
619
|
-
console.error(tag, e_10);
|
|
620
|
-
throw e_10;
|
|
621
|
-
case 7: return [2 /*return*/];
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
});
|
|
347
|
+
let get_balance_by_addresses = async function (coin, addresses) {
|
|
348
|
+
let tag = TAG + " | get_balance_by_address | ";
|
|
349
|
+
try {
|
|
350
|
+
let query = URL_BLOCKCHAIN_INFO + "/multiaddr?active=";
|
|
351
|
+
for (let i = 0; i < addresses.length; i++) {
|
|
352
|
+
let address = addresses[i];
|
|
353
|
+
query = query + address + "|";
|
|
354
|
+
}
|
|
355
|
+
console.log(query);
|
|
356
|
+
//let query =
|
|
357
|
+
let balanceInfo = await axios({ method: 'GET', url: query });
|
|
358
|
+
//https://blockchain.info/multiaddr?active=$address|$address
|
|
359
|
+
return balanceInfo.data;
|
|
360
|
+
}
|
|
361
|
+
catch (e) {
|
|
362
|
+
console.error(tag, e);
|
|
363
|
+
}
|
|
625
364
|
};
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return [4 /*yield*/, blockbook.utxosByXpub(coin, xpub)];
|
|
637
|
-
case 2:
|
|
638
|
-
output = _a.sent();
|
|
639
|
-
log.info(tag, "output: ", output);
|
|
640
|
-
balance = 0;
|
|
641
|
-
//tally
|
|
642
|
-
for (i = 0; i < output.length; i++) {
|
|
643
|
-
uxto = output[i];
|
|
644
|
-
balance = balance + parseInt(uxto.value);
|
|
645
|
-
}
|
|
646
|
-
return [2 /*return*/, balance];
|
|
647
|
-
case 3:
|
|
648
|
-
e_11 = _a.sent();
|
|
649
|
-
console.error(tag, e_11);
|
|
650
|
-
return [3 /*break*/, 4];
|
|
651
|
-
case 4: return [2 /*return*/];
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
});
|
|
365
|
+
let get_balance_by_address = async function (coin, address) {
|
|
366
|
+
let tag = TAG + " | get_balance_by_address | ";
|
|
367
|
+
try {
|
|
368
|
+
//
|
|
369
|
+
let balanceInfo = await axios({ method: 'GET', url: URL_BLOCKBOOK_BTC + '/address/' + address });
|
|
370
|
+
return balanceInfo.data.balance;
|
|
371
|
+
}
|
|
372
|
+
catch (e) {
|
|
373
|
+
console.error(tag, e);
|
|
374
|
+
}
|
|
655
375
|
};
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
376
|
+
let get_utxos_by_xpub = async function (coin, xpub) {
|
|
377
|
+
let tag = TAG + " | get_utxos_by_xpub | ";
|
|
378
|
+
try {
|
|
379
|
+
//
|
|
380
|
+
let output = {};
|
|
381
|
+
try {
|
|
382
|
+
output = await blockbook.utxosByXpub(coin, xpub);
|
|
383
|
+
log.debug(tag, "output: ", output);
|
|
384
|
+
//@TODO fall back to node
|
|
385
|
+
}
|
|
386
|
+
catch (e) {
|
|
387
|
+
output.error = e;
|
|
388
|
+
}
|
|
389
|
+
// if(unchained[shortListSymbolToCaip[coin]]){
|
|
390
|
+
// log.info('USING UNCHAINED!@!!!!!! ')
|
|
391
|
+
// log.info("unchained[SYMBOL_TshortListSymbolToCaipO_CAIP[coin]]: ",unchained[shortListSymbolToCaip[coin]])
|
|
392
|
+
// let result = await unchained[shortListSymbolToCaip[coin]].GetUtxos({pubkey:xpub})
|
|
393
|
+
// //console.log("result: ",result.data)
|
|
394
|
+
// output = result.data
|
|
395
|
+
// } else {
|
|
396
|
+
// try{
|
|
397
|
+
// output = await blockbook.utxosByXpub(coin,xpub)
|
|
398
|
+
// log.debug(tag,"output: ",output)
|
|
399
|
+
// //@TODO fall back to node
|
|
400
|
+
// }catch(e){
|
|
401
|
+
// output.error = e
|
|
402
|
+
// }
|
|
403
|
+
// }
|
|
404
|
+
return output;
|
|
405
|
+
}
|
|
406
|
+
catch (e) {
|
|
407
|
+
console.error(tag, e);
|
|
408
|
+
throw e;
|
|
409
|
+
}
|
|
679
410
|
};
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
return [2 /*return*/, output];
|
|
697
|
-
case 3:
|
|
698
|
-
e_13 = _a.sent();
|
|
699
|
-
console.error(tag, 'Error: ', e_13);
|
|
700
|
-
throw e_13;
|
|
701
|
-
case 4: return [2 /*return*/];
|
|
702
|
-
}
|
|
703
|
-
});
|
|
704
|
-
});
|
|
411
|
+
let get_balance_by_xpub = async function (coin, xpub) {
|
|
412
|
+
let tag = TAG + " | get_balance_by_xpub | ";
|
|
413
|
+
try {
|
|
414
|
+
let output = await blockbook.utxosByXpub(coin, xpub);
|
|
415
|
+
log.info(tag, "output: ", output);
|
|
416
|
+
let balance = 0;
|
|
417
|
+
//tally
|
|
418
|
+
for (let i = 0; i < output.length; i++) {
|
|
419
|
+
let uxto = output[i];
|
|
420
|
+
balance = balance + parseInt(uxto.value);
|
|
421
|
+
}
|
|
422
|
+
return balance;
|
|
423
|
+
}
|
|
424
|
+
catch (e) {
|
|
425
|
+
console.error(tag, e);
|
|
426
|
+
}
|
|
705
427
|
};
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
428
|
+
let get_block_hash = async function (coin, height) {
|
|
429
|
+
let tag = TAG + " | get_node_info | ";
|
|
430
|
+
try {
|
|
431
|
+
let blockHash = await nodeMap[coin].getBlockHash(height);
|
|
432
|
+
log.debug(tag, "blockHash: ", blockHash);
|
|
433
|
+
return blockHash;
|
|
434
|
+
}
|
|
435
|
+
catch (e) {
|
|
436
|
+
console.error(tag, e);
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
let get_transaction = async function (coin, txid, format) {
|
|
440
|
+
let tag = ' | get_transaction | ';
|
|
441
|
+
try {
|
|
442
|
+
log.debug(tag, "checkpoint: ");
|
|
443
|
+
let txInfo = {};
|
|
444
|
+
let output = await blockbook.getTransaction(coin, txid);
|
|
445
|
+
log.debug(tag, "output: ", output);
|
|
446
|
+
return output;
|
|
447
|
+
}
|
|
448
|
+
catch (e) {
|
|
449
|
+
console.error(tag, 'Error: ', e);
|
|
450
|
+
throw e;
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
let get_txs_by_xpub = async function (coin, xpub) {
|
|
454
|
+
let tag = ' | get_txs_by_xpub | ';
|
|
455
|
+
try {
|
|
456
|
+
log.debug(tag, "checkpoint: ", xpub);
|
|
457
|
+
let output = [];
|
|
458
|
+
let url = "https://blockchain.info/" + "rawaddr/" + xpub;
|
|
459
|
+
//
|
|
460
|
+
// let txInfo = await axios({method:'GET',url})
|
|
461
|
+
// return txInfo.data
|
|
462
|
+
}
|
|
463
|
+
catch (e) {
|
|
464
|
+
console.error(tag, 'Error: ', e);
|
|
465
|
+
throw e;
|
|
466
|
+
}
|
|
726
467
|
};
|
|
727
468
|
// let get_unspent_by_address = async function (coin:string,address:string) {
|
|
728
469
|
// let tag = ' | get_txs_by_address | '
|
|
@@ -751,58 +492,48 @@ var get_txs_by_xpub = function (coin, xpub) {
|
|
|
751
492
|
// throw e
|
|
752
493
|
// }
|
|
753
494
|
// }
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
console.error(tag, 'Error: ', e);
|
|
773
|
-
throw e;
|
|
774
|
-
}
|
|
775
|
-
return [2 /*return*/];
|
|
776
|
-
});
|
|
777
|
-
});
|
|
495
|
+
let get_txs_by_addresses = async function (coin, addresses) {
|
|
496
|
+
let tag = ' | get_txs_by_address | ';
|
|
497
|
+
try {
|
|
498
|
+
log.debug(tag, "checkpoint: ", addresses);
|
|
499
|
+
let output = [];
|
|
500
|
+
//tier 0
|
|
501
|
+
//tier 1
|
|
502
|
+
// let url = "https://blockchain.info/" +"multiaddr?active="+address
|
|
503
|
+
// //
|
|
504
|
+
// let txInfo = await axios({method:'GET',url})
|
|
505
|
+
//
|
|
506
|
+
//
|
|
507
|
+
// return txInfo.data
|
|
508
|
+
}
|
|
509
|
+
catch (e) {
|
|
510
|
+
console.error(tag, 'Error: ', e);
|
|
511
|
+
throw e;
|
|
512
|
+
}
|
|
778
513
|
};
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}
|
|
803
|
-
return [2 /*return*/];
|
|
804
|
-
});
|
|
805
|
-
});
|
|
514
|
+
let get_txs_by_xpubs = async function (coin, xpub) {
|
|
515
|
+
let tag = ' | get_txs_by_xpubs | ';
|
|
516
|
+
try {
|
|
517
|
+
log.debug(tag, "checkpoint: ", xpub);
|
|
518
|
+
let output = [];
|
|
519
|
+
//tier 0
|
|
520
|
+
let txInfo;
|
|
521
|
+
if (coin !== "BTC") {
|
|
522
|
+
//tier 1
|
|
523
|
+
let url = "https://blockchain.info/" + "multiaddr?active=" + xpub;
|
|
524
|
+
//
|
|
525
|
+
// txInfo = await axios({method:'GET',url})
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
//TODO
|
|
529
|
+
throw Error("not supported! '");
|
|
530
|
+
}
|
|
531
|
+
// return txInfo.data
|
|
532
|
+
}
|
|
533
|
+
catch (e) {
|
|
534
|
+
console.error(tag, 'Error: ', e);
|
|
535
|
+
throw e;
|
|
536
|
+
}
|
|
806
537
|
};
|
|
807
538
|
// let get_txs_by_address = async function (coin:string,address:string) {
|
|
808
539
|
// let tag = ' | get_txs_by_address | '
|
|
@@ -829,34 +560,19 @@ var get_txs_by_xpubs = function (coin, xpub) {
|
|
|
829
560
|
// throw e
|
|
830
561
|
// }
|
|
831
562
|
// }
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
log.debug(tag, "blockHash: ", blockHash);
|
|
846
|
-
log.debug(tag, 'blockHash: ', blockHash);
|
|
847
|
-
return [4 /*yield*/, nodeMap[coin].getBlock(blockHash, 2)];
|
|
848
|
-
case 3:
|
|
849
|
-
blockInfo = _a.sent();
|
|
850
|
-
log.debug(tag, "blockInfo: ", blockInfo);
|
|
851
|
-
return [2 /*return*/, blockInfo];
|
|
852
|
-
case 4:
|
|
853
|
-
e_14 = _a.sent();
|
|
854
|
-
console.error(tag, e_14);
|
|
855
|
-
return [3 /*break*/, 5];
|
|
856
|
-
case 5: return [2 /*return*/];
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
});
|
|
563
|
+
let get_block = async function (coin, height) {
|
|
564
|
+
let tag = TAG + " | get_node_info | ";
|
|
565
|
+
try {
|
|
566
|
+
let blockHash = await nodeMap[coin].getBlockHash(height);
|
|
567
|
+
log.debug(tag, "blockHash: ", blockHash);
|
|
568
|
+
log.debug(tag, 'blockHash: ', blockHash);
|
|
569
|
+
let blockInfo = await nodeMap[coin].getBlock(blockHash, 2);
|
|
570
|
+
log.debug(tag, "blockInfo: ", blockInfo);
|
|
571
|
+
return blockInfo;
|
|
572
|
+
}
|
|
573
|
+
catch (e) {
|
|
574
|
+
console.error(tag, e);
|
|
575
|
+
}
|
|
860
576
|
};
|
|
861
577
|
// let get_node_info = async function(){
|
|
862
578
|
// let tag = TAG + " | get_node_info | "
|
|
@@ -882,28 +598,18 @@ var get_block = function (coin, height) {
|
|
|
882
598
|
// console.error(tag,e)
|
|
883
599
|
// }
|
|
884
600
|
// }
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
results.coin = coin;
|
|
900
|
-
return [2 /*return*/, results];
|
|
901
|
-
case 3:
|
|
902
|
-
e_15 = _a.sent();
|
|
903
|
-
console.error(tag, e_15);
|
|
904
|
-
return [3 /*break*/, 4];
|
|
905
|
-
case 4: return [2 /*return*/];
|
|
906
|
-
}
|
|
907
|
-
});
|
|
908
|
-
});
|
|
601
|
+
let get_node_info = async function (coin) {
|
|
602
|
+
let tag = TAG + " | get_node_info | ";
|
|
603
|
+
try {
|
|
604
|
+
log.debug(nodeMap);
|
|
605
|
+
//
|
|
606
|
+
//let results = await nodeMap[coin].getBlockchainInfo()
|
|
607
|
+
// let results = await nodeMap[coin].getBlockchainInfo()
|
|
608
|
+
let results = await nodeMap[coin].getBlockchainInfo();
|
|
609
|
+
results.coin = coin;
|
|
610
|
+
return results;
|
|
611
|
+
}
|
|
612
|
+
catch (e) {
|
|
613
|
+
console.error(tag, e);
|
|
614
|
+
}
|
|
909
615
|
};
|