From e4de89ad5875bdd003f777865f6863e39cd897ed Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Thu, 13 Jul 2023 12:58:03 +0300 Subject: [PATCH] Add .json extensions toggle for Collection Actions > Batch Update Metadata --- components/collections/actions/Action.tsx | 23 +++++++++++++++++++++++ components/collections/actions/actions.ts | 5 +++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/components/collections/actions/Action.tsx b/components/collections/actions/Action.tsx index 9e91783..f664a68 100644 --- a/components/collections/actions/Action.tsx +++ b/components/collections/actions/Action.tsx @@ -12,6 +12,7 @@ import { AddressInput, NumberInput } from 'components/forms/FormInput' import { useInputState, useNumberInputState } from 'components/forms/FormInput.hooks' import { InputDateTime } from 'components/InputDateTime' import { JsonPreview } from 'components/JsonPreview' +import { Tooltip } from 'components/Tooltip' import { TransactionHash } from 'components/TransactionHash' import { useWallet } from 'contexts/wallet' import type { BaseMinterInstance } from 'contracts/baseMinter' @@ -63,6 +64,7 @@ export const CollectionActions = ({ const [collectionInfo, setCollectionInfo] = useState() const [explicitContent, setExplicitContent] = useState(undefined) const [resolvedRecipientAddress, setResolvedRecipientAddress] = useState('') + const [jsonExtensions, setJsonExtensions] = useState(false) const actionComboboxState = useActionsComboboxState() const type = actionComboboxState.value?.id @@ -228,6 +230,7 @@ export const CollectionActions = ({ ? baseURIState.value.trim().slice(0, -1) : baseURIState.value.trim(), collectionInfo, + jsonExtensions, } const resolveRecipientAddress = async () => { await resolveAddress(recipientState.value.trim(), wallet).then((resolvedAddress) => { @@ -507,6 +510,26 @@ export const CollectionActions = ({ setEndTimestamp(date)} value={endTimestamp} /> + + +
+ +
+
+
diff --git a/components/collections/actions/actions.ts b/components/collections/actions/actions.ts index a1803c8..2d7c850 100644 --- a/components/collections/actions/actions.ts +++ b/components/collections/actions/actions.ts @@ -327,6 +327,7 @@ export interface DispatchExecuteArgs { tokenRecipients: AirdropAllocation[] collectionInfo: CollectionInfo | undefined baseUri: string + jsonExtensions: boolean } export const dispatchExecute = async (args: DispatchExecuteArgs) => { @@ -387,7 +388,7 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => { return sg721Messages.updateTokenMetadata(args.tokenId.toString(), args.tokenUri) } case 'batch_update_token_metadata': { - return sg721Messages.batchUpdateTokenMetadata(args.tokenIds, args.baseUri) + return sg721Messages.batchUpdateTokenMetadata(args.tokenIds, args.baseUri, args.jsonExtensions) } case 'freeze_token_metadata': { return sg721Messages.freezeTokenMetadata() @@ -494,7 +495,7 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => { return sg721Messages(sg721Contract)?.updateTokenMetadata(args.tokenId.toString(), args.tokenUri) } case 'batch_update_token_metadata': { - return sg721Messages(sg721Contract)?.batchUpdateTokenMetadata(args.tokenIds, args.baseUri) + return sg721Messages(sg721Contract)?.batchUpdateTokenMetadata(args.tokenIds, args.baseUri, args.jsonExtensions) } case 'freeze_token_metadata': { return sg721Messages(sg721Contract)?.freezeTokenMetadata()