@pioneer-platform/zapper-client 8.25.0 → 8.26.2

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,23 @@
1
1
  # @pioneer-platform/zapper-client
2
2
 
3
+ ## 8.26.2
4
+
5
+ ### Patch Changes
6
+
7
+ - chore: fix: transaction event channel mismatch + add networkId to event payload
8
+
9
+ ## 8.26.1
10
+
11
+ ### Patch Changes
12
+
13
+ - fix: transaction event channel mismatch + add networkId to event payload
14
+
15
+ ## 8.26.0
16
+
17
+ ### Minor Changes
18
+
19
+ - chore: chore: chore: feat(pioneer-server): Migrate from Bun to Node.js for Blockbook WebSocket compatibility
20
+
3
21
  ## 8.25.0
4
22
 
5
23
  ### Minor Changes
package/lib/index.js CHANGED
@@ -358,14 +358,16 @@ var get_portfolio = function (address) {
358
358
  return __awaiter(this, void 0, void 0, function () {
359
359
  var tag, output_1, appsGraphqlQuery, appsResponse, appsData, totalBalanceUSDApp, apps, _i, apps_1, appEdge, appNode, networkName, networkId, positions, _a, positions_1, posEdge, position, balance, tokenForCaip, tokens, _b, tokens_1, tokenWithMeta, token, balance, tokenForCaip, graphqlQuery, tokensResponse, totalBalanceUsdTokens_1, tokenData, tokens, nftGraphqlQuery, nftResponse, nftData, nftUsdNetWorth, allTokens, totalNetWorth, totalNetWorthFormatted, e_2;
360
360
  var _c;
361
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
362
- return __generator(this, function (_12) {
363
- switch (_12.label) {
361
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
362
+ return __generator(this, function (_15) {
363
+ switch (_15.label) {
364
364
  case 0:
365
365
  tag = TAG + " | get_portfolio | ";
366
- _12.label = 1;
366
+ _15.label = 1;
367
367
  case 1:
368
- _12.trys.push([1, 11, , 13]);
368
+ _15.trys.push([1, 11, , 13]);
369
+ log.info(tag, "\uD83D\uDD0D [ZAPPER START] Fetching portfolio for address: ".concat(address));
370
+ log.info(tag, "\uD83D\uDD11 [ZAPPER] API Key configured: ".concat(!!API_KEY, " (length: ").concat((API_KEY === null || API_KEY === void 0 ? void 0 : API_KEY.length) || 0, ")"));
369
371
  output_1 = {
370
372
  balances: [], // Native assets only (ETH, BTC, etc. with /slip44:)
371
373
  tokens: [] // ERC20/BEP20/SPL tokens with contract addresses
@@ -383,11 +385,11 @@ var get_portfolio = function (address) {
383
385
  }
384
386
  })];
385
387
  case 2:
386
- appsResponse = _12.sent();
388
+ appsResponse = _15.sent();
387
389
  if (!((_d = appsResponse.data) === null || _d === void 0 ? void 0 : _d.errors)) return [3 /*break*/, 4];
388
390
  return [4 /*yield*/, handleZapperError({ response: appsResponse }, 'getPortfolio[apps]')];
389
391
  case 3:
390
- _12.sent();
392
+ _15.sent();
391
393
  return [2 /*return*/];
392
394
  case 4:
393
395
  log.debug(tag, "GraphQL apps response:", appsResponse.data);
@@ -495,18 +497,33 @@ var get_portfolio = function (address) {
495
497
  }
496
498
  })];
497
499
  case 5:
498
- tokensResponse = _12.sent();
500
+ tokensResponse = _15.sent();
499
501
  if (!((_1 = tokensResponse.data) === null || _1 === void 0 ? void 0 : _1.errors)) return [3 /*break*/, 7];
502
+ log.error(tag, "❌ [ZAPPER ERROR] GraphQL errors in tokens response:", JSON.stringify(tokensResponse.data.errors, null, 2));
500
503
  return [4 /*yield*/, handleZapperError({ response: tokensResponse }, 'getPortfolio[tokens]')];
501
504
  case 6:
502
- _12.sent();
505
+ _15.sent();
503
506
  return [2 /*return*/];
504
507
  case 7:
505
508
  log.debug(tag, "GraphQL tokens response:", tokensResponse.data);
509
+ // DIAGNOSTIC: Log the full response structure
510
+ if (!((_3 = (_2 = tokensResponse.data) === null || _2 === void 0 ? void 0 : _2.data) === null || _3 === void 0 ? void 0 : _3.portfolioV2)) {
511
+ log.error(tag, "❌ [ZAPPER] portfolioV2 missing from response! Full response:", JSON.stringify(tokensResponse.data, null, 2));
512
+ }
513
+ else if (!tokensResponse.data.data.portfolioV2.tokenBalances) {
514
+ log.error(tag, "❌ [ZAPPER] tokenBalances missing from portfolioV2! Full portfolioV2:", JSON.stringify(tokensResponse.data.data.portfolioV2, null, 2));
515
+ }
506
516
  totalBalanceUsdTokens_1 = 0;
507
- if ((_4 = (_3 = (_2 = tokensResponse.data) === null || _2 === void 0 ? void 0 : _2.data) === null || _3 === void 0 ? void 0 : _3.portfolioV2) === null || _4 === void 0 ? void 0 : _4.tokenBalances) {
517
+ if ((_6 = (_5 = (_4 = tokensResponse.data) === null || _4 === void 0 ? void 0 : _4.data) === null || _5 === void 0 ? void 0 : _5.portfolioV2) === null || _6 === void 0 ? void 0 : _6.tokenBalances) {
508
518
  tokenData = tokensResponse.data.data.portfolioV2.tokenBalances;
509
- tokens = ((_5 = tokenData.byToken) === null || _5 === void 0 ? void 0 : _5.edges) || [];
519
+ tokens = ((_7 = tokenData.byToken) === null || _7 === void 0 ? void 0 : _7.edges) || [];
520
+ // DIAGNOSTIC: Log token data structure
521
+ log.info(tag, "📊 [ZAPPER] Token data structure:", {
522
+ totalBalanceUSD: tokenData.totalBalanceUSD,
523
+ byTokenExists: !!tokenData.byToken,
524
+ edgesExists: !!((_8 = tokenData.byToken) === null || _8 === void 0 ? void 0 : _8.edges),
525
+ tokensLength: tokens.length
526
+ });
510
527
  // DO NOT set output.tokens here - let categorization logic handle it
511
528
  // output.tokens will be populated by the CAIP categorization logic below
512
529
  log.info(tag, "tokens from GraphQL: ", tokens.length);
@@ -586,16 +603,16 @@ var get_portfolio = function (address) {
586
603
  }
587
604
  })];
588
605
  case 8:
589
- nftResponse = _12.sent();
590
- if (!((_6 = nftResponse.data) === null || _6 === void 0 ? void 0 : _6.errors)) return [3 /*break*/, 10];
606
+ nftResponse = _15.sent();
607
+ if (!((_9 = nftResponse.data) === null || _9 === void 0 ? void 0 : _9.errors)) return [3 /*break*/, 10];
591
608
  return [4 /*yield*/, handleZapperError({ response: nftResponse }, 'getPortfolio[nfts]')];
592
609
  case 9:
593
- _12.sent();
610
+ _15.sent();
594
611
  return [2 /*return*/];
595
612
  case 10:
596
- nftData = (_9 = (_8 = (_7 = nftResponse.data) === null || _7 === void 0 ? void 0 : _7.data) === null || _8 === void 0 ? void 0 : _8.portfolioV2) === null || _9 === void 0 ? void 0 : _9.nftBalances;
613
+ nftData = (_12 = (_11 = (_10 = nftResponse.data) === null || _10 === void 0 ? void 0 : _10.data) === null || _11 === void 0 ? void 0 : _11.portfolioV2) === null || _12 === void 0 ? void 0 : _12.nftBalances;
597
614
  nftUsdNetWorth = (nftData === null || nftData === void 0 ? void 0 : nftData.totalBalanceUSD) || 0;
598
- allTokens = ((_11 = (_10 = nftData === null || nftData === void 0 ? void 0 : nftData.byToken) === null || _10 === void 0 ? void 0 : _10.edges) === null || _11 === void 0 ? void 0 : _11.map(function (edge) { return edge.node.token; })) || [];
615
+ allTokens = ((_14 = (_13 = nftData === null || nftData === void 0 ? void 0 : nftData.byToken) === null || _13 === void 0 ? void 0 : _13.edges) === null || _14 === void 0 ? void 0 : _14.map(function (edge) { return edge.node.token; })) || [];
599
616
  output_1.nfts = allTokens;
600
617
  output_1.nftUsdNetWorth = (_c = {}, _c[address.toLowerCase()] = nftUsdNetWorth.toString(), _c);
601
618
  output_1.totalBalanceUsdTokens = totalBalanceUsdTokens_1;
@@ -636,10 +653,10 @@ var get_portfolio = function (address) {
636
653
  }
637
654
  return [2 /*return*/, output_1];
638
655
  case 11:
639
- e_2 = _12.sent();
656
+ e_2 = _15.sent();
640
657
  return [4 /*yield*/, handleZapperError(e_2, 'getPortfolio')];
641
658
  case 12:
642
- _12.sent();
659
+ _15.sent();
643
660
  return [3 /*break*/, 13];
644
661
  case 13: return [2 /*return*/];
645
662
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/zapper-client",
3
- "version": "8.25.0",
3
+ "version": "8.26.2",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "dependencies": {