From b96978c07cff1455381120b0ae6b8d1a2090e90c Mon Sep 17 00:00:00 2001 From: tipusinghaw <126460794+tipusinghaw@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:40:47 +0530 Subject: [PATCH] chore: updated packages (#23) --- README.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++-- package.json | 4 +-- pnpm-lock.yaml | 22 ++++++------- 3 files changed, 97 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 44f2740..a54f68b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,85 @@ -# polygon-schema-manager +# Polygon schema Registrar -polygon-schema-manager +This GitHub repository is dedicated to creating W3C-compliant schemas for JSON-LD credentials, facilitating interoperability and standardization in digital credentialing. +Methods + +## Contract Deployment + +| Network | ChainId | Contract Address | +| :--------------------: | :-----: | :----------------------------------------: | +| Polygon Mainnet | 137 | 0x4B16719E73949a62E9A7306F352ec73F1B143c27 | +| Polygon Testnet (amoy) | 80002 | 0x4742d43C2dFCa5a1d4238240Afa8547Daf87Ee7a | + +### Example of Polygon JSON-LD Schema: + +```json +{ + "resourceURI": "did:polygon:testnet:0x13cd23928Ae515b86592C630f56C138aE4c7B79a/resources/398cee0a-efac-4643-9f4c-74c48c72a14b", + "resourceCollectionId": "55dbc8bf-fba3-4117-855c-1e0dc1d3bb47", + "resourceId": "398cee0a-efac-4643-9f4c-74c48c72a14b", + "resourceName": "PANCARD", + "resourceType": "W3C-schema", + "mediaType": "txt", + "created": "2022-11-17T08:10:36Z", + "checksum": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559", + "previousVersionId": null, + "nextVersionId": null +} +``` + +# Schema Operations + +## Create Schema + +Create a new JSON-LD credential schema. This method allows users to define the structure and properties of the credential schema. + +```js +import { createSchema } from 'polygon-schema-manager' +const txDetails = await createSchema(did, schemaName, schema) +``` + +The function returns, did, schemaId,and txnReceipt. + +## Get Schema by ID + +Retrieves schema details by its unique ID. + +```js +import { getSchemaById } from 'polygon-schema-manager' +const schemaDetail = await getSchemaById(did, schemaId) +``` + +The function returns Schema details including resourceURI, resourceCollectionId, etc.. + +## Get All Schemas by DID + +Retrieves all schemas associated with a specific DID. + +```js +import { getSchemaById } from 'polygon-schema-manager' +const schemaDetails = await getSchemaById(did) +``` + +The function returns Array of schema objects with essential keys.. + +## Estimate Transaction + +Estimates transaction fees for schema-related transactions. + +```js +import { estimateTxFee } from 'polygon-schema-manager' +const transactionDetails = await getSchemaById(did) +``` + +The function returns transaction details including transactionFee, gasLimit, etc. + +## Validate Schema Object + +Validates the JSON schema object to ensure its correctness. + +```js +import { estimateTxFee } from 'polygon-schema-manager' +const transactionDetails = await getSchemaById(did) +``` + +The function returns boolean indicating whether the schema is valid. diff --git a/package.json b/package.json index 9e236ab..dddd277 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "author": "Sai Ranjit Tummalapalli", "license": "Apache-2.0", "dependencies": { - "@ayanworks/polygon-did-registry-contract": "2.0.1-alpha.8", - "@ayanworks/polygon-did-resolver": "^0.0.16-alpha.16", + "@ayanworks/polygon-did-registry-contract": "3.0.0", + "@ayanworks/polygon-did-resolver": "1.0.0", "@nomicfoundation/hardhat-verify": "^2.0.3", "axios": "^1.6.3", "did-resolver": "^4.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 50f10f5..423f6b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,11 +9,11 @@ importers: .: dependencies: '@ayanworks/polygon-did-registry-contract': - specifier: 2.0.1-alpha.8 - version: 2.0.1-alpha.8 + specifier: 3.0.0 + version: 3.0.0 '@ayanworks/polygon-did-resolver': - specifier: ^0.0.16-alpha.16 - version: 0.0.16-alpha.16 + specifier: 1.0.0 + version: 1.0.0 '@nomicfoundation/hardhat-verify': specifier: ^2.0.3 version: 2.0.3(hardhat@2.19.4(ts-node@10.9.2(@types/node@18.19.3)(typescript@5.3.3))(typescript@5.3.3)) @@ -88,11 +88,11 @@ packages: '@aws-sdk/util-utf8-browser@3.259.0': resolution: {integrity: sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==} - '@ayanworks/polygon-did-registry-contract@2.0.1-alpha.8': - resolution: {integrity: sha512-5PI/poy+zWrT3iAQGc4w4hsj39lATIv2ucWeRwMq5uwu1NRQAYRWfoIez4bF/HxBMgI5dYuXWIqLtksLBmTiag==} + '@ayanworks/polygon-did-registry-contract@3.0.0': + resolution: {integrity: sha512-RnW31nkDIMG1YzuOycxGGrJFpgTcpBwS/UZR6/wMPrsJBKBEN28k2CZImwXkbgaknyTfL7xe1u3C8NxfDvhI4Q==} - '@ayanworks/polygon-did-resolver@0.0.16-alpha.16': - resolution: {integrity: sha512-+UdFk8/OAItRNx1soKt2DKhR+1RKDcMDVenoaHgcTbEUc3XVcmvqo622BLy2Kqo/VPugHzGpCmaBIOV1JIqM6g==} + '@ayanworks/polygon-did-resolver@1.0.0': + resolution: {integrity: sha512-mzYh3XNQ4HJ0GakP1QD7UOW8PjMAhdtu/TXzeOqMtHLhWktFMQcgJuqNMNxMGbJFdIe12qFJROlle6p1BjF01g==} '@babel/code-frame@7.23.5': resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} @@ -2973,11 +2973,11 @@ snapshots: dependencies: tslib: 2.6.2 - '@ayanworks/polygon-did-registry-contract@2.0.1-alpha.8': {} + '@ayanworks/polygon-did-registry-contract@3.0.0': {} - '@ayanworks/polygon-did-resolver@0.0.16-alpha.16': + '@ayanworks/polygon-did-resolver@1.0.0': dependencies: - '@ayanworks/polygon-did-registry-contract': 2.0.1-alpha.8 + '@ayanworks/polygon-did-registry-contract': 3.0.0 did-resolver: 4.1.0 ethers: 5.7.2 transitivePeerDependencies: