You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@hashgraph/nft-utilities

Package Overview
Dependencies
Maintainers
16
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hashgraph/nft-utilities - npm Package Compare versions

Comparing version

to
2.2.0

2

dist/cjs/rarity/index.d.ts

@@ -24,4 +24,4 @@ /**

* @return {RarityResult[]} Array of objects with rarity information for each NFT
*/
*/
declare const calculateRarity: (dir: string) => RarityResult[];
export { calculateRarity };

@@ -27,3 +27,3 @@ "use strict";

* @return {RarityResult[]} Array of objects with rarity information for each NFT
*/
*/
const calculateRarity = (dir) => {

@@ -38,2 +38,14 @@ const filenames = (0, files_1.getJSONFilesForDir)(dir);

file.filedata.attributes.forEach((NFTAttribute) => {
// Skip special types of attributes in the rarity calculation (Openrarity specification)
if (NFTAttribute.display_type == 'percentage' ||
NFTAttribute.display_type == 'boost' ||
NFTAttribute.display_type == 'color' ||
NFTAttribute.display_type == 'datetime' ||
NFTAttribute.display_type == 'boolean') {
return traitRarities.push({
trait: NFTAttribute.trait_type,
value: NFTAttribute.value,
rarity: 0,
});
}
const attributeConfigObject = attributesMap.find((attribute) => attribute.trait_type === NFTAttribute.trait_type);

@@ -75,2 +87,4 @@ if (!attributeConfigObject)

files.forEach((file) => {
if (!file.filedata.attributes)
throw new Error(`Attributes not found in file ${file.filename}. Please ensure that your metadata file is valid.`);
file.filedata.attributes.forEach((attribute) => {

@@ -77,0 +91,0 @@ const matchedAttributeIndex = attributesMap.findIndex((attributeObject) => attribute.trait_type === attributeObject.trait_type);

@@ -24,4 +24,4 @@ /**

* @return {RarityResult[]} Array of objects with rarity information for each NFT
*/
*/
declare const calculateRarity: (dir: string) => RarityResult[];
export { calculateRarity };

@@ -27,3 +27,3 @@ "use strict";

* @return {RarityResult[]} Array of objects with rarity information for each NFT
*/
*/
const calculateRarity = (dir) => {

@@ -38,2 +38,14 @@ const filenames = (0, files_1.getJSONFilesForDir)(dir);

file.filedata.attributes.forEach((NFTAttribute) => {
// Skip special types of attributes in the rarity calculation (Openrarity specification)
if (NFTAttribute.display_type == 'percentage' ||
NFTAttribute.display_type == 'boost' ||
NFTAttribute.display_type == 'color' ||
NFTAttribute.display_type == 'datetime' ||
NFTAttribute.display_type == 'boolean') {
return traitRarities.push({
trait: NFTAttribute.trait_type,
value: NFTAttribute.value,
rarity: 0,
});
}
const attributeConfigObject = attributesMap.find((attribute) => attribute.trait_type === NFTAttribute.trait_type);

@@ -75,2 +87,4 @@ if (!attributeConfigObject)

files.forEach((file) => {
if (!file.filedata.attributes)
throw new Error(`Attributes not found in file ${file.filename}. Please ensure that your metadata file is valid.`);
file.filedata.attributes.forEach((attribute) => {

@@ -77,0 +91,0 @@ const matchedAttributeIndex = attributesMap.findIndex((attributeObject) => attribute.trait_type === attributeObject.trait_type);

{
"name": "@hashgraph/nft-utilities",
"version": "2.1.5",
"version": "2.2.0",
"description": "NFT Utilities for Hedera Hashgraph",

@@ -5,0 +5,0 @@ "author": "Michiel Mulders",