@xyo-network/crypto-nft-diviner-score-plugin 2.70.15 → 2.71.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.
- package/dist/cjs/Diviner.js +14 -8
- package/dist/cjs/Diviner.js.map +1 -1
- package/dist/cjs/lib/rating/analyzeNft.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/contract.js +3 -3
- package/dist/cjs/lib/rating/criteria/scoring/contract.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/animationUrl.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/backgroundColor.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/description.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/externalUrl.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/image.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/imageData.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/name.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/youtubeUrl.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/supply.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/tokenId.js.map +1 -1
- package/dist/cjs/lib/rating/criteria/scoring/type.js.map +1 -1
- package/dist/docs.json +1367 -1437
- package/dist/esm/Diviner.js +13 -7
- package/dist/esm/Diviner.js.map +1 -1
- package/dist/esm/lib/rating/analyzeNft.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/contract.js +3 -3
- package/dist/esm/lib/rating/criteria/scoring/contract.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/animationUrl.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/backgroundColor.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/description.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/externalUrl.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/image.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/imageData.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/name.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/youtubeUrl.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/supply.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/tokenId.js.map +1 -1
- package/dist/esm/lib/rating/criteria/scoring/type.js.map +1 -1
- package/dist/types/Diviner.d.ts +1 -3
- package/dist/types/Diviner.d.ts.map +1 -1
- package/dist/types/lib/rating/analyzeNft.d.ts +2 -2
- package/dist/types/lib/rating/analyzeNft.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/contract.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/contract.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/animationUrl.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/animationUrl.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/backgroundColor.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/backgroundColor.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/description.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/description.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/externalUrl.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/externalUrl.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/image.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/image.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/imageData.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/imageData.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/name.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/name.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/youtubeUrl.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/metadata/youtubeUrl.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/supply.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/supply.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/tokenId.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/tokenId.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoring/type.d.ts +2 -2
- package/dist/types/lib/rating/criteria/scoring/type.d.ts.map +1 -1
- package/dist/types/lib/rating/criteria/scoringCriteria.d.ts +13 -13
- package/package.json +9 -9
- package/src/Diviner.ts +15 -8
- package/src/lib/rating/analyzeNft.ts +2 -2
- package/src/lib/rating/criteria/scoring/contract.ts +5 -5
- package/src/lib/rating/criteria/scoring/metadata/animationUrl.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/backgroundColor.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/description.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/externalUrl.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/image.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/imageData.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/name.ts +2 -2
- package/src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts +2 -2
- package/src/lib/rating/criteria/scoring/supply.ts +2 -2
- package/src/lib/rating/criteria/scoring/tokenId.ts +2 -2
- package/src/lib/rating/criteria/scoring/type.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { Score } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
import { scoringCriteria } from './criteria'
|
|
@@ -13,7 +13,7 @@ export const analyzeNft = async (
|
|
|
13
13
|
/**
|
|
14
14
|
* The NFT to evaluate
|
|
15
15
|
*/
|
|
16
|
-
nft:
|
|
16
|
+
nft: NftInfoFields,
|
|
17
17
|
): Promise<NftAnalysis> => {
|
|
18
18
|
const result = Object.fromEntries(
|
|
19
19
|
await Promise.all(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isAddress } from '@ethersproject/address'
|
|
2
|
-
import {
|
|
2
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
3
3
|
import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'
|
|
4
4
|
|
|
5
|
-
export const scoreContractAddress: PassFailScoringFunction<
|
|
6
|
-
if (!nft.
|
|
7
|
-
if (typeof nft.
|
|
8
|
-
if (!isAddress(nft.
|
|
5
|
+
export const scoreContractAddress: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {
|
|
6
|
+
if (!nft.address) return FAIL
|
|
7
|
+
if (typeof nft.address !== 'string') return FAIL
|
|
8
|
+
if (!isAddress(nft.address)) return FAIL
|
|
9
9
|
return PASS
|
|
10
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
import { isSecure, isValidUrl, isWeb3 } from './lib'
|
|
5
5
|
|
|
6
|
-
export const scoreNftAnimationUrl = (nft:
|
|
6
|
+
export const scoreNftAnimationUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
7
7
|
return scoreAnimationUrl(nft.metadata?.animation_url)
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NftAttribute,
|
|
1
|
+
import { NftAttribute, NftInfoFields, OpenSeaNftAttribute, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementPossible, incrementTotal, incrementTotalAndPossible, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
const isDate = (value: unknown): value is Date => {
|
|
@@ -21,7 +21,7 @@ const isNonEmptyString = (value: unknown): value is string => typeof value === '
|
|
|
21
21
|
|
|
22
22
|
const isNonEmptyStringOrNumber = (value: unknown): value is string | number => value === 'number' || isNonEmptyString(value)
|
|
23
23
|
|
|
24
|
-
export const evaluateNftAttributes = (nft:
|
|
24
|
+
export const evaluateNftAttributes = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore =>
|
|
25
25
|
!nft?.metadata?.attributes ? [0, 1] : evaluateAttributes(nft?.metadata?.attributes)
|
|
26
26
|
|
|
27
27
|
export const evaluateAttributes = (attributes: NftAttribute[] | OpenSeaNftAttribute[] | unknown): ScaledScore => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
const isHexColor = /^[0-9A-F]{6}$/i
|
|
5
5
|
|
|
6
|
-
export const scoreNftBackgroundColor = (nft:
|
|
6
|
+
export const scoreNftBackgroundColor = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
7
7
|
return scoreBackgroundColor(nft.metadata?.background_color)
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
|
-
export const scoreNftDescription = (nft:
|
|
4
|
+
export const scoreNftDescription = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
5
5
|
return scoreDescription(nft.metadata?.description)
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
import { isSecure, isValidUrl } from './lib'
|
|
5
5
|
|
|
6
|
-
export const scoreNftExternalUrl = (nft:
|
|
6
|
+
export const scoreNftExternalUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
7
7
|
return scoreExternalUrl(nft?.metadata?.external_url)
|
|
8
8
|
}
|
|
9
9
|
export const scoreExternalUrl = (external_url: unknown): ScaledScore => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
import { isSecure, isValidUrl, isWeb3 } from './lib'
|
|
5
5
|
|
|
6
6
|
const MaxPossibleImageScore = 3
|
|
7
7
|
|
|
8
|
-
export const scoreNftImage = (nft:
|
|
8
|
+
export const scoreNftImage = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
9
9
|
// If there's no image data
|
|
10
10
|
if (!nft?.metadata?.image) {
|
|
11
11
|
// but there is image data, skip this scoring criteria, otherwise fail it completely
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
import { parse } from 'svg-parser'
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ const isValidImageData = (image_data: string): boolean => {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const scoreNftImageData = (nft:
|
|
21
|
+
export const scoreNftImageData = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
22
22
|
// If there's no image data
|
|
23
23
|
if (!nft?.metadata?.image_data) {
|
|
24
24
|
// but there is an image, skip this scoring criteria, otherwise fail it completely
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
|
-
export const scoreNftName = (nft:
|
|
4
|
+
export const scoreNftName = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
5
5
|
return scoreName(nft.metadata?.name)
|
|
6
6
|
}
|
|
7
7
|
export const scoreName = (name: unknown): ScaledScore => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
import { isSecure, isValidUrl } from './lib'
|
|
5
5
|
|
|
6
|
-
export const scoreNftYoutubeUrl = (nft:
|
|
6
|
+
export const scoreNftYoutubeUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {
|
|
7
7
|
return scoreYoutubeUrl(nft?.metadata?.youtube_url)
|
|
8
8
|
}
|
|
9
9
|
export const scoreYoutubeUrl = (youtube_url: unknown): ScaledScore => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
import { isValidPositiveBigNumber } from './lib'
|
|
5
5
|
|
|
6
|
-
export const scoreSupply: PassFailScoringFunction<
|
|
6
|
+
export const scoreSupply: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {
|
|
7
7
|
if (!nft.supply) return FAIL
|
|
8
8
|
if (typeof nft.supply !== 'string') return FAIL
|
|
9
9
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
4
|
import { isValidPositiveBigNumber } from './lib'
|
|
@@ -9,7 +9,7 @@ import { isValidPositiveBigNumber } from './lib'
|
|
|
9
9
|
* @param nft
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
export const scoreTokenId: PassFailScoringFunction<
|
|
12
|
+
export const scoreTokenId: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {
|
|
13
13
|
if (!nft.tokenId) return FAIL
|
|
14
14
|
if (typeof nft.tokenId !== 'string') return FAIL
|
|
15
15
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'
|
|
2
2
|
import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'
|
|
3
3
|
|
|
4
|
-
export const scoreType: PassFailScoringFunction<
|
|
4
|
+
export const scoreType: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {
|
|
5
5
|
if (!nft.type) return FAIL
|
|
6
6
|
if (typeof nft.type !== 'string') return FAIL
|
|
7
7
|
const type = nft.type.toUpperCase()
|