diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/package.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/package.json index b6287aa86df..ee3bbc54225 100644 --- a/packages/plugins/packages/payload/packages/crypto/packages/nft/package.json +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/package.json @@ -1,5 +1,5 @@ { - "name": "@xyo-network/crypto-nft-payload-plugin", + "name": "@xyo-network/crypto-nft-payload-plugins", "author": { "email": "support@xyo.network", "name": "XYO Development Team", @@ -10,10 +10,8 @@ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues" }, "dependencies": { - "@xyo-network/diviner-model": "workspace:~", - "@xyo-network/payload-model": "workspace:~", - "@xyo-network/payload-plugin": "workspace:~", - "@xyo-network/witness": "workspace:~" + "@xyo-network/crypto-nft-collection-payload-plugin": "workspace:~", + "@xyo-network/crypto-nft-payload-plugin": "workspace:~" }, "devDependencies": { "@xylabs/ts-scripts-yarn3": "^2.19.0", diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/.npmignore b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/.npmignore new file mode 100644 index 00000000000..0430e8967b1 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/.npmignore @@ -0,0 +1,21 @@ +.* +.env +.eslintcache +.example.env +tsconfig* +jest.config.js +rollup.config.ts +yarn.lock +**/*.spec.ts +**/*.snap + +.github +docs +.pnp.* +.vscode +.yarn/* +coverage +cspell.json +node_modules +swagger.json +packages \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/LICENSE b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/LICENSE new file mode 100644 index 00000000000..0a041280bd0 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/README.md b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/README.md new file mode 100644 index 00000000000..cd0084ca798 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/README.md @@ -0,0 +1,13 @@ +[![logo][]](https://xyo.network) + +Part of [sdk-xyo-clint-js](https://www.npmjs.com/package/@xyo-network/sdk-xyo-client-js) + +## License + +> See the [LICENSE](LICENSE) file for license details + +## Credits + +[Made with 🔥 and ❄️ by XYO](https://xyo.network) + +[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/package.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/package.json new file mode 100644 index 00000000000..5b71286290e --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/package.json @@ -0,0 +1,57 @@ +{ + "name": "@xyo-network/crypto-nft-collection-payload-plugin", + "author": { + "email": "support@xyo.network", + "name": "XYO Development Team", + "url": "https://xyo.network" + }, + "bugs": { + "email": "support@xyo.network", + "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues" + }, + "dependencies": { + "@xyo-network/diviner-model": "workspace:~", + "@xyo-network/payload-model": "workspace:~", + "@xyo-network/payload-plugin": "workspace:~", + "@xyo-network/witness": "workspace:~" + }, + "devDependencies": { + "@xylabs/ts-scripts-yarn3": "^2.19.0", + "@xylabs/tsconfig": "^2.19.0", + "typescript": "^5.1.6" + }, + "description": "Primary SDK for using XYO Protocol 2.0", + "browser": "dist/esm/index.js", + "docs": "dist/docs.json", + "exports": { + ".": { + "node": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "browser": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "default": "./dist/esm/index.js" + }, + "./dist/docs.json": { + "default": "./dist/docs.json" + }, + "./package.json": "./package.json" + }, + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "homepage": "https://xyo.network", + "license": "LGPL-3.0", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git" + }, + "sideEffects": false, + "types": "dist/types/index.d.ts", + "version": "2.70.0" +} diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Config.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Config.ts new file mode 100644 index 00000000000..cbd1d32d8a0 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Config.ts @@ -0,0 +1,8 @@ +import { DivinerConfig } from '@xyo-network/diviner-model' + +import { NftCollectionScoreSchema } from './Schema' + +export type NftCollectionScoreDivinerConfigSchema = `${NftCollectionScoreSchema}.diviner.config` +export const NftCollectionScoreDivinerConfigSchema: NftCollectionScoreDivinerConfigSchema = `${NftCollectionScoreSchema}.diviner.config` + +export type NftCollectionScoreDivinerConfig = DivinerConfig<{ schema: NftCollectionScoreDivinerConfigSchema }> diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Payload.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Payload.ts new file mode 100644 index 00000000000..c89f482a4ce --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Payload.ts @@ -0,0 +1,8 @@ +import { Payload } from '@xyo-network/payload-model' + +import { NftCollectionScoreSchema } from './Schema' + +export type NftCollectionAnalysis = Record + +export type NftCollectionScorePayload = Payload<{ schema: NftCollectionScoreSchema } & Partial>> +export const isNftCollectionScorePayload = (x?: Payload | null): x is NftCollectionScorePayload => x?.schema === NftCollectionScoreSchema diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Schema.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Schema.ts new file mode 100644 index 00000000000..bdbf3d6e61b --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/Schema.ts @@ -0,0 +1,4 @@ +import { NftCollectionSchema } from '../Schema' + +export type NftCollectionScoreSchema = `${NftCollectionSchema}.score` +export const NftCollectionScoreSchema: NftCollectionScoreSchema = `${NftCollectionSchema}.score` diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/index.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/index.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Diviner/index.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Payload.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Payload.ts new file mode 100644 index 00000000000..d9630c3bfac --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Payload.ts @@ -0,0 +1,14 @@ +import { Payload } from '@xyo-network/payload-model' + +import { NftCollectionSchema } from './Schema' + +export interface NftCollectionInfo { + address: string + chainId: string +} + +export type NftCollectionInfoPayload = Payload + +export const isNftCollectionInfoPayload = (payload: Payload): payload is NftCollectionInfoPayload => { + return payload.schema === NftCollectionSchema +} diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Plugin.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Plugin.ts new file mode 100644 index 00000000000..e2105f9f190 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Plugin.ts @@ -0,0 +1,11 @@ +import { createPayloadPlugin } from '@xyo-network/payload-plugin' + +import { NftCollectionInfoPayload } from './Payload' +import { NftCollectionSchema } from './Schema' +import { cryptoNftCollectionPayloadTemplate } from './Template' + +export const NftCollectionInfoPayloadPlugin = () => + createPayloadPlugin({ + schema: NftCollectionSchema, + template: cryptoNftCollectionPayloadTemplate, + }) diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Schema.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Schema.ts new file mode 100644 index 00000000000..12649413671 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Schema.ts @@ -0,0 +1,2 @@ +export type NftCollectionSchema = 'network.xyo.crypto.nft.collection' +export const NftCollectionSchema: NftCollectionSchema = 'network.xyo.crypto.nft.collection' diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Template.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Template.ts new file mode 100644 index 00000000000..ebd0ea9293c --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Template.ts @@ -0,0 +1,6 @@ +import { NftCollectionInfoPayload } from './Payload' +import { NftCollectionSchema } from './Schema' + +export const cryptoNftCollectionPayloadTemplate = (): Partial => ({ + schema: NftCollectionSchema, +}) diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Config.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Config.ts new file mode 100644 index 00000000000..fa10c63ba85 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Config.ts @@ -0,0 +1,9 @@ +import { WitnessConfig } from '@xyo-network/witness' + +import { NftCollectionWitnessConfigSchema } from './Schema' + +export type CryptoWalletNftCollectionWitnessConfig = WitnessConfig<{ + address?: string + chainId?: number + schema: NftCollectionWitnessConfigSchema +}> diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Query.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Query.ts new file mode 100644 index 00000000000..82ce336364d --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Query.ts @@ -0,0 +1,11 @@ +import { Payload } from '@xyo-network/payload-model' + +import { NftCollectionWitnessQuerySchema } from './Schema' + +export type NftCollectionWitnessQueryPayload = Payload<{ + address?: string + chainId?: number + schema: NftCollectionWitnessQuerySchema +}> +export const isNftCollectionWitnessQueryPayload = (x?: Payload | null): x is NftCollectionWitnessQueryPayload => + x?.schema === NftCollectionWitnessQuerySchema diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Schema.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Schema.ts new file mode 100644 index 00000000000..04434331f1f --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/Schema.ts @@ -0,0 +1,7 @@ +import { NftCollectionSchema } from '../Schema' + +export type NftCollectionWitnessConfigSchema = `${NftCollectionSchema}.witness.config` +export const NftCollectionWitnessConfigSchema: NftCollectionWitnessConfigSchema = `${NftCollectionSchema}.witness.config` + +export type NftCollectionWitnessQuerySchema = `${NftCollectionSchema}.witness.query` +export const NftCollectionWitnessQuerySchema: NftCollectionWitnessQuerySchema = `${NftCollectionSchema}.witness.query` diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/index.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/index.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/Witness/index.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/index.ts new file mode 100644 index 00000000000..c51ef2c5942 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/index.ts @@ -0,0 +1,12 @@ +import { NftCollectionInfoPayloadPlugin } from './Plugin' + +export * from './Diviner' +export * from './Payload' +export * from './Schema' +export * from './Template' +export * from './Witness' + +export { NftCollectionInfoPayloadPlugin } + +// eslint-disable-next-line import/no-default-export +export default NftCollectionInfoPayloadPlugin diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/spec/Plugin.spec.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/spec/Plugin.spec.ts new file mode 100644 index 00000000000..3473d18344e --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/spec/Plugin.spec.ts @@ -0,0 +1,11 @@ +import { PayloadPluginResolver } from '@xyo-network/payload-plugin' + +import { NftCollectionInfoPayloadPlugin } from '../Plugin' + +describe('NftCollectionInfoPayloadPlugin', () => { + test('Add to Resolver', () => { + const plugin = NftCollectionInfoPayloadPlugin() + const resolver = new PayloadPluginResolver().register(plugin) + expect(resolver.resolve(plugin.schema)).toBeObject() + }) +}) diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/spec/tsconfig.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/spec/tsconfig.json similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/spec/tsconfig.json rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/src/spec/tsconfig.json diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/tsconfig.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/tsconfig.json new file mode 100644 index 00000000000..c42d01c071b --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "declarationDir": "./dist/types", + "typeRoots": [] + }, + + "extends": "@xylabs/tsconfig" +} + diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/tsconfig.typedoc.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/tsconfig.typedoc.json new file mode 100644 index 00000000000..0919ecb67d7 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/tsconfig.typedoc.json @@ -0,0 +1,5 @@ +{ + "exclude": ["**/spec/*", "**/*.spec.*", "**/packages/*", "dist"], + "extends": "./tsconfig.json" +} + diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/typedoc.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/typedoc.json new file mode 100644 index 00000000000..a1ff9f91cd9 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection/typedoc.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["./src/index.ts"], + "tsconfig": "./tsconfig.typedoc.json" +} \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/.npmignore b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/.npmignore new file mode 100644 index 00000000000..0430e8967b1 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/.npmignore @@ -0,0 +1,21 @@ +.* +.env +.eslintcache +.example.env +tsconfig* +jest.config.js +rollup.config.ts +yarn.lock +**/*.spec.ts +**/*.snap + +.github +docs +.pnp.* +.vscode +.yarn/* +coverage +cspell.json +node_modules +swagger.json +packages \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/LICENSE b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/LICENSE new file mode 100644 index 00000000000..0a041280bd0 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/README.md b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/README.md new file mode 100644 index 00000000000..cd0084ca798 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/README.md @@ -0,0 +1,13 @@ +[![logo][]](https://xyo.network) + +Part of [sdk-xyo-clint-js](https://www.npmjs.com/package/@xyo-network/sdk-xyo-client-js) + +## License + +> See the [LICENSE](LICENSE) file for license details + +## Credits + +[Made with 🔥 and ❄️ by XYO](https://xyo.network) + +[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/package.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/package.json new file mode 100644 index 00000000000..1d1f7e04173 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/package.json @@ -0,0 +1,58 @@ +{ + "name": "@xyo-network/crypto-nft-payload-plugin", + "author": { + "email": "support@xyo.network", + "name": "XYO Development Team", + "url": "https://xyo.network" + }, + "bugs": { + "email": "support@xyo.network", + "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues" + }, + "dependencies": { + "@xyo-network/crypto-nft-score-model": "workspace:~", + "@xyo-network/diviner-model": "workspace:~", + "@xyo-network/payload-model": "workspace:~", + "@xyo-network/payload-plugin": "workspace:~", + "@xyo-network/witness": "workspace:~" + }, + "devDependencies": { + "@xylabs/ts-scripts-yarn3": "^2.19.0", + "@xylabs/tsconfig": "^2.19.0", + "typescript": "^5.1.6" + }, + "description": "Primary SDK for using XYO Protocol 2.0", + "browser": "dist/esm/index.js", + "docs": "dist/docs.json", + "exports": { + ".": { + "node": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "browser": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "default": "./dist/esm/index.js" + }, + "./dist/docs.json": { + "default": "./dist/docs.json" + }, + "./package.json": "./package.json" + }, + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "homepage": "https://xyo.network", + "license": "LGPL-3.0", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git" + }, + "sideEffects": false, + "types": "dist/types/index.d.ts", + "version": "2.70.0" +} diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Config.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/Config.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Config.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/Config.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Payload.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/Payload.ts similarity index 73% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Payload.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/Payload.ts index 6c42cbf596e..f6c082f80df 100644 --- a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Payload.ts +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/Payload.ts @@ -1,14 +1,8 @@ +import { Score } from '@xyo-network/crypto-nft-score-model' 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 = diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Schema.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/Schema.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Diviner/Schema.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/Schema.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/index.ts new file mode 100644 index 00000000000..6afc17db1f3 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Diviner/index.ts @@ -0,0 +1,3 @@ +export * from './Config' +export * from './Payload' +export * from './Schema' diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Payload.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Payload.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Payload.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Payload.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Plugin.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Plugin.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Plugin.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Plugin.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Schema.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Schema.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Schema.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Schema.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Template.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Template.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Template.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Template.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/Config.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/Config.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/Config.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/Config.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/Query.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/Query.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/Query.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/Query.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/Schema.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/Schema.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/Witness/Schema.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/Schema.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/index.ts new file mode 100644 index 00000000000..adbee972009 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/Witness/index.ts @@ -0,0 +1,3 @@ +export * from './Config' +export * from './Query' +export * from './Schema' diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/index.ts new file mode 100644 index 00000000000..34337bec177 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/index.ts @@ -0,0 +1,12 @@ +import { NftInfoPayloadPlugin } from './Plugin' + +export * from './Diviner' +export * from './Payload' +export * from './Schema' +export * from './Template' +export * from './Witness' + +export { NftInfoPayloadPlugin } + +// eslint-disable-next-line import/no-default-export +export default NftInfoPayloadPlugin diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/spec/Plugin.spec.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/spec/Plugin.spec.ts similarity index 100% rename from packages/plugins/packages/payload/packages/crypto/packages/nft/src/spec/Plugin.spec.ts rename to packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/spec/Plugin.spec.ts diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/spec/tsconfig.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/spec/tsconfig.json new file mode 100644 index 00000000000..16980bd0bd0 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/src/spec/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "@xylabs/tsconfig-jest" +} \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/tsconfig.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/tsconfig.json new file mode 100644 index 00000000000..c42d01c071b --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "declarationDir": "./dist/types", + "typeRoots": [] + }, + + "extends": "@xylabs/tsconfig" +} + diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/tsconfig.typedoc.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/tsconfig.typedoc.json new file mode 100644 index 00000000000..0919ecb67d7 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/tsconfig.typedoc.json @@ -0,0 +1,5 @@ +{ + "exclude": ["**/spec/*", "**/*.spec.*", "**/packages/*", "dist"], + "extends": "./tsconfig.json" +} + diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/typedoc.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/typedoc.json new file mode 100644 index 00000000000..a1ff9f91cd9 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft/typedoc.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["./src/index.ts"], + "tsconfig": "./tsconfig.typedoc.json" +} \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/.npmignore b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/.npmignore new file mode 100644 index 00000000000..0430e8967b1 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/.npmignore @@ -0,0 +1,21 @@ +.* +.env +.eslintcache +.example.env +tsconfig* +jest.config.js +rollup.config.ts +yarn.lock +**/*.spec.ts +**/*.snap + +.github +docs +.pnp.* +.vscode +.yarn/* +coverage +cspell.json +node_modules +swagger.json +packages \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/LICENSE b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/LICENSE new file mode 100644 index 00000000000..0a041280bd0 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/README.md b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/README.md new file mode 100644 index 00000000000..cd0084ca798 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/README.md @@ -0,0 +1,13 @@ +[![logo][]](https://xyo.network) + +Part of [sdk-xyo-clint-js](https://www.npmjs.com/package/@xyo-network/sdk-xyo-client-js) + +## License + +> See the [LICENSE](LICENSE) file for license details + +## Credits + +[Made with 🔥 and ❄️ by XYO](https://xyo.network) + +[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/package.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/package.json new file mode 100644 index 00000000000..76e7d52c099 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/package.json @@ -0,0 +1,51 @@ +{ + "name": "@xyo-network/crypto-nft-score-model", + "author": { + "email": "support@xyo.network", + "name": "XYO Development Team", + "url": "https://xyo.network" + }, + "bugs": { + "email": "support@xyo.network", + "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues" + }, + "devDependencies": { + "@xylabs/ts-scripts-yarn3": "^2.19.0", + "@xylabs/tsconfig": "^2.19.0", + "typescript": "^5.1.6" + }, + "description": "Primary SDK for using XYO Protocol 2.0", + "browser": "dist/esm/index.js", + "docs": "dist/docs.json", + "exports": { + ".": { + "node": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "browser": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "default": "./dist/esm/index.js" + }, + "./dist/docs.json": { + "default": "./dist/docs.json" + }, + "./package.json": "./package.json" + }, + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "homepage": "https://xyo.network", + "license": "LGPL-3.0", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git" + }, + "sideEffects": false, + "types": "dist/types/index.d.ts", + "version": "2.70.0" +} diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/increment.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/increment.ts new file mode 100644 index 00000000000..c93868e6d6d --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/increment.ts @@ -0,0 +1,17 @@ +import { ScaledScore } from './score' + +export const incrementTotal = (score: ScaledScore, by = 1): ScaledScore => { + score[0] += by + return score +} + +export const incrementPossible = (score: ScaledScore, by = 1): ScaledScore => { + score[1] += by + return score +} + +export const incrementTotalAndPossible = (score: ScaledScore, totalBy = 1, possibleBy = 1): ScaledScore => { + score[0] += totalBy + score[1] += possibleBy + return score +} diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/index.ts new file mode 100644 index 00000000000..3f145c638bb --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/index.ts @@ -0,0 +1,4 @@ +export * from './increment' +export * from './score' +export * from './scoringFunction' +export * from './weighted' diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/score.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/score.ts new file mode 100644 index 00000000000..49c8e4799a3 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/score.ts @@ -0,0 +1,6 @@ +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 diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/scoringFunction.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/scoringFunction.ts new file mode 100644 index 00000000000..0649b780351 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/scoringFunction.ts @@ -0,0 +1,7 @@ +import { EmptyPayload } from '@xyo-network/payload-model' + +import { PassFailScore, Score } from './score' + +export type PassFailScoringFunction = (payload: T) => PassFailScore | Promise +export type ScaledScoringFunction = (payload: T) => Score | Promise +export type ScoringFunction = PassFailScoringFunction | ScaledScoringFunction diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/weighted.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/weighted.ts new file mode 100644 index 00000000000..5c3c0abb278 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/src/weighted.ts @@ -0,0 +1,8 @@ +import { EmptyPayload } from '@xyo-network/payload-model' + +import { ScoringFunction } from './scoringFunction' + +export interface WeightedScoringCriteria { + score: ScoringFunction + weight: number +} diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/tsconfig.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/tsconfig.json new file mode 100644 index 00000000000..c42d01c071b --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "declarationDir": "./dist/types", + "typeRoots": [] + }, + + "extends": "@xylabs/tsconfig" +} + diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/tsconfig.typedoc.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/tsconfig.typedoc.json new file mode 100644 index 00000000000..0919ecb67d7 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/tsconfig.typedoc.json @@ -0,0 +1,5 @@ +{ + "exclude": ["**/spec/*", "**/*.spec.*", "**/packages/*", "dist"], + "extends": "./tsconfig.json" +} + diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/typedoc.json b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/typedoc.json new file mode 100644 index 00000000000..a1ff9f91cd9 --- /dev/null +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score/typedoc.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["./src/index.ts"], + "tsconfig": "./tsconfig.typedoc.json" +} \ No newline at end of file diff --git a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/index.ts b/packages/plugins/packages/payload/packages/crypto/packages/nft/src/index.ts index 34337bec177..5f0aec5e2ac 100644 --- a/packages/plugins/packages/payload/packages/crypto/packages/nft/src/index.ts +++ b/packages/plugins/packages/payload/packages/crypto/packages/nft/src/index.ts @@ -1,12 +1,2 @@ -import { NftInfoPayloadPlugin } from './Plugin' - -export * from './Diviner' -export * from './Payload' -export * from './Schema' -export * from './Template' -export * from './Witness' - -export { NftInfoPayloadPlugin } - -// eslint-disable-next-line import/no-default-export -export default NftInfoPayloadPlugin +export * from '@xyo-network/crypto-nft-collection-payload-plugin' +export * from '@xyo-network/crypto-nft-payload-plugin' diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/analyzeNft.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/analyzeNft.ts index be187d96663..2403ea4cc9c 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/analyzeNft.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/analyzeNft.ts @@ -1,7 +1,7 @@ import { NftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { Score } from '@xyo-network/crypto-nft-score-model' import { scoringCriteria } from './criteria' -import { Score } from './score' export type ScoringCriteriaKey = keyof typeof scoringCriteria & PropertyKey diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/contract.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/contract.ts index e9d8b5f9d3f..9c6470f62fa 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/contract.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/contract.ts @@ -1,9 +1,8 @@ import { isAddress } from '@ethersproject/address' import { NftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model' -import { FAIL, PASS, PassFailScoringFunction } from '../../score' - -export const scoreContractAddress: PassFailScoringFunction = (nft: NftInfo) => { +export const scoreContractAddress: PassFailScoringFunction = (nft: NftInfo) => { if (!nft.contract) return FAIL if (typeof nft.contract !== 'string') return FAIL if (!isAddress(nft.contract)) return FAIL diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/animationUrl.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/animationUrl.ts index cf77431cbb1..0d4354474a7 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/animationUrl.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/animationUrl.ts @@ -1,6 +1,6 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model' -import { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '../../../score' import { isSecure, isValidUrl, isWeb3 } from './lib' export const scoreNftAnimationUrl = (nft: NftInfo | OpenSeaNftInfo): ScaledScore => { diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts index 3c6e6eee885..0b8f618b69a 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/attributes/evaluateAttributes.ts @@ -1,6 +1,5 @@ import { NftAttribute, NftInfo, OpenSeaNftAttribute, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' - -import { incrementPossible, incrementTotal, incrementTotalAndPossible, ScaledScore } from '../../../../score' +import { incrementPossible, incrementTotal, incrementTotalAndPossible, ScaledScore } from '@xyo-network/crypto-nft-score-model' const isDate = (value: unknown): value is Date => { if (isNumber(value)) { diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/backgroundColor.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/backgroundColor.ts index 2ca8a73bfd7..d6e9b698013 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/backgroundColor.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/backgroundColor.ts @@ -1,6 +1,5 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' - -import { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '../../../score' +import { incrementPossible, incrementTotal, incrementTotalAndPossible, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model' const isHexColor = /^[0-9A-F]{6}$/i diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/description.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/description.ts index 025bc28f93e..7a6a322a45f 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/description.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/description.ts @@ -1,6 +1,5 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' - -import { incrementTotal, ScaledScore } from '../../../score' +import { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model' export const scoreNftDescription = (nft: NftInfo | OpenSeaNftInfo): ScaledScore => { return scoreDescription(nft.metadata?.description) diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/externalUrl.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/externalUrl.ts index 2339ff1ef2f..d205dd14d31 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/externalUrl.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/externalUrl.ts @@ -1,6 +1,6 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model' -import { incrementTotal, ScaledScore } from '../../../score' import { isSecure, isValidUrl } from './lib' export const scoreNftExternalUrl = (nft: NftInfo | OpenSeaNftInfo): ScaledScore => { diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/image.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/image.ts index 4a71551aa1f..070aa6f56a6 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/image.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/image.ts @@ -1,6 +1,6 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model' -import { incrementTotal, PASS, ScaledScore } from '../../../score' import { isSecure, isValidUrl, isWeb3 } from './lib' const MaxPossibleImageScore = 3 diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/imageData.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/imageData.ts index 360bb578112..0b5d88bddc9 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/imageData.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/imageData.ts @@ -1,8 +1,7 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model' import { parse } from 'svg-parser' -import { PASS, ScaledScore } from '../../../score' - const MaxPossibleImageDataScore = 1 // NOTE: There is probably a deeper check we can do diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/name.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/name.ts index ecb80128420..0afbf80967a 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/name.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/name.ts @@ -1,6 +1,5 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' - -import { incrementTotal, ScaledScore } from '../../../score' +import { incrementTotal, ScaledScore } from '@xyo-network/crypto-nft-score-model' export const scoreNftName = (nft: NftInfo | OpenSeaNftInfo): ScaledScore => { return scoreName(nft.metadata?.name) diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/spec/testHelpers.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/spec/testHelpers.ts index 3bfcdea3237..53b1c8c5d9d 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/spec/testHelpers.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/spec/testHelpers.ts @@ -1,4 +1,4 @@ -import { PASS, ScaledScore } from '../../../../score' +import { PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model' export const expectMaxPossibleScore = (score: ScaledScore) => { const [total, possible] = score diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts index aa849c8bc26..c2cb1bf231f 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/metadata/youtubeUrl.ts @@ -1,6 +1,6 @@ import { NftInfo, OpenSeaNftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { incrementTotal, PASS, ScaledScore } from '@xyo-network/crypto-nft-score-model' -import { incrementTotal, PASS, ScaledScore } from '../../../score' import { isSecure, isValidUrl } from './lib' export const scoreNftYoutubeUrl = (nft: NftInfo | OpenSeaNftInfo): ScaledScore => { diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/supply.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/supply.ts index 05980c50ffc..e9ed4b5ae49 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/supply.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/supply.ts @@ -1,9 +1,9 @@ import { NftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model' -import { FAIL, PASS, PassFailScoringFunction } from '../../score' import { isValidPositiveBigNumber } from './lib' -export const scoreSupply: PassFailScoringFunction = (nft: NftInfo) => { +export const scoreSupply: PassFailScoringFunction = (nft: NftInfo) => { if (!nft.supply) return FAIL if (typeof nft.supply !== 'string') return FAIL try { diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/tokenId.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/tokenId.ts index 2d65ddcd708..65700b7879d 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/tokenId.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/tokenId.ts @@ -1,6 +1,6 @@ import { NftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model' -import { FAIL, PASS, PassFailScoringFunction } from '../../score' import { isValidPositiveBigNumber } from './lib' /** @@ -9,7 +9,7 @@ import { isValidPositiveBigNumber } from './lib' * @param nft * @returns */ -export const scoreTokenId: PassFailScoringFunction = (nft: NftInfo) => { +export const scoreTokenId: PassFailScoringFunction = (nft: NftInfo) => { if (!nft.tokenId) return FAIL if (typeof nft.tokenId !== 'string') return FAIL try { diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/type.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/type.ts index d5d39dc2931..1b83c7d6059 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/type.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/criteria/scoring/type.ts @@ -1,8 +1,7 @@ import { NftInfo } from '@xyo-network/crypto-nft-payload-plugin' +import { FAIL, PASS, PassFailScoringFunction } from '@xyo-network/crypto-nft-score-model' -import { FAIL, PASS, PassFailScoringFunction } from '../../score' - -export const scoreType: PassFailScoringFunction = (nft: NftInfo) => { +export const scoreType: PassFailScoringFunction = (nft: NftInfo) => { if (!nft.type) return FAIL if (typeof nft.type !== 'string') return FAIL const type = nft.type.toUpperCase() diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/index.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/index.ts index 24161f52198..e21b848b73a 100644 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/index.ts +++ b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/index.ts @@ -1,2 +1 @@ export * from './analyzeNft' -export * from './score' diff --git a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/score.ts b/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/score.ts deleted file mode 100644 index 492ccacf2c5..00000000000 --- a/packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner/src/lib/rating/score.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { NftInfo } from '@xyo-network/crypto-nft-payload-plugin' - -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 PassFailScoringFunction = (nft: NftInfo) => PassFailScore | Promise -export type ScaledScoringFunction = (nft: NftInfo) => Score | Promise -export type ScoringFunction = PassFailScoringFunction | ScaledScoringFunction - -export interface WeightedScoringCriteria { - score: ScoringFunction - weight: number -} - -export const incrementTotal = (score: ScaledScore, by = 1): ScaledScore => { - score[0] += by - return score -} - -export const incrementPossible = (score: ScaledScore, by = 1): ScaledScore => { - score[1] += by - return score -} - -export const incrementTotalAndPossible = (score: ScaledScore, totalBy = 1, possibleBy = 1): ScaledScore => { - score[0] += totalBy - score[1] += possibleBy - return score -} diff --git a/yarn.lock b/yarn.lock index d90dbada3f4..4bf21e0ba80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6325,6 +6325,20 @@ __metadata: languageName: unknown linkType: soft +"@xyo-network/crypto-nft-collection-payload-plugin@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection, @xyo-network/crypto-nft-collection-payload-plugin@workspace:~": + version: 0.0.0-use.local + resolution: "@xyo-network/crypto-nft-collection-payload-plugin@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft/packages/collection" + dependencies: + "@xylabs/ts-scripts-yarn3": ^2.19.0 + "@xylabs/tsconfig": ^2.19.0 + "@xyo-network/diviner-model": "workspace:~" + "@xyo-network/payload-model": "workspace:~" + "@xyo-network/payload-plugin": "workspace:~" + "@xyo-network/witness": "workspace:~" + typescript: ^5.1.6 + languageName: unknown + linkType: soft + "@xyo-network/crypto-nft-diviner-score-plugin@workspace:packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner, @xyo-network/crypto-nft-diviner-score-plugin@workspace:~": version: 0.0.0-use.local resolution: "@xyo-network/crypto-nft-diviner-score-plugin@workspace:packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/diviner" @@ -6350,12 +6364,13 @@ __metadata: languageName: unknown linkType: soft -"@xyo-network/crypto-nft-payload-plugin@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft, @xyo-network/crypto-nft-payload-plugin@workspace:~": +"@xyo-network/crypto-nft-payload-plugin@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft, @xyo-network/crypto-nft-payload-plugin@workspace:~": version: 0.0.0-use.local - resolution: "@xyo-network/crypto-nft-payload-plugin@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft" + resolution: "@xyo-network/crypto-nft-payload-plugin@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft/packages/nft" dependencies: "@xylabs/ts-scripts-yarn3": ^2.19.0 "@xylabs/tsconfig": ^2.19.0 + "@xyo-network/crypto-nft-score-model": "workspace:~" "@xyo-network/diviner-model": "workspace:~" "@xyo-network/payload-model": "workspace:~" "@xyo-network/payload-plugin": "workspace:~" @@ -6364,6 +6379,18 @@ __metadata: languageName: unknown linkType: soft +"@xyo-network/crypto-nft-payload-plugins@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft": + version: 0.0.0-use.local + resolution: "@xyo-network/crypto-nft-payload-plugins@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft" + dependencies: + "@xylabs/ts-scripts-yarn3": ^2.19.0 + "@xylabs/tsconfig": ^2.19.0 + "@xyo-network/crypto-nft-collection-payload-plugin": "workspace:~" + "@xyo-network/crypto-nft-payload-plugin": "workspace:~" + typescript: ^5.1.6 + languageName: unknown + linkType: soft + "@xyo-network/crypto-nft-plugin@workspace:packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft, @xyo-network/crypto-nft-plugin@workspace:~": version: 0.0.0-use.local resolution: "@xyo-network/crypto-nft-plugin@workspace:packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft" @@ -6390,6 +6417,16 @@ __metadata: languageName: unknown linkType: soft +"@xyo-network/crypto-nft-score-model@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score, @xyo-network/crypto-nft-score-model@workspace:~": + version: 0.0.0-use.local + resolution: "@xyo-network/crypto-nft-score-model@workspace:packages/plugins/packages/payload/packages/crypto/packages/nft/packages/score" + dependencies: + "@xylabs/ts-scripts-yarn3": ^2.19.0 + "@xylabs/tsconfig": ^2.19.0 + typescript: ^5.1.6 + languageName: unknown + linkType: soft + "@xyo-network/crypto-nft-witness-wallet-plugin@workspace:packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/witness, @xyo-network/crypto-nft-witness-wallet-plugin@workspace:~": version: 0.0.0-use.local resolution: "@xyo-network/crypto-nft-witness-wallet-plugin@workspace:packages/plugins/packages/payloadset/packages/crypto/packages/nft/packages/nft/packages/witness"