Skip to content

Commit

Permalink
refactor(envited.ascs.digital): extract address from did when creatin…
Browse files Browse the repository at this point in the history
…g group

Signed-off-by: Roy Scheeren <[email protected]>
  • Loading branch information
royscheeren committed Dec 5, 2024
1 parent a46d123 commit f09a1ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { getAsset, updateAsset, validateAndCreateMetadata } from '../../../asset
import { ExtractedFileWithCID, ManifestExtractedFiles } from '../../../asset/types'
import { copyFile, deleteFile, readFile, writeFile } from '../../../aws'
import { createGroup, uploadFile } from '../../../ipfs'
import { log } from '../../../logger'
import { Asset, AssetMetadata, AssetStatus } from '../../../types'

export const _main =
Expand Down Expand Up @@ -141,6 +142,7 @@ export const _main =

const pinataIpfsPromises = visualizationFiles.map(
async ({ path, arrayBuffer }: { path: string; arrayBuffer: ArrayBuffer }) => {
log.info(`Uploading ${path} to IPFS`)
const group = await createGroup(metadata.minter)
return uploadFile({ arrayBuffer, filename: last(split('/', path)) as string, group })
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Database } from '../../database/types'
import { CreateGroup, UploadJson, createGroup, uploadJson } from '../../ipfs'
import { Log, log } from '../../logger'
import { Asset, Role, Session } from '../../types'
import { badRequestError, forbiddenError, notFoundError, unauthorizedError } from '../../utils'
import { badRequestError, extractAddressFromDid, forbiddenError, notFoundError, unauthorizedError } from '../../utils'

export const uploadTokenMetadataToIPFS =
({
Expand Down Expand Up @@ -53,7 +53,7 @@ export const uploadTokenMetadataToIPFS =
throw forbiddenError({ resource: 'assets', message: 'No issuer found', userId: session.user.id })
}

const group = await createGroup(user.issuerId)
const group = await createGroup(extractAddressFromDid(user.issuerId))
return uploadJson({ data: (asset as Asset).metadata, filename: 'token_info.json', group })
}

Expand Down

0 comments on commit f09a1ca

Please sign in to comment.