uvd-describe-sdk 0.2.0 → 0.3.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/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ var DEFAULT_JITTER_MS = 400;
6
6
  var TREASURY_EVM = "0xe4dc963c56979E0260fc146b87eE24F18220e545";
7
7
  var PARTNER_CHAIN_ID = 8453;
8
8
  var PARTNER_KEY_ENV = "DESCRIBE_PARTNER_PRIVATE_KEY";
9
- var SDK_VERSION = "0.2.0";
9
+ var SDK_VERSION = "0.3.0";
10
10
  var SDK_NAME = "uvd-describe-sdk-ts";
11
11
  function userAgent(product) {
12
12
  const base = `${SDK_NAME}/${SDK_VERSION}`;
@@ -381,6 +381,30 @@ function parseActivity(v) {
381
381
  if (!isObj(v)) return null;
382
382
  return { firstRatingAt: optString(v.first_rating_at), lastRatingAt: optString(v.last_rating_at) };
383
383
  }
384
+ function parseFreshness(v) {
385
+ if (!isObj(v)) return null;
386
+ const scope = isObj(v.scope) ? v.scope : {};
387
+ return {
388
+ scope: {
389
+ kind: optString(scope.kind),
390
+ direction: optString(scope.direction),
391
+ id: optString(scope.id),
392
+ network: optString(scope.network),
393
+ declaredType: optString(scope.declared_type)
394
+ },
395
+ lastReceivedFeedbackAt: optString(v.last_received_feedback_at),
396
+ lastEligibleRatingAt: optString(v.last_eligible_rating_at),
397
+ datedFeedbackCount: num(v.dated_feedback_count),
398
+ undatedFeedbackCount: num(v.undated_feedback_count),
399
+ timestampCoverage: optString(v.timestamp_coverage),
400
+ eligibleDatedCount: num(v.eligible_dated_count),
401
+ eligibleUndatedCount: num(v.eligible_undated_count),
402
+ eligibleTimestampCoverage: optString(v.eligible_timestamp_coverage),
403
+ refreshedAt: optString(v.refreshed_at),
404
+ indexerCheckedAt: optString(v.indexer_checked_at),
405
+ freshnessVersion: optString(v.freshness_version)
406
+ };
407
+ }
384
408
  function parseSnapshot(v) {
385
409
  if (!isObj(v)) return null;
386
410
  const malformed = [];
@@ -503,6 +527,7 @@ function parseWalletBreakdown(payload, payment) {
503
527
  concentration: parseConcentration(payload.concentration),
504
528
  confidence: parseConfidence(payload.confidence),
505
529
  activity: parseActivity(payload.activity),
530
+ freshness: parseFreshness(payload.freshness),
506
531
  snapshot: parseSnapshot(payload.snapshot),
507
532
  payment,
508
533
  policyVersion: optString(payload.policy_version),
@@ -578,6 +603,8 @@ function parseHealth(payload) {
578
603
  orderingPolicy: String(payload.ordering_policy ?? ""),
579
604
  raterWeightPolicy: String(payload.rater_weight_policy ?? ""),
580
605
  confidencePolicy: String(payload.confidence_policy ?? ""),
606
+ credibilityM: optNumber(payload.credibility_m),
607
+ freshness: parseFreshness(payload.freshness),
581
608
  confidenceThresholds: isObj(payload.confidence_thresholds) ? payload.confidence_thresholds : {},
582
609
  readingPolicy: isObj(payload.reading_policy) ? payload.reading_policy : {},
583
610
  buildSha: optString(payload.build_sha),