From 7003325d5d1b5a28e3f77fd7ccae8150074f1b07 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Thu, 3 Aug 2023 00:31:55 +0300 Subject: [PATCH 1/7] Add temporary revoke authorization UI --- pages/revoke.tsx | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 pages/revoke.tsx diff --git a/pages/revoke.tsx b/pages/revoke.tsx new file mode 100644 index 0000000..0fd5301 --- /dev/null +++ b/pages/revoke.tsx @@ -0,0 +1,96 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +import { coins } from '@cosmjs/proto-signing' +import { ContractPageHeader } from 'components/ContractPageHeader' +import { TextInput } from 'components/forms/FormInput' +import { useInputState } from 'components/forms/FormInput.hooks' +import { useWallet } from 'contexts/wallet' +import type { NextPage } from 'next' +import { NextSeo } from 'next-seo' +import { useState } from 'react' +import toast from 'react-hot-toast' +import { withMetadata } from 'utils/layout' +import { links } from 'utils/links' + +const RevokeAuthorization: NextPage = () => { + const wallet = useWallet() + const client = wallet.getClient() + + const [transactionHash, setTransactionHash] = useState(undefined) + + const granteeAddressState = useInputState({ + id: 'grantee-address', + name: 'granteeAddress', + title: 'Grantee Address', + subtitle: 'Address to revoke message authorization', + placeholder: 'stars1234567890abcdefghijklmnopqrstuvwxyz...', + defaultValue: 'stars12vfpmlvmqrh9p0kcrtv6lw9ylkh7reuczdmmz5', + }) + + const messageState = useInputState({ + id: 'message', + name: 'message', + title: 'Message', + subtitle: 'Message to revoke authorization for', + placeholder: '/cosmos.bank.v1beta1.MsgSend', + defaultValue: '/cosmos.bank.v1beta1.MsgSend', + }) + + const revokeAuthorization = async (granteeAddress: string, msg: string) => { + console.log('Wallet Address: ', wallet.address) + try { + await wallet.connect() + const result = await client.signAndBroadcast( + wallet.address, + [ + { + typeUrl: '/cosmos.authz.v1beta1.MsgRevoke', + value: { + granter: wallet.address, + grantee: granteeAddress, + msgTypeUrl: msg, + funds: coins('100000', 'ustars'), + }, + }, + ], + 'auto', + ) + setTransactionHash(result.transactionHash) + } catch (e: any) { + console.log(e) + toast.error(e.message, { style: { maxWidth: 'none' } }) + } + } + + return ( +
+ + + +
Message Types
+ + + + {transactionHash && ( +
{`Transaction Hash: ${transactionHash}`}
+ )} +
+ ) +} +export default withMetadata(RevokeAuthorization, { center: false }) From 3d527c668265f4ea80aa99eb99c423e386b9fdd3 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 4 Aug 2023 10:11:34 +0300 Subject: [PATCH 2/7] 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 3/7] 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, From 18cdef95806903a32df0a6336e29277502123b75 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 4 Aug 2023 11:54:22 +0300 Subject: [PATCH 4/7] Fix: Use replaceAll instead of replace to ignore all escaped line breaks --- components/collections/actions/Action.tsx | 4 ++-- components/openEdition/OpenEditionMinterCreator.tsx | 6 +++--- pages/badges/create.tsx | 2 +- pages/collections/create.tsx | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/collections/actions/Action.tsx b/components/collections/actions/Action.tsx index b53b20e..11275d3 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.replace('\\n', '\n') || undefined, + description: descriptionState.value.replaceAll('\\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.replace('\\n', '\n') || undefined, + description: descriptionState.value.replaceAll('\\n', '\n') || undefined, image: imageState.value || undefined, explicit_content: explicitContent, external_link: externalLinkState.value || undefined, diff --git a/components/openEdition/OpenEditionMinterCreator.tsx b/components/openEdition/OpenEditionMinterCreator.tsx index ab2b725..3260caa 100644 --- a/components/openEdition/OpenEditionMinterCreator.tsx +++ b/components/openEdition/OpenEditionMinterCreator.tsx @@ -436,7 +436,7 @@ export const OpenEditionMinterCreator = ({ data.image = `ipfs://${assetUri}/${offChainMetadataUploadDetails.assetFiles[0].name}` // eslint-disable-next-line @typescript-eslint/no-unsafe-call - data.description = data.description.replace('\\n', '\n') + data.description = data.description.replaceAll('\\n', '\n') const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) @@ -498,7 +498,7 @@ export const OpenEditionMinterCreator = ({ ? { image: uri, name: onChainMetadataInputDetails?.name, - description: onChainMetadataInputDetails?.description?.replace('\\n', '\n'), + description: onChainMetadataInputDetails?.description?.replaceAll('\\n', '\n'), attributes: onChainMetadataInputDetails?.attributes, external_url: onChainMetadataInputDetails?.external_url, animation_url: @@ -526,7 +526,7 @@ export const OpenEditionMinterCreator = ({ symbol: collectionDetails?.symbol, info: { creator: wallet.address, - description: collectionDetails?.description.replace('\\n', '\n'), + description: collectionDetails?.description.replaceAll('\\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 1cfc4cc..61f39ad 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?.replace('\\n', '\n') || undefined, + description: badgeDetails?.description?.replaceAll('\\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 768b44f..e4c1636 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.replace('\\n', '\n'), + description: collectionDetails?.description.replaceAll('\\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.replace('\\n', '\n'), + description: collectionDetails?.description.replaceAll('\\n', '\n'), image: `${ uploadDetails?.uploadMethod === 'new' ? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}` @@ -736,7 +736,7 @@ const CollectionCreationPage: NextPage = () => { data.image = `ipfs://${assetUri}/${uploadDetails.assetFiles[i].name}` // eslint-disable-next-line @typescript-eslint/no-unsafe-call - data.description = data.description.replace('\\n', '\n') + data.description = data.description.replaceAll('\\n', '\n') const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) @@ -792,7 +792,7 @@ const CollectionCreationPage: NextPage = () => { }) // eslint-disable-next-line @typescript-eslint/no-unsafe-call - data.description = data.description.replace('\\n', '\n') + data.description = data.description.replaceAll('\\n', '\n') console.log('Name: ', (uploadDetails.baseMinterMetadataFile as File).name) const updatedMetadataFile = new File( [metadataFileBlob], From 702e47e9e6500d61d3ec8415db05642bcf199aff Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Tue, 15 Aug 2023 20:06:53 +0300 Subject: [PATCH 5/7] Update FRNZ denom for testnet --- config/token.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/token.ts b/config/token.ts index af49d99..7cb99b6 100644 --- a/config/token.ts +++ b/config/token.ts @@ -1,3 +1,5 @@ +import { NETWORK } from 'utils/constants' + export interface TokenInfo { id: string denom: string @@ -30,7 +32,10 @@ export const ibcUsdc: TokenInfo = { export const ibcFrnz: TokenInfo = { id: 'ibc-frnz', - denom: 'ibc/7FA7EC64490E3BDE5A1A28CBE73CC0AD22522794957BC891C46321E3A6074DB9', + denom: + NETWORK === 'mainnet' + ? 'ibc/7FA7EC64490E3BDE5A1A28CBE73CC0AD22522794957BC891C46321E3A6074DB9' + : 'factory/stars10w5eulj60qp3cfqa0hkmke78qdy2feq6x9xdmd/ufrnz', displayName: 'FRNZ', decimalPlaces: 6, } From 3c392381b246974733ca6a07eed1ad3d098cf70b Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Tue, 15 Aug 2023 20:07:51 +0300 Subject: [PATCH 6/7] Address invalid creation fee problem following minting denom change --- pages/collections/create.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 7642a42..70868ff 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -134,6 +134,7 @@ const CollectionCreationPage: NextPage = () => { const [uploading, setUploading] = useState(false) const [isMintingComplete, setIsMintingComplete] = useState(false) + const [initialParametersFetched, setInitialParametersFetched] = useState(false) const [creatingCollection, setCreatingCollection] = useState(false) const [readyToCreateVm, setReadyToCreateVm] = useState(false) const [readyToCreateBm, setReadyToCreateBm] = useState(false) @@ -1115,7 +1116,6 @@ const CollectionCreationPage: NextPage = () => { setVendingMinterFlexCreationFee(vendingFactoryFlexParameters?.params?.creation_fee?.amount) setMinimumFlexMintPrice(vendingFactoryFlexParameters?.params?.min_mint_price?.amount) } - if (OPEN_EDITION_FACTORY_ADDRESS) { const openEditionFactoryParameters = await client .queryContractSmart(OPEN_EDITION_FACTORY_ADDRESS, { params: {} }) @@ -1136,6 +1136,7 @@ const CollectionCreationPage: NextPage = () => { setOpenEditionMinterUpdatableCreationFee(openEditionUpdatableFactoryParameters?.params?.creation_fee?.amount) setMinimumOpenEditionUpdatableMintPrice(openEditionUpdatableFactoryParameters?.params?.min_mint_price?.amount) } + setInitialParametersFetched(true) } const fetchOpenEditionFactoryParameters = useCallback(async () => { @@ -1175,7 +1176,7 @@ const CollectionCreationPage: NextPage = () => { }) setOpenEditionMinterUpdatableCreationFee(openEditionUpdatableFactoryParameters?.params?.creation_fee?.amount) if (openEditionMinterDetails?.collectionDetails?.updatable) { - setMinimumOpenEditionMintPrice(openEditionUpdatableFactoryParameters?.params?.min_mint_price?.amount) + setMinimumOpenEditionUpdatableMintPrice(openEditionUpdatableFactoryParameters?.params?.min_mint_price?.amount) setMintTokenFromOpenEditionFactory( tokensList.find( (token) => token.denom === openEditionUpdatableFactoryParameters?.params?.min_mint_price?.denom, @@ -1319,7 +1320,9 @@ const CollectionCreationPage: NextPage = () => { }, [minterType, baseMinterDetails?.baseMinterAcquisitionMethod, uploadDetails?.uploadMethod]) useEffect(() => { - void fetchInitialFactoryParameters() + if (!initialParametersFetched) { + void fetchInitialFactoryParameters() + } }, [wallet.client]) useEffect(() => { From ea5caff1aa2ef599a8d0bdbcde9aae81efc06e83 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Tue, 15 Aug 2023 20:09:35 +0300 Subject: [PATCH 7/7] Update .env.example --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index e460d2a..ffe2835 100644 --- a/.env.example +++ b/.env.example @@ -35,8 +35,8 @@ NEXT_PUBLIC_OPEN_EDITION_UPDATABLE_FACTORY_ADDRESS="stars1fk5dkzcylam8mcpqrn8y9s # NEXT_PUBLIC_OPEN_EDITION_UPDATABLE_IBC_ATOM_FACTORY_ADDRESS= # NEXT_PUBLIC_OPEN_EDITION_IBC_USDC_FACTORY_ADDRESS= # NEXT_PUBLIC_OPEN_EDITION_UPDATABLE_IBC_USDC_FACTORY_ADDRESS= -# NEXT_PUBLIC_OPEN_EDITION_IBC_FRNZ_FACTORY_ADDRESS= -# NEXT_PUBLIC_OPEN_EDITION_UPDATABLE_IBC_FRNZ_FACTORY_ADDRESS= +NEXT_PUBLIC_OPEN_EDITION_IBC_FRNZ_FACTORY_ADDRESS="stars1vzffawsjhvspstu5lvtzz2x5n7zh07hnw09c9dfxcj78un05rcms5n3q3e" +NEXT_PUBLIC_OPEN_EDITION_UPDATABLE_IBC_FRNZ_FACTORY_ADDRESS="stars1tc09vlgdg8rqyapcxwm9qdq8naj4gym9px4ntue9cs0kse5rvess0nee3a" NEXT_PUBLIC_SG721_NAME_ADDRESS="stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr" NEXT_PUBLIC_WHITELIST_CODE_ID=2602