Open edition IBC minter creation success
This commit is contained in:
parent
d2d06dffae
commit
1bfd1113bb
@ -12,6 +12,7 @@ import type { MinterType } from 'components/collections/actions/Combobox'
|
|||||||
import { Conditional } from 'components/Conditional'
|
import { Conditional } from 'components/Conditional'
|
||||||
import { ConfirmationModal } from 'components/ConfirmationModal'
|
import { ConfirmationModal } from 'components/ConfirmationModal'
|
||||||
import { LoadingModal } from 'components/LoadingModal'
|
import { LoadingModal } from 'components/LoadingModal'
|
||||||
|
import { openEditionMinterList } from 'config/minter'
|
||||||
import type { TokenInfo } from 'config/token'
|
import type { TokenInfo } from 'config/token'
|
||||||
import { useContracts } from 'contexts/contracts'
|
import { useContracts } from 'contexts/contracts'
|
||||||
import { addLogItem } from 'contexts/log'
|
import { addLogItem } from 'contexts/log'
|
||||||
@ -90,10 +91,6 @@ export const OpenEditionMinterCreator = ({
|
|||||||
const { openEditionMinter: openEditionMinterContract, openEditionFactory: openEditionFactoryContract } =
|
const { openEditionMinter: openEditionMinterContract, openEditionFactory: openEditionFactoryContract } =
|
||||||
useContracts()
|
useContracts()
|
||||||
|
|
||||||
const openEditionFactoryMessages = useMemo(
|
|
||||||
() => openEditionFactoryContract?.use(OPEN_EDITION_FACTORY_ADDRESS),
|
|
||||||
[openEditionFactoryContract, wallet.address],
|
|
||||||
)
|
|
||||||
const [metadataStorageMethod, setMetadataStorageMethod] = useState<MetadataStorageMethod>('off-chain')
|
const [metadataStorageMethod, setMetadataStorageMethod] = useState<MetadataStorageMethod>('off-chain')
|
||||||
const [imageUploadDetails, setImageUploadDetails] = useState<ImageUploadDetailsDataProps | null>(null)
|
const [imageUploadDetails, setImageUploadDetails] = useState<ImageUploadDetailsDataProps | null>(null)
|
||||||
const [collectionDetails, setCollectionDetails] = useState<CollectionDetailsDataProps | null>(null)
|
const [collectionDetails, setCollectionDetails] = useState<CollectionDetailsDataProps | null>(null)
|
||||||
@ -114,6 +111,21 @@ export const OpenEditionMinterCreator = ({
|
|||||||
const [sg721ContractAddress, setSg721ContractAddress] = useState<string | null>(null)
|
const [sg721ContractAddress, setSg721ContractAddress] = useState<string | null>(null)
|
||||||
const [transactionHash, setTransactionHash] = useState<string | null>(null)
|
const [transactionHash, setTransactionHash] = useState<string | null>(null)
|
||||||
|
|
||||||
|
const factoryAddressForSelectedDenom =
|
||||||
|
openEditionMinterList.find((minter) => minter.supportedToken === mintTokenFromFactory && minter.updatable === false)
|
||||||
|
?.factoryAddress || OPEN_EDITION_FACTORY_ADDRESS
|
||||||
|
const updatableFactoryAddressForSelectedDenom =
|
||||||
|
openEditionMinterList.find((minter) => minter.supportedToken === mintTokenFromFactory && minter.updatable === true)
|
||||||
|
?.factoryAddress || OPEN_EDITION_UPDATABLE_FACTORY_ADDRESS
|
||||||
|
|
||||||
|
const openEditionFactoryMessages = useMemo(
|
||||||
|
() =>
|
||||||
|
openEditionFactoryContract?.use(
|
||||||
|
collectionDetails?.updatable ? updatableFactoryAddressForSelectedDenom : factoryAddressForSelectedDenom,
|
||||||
|
),
|
||||||
|
[openEditionFactoryContract, wallet.address],
|
||||||
|
)
|
||||||
|
|
||||||
const performOpenEditionMinterChecks = () => {
|
const performOpenEditionMinterChecks = () => {
|
||||||
try {
|
try {
|
||||||
setReadyToCreate(false)
|
setReadyToCreate(false)
|
||||||
@ -528,7 +540,7 @@ export const OpenEditionMinterCreator = ({
|
|||||||
end_time: mintingDetails?.endTime,
|
end_time: mintingDetails?.endTime,
|
||||||
mint_price: {
|
mint_price: {
|
||||||
amount: Number(mintingDetails?.unitPrice).toString(),
|
amount: Number(mintingDetails?.unitPrice).toString(),
|
||||||
denom: 'ustars',
|
denom: (mintTokenFromFactory?.denom as string) || 'ustars',
|
||||||
},
|
},
|
||||||
per_address_limit: mintingDetails?.perAddressLimit,
|
per_address_limit: mintingDetails?.perAddressLimit,
|
||||||
payment_address: mintingDetails?.paymentAddress || null,
|
payment_address: mintingDetails?.paymentAddress || null,
|
||||||
@ -550,9 +562,9 @@ export const OpenEditionMinterCreator = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('msg: ', msg)
|
console.log('msg: ', msg)
|
||||||
|
console.log('Using factory address: ', factoryAddressForSelectedDenom)
|
||||||
const payload: OpenEditionFactoryDispatchExecuteArgs = {
|
const payload: OpenEditionFactoryDispatchExecuteArgs = {
|
||||||
contract: collectionDetails?.updatable ? OPEN_EDITION_UPDATABLE_FACTORY_ADDRESS : OPEN_EDITION_FACTORY_ADDRESS,
|
contract: collectionDetails?.updatable ? updatableFactoryAddressForSelectedDenom : factoryAddressForSelectedDenom,
|
||||||
messages: openEditionFactoryMessages,
|
messages: openEditionFactoryMessages,
|
||||||
txSigner: wallet.address,
|
txSigner: wallet.address,
|
||||||
msg,
|
msg,
|
||||||
|
@ -58,7 +58,7 @@ export const openEditionUpdatableIbcUsdcMinter: MinterInfo = {
|
|||||||
id: 'open-edition-updatable-ibc-usdc-minter',
|
id: 'open-edition-updatable-ibc-usdc-minter',
|
||||||
factoryAddress: OPEN_EDITION_UPDATABLE_IBC_USDC_FACTORY_ADDRESS,
|
factoryAddress: OPEN_EDITION_UPDATABLE_IBC_USDC_FACTORY_ADDRESS,
|
||||||
supportedToken: ibcUsdc,
|
supportedToken: ibcUsdc,
|
||||||
updatable: false,
|
updatable: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const openEditionIbcFrenzMinter: MinterInfo = {
|
export const openEditionIbcFrenzMinter: MinterInfo = {
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import type { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
import type { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
||||||
import type { Coin } from '@cosmjs/proto-signing'
|
import type { Coin } from '@cosmjs/proto-signing'
|
||||||
import type { logs } from '@cosmjs/stargate'
|
import type { logs } from '@cosmjs/stargate'
|
||||||
import { OPEN_EDITION_FACTORY_ADDRESS, OPEN_EDITION_UPDATABLE_FACTORY_ADDRESS } from 'utils/constants'
|
|
||||||
|
|
||||||
export interface CreateOpenEditionMinterResponse {
|
export interface CreateOpenEditionMinterResponse {
|
||||||
readonly openEditionMinterAddress: string
|
readonly openEditionMinterAddress: string
|
||||||
@ -23,6 +22,7 @@ export interface OpenEditionFactoryInstance {
|
|||||||
msg: Record<string, unknown>,
|
msg: Record<string, unknown>,
|
||||||
funds: Coin[],
|
funds: Coin[],
|
||||||
updatable?: boolean,
|
updatable?: boolean,
|
||||||
|
selectedFactoryAddress?: string,
|
||||||
) => Promise<CreateOpenEditionMinterResponse>
|
) => Promise<CreateOpenEditionMinterResponse>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,16 +56,9 @@ export const openEditionFactory = (client: SigningCosmWasmClient, txSigner: stri
|
|||||||
senderAddress: string,
|
senderAddress: string,
|
||||||
msg: Record<string, unknown>,
|
msg: Record<string, unknown>,
|
||||||
funds: Coin[],
|
funds: Coin[],
|
||||||
updatable?: boolean,
|
|
||||||
): Promise<CreateOpenEditionMinterResponse> => {
|
): Promise<CreateOpenEditionMinterResponse> => {
|
||||||
const result = await client.execute(
|
console.log('Contract Address: ', contractAddress)
|
||||||
senderAddress,
|
const result = await client.execute(senderAddress, contractAddress, msg, 'auto', '', funds)
|
||||||
updatable ? OPEN_EDITION_UPDATABLE_FACTORY_ADDRESS : OPEN_EDITION_FACTORY_ADDRESS,
|
|
||||||
msg,
|
|
||||||
'auto',
|
|
||||||
'',
|
|
||||||
funds,
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
openEditionMinterAddress: result.logs[0].events[5].attributes[0].value,
|
openEditionMinterAddress: result.logs[0].events[5].attributes[0].value,
|
||||||
|
@ -74,7 +74,7 @@ import type { MinterType } from '../../components/collections/actions/Combobox'
|
|||||||
import type { UploadMethod } from '../../components/collections/creation/UploadDetails'
|
import type { UploadMethod } from '../../components/collections/creation/UploadDetails'
|
||||||
import { ConfirmationModal } from '../../components/ConfirmationModal'
|
import { ConfirmationModal } from '../../components/ConfirmationModal'
|
||||||
import type { OpenEditionMinterDetailsDataProps } from '../../components/openEdition/OpenEditionMinterCreator'
|
import type { OpenEditionMinterDetailsDataProps } from '../../components/openEdition/OpenEditionMinterCreator'
|
||||||
import { tokensList } from '../../config/token'
|
import { stars, tokensList } from '../../config/token'
|
||||||
import { getAssetType } from '../../utils/getAssetType'
|
import { getAssetType } from '../../utils/getAssetType'
|
||||||
import { isValidAddress } from '../../utils/isValidAddress'
|
import { isValidAddress } from '../../utils/isValidAddress'
|
||||||
|
|
||||||
@ -128,9 +128,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
const [minimumOpenEditionUpdatableMintPrice, setMinimumOpenEditionUpdatableMintPrice] = useState<string | null>('0')
|
const [minimumOpenEditionUpdatableMintPrice, setMinimumOpenEditionUpdatableMintPrice] = useState<string | null>('0')
|
||||||
const [minimumFlexMintPrice, setMinimumFlexMintPrice] = useState<string | null>('0')
|
const [minimumFlexMintPrice, setMinimumFlexMintPrice] = useState<string | null>('0')
|
||||||
|
|
||||||
const [mintTokenFromOpenEditionFactory, setMintTokenFromOpenEditionFactory] = useState<TokenInfo | undefined>(
|
const [mintTokenFromOpenEditionFactory, setMintTokenFromOpenEditionFactory] = useState<TokenInfo | undefined>(stars)
|
||||||
undefined,
|
|
||||||
)
|
|
||||||
|
|
||||||
const [uploading, setUploading] = useState(false)
|
const [uploading, setUploading] = useState(false)
|
||||||
const [isMintingComplete, setIsMintingComplete] = useState(false)
|
const [isMintingComplete, setIsMintingComplete] = useState(false)
|
||||||
@ -1153,6 +1151,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
toast.error(`${error.message}`, { style: { maxWidth: 'none' } })
|
toast.error(`${error.message}`, { style: { maxWidth: 'none' } })
|
||||||
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
||||||
})
|
})
|
||||||
|
console.log('Open Edition Factory Parameters: ', openEditionFactoryParameters)
|
||||||
setOpenEditionMinterCreationFee(openEditionFactoryParameters?.params?.creation_fee?.amount)
|
setOpenEditionMinterCreationFee(openEditionFactoryParameters?.params?.creation_fee?.amount)
|
||||||
if (!openEditionMinterDetails?.collectionDetails?.updatable) {
|
if (!openEditionMinterDetails?.collectionDetails?.updatable) {
|
||||||
setMinimumOpenEditionMintPrice(openEditionFactoryParameters?.params?.min_mint_price?.amount)
|
setMinimumOpenEditionMintPrice(openEditionFactoryParameters?.params?.min_mint_price?.amount)
|
||||||
|
Loading…
Reference in New Issue
Block a user