From cd0c3f1d8d823279fecbcff589de8247012570cb Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Mon, 27 Mar 2023 12:06:02 +0300 Subject: [PATCH 1/2] Conditionally disable sg721-updatable switch --- components/collections/actions/actions.ts | 2 + .../creation/CollectionDetails.tsx | 62 ++++++++++--------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/components/collections/actions/actions.ts b/components/collections/actions/actions.ts index e7d44ab..05c4c7e 100644 --- a/components/collections/actions/actions.ts +++ b/components/collections/actions/actions.ts @@ -1,3 +1,5 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ + import { useBaseMinterContract } from 'contracts/baseMinter' import type { CollectionInfo, SG721Instance } from 'contracts/sg721' import { useSG721Contract } from 'contracts/sg721' diff --git a/components/collections/creation/CollectionDetails.tsx b/components/collections/creation/CollectionDetails.tsx index 2dd528a..22691d9 100644 --- a/components/collections/creation/CollectionDetails.tsx +++ b/components/collections/creation/CollectionDetails.tsx @@ -4,6 +4,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import clsx from 'clsx' +import { Conditional } from 'components/Conditional' import { FormControl } from 'components/FormControl' import { FormGroup } from 'components/FormGroup' import { useInputState } from 'components/forms/FormInput.hooks' @@ -12,6 +13,7 @@ import { Tooltip } from 'components/Tooltip' import type { ChangeEvent } from 'react' import { useEffect, useRef, useState } from 'react' import { toast } from 'react-hot-toast' +import { SG721_UPDATABLE_CODE_ID } from 'utils/constants' import { TextInput } from '../../forms/FormInput' import type { MinterType } from '../actions/Combobox' @@ -241,36 +243,38 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte - - - ℹ️ When enabled, the metadata for tokens can be updated after the collection is created until the - collection is frozen by the creator. - - - } - placement="bottom" - > -
0}> + + + ℹ️ When enabled, the metadata for tokens can be updated after the collection is created until the + collection is frozen by the creator. + +
+ } + placement="bottom" > - - -
+
+ +
+ + ) From 28f4c81bde0a55bc3939a3e051173c4126885597 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Mon, 27 Mar 2023 12:18:39 +0300 Subject: [PATCH 2/2] Update paymentAddress checks --- components/collections/creation/MintingDetails.tsx | 2 +- pages/collections/create.tsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/collections/creation/MintingDetails.tsx b/components/collections/creation/MintingDetails.tsx index 8928051..065224a 100644 --- a/components/collections/creation/MintingDetails.tsx +++ b/components/collections/creation/MintingDetails.tsx @@ -77,7 +77,7 @@ export const MintingDetails = ({ onChange, numberOfTokens, uploadMethod }: Minti unitPrice: unitPriceState.value ? (Number(unitPriceState.value) * 1_000_000).toString() : '', perAddressLimit: perAddressLimitState.value, startTime: timestamp ? (timestamp.getTime() * 1_000_000).toString() : '', - paymentAddress: paymentAddressState.value, + paymentAddress: paymentAddressState.value.trim(), } onChange(data) // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 7f6ca39..dcce51c 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -770,7 +770,10 @@ const CollectionCreationPage: NextPage = () => { ) if (mintingDetails.startTime === '') throw new Error('Start time is required') if (Number(mintingDetails.startTime) < new Date().getTime() * 1000000) throw new Error('Invalid start time') - if (mintingDetails.paymentAddress && !isValidAddress(mintingDetails.paymentAddress)) + if ( + mintingDetails.paymentAddress && + (!isValidAddress(mintingDetails.paymentAddress) || !mintingDetails.paymentAddress.startsWith('stars1')) + ) throw new Error('Invalid payment address') }