@explorins/pers-sdk-react-native 2.0.2 → 2.0.3

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.js CHANGED
@@ -37586,9 +37586,16 @@ function getMetadataFromTokenUnitResponse(tokenUnit, incrementalId) {
37586
37586
  if (!tokenUnit.token?.metadata || tokenUnit.token.metadata.length === 0) {
37587
37587
  return null;
37588
37588
  }
37589
- // Use provided incrementalId, or tokenUnit's incrementalId, or default to 0
37590
- const index = incrementalId ?? tokenUnit.tokenMetadataIncrementalId ?? 0;
37591
- return tokenUnit.token.metadata[index] ?? null;
37589
+ const metadata = tokenUnit.token.metadata;
37590
+ // Use provided incrementalId or tokenUnit's incrementalId to find matching metadata
37591
+ const targetId = incrementalId ?? tokenUnit.tokenMetadataIncrementalId;
37592
+ if (targetId !== undefined) {
37593
+ const found = metadata.find((m) => m.incrementalId === targetId);
37594
+ if (found)
37595
+ return found;
37596
+ }
37597
+ // Fallback to first metadata item
37598
+ return metadata[0];
37592
37599
  }
37593
37600
 
37594
37601
  // ============================================================================