From ca9fb955d320a2876b0a85ddf6cf5d183607bfdc Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Mon, 25 Mar 2024 23:12:30 +0530 Subject: [PATCH 1/7] asset: Updates to have a VC of Asset Signed-off-by: Shreevatsa N --- demo/res/asset_vc_schema.json | 31 ++++++++ demo/src/asset-vc-tx.ts | 125 +++++++++++++++++++++--------- package.json | 1 + packages/asset/src/Asset.chain.ts | 6 +- 4 files changed, 123 insertions(+), 40 deletions(-) create mode 100644 demo/res/asset_vc_schema.json diff --git a/demo/res/asset_vc_schema.json b/demo/res/asset_vc_schema.json new file mode 100644 index 00000000..897f1284 --- /dev/null +++ b/demo/res/asset_vc_schema.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$metadata": { + "version": "1.0.0", + "slug": "test-demo-schema", + "discoverable": true + }, + "title": "Test Demo Schema v3", + "description": "Test Demo Schema", + "properties": { + "assetType": { + "type": "string" + }, + "assetDesc": { + "type": "string" + }, + "assetQty": { + "type": "integer" + }, + "assetValue": { + "type": "integer" + }, + "assetTag": { + "type": "string" + }, + "assetMeta": { + "type": "string" + } + }, + "type": "object" +} diff --git a/demo/src/asset-vc-tx.ts b/demo/src/asset-vc-tx.ts index 378b4f62..0e9f1a3d 100644 --- a/demo/src/asset-vc-tx.ts +++ b/demo/src/asset-vc-tx.ts @@ -1,22 +1,18 @@ import * as Cord from "@cord.network/sdk"; import { addNetworkMember } from "./utils/createAuthorities.js"; import { createAccount } from "./utils/createAccount.js"; -/* -import { - buildFromAssetProperties, - failproofSubmit, - buildFromAssetIssueProperties, - buildFromAssetTransferProperties, -} from "./utils/assets.js"; - -import { AssetTypeOf, IAssetProperties } from "./utils/asset-types.js"; -*/ + +import * as vcExport from "@cord.network/vc-export"; + +import { uriToIdentifier } from '@cord.network/identifier' + import { createDid } from "./utils/generateDid"; +import PalletAssetVcAssetEntry from '@polkadot/types/lookup'; const { NETWORK_ADDRESS, ANCHOR_URI } = process.env; async function main() { - const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:9944'; + const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:60477'; const anchorUri = ANCHOR_URI ?? '//Alice'; // Temporarily suppress console.log @@ -81,15 +77,17 @@ async function main() { colors: true, }) + let extSignCallback = async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }) + console.log(`\n❄️ Chain Space Properties `) const space = await Cord.ChainSpace.dispatchToChain( spaceProperties, issuerDid.uri, authorIdentity, - async ({ data }) => ({ - signature: issuerKeys.authentication.sign(data), - keyType: issuerKeys.authentication.type, - }) + extSignCallback, ) console.dir(space, { depth: null, @@ -105,6 +103,28 @@ async function main() { ) console.log(`✅ Chain Space Approved`) + let newSchemaContent = require('../res/asset_vc_schema.json'); + let newSchemaName = + newSchemaContent.title + ':' + Cord.Utils.UUID.generate(); + newSchemaContent.title = newSchemaName; + + let schemaProperties = Cord.Schema.buildFromProperties( + newSchemaContent, + space.uri, + issuerDid.uri, +); + const schemaUri = await Cord.Schema.dispatchToChain( + schemaProperties.schema, + issuerDid.uri, + authorIdentity, + space.authorization, + async ({ data }) => ({ + signature: issuerKeys.authentication.sign(data), + keyType: issuerKeys.authentication.type, + }), + ); + console.log(`✅ Schema - ${schemaUri} - added!`); + // Step 2: Create assets on-chain let assetProperties: Cord.IAssetProperties = { assetType: Cord.AssetTypeOf.art, @@ -115,38 +135,72 @@ async function main() { assetMeta: "Meta - " + Cord.Utils.UUID.generate(), }; + // Step 4: Delegate creates a new Verifiable Document + console.log(`\n❄️ VC Asset Creation `); + + let newCredContent = await vcExport.buildVcFromContent( + schemaProperties.schema, + assetProperties, + issuerDid, + issuerDid.uri, + { + spaceUri: space.uri, + schemaUri: schemaUri, + }, + ); + + console.log("VC asset creation complete", newCredContent); + + let vc = await vcExport.addProof( + newCredContent, + async (data) => ({ + signature: await issuerKeys.assertionMethod.sign(data), + keyType: issuerKeys.assertionMethod.type, + keyUri: `${issuerDid.uri}${ + issuerDid.assertionMethod![0].id + }` as Cord.DidResourceUri, + }), + issuerDid, + { spaceUri: space.uri, schemaUri, needSDR: false, needStatementProof: false }, + ); + console.dir(vc, { + depth: null, + colors: true, + }); + console.log(`\n❄️ Asset Properties - Created by Issuer `); console.dir(assetProperties, { depth: null, colors: true, }); - const assetEntry = await Cord.Asset.buildFromAssetProperties( - assetProperties, - issuerDid.uri, - space.uri, - ); + // const assetEntry = await Cord.Asset.buildFromAssetProperties( + // assetProperties, + // issuerDid.uri, + // space.uri, + // ); - console.log(`\n❄️ Asset Transaction - Created by Issuer `); - console.dir(assetEntry, { - depth: null, - colors: true, - }); + console.log("\n ** VC Asset Create Entry to chain ** \n", + { + "entry": { + assetQty: assetProperties.assetQty, + digest: vc.credentialHash, + authorizationId: uriToIdentifier(space.authorization), + }}); const extrinsic = await Cord.Asset.dispatchCreateVcToChain( assetProperties.assetQty, - assetEntry.digest, - assetEntry.creator, + vc.credentialHash, + vc.issuer, networkAuthorityIdentity, space.authorization, - assetEntry.uri, - async ({ data }) => ({ - signature: issuerKeys.authentication.sign(data), - keyType: issuerKeys.authentication.type, - }), + //assetEntry.uri, + extSignCallback, ) - console.log("✅ Asset created!"); + console.log("\n ✅ VC Asset created!"); + + console.log("Pring vc asset", vc); // Step 3: Issue Asset to Holder console.log(`\n❄️ Issue Asset to Holder - Issuer Action `); @@ -167,10 +221,7 @@ async function main() { assetIssuance, networkAuthorityIdentity, space.authorization, - async ({ data }) => ({ - signature: issuerKeys.authentication.sign(data), - keyType: issuerKeys.authentication.type, - }), + extSignCallback, ) // Step 4: Transfer Asset to New Owner diff --git a/package.json b/package.json index 782ca953..17760215 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@babel/preset-env": "^7.23.9", "@commitlint/cli": "^9.1.2", "@commitlint/config-conventional": "^9.1.2", + "@cord.network/vc-export": "0.9.3-1rc12", "@playwright/test": "^1.41.2", "@types/jest": "^29.5.12", "@types/node": "^20.11.6", diff --git a/packages/asset/src/Asset.chain.ts b/packages/asset/src/Asset.chain.ts index 8b63a394..f476af6a 100644 --- a/packages/asset/src/Asset.chain.ts +++ b/packages/asset/src/Asset.chain.ts @@ -84,9 +84,9 @@ export async function dispatchCreateVcToChain( creator: DidUri, authorAccount: CordKeyringPair, authorizationUri: AuthorizationUri, - assetEntryUri: AssetUri, + //assetEntryUri: AssetUri, signCallback: SignExtrinsicCallback -): Promise { +): Promise { try { const api = ConfigService.get('api') const authorizationId: AuthorizationId = uriToIdentifier(authorizationUri) @@ -106,7 +106,7 @@ export async function dispatchCreateVcToChain( await Chain.signAndSubmitTx(extrinsic, authorAccount) - return assetEntryUri + return null } catch (error) { const errorMessage = error instanceof Error ? error.message : JSON.stringify(error) From f7855b6c1b6b6c1fff8e5dfaf640a066dbd40dfe Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Tue, 26 Mar 2024 12:04:05 +0530 Subject: [PATCH 2/7] add helper function building assetEntryUri(temporary) Signed-off-by: Shreevatsa N --- demo/res/asset_vc_schema.json | 6 ++-- demo/src/asset-vc-tx.ts | 61 ++++++++++++++++++++++++++++++++--- 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/demo/res/asset_vc_schema.json b/demo/res/asset_vc_schema.json index 897f1284..de67a2db 100644 --- a/demo/res/asset_vc_schema.json +++ b/demo/res/asset_vc_schema.json @@ -2,11 +2,11 @@ "$schema": "http://json-schema.org/draft-07/schema#", "$metadata": { "version": "1.0.0", - "slug": "test-demo-schema", + "slug": "asset-demo-schema", "discoverable": true }, - "title": "Test Demo Schema v3", - "description": "Test Demo Schema", + "title": "Asset Demo Schema v3", + "description": "Asset Demo Schema", "properties": { "assetType": { "type": "string" diff --git a/demo/src/asset-vc-tx.ts b/demo/src/asset-vc-tx.ts index 0e9f1a3d..5a6feb0f 100644 --- a/demo/src/asset-vc-tx.ts +++ b/demo/src/asset-vc-tx.ts @@ -3,14 +3,63 @@ import { addNetworkMember } from "./utils/createAuthorities.js"; import { createAccount } from "./utils/createAccount.js"; import * as vcExport from "@cord.network/vc-export"; - -import { uriToIdentifier } from '@cord.network/identifier' - import { createDid } from "./utils/generateDid"; import PalletAssetVcAssetEntry from '@polkadot/types/lookup'; const { NETWORK_ADDRESS, ANCHOR_URI } = process.env; +/* TODO: Remove unused below dependencies after AssetEntryUri is built in vcExport library */ +import { hashToUri, uriToIdentifier } from '@cord.network/identifier' +import { + IAssetProperties, + ASSET_IDENT, + ASSET_PREFIX, + AssetUri, + IAssetIssuance, + ASSET_INSTANCE_IDENT, + IAssetTransfer, + IAssetEntry, + IAssetTransferEntry, + DidUri, + SpaceUri, + blake2AsHex, + AccountId, + H256, + Bytes, +} from '@cord.network/types' +import { Crypto } from '@cord.network/utils' +import * as Did from '@cord.network/did' +//import AccountId32 from '@polkadot/types/interfaces/runtime'; + + +/* TODO: Take arguments, generate digests with typed arguments */ +async function buildAssetUri(assetInput: IAssetEntry, issuerUri: DidUri , spaceUri: SpaceUri, api: any) { + //const api = Cord.ConfigService.get("api"); + const entryDigest = Crypto.hashObjectAsHexStr(assetInput); + + const scaleEncodedAssetDigest = api + .createType("H256", entryDigest) + .toU8a(); + const scaleEncodedIssuer = api + .createType('AccountId', Did.toChain(issuerUri)) + .toU8a() + const scaleEncodedSpace = api + .createType('Bytes', uriToIdentifier(spaceUri)) + .toU8a() + + const assetIdDigest = blake2AsHex( + Uint8Array.from([...scaleEncodedAssetDigest, ...scaleEncodedSpace, ...scaleEncodedIssuer]) + ); + + const assetIdentifier = hashToUri( + assetIdDigest, + ASSET_IDENT, + ASSET_PREFIX + ) as AssetUri; + + return assetIdentifier +} + async function main() { const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:60477'; const anchorUri = ANCHOR_URI ?? '//Alice'; @@ -188,6 +237,9 @@ async function main() { authorizationId: uriToIdentifier(space.authorization), }}); + /* TODO: Build assetEntryUri from vcExport library */ + const assetEntryUri = await buildAssetUri(assetProperties, issuerDid.uri, space.uri, api); + const extrinsic = await Cord.Asset.dispatchCreateVcToChain( assetProperties.assetQty, vc.credentialHash, @@ -205,7 +257,8 @@ async function main() { // Step 3: Issue Asset to Holder console.log(`\n❄️ Issue Asset to Holder - Issuer Action `); const assetIssuance = await Cord.Asset.buildFromIssueProperties( - assetEntry.uri, + //assetEntry.uri, + assetEntryUri, holderDid.uri, 1, issuerDid.uri, From ad94ab77e0e94805d96daefb96a9ef8c5844f33d Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Tue, 26 Mar 2024 18:42:38 +0530 Subject: [PATCH 3/7] Updates to asset-vc-tx & addition of yarn.lock Signed-off-by: Shreevatsa N --- demo/src/asset-vc-tx.ts | 136 ++++++++----------- packages/asset/src/Asset.chain.ts | 6 +- yarn.lock | 208 +++++++++++++++++++++++++++++- 3 files changed, 267 insertions(+), 83 deletions(-) diff --git a/demo/src/asset-vc-tx.ts b/demo/src/asset-vc-tx.ts index 5a6feb0f..d568b242 100644 --- a/demo/src/asset-vc-tx.ts +++ b/demo/src/asset-vc-tx.ts @@ -8,43 +8,30 @@ import PalletAssetVcAssetEntry from '@polkadot/types/lookup'; const { NETWORK_ADDRESS, ANCHOR_URI } = process.env; -/* TODO: Remove unused below dependencies after AssetEntryUri is built in vcExport library */ import { hashToUri, uriToIdentifier } from '@cord.network/identifier' import { - IAssetProperties, ASSET_IDENT, ASSET_PREFIX, AssetUri, - IAssetIssuance, - ASSET_INSTANCE_IDENT, - IAssetTransfer, IAssetEntry, - IAssetTransferEntry, DidUri, SpaceUri, blake2AsHex, AccountId, H256, - Bytes, } from '@cord.network/types' -import { Crypto } from '@cord.network/utils' import * as Did from '@cord.network/did' -//import AccountId32 from '@polkadot/types/interfaces/runtime'; - - -/* TODO: Take arguments, generate digests with typed arguments */ -async function buildAssetUri(assetInput: IAssetEntry, issuerUri: DidUri , spaceUri: SpaceUri, api: any) { - //const api = Cord.ConfigService.get("api"); - const entryDigest = Crypto.hashObjectAsHexStr(assetInput); +import { HexString } from "@cord.network/types"; +async function buildFromAssetVcProperties(entryDigest: HexString, issuerUri: DidUri , spaceUri: SpaceUri, api: Cord.ConfigService) { const scaleEncodedAssetDigest = api - .createType("H256", entryDigest) + .createType("H256", entryDigest) .toU8a(); const scaleEncodedIssuer = api - .createType('AccountId', Did.toChain(issuerUri)) + .createType('AccountId', Did.toChain(issuerUri)) .toU8a() const scaleEncodedSpace = api - .createType('Bytes', uriToIdentifier(spaceUri)) + .createType('Bytes', uriToIdentifier(spaceUri)) .toU8a() const assetIdDigest = blake2AsHex( @@ -57,11 +44,18 @@ async function buildAssetUri(assetInput: IAssetEntry, issuerUri: DidUri , spaceU ASSET_PREFIX ) as AssetUri; - return assetIdentifier + const transformedEntry: IAssetEntry = { + creator: issuerUri, + space: spaceUri, + digest: entryDigest, + uri: assetIdentifier, + }; + + return transformedEntry; } async function main() { - const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:60477'; + const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:9944'; const anchorUri = ANCHOR_URI ?? '//Alice'; // Temporarily suppress console.log @@ -86,7 +80,7 @@ async function main() { await addNetworkMember(networkAuthorityIdentity, authorIdentity.address) // const { account: issuerIdentity } = createAccount(); - // Create issuer DID + // Create issuer DID const { mnemonic: issuerMnemonic, document: issuerDid } = await createDid( networkAuthorityIdentity ) @@ -116,7 +110,7 @@ async function main() { await addNetworkMember(networkAuthorityIdentity, apiIdentity.address); console.log("✅ Identities created!"); - // Step 3: Create a new Chain Space + // Step 2: Create a new Chain Space console.log(`\n❄️ Chain Space Creation `) const spaceProperties = await Cord.ChainSpace.buildFromProperties( issuerDid.uri @@ -150,8 +144,9 @@ async function main() { space.uri, 100 ) - console.log(`✅ Chain Space Approved`) + console.log(`✅ Chain Space Approved`) + // Step 3: Dispatch new schema to chain. let newSchemaContent = require('../res/asset_vc_schema.json'); let newSchemaName = newSchemaContent.title + ':' + Cord.Utils.UUID.generate(); @@ -161,7 +156,8 @@ async function main() { newSchemaContent, space.uri, issuerDid.uri, -); + ); + const schemaUri = await Cord.Schema.dispatchToChain( schemaProperties.schema, issuerDid.uri, @@ -172,9 +168,10 @@ async function main() { keyType: issuerKeys.authentication.type, }), ); + console.log(`✅ Schema - ${schemaUri} - added!`); - // Step 2: Create assets on-chain + // Step 4: Create assets off-chain let assetProperties: Cord.IAssetProperties = { assetType: Cord.AssetTypeOf.art, assetDesc: "Asset - " + Cord.Utils.UUID.generate(), @@ -184,7 +181,13 @@ async function main() { assetMeta: "Meta - " + Cord.Utils.UUID.generate(), }; - // Step 4: Delegate creates a new Verifiable Document + console.log(`\n❄️ Asset Properties - Created by Issuer `); + console.dir(assetProperties, { + depth: null, + colors: true, + }); + + // Step 5: Delegate(Asset Owner/Issuer) creates a new Verifiable Document console.log(`\n❄️ VC Asset Creation `); let newCredContent = await vcExport.buildVcFromContent( @@ -197,68 +200,43 @@ async function main() { schemaUri: schemaUri, }, ); - - console.log("VC asset creation complete", newCredContent); - - let vc = await vcExport.addProof( - newCredContent, - async (data) => ({ - signature: await issuerKeys.assertionMethod.sign(data), - keyType: issuerKeys.assertionMethod.type, - keyUri: `${issuerDid.uri}${ - issuerDid.assertionMethod![0].id - }` as Cord.DidResourceUri, - }), - issuerDid, - { spaceUri: space.uri, schemaUri, needSDR: false, needStatementProof: false }, - ); - console.dir(vc, { - depth: null, - colors: true, - }); - - console.log(`\n❄️ Asset Properties - Created by Issuer `); - console.dir(assetProperties, { - depth: null, - colors: true, - }); - - // const assetEntry = await Cord.Asset.buildFromAssetProperties( - // assetProperties, - // issuerDid.uri, - // space.uri, + console.log("\n❄️ Asset Verifiable Credential Document created \n", newCredContent); + + /* TODO: Fix addProof dependency issue by implementing the methods requiring api locally */ + // let vc = await vcExport.addProof( + // newCredContent, + // async (data) => ({ + // signature: await issuerKeys.assertionMethod.sign(data), + // keyType: issuerKeys.assertionMethod.type, + // keyUri: `${issuerDid.uri}${ + // issuerDid.assertionMethod![0].id + // }` as Cord.DidResourceUri, + // }), + // issuerDid, + // { spaceUri: space.uri, schemaUri, needSDR: false, needStatementProof: false }, // ); - - console.log("\n ** VC Asset Create Entry to chain ** \n", - { - "entry": { - assetQty: assetProperties.assetQty, - digest: vc.credentialHash, - authorizationId: uriToIdentifier(space.authorization), - }}); - - /* TODO: Build assetEntryUri from vcExport library */ - const assetEntryUri = await buildAssetUri(assetProperties, issuerDid.uri, space.uri, api); + // console.dir(vc, { + // depth: null, + // colors: true, + // }); + + const assetVcEntry = await buildFromAssetVcProperties(newCredContent.credentialHash, issuerDid.uri, space.uri, api); const extrinsic = await Cord.Asset.dispatchCreateVcToChain( assetProperties.assetQty, - vc.credentialHash, - vc.issuer, + newCredContent.credentialHash, + newCredContent.issuer, networkAuthorityIdentity, space.authorization, - //assetEntry.uri, + assetVcEntry.uri, extSignCallback, ) + console.log("\n✅ VC Asset created on-chain!"); - console.log("\n ✅ VC Asset created!"); - - console.log("Pring vc asset", vc); - - // Step 3: Issue Asset to Holder + // Step 6: Issue Asset to Holder console.log(`\n❄️ Issue Asset to Holder - Issuer Action `); const assetIssuance = await Cord.Asset.buildFromIssueProperties( - //assetEntry.uri, - assetEntryUri, + assetVcEntry.uri, holderDid.uri, 1, issuerDid.uri, @@ -277,7 +255,7 @@ async function main() { extSignCallback, ) - // Step 4: Transfer Asset to New Owner + // Step 7: Transfer Asset to New Owner console.log(`\n❄️ Transfer Asset to New Owner (Holder2) - Holder Action `); const assetTransfer = await Cord.Asset.buildFromTransferProperties( @@ -300,7 +278,7 @@ async function main() { }), ) - console.log("✅ Asset transferred!"); + console.log("✅ Asset transferred!"); } main() .then(() => console.log("\nBye! 👋 👋 👋 ")) diff --git a/packages/asset/src/Asset.chain.ts b/packages/asset/src/Asset.chain.ts index f476af6a..8b63a394 100644 --- a/packages/asset/src/Asset.chain.ts +++ b/packages/asset/src/Asset.chain.ts @@ -84,9 +84,9 @@ export async function dispatchCreateVcToChain( creator: DidUri, authorAccount: CordKeyringPair, authorizationUri: AuthorizationUri, - //assetEntryUri: AssetUri, + assetEntryUri: AssetUri, signCallback: SignExtrinsicCallback -): Promise { +): Promise { try { const api = ConfigService.get('api') const authorizationId: AuthorizationId = uriToIdentifier(authorizationUri) @@ -106,7 +106,7 @@ export async function dispatchCreateVcToChain( await Chain.signAndSubmitTx(extrinsic, authorAccount) - return null + return assetEntryUri } catch (error) { const errorMessage = error instanceof Error ? error.message : JSON.stringify(error) diff --git a/yarn.lock b/yarn.lock index c8066813..adc3e9c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1600,6 +1600,20 @@ __metadata: languageName: node linkType: hard +"@cord.network/asset@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/asset@npm:0.9.3-1rc11" + dependencies: + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/did": "npm:0.9.3-1rc11" + "@cord.network/identifier": "npm:0.9.3-1rc11" + "@cord.network/network": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: 290dd71d9ef12a98bc128f423ea46823326bc76c138381c433908db7f5aba5e921aedda9cf02b4da4fbc17ef73ed75cfb06202938b87b57f7a1225e22042ec64 + languageName: node + linkType: hard + "@cord.network/asset@workspace:*, @cord.network/asset@workspace:packages/asset": version: 0.0.0-use.local resolution: "@cord.network/asset@workspace:packages/asset" @@ -1615,6 +1629,18 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/augment-api@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/augment-api@npm:0.9.3-1rc11" + dependencies: + "@cord.network/type-definitions": "npm:0.9.3-1rc11" + "@polkadot/rpc-augment": "npm:^10.12.2" + "@polkadot/rpc-core": "npm:^10.12.2" + "@polkadot/rpc-provider": "npm:^10.12.2" + checksum: 432c39f48d209296e023f3662bdf882c2bd67abc51a29bc9a3074a24b518202bb7c74d77c77408ae3689e47dc0b502ff333f3fb780b314e66407e240b55ba5b6 + languageName: node + linkType: hard + "@cord.network/augment-api@workspace:*, @cord.network/augment-api@workspace:packages/augment-api": version: 0.0.0-use.local resolution: "@cord.network/augment-api@workspace:packages/augment-api" @@ -1634,6 +1660,20 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/chain-space@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/chain-space@npm:0.9.3-1rc11" + dependencies: + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/did": "npm:0.9.3-1rc11" + "@cord.network/identifier": "npm:0.9.3-1rc11" + "@cord.network/network": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: 56ba432c34bc37a5fbcf3063e2fdf6fae164220fee7963bc89a35a39de4b55a7339d38ae9f165fe0a2b0cc43cea3555b347e436fa7386180d0bd68d6eac4fa18 + languageName: node + linkType: hard + "@cord.network/chain-space@workspace:*, @cord.network/chain-space@workspace:packages/chain-space": version: 0.0.0-use.local resolution: "@cord.network/chain-space@workspace:packages/chain-space" @@ -1649,6 +1689,17 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/config@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/config@npm:0.9.3-1rc11" + dependencies: + "@cord.network/type-definitions": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: 346a94876cbaced6d7d62469e8682c9a876c50cda25f0e76490689da85ec6e904deba16e955371a14091ebcecb484695369120203b2d6ea80d44dcf2dd610559 + languageName: node + linkType: hard + "@cord.network/config@workspace:*, @cord.network/config@workspace:packages/config": version: 0.0.0-use.local resolution: "@cord.network/config@workspace:packages/config" @@ -1661,6 +1712,26 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/did@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/did@npm:0.9.3-1rc11" + dependencies: + "@cord.network/augment-api": "npm:0.9.3-1rc11" + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/network": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + "@digitalbazaar/security-context": "npm:^1.0.1" + "@polkadot/api": "npm:^10.12.2" + "@polkadot/keyring": "npm:^12.6.2" + "@polkadot/types": "npm:^10.12.2" + "@polkadot/types-codec": "npm:^10.12.2" + "@polkadot/util": "npm:^12.6.2" + "@polkadot/util-crypto": "npm:^12.6.2" + checksum: 63c1ba4a5e2d136c1f1991161ef315c310783d5b82ad1d5a2b330f866cea84652067ebda739314e8d7626809c086642afc79caf7158407d64a0fbdaf558acd6f + languageName: node + linkType: hard + "@cord.network/did@workspace:*, @cord.network/did@workspace:packages/did": version: 0.0.0-use.local resolution: "@cord.network/did@workspace:packages/did" @@ -1682,6 +1753,16 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/identifier@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/identifier@npm:0.9.3-1rc11" + dependencies: + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: bd4433415209f8b5db7abb1ae59894f6d464602b5d455d312d87fb75aff8b2ff92460cc2fb17cb458c2509590e5e29258fe5113e2d4dd06a879f58a2d1b8bbe2 + languageName: node + linkType: hard + "@cord.network/identifier@workspace:*, @cord.network/identifier@workspace:packages/identifier": version: 0.0.0-use.local resolution: "@cord.network/identifier@workspace:packages/identifier" @@ -1693,6 +1774,20 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/network-score@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/network-score@npm:0.9.3-1rc11" + dependencies: + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/did": "npm:0.9.3-1rc11" + "@cord.network/identifier": "npm:0.9.3-1rc11" + "@cord.network/network": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: ef4d8f237113045fc6dbc3ecfa2df1ccfc95330f2e2332046687f400fb82fcdebed153a24acd154974b9614a773ad3d8f432a16fbaea37f32dc4086bcaa74530 + languageName: node + linkType: hard + "@cord.network/network-score@workspace:*, @cord.network/network-score@workspace:packages/network-score": version: 0.0.0-use.local resolution: "@cord.network/network-score@workspace:packages/network-score" @@ -1708,6 +1803,19 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/network@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/network@npm:0.9.3-1rc11" + dependencies: + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + "@polkadot/api": "npm:^10.12.2" + "@polkadot/types": "npm:^10.12.2" + checksum: 46161a47673d29b47952a553be6fd9211135a2a85a4c466f5996964c2d7848c677327e21048730351895fba1591d68cd9f2a1c1b148ac19e0bb7cb4dff5260d7 + languageName: node + linkType: hard + "@cord.network/network@workspace:*, @cord.network/network@workspace:packages/network": version: 0.0.0-use.local resolution: "@cord.network/network@workspace:packages/network" @@ -1723,6 +1831,22 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/schema@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/schema@npm:0.9.3-1rc11" + dependencies: + "@cord.network/augment-api": "npm:0.9.3-1rc11" + "@cord.network/chain-space": "npm:0.9.3-1rc11" + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/did": "npm:0.9.3-1rc11" + "@cord.network/identifier": "npm:0.9.3-1rc11" + "@cord.network/network": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: 803b534b47558fb35e5a080b3e3b1315a24547802c09f388013a10890095e9605b36f2785dd576763c2d766d354db4f33d7a8cb343cf6223e3e399963a047f10 + languageName: node + linkType: hard + "@cord.network/schema@workspace:*, @cord.network/schema@workspace:packages/schema": version: 0.0.0-use.local resolution: "@cord.network/schema@workspace:packages/schema" @@ -1742,6 +1866,25 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/sdk@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/sdk@npm:0.9.3-1rc11" + dependencies: + "@cord.network/asset": "npm:0.9.3-1rc11" + "@cord.network/chain-space": "npm:0.9.3-1rc11" + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/did": "npm:0.9.3-1rc11" + "@cord.network/identifier": "npm:0.9.3-1rc11" + "@cord.network/network": "npm:0.9.3-1rc11" + "@cord.network/network-score": "npm:0.9.3-1rc11" + "@cord.network/schema": "npm:0.9.3-1rc11" + "@cord.network/statement": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: 4be77737bcabb2236adf501a5a71b692751e197a74e038752890198bc65061edaf66c9d73727d1ec8d5b050caa8d7888b4633b14a693a7ae1da2161b3aa65c74 + languageName: node + linkType: hard + "@cord.network/sdk@workspace:packages/sdk": version: 0.0.0-use.local resolution: "@cord.network/sdk@workspace:packages/sdk" @@ -1765,6 +1908,20 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/statement@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/statement@npm:0.9.3-1rc11" + dependencies: + "@cord.network/config": "npm:0.9.3-1rc11" + "@cord.network/did": "npm:0.9.3-1rc11" + "@cord.network/identifier": "npm:0.9.3-1rc11" + "@cord.network/network": "npm:0.9.3-1rc11" + "@cord.network/types": "npm:0.9.3-1rc11" + "@cord.network/utils": "npm:0.9.3-1rc11" + checksum: 6a64e93d4b56147ed791b8885a64539c7e9211944d58804c23d821364d306a20438ed30c84507095f89cc67c226ae81514b11454ce5eb9d9b1803c9b89ce79c5 + languageName: node + linkType: hard + "@cord.network/statement@workspace:*, @cord.network/statement@workspace:packages/statement": version: 0.0.0-use.local resolution: "@cord.network/statement@workspace:packages/statement" @@ -1780,6 +1937,15 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/type-definitions@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/type-definitions@npm:0.9.3-1rc11" + dependencies: + "@polkadot/types": "npm:^10.12.2" + checksum: 0843e326df244f623633ba477b1bc0fbc94a51b835d498b6975058d2ce9341bdcdbfc1def8679bd33116abc58dd012545ce57bc3f0620e4a835687c8f24f6e15 + languageName: node + linkType: hard + "@cord.network/type-definitions@workspace:*, @cord.network/type-definitions@workspace:packages/type-definitions": version: 0.0.0-use.local resolution: "@cord.network/type-definitions@workspace:packages/type-definitions" @@ -1790,6 +1956,19 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/types@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/types@npm:0.9.3-1rc11" + dependencies: + "@polkadot/api": "npm:^10.12.2" + "@polkadot/keyring": "npm:^12.6.2" + "@polkadot/types": "npm:^10.12.2" + "@polkadot/util": "npm:^12.6.2" + "@polkadot/util-crypto": "npm:^12.6.2" + checksum: e65902c7830b081f27a53e240aec07454ae703fc7f92dccaab9c8fa44505c7de83c658ea7c7f684b8c41948ecd2bf43be1d298b3fcfc1231f8d252b1dd377176 + languageName: node + linkType: hard + "@cord.network/types@workspace:*, @cord.network/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@cord.network/types@workspace:packages/types" @@ -1804,6 +1983,22 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/utils@npm:0.9.3-1rc11": + version: 0.9.3-1rc11 + resolution: "@cord.network/utils@npm:0.9.3-1rc11" + dependencies: + "@cord.network/types": "npm:0.9.3-1rc11" + "@polkadot/api": "npm:^10.12.2" + "@polkadot/keyring": "npm:^12.6.2" + "@polkadot/util": "npm:^12.6.2" + "@polkadot/util-crypto": "npm:^12.6.2" + cbor-x: "npm:^1.5.8" + tweetnacl: "npm:^1.0.3" + uuid: "npm:^9.0.1" + checksum: 50e0caae7a4ca005d202fb0039127b8dbb0a1cf11e40d527e675a632243c518266267ccae0def77f9c42fd4af34f70bcdd647ef406abec4d7cef3facad0e0856 + languageName: node + linkType: hard + "@cord.network/utils@workspace:*, @cord.network/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@cord.network/utils@workspace:packages/utils" @@ -1822,6 +2017,16 @@ __metadata: languageName: unknown linkType: soft +"@cord.network/vc-export@npm:0.9.3-1rc12": + version: 0.9.3-1rc12 + resolution: "@cord.network/vc-export@npm:0.9.3-1rc12" + dependencies: + "@cord.network/sdk": "npm:0.9.3-1rc11" + moment: "npm:^2.29.4" + checksum: 70c33290771d0b8a683fa5a160444bd84ea09a74c000e36234a39f00d5996921f762c3256e2db109d21857aa599b5a7e4f1b088e3359cf9183182ce957da725e + languageName: node + linkType: hard + "@digitalbazaar/security-context@npm:^1.0.1": version: 1.0.1 resolution: "@digitalbazaar/security-context@npm:1.0.1" @@ -7823,7 +8028,7 @@ __metadata: languageName: node linkType: hard -"moment@npm:^2.30.1": +"moment@npm:^2.29.4, moment@npm:^2.30.1": version: 2.30.1 resolution: "moment@npm:2.30.1" checksum: ae42d876d4ec831ef66110bdc302c0657c664991e45cf2afffc4b0f6cd6d251dde11375c982a5c0564ccc0fa593fc564576ddceb8c8845e87c15f58aa6baca69 @@ -8760,6 +8965,7 @@ __metadata: "@babel/preset-env": "npm:^7.23.9" "@commitlint/cli": "npm:^9.1.2" "@commitlint/config-conventional": "npm:^9.1.2" + "@cord.network/vc-export": "npm:0.9.3-1rc12" "@playwright/test": "npm:^1.41.2" "@types/jest": "npm:^29.5.12" "@types/node": "npm:^20.11.6" From 1b50541232577a0699330e8531267e979d258de7 Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Wed, 27 Mar 2024 15:40:58 +0530 Subject: [PATCH 4/7] Add vc for issue, transfer Signed-off-by: Shreevatsa N --- demo/src/asset-vc-tx.ts | 44 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/demo/src/asset-vc-tx.ts b/demo/src/asset-vc-tx.ts index d568b242..d9aefbad 100644 --- a/demo/src/asset-vc-tx.ts +++ b/demo/src/asset-vc-tx.ts @@ -55,7 +55,7 @@ async function buildFromAssetVcProperties(entryDigest: HexString, issuerUri: Did } async function main() { - const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:9944'; + const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:63214'; const anchorUri = ANCHOR_URI ?? '//Alice'; // Temporarily suppress console.log @@ -146,7 +146,7 @@ async function main() { ) console.log(`✅ Chain Space Approved`) - // Step 3: Dispatch new schema to chain. + // Step 3: Dispatch creation of asset schema to chain. let newSchemaContent = require('../res/asset_vc_schema.json'); let newSchemaName = newSchemaContent.title + ':' + Cord.Utils.UUID.generate(); @@ -200,8 +200,6 @@ async function main() { schemaUri: schemaUri, }, ); - console.log("\n❄️ Asset Verifiable Credential Document created \n", newCredContent); - /* TODO: Fix addProof dependency issue by implementing the methods requiring api locally */ // let vc = await vcExport.addProof( // newCredContent, @@ -221,6 +219,8 @@ async function main() { // }); const assetVcEntry = await buildFromAssetVcProperties(newCredContent.credentialHash, issuerDid.uri, space.uri, api); + newCredContent.id = assetVcEntry.uri; + console.log("\n❄️ Asset(create) Verifiable Credential Document created \n", newCredContent); const extrinsic = await Cord.Asset.dispatchCreateVcToChain( assetProperties.assetQty, @@ -233,6 +233,21 @@ async function main() { ) console.log("\n✅ VC Asset created on-chain!"); + // Update the assetProperties with number of quantity of asset issued. + let issuanceQty = 1; + assetProperties.assetQty = issuanceQty; + + let newIssueCredContent = await vcExport.buildVcFromContent( + schemaProperties.schema, + assetProperties, + issuerDid, + holderDid.uri, + { + spaceUri: space.uri, + schemaUri: schemaUri, + }, + ); + // Step 6: Issue Asset to Holder console.log(`\n❄️ Issue Asset to Holder - Issuer Action `); const assetIssuance = await Cord.Asset.buildFromIssueProperties( @@ -248,6 +263,10 @@ async function main() { colors: true, }); + // Asset Issue ID consists of both asset_id:instance_id + newIssueCredContent.id = assetIssuance.uri; + console.log("\n❄️ Asset(issue) Verifiable Credential Document created \n", newIssueCredContent); + const issueExtrinsic = await Cord.Asset.dispatchIssueVcToChain( assetIssuance, networkAuthorityIdentity, @@ -257,6 +276,23 @@ async function main() { // Step 7: Transfer Asset to New Owner console.log(`\n❄️ Transfer Asset to New Owner (Holder2) - Holder Action `); + + // Should we create new assetProperties, or just update the qutantity(being issued) + assetProperties.assetQty = issuanceQty; + let newTransferCredContent = await vcExport.buildVcFromContent( + schemaProperties.schema, + assetProperties, + holderDid, + holder2Did.uri, + { + spaceUri: space.uri, + schemaUri: schemaUri, + }, + ); + + // Asset Issue ID consists of both asset_id:instance_id + newTransferCredContent.id = assetIssuance.uri; + console.log("\n❄️ Asset(transfer) Verifiable Credential Document created \n", newTransferCredContent); const assetTransfer = await Cord.Asset.buildFromTransferProperties( assetIssuance.uri, From 204a84050903e4a88d43d1c5cf565404d53a195c Mon Sep 17 00:00:00 2001 From: Shree Vatsa N Date: Tue, 2 Apr 2024 10:48:58 +0530 Subject: [PATCH 5/7] Delete package.json --- package.json | 75 ---------------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 package.json diff --git a/package.json b/package.json deleted file mode 100644 index 17760215..00000000 --- a/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "repository": "https://github.com/dhiway/cord.js", - "private": true, - "workspaces": [ - "packages/*" - ], - "scripts": { - "check": "tsc -p tsconfig.json --noEmit", - "build": "yarn workspaces foreach -Apt --exclude '{root-workspace}' run build", - "build:docs": "typedoc --skipErrorChecking --theme default --out docs/api --tsconfig tsconfig.docs.json && touch docs/.nojekyll", - "bundle": "yarn workspace @cord.network/sdk run bundle", - "clean": "rimraf tests/dist && yarn workspaces foreach -Ap --exclude '{root-workspace}' run clean", - "clean:docs": "rimraf docs/api", - "set:version": "yarn workspaces foreach -pt exec npm version --no-git-tag-version", - "prepublish": "yarn workspaces foreach -Ap --no-private exec cp -f ../../LICENSE .", - "publish": "yarn workspaces foreach -Apt --no-private npm publish", - "publish-rc": "yarn workspaces foreach -Apt --no-private npm publish --tag rc", - "lint": "eslint packages --format=codeframe", - "lint:fix": "yarn lint --fix", - "style": "prettier -l packages", - "style:fix": "yarn style --write", - "test": "jest --coverage --group=unit --detectOpenHandles", - "test:ci": "yarn test --ci --forceExit", - "test:watch": "yarn test --watch", - "demo-statement": "tsx --no-cache demo/src/func-test.ts", - "demo-network-score": "tsx --no-cache demo/src/network-score-test.ts", - "demo-asset": "tsx --no-cache demo/src/asset-tx.ts" - }, - "husky": { - "hooks": { - "pre-push": "yarn lint && yarn style", - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } - }, - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] - }, - "devDependencies": { - "@babel/core": "^7.23.9", - "@babel/preset-env": "^7.23.9", - "@commitlint/cli": "^9.1.2", - "@commitlint/config-conventional": "^9.1.2", - "@cord.network/vc-export": "0.9.3-1rc12", - "@playwright/test": "^1.41.2", - "@types/jest": "^29.5.12", - "@types/node": "^20.11.6", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", - "eslint": "^8.56.0", - "eslint-config-airbnb-base": "15.0.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsdoc": "^37.9.7", - "eslint-plugin-license-header": "^0.6.0", - "eslint-plugin-prettier": "^4.2.1", - "husky": "^9.0.10", - "jest": "^29.7.0", - "moment": "^2.30.1", - "prettier": "^3.2.5", - "rimraf": "^5.0.5", - "testcontainers": "^10.7.1", - "ts-jest": "^29.1.2", - "ts-jest-resolver": "^2.0.1", - "tsx": "^4.7.1", - "typedoc": "^0.25.8", - "typescript": "^5.3.3" - }, - "resolutions": { - "typescript": "^5.3.3" - }, - "version": "0.9.3-1rc4", - "packageManager": "yarn@4.0.2" -} From 0079a45eb01819a576122c38ead55b4cafcc76b2 Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Tue, 2 Apr 2024 10:54:58 +0530 Subject: [PATCH 6/7] revert Signed-off-by: Shreevatsa N --- demo/src/asset-vc-tx.ts | 2 +- package.json | 74 ++++++++++++++ yarn.lock | 208 +--------------------------------------- 3 files changed, 76 insertions(+), 208 deletions(-) create mode 100644 package.json diff --git a/demo/src/asset-vc-tx.ts b/demo/src/asset-vc-tx.ts index d9aefbad..3cd624d8 100644 --- a/demo/src/asset-vc-tx.ts +++ b/demo/src/asset-vc-tx.ts @@ -55,7 +55,7 @@ async function buildFromAssetVcProperties(entryDigest: HexString, issuerUri: Did } async function main() { - const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:63214'; + const networkAddress = NETWORK_ADDRESS ?? 'ws://127.0.0.1:9944'; const anchorUri = ANCHOR_URI ?? '//Alice'; // Temporarily suppress console.log diff --git a/package.json b/package.json new file mode 100644 index 00000000..782ca953 --- /dev/null +++ b/package.json @@ -0,0 +1,74 @@ +{ + "repository": "https://github.com/dhiway/cord.js", + "private": true, + "workspaces": [ + "packages/*" + ], + "scripts": { + "check": "tsc -p tsconfig.json --noEmit", + "build": "yarn workspaces foreach -Apt --exclude '{root-workspace}' run build", + "build:docs": "typedoc --skipErrorChecking --theme default --out docs/api --tsconfig tsconfig.docs.json && touch docs/.nojekyll", + "bundle": "yarn workspace @cord.network/sdk run bundle", + "clean": "rimraf tests/dist && yarn workspaces foreach -Ap --exclude '{root-workspace}' run clean", + "clean:docs": "rimraf docs/api", + "set:version": "yarn workspaces foreach -pt exec npm version --no-git-tag-version", + "prepublish": "yarn workspaces foreach -Ap --no-private exec cp -f ../../LICENSE .", + "publish": "yarn workspaces foreach -Apt --no-private npm publish", + "publish-rc": "yarn workspaces foreach -Apt --no-private npm publish --tag rc", + "lint": "eslint packages --format=codeframe", + "lint:fix": "yarn lint --fix", + "style": "prettier -l packages", + "style:fix": "yarn style --write", + "test": "jest --coverage --group=unit --detectOpenHandles", + "test:ci": "yarn test --ci --forceExit", + "test:watch": "yarn test --watch", + "demo-statement": "tsx --no-cache demo/src/func-test.ts", + "demo-network-score": "tsx --no-cache demo/src/network-score-test.ts", + "demo-asset": "tsx --no-cache demo/src/asset-tx.ts" + }, + "husky": { + "hooks": { + "pre-push": "yarn lint && yarn style", + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } + }, + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "devDependencies": { + "@babel/core": "^7.23.9", + "@babel/preset-env": "^7.23.9", + "@commitlint/cli": "^9.1.2", + "@commitlint/config-conventional": "^9.1.2", + "@playwright/test": "^1.41.2", + "@types/jest": "^29.5.12", + "@types/node": "^20.11.6", + "@typescript-eslint/eslint-plugin": "^5.62.0", + "@typescript-eslint/parser": "^5.62.0", + "eslint": "^8.56.0", + "eslint-config-airbnb-base": "15.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsdoc": "^37.9.7", + "eslint-plugin-license-header": "^0.6.0", + "eslint-plugin-prettier": "^4.2.1", + "husky": "^9.0.10", + "jest": "^29.7.0", + "moment": "^2.30.1", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "testcontainers": "^10.7.1", + "ts-jest": "^29.1.2", + "ts-jest-resolver": "^2.0.1", + "tsx": "^4.7.1", + "typedoc": "^0.25.8", + "typescript": "^5.3.3" + }, + "resolutions": { + "typescript": "^5.3.3" + }, + "version": "0.9.3-1rc4", + "packageManager": "yarn@4.0.2" +} diff --git a/yarn.lock b/yarn.lock index adc3e9c9..c8066813 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1600,20 +1600,6 @@ __metadata: languageName: node linkType: hard -"@cord.network/asset@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/asset@npm:0.9.3-1rc11" - dependencies: - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/did": "npm:0.9.3-1rc11" - "@cord.network/identifier": "npm:0.9.3-1rc11" - "@cord.network/network": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: 290dd71d9ef12a98bc128f423ea46823326bc76c138381c433908db7f5aba5e921aedda9cf02b4da4fbc17ef73ed75cfb06202938b87b57f7a1225e22042ec64 - languageName: node - linkType: hard - "@cord.network/asset@workspace:*, @cord.network/asset@workspace:packages/asset": version: 0.0.0-use.local resolution: "@cord.network/asset@workspace:packages/asset" @@ -1629,18 +1615,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/augment-api@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/augment-api@npm:0.9.3-1rc11" - dependencies: - "@cord.network/type-definitions": "npm:0.9.3-1rc11" - "@polkadot/rpc-augment": "npm:^10.12.2" - "@polkadot/rpc-core": "npm:^10.12.2" - "@polkadot/rpc-provider": "npm:^10.12.2" - checksum: 432c39f48d209296e023f3662bdf882c2bd67abc51a29bc9a3074a24b518202bb7c74d77c77408ae3689e47dc0b502ff333f3fb780b314e66407e240b55ba5b6 - languageName: node - linkType: hard - "@cord.network/augment-api@workspace:*, @cord.network/augment-api@workspace:packages/augment-api": version: 0.0.0-use.local resolution: "@cord.network/augment-api@workspace:packages/augment-api" @@ -1660,20 +1634,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/chain-space@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/chain-space@npm:0.9.3-1rc11" - dependencies: - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/did": "npm:0.9.3-1rc11" - "@cord.network/identifier": "npm:0.9.3-1rc11" - "@cord.network/network": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: 56ba432c34bc37a5fbcf3063e2fdf6fae164220fee7963bc89a35a39de4b55a7339d38ae9f165fe0a2b0cc43cea3555b347e436fa7386180d0bd68d6eac4fa18 - languageName: node - linkType: hard - "@cord.network/chain-space@workspace:*, @cord.network/chain-space@workspace:packages/chain-space": version: 0.0.0-use.local resolution: "@cord.network/chain-space@workspace:packages/chain-space" @@ -1689,17 +1649,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/config@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/config@npm:0.9.3-1rc11" - dependencies: - "@cord.network/type-definitions": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: 346a94876cbaced6d7d62469e8682c9a876c50cda25f0e76490689da85ec6e904deba16e955371a14091ebcecb484695369120203b2d6ea80d44dcf2dd610559 - languageName: node - linkType: hard - "@cord.network/config@workspace:*, @cord.network/config@workspace:packages/config": version: 0.0.0-use.local resolution: "@cord.network/config@workspace:packages/config" @@ -1712,26 +1661,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/did@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/did@npm:0.9.3-1rc11" - dependencies: - "@cord.network/augment-api": "npm:0.9.3-1rc11" - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/network": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - "@digitalbazaar/security-context": "npm:^1.0.1" - "@polkadot/api": "npm:^10.12.2" - "@polkadot/keyring": "npm:^12.6.2" - "@polkadot/types": "npm:^10.12.2" - "@polkadot/types-codec": "npm:^10.12.2" - "@polkadot/util": "npm:^12.6.2" - "@polkadot/util-crypto": "npm:^12.6.2" - checksum: 63c1ba4a5e2d136c1f1991161ef315c310783d5b82ad1d5a2b330f866cea84652067ebda739314e8d7626809c086642afc79caf7158407d64a0fbdaf558acd6f - languageName: node - linkType: hard - "@cord.network/did@workspace:*, @cord.network/did@workspace:packages/did": version: 0.0.0-use.local resolution: "@cord.network/did@workspace:packages/did" @@ -1753,16 +1682,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/identifier@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/identifier@npm:0.9.3-1rc11" - dependencies: - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: bd4433415209f8b5db7abb1ae59894f6d464602b5d455d312d87fb75aff8b2ff92460cc2fb17cb458c2509590e5e29258fe5113e2d4dd06a879f58a2d1b8bbe2 - languageName: node - linkType: hard - "@cord.network/identifier@workspace:*, @cord.network/identifier@workspace:packages/identifier": version: 0.0.0-use.local resolution: "@cord.network/identifier@workspace:packages/identifier" @@ -1774,20 +1693,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/network-score@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/network-score@npm:0.9.3-1rc11" - dependencies: - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/did": "npm:0.9.3-1rc11" - "@cord.network/identifier": "npm:0.9.3-1rc11" - "@cord.network/network": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: ef4d8f237113045fc6dbc3ecfa2df1ccfc95330f2e2332046687f400fb82fcdebed153a24acd154974b9614a773ad3d8f432a16fbaea37f32dc4086bcaa74530 - languageName: node - linkType: hard - "@cord.network/network-score@workspace:*, @cord.network/network-score@workspace:packages/network-score": version: 0.0.0-use.local resolution: "@cord.network/network-score@workspace:packages/network-score" @@ -1803,19 +1708,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/network@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/network@npm:0.9.3-1rc11" - dependencies: - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - "@polkadot/api": "npm:^10.12.2" - "@polkadot/types": "npm:^10.12.2" - checksum: 46161a47673d29b47952a553be6fd9211135a2a85a4c466f5996964c2d7848c677327e21048730351895fba1591d68cd9f2a1c1b148ac19e0bb7cb4dff5260d7 - languageName: node - linkType: hard - "@cord.network/network@workspace:*, @cord.network/network@workspace:packages/network": version: 0.0.0-use.local resolution: "@cord.network/network@workspace:packages/network" @@ -1831,22 +1723,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/schema@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/schema@npm:0.9.3-1rc11" - dependencies: - "@cord.network/augment-api": "npm:0.9.3-1rc11" - "@cord.network/chain-space": "npm:0.9.3-1rc11" - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/did": "npm:0.9.3-1rc11" - "@cord.network/identifier": "npm:0.9.3-1rc11" - "@cord.network/network": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: 803b534b47558fb35e5a080b3e3b1315a24547802c09f388013a10890095e9605b36f2785dd576763c2d766d354db4f33d7a8cb343cf6223e3e399963a047f10 - languageName: node - linkType: hard - "@cord.network/schema@workspace:*, @cord.network/schema@workspace:packages/schema": version: 0.0.0-use.local resolution: "@cord.network/schema@workspace:packages/schema" @@ -1866,25 +1742,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/sdk@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/sdk@npm:0.9.3-1rc11" - dependencies: - "@cord.network/asset": "npm:0.9.3-1rc11" - "@cord.network/chain-space": "npm:0.9.3-1rc11" - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/did": "npm:0.9.3-1rc11" - "@cord.network/identifier": "npm:0.9.3-1rc11" - "@cord.network/network": "npm:0.9.3-1rc11" - "@cord.network/network-score": "npm:0.9.3-1rc11" - "@cord.network/schema": "npm:0.9.3-1rc11" - "@cord.network/statement": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: 4be77737bcabb2236adf501a5a71b692751e197a74e038752890198bc65061edaf66c9d73727d1ec8d5b050caa8d7888b4633b14a693a7ae1da2161b3aa65c74 - languageName: node - linkType: hard - "@cord.network/sdk@workspace:packages/sdk": version: 0.0.0-use.local resolution: "@cord.network/sdk@workspace:packages/sdk" @@ -1908,20 +1765,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/statement@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/statement@npm:0.9.3-1rc11" - dependencies: - "@cord.network/config": "npm:0.9.3-1rc11" - "@cord.network/did": "npm:0.9.3-1rc11" - "@cord.network/identifier": "npm:0.9.3-1rc11" - "@cord.network/network": "npm:0.9.3-1rc11" - "@cord.network/types": "npm:0.9.3-1rc11" - "@cord.network/utils": "npm:0.9.3-1rc11" - checksum: 6a64e93d4b56147ed791b8885a64539c7e9211944d58804c23d821364d306a20438ed30c84507095f89cc67c226ae81514b11454ce5eb9d9b1803c9b89ce79c5 - languageName: node - linkType: hard - "@cord.network/statement@workspace:*, @cord.network/statement@workspace:packages/statement": version: 0.0.0-use.local resolution: "@cord.network/statement@workspace:packages/statement" @@ -1937,15 +1780,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/type-definitions@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/type-definitions@npm:0.9.3-1rc11" - dependencies: - "@polkadot/types": "npm:^10.12.2" - checksum: 0843e326df244f623633ba477b1bc0fbc94a51b835d498b6975058d2ce9341bdcdbfc1def8679bd33116abc58dd012545ce57bc3f0620e4a835687c8f24f6e15 - languageName: node - linkType: hard - "@cord.network/type-definitions@workspace:*, @cord.network/type-definitions@workspace:packages/type-definitions": version: 0.0.0-use.local resolution: "@cord.network/type-definitions@workspace:packages/type-definitions" @@ -1956,19 +1790,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/types@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/types@npm:0.9.3-1rc11" - dependencies: - "@polkadot/api": "npm:^10.12.2" - "@polkadot/keyring": "npm:^12.6.2" - "@polkadot/types": "npm:^10.12.2" - "@polkadot/util": "npm:^12.6.2" - "@polkadot/util-crypto": "npm:^12.6.2" - checksum: e65902c7830b081f27a53e240aec07454ae703fc7f92dccaab9c8fa44505c7de83c658ea7c7f684b8c41948ecd2bf43be1d298b3fcfc1231f8d252b1dd377176 - languageName: node - linkType: hard - "@cord.network/types@workspace:*, @cord.network/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@cord.network/types@workspace:packages/types" @@ -1983,22 +1804,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/utils@npm:0.9.3-1rc11": - version: 0.9.3-1rc11 - resolution: "@cord.network/utils@npm:0.9.3-1rc11" - dependencies: - "@cord.network/types": "npm:0.9.3-1rc11" - "@polkadot/api": "npm:^10.12.2" - "@polkadot/keyring": "npm:^12.6.2" - "@polkadot/util": "npm:^12.6.2" - "@polkadot/util-crypto": "npm:^12.6.2" - cbor-x: "npm:^1.5.8" - tweetnacl: "npm:^1.0.3" - uuid: "npm:^9.0.1" - checksum: 50e0caae7a4ca005d202fb0039127b8dbb0a1cf11e40d527e675a632243c518266267ccae0def77f9c42fd4af34f70bcdd647ef406abec4d7cef3facad0e0856 - languageName: node - linkType: hard - "@cord.network/utils@workspace:*, @cord.network/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@cord.network/utils@workspace:packages/utils" @@ -2017,16 +1822,6 @@ __metadata: languageName: unknown linkType: soft -"@cord.network/vc-export@npm:0.9.3-1rc12": - version: 0.9.3-1rc12 - resolution: "@cord.network/vc-export@npm:0.9.3-1rc12" - dependencies: - "@cord.network/sdk": "npm:0.9.3-1rc11" - moment: "npm:^2.29.4" - checksum: 70c33290771d0b8a683fa5a160444bd84ea09a74c000e36234a39f00d5996921f762c3256e2db109d21857aa599b5a7e4f1b088e3359cf9183182ce957da725e - languageName: node - linkType: hard - "@digitalbazaar/security-context@npm:^1.0.1": version: 1.0.1 resolution: "@digitalbazaar/security-context@npm:1.0.1" @@ -8028,7 +7823,7 @@ __metadata: languageName: node linkType: hard -"moment@npm:^2.29.4, moment@npm:^2.30.1": +"moment@npm:^2.30.1": version: 2.30.1 resolution: "moment@npm:2.30.1" checksum: ae42d876d4ec831ef66110bdc302c0657c664991e45cf2afffc4b0f6cd6d251dde11375c982a5c0564ccc0fa593fc564576ddceb8c8845e87c15f58aa6baca69 @@ -8965,7 +8760,6 @@ __metadata: "@babel/preset-env": "npm:^7.23.9" "@commitlint/cli": "npm:^9.1.2" "@commitlint/config-conventional": "npm:^9.1.2" - "@cord.network/vc-export": "npm:0.9.3-1rc12" "@playwright/test": "npm:^1.41.2" "@types/jest": "npm:^29.5.12" "@types/node": "npm:^20.11.6" From 5b4ae2b280acafcc7f1f9597142016a7bcf828fd Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Tue, 2 Apr 2024 16:02:18 +0530 Subject: [PATCH 7/7] address review comments Signed-off-by: Shreevatsa N --- demo/src/asset-vc-tx.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/demo/src/asset-vc-tx.ts b/demo/src/asset-vc-tx.ts index 3cd624d8..281bc3c5 100644 --- a/demo/src/asset-vc-tx.ts +++ b/demo/src/asset-vc-tx.ts @@ -277,7 +277,6 @@ async function main() { // Step 7: Transfer Asset to New Owner console.log(`\n❄️ Transfer Asset to New Owner (Holder2) - Holder Action `); - // Should we create new assetProperties, or just update the qutantity(being issued) assetProperties.assetQty = issuanceQty; let newTransferCredContent = await vcExport.buildVcFromContent( schemaProperties.schema,