From 3d527c668265f4ea80aa99eb99c423e386b9fdd3 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 4 Aug 2023 10:11:34 +0300 Subject: [PATCH 1/2] Avoid escaping line breaks in token and collection descriptions --- components/openEdition/OpenEditionMinterCreator.tsx | 6 ++++-- pages/badges/create.tsx | 2 +- pages/collections/create.tsx | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/components/openEdition/OpenEditionMinterCreator.tsx b/components/openEdition/OpenEditionMinterCreator.tsx index 3f0fce3..ab2b725 100644 --- a/components/openEdition/OpenEditionMinterCreator.tsx +++ b/components/openEdition/OpenEditionMinterCreator.tsx @@ -435,6 +435,8 @@ export const OpenEditionMinterCreator = ({ if (getAssetType(offChainMetadataUploadDetails.assetFiles[0].name) !== 'html') data.image = `ipfs://${assetUri}/${offChainMetadataUploadDetails.assetFiles[0].name}` + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + data.description = data.description.replace('\\n', '\n') const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) @@ -496,7 +498,7 @@ export const OpenEditionMinterCreator = ({ ? { image: uri, name: onChainMetadataInputDetails?.name, - description: onChainMetadataInputDetails?.description, + description: onChainMetadataInputDetails?.description?.replace('\\n', '\n'), attributes: onChainMetadataInputDetails?.attributes, external_url: onChainMetadataInputDetails?.external_url, animation_url: @@ -524,7 +526,7 @@ export const OpenEditionMinterCreator = ({ symbol: collectionDetails?.symbol, info: { creator: wallet.address, - description: collectionDetails?.description, + description: collectionDetails?.description.replace('\\n', '\n'), image: coverImageUri, explicit_content: collectionDetails?.explicit || false, royalty_info: royaltyInfo, diff --git a/pages/badges/create.tsx b/pages/badges/create.tsx index 40089ab..1cfc4cc 100644 --- a/pages/badges/create.tsx +++ b/pages/badges/create.tsx @@ -189,7 +189,7 @@ const BadgeCreationPage: NextPage = () => { manager: badgeDetails?.manager as string, metadata: { name: badgeDetails?.name || undefined, - description: badgeDetails?.description || undefined, + description: badgeDetails?.description?.replace('\\n', '\n') || undefined, image: coverUrl || undefined, image_data: badgeDetails?.image_data || undefined, external_url: badgeDetails?.external_url || undefined, diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 6a99323..768b44f 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -547,7 +547,7 @@ const CollectionCreationPage: NextPage = () => { symbol: collectionDetails?.symbol, info: { creator: wallet.address, - description: collectionDetails?.description, + description: collectionDetails?.description.replace('\\n', '\n'), image: `${ uploadDetails?.uploadMethod === 'new' ? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}` @@ -613,7 +613,7 @@ const CollectionCreationPage: NextPage = () => { symbol: collectionDetails?.symbol, info: { creator: wallet.address, - description: collectionDetails?.description, + description: collectionDetails?.description.replace('\\n', '\n'), image: `${ uploadDetails?.uploadMethod === 'new' ? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}` @@ -735,6 +735,8 @@ const CollectionCreationPage: NextPage = () => { if (getAssetType(uploadDetails.assetFiles[i].name) !== 'html') data.image = `ipfs://${assetUri}/${uploadDetails.assetFiles[i].name}` + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + data.description = data.description.replace('\\n', '\n') const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) @@ -789,6 +791,8 @@ const CollectionCreationPage: NextPage = () => { type: 'application/json', }) + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + data.description = data.description.replace('\\n', '\n') console.log('Name: ', (uploadDetails.baseMinterMetadataFile as File).name) const updatedMetadataFile = new File( [metadataFileBlob], From c5e321e7f438461aa289ce6446c579e623e955ad Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 4 Aug 2023 10:22:11 +0300 Subject: [PATCH 2/2] Cover collection updates --- components/collections/actions/Action.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/collections/actions/Action.tsx b/components/collections/actions/Action.tsx index f664a68..b53b20e 100644 --- a/components/collections/actions/Action.tsx +++ b/components/collections/actions/Action.tsx @@ -244,7 +244,7 @@ export const CollectionActions = ({ const resolveRoyaltyPaymentAddress = async () => { await resolveAddress(royaltyPaymentAddressState.value.trim(), wallet).then((resolvedAddress) => { setCollectionInfo({ - description: descriptionState.value || undefined, + description: descriptionState.value.replace('\\n', '\n') || undefined, image: imageState.value || undefined, explicit_content: explicitContent, external_link: externalLinkState.value || undefined, @@ -265,7 +265,7 @@ export const CollectionActions = ({ useEffect(() => { setCollectionInfo({ - description: descriptionState.value || undefined, + description: descriptionState.value.replace('\\n', '\n') || undefined, image: imageState.value || undefined, explicit_content: explicitContent, external_link: externalLinkState.value || undefined,