@xyo-network/crypto-nft-collection-diviner-score-plugin 2.73.3 → 2.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Diviner.d.mts.map +1 -0
- package/dist/Diviner.d.ts +11 -0
- package/dist/Diviner.d.ts.map +1 -0
- package/dist/Plugin.d.mts +50 -0
- package/dist/Plugin.d.mts.map +1 -0
- package/dist/{types/Plugin.d.ts → Plugin.d.ts} +5 -5
- package/dist/Plugin.d.ts.map +1 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/{esm/index.js → index.d.ts} +1 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +173 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +148 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/index.d.mts.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/rating/analyzeNftCollection.d.mts.map +1 -0
- package/dist/lib/rating/analyzeNftCollection.d.ts +9 -0
- package/dist/lib/rating/analyzeNftCollection.d.ts.map +1 -0
- package/dist/lib/rating/criteria/index.d.mts.map +1 -0
- package/dist/lib/rating/criteria/index.d.ts +6 -0
- package/dist/lib/rating/criteria/index.d.ts.map +1 -0
- package/dist/lib/rating/criteria/scoring/index.d.mts.map +1 -0
- package/dist/{esm/lib/rating/criteria/scoring/index.js → lib/rating/criteria/scoring/index.d.ts} +1 -1
- package/dist/lib/rating/criteria/scoring/index.d.ts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/index.d.mts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/index.d.ts +2 -0
- package/dist/lib/rating/criteria/scoring/metadata/index.d.ts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/metadata.d.mts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/metadata.d.ts +9 -0
- package/dist/lib/rating/criteria/scoring/metadata/metadata.d.ts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.d.mts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.d.ts +4 -0
- package/dist/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.d.ts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.d.mts.map +1 -0
- package/dist/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.d.ts +24 -0
- package/dist/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.d.ts.map +1 -0
- package/dist/lib/rating/criteria/scoring/total.d.mts.map +1 -0
- package/dist/lib/rating/criteria/scoring/total.d.ts +16 -0
- package/dist/lib/rating/criteria/scoring/total.d.ts.map +1 -0
- package/dist/lib/rating/index.d.mts.map +1 -0
- package/dist/{esm/lib/rating/index.js → lib/rating/index.d.ts} +1 -1
- package/dist/lib/rating/index.d.ts.map +1 -0
- package/package.json +33 -26
- package/dist/cjs/Diviner.js +0 -35
- package/dist/cjs/Diviner.js.map +0 -1
- package/dist/cjs/Plugin.js +0 -16
- package/dist/cjs/Plugin.js.map +0 -1
- package/dist/cjs/index.js +0 -11
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/lib/index.js +0 -5
- package/dist/cjs/lib/index.js.map +0 -1
- package/dist/cjs/lib/rating/analyzeNftCollection.js +0 -19
- package/dist/cjs/lib/rating/analyzeNftCollection.js.map +0 -1
- package/dist/cjs/lib/rating/criteria/index.js +0 -6
- package/dist/cjs/lib/rating/criteria/index.js.map +0 -1
- package/dist/cjs/lib/rating/criteria/scoring/index.js +0 -6
- package/dist/cjs/lib/rating/criteria/scoring/index.js.map +0 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/index.js +0 -5
- package/dist/cjs/lib/rating/criteria/scoring/metadata/index.js.map +0 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/metadata.js +0 -11
- package/dist/cjs/lib/rating/criteria/scoring/metadata/metadata.js.map +0 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js +0 -23
- package/dist/cjs/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js.map +0 -1
- package/dist/cjs/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js +0 -63
- package/dist/cjs/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js.map +0 -1
- package/dist/cjs/lib/rating/criteria/scoring/total.js +0 -50
- package/dist/cjs/lib/rating/criteria/scoring/total.js.map +0 -1
- package/dist/cjs/lib/rating/index.js +0 -5
- package/dist/cjs/lib/rating/index.js.map +0 -1
- package/dist/docs.json +0 -22299
- package/dist/esm/Diviner.js +0 -26
- package/dist/esm/Diviner.js.map +0 -1
- package/dist/esm/Plugin.js +0 -11
- package/dist/esm/Plugin.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/index.js +0 -2
- package/dist/esm/lib/index.js.map +0 -1
- package/dist/esm/lib/rating/analyzeNftCollection.js +0 -14
- package/dist/esm/lib/rating/analyzeNftCollection.js.map +0 -1
- package/dist/esm/lib/rating/criteria/index.js +0 -6
- package/dist/esm/lib/rating/criteria/index.js.map +0 -1
- package/dist/esm/lib/rating/criteria/scoring/index.js.map +0 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/index.js +0 -2
- package/dist/esm/lib/rating/criteria/scoring/metadata/index.js.map +0 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/metadata.js +0 -10
- package/dist/esm/lib/rating/criteria/scoring/metadata/metadata.js.map +0 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js +0 -19
- package/dist/esm/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js.map +0 -1
- package/dist/esm/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js +0 -59
- package/dist/esm/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js.map +0 -1
- package/dist/esm/lib/rating/criteria/scoring/total.js +0 -46
- package/dist/esm/lib/rating/criteria/scoring/total.js.map +0 -1
- package/dist/esm/lib/rating/index.js.map +0 -1
- package/dist/types/Diviner.d.ts.map +0 -1
- package/dist/types/Plugin.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/index.d.ts.map +0 -1
- package/dist/types/lib/rating/analyzeNftCollection.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/index.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/index.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/index.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/metadata.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/total.d.ts.map +0 -1
- package/dist/types/lib/rating/index.d.ts.map +0 -1
- /package/dist/{types/Diviner.d.ts → Diviner.d.mts} +0 -0
- /package/dist/{types/index.d.ts → index.d.mts} +0 -0
- /package/dist/{types/lib/index.d.ts → lib/index.d.mts} +0 -0
- /package/dist/{types/lib/rating/analyzeNftCollection.d.ts → lib/rating/analyzeNftCollection.d.mts} +0 -0
- /package/dist/{types/lib/rating/criteria/index.d.ts → lib/rating/criteria/index.d.mts} +0 -0
- /package/dist/{types/lib/rating/criteria/scoring/index.d.ts → lib/rating/criteria/scoring/index.d.mts} +0 -0
- /package/dist/{types/lib/rating/criteria/scoring/metadata/index.d.ts → lib/rating/criteria/scoring/metadata/index.d.mts} +0 -0
- /package/dist/{types/lib/rating/criteria/scoring/metadata/metadata.d.ts → lib/rating/criteria/scoring/metadata/metadata.d.mts} +0 -0
- /package/dist/{types/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.d.ts → lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.d.mts} +0 -0
- /package/dist/{types/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.d.ts → lib/rating/criteria/scoring/metadata/scoreTotalAttributes.d.mts} +0 -0
- /package/dist/{types/lib/rating/criteria/scoring/total.d.ts → lib/rating/criteria/scoring/total.d.mts} +0 -0
- /package/dist/{types/lib/rating/index.d.ts → lib/rating/index.d.mts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoreIndividualAttributes.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAA;AACjG,OAAO,EAAa,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAItE,eAAO,MAAM,yBAAyB,SAAU,6BAA6B,KAAG,KAc/E,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoreTotalAttributes.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAA;AACjG,OAAO,EAAa,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAiCtE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,SAAU,6BAA6B,KAAG,KAU1E,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin';
|
|
2
|
+
import { Score } from '@xyo-network/crypto-nft-score-model';
|
|
3
|
+
/**
|
|
4
|
+
* We're working on some assumptions here:
|
|
5
|
+
*
|
|
6
|
+
* - If you have a 100% chance of getting a trait, everyone get's a trophy
|
|
7
|
+
* - If you have a 50% chance of getting a trait, it's not rare
|
|
8
|
+
* - If you have a 0% chance of getting a trait, it's not fun
|
|
9
|
+
*
|
|
10
|
+
* So we're looking for something Pareto-ish (somewhere between
|
|
11
|
+
* 80/20 or 90/10) as that's a good & sustainable model for the
|
|
12
|
+
* distribution of many traits in real life.
|
|
13
|
+
* However, we also don't want to maximally reward collections
|
|
14
|
+
* that have a lot of single attributes distributed uniformly
|
|
15
|
+
* (basically a 0% trait probably) as that's perfectly entropic
|
|
16
|
+
* but not very interesting (some overlap is desirable).
|
|
17
|
+
* So we're using a Gaussian distribution to model the
|
|
18
|
+
* probability density of the joint probability of all traits
|
|
19
|
+
* centered around 15%.
|
|
20
|
+
* @param info
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare const scoreTotalAttributes: (info: NftCollectionAttributeMetrics) => Score;
|
|
24
|
+
//# sourceMappingURL=scoreTotalAttributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoreTotalAttributes.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAA;AACjG,OAAO,EAAa,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAiCtE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,SAAU,6BAA6B,KAAG,KAU1E,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"total.d.ts","sourceRoot":"","sources":["../../../../../src/lib/rating/criteria/scoring/total.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAA;AACtF,OAAO,EAAa,KAAK,EAAE,MAAM,qCAAqC,CAAA;AA+BtE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,QAAS,kBAAkB,KAAG,KAIpD,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NftCollectionCount } from '@xyo-network/crypto-nft-collection-payload-plugin';
|
|
2
|
+
import { Score } from '@xyo-network/crypto-nft-score-model';
|
|
3
|
+
/**
|
|
4
|
+
* We're working on some assumptions here:
|
|
5
|
+
* - If there's < 1000 NFTs in your collection it starts becoming too niche
|
|
6
|
+
* - If there's > 20,000 NFTs in your collection it starts becoming too broad
|
|
7
|
+
* So there's a sweet spot somewhere between 2000 and 10,000
|
|
8
|
+
* where a collection has enough NFTs to be interesting, but
|
|
9
|
+
* not so many that it's teetering on a diluted money grab.
|
|
10
|
+
* To model that we're using a log-normal distribution optimized
|
|
11
|
+
* to maximally reward collections in the aforementioned range
|
|
12
|
+
* @param nft
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const scoreTotal: (nft: NftCollectionCount) => Score;
|
|
16
|
+
//# sourceMappingURL=total.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"total.d.ts","sourceRoot":"","sources":["../../../../../src/lib/rating/criteria/scoring/total.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAA;AACtF,OAAO,EAAa,KAAK,EAAE,MAAM,qCAAqC,CAAA;AA+BtE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,QAAS,kBAAkB,KAAG,KAIpD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/rating/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './analyzeNftCollection';
|
|
2
|
-
//# sourceMappingURL=index.
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/rating/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -10,46 +10,54 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xyo-network/abstract-diviner": "~2.
|
|
14
|
-
"@xyo-network/core": "~2.
|
|
15
|
-
"@xyo-network/crypto-nft-collection-payload-plugin": "~2.
|
|
16
|
-
"@xyo-network/crypto-nft-payload-plugin": "~2.
|
|
17
|
-
"@xyo-network/crypto-nft-score-model": "~2.
|
|
18
|
-
"@xyo-network/diviner-model": "~2.
|
|
19
|
-
"@xyo-network/module": "~2.
|
|
20
|
-
"@xyo-network/payload-model": "~2.
|
|
21
|
-
"@xyo-network/payloadset-plugin": "~2.
|
|
13
|
+
"@xyo-network/abstract-diviner": "~2.74.0",
|
|
14
|
+
"@xyo-network/core": "~2.74.0",
|
|
15
|
+
"@xyo-network/crypto-nft-collection-payload-plugin": "~2.74.0",
|
|
16
|
+
"@xyo-network/crypto-nft-payload-plugin": "~2.74.0",
|
|
17
|
+
"@xyo-network/crypto-nft-score-model": "~2.74.0",
|
|
18
|
+
"@xyo-network/diviner-model": "~2.74.0",
|
|
19
|
+
"@xyo-network/module": "~2.74.0",
|
|
20
|
+
"@xyo-network/payload-model": "~2.74.0",
|
|
21
|
+
"@xyo-network/payloadset-plugin": "~2.74.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@xylabs/jest-helpers": "^2.
|
|
25
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
26
|
-
"@xylabs/tsconfig": "^
|
|
24
|
+
"@xylabs/jest-helpers": "^2.11.5",
|
|
25
|
+
"@xylabs/ts-scripts-yarn3": "^3.0.27",
|
|
26
|
+
"@xylabs/tsconfig": "^3.0.27",
|
|
27
27
|
"ethers": "^5.7.2",
|
|
28
|
-
"jest": "^29.
|
|
28
|
+
"jest": "^29.7.0",
|
|
29
29
|
"typescript": "^5.2.2"
|
|
30
30
|
},
|
|
31
31
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
32
|
-
"browser": "dist/esm/index.js",
|
|
33
32
|
"docs": "dist/docs.json",
|
|
33
|
+
"types": "dist/index.d.ts",
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"default": "./dist/index.js"
|
|
39
39
|
},
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
}
|
|
44
|
-
"default": "./dist/esm/index.js"
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./dist/index.d.mts",
|
|
42
|
+
"default": "./dist/index.mjs"
|
|
43
|
+
}
|
|
45
44
|
},
|
|
46
45
|
"./dist/docs.json": {
|
|
47
46
|
"default": "./dist/docs.json"
|
|
48
47
|
},
|
|
48
|
+
"./cjs": {
|
|
49
|
+
"default": "./dist/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./docs": {
|
|
52
|
+
"default": "./dist/docs.json"
|
|
53
|
+
},
|
|
54
|
+
"./esm": {
|
|
55
|
+
"default": "./dist/index.mjs"
|
|
56
|
+
},
|
|
49
57
|
"./package.json": "./package.json"
|
|
50
58
|
},
|
|
51
|
-
"main": "dist/
|
|
52
|
-
"module": "dist/
|
|
59
|
+
"main": "dist/index.js",
|
|
60
|
+
"module": "dist/index.mjs",
|
|
53
61
|
"homepage": "https://xyo.network",
|
|
54
62
|
"license": "LGPL-3.0",
|
|
55
63
|
"publishConfig": {
|
|
@@ -60,6 +68,5 @@
|
|
|
60
68
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
61
69
|
},
|
|
62
70
|
"sideEffects": false,
|
|
63
|
-
"
|
|
64
|
-
"version": "2.73.3"
|
|
71
|
+
"version": "2.74.0"
|
|
65
72
|
}
|
package/dist/cjs/Diviner.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NftCollectionScoreDiviner = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const abstract_diviner_1 = require("@xyo-network/abstract-diviner");
|
|
6
|
-
const core_1 = require("@xyo-network/core");
|
|
7
|
-
const crypto_nft_collection_payload_plugin_1 = require("@xyo-network/crypto-nft-collection-payload-plugin");
|
|
8
|
-
const lib_1 = require("./lib");
|
|
9
|
-
const toNftCollectionScore = (nftCollectionInfo, scores) => {
|
|
10
|
-
const { name, symbol, address, chainId, type } = nftCollectionInfo;
|
|
11
|
-
const metadata = { address, chainId, name, symbol, type };
|
|
12
|
-
return Object.assign(Object.assign({}, metadata), { schema: crypto_nft_collection_payload_plugin_1.NftCollectionScoreSchema, scores });
|
|
13
|
-
};
|
|
14
|
-
class NftCollectionScoreDiviner extends abstract_diviner_1.AbstractDiviner {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.divineHandler = (payloads) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
var _a;
|
|
19
|
-
const nftCollectionInfos = (_a = payloads === null || payloads === void 0 ? void 0 : payloads.filter(crypto_nft_collection_payload_plugin_1.isNftCollectionInfo)) !== null && _a !== void 0 ? _a : [];
|
|
20
|
-
const results = yield Promise.all(nftCollectionInfos.map((nftCollectionInfo) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const [score, sourceHash] = yield Promise.all([
|
|
22
|
-
// Get score
|
|
23
|
-
toNftCollectionScore(nftCollectionInfo, yield (0, lib_1.analyzeNftCollection)(nftCollectionInfo)),
|
|
24
|
-
// Hash sources
|
|
25
|
-
core_1.PayloadHasher.hashAsync(nftCollectionInfo),
|
|
26
|
-
]);
|
|
27
|
-
return Object.assign(Object.assign({}, score), { schema: crypto_nft_collection_payload_plugin_1.NftCollectionScoreSchema, sources: [sourceHash] });
|
|
28
|
-
})));
|
|
29
|
-
return results;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.NftCollectionScoreDiviner = NftCollectionScoreDiviner;
|
|
34
|
-
NftCollectionScoreDiviner.configSchemas = [crypto_nft_collection_payload_plugin_1.NftCollectionScoreDivinerConfigSchema];
|
|
35
|
-
//# sourceMappingURL=Diviner.js.map
|
package/dist/cjs/Diviner.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.js","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":";;;;AAAA,oEAA+D;AAC/D,4CAAiD;AACjD,4GAQ0D;AAK1D,+BAAmE;AAInE,MAAM,oBAAoB,GAAG,CAAC,iBAAoC,EAAE,MAA6B,EAAsB,EAAE;IACvH,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAA;IAClE,MAAM,QAAQ,GAA0B,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;IAChF,uCAAY,QAAQ,KAAE,MAAM,EAAE,+DAAwB,EAAE,MAAM,IAAE;AAClE,CAAC,CAAA;AAED,MAAa,yBAEX,SAAQ,kCAAwB;IAFlC;;QAKqB,kBAAa,GAAG,CAAO,QAAoB,EAAsB,EAAE;;YACpF,MAAM,kBAAkB,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,0DAAmB,CAAC,mCAAI,EAAE,CAAA;YACtE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,kBAAkB,CAAC,GAAG,CAA8B,CAAO,iBAAiB,EAAE,EAAE;gBAC9E,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;oBAC5C,YAAY;oBACZ,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,IAAA,0BAAoB,EAAC,iBAAiB,CAAC,CAAC;oBACtF,eAAe;oBACf,oBAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC;iBAC3C,CAAC,CAAA;gBACF,OAAO,gCAAK,KAAK,KAAE,MAAM,EAAE,+DAAwB,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,GAAwB,CAAA;YACpG,CAAC,CAAA,CAAC,CACH,CAAA;YACD,OAAO,OAAO,CAAA;QAChB,CAAC,CAAA,CAAA;IACH,CAAC;;AApBD,8DAoBC;AAjBiB,uCAAa,GAAG,CAAC,4EAAqC,CAAC,AAA1C,CAA0C"}
|
package/dist/cjs/Plugin.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NftCollectionScoreDivinerPlugin = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const crypto_nft_payload_plugin_1 = require("@xyo-network/crypto-nft-payload-plugin");
|
|
6
|
-
const payload_model_1 = require("@xyo-network/payload-model");
|
|
7
|
-
const payloadset_plugin_1 = require("@xyo-network/payloadset-plugin");
|
|
8
|
-
const Diviner_1 = require("./Diviner");
|
|
9
|
-
const NftCollectionScoreDivinerPlugin = () => (0, payloadset_plugin_1.createPayloadSetDivinerPlugin)({ required: { [crypto_nft_payload_plugin_1.NftSchema]: 1 }, schema: payload_model_1.PayloadSetSchema }, {
|
|
10
|
-
diviner: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
const result = yield Diviner_1.NftCollectionScoreDiviner.create(params);
|
|
12
|
-
return result;
|
|
13
|
-
}),
|
|
14
|
-
});
|
|
15
|
-
exports.NftCollectionScoreDivinerPlugin = NftCollectionScoreDivinerPlugin;
|
|
16
|
-
//# sourceMappingURL=Plugin.js.map
|
package/dist/cjs/Plugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":";;;;AAAA,sFAAkE;AAClE,8DAA6D;AAC7D,sEAA8E;AAE9E,uCAAqD;AAE9C,MAAM,+BAA+B,GAAG,GAAG,EAAE,CAClD,IAAA,iDAA6B,EAC3B,EAAE,QAAQ,EAAE,EAAE,CAAC,qCAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,gCAAgB,EAAE,EAC1D;IACE,OAAO,EAAE,CAAO,MAAM,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,MAAM,mCAAyB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC7D,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;CACF,CACF,CAAA;AATU,QAAA,+BAA+B,mCASzC"}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NftCollectionScoreDivinerPlugin = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const Plugin_1 = require("./Plugin");
|
|
6
|
-
Object.defineProperty(exports, "NftCollectionScoreDivinerPlugin", { enumerable: true, get: function () { return Plugin_1.NftCollectionScoreDivinerPlugin; } });
|
|
7
|
-
tslib_1.__exportStar(require("./Diviner"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./lib"), exports);
|
|
9
|
-
// eslint-disable-next-line import/no-default-export
|
|
10
|
-
exports.default = Plugin_1.NftCollectionScoreDivinerPlugin;
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qCAA0D;AAKjD,gHALA,wCAA+B,OAKA;AAHxC,oDAAyB;AACzB,gDAAqB;AAIrB,oDAAoD;AACpD,kBAAe,wCAA+B,CAAA"}
|
package/dist/cjs/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwB"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.analyzeNftCollection = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const criteria_1 = require("./criteria");
|
|
6
|
-
const analyzeNftCollection = (
|
|
7
|
-
/**
|
|
8
|
-
* The NFT to evaluate
|
|
9
|
-
*/
|
|
10
|
-
nft) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
const result = Object.fromEntries(yield Promise.all(Object.entries(criteria_1.scoringCriteria).map(([key, { score, weight }]) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
-
const rawScore = yield score(nft);
|
|
13
|
-
const weighted = rawScore.map((v) => v * weight);
|
|
14
|
-
return [key, weighted];
|
|
15
|
-
}))));
|
|
16
|
-
return result;
|
|
17
|
-
});
|
|
18
|
-
exports.analyzeNftCollection = analyzeNftCollection;
|
|
19
|
-
//# sourceMappingURL=analyzeNftCollection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeNftCollection.js","sourceRoot":"","sources":["../../../../src/lib/rating/analyzeNftCollection.ts"],"names":[],"mappings":";;;;AAGA,yCAA4C;AAQrC,MAAM,oBAAoB,GAAG;AAClC;;GAEG;AACH,GAAsB,EACU,EAAE;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAC/B,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,0BAAe,CAAC,CAAC,GAAG,CAAC,CAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;QACrE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;QACjC,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAU,CAAA;QACzD,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAU,CAAA;IACjC,CAAC,CAAA,CAAC,CACH,CACuB,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA,CAAA;AAhBY,QAAA,oBAAoB,wBAgBhC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scoringCriteria = void 0;
|
|
4
|
-
const scoring_1 = require("./scoring");
|
|
5
|
-
exports.scoringCriteria = Object.assign(Object.assign({}, scoring_1.scoreMetadata), { Total: { score: scoring_1.scoreTotal, weight: 2 } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/rating/criteria/index.ts"],"names":[],"mappings":";;;AAGA,uCAAqD;AAExC,QAAA,eAAe,mCACvB,uBAAa,KAChB,KAAK,EAAE,EAAE,KAAK,EAAE,oBAAU,EAAE,MAAM,EAAE,CAAC,EAAE,IACxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/index.ts"],"names":[],"mappings":";;;AAAA,qDAA0B;AAC1B,kDAAuB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/index.ts"],"names":[],"mappings":";;;AAAA,qDAA0B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scoreMetadata = exports.attributeScoringCriteria = void 0;
|
|
4
|
-
const scoreIndividualAttributes_1 = require("./scoreIndividualAttributes");
|
|
5
|
-
const scoreTotalAttributes_1 = require("./scoreTotalAttributes");
|
|
6
|
-
exports.attributeScoringCriteria = {
|
|
7
|
-
'Metadata Attributes Individual': { score: scoreIndividualAttributes_1.scoreIndividualAttributes, weight: 2 },
|
|
8
|
-
'Metadata Attributes Total': { score: scoreTotalAttributes_1.scoreTotalAttributes, weight: 2 },
|
|
9
|
-
};
|
|
10
|
-
exports.scoreMetadata = Object.assign({}, exports.attributeScoringCriteria);
|
|
11
|
-
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/metadata.ts"],"names":[],"mappings":";;;AAGA,2EAAuE;AACvE,iEAA6D;AAEhD,QAAA,wBAAwB,GAAkE;IACrG,gCAAgC,EAAE,EAAE,KAAK,EAAE,qDAAyB,EAAE,MAAM,EAAE,CAAC,EAAE;IACjF,2BAA2B,EAAE,EAAE,KAAK,EAAE,2CAAoB,EAAE,MAAM,EAAE,CAAC,EAAE;CACxE,CAAA;AAEY,QAAA,aAAa,qBACrB,gCAAwB,EAC5B"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scoreIndividualAttributes = void 0;
|
|
4
|
-
const crypto_nft_score_model_1 = require("@xyo-network/crypto-nft-score-model");
|
|
5
|
-
const maxScore = 10;
|
|
6
|
-
const scoreIndividualAttributes = (info) => {
|
|
7
|
-
const { attributes } = info.metrics.metadata;
|
|
8
|
-
const entries = Object.entries(attributes);
|
|
9
|
-
if (entries.length === 0)
|
|
10
|
-
return [0, maxScore];
|
|
11
|
-
const scores = Object.entries(attributes)
|
|
12
|
-
.map(([_trait, { values }]) => {
|
|
13
|
-
return Object.entries(values).map(([_traitValue, metrics]) => {
|
|
14
|
-
const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
|
|
15
|
-
return [rarity, maxScore];
|
|
16
|
-
});
|
|
17
|
-
})
|
|
18
|
-
.flat();
|
|
19
|
-
const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
|
|
20
|
-
return (0, crypto_nft_score_model_1.normalize)(total, maxScore);
|
|
21
|
-
};
|
|
22
|
-
exports.scoreIndividualAttributes = scoreIndividualAttributes;
|
|
23
|
-
//# sourceMappingURL=scoreIndividualAttributes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreIndividualAttributes.js","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts"],"names":[],"mappings":";;;AACA,gFAAsE;AAEtE,MAAM,QAAQ,GAAG,EAAE,CAAA;AAEZ,MAAM,yBAAyB,GAAG,CAAC,IAAmC,EAAS,EAAE;IACtF,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAC1C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;SACtC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;QAC5B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAQ,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,EAAE;YAClE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAA;YAClF,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC;SACD,IAAI,EAAE,CAAA;IACT,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9E,OAAO,IAAA,kCAAS,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACnC,CAAC,CAAA;AAdY,QAAA,yBAAyB,6BAcrC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scoreTotalAttributes = void 0;
|
|
4
|
-
const crypto_nft_score_model_1 = require("@xyo-network/crypto-nft-score-model");
|
|
5
|
-
const maxScore = 10;
|
|
6
|
-
/**
|
|
7
|
-
* Mean: What value is the distribution centered around
|
|
8
|
-
*/
|
|
9
|
-
const defaultMu = 0.15;
|
|
10
|
-
/**
|
|
11
|
-
* Standard Deviation: How spread out is the distribution
|
|
12
|
-
*/
|
|
13
|
-
const defaultSigma = 0.1;
|
|
14
|
-
/**
|
|
15
|
-
* Calculates the Gaussian probability density
|
|
16
|
-
* @param x
|
|
17
|
-
* @param mu Mean
|
|
18
|
-
* @param sigma Standard Deviation
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
const gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
|
|
22
|
-
const sqrtTwoPi = Math.sqrt(2 * Math.PI);
|
|
23
|
-
const denominator = sigma * sqrtTwoPi;
|
|
24
|
-
const power = -0.5 * Math.pow((x - mu) / sigma, 2);
|
|
25
|
-
return (1 / denominator) * Math.exp(power);
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* For a Gaussian distribution, the peak of the distribution is the mean
|
|
29
|
-
*/
|
|
30
|
-
const maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
|
|
31
|
-
/**
|
|
32
|
-
* We're working on some assumptions here:
|
|
33
|
-
*
|
|
34
|
-
* - If you have a 100% chance of getting a trait, everyone get's a trophy
|
|
35
|
-
* - If you have a 50% chance of getting a trait, it's not rare
|
|
36
|
-
* - If you have a 0% chance of getting a trait, it's not fun
|
|
37
|
-
*
|
|
38
|
-
* So we're looking for something Pareto-ish (somewhere between
|
|
39
|
-
* 80/20 or 90/10) as that's a good & sustainable model for the
|
|
40
|
-
* distribution of many traits in real life.
|
|
41
|
-
* However, we also don't want to maximally reward collections
|
|
42
|
-
* that have a lot of single attributes distributed uniformly
|
|
43
|
-
* (basically a 0% trait probably) as that's perfectly entropic
|
|
44
|
-
* but not very interesting (some overlap is desirable).
|
|
45
|
-
* So we're using a Gaussian distribution to model the
|
|
46
|
-
* probability density of the joint probability of all traits
|
|
47
|
-
* centered around 15%.
|
|
48
|
-
* @param info
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
const scoreTotalAttributes = (info) => {
|
|
52
|
-
const { attributes } = info.metrics.metadata;
|
|
53
|
-
// This has somewhat of a filtering function by causing anything with 100% probability to
|
|
54
|
-
// add no value to the end score
|
|
55
|
-
const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
|
|
56
|
-
return acc * metrics.binomial.p;
|
|
57
|
-
}, 1);
|
|
58
|
-
const probabilityDensity = gaussianProbabilityDensity(jointProbability);
|
|
59
|
-
const score = [probabilityDensity, maxProbabilityDensity];
|
|
60
|
-
return (0, crypto_nft_score_model_1.normalize)(score, maxScore);
|
|
61
|
-
};
|
|
62
|
-
exports.scoreTotalAttributes = scoreTotalAttributes;
|
|
63
|
-
//# sourceMappingURL=scoreTotalAttributes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoreTotalAttributes.js","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts"],"names":[],"mappings":";;;AACA,gFAAsE;AAEtE,MAAM,QAAQ,GAAG,EAAE,CAAA;AAEnB;;GAEG;AACH,MAAM,SAAS,GAAG,IAAI,CAAA;AAEtB;;GAEG;AACH,MAAM,YAAY,GAAG,GAAG,CAAA;AAExB;;;;;;GAMG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAS,EAAE,KAAa,SAAS,EAAE,QAAgB,YAAY,EAAU,EAAE;IAC7G,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;IACxC,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,CAAA;IACrC,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAA;IAClD,OAAO,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,qBAAqB,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,oBAAoB,GAAG,CAAC,IAAmC,EAAS,EAAE;IACjF,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IAC5C,yFAAyF;IACzF,gCAAgC;IAChC,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;QACxF,OAAO,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;IACjC,CAAC,EAAE,CAAC,CAAC,CAAA;IACL,MAAM,kBAAkB,GAAG,0BAA0B,CAAC,gBAAgB,CAAC,CAAA;IACvE,MAAM,KAAK,GAAU,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAA;IAChE,OAAO,IAAA,kCAAS,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACnC,CAAC,CAAA;AAVY,QAAA,oBAAoB,wBAUhC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scoreTotal = void 0;
|
|
4
|
-
const crypto_nft_score_model_1 = require("@xyo-network/crypto-nft-score-model");
|
|
5
|
-
/**
|
|
6
|
-
* This "magic" value was obtained using Solver in Excel
|
|
7
|
-
* to find the median, with mu/sigma fixed, which maximizes
|
|
8
|
-
* the distribution (the mode for lognormal) at 10,000
|
|
9
|
-
*/
|
|
10
|
-
const median = 81030839.8217352;
|
|
11
|
-
const defaultMu = Math.log(median);
|
|
12
|
-
const defaultSigma = 3;
|
|
13
|
-
const mode = Math.exp(defaultMu - Math.pow(defaultSigma, 2));
|
|
14
|
-
/**
|
|
15
|
-
* Calculates the log-normal probability density
|
|
16
|
-
* @param x the value at which you want to calculate the probability density
|
|
17
|
-
* @param mu mean of the associated normal distribution
|
|
18
|
-
* @param sigma standard deviation of the associated normal distribution
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
const logNormalProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
|
|
22
|
-
if (x <= 0)
|
|
23
|
-
return 0;
|
|
24
|
-
const logX = Math.log(x);
|
|
25
|
-
return (1 / (x * sigma * Math.sqrt(2 * Math.PI))) * Math.exp(-0.5 * Math.pow((logX - mu) / sigma, 2));
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* For a lognormal distribution, the peak of the distribution is the mode
|
|
29
|
-
*/
|
|
30
|
-
const maxProbabilityDensity = logNormalProbabilityDensity(mode);
|
|
31
|
-
const maxScore = 10;
|
|
32
|
-
/**
|
|
33
|
-
* We're working on some assumptions here:
|
|
34
|
-
* - If there's < 1000 NFTs in your collection it starts becoming too niche
|
|
35
|
-
* - If there's > 20,000 NFTs in your collection it starts becoming too broad
|
|
36
|
-
* So there's a sweet spot somewhere between 2000 and 10,000
|
|
37
|
-
* where a collection has enough NFTs to be interesting, but
|
|
38
|
-
* not so many that it's teetering on a diluted money grab.
|
|
39
|
-
* To model that we're using a log-normal distribution optimized
|
|
40
|
-
* to maximally reward collections in the aforementioned range
|
|
41
|
-
* @param nft
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
const scoreTotal = (nft) => {
|
|
45
|
-
const density = logNormalProbabilityDensity(nft.total);
|
|
46
|
-
const score = [density, maxProbabilityDensity];
|
|
47
|
-
return (0, crypto_nft_score_model_1.normalize)(score, maxScore);
|
|
48
|
-
};
|
|
49
|
-
exports.scoreTotal = scoreTotal;
|
|
50
|
-
//# sourceMappingURL=total.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"total.js","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/total.ts"],"names":[],"mappings":";;;AACA,gFAAsE;AAEtE;;;;GAIG;AACH,MAAM,MAAM,GAAG,gBAAgB,CAAA;AAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAClC,MAAM,YAAY,GAAG,CAAC,CAAA;AACtB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAA;AAC5D;;;;;;GAMG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAS,EAAE,KAAa,SAAS,EAAE,QAAgB,YAAY,EAAU,EAAE;IAC9G,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IACpB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACxB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;AACvG,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,qBAAqB,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAA;AAE/D,MAAM,QAAQ,GAAG,EAAE,CAAA;AAEnB;;;;;;;;;;;GAWG;AACI,MAAM,UAAU,GAAG,CAAC,GAAuB,EAAS,EAAE;IAC3D,MAAM,OAAO,GAAG,2BAA2B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACtD,MAAM,KAAK,GAAU,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAA;IACrD,OAAO,IAAA,kCAAS,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACnC,CAAC,CAAA;AAJY,QAAA,UAAU,cAItB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/rating/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC"}
|