Skip to content

Commit

Permalink
chore: updated packages (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
tipusinghaw authored Jun 4, 2024
1 parent 35f156f commit b96978c
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 15 deletions.
86 changes: 84 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b96978c

Please sign in to comment.