@xyo-network/crypto-nft-diviner-score-plugin 2.70.15 → 2.71.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/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/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
- package/dist/docs.json +0 -20712
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin';
|
|
2
2
|
import { PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model';
|
|
3
|
-
export declare const scoreSupply: PassFailScoringFunction<
|
|
3
|
+
export declare const scoreSupply: PassFailScoringFunction<NftInfoFields>;
|
|
4
4
|
//# sourceMappingURL=supply.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supply.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/supply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"supply.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/supply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AACtE,OAAO,EAAc,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAIzF,eAAO,MAAM,WAAW,EAAE,uBAAuB,CAAC,aAAa,CAS9D,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin';
|
|
2
2
|
import { PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model';
|
|
3
3
|
/**
|
|
4
4
|
* Callers SHALL NOT assume that ID numbers have any specific pattern to them, and
|
|
@@ -6,5 +6,5 @@ import { PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model';
|
|
|
6
6
|
* @param nft
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare const scoreTokenId: PassFailScoringFunction<
|
|
9
|
+
export declare const scoreTokenId: PassFailScoringFunction<NftInfoFields>;
|
|
10
10
|
//# sourceMappingURL=tokenId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenId.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/tokenId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tokenId.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/tokenId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AACtE,OAAO,EAAc,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAIzF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,uBAAuB,CAAC,aAAa,CAS/D,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin';
|
|
2
2
|
import { PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model';
|
|
3
|
-
export declare const scoreType: PassFailScoringFunction<
|
|
3
|
+
export declare const scoreType: PassFailScoringFunction<NftInfoFields>;
|
|
4
4
|
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AACtE,OAAO,EAAc,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAEzF,eAAO,MAAM,SAAS,EAAE,uBAAuB,CAAC,aAAa,CAM5D,CAAA"}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
export declare const scoringCriteria: {
|
|
2
2
|
Attributes: {
|
|
3
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
3
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
4
4
|
weight: number;
|
|
5
5
|
};
|
|
6
6
|
'Animation URL': {
|
|
7
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
7
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
8
8
|
weight: number;
|
|
9
9
|
};
|
|
10
10
|
'Background Color': {
|
|
11
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
11
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
12
12
|
weight: number;
|
|
13
13
|
};
|
|
14
14
|
Description: {
|
|
15
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
15
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
16
16
|
weight: number;
|
|
17
17
|
};
|
|
18
18
|
'External Url': {
|
|
19
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
19
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
20
20
|
weight: number;
|
|
21
21
|
};
|
|
22
22
|
Image: {
|
|
23
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
23
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
24
24
|
weight: number;
|
|
25
25
|
};
|
|
26
26
|
'Image Data': {
|
|
27
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
27
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
28
28
|
weight: number;
|
|
29
29
|
};
|
|
30
30
|
Name: {
|
|
31
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
31
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
32
32
|
weight: number;
|
|
33
33
|
};
|
|
34
34
|
'YouTube URL': {
|
|
35
|
-
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").
|
|
35
|
+
score: (nft: import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields | import("@xyo-network/crypto-nft-payload-plugin").OpenSeaNftInfoFields) => import("@xyo-network/crypto-nft-score-model").ScaledScore;
|
|
36
36
|
weight: number;
|
|
37
37
|
};
|
|
38
38
|
'Contract Address': {
|
|
39
|
-
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").
|
|
39
|
+
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields>;
|
|
40
40
|
weight: number;
|
|
41
41
|
};
|
|
42
42
|
Supply: {
|
|
43
|
-
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").
|
|
43
|
+
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields>;
|
|
44
44
|
weight: number;
|
|
45
45
|
};
|
|
46
46
|
'Token Id': {
|
|
47
|
-
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").
|
|
47
|
+
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields>;
|
|
48
48
|
weight: number;
|
|
49
49
|
};
|
|
50
50
|
Type: {
|
|
51
|
-
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").
|
|
51
|
+
score: import("@xyo-network/crypto-nft-score-model").PassFailScoringFunction<import("@xyo-network/crypto-nft-payload-plugin").NftInfoFields>;
|
|
52
52
|
weight: number;
|
|
53
53
|
};
|
|
54
54
|
};
|
package/package.json
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"@ethersproject/address": "^5.7.0",
|
|
14
14
|
"@xylabs/bignumber": "^2.9.3",
|
|
15
15
|
"@xylabs/url": "^2.9.3",
|
|
16
|
-
"@xyo-network/abstract-diviner": "~2.
|
|
17
|
-
"@xyo-network/core": "~2.
|
|
18
|
-
"@xyo-network/crypto-nft-payload-plugin": "~2.
|
|
19
|
-
"@xyo-network/crypto-nft-score-model": "~2.
|
|
20
|
-
"@xyo-network/diviner-model": "~2.
|
|
21
|
-
"@xyo-network/module": "~2.
|
|
22
|
-
"@xyo-network/payload-model": "~2.
|
|
23
|
-
"@xyo-network/payloadset-plugin": "~2.
|
|
16
|
+
"@xyo-network/abstract-diviner": "~2.71.0",
|
|
17
|
+
"@xyo-network/core": "~2.71.0",
|
|
18
|
+
"@xyo-network/crypto-nft-payload-plugin": "~2.71.0",
|
|
19
|
+
"@xyo-network/crypto-nft-score-model": "~2.71.0",
|
|
20
|
+
"@xyo-network/diviner-model": "~2.71.0",
|
|
21
|
+
"@xyo-network/module": "~2.71.0",
|
|
22
|
+
"@xyo-network/payload-model": "~2.71.0",
|
|
23
|
+
"@xyo-network/payloadset-plugin": "~2.71.0",
|
|
24
24
|
"svg-parser": "^2.0.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
},
|
|
66
66
|
"sideEffects": false,
|
|
67
67
|
"types": "dist/types/index.d.ts",
|
|
68
|
-
"version": "2.
|
|
68
|
+
"version": "2.71.0"
|
|
69
69
|
}
|
package/src/Diviner.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AbstractDiviner } from '@xyo-network/abstract-diviner'
|
|
2
2
|
import { PayloadHasher } from '@xyo-network/core'
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
isNftInfo,
|
|
5
|
+
NftInfo,
|
|
6
|
+
NftScore,
|
|
5
7
|
NftScoreDivinerConfig,
|
|
6
8
|
NftScoreDivinerConfigSchema,
|
|
7
|
-
NftScorePayload,
|
|
8
9
|
NftScoreSchema,
|
|
9
10
|
} from '@xyo-network/crypto-nft-payload-plugin'
|
|
10
11
|
import { DivinerParams } from '@xyo-network/diviner-model'
|
|
@@ -15,20 +16,26 @@ import { analyzeNft, NftAnalysis } from './lib'
|
|
|
15
16
|
|
|
16
17
|
export type NftScoreDivinerParams = DivinerParams<AnyConfigSchema<NftScoreDivinerConfig>>
|
|
17
18
|
|
|
18
|
-
const toNftScorePayload = (
|
|
19
|
-
|
|
19
|
+
const toNftScorePayload = (nftInfo: NftInfo, scores: NftAnalysis): NftScore => {
|
|
20
|
+
const { address, chainId, type } = nftInfo
|
|
21
|
+
return { address, chainId, schema: NftScoreSchema, scores, type }
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
export const
|
|
24
|
+
export const isNftScore = (payload: Payload): payload is NftScore => payload.schema === NftScoreSchema
|
|
23
25
|
|
|
24
26
|
export class NftScoreDiviner<TParams extends NftScoreDivinerParams = NftScoreDivinerParams> extends AbstractDiviner<TParams> {
|
|
25
27
|
static override configSchemas = [NftScoreDivinerConfigSchema]
|
|
26
28
|
|
|
27
29
|
protected override divineHandler = async (payloads?: Payload[]): Promise<Payload[]> => {
|
|
28
|
-
const
|
|
30
|
+
const nftInfos = payloads?.filter(isNftInfo) ?? []
|
|
29
31
|
const results = await Promise.all(
|
|
30
|
-
|
|
31
|
-
const [score, sourceHash] = await Promise.all([
|
|
32
|
+
nftInfos.map<Promise<NftScore>>(async (nftInfo) => {
|
|
33
|
+
const [score, sourceHash] = await Promise.all([
|
|
34
|
+
// Analyze the NFT
|
|
35
|
+
toNftScorePayload(nftInfo, await analyzeNft(nftInfo)),
|
|
36
|
+
// Hash the source payload
|
|
37
|
+
PayloadHasher.hashAsync(nftInfo),
|
|
38
|
+
])
|
|
32
39
|
return { ...score, sources: [sourceHash] }
|
|
33
40
|
}),
|
|
34
41
|
)
|
|
@@ -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()
|