From d5701fe9fec96a1d8646a65337d4023780a8c791 Mon Sep 17 00:00:00 2001 From: DaevMithran Date: Fri, 23 Aug 2024 12:25:49 +0530 Subject: [PATCH] docs(cheqd): Add Cheqd create resource tutorial Signed-off-by: DaevMithran --- guides/tutorials/cheqd/index.md | 23 +++++++++++++++++++++++ snippets/current/src/set-up-cheqd.ts | 13 +++++++++++++ 2 files changed, 36 insertions(+) diff --git a/guides/tutorials/cheqd/index.md b/guides/tutorials/cheqd/index.md index 2014f223..ebf7788b 100644 --- a/guides/tutorials/cheqd/index.md +++ b/guides/tutorials/cheqd/index.md @@ -70,6 +70,29 @@ A DID can be deactivated, it can still be resolved ``` +### Create Resource + +Using the createResource cheqd api agents are able to create custom DID-Linked Resources, including: + +- Trust Registries +- Status Lists +- Logos associated with DIDs +- Governance files + +#### Parameters + +1. `did`\* +2. `name`\* +3. `resourceType`\* +4. `id`\* +5. `data`\* : Text, Base64 string or an object +6. `alsoKnownAs` +7. `version` + +```typescript showLineNumbers set-up-cheqd.ts section-6 + +``` + ### Types --- diff --git a/snippets/current/src/set-up-cheqd.ts b/snippets/current/src/set-up-cheqd.ts index 92fb81c7..f9b00d78 100644 --- a/snippets/current/src/set-up-cheqd.ts +++ b/snippets/current/src/set-up-cheqd.ts @@ -160,3 +160,16 @@ await agent.dids.deactivate({ }, }) // end-section-5 + +// start-section-6 +await agent.modules.cheqd.createResource('did:cheqd:testnet:92874297-d824-40ea-8ae5-364a1ec9237d', { + name: 'resourceName', + resourceType: 'resourceType', + id: '6de33634-6439-4e46-aa3f-bfe03606b000', + version: '1.0', + data: { + name: 'name', + age: 18, + }, +}) +// end-section-6