From 7d358c94bc9a596546c4cf2d74bd2676b08736b5 Mon Sep 17 00:00:00 2001 From: Pavan Vora Date: Sat, 14 Sep 2024 12:23:56 +0530 Subject: [PATCH] update validation (#40) --- README.md | 64 ++++++++++++----------- scripts/validate.js | 6 ++- yarn.lock | 120 +++++++++++++++++++++++++++----------------- 3 files changed, 114 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 579efad..7ca148d 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,18 @@ This is an off-chain registry to maintain labels, audits, and metadata for the dApps on Cardano. Please create or update your dApp project file to update the information on the Cardanoscan Explorer. - [How to create a new entry?](#how-to-create-a-new-entry-) - + [1. Fork and clone this repo](#1-fork-and-clone-this-repo) - + [2. create a new file under `projects` folder for your project](#2-create-a-new-file-under--projects--folder-for-your-project) - + [3. Add the meta details](#3-add-the-meta-details) - + [4. Add contracts details](#4-add-contracts-details) - + [5. Validate your changes](#5-validate-your-changes) - + [6. Create a pull request](#6-create-a-pull-request) - + [7. Send us the pull request link!](#7-send-us-the-pull-request-link-) + - [1. Fork and clone this repo](#1-fork-and-clone-this-repo) + - [2. create a new file under `projects` folder for your project](#2-create-a-new-file-under--projects--folder-for-your-project) + - [3. Add the meta details](#3-add-the-meta-details) + - [4. Add contracts details](#4-add-contracts-details) + - [5. Validate your changes](#5-validate-your-changes) + - [6. Create a pull request](#6-create-a-pull-request) + - [7. Send us the pull request link!](#7-send-us-the-pull-request-link-) - [Specification Guide](#specification-guide) - + [dApp](#dapp) - + [Contract](#contract) - + [Audit](#audit) - + [Examples](#examples) + - [dApp](#dapp) + - [Contract](#contract) + - [Audit](#audit) + - [Examples](#examples) ## How to create a new entry? @@ -95,7 +95,9 @@ This is an off-chain registry to maintain labels, audits, and metadata for the d ``` ### 5. Validate your changes + Please execute `npm run validate` to verify your changes, this will ensure that your changes follow the spec defined in the [Specification Guide](#specification-guide). + ### 6. Create a pull request Commit your changes, and create a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) @@ -111,6 +113,7 @@ To help us verify the authenticity of the pull request please send us the pull r The `labelPrefix` and `contracts.name` field is used in conjunction to form a label. See below for field limits and examples, ### dApp + --- | Field | Max Char Limit | | @@ -120,30 +123,34 @@ The `labelPrefix` and `contracts.name` field is used in conjunction to form a la | website | 35 | Optional | | twitter | 16 | Optional | | discord | 40 | Optional | +| github | 100 | Optional | | description | 140 | Optional | --- ### Contract -| Field | Max Char Limit | | -|:------|:---------------|:---------| -| name | 45 | Required | -| version | numeric | Required | -| languageVersion | numeric | Required | -| scriptHash| 56 | Required | -| github | 80 | Optional | -| description | 140 | Optional | -| audit | | Optional | - -You can visit [Cardanoscan Address Inspector](https://cardanoscan.io/addressInspector) to extract `scriptHash` (paymentCredential) from an address. + +| Field | Max Char Limit | | +| :-------------- | :------------- | :------- | +| name | 45 | Required | +| version | numeric | Required | +| languageVersion | numeric | Required | +| scriptHash | 56 | Required | +| github | 100 | Optional | +| description | 140 | Optional | +| audit | | Optional | + +You can visit [Cardanoscan Address Inspector](https://cardanoscan.io/addressInspector) to extract `scriptHash` (paymentCredential) from an address. --- + ### Audit -| Field | Max Char Limit | | -|:------|:---------------|:---------| -| provider | 20 | Required | -| report | 120 | Required | -| date | DD-MM-YYYY | Required | + +| Field | Max Char Limit | | +| :------- | :------------- | :------- | +| provider | 20 | Required | +| report | 120 | Required | +| date | DD-MM-YYYY | Required | --- @@ -170,6 +177,7 @@ If your contract does not have a specific name, you can use a generic name eg. ` } } ``` + The resulting label is -> `Perfect Dex Contract` ---- \ No newline at end of file +--- diff --git a/scripts/validate.js b/scripts/validate.js index dc0dbc7..b43755a 100644 --- a/scripts/validate.js +++ b/scripts/validate.js @@ -13,7 +13,7 @@ const contractSchema = Joi.object({ language: Joi.string().valid("PLUTUS", "NATIVESCRIPT").required(), languageVersion: Joi.number().required(), scriptHash: Joi.string().length(56).required(), - github: Joi.string().max(80), + github: Joi.string().max(100), description: Joi.string().max(140), audit: Joi.array().items(auditSchema), }); @@ -21,6 +21,7 @@ const contractSchema = Joi.object({ const schema = Joi.object({ projectName: Joi.string().max(30).required(), labelPrefix: Joi.string().max(16).required(), + github: Joi.string().max(100), website: Joi.string().max(35), twitter: Joi.string().max(16), discord: Joi.string().max(40), @@ -32,7 +33,8 @@ const schema = Joi.object({ "NFT", "GAMING", "TOKEN", - "ORACLE" + "ORACLE", + "TOOLS" ), description: Joi.string().max(140), contracts: Joi.array().items(contractSchema).min(1), diff --git a/yarn.lock b/yarn.lock index 7ace9d0..eabdbb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,55 +1,83 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! +__metadata: + version: 8 + cacheKey: 10c0 -"@hapi/hoek@^9.0.0": - version "9.3.0" - resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" - integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== +"@hapi/hoek@npm:^9.0.0": + version: 9.3.0 + resolution: "@hapi/hoek@npm:9.3.0" + checksum: 10c0/a096063805051fb8bba4c947e293c664b05a32b47e13bc654c0dd43813a1cec993bdd8f29ceb838020299e1d0f89f68dc0d62a603c13c9cc8541963f0beca055 + languageName: node + linkType: hard -"@hapi/topo@^5.0.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" - integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== +"@hapi/topo@npm:^5.0.0": + version: 5.1.0 + resolution: "@hapi/topo@npm:5.1.0" dependencies: - "@hapi/hoek" "^9.0.0" + "@hapi/hoek": "npm:^9.0.0" + checksum: 10c0/b16b06d9357947149e032bdf10151eb71aea8057c79c4046bf32393cb89d0d0f7ca501c40c0f7534a5ceca078de0700d2257ac855c15e59fe4e00bba2f25c86f + languageName: node + linkType: hard -"@joi/date@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@joi/date/-/date-2.1.0.tgz#fa7e3069a63c17d9ebe51a0b667f090c288de237" - integrity sha512-2zN5m0LgxZp/cynHGbzEImVmFIa+n+IOb/Nlw5LX/PLJneeCwG1NbiGw7MvPjsAKUGQK8z31Nn6V6lEN+4fZhg== +"@joi/date@npm:^2.1.0": + version: 2.1.0 + resolution: "@joi/date@npm:2.1.0" dependencies: - moment "2.x.x" + moment: "npm:2.x.x" + checksum: 10c0/43f6e7a80fe89d327c554127f29c86159121f31dc1b2133580601461da8396020ad92dcadbad6c66ca06a52b50d06670f3edbed96cb166bea1dfce8a38b95833 + languageName: node + linkType: hard -"@sideway/address@^4.1.3": - version "4.1.4" - resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.4.tgz#03dccebc6ea47fdc226f7d3d1ad512955d4783f0" - integrity sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw== +"@sideway/address@npm:^4.1.3": + version: 4.1.4 + resolution: "@sideway/address@npm:4.1.4" dependencies: - "@hapi/hoek" "^9.0.0" - -"@sideway/formula@^3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" - integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== - -"@sideway/pinpoint@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" - integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== - -joi@^17.9.1: - version "17.10.2" - resolved "https://registry.yarnpkg.com/joi/-/joi-17.10.2.tgz#4ecc348aa89ede0b48335aad172e0f5591e55b29" - integrity sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA== + "@hapi/hoek": "npm:^9.0.0" + checksum: 10c0/c6fad7d87fb016053e9e9b69c2f2d1f23036d5f1696df141e64c3c58bcf8c7d2a4133348adc2d246682410364d5922c6271ae556122741025794fb7c19814aae + languageName: node + linkType: hard + +"@sideway/formula@npm:^3.0.1": + version: 3.0.1 + resolution: "@sideway/formula@npm:3.0.1" + checksum: 10c0/3fe81fa9662efc076bf41612b060eb9b02e846ea4bea5bd114f1662b7f1541e9dedcf98aff0d24400bcb92f113964a50e0290b86e284edbdf6346fa9b7e2bf2c + languageName: node + linkType: hard + +"@sideway/pinpoint@npm:^2.0.0": + version: 2.0.0 + resolution: "@sideway/pinpoint@npm:2.0.0" + checksum: 10c0/d2ca75dacaf69b8fc0bb8916a204e01def3105ee44d8be16c355e5f58189eb94039e15ce831f3d544f229889ccfa35562a0ce2516179f3a7ee1bbe0b71e55b36 + languageName: node + linkType: hard + +"@stricahq/cardano-contracts-registry@workspace:.": + version: 0.0.0-use.local + resolution: "@stricahq/cardano-contracts-registry@workspace:." dependencies: - "@hapi/hoek" "^9.0.0" - "@hapi/topo" "^5.0.0" - "@sideway/address" "^4.1.3" - "@sideway/formula" "^3.0.1" - "@sideway/pinpoint" "^2.0.0" - -moment@2.x.x: - version "2.29.4" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" - integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== + "@joi/date": "npm:^2.1.0" + joi: "npm:^17.9.1" + languageName: unknown + linkType: soft + +"joi@npm:^17.9.1": + version: 17.10.2 + resolution: "joi@npm:17.10.2" + dependencies: + "@hapi/hoek": "npm:^9.0.0" + "@hapi/topo": "npm:^5.0.0" + "@sideway/address": "npm:^4.1.3" + "@sideway/formula": "npm:^3.0.1" + "@sideway/pinpoint": "npm:^2.0.0" + checksum: 10c0/5999a68f38a24de0b98850e137bbf4134e6dd8de29faa5893d7836f3e3aeb76ed5b2dd4daf836b87d2681aa9dfb6a5531c586d4d361dca9721d9ad0567be6b48 + languageName: node + linkType: hard + +"moment@npm:2.x.x": + version: 2.29.4 + resolution: "moment@npm:2.29.4" + checksum: 10c0/844c6f3ce42862ac9467c8ca4f5e48a00750078682cc5bda1bc0e50cc7ca88e2115a0f932d65a06e4a90e26cb78892be9b3ca3dd6546ca2c4d994cebb787fc2b + languageName: node + linkType: hard