@xyo-network/crypto-nft-diviner-score-plugin 2.95.5 → 2.96.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.
@@ -11,12 +11,9 @@ import { PayloadBuilder } from "@xyo-network/payload-builder";
11
11
  import { FAIL, PASS } from "@xyo-network/crypto-nft-score-model";
12
12
  import { isAddress } from "ethers";
13
13
  var scoreContractAddress = (nft) => {
14
- if (!nft.address)
15
- return FAIL;
16
- if (typeof nft.address !== "string")
17
- return FAIL;
18
- if (!isAddress(nft.address))
19
- return FAIL;
14
+ if (!nft.address) return FAIL;
15
+ if (typeof nft.address !== "string") return FAIL;
16
+ if (!isAddress(nft.address)) return FAIL;
20
17
  return PASS;
21
18
  };
22
19
 
@@ -27,8 +24,7 @@ import { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS as P
27
24
  import { URL } from "@xylabs/url";
28
25
  var web3Protocols = ["ipfs:", "ar:"];
29
26
  var toUrl = (url) => {
30
- if (!url)
31
- return void 0;
27
+ if (!url) return void 0;
32
28
  try {
33
29
  return new URL(url);
34
30
  } catch {
@@ -45,20 +41,15 @@ var scoreNftAnimationUrl = (nft) => {
45
41
  };
46
42
  var scoreAnimationUrl = (animation_url) => {
47
43
  const score = [0, 0];
48
- if (animation_url === void 0 || animation_url === null)
49
- return PASS2;
44
+ if (animation_url === void 0 || animation_url === null) return PASS2;
50
45
  incrementPossible(score);
51
- if (typeof animation_url !== "string")
52
- return score;
46
+ if (typeof animation_url !== "string") return score;
53
47
  incrementTotalAndPossible(score);
54
- if (!isValidUrl(animation_url))
55
- return score;
48
+ if (!isValidUrl(animation_url)) return score;
56
49
  incrementTotalAndPossible(score);
57
- if (!isSecure(animation_url))
58
- return score;
50
+ if (!isSecure(animation_url)) return score;
59
51
  incrementTotalAndPossible(score);
60
- if (!isWeb3(animation_url))
61
- return score;
52
+ if (!isWeb3(animation_url)) return score;
62
53
  return incrementTotal(score);
63
54
  };
64
55
 
@@ -81,8 +72,7 @@ var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
81
72
  var isNonEmptyStringOrNumber = (value) => value === "number" || isNonEmptyString(value);
82
73
  var evaluateNftAttributes = (nft) => nft?.metadata?.attributes ? evaluateAttributes(nft?.metadata?.attributes) : [0, 1];
83
74
  var evaluateAttributes = (attributes) => {
84
- if (!attributes || !Array.isArray(attributes) || attributes.length === 0)
85
- return [0, 1];
75
+ if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [0, 1];
86
76
  const score = [0, 0];
87
77
  for (const attribute of attributes) {
88
78
  const [attributeTotal, attributePossible] = evaluateAttribute(attribute);
@@ -95,16 +85,13 @@ var evaluateAttribute = (attribute) => {
95
85
  const max_value = attribute?.max_value;
96
86
  const trait_type = attribute?.trait_type;
97
87
  const value = attribute?.value;
98
- if (!attribute || typeof attribute !== "object" || !isNonEmptyString(trait_type) || !isNonEmptyStringOrNumber(value))
99
- return score;
88
+ if (!attribute || typeof attribute !== "object" || !isNonEmptyString(trait_type) || !isNonEmptyStringOrNumber(value)) return score;
100
89
  incrementTotal2(score);
101
90
  incrementPossible2(score);
102
- if (validDisplayType(attribute))
103
- incrementTotal2(score);
91
+ if (validDisplayType(attribute)) incrementTotal2(score);
104
92
  if (max_value !== void 0) {
105
93
  incrementPossible2(score);
106
- if (isNumber(max_value) && isNumber(value) && value <= max_value)
107
- incrementTotal2(score);
94
+ if (isNumber(max_value) && isNumber(value) && value <= max_value) incrementTotal2(score);
108
95
  }
109
96
  return score;
110
97
  };
@@ -112,24 +99,20 @@ var validDisplayType = (attribute) => {
112
99
  switch (attribute?.display_type) {
113
100
  case "number":
114
101
  case "boost_number": {
115
- if (isNumber(attribute?.value))
116
- return true;
102
+ if (isNumber(attribute?.value)) return true;
117
103
  break;
118
104
  }
119
105
  case "boost_percentage": {
120
- if (isPercentage(attribute?.value))
121
- return true;
106
+ if (isPercentage(attribute?.value)) return true;
122
107
  break;
123
108
  }
124
109
  case "date": {
125
- if (isDate(attribute?.value))
126
- return true;
110
+ if (isDate(attribute?.value)) return true;
127
111
  break;
128
112
  }
129
113
  case "string":
130
114
  case void 0: {
131
- if (isNonEmptyString(attribute?.value))
132
- return true;
115
+ if (isNonEmptyString(attribute?.value)) return true;
133
116
  break;
134
117
  }
135
118
  default: {
@@ -147,14 +130,11 @@ var scoreNftBackgroundColor = (nft) => {
147
130
  };
148
131
  var scoreBackgroundColor = (background_color) => {
149
132
  const score = [0, 0];
150
- if (background_color === void 0 || background_color === null)
151
- return PASS3;
133
+ if (background_color === void 0 || background_color === null) return PASS3;
152
134
  incrementPossible3(score);
153
- if (typeof background_color !== "string")
154
- return score;
135
+ if (typeof background_color !== "string") return score;
155
136
  incrementTotalAndPossible3(score);
156
- if (!isHexColor.test(background_color.toUpperCase()))
157
- return score;
137
+ if (!isHexColor.test(background_color.toUpperCase())) return score;
158
138
  return incrementTotal3(score);
159
139
  };
160
140
 
@@ -165,8 +145,7 @@ var scoreNftDescription = (nft) => {
165
145
  };
166
146
  var scoreDescription = (description) => {
167
147
  const score = [0, 1];
168
- if (!description || typeof description !== "string")
169
- return score;
148
+ if (!description || typeof description !== "string") return score;
170
149
  return incrementTotal4(score);
171
150
  };
172
151
 
@@ -177,11 +156,9 @@ var scoreNftExternalUrl = (nft) => {
177
156
  };
178
157
  var scoreExternalUrl = (external_url) => {
179
158
  const score = [0, 2];
180
- if (external_url === void 0 || external_url === null || typeof external_url !== "string" || !isValidUrl(external_url))
181
- return score;
159
+ if (external_url === void 0 || external_url === null || typeof external_url !== "string" || !isValidUrl(external_url)) return score;
182
160
  incrementTotal5(score);
183
- if (!isSecure(external_url))
184
- return score;
161
+ if (!isSecure(external_url)) return score;
185
162
  return incrementTotal5(score);
186
163
  };
187
164
 
@@ -197,14 +174,11 @@ var scoreNftImage = (nft) => {
197
174
  };
198
175
  var scoreImage = (image) => {
199
176
  const score = [0, MaxPossibleImageScore];
200
- if (!image || typeof image !== "string" || !isValidUrl(image))
201
- return score;
177
+ if (!image || typeof image !== "string" || !isValidUrl(image)) return score;
202
178
  incrementTotal6(score);
203
- if (!isSecure(image))
204
- return score;
179
+ if (!isSecure(image)) return score;
205
180
  incrementTotal6(score);
206
- if (!isWeb3(image))
207
- return score;
181
+ if (!isWeb3(image)) return score;
208
182
  incrementTotal6(score);
209
183
  return score;
210
184
  };
@@ -214,8 +188,7 @@ import { PASS as PASS5 } from "@xyo-network/crypto-nft-score-model";
214
188
  import { parse } from "svg-parser";
215
189
  var MaxPossibleImageDataScore = 1;
216
190
  var isValidImageData = (image_data) => {
217
- if (!image_data.startsWith("<svg"))
218
- return false;
191
+ if (!image_data.startsWith("<svg")) return false;
219
192
  try {
220
193
  parse(image_data);
221
194
  return true;
@@ -241,8 +214,7 @@ var scoreNftName = (nft) => {
241
214
  };
242
215
  var scoreName = (name) => {
243
216
  const score = [0, 1];
244
- if (!name || typeof name !== "string")
245
- return score;
217
+ if (!name || typeof name !== "string") return score;
246
218
  return incrementTotal7(score);
247
219
  };
248
220
 
@@ -252,24 +224,19 @@ var scoreNftYoutubeUrl = (nft) => {
252
224
  return scoreYoutubeUrl(nft?.metadata?.youtube_url);
253
225
  };
254
226
  var scoreYoutubeUrl = (youtube_url) => {
255
- if (youtube_url === void 0 || youtube_url === null)
256
- return PASS6;
227
+ if (youtube_url === void 0 || youtube_url === null) return PASS6;
257
228
  const score = [0, 2];
258
- if (typeof youtube_url !== "string" || !isValidUrl(youtube_url))
259
- return score;
229
+ if (typeof youtube_url !== "string" || !isValidUrl(youtube_url)) return score;
260
230
  incrementTotal8(score);
261
- if (!isSecure(youtube_url))
262
- return score;
231
+ if (!isSecure(youtube_url)) return score;
263
232
  return incrementTotal8(score);
264
233
  };
265
234
 
266
235
  // src/lib/rating/criteria/scoring/supply.ts
267
236
  import { FAIL as FAIL2, PASS as PASS7 } from "@xyo-network/crypto-nft-score-model";
268
237
  var scoreSupply = (nft) => {
269
- if (!nft.supply)
270
- return FAIL2;
271
- if (typeof nft.supply !== "string")
272
- return FAIL2;
238
+ if (!nft.supply) return FAIL2;
239
+ if (typeof nft.supply !== "string") return FAIL2;
273
240
  try {
274
241
  return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? PASS7 : FAIL2;
275
242
  } catch {
@@ -280,10 +247,8 @@ var scoreSupply = (nft) => {
280
247
  // src/lib/rating/criteria/scoring/tokenId.ts
281
248
  import { FAIL as FAIL3, PASS as PASS8 } from "@xyo-network/crypto-nft-score-model";
282
249
  var scoreTokenId = (nft) => {
283
- if (!nft.tokenId)
284
- return FAIL3;
285
- if (typeof nft.tokenId !== "string")
286
- return FAIL3;
250
+ if (!nft.tokenId) return FAIL3;
251
+ if (typeof nft.tokenId !== "string") return FAIL3;
287
252
  try {
288
253
  return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? PASS8 : FAIL3;
289
254
  } catch {
@@ -294,13 +259,10 @@ var scoreTokenId = (nft) => {
294
259
  // src/lib/rating/criteria/scoring/type.ts
295
260
  import { FAIL as FAIL4, PASS as PASS9 } from "@xyo-network/crypto-nft-score-model";
296
261
  var scoreType = (nft) => {
297
- if (!nft.type)
298
- return FAIL4;
299
- if (typeof nft.type !== "string")
300
- return FAIL4;
262
+ if (!nft.type) return FAIL4;
263
+ if (typeof nft.type !== "string") return FAIL4;
301
264
  const type = nft.type.toUpperCase();
302
- if (type !== "ERC721" && type !== "ERC1155")
303
- return FAIL4;
265
+ if (type !== "ERC721" && type !== "ERC1155") return FAIL4;
304
266
  return PASS9;
305
267
  };
306
268
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner.ts","../../src/lib/rating/criteria/scoring/contract.ts","../../src/lib/rating/criteria/scoring/metadata/animationUrl.ts","../../src/lib/rating/criteria/scoring/metadata/lib/urlHelpers.ts","../../src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts","../../src/lib/rating/criteria/scoring/metadata/backgroundColor.ts","../../src/lib/rating/criteria/scoring/metadata/description.ts","../../src/lib/rating/criteria/scoring/metadata/externalUrl.ts","../../src/lib/rating/criteria/scoring/metadata/image.ts","../../src/lib/rating/criteria/scoring/metadata/imageData.ts","../../src/lib/rating/criteria/scoring/metadata/name.ts","../../src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts","../../src/lib/rating/criteria/scoring/supply.ts","../../src/lib/rating/criteria/scoring/tokenId.ts","../../src/lib/rating/criteria/scoring/type.ts","../../src/lib/rating/criteria/scoringCriteria.ts","../../src/lib/rating/analyzeNft.ts","../../src/Plugin.ts"],"sourcesContent":["import {\n isNftInfo,\n NftInfo,\n NftScore,\n NftScoreDivinerConfig,\n NftScoreDivinerConfigSchema,\n NftScoreSchema,\n} from '@xyo-network/crypto-nft-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { analyzeNft, NftAnalysis } from './lib'\n\nexport type NftScoreDivinerParams = DivinerParams<AnyConfigSchema<NftScoreDivinerConfig>>\n\nconst toNftScorePayload = (nftInfo: NftInfo, scores: NftAnalysis): NftScore => {\n const { address, chainId, type } = nftInfo\n return { address, chainId, schema: NftScoreSchema, scores, type }\n}\n\nexport const isNftScore = (payload: Payload): payload is NftScore => payload.schema === NftScoreSchema\n\nexport class NftScoreDiviner<TParams extends NftScoreDivinerParams = NftScoreDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, NftScoreDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = NftScoreDivinerConfigSchema\n\n protected override divineHandler = async (payloads?: Payload[]): Promise<Payload[]> => {\n const nftInfos = payloads?.filter(isNftInfo) ?? []\n const results = await Promise.all(\n nftInfos.map<Promise<NftScore>>(async (nftInfo) => {\n const [score, sourceHash] = await Promise.all([\n // Analyze the NFT\n toNftScorePayload(nftInfo, await analyzeNft(nftInfo)),\n // Hash the source payload\n PayloadBuilder.dataHash(nftInfo),\n ])\n return { ...score, sources: [sourceHash] }\n }),\n )\n return results\n }\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\nimport { isAddress } from 'ethers'\n\nexport const scoreContractAddress: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.address) return FAIL\n if (typeof nft.address !== 'string') return FAIL\n if (!isAddress(nft.address)) return FAIL\n return PASS\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl, isWeb3 } from './lib'\n\nexport const scoreNftAnimationUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreAnimationUrl(nft.metadata?.animation_url)\n}\n\nexport const scoreAnimationUrl = (animation_url: unknown): ScaledScore => {\n const score: ScaledScore = [0, 0]\n if (animation_url === undefined || animation_url === null) return PASS\n incrementPossible(score)\n if (typeof animation_url !== 'string') return score\n incrementTotalAndPossible(score)\n if (!isValidUrl(animation_url)) return score\n incrementTotalAndPossible(score)\n if (!isSecure(animation_url)) return score\n incrementTotalAndPossible(score)\n if (!isWeb3(animation_url)) return score\n return incrementTotal(score)\n}\n","import { URL } from '@xylabs/url'\n\nexport const web3Protocols = ['ipfs:', 'ar:']\n\nexport const toUrl = (url?: string | null): URL | undefined => {\n if (!url) return undefined\n try {\n return new URL(url)\n } catch {\n return undefined\n }\n}\n\nexport const isValidUrl = (url?: string | null): boolean => toUrl(url) !== undefined\n// eslint-disable-next-line unicorn/prefer-includes\nexport const isWeb3 = (url?: string | null): boolean => web3Protocols.some((protocol) => protocol === toUrl(url)?.protocol)\nexport const isWeb2 = (url?: string | null): boolean => !isWeb3(url)\nexport const isSecure = (url?: string | null): boolean => isWeb3(url) || toUrl(url)?.protocol === 'https:'\n","import { NftAttribute, NftInfoFields, OpenSeaNftAttribute, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementPossible, incrementTotal, incrementTotalAndPossible, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nconst isDate = (value: unknown): value is Date => {\n if (isNumber(value)) {\n try {\n new Date(value)\n return true\n } catch {\n return false\n }\n }\n return false\n}\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number'\n\nconst isPercentage = (value: unknown): boolean => isNumber(value) && value >= 0 && value <= 100\n\nconst isNonEmptyString = (value: unknown): value is string => typeof value === 'string' && value.length > 0\n\nconst isNonEmptyStringOrNumber = (value: unknown): value is string | number => value === 'number' || isNonEmptyString(value)\n\nexport const evaluateNftAttributes = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore =>\n nft?.metadata?.attributes ? evaluateAttributes(nft?.metadata?.attributes) : [0, 1]\n\nexport const evaluateAttributes = (attributes: NftAttribute[] | OpenSeaNftAttribute[] | unknown): ScaledScore => {\n if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [0, 1]\n const score: ScaledScore = [0, 0]\n for (const attribute of attributes) {\n const [attributeTotal, attributePossible] = evaluateAttribute(attribute)\n incrementTotalAndPossible(score, attributeTotal, attributePossible)\n }\n return [1, 1]\n}\n\nexport const evaluateAttribute = (attribute: OpenSeaNftAttribute): ScaledScore => {\n const score: ScaledScore = [0, 1]\n const max_value = attribute?.max_value\n const trait_type = attribute?.trait_type\n const value = attribute?.value\n\n // Validate trait_type & value\n if (!attribute || typeof attribute !== 'object' || !isNonEmptyString(trait_type) || !isNonEmptyStringOrNumber(value)) return score\n incrementTotal(score)\n\n // Validate display_type\n incrementPossible(score)\n if (validDisplayType(attribute)) incrementTotal(score)\n\n // Validate max_value\n if (max_value !== undefined) {\n incrementPossible(score)\n if (isNumber(max_value) && isNumber(value) && value <= max_value) incrementTotal(score)\n }\n\n return score\n}\n\nconst validDisplayType = (attribute: OpenSeaNftAttribute): boolean => {\n switch (attribute?.display_type) {\n case 'number':\n case 'boost_number': {\n if (isNumber(attribute?.value)) return true\n break\n }\n case 'boost_percentage': {\n if (isPercentage(attribute?.value)) return true\n break\n }\n case 'date': {\n if (isDate(attribute?.value)) return true\n break\n }\n case 'string':\n case undefined: {\n if (isNonEmptyString(attribute?.value)) return true\n break\n }\n default: {\n break\n }\n }\n return false\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nconst isHexColor = /^[\\da-f]{6}$/i\n\nexport const scoreNftBackgroundColor = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreBackgroundColor(nft.metadata?.background_color)\n}\n\nexport const scoreBackgroundColor = (background_color: unknown): ScaledScore => {\n const score: ScaledScore = [0, 0]\n if (background_color === undefined || background_color === null) return PASS\n incrementPossible(score)\n if (typeof background_color !== 'string') return score\n incrementTotalAndPossible(score)\n if (!isHexColor.test(background_color.toUpperCase())) return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreNftDescription = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreDescription(nft.metadata?.description)\n}\n\nexport const scoreDescription = (description: unknown): ScaledScore => {\n const score: ScaledScore = [0, 1]\n if (!description || typeof description !== 'string') return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl } from './lib'\n\nexport const scoreNftExternalUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreExternalUrl(nft?.metadata?.external_url)\n}\nexport const scoreExternalUrl = (external_url: unknown): ScaledScore => {\n const score: ScaledScore = [0, 2]\n if (external_url === undefined || external_url === null || typeof external_url !== 'string' || !isValidUrl(external_url)) return score\n incrementTotal(score)\n if (!isSecure(external_url)) return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl, isWeb3 } from './lib'\n\nconst MaxPossibleImageScore = 3\n\nexport const scoreNftImage = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n // If there's no image data\n if (nft?.metadata?.image) {\n return scoreImage(nft.metadata?.image)\n } else {\n // but there is image data, skip this scoring criteria, otherwise fail it completely\n return nft.metadata?.image_data ? PASS : [0, MaxPossibleImageScore]\n }\n}\n\nexport const scoreImage = (image: unknown): ScaledScore => {\n const score: ScaledScore = [0, MaxPossibleImageScore]\n if (!image || typeof image !== 'string' || !isValidUrl(image)) return score\n incrementTotal(score)\n if (!isSecure(image)) return score\n incrementTotal(score)\n if (!isWeb3(image)) return score\n incrementTotal(score)\n return score\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\nimport { parse } from 'svg-parser'\n\nconst MaxPossibleImageDataScore = 1\n\n// NOTE: There is probably a deeper check we can do\n// here, but this is a good start\nconst isValidImageData = (image_data: string): boolean => {\n // If it doesn't start with an svg tag, it's not an svg\n if (!image_data.startsWith('<svg')) return false\n try {\n // If it can't be parsed, it's not an svg\n parse(image_data)\n return true\n } catch {\n return false\n }\n}\n\nexport const scoreNftImageData = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n // If there's no image data\n if (nft?.metadata?.image_data) {\n return scoreImageData(nft.metadata?.image_data)\n } else {\n // but there is an image, skip this scoring criteria, otherwise fail it completely\n return nft.metadata?.image ? PASS : [0, MaxPossibleImageDataScore]\n }\n}\n\nexport const scoreImageData = (image_data: unknown): ScaledScore => {\n return !image_data || typeof image_data !== 'string' || !isValidImageData(image_data) ?\n [0, MaxPossibleImageDataScore]\n : [MaxPossibleImageDataScore, MaxPossibleImageDataScore]\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreNftName = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreName(nft.metadata?.name)\n}\nexport const scoreName = (name: unknown): ScaledScore => {\n const score: ScaledScore = [0, 1]\n if (!name || typeof name !== 'string') return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl } from './lib'\n\nexport const scoreNftYoutubeUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreYoutubeUrl(nft?.metadata?.youtube_url)\n}\nexport const scoreYoutubeUrl = (youtube_url: unknown): ScaledScore => {\n if (youtube_url === undefined || youtube_url === null) return PASS\n const score: ScaledScore = [0, 2]\n if (typeof youtube_url !== 'string' || !isValidUrl(youtube_url)) return score\n incrementTotal(score)\n if (!isSecure(youtube_url)) return score\n return incrementTotal(score)\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreSupply: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.supply) return FAIL\n if (typeof nft.supply !== 'string') return FAIL\n try {\n return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? PASS : FAIL\n } catch {\n return FAIL\n }\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\n\n/**\n * Callers SHALL NOT assume that ID numbers have any specific pattern to them, and\n * MUST treat the ID as a \"black box\"\n * @param nft\n * @returns\n */\nexport const scoreTokenId: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.tokenId) return FAIL\n if (typeof nft.tokenId !== 'string') return FAIL\n try {\n return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? PASS : FAIL\n } catch {\n return FAIL\n }\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreType: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.type) return FAIL\n if (typeof nft.type !== 'string') return FAIL\n const type = nft.type.toUpperCase()\n if (type !== 'ERC721' && type !== 'ERC1155') return FAIL\n return PASS\n}\n","import {\n evaluateNftAttributes,\n scoreContractAddress,\n scoreNftAnimationUrl,\n scoreNftBackgroundColor,\n scoreNftDescription,\n scoreNftExternalUrl,\n scoreNftImage,\n scoreNftImageData,\n scoreNftName,\n scoreNftYoutubeUrl,\n scoreSupply,\n scoreTokenId,\n scoreType,\n} from './scoring'\n\nconst attributesScoringCriteria = {\n Attributes: { score: evaluateNftAttributes, weight: 1 },\n}\n\nconst metadataScoringCriteria = {\n 'Animation URL': { score: scoreNftAnimationUrl, weight: 1 },\n 'Background Color': { score: scoreNftBackgroundColor, weight: 1 },\n Description: { score: scoreNftDescription, weight: 1 },\n 'External Url': { score: scoreNftExternalUrl, weight: 1 },\n Image: { score: scoreNftImage, weight: 1 },\n 'Image Data': { score: scoreNftImageData, weight: 1 },\n Name: { score: scoreNftName, weight: 1 },\n 'YouTube URL': { score: scoreNftYoutubeUrl, weight: 1 },\n ...attributesScoringCriteria,\n}\n\nexport const scoringCriteria = {\n 'Contract Address': { score: scoreContractAddress, weight: 1 },\n Supply: { score: scoreSupply, weight: 1 },\n 'Token Id': { score: scoreTokenId, weight: 1 },\n Type: { score: scoreType, weight: 1 },\n ...metadataScoringCriteria,\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { Score } from '@xyo-network/crypto-nft-score-model'\n\nimport { scoringCriteria } from './criteria'\n\nexport type ScoringCriteriaKey = keyof typeof scoringCriteria & PropertyKey\n\nexport type NftAnalysis = {\n [key in ScoringCriteriaKey]: Score\n}\n\nexport const analyzeNft = async (\n /**\n * The NFT to evaluate\n */\n nft: NftInfoFields,\n): Promise<NftAnalysis> => {\n const result = Object.fromEntries(\n await Promise.all(\n Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {\n const rawScore = await score(nft)\n const weighted = rawScore.map((v) => v * weight) as Score\n return [key, weighted] as const\n }),\n ),\n ) as NftAnalysis\n return result\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { NftScoreDiviner } from './Diviner'\n\nexport const NftScoreDivinerPlugin = () =>\n createPayloadSetDivinerPlugin<NftScoreDiviner>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n const result = await NftScoreDiviner.create(params)\n return result\n },\n },\n )\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAGhC,SAAS,sBAAsB;;;ACV/B,SAAS,MAAM,YAAqC;AACpD,SAAS,iBAAiB;AAEnB,IAAM,uBAA+D,CAAC,QAAuB;AAClG,MAAI,CAAC,IAAI;AAAS,WAAO;AACzB,MAAI,OAAO,IAAI,YAAY;AAAU,WAAO;AAC5C,MAAI,CAAC,UAAU,IAAI,OAAO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AE;AAAA,MAC3C,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AACF;;;AiB5CA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;AAIvC,IAAM,wBAAwB,MACnC;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,SAAS,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EACzD;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,YAAM,SAAS,MAAM,gBAAgB,OAAO,MAAM;AAClD,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["PASS","PASS","incrementPossible","incrementTotal","incrementTotalAndPossible","incrementPossible","incrementTotal","incrementTotalAndPossible","PASS","incrementTotal","incrementTotal","incrementTotal","incrementTotal","PASS","PASS","incrementTotal","PASS","incrementTotal","incrementTotal","PASS","PASS","incrementTotal","FAIL","PASS","FAIL","PASS","FAIL","PASS"]}
1
+ {"version":3,"sources":["../../src/Diviner.ts","../../src/lib/rating/criteria/scoring/contract.ts","../../src/lib/rating/criteria/scoring/metadata/animationUrl.ts","../../src/lib/rating/criteria/scoring/metadata/lib/urlHelpers.ts","../../src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts","../../src/lib/rating/criteria/scoring/metadata/backgroundColor.ts","../../src/lib/rating/criteria/scoring/metadata/description.ts","../../src/lib/rating/criteria/scoring/metadata/externalUrl.ts","../../src/lib/rating/criteria/scoring/metadata/image.ts","../../src/lib/rating/criteria/scoring/metadata/imageData.ts","../../src/lib/rating/criteria/scoring/metadata/name.ts","../../src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts","../../src/lib/rating/criteria/scoring/supply.ts","../../src/lib/rating/criteria/scoring/tokenId.ts","../../src/lib/rating/criteria/scoring/type.ts","../../src/lib/rating/criteria/scoringCriteria.ts","../../src/lib/rating/analyzeNft.ts","../../src/Plugin.ts"],"sourcesContent":["import {\n isNftInfo,\n NftInfo,\n NftScore,\n NftScoreDivinerConfig,\n NftScoreDivinerConfigSchema,\n NftScoreSchema,\n} from '@xyo-network/crypto-nft-payload-plugin'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { analyzeNft, NftAnalysis } from './lib'\n\nexport type NftScoreDivinerParams = DivinerParams<AnyConfigSchema<NftScoreDivinerConfig>>\n\nconst toNftScorePayload = (nftInfo: NftInfo, scores: NftAnalysis): NftScore => {\n const { address, chainId, type } = nftInfo\n return { address, chainId, schema: NftScoreSchema, scores, type }\n}\n\nexport const isNftScore = (payload: Payload): payload is NftScore => payload.schema === NftScoreSchema\n\nexport class NftScoreDiviner<TParams extends NftScoreDivinerParams = NftScoreDivinerParams> extends AbstractDiviner<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, NftScoreDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = NftScoreDivinerConfigSchema\n\n protected override divineHandler = async (payloads?: Payload[]): Promise<Payload[]> => {\n const nftInfos = payloads?.filter(isNftInfo) ?? []\n const results = await Promise.all(\n nftInfos.map<Promise<NftScore>>(async (nftInfo) => {\n const [score, sourceHash] = await Promise.all([\n // Analyze the NFT\n toNftScorePayload(nftInfo, await analyzeNft(nftInfo)),\n // Hash the source payload\n PayloadBuilder.dataHash(nftInfo),\n ])\n return { ...score, sources: [sourceHash] }\n }),\n )\n return results\n }\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\nimport { isAddress } from 'ethers'\n\nexport const scoreContractAddress: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.address) return FAIL\n if (typeof nft.address !== 'string') return FAIL\n if (!isAddress(nft.address)) return FAIL\n return PASS\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl, isWeb3 } from './lib'\n\nexport const scoreNftAnimationUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreAnimationUrl(nft.metadata?.animation_url)\n}\n\nexport const scoreAnimationUrl = (animation_url: unknown): ScaledScore => {\n const score: ScaledScore = [0, 0]\n if (animation_url === undefined || animation_url === null) return PASS\n incrementPossible(score)\n if (typeof animation_url !== 'string') return score\n incrementTotalAndPossible(score)\n if (!isValidUrl(animation_url)) return score\n incrementTotalAndPossible(score)\n if (!isSecure(animation_url)) return score\n incrementTotalAndPossible(score)\n if (!isWeb3(animation_url)) return score\n return incrementTotal(score)\n}\n","import { URL } from '@xylabs/url'\n\nexport const web3Protocols = ['ipfs:', 'ar:']\n\nexport const toUrl = (url?: string | null): URL | undefined => {\n if (!url) return undefined\n try {\n return new URL(url)\n } catch {\n return undefined\n }\n}\n\nexport const isValidUrl = (url?: string | null): boolean => toUrl(url) !== undefined\n// eslint-disable-next-line unicorn/prefer-includes\nexport const isWeb3 = (url?: string | null): boolean => web3Protocols.some((protocol) => protocol === toUrl(url)?.protocol)\nexport const isWeb2 = (url?: string | null): boolean => !isWeb3(url)\nexport const isSecure = (url?: string | null): boolean => isWeb3(url) || toUrl(url)?.protocol === 'https:'\n","import { NftAttribute, NftInfoFields, OpenSeaNftAttribute, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementPossible, incrementTotal, incrementTotalAndPossible, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nconst isDate = (value: unknown): value is Date => {\n if (isNumber(value)) {\n try {\n new Date(value)\n return true\n } catch {\n return false\n }\n }\n return false\n}\n\nconst isNumber = (value: unknown): value is number => typeof value === 'number'\n\nconst isPercentage = (value: unknown): boolean => isNumber(value) && value >= 0 && value <= 100\n\nconst isNonEmptyString = (value: unknown): value is string => typeof value === 'string' && value.length > 0\n\nconst isNonEmptyStringOrNumber = (value: unknown): value is string | number => value === 'number' || isNonEmptyString(value)\n\nexport const evaluateNftAttributes = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore =>\n nft?.metadata?.attributes ? evaluateAttributes(nft?.metadata?.attributes) : [0, 1]\n\nexport const evaluateAttributes = (attributes: NftAttribute[] | OpenSeaNftAttribute[] | unknown): ScaledScore => {\n if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [0, 1]\n const score: ScaledScore = [0, 0]\n for (const attribute of attributes) {\n const [attributeTotal, attributePossible] = evaluateAttribute(attribute)\n incrementTotalAndPossible(score, attributeTotal, attributePossible)\n }\n return [1, 1]\n}\n\nexport const evaluateAttribute = (attribute: OpenSeaNftAttribute): ScaledScore => {\n const score: ScaledScore = [0, 1]\n const max_value = attribute?.max_value\n const trait_type = attribute?.trait_type\n const value = attribute?.value\n\n // Validate trait_type & value\n if (!attribute || typeof attribute !== 'object' || !isNonEmptyString(trait_type) || !isNonEmptyStringOrNumber(value)) return score\n incrementTotal(score)\n\n // Validate display_type\n incrementPossible(score)\n if (validDisplayType(attribute)) incrementTotal(score)\n\n // Validate max_value\n if (max_value !== undefined) {\n incrementPossible(score)\n if (isNumber(max_value) && isNumber(value) && value <= max_value) incrementTotal(score)\n }\n\n return score\n}\n\nconst validDisplayType = (attribute: OpenSeaNftAttribute): boolean => {\n switch (attribute?.display_type) {\n case 'number':\n case 'boost_number': {\n if (isNumber(attribute?.value)) return true\n break\n }\n case 'boost_percentage': {\n if (isPercentage(attribute?.value)) return true\n break\n }\n case 'date': {\n if (isDate(attribute?.value)) return true\n break\n }\n case 'string':\n case undefined: {\n if (isNonEmptyString(attribute?.value)) return true\n break\n }\n default: {\n break\n }\n }\n return false\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nconst isHexColor = /^[\\da-f]{6}$/i\n\nexport const scoreNftBackgroundColor = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreBackgroundColor(nft.metadata?.background_color)\n}\n\nexport const scoreBackgroundColor = (background_color: unknown): ScaledScore => {\n const score: ScaledScore = [0, 0]\n if (background_color === undefined || background_color === null) return PASS\n incrementPossible(score)\n if (typeof background_color !== 'string') return score\n incrementTotalAndPossible(score)\n if (!isHexColor.test(background_color.toUpperCase())) return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreNftDescription = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreDescription(nft.metadata?.description)\n}\n\nexport const scoreDescription = (description: unknown): ScaledScore => {\n const score: ScaledScore = [0, 1]\n if (!description || typeof description !== 'string') return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl } from './lib'\n\nexport const scoreNftExternalUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreExternalUrl(nft?.metadata?.external_url)\n}\nexport const scoreExternalUrl = (external_url: unknown): ScaledScore => {\n const score: ScaledScore = [0, 2]\n if (external_url === undefined || external_url === null || typeof external_url !== 'string' || !isValidUrl(external_url)) return score\n incrementTotal(score)\n if (!isSecure(external_url)) return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl, isWeb3 } from './lib'\n\nconst MaxPossibleImageScore = 3\n\nexport const scoreNftImage = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n // If there's no image data\n if (nft?.metadata?.image) {\n return scoreImage(nft.metadata?.image)\n } else {\n // but there is image data, skip this scoring criteria, otherwise fail it completely\n return nft.metadata?.image_data ? PASS : [0, MaxPossibleImageScore]\n }\n}\n\nexport const scoreImage = (image: unknown): ScaledScore => {\n const score: ScaledScore = [0, MaxPossibleImageScore]\n if (!image || typeof image !== 'string' || !isValidUrl(image)) return score\n incrementTotal(score)\n if (!isSecure(image)) return score\n incrementTotal(score)\n if (!isWeb3(image)) return score\n incrementTotal(score)\n return score\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\nimport { parse } from 'svg-parser'\n\nconst MaxPossibleImageDataScore = 1\n\n// NOTE: There is probably a deeper check we can do\n// here, but this is a good start\nconst isValidImageData = (image_data: string): boolean => {\n // If it doesn't start with an svg tag, it's not an svg\n if (!image_data.startsWith('<svg')) return false\n try {\n // If it can't be parsed, it's not an svg\n parse(image_data)\n return true\n } catch {\n return false\n }\n}\n\nexport const scoreNftImageData = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n // If there's no image data\n if (nft?.metadata?.image_data) {\n return scoreImageData(nft.metadata?.image_data)\n } else {\n // but there is an image, skip this scoring criteria, otherwise fail it completely\n return nft.metadata?.image ? PASS : [0, MaxPossibleImageDataScore]\n }\n}\n\nexport const scoreImageData = (image_data: unknown): ScaledScore => {\n return !image_data || typeof image_data !== 'string' || !isValidImageData(image_data) ?\n [0, MaxPossibleImageDataScore]\n : [MaxPossibleImageDataScore, MaxPossibleImageDataScore]\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreNftName = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreName(nft.metadata?.name)\n}\nexport const scoreName = (name: unknown): ScaledScore => {\n const score: ScaledScore = [0, 1]\n if (!name || typeof name !== 'string') return score\n return incrementTotal(score)\n}\n","import { NftInfoFields, OpenSeaNftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model'\n\nimport { isSecure, isValidUrl } from './lib'\n\nexport const scoreNftYoutubeUrl = (nft: NftInfoFields | OpenSeaNftInfoFields): ScaledScore => {\n return scoreYoutubeUrl(nft?.metadata?.youtube_url)\n}\nexport const scoreYoutubeUrl = (youtube_url: unknown): ScaledScore => {\n if (youtube_url === undefined || youtube_url === null) return PASS\n const score: ScaledScore = [0, 2]\n if (typeof youtube_url !== 'string' || !isValidUrl(youtube_url)) return score\n incrementTotal(score)\n if (!isSecure(youtube_url)) return score\n return incrementTotal(score)\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreSupply: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.supply) return FAIL\n if (typeof nft.supply !== 'string') return FAIL\n try {\n return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? PASS : FAIL\n } catch {\n return FAIL\n }\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\n\n/**\n * Callers SHALL NOT assume that ID numbers have any specific pattern to them, and\n * MUST treat the ID as a \"black box\"\n * @param nft\n * @returns\n */\nexport const scoreTokenId: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.tokenId) return FAIL\n if (typeof nft.tokenId !== 'string') return FAIL\n try {\n return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? PASS : FAIL\n } catch {\n return FAIL\n }\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model'\n\nexport const scoreType: PassFailScoringFunction<NftInfoFields> = (nft: NftInfoFields) => {\n if (!nft.type) return FAIL\n if (typeof nft.type !== 'string') return FAIL\n const type = nft.type.toUpperCase()\n if (type !== 'ERC721' && type !== 'ERC1155') return FAIL\n return PASS\n}\n","import {\n evaluateNftAttributes,\n scoreContractAddress,\n scoreNftAnimationUrl,\n scoreNftBackgroundColor,\n scoreNftDescription,\n scoreNftExternalUrl,\n scoreNftImage,\n scoreNftImageData,\n scoreNftName,\n scoreNftYoutubeUrl,\n scoreSupply,\n scoreTokenId,\n scoreType,\n} from './scoring'\n\nconst attributesScoringCriteria = {\n Attributes: { score: evaluateNftAttributes, weight: 1 },\n}\n\nconst metadataScoringCriteria = {\n 'Animation URL': { score: scoreNftAnimationUrl, weight: 1 },\n 'Background Color': { score: scoreNftBackgroundColor, weight: 1 },\n Description: { score: scoreNftDescription, weight: 1 },\n 'External Url': { score: scoreNftExternalUrl, weight: 1 },\n Image: { score: scoreNftImage, weight: 1 },\n 'Image Data': { score: scoreNftImageData, weight: 1 },\n Name: { score: scoreNftName, weight: 1 },\n 'YouTube URL': { score: scoreNftYoutubeUrl, weight: 1 },\n ...attributesScoringCriteria,\n}\n\nexport const scoringCriteria = {\n 'Contract Address': { score: scoreContractAddress, weight: 1 },\n Supply: { score: scoreSupply, weight: 1 },\n 'Token Id': { score: scoreTokenId, weight: 1 },\n Type: { score: scoreType, weight: 1 },\n ...metadataScoringCriteria,\n}\n","import { NftInfoFields } from '@xyo-network/crypto-nft-payload-plugin'\nimport { Score } from '@xyo-network/crypto-nft-score-model'\n\nimport { scoringCriteria } from './criteria'\n\nexport type ScoringCriteriaKey = keyof typeof scoringCriteria & PropertyKey\n\nexport type NftAnalysis = {\n [key in ScoringCriteriaKey]: Score\n}\n\nexport const analyzeNft = async (\n /**\n * The NFT to evaluate\n */\n nft: NftInfoFields,\n): Promise<NftAnalysis> => {\n const result = Object.fromEntries(\n await Promise.all(\n Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {\n const rawScore = await score(nft)\n const weighted = rawScore.map((v) => v * weight) as Score\n return [key, weighted] as const\n }),\n ),\n ) as NftAnalysis\n return result\n}\n","import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { NftScoreDiviner } from './Diviner'\n\nexport const NftScoreDivinerPlugin = () =>\n createPayloadSetDivinerPlugin<NftScoreDiviner>(\n { required: { [NftSchema]: 1 }, schema: PayloadSetSchema },\n {\n diviner: async (params) => {\n const result = await NftScoreDiviner.create(params)\n return result\n },\n },\n )\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAGhC,SAAS,sBAAsB;;;ACV/B,SAAS,MAAM,YAAqC;AACpD,SAAS,iBAAiB;AAEnB,IAAM,uBAA+D,CAAC,QAAuB;AAClG,MAAI,CAAC,IAAI,QAAS,QAAO;AACzB,MAAI,OAAO,IAAI,YAAY,SAAU,QAAO;AAC5C,MAAI,CAAC,UAAU,IAAI,OAAO,EAAG,QAAO;AACpC,SAAO;AACT;;;ACRA,SAAS,mBAAmB,gBAAgB,2BAA2B,QAAAA,aAAyB;;;ACDhG,SAAS,WAAW;AAEb,IAAM,gBAAgB,CAAC,SAAS,KAAK;AAErC,IAAM,QAAQ,CAAC,QAAyC;AAC7D,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,WAAO,IAAI,IAAI,GAAG;AAAA,EACpB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,aAAa,CAAC,QAAiC,MAAM,GAAG,MAAM;AAEpE,IAAM,SAAS,CAAC,QAAiC,cAAc,KAAK,CAAC,aAAa,aAA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ossible","incrementTotal","incrementTotalAndPossible","PASS","incrementTotal","incrementTotal","incrementTotal","incrementTotal","PASS","PASS","incrementTotal","PASS","incrementTotal","incrementTotal","PASS","PASS","incrementTotal","FAIL","PASS","FAIL","PASS","FAIL","PASS"]}
@@ -38,12 +38,9 @@ var import_payload_builder = require("@xyo-network/payload-builder");
38
38
  var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
39
39
  var import_ethers = require("ethers");
40
40
  var scoreContractAddress = (nft) => {
41
- if (!nft.address)
42
- return import_crypto_nft_score_model.FAIL;
43
- if (typeof nft.address !== "string")
44
- return import_crypto_nft_score_model.FAIL;
45
- if (!(0, import_ethers.isAddress)(nft.address))
46
- return import_crypto_nft_score_model.FAIL;
41
+ if (!nft.address) return import_crypto_nft_score_model.FAIL;
42
+ if (typeof nft.address !== "string") return import_crypto_nft_score_model.FAIL;
43
+ if (!(0, import_ethers.isAddress)(nft.address)) return import_crypto_nft_score_model.FAIL;
47
44
  return import_crypto_nft_score_model.PASS;
48
45
  };
49
46
 
@@ -54,8 +51,7 @@ var import_crypto_nft_score_model2 = require("@xyo-network/crypto-nft-score-mode
54
51
  var import_url = require("@xylabs/url");
55
52
  var web3Protocols = ["ipfs:", "ar:"];
56
53
  var toUrl = (url) => {
57
- if (!url)
58
- return void 0;
54
+ if (!url) return void 0;
59
55
  try {
60
56
  return new import_url.URL(url);
61
57
  } catch {
@@ -79,20 +75,15 @@ var scoreNftAnimationUrl = (nft) => {
79
75
  };
80
76
  var scoreAnimationUrl = (animation_url) => {
81
77
  const score = [0, 0];
82
- if (animation_url === void 0 || animation_url === null)
83
- return import_crypto_nft_score_model2.PASS;
78
+ if (animation_url === void 0 || animation_url === null) return import_crypto_nft_score_model2.PASS;
84
79
  (0, import_crypto_nft_score_model2.incrementPossible)(score);
85
- if (typeof animation_url !== "string")
86
- return score;
80
+ if (typeof animation_url !== "string") return score;
87
81
  (0, import_crypto_nft_score_model2.incrementTotalAndPossible)(score);
88
- if (!isValidUrl(animation_url))
89
- return score;
82
+ if (!isValidUrl(animation_url)) return score;
90
83
  (0, import_crypto_nft_score_model2.incrementTotalAndPossible)(score);
91
- if (!isSecure(animation_url))
92
- return score;
84
+ if (!isSecure(animation_url)) return score;
93
85
  (0, import_crypto_nft_score_model2.incrementTotalAndPossible)(score);
94
- if (!isWeb3(animation_url))
95
- return score;
86
+ if (!isWeb3(animation_url)) return score;
96
87
  return (0, import_crypto_nft_score_model2.incrementTotal)(score);
97
88
  };
98
89
 
@@ -118,8 +109,7 @@ var evaluateNftAttributes = (nft) => {
118
109
  return ((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.attributes) ? evaluateAttributes((_b = nft == null ? void 0 : nft.metadata) == null ? void 0 : _b.attributes) : [0, 1];
119
110
  };
120
111
  var evaluateAttributes = (attributes) => {
121
- if (!attributes || !Array.isArray(attributes) || attributes.length === 0)
122
- return [0, 1];
112
+ if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [0, 1];
123
113
  const score = [0, 0];
124
114
  for (const attribute of attributes) {
125
115
  const [attributeTotal, attributePossible] = evaluateAttribute(attribute);
@@ -132,16 +122,13 @@ var evaluateAttribute = (attribute) => {
132
122
  const max_value = attribute == null ? void 0 : attribute.max_value;
133
123
  const trait_type = attribute == null ? void 0 : attribute.trait_type;
134
124
  const value = attribute == null ? void 0 : attribute.value;
135
- if (!attribute || typeof attribute !== "object" || !isNonEmptyString(trait_type) || !isNonEmptyStringOrNumber(value))
136
- return score;
125
+ if (!attribute || typeof attribute !== "object" || !isNonEmptyString(trait_type) || !isNonEmptyStringOrNumber(value)) return score;
137
126
  (0, import_crypto_nft_score_model3.incrementTotal)(score);
138
127
  (0, import_crypto_nft_score_model3.incrementPossible)(score);
139
- if (validDisplayType(attribute))
140
- (0, import_crypto_nft_score_model3.incrementTotal)(score);
128
+ if (validDisplayType(attribute)) (0, import_crypto_nft_score_model3.incrementTotal)(score);
141
129
  if (max_value !== void 0) {
142
130
  (0, import_crypto_nft_score_model3.incrementPossible)(score);
143
- if (isNumber(max_value) && isNumber(value) && value <= max_value)
144
- (0, import_crypto_nft_score_model3.incrementTotal)(score);
131
+ if (isNumber(max_value) && isNumber(value) && value <= max_value) (0, import_crypto_nft_score_model3.incrementTotal)(score);
145
132
  }
146
133
  return score;
147
134
  };
@@ -149,24 +136,20 @@ var validDisplayType = (attribute) => {
149
136
  switch (attribute == null ? void 0 : attribute.display_type) {
150
137
  case "number":
151
138
  case "boost_number": {
152
- if (isNumber(attribute == null ? void 0 : attribute.value))
153
- return true;
139
+ if (isNumber(attribute == null ? void 0 : attribute.value)) return true;
154
140
  break;
155
141
  }
156
142
  case "boost_percentage": {
157
- if (isPercentage(attribute == null ? void 0 : attribute.value))
158
- return true;
143
+ if (isPercentage(attribute == null ? void 0 : attribute.value)) return true;
159
144
  break;
160
145
  }
161
146
  case "date": {
162
- if (isDate(attribute == null ? void 0 : attribute.value))
163
- return true;
147
+ if (isDate(attribute == null ? void 0 : attribute.value)) return true;
164
148
  break;
165
149
  }
166
150
  case "string":
167
151
  case void 0: {
168
- if (isNonEmptyString(attribute == null ? void 0 : attribute.value))
169
- return true;
152
+ if (isNonEmptyString(attribute == null ? void 0 : attribute.value)) return true;
170
153
  break;
171
154
  }
172
155
  default: {
@@ -185,14 +168,11 @@ var scoreNftBackgroundColor = (nft) => {
185
168
  };
186
169
  var scoreBackgroundColor = (background_color) => {
187
170
  const score = [0, 0];
188
- if (background_color === void 0 || background_color === null)
189
- return import_crypto_nft_score_model4.PASS;
171
+ if (background_color === void 0 || background_color === null) return import_crypto_nft_score_model4.PASS;
190
172
  (0, import_crypto_nft_score_model4.incrementPossible)(score);
191
- if (typeof background_color !== "string")
192
- return score;
173
+ if (typeof background_color !== "string") return score;
193
174
  (0, import_crypto_nft_score_model4.incrementTotalAndPossible)(score);
194
- if (!isHexColor.test(background_color.toUpperCase()))
195
- return score;
175
+ if (!isHexColor.test(background_color.toUpperCase())) return score;
196
176
  return (0, import_crypto_nft_score_model4.incrementTotal)(score);
197
177
  };
198
178
 
@@ -204,8 +184,7 @@ var scoreNftDescription = (nft) => {
204
184
  };
205
185
  var scoreDescription = (description) => {
206
186
  const score = [0, 1];
207
- if (!description || typeof description !== "string")
208
- return score;
187
+ if (!description || typeof description !== "string") return score;
209
188
  return (0, import_crypto_nft_score_model5.incrementTotal)(score);
210
189
  };
211
190
 
@@ -217,11 +196,9 @@ var scoreNftExternalUrl = (nft) => {
217
196
  };
218
197
  var scoreExternalUrl = (external_url) => {
219
198
  const score = [0, 2];
220
- if (external_url === void 0 || external_url === null || typeof external_url !== "string" || !isValidUrl(external_url))
221
- return score;
199
+ if (external_url === void 0 || external_url === null || typeof external_url !== "string" || !isValidUrl(external_url)) return score;
222
200
  (0, import_crypto_nft_score_model6.incrementTotal)(score);
223
- if (!isSecure(external_url))
224
- return score;
201
+ if (!isSecure(external_url)) return score;
225
202
  return (0, import_crypto_nft_score_model6.incrementTotal)(score);
226
203
  };
227
204
 
@@ -238,14 +215,11 @@ var scoreNftImage = (nft) => {
238
215
  };
239
216
  var scoreImage = (image) => {
240
217
  const score = [0, MaxPossibleImageScore];
241
- if (!image || typeof image !== "string" || !isValidUrl(image))
242
- return score;
218
+ if (!image || typeof image !== "string" || !isValidUrl(image)) return score;
243
219
  (0, import_crypto_nft_score_model7.incrementTotal)(score);
244
- if (!isSecure(image))
245
- return score;
220
+ if (!isSecure(image)) return score;
246
221
  (0, import_crypto_nft_score_model7.incrementTotal)(score);
247
- if (!isWeb3(image))
248
- return score;
222
+ if (!isWeb3(image)) return score;
249
223
  (0, import_crypto_nft_score_model7.incrementTotal)(score);
250
224
  return score;
251
225
  };
@@ -255,8 +229,7 @@ var import_crypto_nft_score_model8 = require("@xyo-network/crypto-nft-score-mode
255
229
  var import_svg_parser = require("svg-parser");
256
230
  var MaxPossibleImageDataScore = 1;
257
231
  var isValidImageData = (image_data) => {
258
- if (!image_data.startsWith("<svg"))
259
- return false;
232
+ if (!image_data.startsWith("<svg")) return false;
260
233
  try {
261
234
  (0, import_svg_parser.parse)(image_data);
262
235
  return true;
@@ -284,8 +257,7 @@ var scoreNftName = (nft) => {
284
257
  };
285
258
  var scoreName = (name) => {
286
259
  const score = [0, 1];
287
- if (!name || typeof name !== "string")
288
- return score;
260
+ if (!name || typeof name !== "string") return score;
289
261
  return (0, import_crypto_nft_score_model9.incrementTotal)(score);
290
262
  };
291
263
 
@@ -296,24 +268,19 @@ var scoreNftYoutubeUrl = (nft) => {
296
268
  return scoreYoutubeUrl((_a = nft == null ? void 0 : nft.metadata) == null ? void 0 : _a.youtube_url);
297
269
  };
298
270
  var scoreYoutubeUrl = (youtube_url) => {
299
- if (youtube_url === void 0 || youtube_url === null)
300
- return import_crypto_nft_score_model10.PASS;
271
+ if (youtube_url === void 0 || youtube_url === null) return import_crypto_nft_score_model10.PASS;
301
272
  const score = [0, 2];
302
- if (typeof youtube_url !== "string" || !isValidUrl(youtube_url))
303
- return score;
273
+ if (typeof youtube_url !== "string" || !isValidUrl(youtube_url)) return score;
304
274
  (0, import_crypto_nft_score_model10.incrementTotal)(score);
305
- if (!isSecure(youtube_url))
306
- return score;
275
+ if (!isSecure(youtube_url)) return score;
307
276
  return (0, import_crypto_nft_score_model10.incrementTotal)(score);
308
277
  };
309
278
 
310
279
  // src/lib/rating/criteria/scoring/supply.ts
311
280
  var import_crypto_nft_score_model11 = require("@xyo-network/crypto-nft-score-model");
312
281
  var scoreSupply = (nft) => {
313
- if (!nft.supply)
314
- return import_crypto_nft_score_model11.FAIL;
315
- if (typeof nft.supply !== "string")
316
- return import_crypto_nft_score_model11.FAIL;
282
+ if (!nft.supply) return import_crypto_nft_score_model11.FAIL;
283
+ if (typeof nft.supply !== "string") return import_crypto_nft_score_model11.FAIL;
317
284
  try {
318
285
  return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? import_crypto_nft_score_model11.PASS : import_crypto_nft_score_model11.FAIL;
319
286
  } catch {
@@ -324,10 +291,8 @@ var scoreSupply = (nft) => {
324
291
  // src/lib/rating/criteria/scoring/tokenId.ts
325
292
  var import_crypto_nft_score_model12 = require("@xyo-network/crypto-nft-score-model");
326
293
  var scoreTokenId = (nft) => {
327
- if (!nft.tokenId)
328
- return import_crypto_nft_score_model12.FAIL;
329
- if (typeof nft.tokenId !== "string")
330
- return import_crypto_nft_score_model12.FAIL;
294
+ if (!nft.tokenId) return import_crypto_nft_score_model12.FAIL;
295
+ if (typeof nft.tokenId !== "string") return import_crypto_nft_score_model12.FAIL;
331
296
  try {
332
297
  return BigInt(nft.tokenId) >= 0n && BigInt(nft.tokenId) < 2n ** 256n ? import_crypto_nft_score_model12.PASS : import_crypto_nft_score_model12.FAIL;
333
298
  } catch {
@@ -338,13 +303,10 @@ var scoreTokenId = (nft) => {
338
303
  // src/lib/rating/criteria/scoring/type.ts
339
304
  var import_crypto_nft_score_model13 = require("@xyo-network/crypto-nft-score-model");
340
305
  var scoreType = (nft) => {
341
- if (!nft.type)
342
- return import_crypto_nft_score_model13.FAIL;
343
- if (typeof nft.type !== "string")
344
- return import_crypto_nft_score_model13.FAIL;
306
+ if (!nft.type) return import_crypto_nft_score_model13.FAIL;
307
+ if (typeof nft.type !== "string") return import_crypto_nft_score_model13.FAIL;
345
308
  const type = nft.type.toUpperCase();
346
- if (type !== "ERC721" && type !== "ERC1155")
347
- return import_crypto_nft_score_model13.FAIL;
309
+ if (type !== "ERC721" && type !== "ERC1155") return import_crypto_nft_score_model13.FAIL;
348
310
  return import_crypto_nft_score_model13.PASS;
349
311
  };
350
312