@xyo-network/crypto-nft-collection-diviner-score-plugin 2.73.2 → 2.73.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/dist/docs.json +44 -44
- package/dist/index.d.mts +79 -0
- package/dist/index.d.ts +79 -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/package.json +38 -25
- package/tsup.config.ts +16 -0
- 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/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 +0 -7
- 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 +0 -3
- 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 +0 -2
- package/dist/esm/lib/rating/index.js.map +0 -1
- package/dist/types/Diviner.d.ts +0 -11
- package/dist/types/Diviner.d.ts.map +0 -1
- package/dist/types/Plugin.d.ts +0 -50
- package/dist/types/Plugin.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/index.d.ts +0 -2
- package/dist/types/lib/index.d.ts.map +0 -1
- package/dist/types/lib/rating/analyzeNftCollection.d.ts +0 -9
- package/dist/types/lib/rating/analyzeNftCollection.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/index.d.ts +0 -6
- package/dist/types/lib/rating/criteria/index.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/index.d.ts +0 -3
- package/dist/types/lib/rating/criteria/scoring/index.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/metadata/index.d.ts +0 -2
- 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 +0 -9
- 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 +0 -4
- 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 +0 -24
- package/dist/types/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.d.ts.map +0 -1
- package/dist/types/lib/rating/criteria/scoring/total.d.ts +0 -16
- package/dist/types/lib/rating/criteria/scoring/total.d.ts.map +0 -1
- package/dist/types/lib/rating/index.d.ts +0 -2
- package/dist/types/lib/rating/index.d.ts.map +0 -1
|
@@ -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":["../../../../../../../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AA0B,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"}
|
package/dist/esm/Diviner.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AbstractDiviner } from '@xyo-network/abstract-diviner';
|
|
2
|
-
import { PayloadHasher } from '@xyo-network/core';
|
|
3
|
-
import { isNftCollectionInfo, NftCollectionScoreDivinerConfigSchema, NftCollectionScoreSchema, } from '@xyo-network/crypto-nft-collection-payload-plugin';
|
|
4
|
-
import { analyzeNftCollection } from './lib';
|
|
5
|
-
const toNftCollectionScore = (nftCollectionInfo, scores) => {
|
|
6
|
-
const { name, symbol, address, chainId, type } = nftCollectionInfo;
|
|
7
|
-
const metadata = { address, chainId, name, symbol, type };
|
|
8
|
-
return { ...metadata, schema: NftCollectionScoreSchema, scores };
|
|
9
|
-
};
|
|
10
|
-
export class NftCollectionScoreDiviner extends AbstractDiviner {
|
|
11
|
-
static configSchemas = [NftCollectionScoreDivinerConfigSchema];
|
|
12
|
-
divineHandler = async (payloads) => {
|
|
13
|
-
const nftCollectionInfos = payloads?.filter(isNftCollectionInfo) ?? [];
|
|
14
|
-
const results = await Promise.all(nftCollectionInfos.map(async (nftCollectionInfo) => {
|
|
15
|
-
const [score, sourceHash] = await Promise.all([
|
|
16
|
-
// Get score
|
|
17
|
-
toNftCollectionScore(nftCollectionInfo, await analyzeNftCollection(nftCollectionInfo)),
|
|
18
|
-
// Hash sources
|
|
19
|
-
PayloadHasher.hashAsync(nftCollectionInfo),
|
|
20
|
-
]);
|
|
21
|
-
return { ...score, schema: NftCollectionScoreSchema, sources: [sourceHash] };
|
|
22
|
-
}));
|
|
23
|
-
return results;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=Diviner.js.map
|
package/dist/esm/Diviner.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.js","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EACL,mBAAmB,EAKnB,qCAAqC,EACrC,wBAAwB,GACzB,MAAM,mDAAmD,CAAA;AAK1D,OAAO,EAAE,oBAAoB,EAAyB,MAAM,OAAO,CAAA;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,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,OAAO,yBAEX,SAAQ,eAAwB;IAChC,MAAM,CAAU,aAAa,GAAG,CAAC,qCAAqC,CAAC,CAAA;IAEpD,aAAa,GAAG,KAAK,EAAE,QAAoB,EAAsB,EAAE;QACpF,MAAM,kBAAkB,GAAG,QAAQ,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAA;QACtE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,kBAAkB,CAAC,GAAG,CAA8B,KAAK,EAAE,iBAAiB,EAAE,EAAE;YAC9E,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAC5C,YAAY;gBACZ,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;gBACtF,eAAe;gBACf,aAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC;aAC3C,CAAC,CAAA;YACF,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,wBAAwB,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,EAAwB,CAAA;QACpG,CAAC,CAAC,CACH,CAAA;QACD,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA"}
|
package/dist/esm/Plugin.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NftSchema } from '@xyo-network/crypto-nft-payload-plugin';
|
|
2
|
-
import { PayloadSetSchema } from '@xyo-network/payload-model';
|
|
3
|
-
import { createPayloadSetDivinerPlugin } from '@xyo-network/payloadset-plugin';
|
|
4
|
-
import { NftCollectionScoreDiviner } from './Diviner';
|
|
5
|
-
export const NftCollectionScoreDivinerPlugin = () => createPayloadSetDivinerPlugin({ required: { [NftSchema]: 1 }, schema: PayloadSetSchema }, {
|
|
6
|
-
diviner: async (params) => {
|
|
7
|
-
const result = await NftCollectionScoreDiviner.create(params);
|
|
8
|
-
return result;
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=Plugin.js.map
|
package/dist/esm/Plugin.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAA;AAE9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAErD,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE,CAClD,6BAA6B,CAC3B,EAAE,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAC1D;IACE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC7D,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CACF,CAAA"}
|
package/dist/esm/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NftCollectionScoreDivinerPlugin } from './Plugin';
|
|
2
|
-
export * from './Diviner';
|
|
3
|
-
export * from './lib';
|
|
4
|
-
export { NftCollectionScoreDivinerPlugin };
|
|
5
|
-
// eslint-disable-next-line import/no-default-export
|
|
6
|
-
export default NftCollectionScoreDivinerPlugin;
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAA;AAE1D,cAAc,WAAW,CAAA;AACzB,cAAc,OAAO,CAAA;AAErB,OAAO,EAAE,+BAA+B,EAAE,CAAA;AAE1C,oDAAoD;AACpD,eAAe,+BAA+B,CAAA"}
|
package/dist/esm/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { scoringCriteria } from './criteria';
|
|
2
|
-
export const analyzeNftCollection = async (
|
|
3
|
-
/**
|
|
4
|
-
* The NFT to evaluate
|
|
5
|
-
*/
|
|
6
|
-
nft) => {
|
|
7
|
-
const result = Object.fromEntries(await Promise.all(Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {
|
|
8
|
-
const rawScore = await score(nft);
|
|
9
|
-
const weighted = rawScore.map((v) => v * weight);
|
|
10
|
-
return [key, weighted];
|
|
11
|
-
})));
|
|
12
|
-
return result;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=analyzeNftCollection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeNftCollection.js","sourceRoot":"","sources":["../../../../src/lib/rating/analyzeNftCollection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAQ5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK;AACvC;;GAEG;AACH,GAAsB,EACU,EAAE;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAC/B,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,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,CAAC,CACH,CACuB,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/rating/criteria/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAErD,MAAM,CAAC,MAAM,eAAe,GAAkE;IAC5F,GAAG,aAAa;IAChB,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE;CACxC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { scoreIndividualAttributes } from './scoreIndividualAttributes';
|
|
2
|
-
import { scoreTotalAttributes } from './scoreTotalAttributes';
|
|
3
|
-
export const attributeScoringCriteria = {
|
|
4
|
-
'Metadata Attributes Individual': { score: scoreIndividualAttributes, weight: 2 },
|
|
5
|
-
'Metadata Attributes Total': { score: scoreTotalAttributes, weight: 2 },
|
|
6
|
-
};
|
|
7
|
-
export const scoreMetadata = {
|
|
8
|
-
...attributeScoringCriteria,
|
|
9
|
-
};
|
|
10
|
-
//# 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,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,CAAC,MAAM,wBAAwB,GAAkE;IACrG,gCAAgC,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,CAAC,EAAE;IACjF,2BAA2B,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,CAAC,EAAE;CACxE,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAkE;IAC1F,GAAG,wBAAwB;CAC5B,CAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { normalize } from '@xyo-network/crypto-nft-score-model';
|
|
2
|
-
const maxScore = 10;
|
|
3
|
-
export const scoreIndividualAttributes = (info) => {
|
|
4
|
-
const { attributes } = info.metrics.metadata;
|
|
5
|
-
const entries = Object.entries(attributes);
|
|
6
|
-
if (entries.length === 0)
|
|
7
|
-
return [0, maxScore];
|
|
8
|
-
const scores = Object.entries(attributes)
|
|
9
|
-
.map(([_trait, { values }]) => {
|
|
10
|
-
return Object.entries(values).map(([_traitValue, metrics]) => {
|
|
11
|
-
const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
|
|
12
|
-
return [rarity, maxScore];
|
|
13
|
-
});
|
|
14
|
-
})
|
|
15
|
-
.flat();
|
|
16
|
-
const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
|
|
17
|
-
return normalize(total, maxScore);
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=scoreIndividualAttributes.js.map
|
|
@@ -1 +0,0 @@
|
|
|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C,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9E,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACnC,CAAC,CAAA"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { normalize } from '@xyo-network/crypto-nft-score-model';
|
|
2
|
-
const maxScore = 10;
|
|
3
|
-
/**
|
|
4
|
-
* Mean: What value is the distribution centered around
|
|
5
|
-
*/
|
|
6
|
-
const defaultMu = 0.15;
|
|
7
|
-
/**
|
|
8
|
-
* Standard Deviation: How spread out is the distribution
|
|
9
|
-
*/
|
|
10
|
-
const defaultSigma = 0.1;
|
|
11
|
-
/**
|
|
12
|
-
* Calculates the Gaussian probability density
|
|
13
|
-
* @param x
|
|
14
|
-
* @param mu Mean
|
|
15
|
-
* @param sigma Standard Deviation
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
const gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
|
|
19
|
-
const sqrtTwoPi = Math.sqrt(2 * Math.PI);
|
|
20
|
-
const denominator = sigma * sqrtTwoPi;
|
|
21
|
-
const power = -0.5 * Math.pow((x - mu) / sigma, 2);
|
|
22
|
-
return (1 / denominator) * Math.exp(power);
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* For a Gaussian distribution, the peak of the distribution is the mean
|
|
26
|
-
*/
|
|
27
|
-
const maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
|
|
28
|
-
/**
|
|
29
|
-
* We're working on some assumptions here:
|
|
30
|
-
*
|
|
31
|
-
* - If you have a 100% chance of getting a trait, everyone get's a trophy
|
|
32
|
-
* - If you have a 50% chance of getting a trait, it's not rare
|
|
33
|
-
* - If you have a 0% chance of getting a trait, it's not fun
|
|
34
|
-
*
|
|
35
|
-
* So we're looking for something Pareto-ish (somewhere between
|
|
36
|
-
* 80/20 or 90/10) as that's a good & sustainable model for the
|
|
37
|
-
* distribution of many traits in real life.
|
|
38
|
-
* However, we also don't want to maximally reward collections
|
|
39
|
-
* that have a lot of single attributes distributed uniformly
|
|
40
|
-
* (basically a 0% trait probably) as that's perfectly entropic
|
|
41
|
-
* but not very interesting (some overlap is desirable).
|
|
42
|
-
* So we're using a Gaussian distribution to model the
|
|
43
|
-
* probability density of the joint probability of all traits
|
|
44
|
-
* centered around 15%.
|
|
45
|
-
* @param info
|
|
46
|
-
* @returns
|
|
47
|
-
*/
|
|
48
|
-
export const scoreTotalAttributes = (info) => {
|
|
49
|
-
const { attributes } = info.metrics.metadata;
|
|
50
|
-
// This has somewhat of a filtering function by causing anything with 100% probability to
|
|
51
|
-
// add no value to the end score
|
|
52
|
-
const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
|
|
53
|
-
return acc * metrics.binomial.p;
|
|
54
|
-
}, 1);
|
|
55
|
-
const probabilityDensity = gaussianProbabilityDensity(jointProbability);
|
|
56
|
-
const score = [probabilityDensity, maxProbabilityDensity];
|
|
57
|
-
return normalize(score, maxScore);
|
|
58
|
-
};
|
|
59
|
-
//# 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,OAAO,EAAE,SAAS,EAAS,MAAM,qCAAqC,CAAA;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;AACH,MAAM,CAAC,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,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACnC,CAAC,CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { normalize } from '@xyo-network/crypto-nft-score-model';
|
|
2
|
-
/**
|
|
3
|
-
* This "magic" value was obtained using Solver in Excel
|
|
4
|
-
* to find the median, with mu/sigma fixed, which maximizes
|
|
5
|
-
* the distribution (the mode for lognormal) at 10,000
|
|
6
|
-
*/
|
|
7
|
-
const median = 81030839.8217352;
|
|
8
|
-
const defaultMu = Math.log(median);
|
|
9
|
-
const defaultSigma = 3;
|
|
10
|
-
const mode = Math.exp(defaultMu - Math.pow(defaultSigma, 2));
|
|
11
|
-
/**
|
|
12
|
-
* Calculates the log-normal probability density
|
|
13
|
-
* @param x the value at which you want to calculate the probability density
|
|
14
|
-
* @param mu mean of the associated normal distribution
|
|
15
|
-
* @param sigma standard deviation of the associated normal distribution
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
const logNormalProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
|
|
19
|
-
if (x <= 0)
|
|
20
|
-
return 0;
|
|
21
|
-
const logX = Math.log(x);
|
|
22
|
-
return (1 / (x * sigma * Math.sqrt(2 * Math.PI))) * Math.exp(-0.5 * Math.pow((logX - mu) / sigma, 2));
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* For a lognormal distribution, the peak of the distribution is the mode
|
|
26
|
-
*/
|
|
27
|
-
const maxProbabilityDensity = logNormalProbabilityDensity(mode);
|
|
28
|
-
const maxScore = 10;
|
|
29
|
-
/**
|
|
30
|
-
* We're working on some assumptions here:
|
|
31
|
-
* - If there's < 1000 NFTs in your collection it starts becoming too niche
|
|
32
|
-
* - If there's > 20,000 NFTs in your collection it starts becoming too broad
|
|
33
|
-
* So there's a sweet spot somewhere between 2000 and 10,000
|
|
34
|
-
* where a collection has enough NFTs to be interesting, but
|
|
35
|
-
* not so many that it's teetering on a diluted money grab.
|
|
36
|
-
* To model that we're using a log-normal distribution optimized
|
|
37
|
-
* to maximally reward collections in the aforementioned range
|
|
38
|
-
* @param nft
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
export const scoreTotal = (nft) => {
|
|
42
|
-
const density = logNormalProbabilityDensity(nft.total);
|
|
43
|
-
const score = [density, maxProbabilityDensity];
|
|
44
|
-
return normalize(score, maxScore);
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=total.js.map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tD,MAAM,KAAK,GAAU,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAA;IACrD,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AACnC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/rating/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
package/dist/types/Diviner.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AbstractDiviner } from '@xyo-network/abstract-diviner';
|
|
2
|
-
import { NftCollectionScoreDivinerConfig } from '@xyo-network/crypto-nft-collection-payload-plugin';
|
|
3
|
-
import { DivinerParams } from '@xyo-network/diviner-model';
|
|
4
|
-
import { AnyConfigSchema } from '@xyo-network/module';
|
|
5
|
-
import { Payload } from '@xyo-network/payload-model';
|
|
6
|
-
export type NftCollectionScoreDivinerParams = DivinerParams<AnyConfigSchema<NftCollectionScoreDivinerConfig>>;
|
|
7
|
-
export declare class NftCollectionScoreDiviner<TParams extends NftCollectionScoreDivinerParams = NftCollectionScoreDivinerParams> extends AbstractDiviner<TParams> {
|
|
8
|
-
static configSchemas: "network.xyo.crypto.nft.collection.score.diviner.config"[];
|
|
9
|
-
protected divineHandler: (payloads?: Payload[]) => Promise<Payload[]>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=Diviner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAKL,+BAA+B,EAGhC,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAIpD,MAAM,MAAM,+BAA+B,GAAG,aAAa,CAAC,eAAe,CAAC,+BAA+B,CAAC,CAAC,CAAA;AAQ7G,qBAAa,yBAAyB,CACpC,OAAO,SAAS,+BAA+B,GAAG,+BAA+B,CACjF,SAAQ,eAAe,CAAC,OAAO,CAAC;IAChC,OAAgB,aAAa,6DAA0C;IAEvE,UAAmB,aAAa,cAAqB,OAAO,EAAE,KAAG,QAAQ,OAAO,EAAE,CAAC,CAclF;CACF"}
|
package/dist/types/Plugin.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { NftCollectionScoreDiviner } from './Diviner';
|
|
2
|
-
export declare const NftCollectionScoreDivinerPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetDivinerPlugin<NftCollectionScoreDiviner<import("@xyo-network/core").BaseParamsFields & {
|
|
3
|
-
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
4
|
-
config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
5
|
-
accountDerivationPath?: string | undefined;
|
|
6
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
7
|
-
readonly name?: string | undefined;
|
|
8
|
-
readonly paging?: Record<string, {
|
|
9
|
-
size?: number | undefined;
|
|
10
|
-
}> | undefined;
|
|
11
|
-
readonly schema: string;
|
|
12
|
-
readonly security?: {
|
|
13
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
14
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
15
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
16
|
-
} | undefined;
|
|
17
|
-
readonly sign?: boolean | undefined;
|
|
18
|
-
readonly storeQueries?: boolean | undefined;
|
|
19
|
-
readonly timestamp?: boolean | undefined;
|
|
20
|
-
} & Omit<Omit<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
21
|
-
accountDerivationPath?: string | undefined;
|
|
22
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
23
|
-
readonly name?: string | undefined;
|
|
24
|
-
readonly paging?: Record<string, {
|
|
25
|
-
size?: number | undefined;
|
|
26
|
-
}> | undefined;
|
|
27
|
-
readonly schema: "network.xyo.crypto.nft.collection.score.diviner.config";
|
|
28
|
-
readonly security?: {
|
|
29
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
30
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
31
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
32
|
-
} | undefined;
|
|
33
|
-
readonly sign?: boolean | undefined;
|
|
34
|
-
readonly storeQueries?: boolean | undefined;
|
|
35
|
-
readonly timestamp?: boolean | undefined;
|
|
36
|
-
} & Omit<{
|
|
37
|
-
schema: "network.xyo.crypto.nft.collection.score.diviner.config";
|
|
38
|
-
} & Omit<{
|
|
39
|
-
schema: "network.xyo.crypto.nft.collection.score.diviner.config";
|
|
40
|
-
}, "schema">, "schema"> & {
|
|
41
|
-
schema: "network.xyo.crypto.nft.collection.score.diviner.config";
|
|
42
|
-
}, "schema"> & {
|
|
43
|
-
schema: string;
|
|
44
|
-
}, "schema"> & {
|
|
45
|
-
schema: string;
|
|
46
|
-
};
|
|
47
|
-
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
48
|
-
wallet?: import("@xyo-network/wallet-model").WalletInstance | undefined;
|
|
49
|
-
}>>;
|
|
50
|
-
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAErD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASzC,CAAA"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAA;AAE1D,cAAc,WAAW,CAAA;AACzB,cAAc,OAAO,CAAA;AAErB,OAAO,EAAE,+BAA+B,EAAE,CAAA;AAG1C,eAAe,+BAA+B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin';
|
|
2
|
-
import { Score } from '@xyo-network/crypto-nft-score-model';
|
|
3
|
-
import { scoringCriteria } from './criteria';
|
|
4
|
-
export type ScoringCriteriaKey = keyof typeof scoringCriteria & PropertyKey;
|
|
5
|
-
export type NftCollectionAnalysis = {
|
|
6
|
-
[key in ScoringCriteriaKey]: Score;
|
|
7
|
-
};
|
|
8
|
-
export declare const analyzeNftCollection: (nft: NftCollectionInfo) => Promise<NftCollectionAnalysis>;
|
|
9
|
-
//# sourceMappingURL=analyzeNftCollection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeNftCollection.d.ts","sourceRoot":"","sources":["../../../../src/lib/rating/analyzeNftCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,eAAe,GAAG,WAAW,CAAA;AAE3E,MAAM,MAAM,qBAAqB,GAAG;KACjC,GAAG,IAAI,kBAAkB,GAAG,KAAK;CACnC,CAAA;AAED,eAAO,MAAM,oBAAoB,QAI1B,iBAAiB,KACrB,QAAQ,qBAAqB,CAW/B,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin';
|
|
2
|
-
import { WeightedScoringCriteria } from '@xyo-network/crypto-nft-score-model';
|
|
3
|
-
export declare const scoringCriteria: {
|
|
4
|
-
[key: string]: WeightedScoringCriteria<NftCollectionInfo>;
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/rating/criteria/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAI7E,eAAO,MAAM,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAC,iBAAiB,CAAC,CAAA;CAGxF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/rating/criteria/scoring/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|