@pioneer-platform/eth-network 8.28.4 → 8.30.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,27 @@
1
1
  # @pioneer-platform/eth-network
2
2
 
3
+ ## 8.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - chore: feat(pioneer-sdk): Add transaction history integration
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @pioneer-platform/blockbook@8.29.0
13
+
14
+ ## 8.29.0
15
+
16
+ ### Minor Changes
17
+
18
+ - feat(pioneer-sdk): Add transaction history integration
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+ - @pioneer-platform/blockbook@8.28.0
24
+
3
25
  ## 8.28.4
4
26
 
5
27
  ### Patch Changes
package/lib/index.js CHANGED
@@ -316,9 +316,16 @@ const validateNodesOnStartup = async () => {
316
316
  */
317
317
  const init = async function (settings, redis) {
318
318
  const tag = TAG + ' | init | ';
319
- // NOTE: Blockbook is initialized globally by the server with all networks
320
- // Do NOT call blockbook.init() here as it would overwrite the server's initialization
321
- log.debug(tag, 'Blockbook should already be initialized by server for transaction history');
319
+ // CRITICAL: Initialize blockbook if not already initialized (for standalone/test usage)
320
+ // Check if blockbook has been initialized by checking if it has any URLs configured
321
+ const blockbookUrls = blockbook.getBlockbooks ? blockbook.getBlockbooks() : {};
322
+ if (!blockbookUrls || Object.keys(blockbookUrls).length === 0) {
323
+ log.info(tag, 'Blockbook not initialized - initializing now for transaction history support');
324
+ await blockbook.init();
325
+ }
326
+ else {
327
+ log.debug(tag, 'Blockbook already initialized by server');
328
+ }
322
329
  // Initialize node health tracking (with optional Redis)
323
330
  await NodeHealth.initNodeHealth(redis);
324
331
  // Load web3 nodes from @pioneer-platform/nodes
@@ -1388,27 +1395,29 @@ const getTransactionsByNetwork = async function (networkId, address, options = {
1388
1395
  log.error(tag, `Invalid Ethereum address format: ${address} - ${e.message}`);
1389
1396
  throw new Error(`Invalid Ethereum address: ${address}`);
1390
1397
  }
1391
- // Determine which coin symbol to use for Blockbook
1392
- // ETH mainnet uses "ETH", other networks would need mapping
1393
- let coinSymbol = 'ETH'; // Default to ETH mainnet
1394
- // Map network ID to Blockbook coin symbol
1395
- const networkToCoin = {
1398
+ // Map networkId to Blockbook coin symbol
1399
+ // Blockbook uses coin symbols ('ETH'), not networkIds ('eip155:1')
1400
+ const networkToSymbol = {
1396
1401
  'eip155:1': 'ETH', // Ethereum Mainnet
1397
- 'eip155:137': 'MATIC', // Polygon (if supported)
1398
- 'eip155:56': 'BSC', // BSC (if supported)
1402
+ 'eip155:137': 'MATIC', // Polygon
1403
+ 'eip155:56': 'BSC', // BSC
1404
+ 'eip155:43114': 'AVAX', // Avalanche C-Chain
1405
+ 'eip155:250': 'FTM', // Fantom
1406
+ 'eip155:42161': 'ARB', // Arbitrum
1407
+ 'eip155:10': 'OP', // Optimism
1408
+ 'eip155:8453': 'BASE', // Base
1399
1409
  // Add more as needed
1400
1410
  };
1401
- if (networkToCoin[networkId]) {
1402
- coinSymbol = networkToCoin[networkId];
1403
- }
1404
- else {
1405
- log.warn(tag, `Unknown networkId ${networkId}, defaulting to ETH`);
1411
+ const coinSymbol = networkToSymbol[networkId];
1412
+ if (!coinSymbol) {
1413
+ log.warn(tag, `Unknown networkId ${networkId} for Blockbook - no transaction history available`);
1414
+ return [];
1406
1415
  }
1407
1416
  // Fetch address info from Blockbook with transaction details
1408
1417
  const page = options?.page || 1;
1409
1418
  const pageSize = options?.pageSize || 1000; // Max transactions per page
1410
- log.info(tag, `Fetching from Blockbook: ${coinSymbol} address ${checksummedAddress} page ${page} pageSize ${pageSize}`);
1411
- // Use Blockbook to get address info with transactions
1419
+ log.info(tag, `Fetching from Blockbook: ${coinSymbol} (${networkId}) address ${checksummedAddress} page ${page} pageSize ${pageSize}`);
1420
+ // Use Blockbook to get address info with transactions - pass symbol
1412
1421
  const addressInfo = await blockbook.getAddressInfo(coinSymbol, checksummedAddress, 'txs', { page, pageSize });
1413
1422
  if (!addressInfo || !addressInfo.transactions) {
1414
1423
  log.warn(tag, 'No transactions found for address');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/eth-network",
3
- "version": "8.28.4",
3
+ "version": "8.30.0",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  "@ethersproject/abstract-provider": "^5.8.0",
19
19
  "@ethersproject/bignumber": "^5.8.0",
20
20
  "@ethersproject/providers": "^5.8.0",
21
- "@pioneer-platform/blockbook": "^8.27.5",
21
+ "@pioneer-platform/blockbook": "^8.29.0",
22
22
  "@pioneer-platform/loggerdog": "^8.11.0",
23
23
  "@pioneer-platform/nodes": "^8.26.2",
24
24
  "@pioneer-platform/pioneer-caip": "^9.19.0",