@pioneer-platform/utxo-network 8.1.61 → 8.1.62

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.
Files changed (2) hide show
  1. package/lib/index.js +38 -103
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -2,104 +2,27 @@
2
2
  /*
3
3
  Anycoin Nodes:
4
4
 
5
- BTC BCH DOGE LTC DASH DGB
5
+ Types of nodes
6
6
 
7
+ Daemons: raw coin nodes
7
8
 
8
- Tier 0:
9
- cointainers
9
+ Blockbook: blockbook indexed nodes (address index)
10
10
 
11
+ Unchained: shapeshift custom API nodes
11
12
 
12
- Tier 1
13
13
 
14
- https://www.blockchain.com/explorer
15
- BTC: BCH ETH
16
- https://www.blockchain.com/api/q
17
-
18
-
19
- Indexers
20
-
21
- Tier 0
22
- * coinquery
23
-
24
- Blockbook
25
- * nodes: ['btc1.trezor.io', 'btc2.trezor.io'],
26
-
27
- electrumx
28
-
29
-
30
-
31
- Tier 1
32
-
33
- (no segwit)
34
- * Bitpay
35
- https://insight.bitpay.com/api
36
-
37
- https://chain.api.btc.com/v3/block/latest/tx?verbose=2
38
-
39
- (segwit)
40
- https://api.smartbit.com.au/v1/blockchain/tx/
41
-
42
-
43
- Notes on batching jsonrpc
44
- https://bitcoin.stackexchange.com/questions/89066/how-to-scale-json-rpc
45
-
46
-
47
- Blockbook docs
48
- https://www.npmjs.com/package/blockbook-client
49
-
50
-
51
-
52
- electrum server lists
53
-
54
- BTC:
55
- More: https://uasf.saltylemon.org/electrum
56
-
57
-
58
- 'erbium1.sytes.net':DEFAULT_PORTS, # core, e-x
59
- 'ecdsa.net':{'t':'50001', 's':'110'}, # core, e-x
60
- 'gh05.geekhosters.com':DEFAULT_PORTS, # core, e-s
61
- 'VPS.hsmiths.com':DEFAULT_PORTS, # core, e-x
62
- 'electrum.anduck.net':DEFAULT_PORTS, # core, e-s; banner with version pending
63
- 'electrum.no-ip.org':DEFAULT_PORTS, # core, e-s
64
- 'electrum.be':DEFAULT_PORTS, # core, e-x
65
- 'helicarrier.bauerj.eu':DEFAULT_PORTS, # core, e-x
66
- 'elex01.blackpole.online':DEFAULT_PORTS, # core, e-x
67
- 'electrumx.not.fyi':DEFAULT_PORTS, # core, e-x
68
- 'node.xbt.eu':DEFAULT_PORTS, # core, e-x
69
- 'kirsche.emzy.de':DEFAULT_PORTS, # core, e-x
70
- 'electrum.villocq.com':DEFAULT_PORTS, # core?, e-s; banner with version recommended
71
- 'us11.einfachmalnettsein.de':DEFAULT_PORTS, # core, e-x
72
- 'electrum.trouth.net':DEFAULT_PORTS, # BU, e-s
73
- 'Electrum.hsmiths.com':{'t':'8080', 's':'995'}, # core, e-x
74
- 'electrum3.hachre.de':DEFAULT_PORTS, # core, e-x
75
- 'b.1209k.com':DEFAULT_PORTS, # XT, jelectrum
76
- 'elec.luggs.co':{ 's':'443'}, # core, e-x
77
- 'btc.smsys.me':{'t':'110', 's':'995'}, # BU, e-x
78
-
79
- BTC (testnet)
80
-
81
- 'testnetnode.arihanc.com': DEFAULT_PORTS,
82
- 'testnet1.bauerj.eu': DEFAULT_PORTS,
83
- '14.3.140.101': DEFAULT_PORTS,
84
- 'testnet.hsmiths.com': {'t':'53011', 's':'53012'},
85
- 'electrum.akinbo.org': DEFAULT_PORTS,
86
- 'ELEX05.blackpole.online': {'t':'52011', 's':'52002'},
87
-
88
-
89
- LTC:
90
-
91
-
92
-
93
- BCH:
94
-
95
-
96
-
97
- DOGE:
98
-
99
-
100
-
101
- DASH:
102
14
 
15
+ Uncchained Spec
16
+ {
17
+ GetInfo: [Function (anonymous)],
18
+ GetAccount: [Function (anonymous)],
19
+ GetTxHistory: [Function (anonymous)],
20
+ GetUtxos: [Function (anonymous)],
21
+ GetTransaction: [Function (anonymous)],
22
+ GetRawTransaction: [Function (anonymous)],
23
+ SendTx: [Function (anonymous)],
24
+ GetNetworkFees: [Function (anonymous)]
25
+ }
103
26
 
104
27
 
105
28
  */
@@ -303,7 +226,7 @@ var init_network = function (servers) {
303
226
  return __generator(this, function (_a) {
304
227
  switch (_a.label) {
305
228
  case 0:
306
- tag = ' | get_txs_by_address | ';
229
+ tag = ' | init_network | ';
307
230
  _a.label = 1;
308
231
  case 1:
309
232
  _a.trys.push([1, 4, , 5]);
@@ -622,24 +545,36 @@ var get_balance_by_address = function (coin, address) {
622
545
  };
623
546
  var get_utxos_by_xpub = function (coin, xpub) {
624
547
  return __awaiter(this, void 0, void 0, function () {
625
- var tag, output, e_11;
548
+ var tag, output, result, e_11;
626
549
  return __generator(this, function (_a) {
627
550
  switch (_a.label) {
628
551
  case 0:
629
552
  tag = TAG + " | get_utxos_by_xpub | ";
630
553
  _a.label = 1;
631
554
  case 1:
632
- _a.trys.push([1, 3, , 4]);
633
- return [4 /*yield*/, blockbook.utxosByXpub(coin, xpub)];
555
+ _a.trys.push([1, 5, , 6]);
556
+ output = {};
557
+ if (!unchained[SYMBOL_TO_CAIP[coin]]) return [3 /*break*/, 3];
558
+ return [4 /*yield*/, unchained[SYMBOL_TO_CAIP[coin]].GetUtxos({ pubkey: xpub })
559
+ //console.log("result: ",result.data)
560
+ ];
634
561
  case 2:
635
- output = _a.sent();
636
- log.debug(tag, "output: ", output);
637
- return [2 /*return*/, output];
562
+ result = _a.sent();
563
+ //console.log("result: ",result.data)
564
+ output = result.data;
565
+ return [3 /*break*/, 4];
638
566
  case 3:
567
+ console.log("no unchained for coin: ", coin);
568
+ //@TODO fall back to node
569
+ output.success = false;
570
+ output.error = "no unchained for coin: " + coin;
571
+ _a.label = 4;
572
+ case 4: return [2 /*return*/, output];
573
+ case 5:
639
574
  e_11 = _a.sent();
640
575
  console.error(tag, e_11);
641
- return [3 /*break*/, 4];
642
- case 4: return [2 /*return*/];
576
+ throw e_11;
577
+ case 6: return [2 /*return*/];
643
578
  }
644
579
  });
645
580
  });
@@ -728,7 +663,7 @@ var get_txs_by_xpub = function (coin, xpub) {
728
663
  return __awaiter(this, void 0, void 0, function () {
729
664
  var tag, output, url;
730
665
  return __generator(this, function (_a) {
731
- tag = ' | get_txs_by_address | ';
666
+ tag = ' | get_txs_by_xpub | ';
732
667
  try {
733
668
  log.debug(tag, "checkpoint: ", xpub);
734
669
  output = [];
@@ -801,7 +736,7 @@ var get_txs_by_xpubs = function (coin, xpub) {
801
736
  return __awaiter(this, void 0, void 0, function () {
802
737
  var tag, output, txInfo, url;
803
738
  return __generator(this, function (_a) {
804
- tag = ' | get_txs_by_address | ';
739
+ tag = ' | get_txs_by_xpubs | ';
805
740
  try {
806
741
  log.debug(tag, "checkpoint: ", xpub);
807
742
  output = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/utxo-network",
3
- "version": "8.1.61",
3
+ "version": "8.1.62",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {