@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.
@@ -245,25 +245,7 @@ declare function getAccountFullQueryOptions(username: string | undefined): _tans
245
245
  downvote_manabar: any;
246
246
  follow_stats: AccountFollowStats | undefined;
247
247
  reputation: number;
248
- profile: {
249
- reputation: number;
250
- about?: string;
251
- cover_image?: string;
252
- location?: string;
253
- name?: string;
254
- profile_image?: string;
255
- website?: string;
256
- pinned?: string;
257
- beneficiary?: {
258
- account: string;
259
- weight: number;
260
- };
261
- tokens?: {
262
- symbol: string;
263
- type: string;
264
- meta: Record<string, any>;
265
- }[];
266
- };
248
+ profile: AccountProfile;
267
249
  }, Error, {
268
250
  name: any;
269
251
  owner: any;
@@ -304,25 +286,7 @@ declare function getAccountFullQueryOptions(username: string | undefined): _tans
304
286
  downvote_manabar: any;
305
287
  follow_stats: AccountFollowStats | undefined;
306
288
  reputation: number;
307
- profile: {
308
- reputation: number;
309
- about?: string;
310
- cover_image?: string;
311
- location?: string;
312
- name?: string;
313
- profile_image?: string;
314
- website?: string;
315
- pinned?: string;
316
- beneficiary?: {
317
- account: string;
318
- weight: number;
319
- };
320
- tokens?: {
321
- symbol: string;
322
- type: string;
323
- meta: Record<string, any>;
324
- }[];
325
- };
289
+ profile: AccountProfile;
326
290
  }, (string | undefined)[]>, "queryFn"> & {
327
291
  queryFn?: _tanstack_react_query.QueryFunction<{
328
292
  name: any;
@@ -364,25 +328,7 @@ declare function getAccountFullQueryOptions(username: string | undefined): _tans
364
328
  downvote_manabar: any;
365
329
  follow_stats: AccountFollowStats | undefined;
366
330
  reputation: number;
367
- profile: {
368
- reputation: number;
369
- about?: string;
370
- cover_image?: string;
371
- location?: string;
372
- name?: string;
373
- profile_image?: string;
374
- website?: string;
375
- pinned?: string;
376
- beneficiary?: {
377
- account: string;
378
- weight: number;
379
- };
380
- tokens?: {
381
- symbol: string;
382
- type: string;
383
- meta: Record<string, any>;
384
- }[];
385
- };
331
+ profile: AccountProfile;
386
332
  }, (string | undefined)[], never> | undefined;
387
333
  } & {
388
334
  queryKey: (string | undefined)[] & {
@@ -426,25 +372,7 @@ declare function getAccountFullQueryOptions(username: string | undefined): _tans
426
372
  downvote_manabar: any;
427
373
  follow_stats: AccountFollowStats | undefined;
428
374
  reputation: number;
429
- profile: {
430
- reputation: number;
431
- about?: string;
432
- cover_image?: string;
433
- location?: string;
434
- name?: string;
435
- profile_image?: string;
436
- website?: string;
437
- pinned?: string;
438
- beneficiary?: {
439
- account: string;
440
- weight: number;
441
- };
442
- tokens?: {
443
- symbol: string;
444
- type: string;
445
- meta: Record<string, any>;
446
- }[];
447
- };
375
+ profile: AccountProfile;
448
376
  };
449
377
  [dataTagErrorSymbol]: Error;
450
378
  };
@@ -406,7 +406,11 @@ function getAccountFullQueryOptions(username) {
406
406
  if (!response[0]) {
407
407
  throw new Error("[SDK] No account with given username");
408
408
  }
409
- const profile = JSON.parse(response[0].posting_json_metadata).profile;
409
+ let profile = {};
410
+ try {
411
+ profile = JSON.parse(response[0].posting_json_metadata).profile;
412
+ } catch (e) {
413
+ }
410
414
  let follow_stats;
411
415
  try {
412
416
  follow_stats = await CONFIG.hiveClient.database.call(
@@ -415,11 +419,16 @@ function getAccountFullQueryOptions(username) {
415
419
  );
416
420
  } catch (e) {
417
421
  }
418
- const reputation = await CONFIG.hiveClient.call(
419
- "condenser_api",
420
- "get_account_reputations",
421
- [username, 1]
422
- );
422
+ let reputationValue = 0;
423
+ try {
424
+ const reputation = await CONFIG.hiveClient.call(
425
+ "condenser_api",
426
+ "get_account_reputations",
427
+ [username, 1]
428
+ );
429
+ reputationValue = reputation[0]?.reputation ?? 0;
430
+ } catch (e) {
431
+ }
423
432
  return {
424
433
  name: response[0].name,
425
434
  owner: response[0].owner,
@@ -459,11 +468,8 @@ function getAccountFullQueryOptions(username) {
459
468
  voting_power: response[0].voting_power,
460
469
  downvote_manabar: response[0].downvote_manabar,
461
470
  follow_stats,
462
- reputation: reputation[0].reputation,
463
- profile: {
464
- ...profile,
465
- reputation: reputation[0].reputation
466
- }
471
+ reputation: reputationValue,
472
+ profile
467
473
  };
468
474
  },
469
475
  enabled: !!username,