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 diff --git a/components/collections/actions/Action.tsx b/components/collections/actions/Action.tsx index f664a68..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 || 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 || 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 d21cf60..4253c56 100644 --- a/components/openEdition/OpenEditionMinterCreator.tsx +++ b/components/openEdition/OpenEditionMinterCreator.tsx @@ -474,6 +474,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.replaceAll('\\n', '\n') const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) @@ -535,7 +537,7 @@ export const OpenEditionMinterCreator = ({ ? { image: uri, name: onChainMetadataInputDetails?.name, - description: onChainMetadataInputDetails?.description, + description: onChainMetadataInputDetails?.description?.replaceAll('\\n', '\n'), attributes: onChainMetadataInputDetails?.attributes, external_url: onChainMetadataInputDetails?.external_url, animation_url: @@ -563,7 +565,7 @@ export const OpenEditionMinterCreator = ({ symbol: collectionDetails?.symbol, info: { creator: wallet.address, - description: collectionDetails?.description, + description: collectionDetails?.description.replaceAll('\\n', '\n'), image: coverImageUri, explicit_content: collectionDetails?.explicit || false, royalty_info: royaltyInfo, 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, } diff --git a/pages/badges/create.tsx b/pages/badges/create.tsx index 40089ab..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 || 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 423cd19..0053acd 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -146,6 +146,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) @@ -571,7 +572,7 @@ const CollectionCreationPage: NextPage = () => { symbol: collectionDetails?.symbol, info: { creator: wallet.address, - description: collectionDetails?.description, + description: collectionDetails?.description.replaceAll('\\n', '\n'), image: `${ uploadDetails?.uploadMethod === 'new' ? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}` @@ -632,7 +633,7 @@ const CollectionCreationPage: NextPage = () => { symbol: collectionDetails?.symbol, info: { creator: wallet.address, - description: collectionDetails?.description, + description: collectionDetails?.description.replaceAll('\\n', '\n'), image: `${ uploadDetails?.uploadMethod === 'new' ? `ipfs://${coverImageUri}/${collectionDetails?.imageFile[0].name as string}` @@ -752,6 +753,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.replaceAll('\\n', '\n') const metadataFileBlob = new Blob([JSON.stringify(data)], { type: 'application/json', }) @@ -806,6 +809,8 @@ const CollectionCreationPage: NextPage = () => { type: 'application/json', }) + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + data.description = data.description.replaceAll('\\n', '\n') console.log('Name: ', (uploadDetails.baseMinterMetadataFile as File).name) const updatedMetadataFile = new File( [metadataFileBlob], @@ -1127,7 +1132,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: {} }) @@ -1148,6 +1152,7 @@ const CollectionCreationPage: NextPage = () => { setOpenEditionMinterUpdatableCreationFee(openEditionUpdatableFactoryParameters?.params?.creation_fee?.amount) setMinimumOpenEditionUpdatableMintPrice(openEditionUpdatableFactoryParameters?.params?.min_mint_price?.amount) } + setInitialParametersFetched(true) } const fetchOpenEditionFactoryParameters = useCallback(async () => { @@ -1187,7 +1192,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, @@ -1381,7 +1386,9 @@ const CollectionCreationPage: NextPage = () => { }, [minterType, baseMinterDetails?.baseMinterAcquisitionMethod, uploadDetails?.uploadMethod]) useEffect(() => { - void fetchInitialFactoryParameters() + if (!initialParametersFetched) { + void fetchInitialFactoryParameters() + } }, [wallet.client]) useEffect(() => { 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 })