From a47fb09b9144c0be15e92bf9b2ba06fb9034969a Mon Sep 17 00:00:00 2001 From: mihaisc Date: Wed, 15 Jun 2022 07:35:41 -0700 Subject: [PATCH] update publish form with DDO v4.1.0 structure (#1519) * update publish form Signed-off-by: mihaisc * typing quick fix * fix build Signed-off-by: mihaisc Co-authored-by: Matthias Kretschmann --- src/@utils/provider.ts | 2 +- src/components/Publish/_utils.ts | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/@utils/provider.ts b/src/@utils/provider.ts index 5ba257d25..30497d5f6 100644 --- a/src/@utils/provider.ts +++ b/src/@utils/provider.ts @@ -9,7 +9,7 @@ import Web3 from 'web3' // TODO: Why do we have these one line functions ?!?!?! export async function getEncryptedFiles( - files: FileMetadata[], + files: any, providerUrl: string ): Promise { try { diff --git a/src/components/Publish/_utils.ts b/src/components/Publish/_utils.ts index 967505a64..503dd0856 100644 --- a/src/components/Publish/_utils.ts +++ b/src/components/Publish/_utils.ts @@ -143,13 +143,18 @@ export async function transformPublishFormToDdo( } // this is the default format hardcoded - const file = [ - { - type: 'url', - url: files[0].url, - method: 'GET' - } - ] + const file = { + nftAddress, + datatokenAddress, + files: [ + { + type: 'url', + index: 0, + url: files[0].url, + method: 'GET' + } + ] + } const filesEncrypted = !isPreview && files?.length && @@ -172,7 +177,7 @@ export async function transformPublishFormToDdo( '@context': ['https://w3id.org/did/v1'], id: did, nftAddress, - version: '4.0.0', + version: '4.1.0', chainId, metadata: newMetadata, services: [newService],