diff --git a/dist/schemas/26-nft-holder/1-1-2.json b/dist/schemas/26-nft-holder/1-1-2.json new file mode 100644 index 0000000..1ce48da --- /dev/null +++ b/dist/schemas/26-nft-holder/1-1-2.json @@ -0,0 +1,275 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/26-nft-holder/1-1-2.json", + "title": "Generic NFT Holder", + "description": "You are a holder of a certain kind of NFT", + "type": "object", + "required": [ + "@context", + "issuer", + "issuanceDate", + "credentialSubject", + "proof" + ], + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + } + }, + "id": { + "type": "string" + }, + "type": { + "type": "array", + "items": { + "type": "string" + } + }, + "issuer": { + "type": "object", + "required": [ + "id", + "name", + "mrenclave" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "mrenclave": { + "type": "string" + }, + "runtimeVersion": { + "type": "object", + "required": [ + "parachain", + "sidechain" + ], + "properties": { + "sidechain": { + "type": "number" + }, + "parachain": { + "type": "number" + } + } + } + } + }, + "issuanceDate": { + "type": "string", + "format": "date-time" + }, + "proof": { + "type": "object", + "required": [ + "created", + "type", + "proofPurpose", + "proofValue", + "verificationMethod" + ], + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "type": { + "type": "string" + }, + "proofPurpose": { + "type": "string" + }, + "proofValue": { + "type": "string" + }, + "verificationMethod": { + "type": "string" + } + } + }, + "credentialSubject": { + "title": "Credential Subject of Generic NFT Holder", + "type": "object", + "required": [ + "id", + "type", + "values", + "endpoint", + "assertions" + ], + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "description": { + "type": "string" + }, + "values": { + "type": "array", + "minItems": 1, + "items": { + "type": "boolean" + } + }, + "endpoint": { + "type": "string", + "format": "uri" + }, + "assertions": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "and" + ], + "properties": { + "and": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "additionalItems": false, + "items": [ + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$nft" + ] + }, + "op": { + "type": "string", + "enum": [ + "==" + ] + }, + "dst": { + "type": "string", + "enum": [ + "Weirdo Ghost Gang", + "Club3 SBT", + "MFAN", + "MEME VIP PASS" + ] + } + } + }, + { + "type": "object", + "required": [ + "or" + ], + "properties": { + "or": { + "type": "array", + "minItems": 1, + "maxItems": 3, + "items": { + "type": "object", + "required": [ + "and" + ], + "properties": { + "and": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "additionalItems": false, + "items": [ + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$network" + ] + }, + "op": { + "type": "string", + "enum": [ + "==" + ] + }, + "dst": { + "type": "string", + "enum": [ + "bsc", + "polygon", + "arbitrum", + "ethereum" + ] + } + } + }, + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$address" + ] + }, + "op": { + "type": "string", + "enum": [ + "==" + ] + }, + "dst": { + "type": "string", + "enum": [ + "0x9f488C0dafb1B3bFeeD3e886e0E6E5f3f4517925", + "0xAc2e4e67cffa5E82bfA1e169e5F9aa405114C982", + "0xcccFF19FB8a4a2A206d07842b8F8c8c0A11904C2", + "0x9401518f4EBBA857BAA879D9f76E1Cc8b31ed197", + "0x9aBc7C604C27622f9CD56bd1628F6321c32bBBf6", + "0xAA813F8691B10Dc62bd616ae90b05A52f0C40C1D" + ] + } + } + } + ] + } + } + } + } + } + } + ] + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/schemas/CHANGELOG.md b/packages/schemas/CHANGELOG.md index 75d15be..731d76f 100644 --- a/packages/schemas/CHANGELOG.md +++ b/packages/schemas/CHANGELOG.md @@ -9,6 +9,12 @@ and this project follows [Schema Versioning](https://docs.snowplow.io/docs/pipel - +## 2024-07-10 + +(ADDITION) [`26-nft-holder`](./src/lib/26-nft-holder/) bumped to 1-1-2 + +- Supported new NFT: MVP. + ## 2024-07-09 (ADDITION) [`25-token-holding-amount`](./src/lib/25-token-holding-amount/) bumped to 1-1-3 diff --git a/packages/schemas/src/lib/26-nft-holder/1-1-2.ts b/packages/schemas/src/lib/26-nft-holder/1-1-2.ts new file mode 100644 index 0000000..c41e078 --- /dev/null +++ b/packages/schemas/src/lib/26-nft-holder/1-1-2.ts @@ -0,0 +1,59 @@ +import { JSONSchema7 } from 'json-schema'; + +import { schema as base } from '../0-base/1-1-0'; +import { resolveGitHubPath } from '../helpers'; +import { credentialSubject, assertion } from '../schema-helpers'; + +// Reference: +// https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/credentials-v2/src/nft_holder/mod.rs + +export const schema: JSONSchema7 = { + ...base, + + $id: resolveGitHubPath('26-nft-holder/1-1-2.json'), + + title: 'Generic NFT Holder', + description: 'You are a holder of a certain kind of NFT', + + properties: { + ...base.properties, + + credentialSubject: credentialSubject({ + title: 'Credential Subject of Generic NFT Holder', + assertions: assertion.and({ + items: [ + assertion.clause({ + src: ['$nft'], + op: ['=='], + dst: ['Weirdo Ghost Gang', 'Club3 SBT', 'MFAN', 'MEME VIP PASS'], + }), + assertion.or({ + minItems: 1, + maxItems: 3, // max(Weirdo Ghost Gang, Club3 SBT, MFAN, MEME VIP PASS) + items: assertion.and({ + items: [ + assertion.clause({ + src: ['$network'], + op: ['=='], + dst: ['bsc', 'polygon', 'arbitrum', 'ethereum'], + }), + assertion.clause({ + src: ['$address'], + op: ['=='], + dst: [ + '0x9f488C0dafb1B3bFeeD3e886e0E6E5f3f4517925', + '0xAc2e4e67cffa5E82bfA1e169e5F9aa405114C982', + '0xcccFF19FB8a4a2A206d07842b8F8c8c0A11904C2', + '0x9401518f4EBBA857BAA879D9f76E1Cc8b31ed197', + '0x9aBc7C604C27622f9CD56bd1628F6321c32bBBf6', + '0xAA813F8691B10Dc62bd616ae90b05A52f0C40C1D', + ], + }), + ], + }), + }), + ], + }), + }), + }, +};