Merge branch 'develop' into export-import-collection-config

This commit is contained in:
Serkan Reis 2023-08-17 17:24:27 +03:00
commit bc719e1a0c
7 changed files with 123 additions and 13 deletions

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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,
}

View File

@ -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,

View File

@ -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(() => {

96
pages/revoke.tsx Normal file
View File

@ -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<string | undefined>(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 (
<section className="py-6 px-12 space-y-4">
<NextSeo title="Revoke Authorization" />
<ContractPageHeader description="Revoke Authorization." link={links.Documentation} title="Revoke Authorization" />
<TextInput {...granteeAddressState} />
<div className="font-bold">Message Types</div>
<select
className="py-2 px-4 bg-black border-2 border-white"
onChange={(e) => messageState.onChange(e.target.value)}
>
<option className="bg-black" value="/cosmos.bank.v1beta1.MsgSend">
/cosmos.bank.v1beta1.MsgSend
</option>
<option className="bg-black" value="/cosmos.staking.v1beta1.MsgUndelegate">
/cosmos.staking.v1beta1.MsgUndelegate
</option>
</select>
<TextInput {...messageState} />
<button
className="text-white bg-stargaze btn"
onClick={() => void revokeAuthorization(granteeAddressState.value, messageState.value)}
type="button"
>
Revoke Authorization
</button>
{transactionHash && (
<div className="justify-center items-center space-y-2">{`Transaction Hash: ${transactionHash}`}</div>
)}
</section>
)
}
export default withMetadata(RevokeAuthorization, { center: false })