update publish form with DDO v4.1.0 structure (#1519)

* update publish form

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* typing quick fix

* fix build

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
This commit is contained in:
mihaisc 2022-06-15 07:35:41 -07:00 committed by GitHub
parent d523c7f0f3
commit a47fb09b91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -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<string> {
try {

View File

@ -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],