@ecency/sdk 1.3.0 → 1.3.1

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.
@@ -427,7 +427,11 @@ function getAccountFullQueryOptions(username) {
427
427
  if (!response[0]) {
428
428
  throw new Error("[SDK] No account with given username");
429
429
  }
430
- const profile = JSON.parse(response[0].posting_json_metadata).profile;
430
+ let profile = {};
431
+ try {
432
+ profile = JSON.parse(response[0].posting_json_metadata).profile;
433
+ } catch (e) {
434
+ }
431
435
  let follow_stats;
432
436
  try {
433
437
  follow_stats = await CONFIG.hiveClient.database.call(
@@ -436,11 +440,16 @@ function getAccountFullQueryOptions(username) {
436
440
  );
437
441
  } catch (e) {
438
442
  }
439
- const reputation = await CONFIG.hiveClient.call(
440
- "condenser_api",
441
- "get_account_reputations",
442
- [username, 1]
443
- );
443
+ let reputationValue = 0;
444
+ try {
445
+ const reputation = await CONFIG.hiveClient.call(
446
+ "condenser_api",
447
+ "get_account_reputations",
448
+ [username, 1]
449
+ );
450
+ reputationValue = reputation[0]?.reputation ?? 0;
451
+ } catch (e) {
452
+ }
444
453
  return {
445
454
  name: response[0].name,
446
455
  owner: response[0].owner,
@@ -480,11 +489,8 @@ function getAccountFullQueryOptions(username) {
480
489
  voting_power: response[0].voting_power,
481
490
  downvote_manabar: response[0].downvote_manabar,
482
491
  follow_stats,
483
- reputation: reputation[0].reputation,
484
- profile: {
485
- ...profile,
486
- reputation: reputation[0].reputation
487
- }
492
+ reputation: reputationValue,
493
+ profile
488
494
  };
489
495
  },
490
496
  enabled: !!username,