@hashgraph/nft-utilities
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "@hashgraph/nft-utilities", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "NFT Utilities for Hedera Hashgraph", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,3 +11,3 @@ <div align="center"> | ||
1. **HIP412 metadata validation:** Verify your metadata against the [HIP412 metadata standard](https://github.com/hashgraph/hedera-improvement-proposal/blob/main/HIP/hip-412.md) for NFTs, which returns errors and warnings against the standard. | ||
1. **Token metadata validation:** Verify your metadata against the [token metadata JSON schema V2](https://github.com/hashgraph/hedera-improvement-proposal/blob/main/HIP/hip-412.md) for NFTs, which returns errors and warnings against the standard. | ||
2. **Local metadata validator:** Verify a local folder containing multiple JSON metadata files against the standard before publishing the NFT collection on the Hedera network. | ||
@@ -20,3 +20,3 @@ 3. **Risk score calculation:** Calculate a risk score for an NFT collection from the token information or by passing a token ID of an NFT on the Hedera testnet or mainnet. | ||
- **Package: [HIP412 metadata validator](#hip412-validator)** | ||
- **Package: [Token metadata validator](#token-metadata-validator)** | ||
- **Package: [Local metadata validator](#local-validator)** | ||
@@ -32,5 +32,5 @@ - **Package: [Risk score calculation](#risk-score-calculation)** | ||
## HIP412 metadata validator | ||
## Token metadata validator | ||
Verify your metadata against the [HIP412 metadata standard](https://github.com/hashgraph/hedera-improvement-proposal/blob/main/HIP/hip-412.md) for NFTs which returns errors and warnings against the standard. | ||
Verify your metadata against the [token metadata V2 standard](https://github.com/hashgraph/hedera-improvement-proposal/blob/main/HIP/hip-412.md) for NFTs which returns errors and warnings against the standard. | ||
@@ -45,3 +45,3 @@ ### Usage | ||
Import the package into your project. You can import the `validator` function and the default schema version for HIP412 with `defaultVersion`. | ||
Import the package into your project. You can import the `validator` function and the default schema version for token metadata with `defaultVersion`. | ||
@@ -53,4 +53,4 @@ ```js | ||
You can use the `validator` like below. | ||
1. The first parameter is the stringified JSON object you want to verify against a JSON schema | ||
2. The second parameter is the version of HIP412 metadata schema against which you want to validate your metadata instance. The default value is `2.0.0`. In the future, new functionality might be added, releasing new version numbers. | ||
1. The first parameter is the JSON object you want to verify against a JSON schema | ||
2. The second parameter is the version of the token metadata JSON schema against which you want to validate your metadata instance. The default value is `2.0.0` (V2). In the future, new functionality might be added, releasing new version numbers. | ||
@@ -66,3 +66,3 @@ ```js | ||
const issues = validator(JSON.stringify(metadata), version); | ||
const issues = validator(metadata, version); | ||
``` | ||
@@ -116,3 +116,3 @@ | ||
See: **[/examples/HIP412-metadata-validator](https://github.com/hashgraph/hedera-nft-utilities/tree/main/examples/HIP412-metadata-validator)** | ||
See: **[/examples/token-metadata-validator](https://github.com/hashgraph/hedera-nft-utilities/tree/main/examples/token-metadata-validator)** | ||
@@ -126,7 +126,7 @@ ### Add custom schema versions | ||
```js | ||
const HIP412_2_0_0 = require("./HIP412@2.0.0.json"); | ||
const token_metadata_2_0_0 = require("./HIP412@2.0.0.json"); | ||
const myCustomSchema = require("./myschema.json"); // import your schema | ||
const schemaMap = new Map(); | ||
schemaMap.set('2.0.0', HIP412_2_0_0); | ||
schemaMap.set('2.0.0', token_metadata_2_0_0); | ||
schemaMap.set('<version>', myCustomSchema); // Add your schema to the map | ||
@@ -197,3 +197,3 @@ ``` | ||
This package uses the `validator` function explained in the [previous section](#hip412-validator). | ||
This package uses the `validator` function explained in the [previous section](#token-metadata-validator). | ||
@@ -343,3 +343,3 @@ ### Interface | ||
According to HIP412, the `calculateRarity` function only looks at objects in the `attributes` property that use the following format: | ||
According to token metadata JSON schema V2, the `calculateRarity` function only looks at objects in the `attributes` property that use the following format: | ||
@@ -381,3 +381,3 @@ ``` | ||
Please create an issue or PR on [this repository](https://github.com/michielmulders/hip412-validator). Make sure to join the [Hedera Discord server](https://hedera.com/discord) to ask questions or discuss improvement suggestions. | ||
Please create an issue or PR on [this repository](https://github.com/hashgraph/hedera-nft-utilities). Make sure to join the [Hedera Discord server](https://hedera.com/discord) to ask questions or discuss improvement suggestions. | ||
@@ -384,0 +384,0 @@ # Support |
@@ -20,10 +20,10 @@ /*- | ||
*/ | ||
const HIP10_1_0_0 = require("./HIP10@1.0.0.json"); | ||
const HIP412_2_0_0 = require("./HIP412@2.0.0.json"); | ||
const token_metadata_1_0_0 = require("./HIP10@1.0.0.json"); | ||
const token_metadata_2_0_0 = require("./HIP412@2.0.0.json"); | ||
const schemaMap = new Map(); | ||
schemaMap.set('1.0.0', HIP10_1_0_0); | ||
schemaMap.set('2.0.0', HIP412_2_0_0); | ||
schemaMap.set('1.0.0', token_metadata_1_0_0); | ||
schemaMap.set('2.0.0', token_metadata_2_0_0); | ||
const defaultVersion = '2.0.0'; // Default is HIP412@2.0.0 | ||
const defaultVersion = '2.0.0'; // Default is HIP412@2.0.0 (Token metadata JSON schema V2) | ||
@@ -30,0 +30,0 @@ /** |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
112272
0