diff --git a/dist/schemas/25-token-holding-amount/1-0-0.json b/dist/schemas/25-token-holding-amount/1-0-0.json new file mode 100644 index 0000000..5cd6eb5 --- /dev/null +++ b/dist/schemas/25-token-holding-amount/1-0-0.json @@ -0,0 +1,423 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/25-token-holding-amount/1-0-0.json", + "title": "Token holding amount", + "description": "The amount of a particular token you are holding", + "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 Token holding amount", + "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": 4, + "maxItems": 4, + "additionalItems": false, + "items": [ + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$token" + ] + }, + "op": { + "type": "string", + "enum": [ + "==" + ] + }, + "dst": { + "type": "string", + "enum": [ + "BNB", + "ETH", + "SPACE_ID", + "LIT", + "WBTC", + "USDC", + "USDT", + "CRV", + "MATIC", + "DYDX", + "AMP", + "CVX", + "TUSD", + "USDD", + "GUSD", + "LINK", + "GRT", + "COMP", + "PEOPLE", + "GTC", + "TON", + "TRX", + "NFP", + "SOL", + "MCRT", + "BTC" + ] + } + } + }, + { + "type": "object", + "required": [ + "or" + ], + "properties": { + "or": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$network" + ] + }, + "op": { + "type": "string", + "enum": [ + "==" + ] + }, + "dst": { + "type": "string", + "enum": [ + "bsc", + "bitcoin_p2tr", + "bitcoin_p2pkh", + "bitcoin_p2sh", + "bitcoin_p2wpkh", + "bitcoin_p2wsh", + "ethereum", + "litentry", + "litmus", + "solana" + ] + } + } + }, + { + "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", + "bitcoin_p2tr", + "bitcoin_p2pkh", + "bitcoin_p2sh", + "bitcoin_p2wpkh", + "bitcoin_p2wsh", + "ethereum", + "litentry", + "litmus", + "solana" + ] + } + } + }, + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$address" + ] + }, + "op": { + "type": "string", + "enum": [ + "==" + ] + }, + "dst": { + "type": "string", + "enum": [ + "0xb8c77482e45f1f44de1745f52c74426c631bdd52", + "0x2170ed0880ac9a755fd29b2688956bd959f933f8", + "0x2dff88a56767223a5529ea5960da7a3f5f766406", + "0xb59490ab09a0f526cc7305822ac65f2ab12f9723", + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", + "0xdac17f958d2ee523a2206206994597c13d831ec7", + "0x55d398326f99059ff775485246999027b3197955", + "0xd533a949740bb3306d119cc777fa900ba034cd52", + "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", + "0x92d6c1e31e14520e676a687f0a93788b716beff5", + "0xff20817765cb7f73d4bde2e66e067e58d11095c2", + "0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b", + "0x0000000000085d4780b73119b644ae5ecd22b376", + "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9", + "0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6", + "0xd17479997f34dd9156deef8f95a52d81d265be9c", + "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd", + "0x514910771af9ca656af840dff83e8264ecf986ca", + "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd", + "0xc944e90c64b2c07662a292be6244bdf05cda44a7", + "0x52ce071bd9b1c4b00a0b92d298c512478cad67e8", + "0xc00e94cb662c3520282e6f5717214004a7f26888", + "0x7a58c0be72be218b41c608b7fe7c5bb630736c71", + "0xde30da39c46104798bb5aa3fe8b9e0e1f348163f", + "0x582d872a1b094fc48f5de31d3b73f2d9be47def1", + "0x76a797a59ba2c17726896976b7b3747bfd1d220f", + "0x50327c6c5a14dcade707abad2e27eb517df87ab5", + "0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3", + "0x75e8ddb518bb757b4282cd5b83bb70d4101d12fb", + "0x570a5d26f7765ecb712c0924e4de545b89fd43df", + "0x5288738df1aeb0894713de903e1d0c001eeb7644", + "0x4b8285aB433D8f69CB48d5Ad62b415ed1a221e4f", + "0xde16ce60804a881e9f8c4ebb3824646edecd478d", + "FADm4QuSUF1K526LvTjvbJjKzeeipP6bj5bSzp3r6ipq" + ] + } + } + } + ] + } + } + } + ] + } + } + } + }, + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$holding_amount" + ] + }, + "op": { + "type": "string", + "enum": [ + ">=" + ] + }, + "dst": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$holding_amount" + ] + }, + "op": { + "type": "string", + "enum": [ + "<" + ] + }, + "dst": { + "type": "string" + } + } + } + ] + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/dist/schemas/6-twitter-follower-amount/1-1-1.json b/dist/schemas/6-twitter-follower-amount/1-1-1.json new file mode 100644 index 0000000..d9be8ab --- /dev/null +++ b/dist/schemas/6-twitter-follower-amount/1-1-1.json @@ -0,0 +1,201 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/6-twitter-follower-amount/1-1-1.json", + "title": "Twitter Follower Amount", + "description": "The range of the user's Twitter follower count", + "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 A6 assertion/ Twitter Follower Amount", + "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": [ + "$total_followers" + ] + }, + "op": { + "type": "string", + "enum": [ + ">" + ] + }, + "dst": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$total_followers" + ] + }, + "op": { + "type": "string", + "enum": [ + "<=" + ] + }, + "dst": { + "type": "string" + } + } + } + ] + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/schemas/CHANGELOG.md b/packages/schemas/CHANGELOG.md index e7fb2d1..61268d2 100644 --- a/packages/schemas/CHANGELOG.md +++ b/packages/schemas/CHANGELOG.md @@ -9,6 +9,14 @@ and this project follows [Schema Versioning](https://docs.snowplow.io/docs/pipel - +## 2024-04-29 + +(ADDITION) [`6-twitter-follower-amount`](./src/lib/6-twitter-follower-amount/) bumped to 1-1-1 + +- Updated the variable `total_followers` to support any numbers + +(MODEL) [`25-token-holding-amount`](./src/lib/25-token-holding-amount/) initial to 1-0-0 + ## 2024-04-02 (ADDITION) Schema [`21-evm-holding-amount`](./src//lib/21-evm-holding-amount/) bumped to 1-1-1 diff --git a/packages/schemas/src/lib/25-token-holding-amount/1-0-0.ts b/packages/schemas/src/lib/25-token-holding-amount/1-0-0.ts new file mode 100644 index 0000000..be02cfd --- /dev/null +++ b/packages/schemas/src/lib/25-token-holding-amount/1-0-0.ts @@ -0,0 +1,172 @@ +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'; + +// Token names: https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/common/src/web3_token/mod.rs +// Networks: https://github.com/litentry/litentry-parachain/blob/dev/primitives/core/src/assertion/web3_token.rs +const supportedTokens = { + // Ethereum + BNB: ['0xb8c77482e45f1f44de1745f52c74426c631bdd52'], + // Bsc + ETH: ['0x2170ed0880ac9a755fd29b2688956bd959f933f8'], + // Ethereum, Bsc + SPACE_ID: ['0x2dff88a56767223a5529ea5960da7a3f5f766406'], + // Ethereum, Bsc + LIT: ['0xb59490ab09a0f526cc7305822ac65f2ab12f9723'], + // Ethereum + WBTC: ['0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'], + // Ethereum, Bsc + USDC: [ + '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', + ], + // Ethereum, Bsc + USDT: [ + '0xdac17f958d2ee523a2206206994597c13d831ec7', + '0x55d398326f99059ff775485246999027b3197955', + ], + // Ethereum + CRV: ['0xd533a949740bb3306d119cc777fa900ba034cd52'], + // Ethereum, Bsc + MATIC: [ + '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', + '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', + ], + // Ethereum + DYDX: ['0x92d6c1e31e14520e676a687f0a93788b716beff5'], + // Ethereum + AMP: ['0xff20817765cb7f73d4bde2e66e067e58d11095c2'], + // Ethereum + CVX: ['0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b'], + // Ethereum, Bsc + TUSD: [ + '0x0000000000085d4780b73119b644ae5ecd22b376', + '0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9', + ], + // Ethereum, Bsc + USDD: [ + '0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6', + '0xd17479997f34dd9156deef8f95a52d81d265be9c', + ], + // Ethereum + GUSD: ['0x056fd409e1d7a124bd7017459dfea2f387b6d5cd'], + // Ethereum, Bsc + LINK: [ + '0x514910771af9ca656af840dff83e8264ecf986ca', + '0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd', + ], + // Ethereum, Bsc + GRT: [ + '0xc944e90c64b2c07662a292be6244bdf05cda44a7', + '0x52ce071bd9b1c4b00a0b92d298c512478cad67e8', + ], + // Ethereum + COMP: ['0xc00e94cb662c3520282e6f5717214004a7f26888'], + // Ethereum + PEOPLE: ['0x7a58c0be72be218b41c608b7fe7c5bb630736c71'], + // Ethereum + GTC: ['0xde30da39c46104798bb5aa3fe8b9e0e1f348163f'], + // Ethereum, Bsc + TON: [ + '0x582d872a1b094fc48f5de31d3b73f2d9be47def1', + '0x76a797a59ba2c17726896976b7b3747bfd1d220f', + ], + // Ethereum, Bsc + TRX: [ + '0x50327c6c5a14dcade707abad2e27eb517df87ab5', + '0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3', + ], + // Bsc + NFP: ['0x75e8ddb518bb757b4282cd5b83bb70d4101d12fb'], + // Bsc, Ethereum + SOL: [ + '0x570a5d26f7765ecb712c0924e4de545b89fd43df', + '0x5288738df1aeb0894713de903e1d0c001eeb7644', + ], + // Bsc, Ethereum, Solana + MCRT: [ + '0x4b8285aB433D8f69CB48d5Ad62b415ed1a221e4f', + '0xde16ce60804a881e9f8c4ebb3824646edecd478d', + 'FADm4QuSUF1K526LvTjvbJjKzeeipP6bj5bSzp3r6ipq', + ], + BTC: [], +}; + +const supportedNetworks = [ + 'bsc', + 'bitcoin_p2tr', + 'bitcoin_p2pkh', + 'bitcoin_p2sh', + 'bitcoin_p2wpkh', + 'bitcoin_p2wsh', + 'ethereum', + 'litentry', + 'litmus', + 'solana', +]; + +const tokenAddresses = Object.values(supportedTokens).flat(); + +export const schema: JSONSchema7 = { + ...base, + + $id: resolveGitHubPath('25-token-holding-amount/1-0-0.json'), + + title: 'Token holding amount', + description: 'The amount of a particular token you are holding', + + properties: { + ...base.properties, + + credentialSubject: credentialSubject({ + title: 'Credential Subject of Token holding amount', + assertions: assertion.and({ + items: [ + assertion.clause({ + src: ['$token'], + op: ['=='], + dst: Object.keys(supportedTokens), + }), + assertion.or({ + items: { + anyOf: [ + assertion.clause({ + src: ['$network'], + op: ['=='], + dst: supportedNetworks, + }), + assertion.and({ + // describes the list, no strict items count check + items: [ + assertion.clause({ + src: ['$network'], + op: ['=='], + dst: supportedNetworks, + }), + assertion.clause({ + src: ['$address'], + op: ['=='], + dst: tokenAddresses, + }), + ], + }), + ], + }, + }), + assertion.clause({ + src: ['$holding_amount'], + op: ['>='], + dst: undefined, // Amount, can be any number. Format is a string. + }), + assertion.clause({ + src: ['$holding_amount'], + op: ['<'], + dst: undefined, // Amount, can be any number. Format is a string. + }), + ], + }), + }), + }, +}; diff --git a/packages/schemas/src/lib/6-twitter-follower-amount/1-1-1.ts b/packages/schemas/src/lib/6-twitter-follower-amount/1-1-1.ts new file mode 100644 index 0000000..aaaa667 --- /dev/null +++ b/packages/schemas/src/lib/6-twitter-follower-amount/1-1-1.ts @@ -0,0 +1,36 @@ +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'; + +export const schema: JSONSchema7 = { + ...base, + + $id: resolveGitHubPath('6-twitter-follower-amount/1-1-1.json'), + + title: 'Twitter Follower Amount', + description: "The range of the user's Twitter follower count", + + properties: { + ...base.properties, + + credentialSubject: credentialSubject({ + title: 'Credential Subject of A6 assertion/ Twitter Follower Amount', + assertions: assertion.and({ + items: [ + assertion.clause({ + src: ['$total_followers'], + op: ['>'], + dst: undefined, // Amount, can be any number. Format is a string. + }), + assertion.clause({ + src: ['$total_followers'], + op: ['<='], + dst: undefined, // Amount, can be any number. Format is a string. + }), + ], + }), + }), + }, +};