@pioneer-platform/utxo-network 8.25.4 → 8.28.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @pioneer-platform/utxo-network
2
2
 
3
+ ## 8.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - chore: feat(pioneer-sdk): Add ERC-20/BEP-20 token table to portfolio dashboard
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @pioneer-platform/blockbook@8.30.0
13
+ - @pioneer-platform/unchained@8.25.0
14
+ - @pioneer-platform/nodes@8.28.0
15
+
16
+ ## 8.27.0
17
+
18
+ ### Minor Changes
19
+
20
+ - chore: feat(pioneer-sdk): Add transaction history integration
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+ - @pioneer-platform/blockbook@8.29.0
26
+
27
+ ## 8.26.0
28
+
29
+ ### Minor Changes
30
+
31
+ - feat(pioneer-sdk): Add transaction history integration
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+ - @pioneer-platform/blockbook@8.28.0
37
+
3
38
  ## 8.25.4
4
39
 
5
40
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { FeeRates } from './types/client-types';
3
3
  export declare const init: (servers: any) => Promise<boolean>;
4
4
  export declare const getInfo: (coin: string) => Promise<any>;
5
5
  export declare const txsMulti: (coin: string, addresses: any) => Promise<void>;
6
- export declare const txsByXpub: (coin: string, addresses: any) => Promise<void>;
6
+ export declare const txsByXpub: (coin: string, addresses: any) => Promise<any>;
7
7
  export declare const utxosByXpub: (coin: string, xpub: any) => Promise<any>;
8
8
  export declare const getPubkeyInfo: (coin: string, xpub: any) => Promise<any>;
9
9
  export declare const getBalanceByXpub: (coin: string, xpub: any) => Promise<{
package/lib/index.js CHANGED
@@ -248,9 +248,16 @@ const init_network = async function (servers) {
248
248
  // @TODO
249
249
  // const blockbooks = servers.filter((server: { type: string; }) => server.type === 'blockbook');
250
250
  // log.debug(tag,"blockbooks: ",blockbooks)
251
- // NOTE: Blockbook is initialized globally by the server with all networks
252
- // Do NOT call blockbook.init() here as it would overwrite the server's initialization
253
- log.debug(tag, 'Blockbook should already be initialized by server');
251
+ // CRITICAL: Initialize blockbook if not already initialized (for standalone/test usage)
252
+ // Check if blockbook has been initialized by checking if it has any URLs configured
253
+ const blockbookUrls = blockbook.getBlockbooks ? blockbook.getBlockbooks() : {};
254
+ if (!blockbookUrls || Object.keys(blockbookUrls).length === 0) {
255
+ log.info(tag, 'Blockbook not initialized - initializing now for transaction history support');
256
+ await blockbook.init();
257
+ }
258
+ else {
259
+ log.debug(tag, 'Blockbook already initialized by server');
260
+ }
254
261
  // @TODO
255
262
  //load daemon servers
256
263
  //load unchained servers
@@ -653,14 +660,14 @@ let get_transaction = async function (coin, txid, format) {
653
660
  }
654
661
  };
655
662
  let get_txs_by_xpub = async function (coin, xpub) {
656
- let tag = ' | get_txs_by_xpub | ';
663
+ let tag = TAG + ' | get_txs_by_xpub | ';
657
664
  try {
658
- log.debug(tag, "checkpoint: ", xpub);
659
- let output = [];
660
- let url = "https://blockchain.info/" + "rawaddr/" + xpub;
661
- //
662
- // let txInfo = await axios({method:'GET',url})
663
- // return txInfo.data
665
+ log.debug(tag, "Getting transactions for xpub: ", xpub.substring(0, 20) + '...');
666
+ // Use blockbook's txsByXpub which uses details=txs to get transaction data
667
+ const xpubData = await blockbook.txsByXpub(coin, xpub);
668
+ log.debug(tag, `Blockbook returned ${xpubData?.transactions?.length || 0} transactions`);
669
+ // Return the transactions array from the xpub data
670
+ return xpubData?.transactions || [];
664
671
  }
665
672
  catch (e) {
666
673
  log.error(tag, stringifyError(e));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/utxo-network",
3
- "version": "8.25.4",
3
+ "version": "8.28.0",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {
@@ -11,11 +11,11 @@
11
11
  "build:live": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts"
12
12
  },
13
13
  "dependencies": {
14
- "@pioneer-platform/blockbook": "^8.27.5",
14
+ "@pioneer-platform/blockbook": "^8.30.0",
15
15
  "@pioneer-platform/loggerdog": "^8.11.0",
16
- "@pioneer-platform/nodes": "^8.26.2",
16
+ "@pioneer-platform/nodes": "^8.28.0",
17
17
  "@pioneer-platform/pioneer-caip": "^9.19.0",
18
- "@pioneer-platform/unchained": "^8.24.1",
18
+ "@pioneer-platform/unchained": "^8.25.0",
19
19
  "@types/request-promise-native": "^1.0.17",
20
20
  "@xchainjs/xchain-client": "^0.7.0",
21
21
  "@xchainjs/xchain-util": "0.2.8",