@pioneer-platform/blockbook 8.1.52 → 8.1.54
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.d.ts +14 -1
- package/lib/index.js +239 -75
- package/package.json +4 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
declare const TAG = " | blockbook-client | ";
|
|
2
|
+
declare let pioneerApi: any;
|
|
3
|
+
declare const Blockbook: any;
|
|
2
4
|
declare const log: any;
|
|
3
5
|
declare const fakeUa: any;
|
|
4
6
|
declare const Axios: any;
|
|
@@ -6,6 +8,18 @@ declare const https: any;
|
|
|
6
8
|
declare const axios: any;
|
|
7
9
|
declare const axiosRetry: any;
|
|
8
10
|
declare let BLOCKBOOK_URLS: any;
|
|
11
|
+
declare let BLOCKBOOK_SOCKETS: any;
|
|
12
|
+
declare let spec: string;
|
|
13
|
+
declare let SERVERS_CONFIG: {
|
|
14
|
+
symbol: string;
|
|
15
|
+
blockchain: string;
|
|
16
|
+
caip: string;
|
|
17
|
+
type: string;
|
|
18
|
+
service: string;
|
|
19
|
+
websocket: string;
|
|
20
|
+
}[];
|
|
21
|
+
declare let init_network: (servers?: any) => Promise<boolean>;
|
|
22
|
+
declare let get_fees: (coin: string) => Promise<any>;
|
|
9
23
|
declare let get_info_by_pubkey: (coin: string, pubkey: string, page?: string | undefined) => Promise<any>;
|
|
10
24
|
declare let get_txids_by_address: (coin: string, address: string, page?: number) => Promise<any>;
|
|
11
25
|
declare let get_info_by_address: (coin: string, address: string, filter?: string) => Promise<any>;
|
|
@@ -14,5 +28,4 @@ declare let broadcast_transaction: (coin: string, hex: string) => Promise<any>;
|
|
|
14
28
|
declare let get_transaction: (coin: string, txid: string) => Promise<any>;
|
|
15
29
|
declare let get_utxos_by_xpub: (coin: string, xpub: string) => Promise<any>;
|
|
16
30
|
declare let get_balance_by_xpub: (coin: string, xpub: any) => Promise<number | undefined>;
|
|
17
|
-
declare let init_network: (servers: any, runtime?: string) => boolean;
|
|
18
31
|
declare let get_node_info: () => Promise<true | undefined>;
|
package/lib/index.js
CHANGED
|
@@ -40,6 +40,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
var TAG = " | blockbook-client | ";
|
|
43
|
+
var pioneerApi = require("@pioneer-platform/pioneer-client").default;
|
|
44
|
+
var Blockbook = require('blockbook-client').Blockbook;
|
|
43
45
|
var log = require('@pioneer-platform/loggerdog')();
|
|
44
46
|
var fakeUa = require('fake-useragent');
|
|
45
47
|
var Axios = require('axios');
|
|
@@ -62,26 +64,115 @@ axiosRetry(axios, {
|
|
|
62
64
|
return error.response.status === 503;
|
|
63
65
|
},
|
|
64
66
|
});
|
|
65
|
-
var BLOCKBOOK_URLS = {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
var BLOCKBOOK_URLS = {};
|
|
68
|
+
var BLOCKBOOK_SOCKETS = {};
|
|
69
|
+
var spec = process.env['PIONEER_SPEC'] || 'https://pioneers.dev/spec/swagger.json';
|
|
70
|
+
var SERVERS_CONFIG = [
|
|
71
|
+
{
|
|
72
|
+
symbol: "MATIC",
|
|
73
|
+
blockchain: "polygon",
|
|
74
|
+
caip: "eip155:137/slip44:60",
|
|
75
|
+
type: "blockbook",
|
|
76
|
+
service: "https://indexer.polygon.shapeshift.com",
|
|
77
|
+
websocket: "wss://indexer.polygon.shapeshift.com/websocket"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
symbol: "ETH",
|
|
81
|
+
blockchain: "optimism",
|
|
82
|
+
caip: "eip155:10/slip44:60",
|
|
83
|
+
type: "blockbook",
|
|
84
|
+
service: "https://indexer.optimism.shapeshift.com",
|
|
85
|
+
websocket: "wss://indexer.optimism.shapeshift.com/websocket"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
symbol: "LTC",
|
|
89
|
+
blockchain: "litecoin",
|
|
90
|
+
caip: "bip122:12a765e31ffd4059bada1e25190f6e98/slip44:2",
|
|
91
|
+
type: "blockbook",
|
|
92
|
+
service: "https://indexer.litecoin.shapeshift.com",
|
|
93
|
+
websocket: "wss://indexer.litecoin.shapeshift.com/websocket"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
symbol: "xDAI",
|
|
97
|
+
blockchain: "gnosis",
|
|
98
|
+
caip: "eip155:100/slip44:60",
|
|
99
|
+
type: "blockbook",
|
|
100
|
+
service: "https://indexer.gnosis.shapeshift.com",
|
|
101
|
+
websocket: "wss://indexer.gnosis.shapeshift.com/websocket"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
symbol: "ETH",
|
|
105
|
+
blockchain: "ethereum",
|
|
106
|
+
caip: "eip155:1/slip44:60",
|
|
107
|
+
type: "blockbook",
|
|
108
|
+
service: "https://indexer.ethereum.shapeshift.com",
|
|
109
|
+
websocket: "wss://indexer.ethereum.shapeshift.com/websocket"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
symbol: "DOGE",
|
|
113
|
+
blockchain: "dogecoin",
|
|
114
|
+
caip: "bip122:00000000001a91e3dace36e2be3bf030/slip44:3",
|
|
115
|
+
type: "blockbook",
|
|
116
|
+
service: "https://indexer.dogecoin.shapeshift.com",
|
|
117
|
+
websocket: "wss://indexer.dogecoin.shapeshift.com/websocket"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
symbol: "BNB",
|
|
121
|
+
blockchain: "bnbsmartchain",
|
|
122
|
+
caip: "eip155:56/slip44:60",
|
|
123
|
+
type: "blockbook",
|
|
124
|
+
service: "https://indexer.bnbsmartchain.shapeshift.com",
|
|
125
|
+
websocket: "wss://indexer.bnbsmartchain.shapeshift.com/websocket"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
symbol: "BCH",
|
|
129
|
+
blockchain: "bitcoincash",
|
|
130
|
+
caip: "bip122:000000000000000000651ef99cb9fcbe/slip44:145",
|
|
131
|
+
type: "blockbook",
|
|
132
|
+
service: "https://indexer.bitcoincash.shapeshift.com",
|
|
133
|
+
websocket: "wss://indexer.bitcoincash.shapeshift.com/websocket"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
symbol: "BTC",
|
|
137
|
+
blockchain: "bitcoin",
|
|
138
|
+
caip: "bip122:000000000019d6689c085ae165831e93/slip44:0",
|
|
139
|
+
type: "blockbook",
|
|
140
|
+
service: "https://indexer.bitcoin.shapeshift.com",
|
|
141
|
+
websocket: "wss://indexer.bitcoin.shapeshift.com/websocket"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
symbol: "AVAX",
|
|
145
|
+
blockchain: "avalanche",
|
|
146
|
+
caip: "eip155:43114/slip44:60",
|
|
147
|
+
type: "blockbook",
|
|
148
|
+
service: "https://indexer.avalanche.shapeshift.com",
|
|
149
|
+
websocket: "wss://indexer.avalanche.shapeshift.com/websocket"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
symbol: "AVAX",
|
|
153
|
+
blockchain: "avalanche",
|
|
154
|
+
caip: "eip155:43114/slip44:60",
|
|
155
|
+
type: "blockbook",
|
|
156
|
+
service: "https://indexer.avalanche.shapeshift.com",
|
|
157
|
+
websocket: "wss://indexer.avalanche.shapeshift.com/websocket"
|
|
158
|
+
}
|
|
159
|
+
];
|
|
78
160
|
module.exports = {
|
|
79
|
-
init: function (servers
|
|
80
|
-
return init_network(servers
|
|
161
|
+
init: function (servers) {
|
|
162
|
+
return init_network(servers);
|
|
81
163
|
},
|
|
82
164
|
getInfo: function () {
|
|
83
165
|
return get_node_info();
|
|
84
166
|
},
|
|
167
|
+
getBlockbooks: function () {
|
|
168
|
+
return BLOCKBOOK_URLS;
|
|
169
|
+
},
|
|
170
|
+
getBlockbookSockets: function () {
|
|
171
|
+
return BLOCKBOOK_SOCKETS;
|
|
172
|
+
},
|
|
173
|
+
getFees: function (coin) {
|
|
174
|
+
return get_fees(coin);
|
|
175
|
+
},
|
|
85
176
|
getTransaction: function (coin, txid) {
|
|
86
177
|
return get_transaction(coin, txid);
|
|
87
178
|
},
|
|
@@ -107,9 +198,116 @@ module.exports = {
|
|
|
107
198
|
return broadcast_transaction(coin, hex);
|
|
108
199
|
},
|
|
109
200
|
};
|
|
201
|
+
var init_network = function (servers) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
203
|
+
var tag, blockbooks, config, pioneer, allBlockbooksRemote, e_1, i, blockbook, url, e_2;
|
|
204
|
+
return __generator(this, function (_a) {
|
|
205
|
+
switch (_a.label) {
|
|
206
|
+
case 0:
|
|
207
|
+
tag = ' | get_txs_by_address | ';
|
|
208
|
+
_a.label = 1;
|
|
209
|
+
case 1:
|
|
210
|
+
_a.trys.push([1, 7, , 8]);
|
|
211
|
+
log.debug(tag, "checkpoint: ");
|
|
212
|
+
blockbooks = servers || [];
|
|
213
|
+
_a.label = 2;
|
|
214
|
+
case 2:
|
|
215
|
+
_a.trys.push([2, 5, , 6]);
|
|
216
|
+
config = {
|
|
217
|
+
queryKey: 'unchained:npm',
|
|
218
|
+
spec: spec
|
|
219
|
+
};
|
|
220
|
+
pioneer = new pioneerApi(spec, config);
|
|
221
|
+
return [4 /*yield*/, pioneer.init()];
|
|
222
|
+
case 3:
|
|
223
|
+
pioneer = _a.sent();
|
|
224
|
+
return [4 /*yield*/, pioneer.SearchNodesByType({ type: "blockbook" })];
|
|
225
|
+
case 4:
|
|
226
|
+
allBlockbooksRemote = _a.sent();
|
|
227
|
+
allBlockbooksRemote = allBlockbooksRemote.data;
|
|
228
|
+
log.info(tag, "allBlockbooksRemote: ", allBlockbooksRemote);
|
|
229
|
+
blockbooks.apply(void 0, allBlockbooksRemote);
|
|
230
|
+
return [3 /*break*/, 6];
|
|
231
|
+
case 5:
|
|
232
|
+
e_1 = _a.sent();
|
|
233
|
+
return [3 /*break*/, 6];
|
|
234
|
+
case 6:
|
|
235
|
+
if (blockbooks.length === 0)
|
|
236
|
+
blockbooks.apply(void 0, SERVERS_CONFIG);
|
|
237
|
+
log.info(tag, "blockbooks: ", blockbooks.length);
|
|
238
|
+
for (i = 0; i < blockbooks.length; i++) {
|
|
239
|
+
blockbook = blockbooks[i];
|
|
240
|
+
//get swagger
|
|
241
|
+
if (blockbook) {
|
|
242
|
+
//log.info("unchainedInfo.swagger: ",unchainedInfo.swagger)
|
|
243
|
+
BLOCKBOOK_URLS[blockbook.symbol.toUpperCase()] = blockbook.service;
|
|
244
|
+
url = blockbook.websocket.replace("/websocket", "");
|
|
245
|
+
url = blockbook.websocket.replace("wss://", "https://");
|
|
246
|
+
console.log("url: ", url);
|
|
247
|
+
BLOCKBOOK_SOCKETS[blockbook.symbol.toUpperCase()] = new Blockbook({
|
|
248
|
+
nodes: [url],
|
|
249
|
+
disableTypeValidation: true,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
log.error(tag, "invalid unchained service: ", blockbook);
|
|
254
|
+
// throw Error("invalid unchained service!")
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
log.info(tag, "BLOCKBOOK_URLS: ", BLOCKBOOK_URLS);
|
|
258
|
+
log.info(tag, "BLOCKBOOK_SOCKETS: ", BLOCKBOOK_SOCKETS);
|
|
259
|
+
return [2 /*return*/, true];
|
|
260
|
+
case 7:
|
|
261
|
+
e_2 = _a.sent();
|
|
262
|
+
// console.error(tag, 'Error: ', e)
|
|
263
|
+
throw e_2;
|
|
264
|
+
case 8: return [2 /*return*/];
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
var get_fees = function (coin) {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
271
|
+
var tag, url, body, resp, e_3;
|
|
272
|
+
return __generator(this, function (_a) {
|
|
273
|
+
switch (_a.label) {
|
|
274
|
+
case 0:
|
|
275
|
+
tag = TAG + " | get_fees | ";
|
|
276
|
+
_a.label = 1;
|
|
277
|
+
case 1:
|
|
278
|
+
_a.trys.push([1, 3, , 4]);
|
|
279
|
+
url = BLOCKBOOK_URLS[coin.toUpperCase()] + "/api/v2/fees";
|
|
280
|
+
log.info(tag, "url: ", url);
|
|
281
|
+
body = {
|
|
282
|
+
method: 'GET',
|
|
283
|
+
url: url,
|
|
284
|
+
headers: {
|
|
285
|
+
'api-key': process.env['NOW_NODES_API'],
|
|
286
|
+
'content-type': 'application/json',
|
|
287
|
+
'User-Agent': fakeUa()
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
return [4 /*yield*/, axios(body)
|
|
291
|
+
//log.info(tag,"resp: ",resp)
|
|
292
|
+
//TODO paginate?
|
|
293
|
+
];
|
|
294
|
+
case 2:
|
|
295
|
+
resp = _a.sent();
|
|
296
|
+
//log.info(tag,"resp: ",resp)
|
|
297
|
+
//TODO paginate?
|
|
298
|
+
return [2 /*return*/, resp.data];
|
|
299
|
+
case 3:
|
|
300
|
+
e_3 = _a.sent();
|
|
301
|
+
console.error(tag, e_3);
|
|
302
|
+
return [3 /*break*/, 4];
|
|
303
|
+
case 4: return [2 /*return*/];
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
};
|
|
110
308
|
var get_info_by_pubkey = function (coin, pubkey, page) {
|
|
111
309
|
return __awaiter(this, void 0, void 0, function () {
|
|
112
|
-
var tag, url, body, resp,
|
|
310
|
+
var tag, url, body, resp, e_4;
|
|
113
311
|
return __generator(this, function (_a) {
|
|
114
312
|
switch (_a.label) {
|
|
115
313
|
case 0:
|
|
@@ -137,8 +335,8 @@ var get_info_by_pubkey = function (coin, pubkey, page) {
|
|
|
137
335
|
//TODO paginate?
|
|
138
336
|
return [2 /*return*/, resp.data];
|
|
139
337
|
case 3:
|
|
140
|
-
|
|
141
|
-
console.error(tag,
|
|
338
|
+
e_4 = _a.sent();
|
|
339
|
+
console.error(tag, e_4);
|
|
142
340
|
return [3 /*break*/, 4];
|
|
143
341
|
case 4: return [2 /*return*/];
|
|
144
342
|
}
|
|
@@ -147,7 +345,7 @@ var get_info_by_pubkey = function (coin, pubkey, page) {
|
|
|
147
345
|
};
|
|
148
346
|
var get_txids_by_address = function (coin, address, page) {
|
|
149
347
|
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var tag, url, body, resp,
|
|
348
|
+
var tag, url, body, resp, e_5;
|
|
151
349
|
return __generator(this, function (_a) {
|
|
152
350
|
switch (_a.label) {
|
|
153
351
|
case 0:
|
|
@@ -176,8 +374,8 @@ var get_txids_by_address = function (coin, address, page) {
|
|
|
176
374
|
//TODO paginate?
|
|
177
375
|
return [2 /*return*/, resp.data];
|
|
178
376
|
case 3:
|
|
179
|
-
|
|
180
|
-
console.error(tag,
|
|
377
|
+
e_5 = _a.sent();
|
|
378
|
+
console.error(tag, e_5);
|
|
181
379
|
return [3 /*break*/, 4];
|
|
182
380
|
case 4: return [2 /*return*/];
|
|
183
381
|
}
|
|
@@ -186,7 +384,7 @@ var get_txids_by_address = function (coin, address, page) {
|
|
|
186
384
|
};
|
|
187
385
|
var get_info_by_address = function (coin, address, filter) {
|
|
188
386
|
return __awaiter(this, void 0, void 0, function () {
|
|
189
|
-
var tag, url, body, resp,
|
|
387
|
+
var tag, url, body, resp, e_6;
|
|
190
388
|
return __generator(this, function (_a) {
|
|
191
389
|
switch (_a.label) {
|
|
192
390
|
case 0:
|
|
@@ -214,8 +412,8 @@ var get_info_by_address = function (coin, address, filter) {
|
|
|
214
412
|
//TODO paginate?
|
|
215
413
|
return [2 /*return*/, resp.data];
|
|
216
414
|
case 3:
|
|
217
|
-
|
|
218
|
-
console.error(tag,
|
|
415
|
+
e_6 = _a.sent();
|
|
416
|
+
console.error(tag, e_6);
|
|
219
417
|
return [3 /*break*/, 4];
|
|
220
418
|
case 4: return [2 /*return*/];
|
|
221
419
|
}
|
|
@@ -224,7 +422,7 @@ var get_info_by_address = function (coin, address, filter) {
|
|
|
224
422
|
};
|
|
225
423
|
var get_txs_by_xpub = function (coin, xpub) {
|
|
226
424
|
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
-
var tag, url, body, resp,
|
|
425
|
+
var tag, url, body, resp, e_7;
|
|
228
426
|
return __generator(this, function (_a) {
|
|
229
427
|
switch (_a.label) {
|
|
230
428
|
case 0:
|
|
@@ -248,8 +446,8 @@ var get_txs_by_xpub = function (coin, xpub) {
|
|
|
248
446
|
resp = _a.sent();
|
|
249
447
|
return [2 /*return*/, resp.data];
|
|
250
448
|
case 3:
|
|
251
|
-
|
|
252
|
-
console.error(tag,
|
|
449
|
+
e_7 = _a.sent();
|
|
450
|
+
console.error(tag, e_7);
|
|
253
451
|
return [3 /*break*/, 4];
|
|
254
452
|
case 4: return [2 /*return*/];
|
|
255
453
|
}
|
|
@@ -258,7 +456,7 @@ var get_txs_by_xpub = function (coin, xpub) {
|
|
|
258
456
|
};
|
|
259
457
|
var broadcast_transaction = function (coin, hex) {
|
|
260
458
|
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
-
var tag, url, data, body, output, resp,
|
|
459
|
+
var tag, url, data, body, output, resp, e_8, e_9;
|
|
262
460
|
return __generator(this, function (_a) {
|
|
263
461
|
switch (_a.label) {
|
|
264
462
|
case 0:
|
|
@@ -293,14 +491,14 @@ var broadcast_transaction = function (coin, hex) {
|
|
|
293
491
|
output.success = true;
|
|
294
492
|
return [3 /*break*/, 5];
|
|
295
493
|
case 4:
|
|
296
|
-
|
|
297
|
-
log.error(tag, "error: ",
|
|
494
|
+
e_8 = _a.sent();
|
|
495
|
+
log.error(tag, "error: ", e_8);
|
|
298
496
|
return [3 /*break*/, 5];
|
|
299
497
|
case 5: return [2 /*return*/, output];
|
|
300
498
|
case 6:
|
|
301
|
-
|
|
499
|
+
e_9 = _a.sent();
|
|
302
500
|
//console.error(tag,e)
|
|
303
|
-
throw
|
|
501
|
+
throw e_9;
|
|
304
502
|
case 7: return [2 /*return*/];
|
|
305
503
|
}
|
|
306
504
|
});
|
|
@@ -308,7 +506,7 @@ var broadcast_transaction = function (coin, hex) {
|
|
|
308
506
|
};
|
|
309
507
|
var get_transaction = function (coin, txid) {
|
|
310
508
|
return __awaiter(this, void 0, void 0, function () {
|
|
311
|
-
var tag, url, body, resp,
|
|
509
|
+
var tag, url, body, resp, e_10;
|
|
312
510
|
return __generator(this, function (_a) {
|
|
313
511
|
switch (_a.label) {
|
|
314
512
|
case 0:
|
|
@@ -331,8 +529,8 @@ var get_transaction = function (coin, txid) {
|
|
|
331
529
|
resp = _a.sent();
|
|
332
530
|
return [2 /*return*/, resp.data];
|
|
333
531
|
case 3:
|
|
334
|
-
|
|
335
|
-
console.error(tag,
|
|
532
|
+
e_10 = _a.sent();
|
|
533
|
+
console.error(tag, e_10);
|
|
336
534
|
return [3 /*break*/, 4];
|
|
337
535
|
case 4: return [2 /*return*/];
|
|
338
536
|
}
|
|
@@ -341,7 +539,7 @@ var get_transaction = function (coin, txid) {
|
|
|
341
539
|
};
|
|
342
540
|
var get_utxos_by_xpub = function (coin, xpub) {
|
|
343
541
|
return __awaiter(this, void 0, void 0, function () {
|
|
344
|
-
var tag, url, body, resp,
|
|
542
|
+
var tag, url, body, resp, e_11;
|
|
345
543
|
return __generator(this, function (_a) {
|
|
346
544
|
switch (_a.label) {
|
|
347
545
|
case 0:
|
|
@@ -365,8 +563,8 @@ var get_utxos_by_xpub = function (coin, xpub) {
|
|
|
365
563
|
resp = _a.sent();
|
|
366
564
|
return [2 /*return*/, resp.data];
|
|
367
565
|
case 3:
|
|
368
|
-
|
|
369
|
-
console.error(tag,
|
|
566
|
+
e_11 = _a.sent();
|
|
567
|
+
console.error(tag, e_11);
|
|
370
568
|
return [3 /*break*/, 4];
|
|
371
569
|
case 4: return [2 /*return*/];
|
|
372
570
|
}
|
|
@@ -375,7 +573,7 @@ var get_utxos_by_xpub = function (coin, xpub) {
|
|
|
375
573
|
};
|
|
376
574
|
var get_balance_by_xpub = function (coin, xpub) {
|
|
377
575
|
return __awaiter(this, void 0, void 0, function () {
|
|
378
|
-
var tag, output, balance, i, uxto,
|
|
576
|
+
var tag, output, balance, i, uxto, e_12;
|
|
379
577
|
return __generator(this, function (_a) {
|
|
380
578
|
switch (_a.label) {
|
|
381
579
|
case 0:
|
|
@@ -397,48 +595,14 @@ var get_balance_by_xpub = function (coin, xpub) {
|
|
|
397
595
|
}
|
|
398
596
|
return [2 /*return*/, balance / 100000000];
|
|
399
597
|
case 3:
|
|
400
|
-
|
|
401
|
-
console.error(tag,
|
|
598
|
+
e_12 = _a.sent();
|
|
599
|
+
console.error(tag, e_12);
|
|
402
600
|
return [3 /*break*/, 4];
|
|
403
601
|
case 4: return [2 /*return*/];
|
|
404
602
|
}
|
|
405
603
|
});
|
|
406
604
|
});
|
|
407
605
|
};
|
|
408
|
-
var init_network = function (servers, runtime) {
|
|
409
|
-
var tag = ' | get_txs_by_address | ';
|
|
410
|
-
try {
|
|
411
|
-
log.debug(tag, "checkpoint: ");
|
|
412
|
-
var output = [];
|
|
413
|
-
//get networks from coins module
|
|
414
|
-
// let blockbooks = getBlockBooks()
|
|
415
|
-
// for(let i = 0; i < blockbooks.length; i++){
|
|
416
|
-
// let coinInfo = blockbooks[i]
|
|
417
|
-
// coinInfo.symbol = coinInfo.symbol.toUpperCase()
|
|
418
|
-
// log.debug("coinInfo: ",coinInfo)
|
|
419
|
-
// let blockbookurl = coinInfo.explorer.tx
|
|
420
|
-
// blockbookurl = blockbookurl.replace("/tx/","")
|
|
421
|
-
//
|
|
422
|
-
// if(servers && servers[coinInfo.symbol]){
|
|
423
|
-
// //use configured
|
|
424
|
-
// BLOCKBOOK_URLS[coinInfo.symbol] = servers[coinInfo.symbol]
|
|
425
|
-
// log.debug(coinInfo.symbol+ " blockbookurl: ",servers[coinInfo.symbol])
|
|
426
|
-
// }else{
|
|
427
|
-
// if(!runtime || runtime === 'public'){
|
|
428
|
-
// //use public
|
|
429
|
-
// BLOCKBOOK_URLS[coinInfo.symbol] = blockbookurl
|
|
430
|
-
// log.debug(coinInfo.symbol+ " blockbookurl: ",blockbookurl)
|
|
431
|
-
// }
|
|
432
|
-
// //TODO use pioneer's
|
|
433
|
-
// }
|
|
434
|
-
// }
|
|
435
|
-
return true;
|
|
436
|
-
}
|
|
437
|
-
catch (e) {
|
|
438
|
-
// console.error(tag, 'Error: ', e)
|
|
439
|
-
throw e;
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
606
|
var get_node_info = function () {
|
|
443
607
|
return __awaiter(this, void 0, void 0, function () {
|
|
444
608
|
var tag;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/blockbook",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.54",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/main.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
"refresh": "rm -rf ./node_modules ./package-lock.json && npm install"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"@altangent/lib-blockbook": "^0.12.9",
|
|
15
16
|
"@pioneer-platform/loggerdog": "^8.1.29",
|
|
17
|
+
"@pioneer-platform/pioneer-client": "^9.0.11",
|
|
16
18
|
"@types/request-promise-native": "^1.0.17",
|
|
17
19
|
"@types/ws": "^7.4.2",
|
|
18
20
|
"axios": "^0.21.4",
|
|
19
21
|
"axios-retry": "^3.1.9",
|
|
20
|
-
"blockbook-client": "^0.
|
|
22
|
+
"blockbook-client": "^0.7.8",
|
|
21
23
|
"fake-useragent": "^1.0.1"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|