-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #868 from XYOracleNetwork/feature/extract-nft-sche…
…ma-from-plugin Extract NFT schema from plugin
- Loading branch information
Showing
15 changed files
with
72 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { DivinerConfig } from '@xyo-network/diviner-model' | ||
|
||
import { NftScoreSchema } from './Schema' | ||
|
||
export type NftScoreDivinerConfigSchema = `${NftScoreSchema}.diviner.config` | ||
export const NftScoreDivinerConfigSchema: NftScoreDivinerConfigSchema = `${NftScoreSchema}.diviner.config` | ||
|
||
export type NftScoreDivinerConfig = DivinerConfig<{ schema: NftScoreDivinerConfigSchema }> |
33 changes: 33 additions & 0 deletions
33
packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Payload.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Payload } from '@xyo-network/payload-model' | ||
|
||
import { NftScoreSchema } from './Schema' | ||
|
||
export type PassFailScore = [total: number, possible: 1] | ||
export const PASS: PassFailScore = [1, 1] | ||
export const FAIL: PassFailScore = [0, 1] | ||
export type ScaledScore = [total: number, possible: number] | ||
export const SKIP: ScaledScore = [0, 0] | ||
export type Score = ScaledScore | PassFailScore | ||
|
||
export type AttributesScoringCriteria = 'Attributes' | ||
|
||
export type MetadataScoringCriteria = | ||
| 'Animation URL' | ||
| 'Background Color' | ||
| 'Description' | ||
| 'External Url' | ||
| 'Image' | ||
| 'Image Data' | ||
| 'Name' | ||
| 'YouTube URL' | ||
| AttributesScoringCriteria | ||
|
||
export type ScoringCriteria = 'Contract Address' | 'Supply' | 'Token Id' | 'Type' | MetadataScoringCriteria | ||
|
||
export type ScoringCriteriaKey = ScoringCriteria & PropertyKey | ||
|
||
export type NftAnalysis = { | ||
[key in ScoringCriteriaKey]: Score | ||
} | ||
|
||
export type NftScorePayload = Payload<{ schema: NftScoreSchema } & Partial<Omit<NftAnalysis, 'schema'>>> |
4 changes: 4 additions & 0 deletions
4
packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { NftSchema } from '../Schema' | ||
|
||
export type NftScoreSchema = `${NftSchema}.score` | ||
export const NftScoreSchema: NftScoreSchema = `${NftSchema}.score` |
3 changes: 3 additions & 0 deletions
3
packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './Config' | ||
export * from './Payload' | ||
export * from './Schema' |
3 changes: 0 additions & 3 deletions
3
packages/plugins/packages/payload/packages/crypto/packages/nft/src/Schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
export type NftSchema = 'network.xyo.crypto.nft' | ||
export const NftSchema: NftSchema = 'network.xyo.crypto.nft' | ||
|
||
export type NftWitnessConfigSchema = `${NftSchema}.witness.config` | ||
export const NftWitnessConfigSchema: NftWitnessConfigSchema = `${NftSchema}.witness.config` |
3 changes: 2 additions & 1 deletion
3
...ackages/crypto/packages/nft/src/Config.ts → ...crypto/packages/nft/src/Witness/Config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/Schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { NftSchema } from '../Schema' | ||
|
||
export type NftWitnessConfigSchema = `${NftSchema}.witness.config` | ||
export const NftWitnessConfigSchema: NftWitnessConfigSchema = `${NftSchema}.witness.config` |
2 changes: 2 additions & 0 deletions
2
packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './Config' | ||
export * from './Schema' |
2 changes: 2 additions & 0 deletions
2
packages/plugins/packages/payload/packages/crypto/packages/nft/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 8 additions & 11 deletions
19
packages/plugins/packages/payloadset/packages/crypto/packages/nft/src/Diviner.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
packages/plugins/packages/payloadset/packages/crypto/packages/nft/src/Witness.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
packages/plugins/packages/payloadset/packages/crypto/packages/nft/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/plugins/packages/payloadset/packages/crypto/packages/nft/src/spec/Diviner.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters