@xyo-network/crypto-nft-collection-diviner-score-plugin 4.2.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/crypto-nft-collection-diviner-score-plugin",
3
- "version": "4.2.0",
3
+ "version": "5.0.1",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -28,26 +28,30 @@
28
28
  },
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "src"
34
+ ],
31
35
  "dependencies": {
32
- "@xyo-network/crypto-nft-collection-payload-plugin": "^4.2.0",
33
- "@xyo-network/crypto-nft-payload-plugin": "^4.2.0",
34
- "@xyo-network/crypto-nft-score-model": "^4.2.0",
35
- "@xyo-network/diviner-abstract": "^4.3.0",
36
- "@xyo-network/diviner-model": "^4.3.0",
37
- "@xyo-network/module-model": "^4.3.0",
38
- "@xyo-network/payload-builder": "^4.3.0",
39
- "@xyo-network/payload-model": "^4.3.0",
40
- "@xyo-network/payloadset-plugin": "^4.3.0"
36
+ "@xyo-network/crypto-nft-collection-payload-plugin": "~5.0.1",
37
+ "@xyo-network/crypto-nft-payload-plugin": "~5.0.1",
38
+ "@xyo-network/crypto-nft-score-model": "~5.0.1",
39
+ "@xyo-network/diviner-abstract": "~5.0.2",
40
+ "@xyo-network/diviner-model": "~5.0.2",
41
+ "@xyo-network/module-model": "~5.0.2",
42
+ "@xyo-network/payload-builder": "~5.0.2",
43
+ "@xyo-network/payload-model": "~5.0.2",
44
+ "@xyo-network/payloadset-plugin": "~5.0.2"
41
45
  },
42
46
  "devDependencies": {
43
- "@xylabs/ts-scripts-yarn3": "^7.0.1",
44
- "@xylabs/tsconfig": "^7.0.1",
45
- "@xylabs/vitest-extended": "^4.15.1",
46
- "@xyo-network/account": "^4.3.0",
47
- "@xyo-network/payload-wrapper": "^4.3.0",
48
- "ethers": "^6.15.0",
49
- "typescript": "^5.8.3",
50
- "vitest": "^3.2.4"
47
+ "@xylabs/ts-scripts-yarn3": "~7.1.0",
48
+ "@xylabs/tsconfig": "~7.1.0",
49
+ "@xylabs/vitest-extended": "~5.0.7",
50
+ "@xyo-network/account": "~5.0.2",
51
+ "@xyo-network/payload-wrapper": "~5.0.2",
52
+ "ethers": "~6.15.0",
53
+ "typescript": "~5.9.2",
54
+ "vitest": "~3.2.4"
51
55
  },
52
56
  "publishConfig": {
53
57
  "access": "public"
@@ -0,0 +1,32 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { readFile } from 'node:fs/promises'
4
+ import Path from 'node:path'
5
+
6
+ import type { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin'
7
+ import {
8
+ beforeAll,
9
+ describe, expect, it,
10
+ } from 'vitest'
11
+
12
+ import { scoreIndividualAttributes } from '../scoreIndividualAttributes.ts'
13
+
14
+ describe('scoreIndividualAttributes', () => {
15
+ let collections: NftCollectionInfo[]
16
+ beforeAll(async () => {
17
+ const filePath = Path.join(__dirname, '../../../../spec', 'testData.json')
18
+ const fileContents = await readFile(filePath, 'utf8')
19
+ collections = JSON.parse(fileContents) as NftCollectionInfo[]
20
+ })
21
+ it('evaluates the NFT collection', () => {
22
+ for (let collection of collections) {
23
+ const score = scoreIndividualAttributes(collection)
24
+ const [total, possible] = score
25
+ expect(total).toBeNumber()
26
+ expect(total).not.toBeNegative()
27
+ expect(possible).toBeNumber()
28
+ expect(possible).not.toBeNegative()
29
+ expect(total).toBeLessThanOrEqual(possible)
30
+ }
31
+ })
32
+ })
@@ -0,0 +1,32 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { readFile } from 'node:fs/promises'
4
+ import Path from 'node:path'
5
+
6
+ import type { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin'
7
+ import {
8
+ beforeAll,
9
+ describe, expect, it,
10
+ } from 'vitest'
11
+
12
+ import { scoreTotalAttributes } from '../scoreTotalAttributes.ts'
13
+
14
+ describe('scoreTotalAttributes', () => {
15
+ let collections: NftCollectionInfo[]
16
+ beforeAll(async () => {
17
+ const filePath = Path.join(__dirname, '../../../../spec', 'testData.json')
18
+ const fileContents = await readFile(filePath, 'utf8')
19
+ collections = JSON.parse(fileContents) as NftCollectionInfo[]
20
+ })
21
+ it('evaluates the NFT collection', () => {
22
+ for (let collection of collections) {
23
+ const score = scoreTotalAttributes(collection)
24
+ const [total, possible] = score
25
+ expect(total).toBeNumber()
26
+ expect(total).not.toBeNegative()
27
+ expect(possible).toBeNumber()
28
+ expect(possible).not.toBeNegative()
29
+ expect(total).toBeLessThanOrEqual(possible)
30
+ }
31
+ })
32
+ })
@@ -0,0 +1,42 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import type { NftCollectionCount } from '@xyo-network/crypto-nft-collection-payload-plugin'
4
+ import {
5
+ describe, expect,
6
+ it,
7
+ } from 'vitest'
8
+
9
+ import { scoreTotal } from '../total.ts'
10
+
11
+ describe('scoreTotal', () => {
12
+ const values: [total: number, expected: number][] = [
13
+ [1, 0],
14
+ [2, 0],
15
+ [3, 0],
16
+ [10, 1],
17
+ [20, 1],
18
+ [30, 2],
19
+ [100, 3],
20
+ [200, 4],
21
+ [300, 5],
22
+ [1000, 7],
23
+ [2000, 9],
24
+ [3000, 9],
25
+ [10_000, 10],
26
+ [20_000, 10],
27
+ [30_000, 9],
28
+ [100_000, 7],
29
+ [200_000, 6],
30
+ [300_000, 5],
31
+ ]
32
+
33
+ it.each(values)('scores %s as %s', (total, expected) => {
34
+ const collection: NftCollectionCount = { total }
35
+ const [score, possible] = scoreTotal(collection)
36
+ expect(score).toBeNumber()
37
+ expect(score).not.toBeNegative()
38
+ expect(possible).not.toBeNegative()
39
+ expect(possible).toBeNumber()
40
+ expect(score).toBe(expected)
41
+ })
42
+ })
@@ -0,0 +1,38 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { readFile } from 'node:fs/promises'
4
+ import Path from 'node:path'
5
+
6
+ import type { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin'
7
+ import {
8
+ beforeAll,
9
+ describe, expect, it,
10
+ } from 'vitest'
11
+
12
+ import { analyzeNftCollection } from '../analyzeNftCollection.ts'
13
+
14
+ describe('analyzeNftCollection', () => {
15
+ let collections: NftCollectionInfo[]
16
+ beforeAll(async () => {
17
+ const filePath = Path.join(__dirname, 'testData.json')
18
+ const fileContents = await readFile(filePath, 'utf8')
19
+ collections = JSON.parse(fileContents) as NftCollectionInfo[]
20
+ })
21
+ it('evaluates the NFT collection', async () => {
22
+ await Promise.all(
23
+ collections.map(async (collection) => {
24
+ const rating = await analyzeNftCollection(collection)
25
+ expect(rating).toBeObject()
26
+ for (let [key, score] of Object.entries(rating)) {
27
+ expect(key).toBeString()
28
+ const [total, possible] = score
29
+ expect(total).toBeNumber()
30
+ expect(total).not.toBeNegative()
31
+ expect(possible).toBeNumber()
32
+ expect(possible).not.toBeNegative()
33
+ expect(total).toBeLessThanOrEqual(possible)
34
+ }
35
+ }),
36
+ )
37
+ })
38
+ })
@@ -0,0 +1,1041 @@
1
+ [
2
+ {
3
+ "address": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
4
+ "chainId": 1,
5
+ "name": "BoredApeYachtClub",
6
+ "symbol": "BAYC",
7
+ "type": "ERC721",
8
+ "metrics": {
9
+ "metadata": {
10
+ "attributes": {
11
+ "Mouth": {
12
+ "metrics": {
13
+ "binomial": {
14
+ "p": 1
15
+ },
16
+ "count": 100
17
+ },
18
+ "values": {
19
+ "Bored Cigarette": {
20
+ "binomial": {
21
+ "p": 0.07
22
+ },
23
+ "count": 7
24
+ },
25
+ "Bored Cigar": {
26
+ "binomial": {
27
+ "p": 0.01
28
+ },
29
+ "count": 1
30
+ },
31
+ "Jovial": {
32
+ "binomial": {
33
+ "p": 0.02
34
+ },
35
+ "count": 2
36
+ },
37
+ "Bored": {
38
+ "binomial": {
39
+ "p": 0.28
40
+ },
41
+ "count": 28
42
+ },
43
+ "Grin": {
44
+ "binomial": {
45
+ "p": 0.05
46
+ },
47
+ "count": 5
48
+ },
49
+ "Bored Unshaven": {
50
+ "binomial": {
51
+ "p": 0.18
52
+ },
53
+ "count": 18
54
+ },
55
+ "Grin Gold Grill": {
56
+ "binomial": {
57
+ "p": 0.01
58
+ },
59
+ "count": 1
60
+ },
61
+ "Discomfort": {
62
+ "binomial": {
63
+ "p": 0.04
64
+ },
65
+ "count": 4
66
+ },
67
+ "Bored Pipe": {
68
+ "binomial": {
69
+ "p": 0.03
70
+ },
71
+ "count": 3
72
+ },
73
+ "Rage": {
74
+ "binomial": {
75
+ "p": 0.02
76
+ },
77
+ "count": 2
78
+ },
79
+ "Phoneme L": {
80
+ "binomial": {
81
+ "p": 0.03
82
+ },
83
+ "count": 3
84
+ },
85
+ "Bored Unshaven Kazoo": {
86
+ "binomial": {
87
+ "p": 0.01
88
+ },
89
+ "count": 1
90
+ },
91
+ "Phoneme Oh": {
92
+ "binomial": {
93
+ "p": 0.04
94
+ },
95
+ "count": 4
96
+ },
97
+ "Small Grin": {
98
+ "binomial": {
99
+ "p": 0.03
100
+ },
101
+ "count": 3
102
+ },
103
+ "Phoneme Wah": {
104
+ "binomial": {
105
+ "p": 0.02
106
+ },
107
+ "count": 2
108
+ },
109
+ "Phoneme Vuh": {
110
+ "binomial": {
111
+ "p": 0.02
112
+ },
113
+ "count": 2
114
+ },
115
+ "Bored Unshaven Cigar": {
116
+ "binomial": {
117
+ "p": 0.02
118
+ },
119
+ "count": 2
120
+ },
121
+ "Bored Kazoo": {
122
+ "binomial": {
123
+ "p": 0.01
124
+ },
125
+ "count": 1
126
+ },
127
+ "Bored Party Horn": {
128
+ "binomial": {
129
+ "p": 0.02
130
+ },
131
+ "count": 2
132
+ },
133
+ "Dumbfounded": {
134
+ "binomial": {
135
+ "p": 0.02
136
+ },
137
+ "count": 2
138
+ },
139
+ "Bored Pizza": {
140
+ "binomial": {
141
+ "p": 0.04
142
+ },
143
+ "count": 4
144
+ },
145
+ "Bored Unshaven Cigarette": {
146
+ "binomial": {
147
+ "p": 0.01
148
+ },
149
+ "count": 1
150
+ },
151
+ "Bored Unshaven Party horn": {
152
+ "binomial": {
153
+ "p": 0.01
154
+ },
155
+ "count": 1
156
+ },
157
+ "Phoneme ooo": {
158
+ "binomial": {
159
+ "p": 0.01
160
+ },
161
+ "count": 1
162
+ }
163
+ }
164
+ },
165
+ "Background": {
166
+ "metrics": {
167
+ "binomial": {
168
+ "p": 1
169
+ },
170
+ "count": 100
171
+ },
172
+ "values": {
173
+ "Army Green": {
174
+ "binomial": {
175
+ "p": 0.08
176
+ },
177
+ "count": 8
178
+ },
179
+ "New Punk Blue": {
180
+ "binomial": {
181
+ "p": 0.25
182
+ },
183
+ "count": 25
184
+ },
185
+ "Orange": {
186
+ "binomial": {
187
+ "p": 0.13
188
+ },
189
+ "count": 13
190
+ },
191
+ "Gray": {
192
+ "binomial": {
193
+ "p": 0.1
194
+ },
195
+ "count": 10
196
+ },
197
+ "Purple": {
198
+ "binomial": {
199
+ "p": 0.09
200
+ },
201
+ "count": 9
202
+ },
203
+ "Blue": {
204
+ "binomial": {
205
+ "p": 0.09
206
+ },
207
+ "count": 9
208
+ },
209
+ "Yellow": {
210
+ "binomial": {
211
+ "p": 0.1
212
+ },
213
+ "count": 10
214
+ },
215
+ "Aquamarine": {
216
+ "binomial": {
217
+ "p": 0.16
218
+ },
219
+ "count": 16
220
+ }
221
+ }
222
+ },
223
+ "Eyes": {
224
+ "metrics": {
225
+ "binomial": {
226
+ "p": 1
227
+ },
228
+ "count": 100
229
+ },
230
+ "values": {
231
+ "Eyepatch": {
232
+ "binomial": {
233
+ "p": 0.03
234
+ },
235
+ "count": 3
236
+ },
237
+ "Coins": {
238
+ "binomial": {
239
+ "p": 0.02
240
+ },
241
+ "count": 2
242
+ },
243
+ "Angry": {
244
+ "binomial": {
245
+ "p": 0.07
246
+ },
247
+ "count": 7
248
+ },
249
+ "Holographic": {
250
+ "binomial": {
251
+ "p": 0.03
252
+ },
253
+ "count": 3
254
+ },
255
+ "Cyborg": {
256
+ "binomial": {
257
+ "p": 0.01
258
+ },
259
+ "count": 1
260
+ },
261
+ "Bored": {
262
+ "binomial": {
263
+ "p": 0.18
264
+ },
265
+ "count": 18
266
+ },
267
+ "Robot": {
268
+ "binomial": {
269
+ "p": 0.03
270
+ },
271
+ "count": 3
272
+ },
273
+ "Wide Eyed": {
274
+ "binomial": {
275
+ "p": 0.05
276
+ },
277
+ "count": 5
278
+ },
279
+ "3d": {
280
+ "binomial": {
281
+ "p": 0.05
282
+ },
283
+ "count": 5
284
+ },
285
+ "Closed": {
286
+ "binomial": {
287
+ "p": 0.09
288
+ },
289
+ "count": 9
290
+ },
291
+ "Sleepy": {
292
+ "binomial": {
293
+ "p": 0.09
294
+ },
295
+ "count": 9
296
+ },
297
+ "Sad": {
298
+ "binomial": {
299
+ "p": 0.05
300
+ },
301
+ "count": 5
302
+ },
303
+ "Bloodshot": {
304
+ "binomial": {
305
+ "p": 0.08
306
+ },
307
+ "count": 8
308
+ },
309
+ "Heart": {
310
+ "binomial": {
311
+ "p": 0.05
312
+ },
313
+ "count": 5
314
+ },
315
+ "Scumbag": {
316
+ "binomial": {
317
+ "p": 0.03
318
+ },
319
+ "count": 3
320
+ },
321
+ "Zombie": {
322
+ "binomial": {
323
+ "p": 0.03
324
+ },
325
+ "count": 3
326
+ },
327
+ "Crazy": {
328
+ "binomial": {
329
+ "p": 0.05
330
+ },
331
+ "count": 5
332
+ },
333
+ "Blue Beams": {
334
+ "binomial": {
335
+ "p": 0.01
336
+ },
337
+ "count": 1
338
+ },
339
+ "Sunglasses": {
340
+ "binomial": {
341
+ "p": 0.03
342
+ },
343
+ "count": 3
344
+ },
345
+ "Blindfold": {
346
+ "binomial": {
347
+ "p": 0.01
348
+ },
349
+ "count": 1
350
+ },
351
+ "X Eyes": {
352
+ "binomial": {
353
+ "p": 0.01
354
+ },
355
+ "count": 1
356
+ }
357
+ }
358
+ },
359
+ "Clothes": {
360
+ "metrics": {
361
+ "binomial": {
362
+ "p": 0.87
363
+ },
364
+ "count": 87
365
+ },
366
+ "values": {
367
+ "Tuxedo Tee": {
368
+ "binomial": {
369
+ "p": 0.06
370
+ },
371
+ "count": 6
372
+ },
373
+ "Black Holes T": {
374
+ "binomial": {
375
+ "p": 0.03
376
+ },
377
+ "count": 3
378
+ },
379
+ "Black T": {
380
+ "binomial": {
381
+ "p": 0.02
382
+ },
383
+ "count": 2
384
+ },
385
+ "Stunt Jacket": {
386
+ "binomial": {
387
+ "p": 0.04
388
+ },
389
+ "count": 4
390
+ },
391
+ "Sleeveless T": {
392
+ "binomial": {
393
+ "p": 0.04
394
+ },
395
+ "count": 4
396
+ },
397
+ "Work Vest": {
398
+ "binomial": {
399
+ "p": 0.04
400
+ },
401
+ "count": 4
402
+ },
403
+ "Navy Striped Tee": {
404
+ "binomial": {
405
+ "p": 0.03
406
+ },
407
+ "count": 3
408
+ },
409
+ "Vietnam Jacket": {
410
+ "binomial": {
411
+ "p": 0.03
412
+ },
413
+ "count": 3
414
+ },
415
+ "Leather Jacket": {
416
+ "binomial": {
417
+ "p": 0.03
418
+ },
419
+ "count": 3
420
+ },
421
+ "Guayabera": {
422
+ "binomial": {
423
+ "p": 0.03
424
+ },
425
+ "count": 3
426
+ },
427
+ "Bayc T Red": {
428
+ "binomial": {
429
+ "p": 0.02
430
+ },
431
+ "count": 2
432
+ },
433
+ "Wool Turtleneck": {
434
+ "binomial": {
435
+ "p": 0.02
436
+ },
437
+ "count": 2
438
+ },
439
+ "Toga": {
440
+ "binomial": {
441
+ "p": 0.03
442
+ },
443
+ "count": 3
444
+ },
445
+ "Biker Vest": {
446
+ "binomial": {
447
+ "p": 0.02
448
+ },
449
+ "count": 2
450
+ },
451
+ "Sleeveless Logo T": {
452
+ "binomial": {
453
+ "p": 0.01
454
+ },
455
+ "count": 1
456
+ },
457
+ "Lumberjack Shirt": {
458
+ "binomial": {
459
+ "p": 0.02
460
+ },
461
+ "count": 2
462
+ },
463
+ "Bone Tee": {
464
+ "binomial": {
465
+ "p": 0.03
466
+ },
467
+ "count": 3
468
+ },
469
+ "Rainbow Suspenders": {
470
+ "binomial": {
471
+ "p": 0.02
472
+ },
473
+ "count": 2
474
+ },
475
+ "Puffy Vest": {
476
+ "binomial": {
477
+ "p": 0.02
478
+ },
479
+ "count": 2
480
+ },
481
+ "Kings Robe": {
482
+ "binomial": {
483
+ "p": 0.02
484
+ },
485
+ "count": 2
486
+ },
487
+ "Striped Tee": {
488
+ "binomial": {
489
+ "p": 0.03
490
+ },
491
+ "count": 3
492
+ },
493
+ "Hawaiian": {
494
+ "binomial": {
495
+ "p": 0.03
496
+ },
497
+ "count": 3
498
+ },
499
+ "Tanktop": {
500
+ "binomial": {
501
+ "p": 0.03
502
+ },
503
+ "count": 3
504
+ },
505
+ "Blue Dress": {
506
+ "binomial": {
507
+ "p": 0.01
508
+ },
509
+ "count": 1
510
+ },
511
+ "Caveman Pelt": {
512
+ "binomial": {
513
+ "p": 0.03
514
+ },
515
+ "count": 3
516
+ },
517
+ "Prom Dress": {
518
+ "binomial": {
519
+ "p": 0.01
520
+ },
521
+ "count": 1
522
+ },
523
+ "Smoking Jacket": {
524
+ "binomial": {
525
+ "p": 0.02
526
+ },
527
+ "count": 2
528
+ },
529
+ "Admirals Coat": {
530
+ "binomial": {
531
+ "p": 0.01
532
+ },
533
+ "count": 1
534
+ },
535
+ "Tweed Suit": {
536
+ "binomial": {
537
+ "p": 0.02
538
+ },
539
+ "count": 2
540
+ },
541
+ "Service": {
542
+ "binomial": {
543
+ "p": 0.02
544
+ },
545
+ "count": 2
546
+ },
547
+ "Bone Necklace": {
548
+ "binomial": {
549
+ "p": 0.01
550
+ },
551
+ "count": 1
552
+ },
553
+ "Bayc T Black": {
554
+ "binomial": {
555
+ "p": 0.02
556
+ },
557
+ "count": 2
558
+ },
559
+ "Pimp Coat": {
560
+ "binomial": {
561
+ "p": 0.01
562
+ },
563
+ "count": 1
564
+ },
565
+ "Lab Coat": {
566
+ "binomial": {
567
+ "p": 0.01
568
+ },
569
+ "count": 1
570
+ },
571
+ "Tie Dye": {
572
+ "binomial": {
573
+ "p": 0.02
574
+ },
575
+ "count": 2
576
+ },
577
+ "Black Suit": {
578
+ "binomial": {
579
+ "p": 0.01
580
+ },
581
+ "count": 1
582
+ },
583
+ "Sailor Shirt": {
584
+ "binomial": {
585
+ "p": 0.01
586
+ },
587
+ "count": 1
588
+ },
589
+ "Prison Jumpsuit": {
590
+ "binomial": {
591
+ "p": 0.01
592
+ },
593
+ "count": 1
594
+ }
595
+ }
596
+ },
597
+ "Fur": {
598
+ "metrics": {
599
+ "binomial": {
600
+ "p": 1
601
+ },
602
+ "count": 100
603
+ },
604
+ "values": {
605
+ "Brown": {
606
+ "binomial": {
607
+ "p": 0.19
608
+ },
609
+ "count": 19
610
+ },
611
+ "White": {
612
+ "binomial": {
613
+ "p": 0.04
614
+ },
615
+ "count": 4
616
+ },
617
+ "Pink": {
618
+ "binomial": {
619
+ "p": 0.05
620
+ },
621
+ "count": 5
622
+ },
623
+ "Robot": {
624
+ "binomial": {
625
+ "p": 0.04
626
+ },
627
+ "count": 4
628
+ },
629
+ "Blue": {
630
+ "binomial": {
631
+ "p": 0.04
632
+ },
633
+ "count": 4
634
+ },
635
+ "Dark Brown": {
636
+ "binomial": {
637
+ "p": 0.14
638
+ },
639
+ "count": 14
640
+ },
641
+ "Cream": {
642
+ "binomial": {
643
+ "p": 0.11
644
+ },
645
+ "count": 11
646
+ },
647
+ "Gray": {
648
+ "binomial": {
649
+ "p": 0.06
650
+ },
651
+ "count": 6
652
+ },
653
+ "Tan": {
654
+ "binomial": {
655
+ "p": 0.03
656
+ },
657
+ "count": 3
658
+ },
659
+ "Golden Brown": {
660
+ "binomial": {
661
+ "p": 0.05
662
+ },
663
+ "count": 5
664
+ },
665
+ "Zombie": {
666
+ "binomial": {
667
+ "p": 0.04
668
+ },
669
+ "count": 4
670
+ },
671
+ "Black": {
672
+ "binomial": {
673
+ "p": 0.08
674
+ },
675
+ "count": 8
676
+ },
677
+ "Noise": {
678
+ "binomial": {
679
+ "p": 0.02
680
+ },
681
+ "count": 2
682
+ },
683
+ "Red": {
684
+ "binomial": {
685
+ "p": 0.06
686
+ },
687
+ "count": 6
688
+ },
689
+ "Trippy": {
690
+ "binomial": {
691
+ "p": 0.02
692
+ },
693
+ "count": 2
694
+ },
695
+ "Cheetah": {
696
+ "binomial": {
697
+ "p": 0.03
698
+ },
699
+ "count": 3
700
+ }
701
+ }
702
+ },
703
+ "Hat": {
704
+ "metrics": {
705
+ "binomial": {
706
+ "p": 0.84
707
+ },
708
+ "count": 84
709
+ },
710
+ "values": {
711
+ "Spinner Hat": {
712
+ "binomial": {
713
+ "p": 0.03
714
+ },
715
+ "count": 3
716
+ },
717
+ "Commie Hat": {
718
+ "binomial": {
719
+ "p": 0.02
720
+ },
721
+ "count": 2
722
+ },
723
+ "Prussian Helmet": {
724
+ "binomial": {
725
+ "p": 0.03
726
+ },
727
+ "count": 3
728
+ },
729
+ "Bayc Flipped Brim": {
730
+ "binomial": {
731
+ "p": 0.04
732
+ },
733
+ "count": 4
734
+ },
735
+ "Cowboy Hat": {
736
+ "binomial": {
737
+ "p": 0.02
738
+ },
739
+ "count": 2
740
+ },
741
+ "Bandana Blue": {
742
+ "binomial": {
743
+ "p": 0.04
744
+ },
745
+ "count": 4
746
+ },
747
+ "Halo": {
748
+ "binomial": {
749
+ "p": 0.05
750
+ },
751
+ "count": 5
752
+ },
753
+ "Fisherman's Hat": {
754
+ "binomial": {
755
+ "p": 0.06
756
+ },
757
+ "count": 6
758
+ },
759
+ "Seaman's Hat": {
760
+ "binomial": {
761
+ "p": 0.04
762
+ },
763
+ "count": 4
764
+ },
765
+ "Faux Hawk": {
766
+ "binomial": {
767
+ "p": 0.03
768
+ },
769
+ "count": 3
770
+ },
771
+ "S&m Hat": {
772
+ "binomial": {
773
+ "p": 0.02
774
+ },
775
+ "count": 2
776
+ },
777
+ "Stuntman Helmet": {
778
+ "binomial": {
779
+ "p": 0.04
780
+ },
781
+ "count": 4
782
+ },
783
+ "Party Hat 1": {
784
+ "binomial": {
785
+ "p": 0.02
786
+ },
787
+ "count": 2
788
+ },
789
+ "Fez": {
790
+ "binomial": {
791
+ "p": 0.05
792
+ },
793
+ "count": 5
794
+ },
795
+ "Short Mohawk": {
796
+ "binomial": {
797
+ "p": 0.02
798
+ },
799
+ "count": 2
800
+ },
801
+ "Bowler": {
802
+ "binomial": {
803
+ "p": 0.06
804
+ },
805
+ "count": 6
806
+ },
807
+ "Beanie": {
808
+ "binomial": {
809
+ "p": 0.07
810
+ },
811
+ "count": 7
812
+ },
813
+ "Army Hat": {
814
+ "binomial": {
815
+ "p": 0.01
816
+ },
817
+ "count": 1
818
+ },
819
+ "Vietnam Era Helmet": {
820
+ "binomial": {
821
+ "p": 0.01
822
+ },
823
+ "count": 1
824
+ },
825
+ "King's Crown": {
826
+ "binomial": {
827
+ "p": 0.01
828
+ },
829
+ "count": 1
830
+ },
831
+ "Horns": {
832
+ "binomial": {
833
+ "p": 0.01
834
+ },
835
+ "count": 1
836
+ },
837
+ "Irish Boho": {
838
+ "binomial": {
839
+ "p": 0.03
840
+ },
841
+ "count": 3
842
+ },
843
+ "Sea Captain's Hat": {
844
+ "binomial": {
845
+ "p": 0.05
846
+ },
847
+ "count": 5
848
+ },
849
+ "Sushi Chef Headband": {
850
+ "binomial": {
851
+ "p": 0.01
852
+ },
853
+ "count": 1
854
+ },
855
+ "Party Hat 2": {
856
+ "binomial": {
857
+ "p": 0.01
858
+ },
859
+ "count": 1
860
+ },
861
+ "Ww2 Pilot Helm": {
862
+ "binomial": {
863
+ "p": 0.02
864
+ },
865
+ "count": 2
866
+ },
867
+ "Bayc Hat Red": {
868
+ "binomial": {
869
+ "p": 0.01
870
+ },
871
+ "count": 1
872
+ },
873
+ "Girl's Hair Pink": {
874
+ "binomial": {
875
+ "p": 0.01
876
+ },
877
+ "count": 1
878
+ },
879
+ "Bayc Hat Black": {
880
+ "binomial": {
881
+ "p": 0.01
882
+ },
883
+ "count": 1
884
+ },
885
+ "Police Motorcycle Helmet": {
886
+ "binomial": {
887
+ "p": 0.01
888
+ },
889
+ "count": 1
890
+ }
891
+ }
892
+ },
893
+ "Earring": {
894
+ "metrics": {
895
+ "binomial": {
896
+ "p": 0.31
897
+ },
898
+ "count": 31
899
+ },
900
+ "values": {
901
+ "Diamond Stud": {
902
+ "binomial": {
903
+ "p": 0.04
904
+ },
905
+ "count": 4
906
+ },
907
+ "Silver Hoop": {
908
+ "binomial": {
909
+ "p": 0.05
910
+ },
911
+ "count": 5
912
+ },
913
+ "Silver Stud": {
914
+ "binomial": {
915
+ "p": 0.1
916
+ },
917
+ "count": 10
918
+ },
919
+ "Gold Stud": {
920
+ "binomial": {
921
+ "p": 0.06
922
+ },
923
+ "count": 6
924
+ },
925
+ "Gold Hoop": {
926
+ "binomial": {
927
+ "p": 0.06
928
+ },
929
+ "count": 6
930
+ }
931
+ }
932
+ }
933
+ }
934
+ }
935
+ },
936
+ "schema": "network.xyo.crypto.nft.collection",
937
+ "sources": [
938
+ "61b6da726adfa0221f2cfa0bb4e6f4ec074033db5c005c6859e589fd1028c095",
939
+ "ea913e41028709011a15e58c6b0ba72872a44ceff6a0c71c87e0e5b05e2ddd6a",
940
+ "40dbdd69ef595c746945715f5d1e0a31a8848d62d1246d1aa4cb6e4ba8dd4a89",
941
+ "cb49dd7871a960beae87574dea065667acc804b2b058518733ba0cd291d3525d",
942
+ "061263daf422dcfd458acba1da9e18a7fe599966c79b52ae98964541a70d4c31",
943
+ "78e37eb5fab5cf40f0f12b920368d4cfa8d1a65fd4c4372c58670f156c24fc57",
944
+ "773b69d56a8940dd6d01279f84ce7341495f2283e47d3e0c32942b77932c2d70",
945
+ "51aa0d42a85a72a1f19f8d93839b0fcec1a8d2ac0ffc9795a5d2cc5c8e404e4f",
946
+ "2f816c00dd5646b2837dccc93a0de6763de493eb25bae22e934ea8ed162ca22b",
947
+ "e8e7326bc8ff80003c7a64a91f46071fdc9f8ce518f1553d81a4e72a8db10715",
948
+ "1f55a7a64dc51506cc07c45305349d7816d81c434d250320002e897a3b222a7e",
949
+ "64cf964dfead8f0402429fab78a1eea5d2ea969f62c01c8e7e5aa8a3e9f01fad",
950
+ "5511fe125402dd0f8ee232dd2a7b937001e54162c8975921c0203c42235a0995",
951
+ "8f6e83777fa7b1697d18d7839ef428cc44bca253a0a11122f415ccc14caa34cd",
952
+ "bcbfc5703a893e1df56b3f789a6b1ae182c24058a299296c4863c2e9d74ac7dc",
953
+ "6dbf4a6fe7c7966b4d73ab592e59b2b46ef6681fdc7ab89c5ec13275863af805",
954
+ "b25ac14052e03983c66fa260e663f70c5d40555fe1ac03f879613f7eb956bc1a",
955
+ "5066f9162cddcf9017b49a75a247a621c8f0c091ea02fd891545a1e120ae810a",
956
+ "92f4f2f72576e7f15e9e6445cf52aa04ff8a3ebc4478abb7517a53d3f6f9334e",
957
+ "684b8091179cc056fca49c8a53abed819c4ebda6e5ab1dbc8959309ff29b8d86",
958
+ "68a42d3b5d2cdb7749c376d3afdc48dbaa0ba9ca67063bcf76a5fe2daeb199ca",
959
+ "a395f6a5c6a8a5d9abab281ad089fcc72298a1826744e184a6a460a544607edd",
960
+ "b2cd4dc7d9f43c8544dffb544e74112b838e2c57d8c275dc272543c29a0553e6",
961
+ "e1a5ce36cea5f4324aa8a61a6cece8c6953fbfcc65b50309f506987c026d8db2",
962
+ "818b2e501a95572b22a17f155c80e736d0592fe7fb379571b108bf8463ad2881",
963
+ "1feb61d2524d3b5fb391d5bb960bf7e707346c78e89df22812cb82b7080ef07c",
964
+ "1538778f6036ab18dd54b3248d623a4c5779577b59c140a13fb9ddfb3c2d47f1",
965
+ "786e38d1abc5eb12fcf581f911a71272608d4285875405a02788275e9d775046",
966
+ "b85ae30366f47086488c056bdf5325d1a2872e79951c4e341abc2f872c13cfd1",
967
+ "8fee05b1f0e101442749e1d45669a3ba166e5288d5337b56894ff16f4e1b1aba",
968
+ "4f5ad27c12d0a0772df86d5fe33e9432f3b97b0296ff2bea06f568968ed6da3c",
969
+ "e59730fb89fe75d09c3cb52e296a46608d9c5f873279350370a999e2235e9d3a",
970
+ "d9af52bfab5b504d115e7585c75132603e1cd00957f5b93bc2cd0f51093eb303",
971
+ "dfd890d6121ece928b53513b3786ac6ed319e9f4a7605a159cd1232153b32cfa",
972
+ "eb47872263424577a050dd4674f5b40c57126a9644f6d655075001f30dda583c",
973
+ "14e98ab2d133c87bce93268b010cfe125a6ddf5ec0e265c6d8a2b9b7fdde3a97",
974
+ "1d933d8082fd05f10a83ba1e7f19e96b4414ee2950adbf2091809f7bd7c04c94",
975
+ "36669d07750d52e7b51044c8a392767b7bc55261b2bfc7b1d30a67f7020f4d58",
976
+ "5e3285278f45bc9a057daaf9fa1f8644a9e5298827e88294ff73f9f0f0fe8c0e",
977
+ "ea77f436555b2bea953fb98a618c7f2a7043607c0e77f275d3477e0f132fbb1d",
978
+ "70aa0343d48aa6b0bb68e9a9aa9b76448d4dc83c10637eeacd254713b2e509ea",
979
+ "1a61357af73f915786792faadb6150b47b60ae3365f869bc2971263e05465ea0",
980
+ "4d8fd5297f44340946f4b0dee6ac08866fdc7493aa68d8f66130fa85f1086a0f",
981
+ "b711ab79bd070e1a67e823a3be8e247027e9498a40f9f6680295e6ba40bb18c7",
982
+ "5e7bb6001e9a79722e78c6c67b49d398918ce4576d9f305de5536f4d3c1816b8",
983
+ "791f44564cbec39197adf80332505767e02ec2d15e0740edcfd92f0ced3e1f27",
984
+ "bfadb8461e19bdfe8f316c1efe4b357f3e7041882df674c1b4c1aab44ff8e0c7",
985
+ "210153fcd4e5c3f7a051ef415517ca7af3de3174e847c1796019a6f2a4648ab1",
986
+ "e1af3de92b92a6c2cfde2f2cd54710a98e75aa2c132cf016e930d3147eabd5a7",
987
+ "18b11abefc44c789fedfcdf6bfe034f66a6e7e9426a59222e63ce1d10ce872eb",
988
+ "b680925aa7bd13ac5bb2f6760db91463b9ae26d21afe4e86e8bb9db0bf1a505a",
989
+ "2a65896ffb2030738bfdaa16c6b67c0fa7d0e21d811e66ea4956ec3ffca79a13",
990
+ "6dda0d0f2f6e8f07713f4ab6625e386eaf8dd01f8cafabe8738375c60c3d023d",
991
+ "a992a804f847b6880b4d8fa2118d4984c99bc50f49292282a1398cd931ceb41c",
992
+ "ead2688462e2d0e278ef6e67b831f50796df14cc98f498a2072ab928050fcbdc",
993
+ "9b0196146f1995aaa37e3b7e8b280e2b5ddaf78d0693a57e21c3ba9ec7658f9b",
994
+ "d00283209206a79282c4918c395baa7a3df34f9dbea3ca0fc62a1b813d01cda0",
995
+ "9f823c78b571ed8ae55154dc963df5a33f255c6eae4e287f1531404da63acfd5",
996
+ "e2c351af648f52f081d5823744d0c2dfd9a20b21bd9d79ef8f7bfdd2d3592bdc",
997
+ "f42ff6bc7d82557b5299dc6b9f0e391be4b986143dc759a1ec55a4f3c50fb553",
998
+ "4c4cea81e4ea964760f205063356682e502aba5357f82eedbc50374560a4d366",
999
+ "629ad0f4a48fefcc229de06e6654b4264a412e903f9a390e18f9ec06c76d1410",
1000
+ "c8f58a2b9b6605deb3ed9bc30544c0166182a52990c021046410a46d3668666e",
1001
+ "bbcb3e5e33bdb21c79b29e53da549f69fa082e0f3ca5a74a2cb6c07d9489a3bd",
1002
+ "1d8aebb8bb31b92e459c165cd9f2158424e8c10b9f66db25bc31826db9e0a3fe",
1003
+ "9fc3b0941df8a77842ae30d6b1adf4f7e06d3b002a4c3538bb20b64268361fbf",
1004
+ "b6eb6a71b9217826fac5da9afaa18d91cf5db7073dc914dc42105223b272bf1e",
1005
+ "391cdbcdabe403ffd1ecab5fe15a7a470dbf81f0693c79719c51b3e3b696201c",
1006
+ "dab2187f280a615b3fe22f87121260186b925c970c9d530b37993bd2873fa7cf",
1007
+ "cec4fef5e02e941a7705049ec5ed1dc6ccb4cad55099154992c7f32d86dddb75",
1008
+ "158c0d477063a57dd4605878f36eeabd25176dbc24864401afbbc1524d1105e0",
1009
+ "9427d8c229b84a5fd1a7cdfbe9da1df89879b0a249a62f6779641d911d185526",
1010
+ "9042c22385d9a14ecd9de52a3891057f3f4cd751bc3acace4ed5ca22943620cc",
1011
+ "2c8eb17ca4ada2dd2690e293a52efc131986ac953e30bb6e66dde2883baf6356",
1012
+ "1bbc4bc8f435fc4ef3ff59813ac84dfc87cbcf6e90e07c695a44e8dab05e6eeb",
1013
+ "ccf066ddd52bec9937eef963f541d75339220a2821cdff4ffb2f8a50ea0dc77e",
1014
+ "e230b39e7e4413622d8dc2cd2e7e1224c5550678622ec92ef76de839112bd131",
1015
+ "0e5ee9604a6c3a1f8c4192af0c324d0b7debaf3fd1b5f70b90f3e3fd1dca687e",
1016
+ "59c83aa12ab4a29f51d156526e991f6e9de7e6c7da7d3ce6ed8a3d7735441fd6",
1017
+ "2116fc58725b6a707f349851f7cc8ae81c98c4825e5789d815692afabd6a8b22",
1018
+ "a2db58243185c082ff4566bc80cfda0e2719cfb1161b3c198d8cc2773b73f0f2",
1019
+ "9f1e7bad6fc693d92847bd06ce808b8d442be02f03b2ac96bb2c51297c19bbf5",
1020
+ "406600f74573179fc78c69abf2347211d15d5d998b4284b33d362b827bb35b7b",
1021
+ "07edd99f06369bcb6162bc7f73409074219d8b64b4e6fd8831b4e23147997288",
1022
+ "35f09c9a91987d47305e25010f7833580aa4ecd5a2efd6b2e90bf0eec9a77346",
1023
+ "996fdc52282ed016dc2dc28fe0ab5e8b532df6ecbc547e5a964351ee910efa89",
1024
+ "bcf99be5ec1ab42e431c6d83f673d2500550ef463953189eda8a82ce80c5bc53",
1025
+ "ccf2877009e55c3c7233cc39a940b6b774eee3dc300958f3577fa96a899237d1",
1026
+ "7c05f80422f9c243921c62d2994d0e011bfce6f649a6a9304c0ccd487487e035",
1027
+ "accae8e8133ba11c7138292a7a20c4e26071e3b8b59d3f1b2aaafec1ff1f35e8",
1028
+ "888ad82208208ec12083c18f49f8e7f9db34dbbd1336432ef677e3815192f4c3",
1029
+ "266a846b7f8b8589571bceb7410b57d24e644bbc9cd018185f65ce6b152c090c",
1030
+ "8f2b60ad58e574bcbef583be27d1d6daadb275f8ff87410af0460f91b0ef35f0",
1031
+ "63b9c1e29ee9e28c8ca384bc75d16b1974a7bb81f0102bd63fadb32d7856943f",
1032
+ "b76ac9e2069f5a85dbc73de3b3cc6a5fcce1941154f17d335f856b9f810bc0b3",
1033
+ "5ab40c5305a11364ee83d99581c18296e5e45a83686d0f22c4d85486d8aed204",
1034
+ "32280227cce363761a82b3aefeaa536cf7f5072a8226fac0e0aa0e48eb1da251",
1035
+ "ec00d9ecf1f2c3f783739599db9b373d7a3b465dc5d9490206c0141cc320fa8c",
1036
+ "17598e59d699132981de9410a5b6279e5c062d9e6cbd1de60160360f37a732eb",
1037
+ "af2925b4823d9e4e3c7c5211063a7cea15485dd203dbae6e680ccd24e8ef9f54"
1038
+ ],
1039
+ "total": 10000
1040
+ }
1041
+ ]
@@ -0,0 +1,79 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { readFile, writeFile } from 'node:fs/promises'
4
+
5
+ import { Account } from '@xyo-network/account'
6
+ import type {
7
+ NftCollectionInfo,
8
+ NftCollectionScore,
9
+ } from '@xyo-network/crypto-nft-collection-payload-plugin'
10
+ import {
11
+ isNftCollectionScore,
12
+ NftCollectionSchema,
13
+ } from '@xyo-network/crypto-nft-collection-payload-plugin'
14
+ import { PayloadWrapper } from '@xyo-network/payload-wrapper'
15
+ import {
16
+ beforeAll,
17
+ describe, expect, it, test,
18
+ } from 'vitest'
19
+
20
+ import { NftCollectionScoreDiviner } from '../Diviner.ts'
21
+
22
+ describe('NftCollectionScoreDiviner', () => {
23
+ const data: NftCollectionInfo[] = [
24
+ {
25
+ address: '0x0000000000',
26
+ chainId: 1,
27
+ metrics: { metadata: { attributes: {} } },
28
+ name: 'test',
29
+ schema: NftCollectionSchema,
30
+ symbol: 'TEST',
31
+ total: 20_000,
32
+ type: 'ERC721',
33
+ },
34
+ ]
35
+ let diviner: NftCollectionScoreDiviner
36
+ beforeAll(async () => {
37
+ const account = await Account.random()
38
+ diviner = await NftCollectionScoreDiviner.create({ account })
39
+ })
40
+ const cases: [address: string, chainId: number][] = [
41
+ ['0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB', 1],
42
+ ['0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', 1],
43
+ ['0x60E4d786628Fea6478F785A6d7e704777c86a7c6', 1],
44
+ ['0xED5AF388653567Af2F388E6224dC7C4b3241C544', 1],
45
+ ['0x059EDD72Cd353dF5106D2B9cC5ab83a52287aC3a', 1],
46
+ ]
47
+ it.skip.each(cases)('diviner calibration', async (address) => {
48
+ const json = await readFile(`./nftData/witness/${address}-witness.json`)
49
+ const data: NftCollectionInfo[] = JSON.parse(json.toString())
50
+ const results = await diviner.divine(data)
51
+ const scores = results.filter(isNftCollectionScore) as NftCollectionScore[]
52
+ for (const score of scores) {
53
+ const address = score.address
54
+ // eslint-disable-next-line unicorn/no-array-reduce
55
+ const total = Object.values(score.scores).reduce(
56
+ ([accValue, accTotal], [value, total]) => {
57
+ return [accValue + value, accTotal + total]
58
+ },
59
+ [0, 0],
60
+ )
61
+ const rating = total[0] / total[1]
62
+ console.log(`Address: ${address} Rating: ${rating}`)
63
+ await writeFile(`./nftData/diviner/${address}-diviner.json`, JSON.stringify(score, null, 2))
64
+ }
65
+ })
66
+ test('divine', async () => {
67
+ const scores = (await diviner.divine(data)).filter(isNftCollectionScore) as NftCollectionScore[]
68
+ expect(scores).toBeArrayOfSize(data.length)
69
+ for (const [i, score] of scores.entries()) {
70
+ const wrapped = PayloadWrapper.wrap<NftCollectionScore>(score)
71
+ expect(await wrapped.getValid()).toBe(true)
72
+ const payload = wrapped.payload
73
+ expect(payload?.sources).toBeArrayOfSize(1)
74
+ expect(payload?.sources?.[0]).toBeString()
75
+ const sourceHash = await PayloadWrapper.wrap(data[i]).dataHash()
76
+ expect(payload?.sources?.[0]).toBe(sourceHash)
77
+ }
78
+ })
79
+ })
@@ -0,0 +1,17 @@
1
+ import '@xylabs/vitest-extended'
2
+
3
+ import { PayloadSetPluginResolver } from '@xyo-network/payloadset-plugin'
4
+ import {
5
+ describe, expect,
6
+ test,
7
+ } from 'vitest'
8
+
9
+ import { NftCollectionScoreDivinerPlugin } from '../Plugin.ts'
10
+
11
+ describe('NftCollectionScoreDivinerPlugin', () => {
12
+ test('Add to Resolver', async () => {
13
+ const plugin = NftCollectionScoreDivinerPlugin()
14
+ const resolver = await new PayloadSetPluginResolver().register(plugin)
15
+ expect(resolver.resolve(plugin.set)).toBeDefined()
16
+ })
17
+ })
package/typedoc.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "https://typedoc.org/schema.json",
3
- "entryPoints": ["./src/index.ts"],
4
- "tsconfig": "./tsconfig.typedoc.json"
5
- }