@xyo-network/crypto-nft-diviner-score-plugin 2.99.5 → 2.99.6

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.
Files changed (41) hide show
  1. package/dist/browser/Plugin.d.cts +2 -2
  2. package/dist/browser/Plugin.d.mts +2 -2
  3. package/dist/browser/Plugin.d.ts +2 -2
  4. package/dist/browser/index.cjs +127 -235
  5. package/dist/browser/index.cjs.map +1 -1
  6. package/dist/browser/index.mjs +131 -237
  7. package/dist/browser/index.mjs.map +1 -1
  8. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts +0 -1
  9. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts.map +1 -1
  10. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts +0 -1
  11. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts.map +1 -1
  12. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts +0 -1
  13. package/dist/browser/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts.map +1 -1
  14. package/dist/neutral/Plugin.d.cts +2 -2
  15. package/dist/neutral/Plugin.d.mts +2 -2
  16. package/dist/neutral/Plugin.d.ts +2 -2
  17. package/dist/neutral/index.cjs +127 -235
  18. package/dist/neutral/index.cjs.map +1 -1
  19. package/dist/neutral/index.mjs +131 -237
  20. package/dist/neutral/index.mjs.map +1 -1
  21. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts +0 -1
  22. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts.map +1 -1
  23. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts +0 -1
  24. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts.map +1 -1
  25. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts +0 -1
  26. package/dist/neutral/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts.map +1 -1
  27. package/dist/node/Plugin.d.cts +2 -2
  28. package/dist/node/Plugin.d.mts +2 -2
  29. package/dist/node/Plugin.d.ts +2 -2
  30. package/dist/node/index.cjs +134 -246
  31. package/dist/node/index.cjs.map +1 -1
  32. package/dist/node/index.mjs +138 -248
  33. package/dist/node/index.mjs.map +1 -1
  34. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts +0 -1
  35. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.cts.map +1 -1
  36. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts +0 -1
  37. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.mts.map +1 -1
  38. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts +0 -1
  39. package/dist/node/lib/rating/criteria/scoring/metadata/lib/urlHelpers.d.ts.map +1 -1
  40. package/package.json +13 -14
  41. package/src/lib/rating/criteria/scoring/metadata/lib/urlHelpers.ts +0 -2
@@ -1,8 +1,8 @@
1
1
  import { NftScoreDiviner } from './Diviner.ts';
2
2
  export declare const NftScoreDivinerPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDivinerPlugin<NftScoreDiviner<import("@xylabs/object").BaseParamsFields & {
3
- account?: import("@xyo-network/account-model").AccountInstance | "random";
3
+ account?: import(".store/@xyo-network-account-model-virtual-c593258ccf/package").AccountInstance | "random";
4
4
  addToResolvers?: boolean;
5
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
5
+ additionalSigners?: import(".store/@xyo-network-account-model-virtual-c593258ccf/package").AccountInstance[];
6
6
  allowNameResolution?: boolean;
7
7
  config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
8
8
  schema: "network.xyo.crypto.nft.score.diviner.config";
@@ -1,8 +1,8 @@
1
1
  import { NftScoreDiviner } from './Diviner.ts';
2
2
  export declare const NftScoreDivinerPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDivinerPlugin<NftScoreDiviner<import("@xylabs/object").BaseParamsFields & {
3
- account?: import("@xyo-network/account-model").AccountInstance | "random";
3
+ account?: import(".store/@xyo-network-account-model-virtual-c593258ccf/package").AccountInstance | "random";
4
4
  addToResolvers?: boolean;
5
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
5
+ additionalSigners?: import(".store/@xyo-network-account-model-virtual-c593258ccf/package").AccountInstance[];
6
6
  allowNameResolution?: boolean;
7
7
  config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
8
8
  schema: "network.xyo.crypto.nft.score.diviner.config";
@@ -1,8 +1,8 @@
1
1
  import { NftScoreDiviner } from './Diviner.ts';
2
2
  export declare const NftScoreDivinerPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDivinerPlugin<NftScoreDiviner<import("@xylabs/object").BaseParamsFields & {
3
- account?: import("@xyo-network/account-model").AccountInstance | "random";
3
+ account?: import(".store/@xyo-network-account-model-virtual-c593258ccf/package").AccountInstance | "random";
4
4
  addToResolvers?: boolean;
5
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
5
+ additionalSigners?: import(".store/@xyo-network-account-model-virtual-c593258ccf/package").AccountInstance[];
6
6
  allowNameResolution?: boolean;
7
7
  config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
8
8
  schema: "network.xyo.crypto.nft.score.diviner.config";
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
6
  var __export = (target, all) => {
8
7
  for (var name in all)
9
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -38,43 +37,36 @@ var import_payload_builder = require("@xyo-network/payload-builder");
38
37
  // src/lib/rating/criteria/scoring/contract.ts
39
38
  var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
40
39
  var import_ethers = require("ethers");
41
- var scoreContractAddress = /* @__PURE__ */ __name((nft) => {
40
+ var scoreContractAddress = (nft) => {
42
41
  if (!nft.address) return import_crypto_nft_score_model.FAIL;
43
42
  if (typeof nft.address !== "string") return import_crypto_nft_score_model.FAIL;
44
43
  if (!(0, import_ethers.isAddress)(nft.address)) return import_crypto_nft_score_model.FAIL;
45
44
  return import_crypto_nft_score_model.PASS;
46
- }, "scoreContractAddress");
45
+ };
47
46
 
48
47
  // src/lib/rating/criteria/scoring/metadata/animationUrl.ts
49
48
  var import_crypto_nft_score_model2 = require("@xyo-network/crypto-nft-score-model");
50
49
 
51
50
  // src/lib/rating/criteria/scoring/metadata/lib/urlHelpers.ts
52
- var import_url = require("@xylabs/url");
53
- var web3Protocols = [
54
- "ipfs:",
55
- "ar:"
56
- ];
57
- var toUrl = /* @__PURE__ */ __name((url) => {
51
+ var web3Protocols = ["ipfs:", "ar:"];
52
+ var toUrl = (url) => {
58
53
  if (!url) return void 0;
59
54
  try {
60
- return new import_url.URL(url);
55
+ return new URL(url);
61
56
  } catch {
62
57
  return void 0;
63
58
  }
64
- }, "toUrl");
65
- var isValidUrl = /* @__PURE__ */ __name((url) => toUrl(url) !== void 0, "isValidUrl");
66
- var isWeb3 = /* @__PURE__ */ __name((url) => web3Protocols.some((protocol) => protocol === toUrl(url)?.protocol), "isWeb3");
67
- var isSecure = /* @__PURE__ */ __name((url) => isWeb3(url) || toUrl(url)?.protocol === "https:", "isSecure");
59
+ };
60
+ var isValidUrl = (url) => toUrl(url) !== void 0;
61
+ var isWeb3 = (url) => web3Protocols.some((protocol) => protocol === toUrl(url)?.protocol);
62
+ var isSecure = (url) => isWeb3(url) || toUrl(url)?.protocol === "https:";
68
63
 
69
64
  // src/lib/rating/criteria/scoring/metadata/animationUrl.ts
70
- var scoreNftAnimationUrl = /* @__PURE__ */ __name((nft) => {
65
+ var scoreNftAnimationUrl = (nft) => {
71
66
  return scoreAnimationUrl(nft.metadata?.animation_url);
72
- }, "scoreNftAnimationUrl");
73
- var scoreAnimationUrl = /* @__PURE__ */ __name((animation_url) => {
74
- const score = [
75
- 0,
76
- 0
77
- ];
67
+ };
68
+ var scoreAnimationUrl = (animation_url) => {
69
+ const score = [0, 0];
78
70
  if (animation_url === void 0 || animation_url === null) return import_crypto_nft_score_model2.PASS;
79
71
  (0, import_crypto_nft_score_model2.incrementPossible)(score);
80
72
  if (typeof animation_url !== "string") return score;
@@ -85,11 +77,11 @@ var scoreAnimationUrl = /* @__PURE__ */ __name((animation_url) => {
85
77
  (0, import_crypto_nft_score_model2.incrementTotalAndPossible)(score);
86
78
  if (!isWeb3(animation_url)) return score;
87
79
  return (0, import_crypto_nft_score_model2.incrementTotal)(score);
88
- }, "scoreAnimationUrl");
80
+ };
89
81
 
90
82
  // src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts
91
83
  var import_crypto_nft_score_model3 = require("@xyo-network/crypto-nft-score-model");
92
- var isDate = /* @__PURE__ */ __name((value) => {
84
+ var isDate = (value) => {
93
85
  if (isNumber(value)) {
94
86
  try {
95
87
  new Date(value);
@@ -99,38 +91,23 @@ var isDate = /* @__PURE__ */ __name((value) => {
99
91
  }
100
92
  }
101
93
  return false;
102
- }, "isDate");
103
- var isNumber = /* @__PURE__ */ __name((value) => typeof value === "number", "isNumber");
104
- var isPercentage = /* @__PURE__ */ __name((value) => isNumber(value) && value >= 0 && value <= 100, "isPercentage");
105
- var isNonEmptyString = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0, "isNonEmptyString");
106
- var isNonEmptyStringOrNumber = /* @__PURE__ */ __name((value) => value === "number" || isNonEmptyString(value), "isNonEmptyStringOrNumber");
107
- var evaluateNftAttributes = /* @__PURE__ */ __name((nft) => nft?.metadata?.attributes ? evaluateAttributes(nft?.metadata?.attributes) : [
108
- 0,
109
- 1
110
- ], "evaluateNftAttributes");
111
- var evaluateAttributes = /* @__PURE__ */ __name((attributes) => {
112
- if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [
113
- 0,
114
- 1
115
- ];
116
- const score = [
117
- 0,
118
- 0
119
- ];
94
+ };
95
+ var isNumber = (value) => typeof value === "number";
96
+ var isPercentage = (value) => isNumber(value) && value >= 0 && value <= 100;
97
+ var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
98
+ var isNonEmptyStringOrNumber = (value) => value === "number" || isNonEmptyString(value);
99
+ var evaluateNftAttributes = (nft) => nft?.metadata?.attributes ? evaluateAttributes(nft?.metadata?.attributes) : [0, 1];
100
+ var evaluateAttributes = (attributes) => {
101
+ if (!attributes || !Array.isArray(attributes) || attributes.length === 0) return [0, 1];
102
+ const score = [0, 0];
120
103
  for (const attribute of attributes) {
121
104
  const [attributeTotal, attributePossible] = evaluateAttribute(attribute);
122
105
  (0, import_crypto_nft_score_model3.incrementTotalAndPossible)(score, attributeTotal, attributePossible);
123
106
  }
124
- return [
125
- 1,
126
- 1
127
- ];
128
- }, "evaluateAttributes");
129
- var evaluateAttribute = /* @__PURE__ */ __name((attribute) => {
130
- const score = [
131
- 0,
132
- 1
133
- ];
107
+ return [1, 1];
108
+ };
109
+ var evaluateAttribute = (attribute) => {
110
+ const score = [0, 1];
134
111
  const max_value = attribute?.max_value;
135
112
  const trait_type = attribute?.trait_type;
136
113
  const value = attribute?.value;
@@ -143,8 +120,8 @@ var evaluateAttribute = /* @__PURE__ */ __name((attribute) => {
143
120
  if (isNumber(max_value) && isNumber(value) && value <= max_value) (0, import_crypto_nft_score_model3.incrementTotal)(score);
144
121
  }
145
122
  return score;
146
- }, "evaluateAttribute");
147
- var validDisplayType = /* @__PURE__ */ __name((attribute) => {
123
+ };
124
+ var validDisplayType = (attribute) => {
148
125
  switch (attribute?.display_type) {
149
126
  case "number":
150
127
  case "boost_number": {
@@ -169,75 +146,60 @@ var validDisplayType = /* @__PURE__ */ __name((attribute) => {
169
146
  }
170
147
  }
171
148
  return false;
172
- }, "validDisplayType");
149
+ };
173
150
 
174
151
  // src/lib/rating/criteria/scoring/metadata/backgroundColor.ts
175
152
  var import_crypto_nft_score_model4 = require("@xyo-network/crypto-nft-score-model");
176
153
  var isHexColor = /^[\da-f]{6}$/i;
177
- var scoreNftBackgroundColor = /* @__PURE__ */ __name((nft) => {
154
+ var scoreNftBackgroundColor = (nft) => {
178
155
  return scoreBackgroundColor(nft.metadata?.background_color);
179
- }, "scoreNftBackgroundColor");
180
- var scoreBackgroundColor = /* @__PURE__ */ __name((background_color) => {
181
- const score = [
182
- 0,
183
- 0
184
- ];
156
+ };
157
+ var scoreBackgroundColor = (background_color) => {
158
+ const score = [0, 0];
185
159
  if (background_color === void 0 || background_color === null) return import_crypto_nft_score_model4.PASS;
186
160
  (0, import_crypto_nft_score_model4.incrementPossible)(score);
187
161
  if (typeof background_color !== "string") return score;
188
162
  (0, import_crypto_nft_score_model4.incrementTotalAndPossible)(score);
189
163
  if (!isHexColor.test(background_color.toUpperCase())) return score;
190
164
  return (0, import_crypto_nft_score_model4.incrementTotal)(score);
191
- }, "scoreBackgroundColor");
165
+ };
192
166
 
193
167
  // src/lib/rating/criteria/scoring/metadata/description.ts
194
168
  var import_crypto_nft_score_model5 = require("@xyo-network/crypto-nft-score-model");
195
- var scoreNftDescription = /* @__PURE__ */ __name((nft) => {
169
+ var scoreNftDescription = (nft) => {
196
170
  return scoreDescription(nft.metadata?.description);
197
- }, "scoreNftDescription");
198
- var scoreDescription = /* @__PURE__ */ __name((description) => {
199
- const score = [
200
- 0,
201
- 1
202
- ];
171
+ };
172
+ var scoreDescription = (description) => {
173
+ const score = [0, 1];
203
174
  if (!description || typeof description !== "string") return score;
204
175
  return (0, import_crypto_nft_score_model5.incrementTotal)(score);
205
- }, "scoreDescription");
176
+ };
206
177
 
207
178
  // src/lib/rating/criteria/scoring/metadata/externalUrl.ts
208
179
  var import_crypto_nft_score_model6 = require("@xyo-network/crypto-nft-score-model");
209
- var scoreNftExternalUrl = /* @__PURE__ */ __name((nft) => {
180
+ var scoreNftExternalUrl = (nft) => {
210
181
  return scoreExternalUrl(nft?.metadata?.external_url);
211
- }, "scoreNftExternalUrl");
212
- var scoreExternalUrl = /* @__PURE__ */ __name((external_url) => {
213
- const score = [
214
- 0,
215
- 2
216
- ];
182
+ };
183
+ var scoreExternalUrl = (external_url) => {
184
+ const score = [0, 2];
217
185
  if (external_url === void 0 || external_url === null || typeof external_url !== "string" || !isValidUrl(external_url)) return score;
218
186
  (0, import_crypto_nft_score_model6.incrementTotal)(score);
219
187
  if (!isSecure(external_url)) return score;
220
188
  return (0, import_crypto_nft_score_model6.incrementTotal)(score);
221
- }, "scoreExternalUrl");
189
+ };
222
190
 
223
191
  // src/lib/rating/criteria/scoring/metadata/image.ts
224
192
  var import_crypto_nft_score_model7 = require("@xyo-network/crypto-nft-score-model");
225
193
  var MaxPossibleImageScore = 3;
226
- var scoreNftImage = /* @__PURE__ */ __name((nft) => {
194
+ var scoreNftImage = (nft) => {
227
195
  if (nft?.metadata?.image) {
228
196
  return scoreImage(nft.metadata?.image);
229
197
  } else {
230
- return nft.metadata?.image_data ? import_crypto_nft_score_model7.PASS : [
231
- 0,
232
- MaxPossibleImageScore
233
- ];
198
+ return nft.metadata?.image_data ? import_crypto_nft_score_model7.PASS : [0, MaxPossibleImageScore];
234
199
  }
235
- }, "scoreNftImage");
236
- var scoreImage = /* @__PURE__ */ __name((image) => {
237
- const score = [
238
- 0,
239
- MaxPossibleImageScore
240
- ];
200
+ };
201
+ var scoreImage = (image) => {
202
+ const score = [0, MaxPossibleImageScore];
241
203
  if (!image || typeof image !== "string" || !isValidUrl(image)) return score;
242
204
  (0, import_crypto_nft_score_model7.incrementTotal)(score);
243
205
  if (!isSecure(image)) return score;
@@ -245,13 +207,13 @@ var scoreImage = /* @__PURE__ */ __name((image) => {
245
207
  if (!isWeb3(image)) return score;
246
208
  (0, import_crypto_nft_score_model7.incrementTotal)(score);
247
209
  return score;
248
- }, "scoreImage");
210
+ };
249
211
 
250
212
  // src/lib/rating/criteria/scoring/metadata/imageData.ts
251
213
  var import_crypto_nft_score_model8 = require("@xyo-network/crypto-nft-score-model");
252
214
  var import_svg_parser = require("svg-parser");
253
215
  var MaxPossibleImageDataScore = 1;
254
- var isValidImageData = /* @__PURE__ */ __name((image_data) => {
216
+ var isValidImageData = (image_data) => {
255
217
  if (!image_data.startsWith("<svg")) return false;
256
218
  try {
257
219
  (0, import_svg_parser.parse)(image_data);
@@ -259,61 +221,46 @@ var isValidImageData = /* @__PURE__ */ __name((image_data) => {
259
221
  } catch {
260
222
  return false;
261
223
  }
262
- }, "isValidImageData");
263
- var scoreNftImageData = /* @__PURE__ */ __name((nft) => {
224
+ };
225
+ var scoreNftImageData = (nft) => {
264
226
  if (nft?.metadata?.image_data) {
265
227
  return scoreImageData(nft.metadata?.image_data);
266
228
  } else {
267
- return nft.metadata?.image ? import_crypto_nft_score_model8.PASS : [
268
- 0,
269
- MaxPossibleImageDataScore
270
- ];
229
+ return nft.metadata?.image ? import_crypto_nft_score_model8.PASS : [0, MaxPossibleImageDataScore];
271
230
  }
272
- }, "scoreNftImageData");
273
- var scoreImageData = /* @__PURE__ */ __name((image_data) => {
274
- return !image_data || typeof image_data !== "string" || !isValidImageData(image_data) ? [
275
- 0,
276
- MaxPossibleImageDataScore
277
- ] : [
278
- MaxPossibleImageDataScore,
279
- MaxPossibleImageDataScore
280
- ];
281
- }, "scoreImageData");
231
+ };
232
+ var scoreImageData = (image_data) => {
233
+ return !image_data || typeof image_data !== "string" || !isValidImageData(image_data) ? [0, MaxPossibleImageDataScore] : [MaxPossibleImageDataScore, MaxPossibleImageDataScore];
234
+ };
282
235
 
283
236
  // src/lib/rating/criteria/scoring/metadata/name.ts
284
237
  var import_crypto_nft_score_model9 = require("@xyo-network/crypto-nft-score-model");
285
- var scoreNftName = /* @__PURE__ */ __name((nft) => {
238
+ var scoreNftName = (nft) => {
286
239
  return scoreName(nft.metadata?.name);
287
- }, "scoreNftName");
288
- var scoreName = /* @__PURE__ */ __name((name) => {
289
- const score = [
290
- 0,
291
- 1
292
- ];
240
+ };
241
+ var scoreName = (name) => {
242
+ const score = [0, 1];
293
243
  if (!name || typeof name !== "string") return score;
294
244
  return (0, import_crypto_nft_score_model9.incrementTotal)(score);
295
- }, "scoreName");
245
+ };
296
246
 
297
247
  // src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts
298
248
  var import_crypto_nft_score_model10 = require("@xyo-network/crypto-nft-score-model");
299
- var scoreNftYoutubeUrl = /* @__PURE__ */ __name((nft) => {
249
+ var scoreNftYoutubeUrl = (nft) => {
300
250
  return scoreYoutubeUrl(nft?.metadata?.youtube_url);
301
- }, "scoreNftYoutubeUrl");
302
- var scoreYoutubeUrl = /* @__PURE__ */ __name((youtube_url) => {
251
+ };
252
+ var scoreYoutubeUrl = (youtube_url) => {
303
253
  if (youtube_url === void 0 || youtube_url === null) return import_crypto_nft_score_model10.PASS;
304
- const score = [
305
- 0,
306
- 2
307
- ];
254
+ const score = [0, 2];
308
255
  if (typeof youtube_url !== "string" || !isValidUrl(youtube_url)) return score;
309
256
  (0, import_crypto_nft_score_model10.incrementTotal)(score);
310
257
  if (!isSecure(youtube_url)) return score;
311
258
  return (0, import_crypto_nft_score_model10.incrementTotal)(score);
312
- }, "scoreYoutubeUrl");
259
+ };
313
260
 
314
261
  // src/lib/rating/criteria/scoring/supply.ts
315
262
  var import_crypto_nft_score_model11 = require("@xyo-network/crypto-nft-score-model");
316
- var scoreSupply = /* @__PURE__ */ __name((nft) => {
263
+ var scoreSupply = (nft) => {
317
264
  if (!nft.supply) return import_crypto_nft_score_model11.FAIL;
318
265
  if (typeof nft.supply !== "string") return import_crypto_nft_score_model11.FAIL;
319
266
  try {
@@ -321,11 +268,11 @@ var scoreSupply = /* @__PURE__ */ __name((nft) => {
321
268
  } catch {
322
269
  return import_crypto_nft_score_model11.FAIL;
323
270
  }
324
- }, "scoreSupply");
271
+ };
325
272
 
326
273
  // src/lib/rating/criteria/scoring/tokenId.ts
327
274
  var import_crypto_nft_score_model12 = require("@xyo-network/crypto-nft-score-model");
328
- var scoreTokenId = /* @__PURE__ */ __name((nft) => {
275
+ var scoreTokenId = (nft) => {
329
276
  if (!nft.tokenId) return import_crypto_nft_score_model12.FAIL;
330
277
  if (typeof nft.tokenId !== "string") return import_crypto_nft_score_model12.FAIL;
331
278
  try {
@@ -333,147 +280,92 @@ var scoreTokenId = /* @__PURE__ */ __name((nft) => {
333
280
  } catch {
334
281
  return import_crypto_nft_score_model12.FAIL;
335
282
  }
336
- }, "scoreTokenId");
283
+ };
337
284
 
338
285
  // src/lib/rating/criteria/scoring/type.ts
339
286
  var import_crypto_nft_score_model13 = require("@xyo-network/crypto-nft-score-model");
340
- var scoreType = /* @__PURE__ */ __name((nft) => {
287
+ var scoreType = (nft) => {
341
288
  if (!nft.type) return import_crypto_nft_score_model13.FAIL;
342
289
  if (typeof nft.type !== "string") return import_crypto_nft_score_model13.FAIL;
343
290
  const type = nft.type.toUpperCase();
344
291
  if (type !== "ERC721" && type !== "ERC1155") return import_crypto_nft_score_model13.FAIL;
345
292
  return import_crypto_nft_score_model13.PASS;
346
- }, "scoreType");
293
+ };
347
294
 
348
295
  // src/lib/rating/criteria/scoringCriteria.ts
349
296
  var attributesScoringCriteria = {
350
- Attributes: {
351
- score: evaluateNftAttributes,
352
- weight: 1
353
- }
297
+ Attributes: { score: evaluateNftAttributes, weight: 1 }
354
298
  };
355
299
  var metadataScoringCriteria = {
356
- "Animation URL": {
357
- score: scoreNftAnimationUrl,
358
- weight: 1
359
- },
360
- "Background Color": {
361
- score: scoreNftBackgroundColor,
362
- weight: 1
363
- },
364
- "Description": {
365
- score: scoreNftDescription,
366
- weight: 1
367
- },
368
- "External Url": {
369
- score: scoreNftExternalUrl,
370
- weight: 1
371
- },
372
- "Image": {
373
- score: scoreNftImage,
374
- weight: 1
375
- },
376
- "Image Data": {
377
- score: scoreNftImageData,
378
- weight: 1
379
- },
380
- "Name": {
381
- score: scoreNftName,
382
- weight: 1
383
- },
384
- "YouTube URL": {
385
- score: scoreNftYoutubeUrl,
386
- weight: 1
387
- },
300
+ "Animation URL": { score: scoreNftAnimationUrl, weight: 1 },
301
+ "Background Color": { score: scoreNftBackgroundColor, weight: 1 },
302
+ "Description": { score: scoreNftDescription, weight: 1 },
303
+ "External Url": { score: scoreNftExternalUrl, weight: 1 },
304
+ "Image": { score: scoreNftImage, weight: 1 },
305
+ "Image Data": { score: scoreNftImageData, weight: 1 },
306
+ "Name": { score: scoreNftName, weight: 1 },
307
+ "YouTube URL": { score: scoreNftYoutubeUrl, weight: 1 },
388
308
  ...attributesScoringCriteria
389
309
  };
390
310
  var scoringCriteria = {
391
- "Contract Address": {
392
- score: scoreContractAddress,
393
- weight: 1
394
- },
395
- "Supply": {
396
- score: scoreSupply,
397
- weight: 1
398
- },
399
- "Token Id": {
400
- score: scoreTokenId,
401
- weight: 1
402
- },
403
- "Type": {
404
- score: scoreType,
405
- weight: 1
406
- },
311
+ "Contract Address": { score: scoreContractAddress, weight: 1 },
312
+ "Supply": { score: scoreSupply, weight: 1 },
313
+ "Token Id": { score: scoreTokenId, weight: 1 },
314
+ "Type": { score: scoreType, weight: 1 },
407
315
  ...metadataScoringCriteria
408
316
  };
409
317
 
410
318
  // src/lib/rating/analyzeNft.ts
411
- var analyzeNft = /* @__PURE__ */ __name(async (nft) => {
412
- const result = Object.fromEntries(await Promise.all(Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {
413
- const rawScore = await score(nft);
414
- const weighted = rawScore.map((v) => v * weight);
415
- return [
416
- key,
417
- weighted
418
- ];
419
- })));
319
+ var analyzeNft = async (nft) => {
320
+ const result = Object.fromEntries(
321
+ await Promise.all(
322
+ Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {
323
+ const rawScore = await score(nft);
324
+ const weighted = rawScore.map((v) => v * weight);
325
+ return [key, weighted];
326
+ })
327
+ )
328
+ );
420
329
  return result;
421
- }, "analyzeNft");
330
+ };
422
331
 
423
332
  // src/Diviner.ts
424
- var toNftScorePayload = /* @__PURE__ */ __name((nftInfo, scores) => {
333
+ var toNftScorePayload = (nftInfo, scores) => {
425
334
  const { address, chainId, type } = nftInfo;
426
- return {
427
- address,
428
- chainId,
429
- schema: import_crypto_nft_payload_plugin.NftScoreSchema,
430
- scores,
431
- type
432
- };
433
- }, "toNftScorePayload");
434
- var isNftScore = /* @__PURE__ */ __name((payload) => payload.schema === import_crypto_nft_payload_plugin.NftScoreSchema, "isNftScore");
335
+ return { address, chainId, schema: import_crypto_nft_payload_plugin.NftScoreSchema, scores, type };
336
+ };
337
+ var isNftScore = (payload) => payload.schema === import_crypto_nft_payload_plugin.NftScoreSchema;
435
338
  var NftScoreDiviner = class extends import_diviner_abstract.AbstractDiviner {
436
- static {
437
- __name(this, "NftScoreDiviner");
438
- }
439
- static configSchemas = [
440
- ...super.configSchemas,
441
- import_crypto_nft_payload_plugin.NftScoreDivinerConfigSchema
442
- ];
339
+ static configSchemas = [...super.configSchemas, import_crypto_nft_payload_plugin.NftScoreDivinerConfigSchema];
443
340
  static defaultConfigSchema = import_crypto_nft_payload_plugin.NftScoreDivinerConfigSchema;
444
- divineHandler = /* @__PURE__ */ __name(async (payloads) => {
341
+ divineHandler = async (payloads) => {
445
342
  const nftInfos = payloads?.filter(import_crypto_nft_payload_plugin.isNftInfo) ?? [];
446
- const results = await Promise.all(nftInfos.map(async (nftInfo) => {
447
- const [score, sourceHash] = await Promise.all([
448
- // Analyze the NFT
449
- toNftScorePayload(nftInfo, await analyzeNft(nftInfo)),
450
- // Hash the source payload
451
- import_payload_builder.PayloadBuilder.dataHash(nftInfo)
452
- ]);
453
- return {
454
- ...score,
455
- sources: [
456
- sourceHash
457
- ]
458
- };
459
- }));
343
+ const results = await Promise.all(
344
+ nftInfos.map(async (nftInfo) => {
345
+ const [score, sourceHash] = await Promise.all([
346
+ // Analyze the NFT
347
+ toNftScorePayload(nftInfo, await analyzeNft(nftInfo)),
348
+ // Hash the source payload
349
+ import_payload_builder.PayloadBuilder.dataHash(nftInfo)
350
+ ]);
351
+ return { ...score, sources: [sourceHash] };
352
+ })
353
+ );
460
354
  return results;
461
- }, "divineHandler");
355
+ };
462
356
  };
463
357
 
464
358
  // src/Plugin.ts
465
359
  var import_crypto_nft_payload_plugin2 = require("@xyo-network/crypto-nft-payload-plugin");
466
360
  var import_payload_model = require("@xyo-network/payload-model");
467
361
  var import_payloadset_plugin = require("@xyo-network/payloadset-plugin");
468
- var NftScoreDivinerPlugin = /* @__PURE__ */ __name(() => (0, import_payloadset_plugin.createPayloadSetDivinerPlugin)({
469
- required: {
470
- [import_crypto_nft_payload_plugin2.NftSchema]: 1
471
- },
472
- schema: import_payload_model.PayloadSetSchema
473
- }, {
474
- diviner: /* @__PURE__ */ __name(async (params) => {
475
- const result = await NftScoreDiviner.create(params);
476
- return result;
477
- }, "diviner")
478
- }), "NftScoreDivinerPlugin");
362
+ var NftScoreDivinerPlugin = () => (0, import_payloadset_plugin.createPayloadSetDivinerPlugin)(
363
+ { required: { [import_crypto_nft_payload_plugin2.NftSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
364
+ {
365
+ diviner: async (params) => {
366
+ const result = await NftScoreDiviner.create(params);
367
+ return result;
368
+ }
369
+ }
370
+ );
479
371
  //# sourceMappingURL=index.cjs.map