@xyo-network/crypto-nft-collection-diviner-score-plugin 5.1.3 → 5.1.4
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 +19 -16
- package/dist/browser/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.d.ts +0 -2
- package/dist/browser/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.d.ts.map +0 -1
- package/dist/browser/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts +0 -2
- package/dist/browser/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts.map +0 -1
- package/dist/browser/lib/rating/criteria/scoring/spec/total.spec.d.ts +0 -2
- package/dist/browser/lib/rating/criteria/scoring/spec/total.spec.d.ts.map +0 -1
- package/dist/browser/lib/rating/spec/analyzeNftCollection.spec.d.ts +0 -2
- package/dist/browser/lib/rating/spec/analyzeNftCollection.spec.d.ts.map +0 -1
- package/dist/browser/spec/Diviner.spec.d.ts +0 -2
- package/dist/browser/spec/Diviner.spec.d.ts.map +0 -1
- package/dist/browser/spec/Plugin.spec.d.ts +0 -2
- package/dist/browser/spec/Plugin.spec.d.ts.map +0 -1
- package/dist/neutral/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.d.ts +0 -2
- package/dist/neutral/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.d.ts.map +0 -1
- package/dist/neutral/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts +0 -2
- package/dist/neutral/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts.map +0 -1
- package/dist/neutral/lib/rating/criteria/scoring/spec/total.spec.d.ts +0 -2
- package/dist/neutral/lib/rating/criteria/scoring/spec/total.spec.d.ts.map +0 -1
- package/dist/neutral/lib/rating/spec/analyzeNftCollection.spec.d.ts +0 -2
- package/dist/neutral/lib/rating/spec/analyzeNftCollection.spec.d.ts.map +0 -1
- package/dist/neutral/spec/Diviner.spec.d.ts +0 -2
- package/dist/neutral/spec/Diviner.spec.d.ts.map +0 -1
- package/dist/neutral/spec/Plugin.spec.d.ts +0 -2
- package/dist/neutral/spec/Plugin.spec.d.ts.map +0 -1
- package/dist/node/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.d.ts +0 -2
- package/dist/node/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.d.ts.map +0 -1
- package/dist/node/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts +0 -2
- package/dist/node/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts.map +0 -1
- package/dist/node/lib/rating/criteria/scoring/spec/total.spec.d.ts +0 -2
- package/dist/node/lib/rating/criteria/scoring/spec/total.spec.d.ts.map +0 -1
- package/dist/node/lib/rating/spec/analyzeNftCollection.spec.d.ts +0 -2
- package/dist/node/lib/rating/spec/analyzeNftCollection.spec.d.ts.map +0 -1
- package/dist/node/spec/Diviner.spec.d.ts +0 -2
- package/dist/node/spec/Diviner.spec.d.ts.map +0 -1
- package/dist/node/spec/Plugin.spec.d.ts +0 -2
- package/dist/node/spec/Plugin.spec.d.ts.map +0 -1
- package/src/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.ts +0 -32
- package/src/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.ts +0 -32
- package/src/lib/rating/criteria/scoring/spec/total.spec.ts +0 -42
- package/src/lib/rating/spec/analyzeNftCollection.spec.ts +0 -38
- package/src/spec/Diviner.spec.ts +0 -79
- package/src/spec/Plugin.spec.ts +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/crypto-nft-collection-diviner-score-plugin",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,25 +30,28 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"src"
|
|
33
|
+
"src",
|
|
34
|
+
"!**/*.bench.*",
|
|
35
|
+
"!**/*.spec.*",
|
|
36
|
+
"!**/*.test.*"
|
|
34
37
|
],
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"@xyo-network/crypto-nft-collection-payload-plugin": "~5.1.
|
|
37
|
-
"@xyo-network/crypto-nft-payload-plugin": "~5.1.
|
|
38
|
-
"@xyo-network/crypto-nft-score-model": "~5.1.
|
|
39
|
-
"@xyo-network/diviner-abstract": "~5.1.
|
|
40
|
-
"@xyo-network/diviner-model": "~5.1.
|
|
41
|
-
"@xyo-network/module-model": "~5.1.
|
|
42
|
-
"@xyo-network/payload-builder": "~5.1.
|
|
43
|
-
"@xyo-network/payload-model": "~5.1.
|
|
44
|
-
"@xyo-network/payloadset-plugin": "~5.1.
|
|
39
|
+
"@xyo-network/crypto-nft-collection-payload-plugin": "~5.1.4",
|
|
40
|
+
"@xyo-network/crypto-nft-payload-plugin": "~5.1.4",
|
|
41
|
+
"@xyo-network/crypto-nft-score-model": "~5.1.4",
|
|
42
|
+
"@xyo-network/diviner-abstract": "~5.1.23",
|
|
43
|
+
"@xyo-network/diviner-model": "~5.1.23",
|
|
44
|
+
"@xyo-network/module-model": "~5.1.23",
|
|
45
|
+
"@xyo-network/payload-builder": "~5.1.23",
|
|
46
|
+
"@xyo-network/payload-model": "~5.1.23",
|
|
47
|
+
"@xyo-network/payloadset-plugin": "~5.1.23"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
|
-
"@xylabs/ts-scripts-yarn3": "~7.
|
|
48
|
-
"@xylabs/tsconfig": "~7.
|
|
49
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
50
|
-
"@xyo-network/account": "~5.1.
|
|
51
|
-
"@xyo-network/payload-wrapper": "~5.1.
|
|
50
|
+
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
51
|
+
"@xylabs/tsconfig": "~7.2.8",
|
|
52
|
+
"@xylabs/vitest-extended": "~5.0.33",
|
|
53
|
+
"@xyo-network/account": "~5.1.23",
|
|
54
|
+
"@xyo-network/payload-wrapper": "~5.1.23",
|
|
52
55
|
"ethers": "~6.15.0",
|
|
53
56
|
"typescript": "~5.9.2",
|
|
54
57
|
"vitest": "~3.2.4"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreIndividualAttributes.spec.d.ts","sourceRoot":"","sources":["../../../../../../../../src/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
package/dist/browser/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreTotalAttributes.spec.d.ts","sourceRoot":"","sources":["../../../../../../../../src/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"total.spec.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/spec/total.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeNftCollection.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/rating/spec/analyzeNftCollection.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Diviner.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Plugin.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreIndividualAttributes.spec.d.ts","sourceRoot":"","sources":["../../../../../../../../src/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
package/dist/neutral/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreTotalAttributes.spec.d.ts","sourceRoot":"","sources":["../../../../../../../../src/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"total.spec.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/spec/total.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeNftCollection.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/rating/spec/analyzeNftCollection.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Diviner.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Plugin.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
package/dist/node/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreIndividualAttributes.spec.d.ts","sourceRoot":"","sources":["../../../../../../../../src/lib/rating/criteria/scoring/metadata/spec/scoreIndividualAttributes.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
package/dist/node/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreTotalAttributes.spec.d.ts","sourceRoot":"","sources":["../../../../../../../../src/lib/rating/criteria/scoring/metadata/spec/scoreTotalAttributes.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"total.spec.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/spec/total.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeNftCollection.spec.d.ts","sourceRoot":"","sources":["../../../../../src/lib/rating/spec/analyzeNftCollection.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Diviner.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Plugin.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
})
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
})
|
package/src/spec/Diviner.spec.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
})
|
package/src/spec/Plugin.spec.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
})
|