From 3efad8a1fd4a92b3075418665adbfb1300db1207 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 31 Mar 2023 19:25:32 +0300 Subject: [PATCH 1/4] Replace Append -> Add --- components/collections/actions/actions.ts | 6 ++---- components/collections/creation/BaseMinterDetails.tsx | 2 +- pages/collections/create.tsx | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/components/collections/actions/actions.ts b/components/collections/actions/actions.ts index b1d592b..c459038 100644 --- a/components/collections/actions/actions.ts +++ b/components/collections/actions/actions.ts @@ -1,6 +1,4 @@ /* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { useBaseMinterContract } from 'contracts/baseMinter' import type { CollectionInfo, SG721Instance } from 'contracts/sg721' @@ -48,8 +46,8 @@ export interface ActionListItem { export const BASE_ACTION_LIST: ActionListItem[] = [ { id: 'mint_token_uri', - name: 'Append New Token', - description: `Mint a new token and append it to the collection`, + name: 'Add New Token', + description: `Mint a new token and add it to the collection`, }, { id: 'update_start_trading_time', diff --git a/components/collections/creation/BaseMinterDetails.tsx b/components/collections/creation/BaseMinterDetails.tsx index 71d163e..0c1678e 100644 --- a/components/collections/creation/BaseMinterDetails.tsx +++ b/components/collections/creation/BaseMinterDetails.tsx @@ -177,7 +177,7 @@ export const BaseMinterDetails = ({ onChange, minterType }: BaseMinterDetailsPro className="inline-block py-1 px-2 text-gray peer-checked:text-white hover:text-white peer-checked:bg-black peer-checked:border-b-2 hover:border-b-2 peer-checked:border-plumbus hover:border-plumbus cursor-pointer form-check-label" htmlFor="inlineRadio6" > - Append a New Token to an Existing 1/1 Collection + Add a New Token to an Existing 1/1 Collection diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index c903d3a..861dc85 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -336,7 +336,7 @@ const CollectionCreationPage: NextPage = () => { return result }) .then((result) => { - toast.success(`Token(s) minted & appended to the collection successfully! Tx Hash: ${result}`, { + toast.success(`Token(s) minted & added to the collection successfully! Tx Hash: ${result}`, { style: { maxWidth: 'none' }, duration: 5000, }) @@ -355,7 +355,7 @@ const CollectionCreationPage: NextPage = () => { .use(baseMinterDetails?.existingBaseMinter as string) ?.mint(wallet.address, `${uploadDetails?.baseTokenURI?.trim()}`) .then((result) => { - toast.success(`Token minted & appended to the collection successfully! Tx Hash: ${result}`, { + toast.success(`Token minted & added to the collection successfully! Tx Hash: ${result}`, { style: { maxWidth: 'none' }, duration: 5000, }) @@ -913,7 +913,7 @@ const CollectionCreationPage: NextPage = () => { @@ -921,7 +921,7 @@ const CollectionCreationPage: NextPage = () => {

{minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing' - ? 'Append Token' + ? 'Add Token' : 'Create Collection'}

@@ -1195,7 +1195,7 @@ const CollectionCreationPage: NextPage = () => { onClick={performUploadAndMintChecks} variant="solid" > - Mint & Append Token(s) + Mint & Add Token(s)
From babdb5fb94c09478a9d064cca0fac1c3a1e96db4 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 31 Mar 2023 19:38:26 +0300 Subject: [PATCH 2/4] Temporary update for hardcoded base minter creation fee --- .env.example | 2 +- contracts/baseFactory/contract.ts | 2 +- contracts/baseMinter/contract.ts | 2 +- pages/collections/create.tsx | 2 +- pages/contracts/baseMinter/instantiate.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 0e6262d..aec186c 100644 --- a/.env.example +++ b/.env.example @@ -7,7 +7,7 @@ NEXT_PUBLIC_VENDING_MINTER_CODE_ID=1909 NEXT_PUBLIC_BASE_MINTER_CODE_ID=1910 NEXT_PUBLIC_VENDING_FACTORY_ADDRESS="stars1ynec878x5phexq3hj4zdgvp6r5ayfmxks38kvunwyjugqn3hqeqq3cgtuw" NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS="stars1fnfywcnzzwledr93at65qm8gf953tjxgh6u2u4r8n9vsdv7u75eqe7ecn3" -NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars1sr37phnuahzsc6tpner9875g3fy69khlgvvyzgs2vjtuupw6lffqd7lark" +NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars1l0ylnyytlake550wyue5km77zzrqwfas3hna9agavjrzs73h33nqrx8zlg" NEXT_PUBLIC_BASE_FACTORY_UPDATABLE_ADDRESS="stars13pw8r33dsnghlxfj2upaywf38z2fc6npuw9maq9e5cpet4v285sscgzjp2" NEXT_PUBLIC_SG721_NAME_ADDRESS="stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr" NEXT_PUBLIC_WHITELIST_CODE_ID=1913 diff --git a/contracts/baseFactory/contract.ts b/contracts/baseFactory/contract.ts index ef4e965..6a28ab0 100644 --- a/contracts/baseFactory/contract.ts +++ b/contracts/baseFactory/contract.ts @@ -91,7 +91,7 @@ export const baseFactory = (client: SigningCosmWasmClient, txSigner: string): Ba sender: txSigner, contract: contractAddress, msg, - funds: [coin(updatable ? '3000000000' : '1000000000', 'ustars')], + funds: [coin(updatable ? '3000000000' : '250000000', 'ustars')], } } diff --git a/contracts/baseMinter/contract.ts b/contracts/baseMinter/contract.ts index c986daa..fdcb384 100644 --- a/contracts/baseMinter/contract.ts +++ b/contracts/baseMinter/contract.ts @@ -249,7 +249,7 @@ export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): Bas label: string, ): Promise => { const result = await client.instantiate(senderAddress, codeId, initMsg, label, 'auto', { - funds: [coin('1000000000', 'ustars')], + funds: [coin('250000000', 'ustars')], }) return { contractAddress: result.contractAddress, diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 861dc85..603d0f8 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -503,7 +503,7 @@ const CollectionCreationPage: NextPage = () => { messages: baseFactoryMessages, txSigner: wallet.address, msg, - funds: [coin(collectionDetails?.updatable ? '3000000000' : '1000000000', 'ustars')], + funds: [coin(collectionDetails?.updatable ? '3000000000' : '250000000', 'ustars')], updatable: collectionDetails?.updatable, } await baseFactoryDispatchExecute(payload) diff --git a/pages/contracts/baseMinter/instantiate.tsx b/pages/contracts/baseMinter/instantiate.tsx index 4bcaaa5..1deac6c 100644 --- a/pages/contracts/baseMinter/instantiate.tsx +++ b/pages/contracts/baseMinter/instantiate.tsx @@ -145,7 +145,7 @@ const BaseMinterInstantiatePage: NextPage = () => { return toast.promise( contract .use(BASE_FACTORY_ADDRESS) - ?.createBaseMinter(wallet.address, msg, [coin('1000000000', 'ustars')]) as Promise, + ?.createBaseMinter(wallet.address, msg, [coin('250000000', 'ustars')]) as Promise, { loading: 'Instantiating contract...', error: 'Instantiation failed!', From 1d1c35135f56de64e97ad535659b76b721ed31f9 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sat, 1 Apr 2023 16:45:49 +0300 Subject: [PATCH 3/4] Fetch minter creation fees prior to collection creation --- .env.example | 4 +- .../creation/CollectionDetails.tsx | 7 +- contracts/baseFactory/contract.ts | 11 +- contracts/baseFactory/messages/execute.ts | 2 +- contracts/baseMinter/contract.ts | 131 +++++++++--------- contracts/vendingFactory/contract.ts | 11 +- contracts/vendingFactory/messages/execute.ts | 2 +- pages/collections/create.tsx | 64 +++++++-- 8 files changed, 144 insertions(+), 88 deletions(-) diff --git a/.env.example b/.env.example index aec186c..9a6492a 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -APP_VERSION=0.5.3 +APP_VERSION=0.5.4 NEXT_PUBLIC_PINATA_ENDPOINT_URL=https://api.pinata.cloud/pinning/pinFileToIPFS NEXT_PUBLIC_SG721_CODE_ID=1911 @@ -7,7 +7,7 @@ NEXT_PUBLIC_VENDING_MINTER_CODE_ID=1909 NEXT_PUBLIC_BASE_MINTER_CODE_ID=1910 NEXT_PUBLIC_VENDING_FACTORY_ADDRESS="stars1ynec878x5phexq3hj4zdgvp6r5ayfmxks38kvunwyjugqn3hqeqq3cgtuw" NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS="stars1fnfywcnzzwledr93at65qm8gf953tjxgh6u2u4r8n9vsdv7u75eqe7ecn3" -NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars1l0ylnyytlake550wyue5km77zzrqwfas3hna9agavjrzs73h33nqrx8zlg" +NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars10rmaxgnjvskuumgv7e2awqkhdqdcygkwrz8a8vvt88szj7fc7xlq5jcs3f" NEXT_PUBLIC_BASE_FACTORY_UPDATABLE_ADDRESS="stars13pw8r33dsnghlxfj2upaywf38z2fc6npuw9maq9e5cpet4v285sscgzjp2" NEXT_PUBLIC_SG721_NAME_ADDRESS="stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr" NEXT_PUBLIC_WHITELIST_CODE_ID=1913 diff --git a/components/collections/creation/CollectionDetails.tsx b/components/collections/creation/CollectionDetails.tsx index 2a18af3..6d83083 100644 --- a/components/collections/creation/CollectionDetails.tsx +++ b/components/collections/creation/CollectionDetails.tsx @@ -13,6 +13,7 @@ import { Tooltip } from 'components/Tooltip' import type { ChangeEvent } from 'react' import { useEffect, useRef, useState } from 'react' import { toast } from 'react-hot-toast' +import { SG721_CODE_ID } from 'utils/constants' import { TextInput } from '../../forms/FormInput' import type { MinterType } from '../actions/Combobox' @@ -184,7 +185,9 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte
no-preview-available
)} @@ -242,7 +245,7 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte - + 0}> , updatable?: boolean) => CreateBaseMinterMessage + createBaseMinter: (msg: Record, funds: Coin[], updatable?: boolean) => CreateBaseMinterMessage } export interface CreateBaseMinterMessage { @@ -86,12 +85,16 @@ export const baseFactory = (client: SigningCosmWasmClient, txSigner: string): Ba } const messages = (contractAddress: string) => { - const createBaseMinter = (msg: Record, updatable?: boolean): CreateBaseMinterMessage => { + const createBaseMinter = ( + msg: Record, + funds: Coin[], + updatable?: boolean, + ): CreateBaseMinterMessage => { return { sender: txSigner, contract: contractAddress, msg, - funds: [coin(updatable ? '3000000000' : '250000000', 'ustars')], + funds, } } diff --git a/contracts/baseFactory/messages/execute.ts b/contracts/baseFactory/messages/execute.ts index 1bb8612..68afb40 100644 --- a/contracts/baseFactory/messages/execute.ts +++ b/contracts/baseFactory/messages/execute.ts @@ -25,5 +25,5 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => { // eslint-disable-next-line react-hooks/rules-of-hooks const { messages } = useBaseFactoryContract() const { contract } = args - return messages(contract)?.createBaseMinter(args.msg, args.updatable) + return messages(contract)?.createBaseMinter(args.msg, args.funds, args.updatable) } diff --git a/contracts/baseMinter/contract.ts b/contracts/baseMinter/contract.ts index fdcb384..1945412 100644 --- a/contracts/baseMinter/contract.ts +++ b/contracts/baseMinter/contract.ts @@ -6,7 +6,6 @@ import type { logs } from '@cosmjs/stargate' import type { Timestamp } from '@stargazezone/types/contracts/minter/shared-types' import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx' import toast from 'react-hot-toast' -import { BASE_FACTORY_ADDRESS } from 'utils/constants' export interface InstantiateResponse { readonly contractAddress: string @@ -114,10 +113,9 @@ export interface BaseMinterContract { export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): BaseMinterContract => { const use = (contractAddress: string): BaseMinterInstance => { //Query - const getFactoryParameters = async (): Promise => { - const res = await client.queryContractSmart(BASE_FACTORY_ADDRESS, { params: {} }) + const getFactoryParameters = async (factoryAddress: string): Promise => { + const res = await client.queryContractSmart(factoryAddress, { params: {} }) return res - console.log(res) } const getConfig = async (): Promise => { @@ -136,34 +134,34 @@ export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): Bas //Execute const mint = async (senderAddress: string, tokenUri: string): Promise => { - //const factoryParameters = await baseFactory?.use(BASE_FACTORY_ADDRESS)?.getParams() + const txHash = await getConfig().then(async (response) => { + const factoryParameters = await toast.promise(getFactoryParameters(response.config?.factory), { + loading: 'Querying Factory Parameters...', + error: 'Querying Factory Parameters failed!', + success: 'Query successful! Minting...', + }) + console.log(factoryParameters.params.mint_fee_bps) - const factoryParameters = await toast.promise(getFactoryParameters(), { - loading: 'Querying Factory Parameters...', - error: 'Querying Factory Parameters failed!', - success: 'Query successful! Minting...', - }) - console.log(factoryParameters.params.mint_fee_bps) - - const price = (await getConfig()).config?.mint_price.amount - if (!price) { - throw new Error( - 'Unable to retrieve a valid mint price. It may be that the given contract address does not belong to a Base Minter contract.', + const price = response.config?.mint_price.amount + if (!price) { + throw new Error( + 'Unable to retrieve a valid mint price. It may be that the given contract address does not belong to a Base Minter contract.', + ) + } + console.log((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100) + const res = await client.execute( + senderAddress, + contractAddress, + { + mint: { token_uri: tokenUri }, + }, + 'auto', + '', + [coin((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100 / 100, 'ustars')], ) - } - console.log((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100) - const res = await client.execute( - senderAddress, - contractAddress, - { - mint: { token_uri: tokenUri }, - }, - 'auto', - '', - [coin((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100 / 100, 'ustars')], - ) - - return res.transactionHash + return res.transactionHash + }) + return txHash } const updateStartTradingTime = async (senderAddress: string, time?: Timestamp): Promise => { @@ -181,42 +179,45 @@ export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): Bas } const batchMint = async (senderAddress: string, baseUri: string, batchCount: number): Promise => { - const factoryParameters = await toast.promise(getFactoryParameters(), { - loading: 'Querying Factory Parameters...', - error: 'Querying Factory Parameters failed!', - success: 'Query successful! Minting...', + const txHash = await getConfig().then(async (response) => { + const factoryParameters = await toast.promise(getFactoryParameters(response?.config?.factory), { + loading: 'Querying Factory Parameters...', + error: 'Querying Factory Parameters failed!', + success: 'Query successful! Minting...', + }) + console.log(factoryParameters.params.mint_fee_bps) + + const price = response.config?.mint_price.amount + if (!price) { + throw new Error( + 'Unable to retrieve a valid mint price. It may be that the given contract address does not belong to a Base Minter contract.', + ) + } + console.log((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100) + + const executeContractMsgs: MsgExecuteContractEncodeObject[] = [] + for (let i = 0; i < batchCount; i++) { + const msg = { + mint: { token_uri: `${baseUri}/${i + 1}` }, + } + const executeContractMsg: MsgExecuteContractEncodeObject = { + typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', + value: MsgExecuteContract.fromPartial({ + sender: senderAddress, + contract: contractAddress, + msg: toUtf8(JSON.stringify(msg)), + funds: [coin((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100 / 100, 'ustars')], + }), + } + + executeContractMsgs.push(executeContractMsg) + } + + const res = await client.signAndBroadcast(senderAddress, executeContractMsgs, 'auto', 'batch mint') + + return res.transactionHash }) - console.log(factoryParameters.params.mint_fee_bps) - - const price = (await getConfig()).config?.mint_price.amount - if (!price) { - throw new Error( - 'Unable to retrieve a valid mint price. It may be that the given contract address does not belong to a Base Minter contract.', - ) - } - console.log((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100) - - const executeContractMsgs: MsgExecuteContractEncodeObject[] = [] - for (let i = 0; i < batchCount; i++) { - const msg = { - mint: { token_uri: `${baseUri}/${i + 1}` }, - } - const executeContractMsg: MsgExecuteContractEncodeObject = { - typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', - value: MsgExecuteContract.fromPartial({ - sender: senderAddress, - contract: contractAddress, - msg: toUtf8(JSON.stringify(msg)), - funds: [coin((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100 / 100, 'ustars')], - }), - } - - executeContractMsgs.push(executeContractMsg) - } - - const res = await client.signAndBroadcast(senderAddress, executeContractMsgs, 'auto', 'batch mint') - - return res.transactionHash + return txHash } return { diff --git a/contracts/vendingFactory/contract.ts b/contracts/vendingFactory/contract.ts index 120907f..f58a34e 100644 --- a/contracts/vendingFactory/contract.ts +++ b/contracts/vendingFactory/contract.ts @@ -1,6 +1,5 @@ import type { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import type { Coin } from '@cosmjs/proto-signing' -import { coin } from '@cosmjs/proto-signing' import type { logs } from '@cosmjs/stargate' import { VENDING_FACTORY_ADDRESS } from 'utils/constants' @@ -28,7 +27,7 @@ export interface VendingFactoryInstance { } export interface VendingFactoryMessages { - createVendingMinter: (msg: Record, updatable?: boolean) => CreateVendingMinterMessage + createVendingMinter: (msg: Record, funds: Coin[], updatable?: boolean) => CreateVendingMinterMessage } export interface CreateVendingMinterMessage { @@ -79,12 +78,16 @@ export const vendingFactory = (client: SigningCosmWasmClient, txSigner: string): } const messages = (contractAddress: string) => { - const createVendingMinter = (msg: Record, updatable?: boolean): CreateVendingMinterMessage => { + const createVendingMinter = ( + msg: Record, + funds: Coin[], + updatable?: boolean, + ): CreateVendingMinterMessage => { return { sender: txSigner, contract: contractAddress, msg, - funds: [coin(updatable ? '5000000000' : '3000000000', 'ustars')], + funds, } } diff --git a/contracts/vendingFactory/messages/execute.ts b/contracts/vendingFactory/messages/execute.ts index 05cbb8c..884ac6d 100644 --- a/contracts/vendingFactory/messages/execute.ts +++ b/contracts/vendingFactory/messages/execute.ts @@ -25,5 +25,5 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => { // eslint-disable-next-line react-hooks/rules-of-hooks const { messages } = useVendingFactoryContract() const { contract } = args - return messages(contract)?.createVendingMinter(args.msg, args.updatable) + return messages(contract)?.createVendingMinter(args.msg, args.funds, args.updatable) } diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index 603d0f8..a85ecaf 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -88,6 +88,11 @@ const CollectionCreationPage: NextPage = () => { const [royaltyDetails, setRoyaltyDetails] = useState(null) const [minterType, setMinterType] = useState('vending') + const [vendingMinterCreationFee, setVendingMinterCreationFee] = useState(null) + const [baseMinterCreationFee, setBaseMinterCreationFee] = useState(null) + const [vendingMinterUpdatableCreationFee, setVendingMinterUpdatableCreationFee] = useState(null) + const [baseMinterUpdatableCreationFee, setBaseMinterUpdatableCreationFee] = useState(null) + const [uploading, setUploading] = useState(false) const [isMintingComplete, setIsMintingComplete] = useState(false) const [creatingCollection, setCreatingCollection] = useState(false) @@ -452,7 +457,14 @@ const CollectionCreationPage: NextPage = () => { messages: vendingFactoryMessages, txSigner: wallet.address, msg, - funds: [coin(collectionDetails?.updatable ? '5000000000' : '3000000000', 'ustars')], + funds: [ + coin( + collectionDetails?.updatable + ? (vendingMinterUpdatableCreationFee as string) + : (vendingMinterCreationFee as string), + 'ustars', + ), + ], updatable: collectionDetails?.updatable, } const data = await vendingFactoryDispatchExecute(payload) @@ -503,7 +515,12 @@ const CollectionCreationPage: NextPage = () => { messages: baseFactoryMessages, txSigner: wallet.address, msg, - funds: [coin(collectionDetails?.updatable ? '3000000000' : '250000000', 'ustars')], + funds: [ + coin( + collectionDetails?.updatable ? (baseMinterUpdatableCreationFee as string) : (baseMinterCreationFee as string), + 'ustars', + ), + ], updatable: collectionDetails?.updatable, } await baseFactoryDispatchExecute(payload) @@ -864,12 +881,37 @@ const CollectionCreationPage: NextPage = () => { } } + const fetchFactoryParameters = async () => { + const client = wallet.client + if (!client) return + if (BASE_FACTORY_ADDRESS) { + const baseFactoryParameters = await client.queryContractSmart(BASE_FACTORY_ADDRESS, { params: {} }) + setBaseMinterCreationFee(baseFactoryParameters?.params?.creation_fee?.amount) + } + if (BASE_FACTORY_UPDATABLE_ADDRESS) { + const baseFactoryUpdatableParameters = await client.queryContractSmart(BASE_FACTORY_UPDATABLE_ADDRESS, { + params: {}, + }) + setBaseMinterUpdatableCreationFee(baseFactoryUpdatableParameters?.params?.creation_fee?.amount) + } + if (VENDING_FACTORY_ADDRESS) { + const vendingFactoryParameters = await client.queryContractSmart(VENDING_FACTORY_ADDRESS, { params: {} }) + setVendingMinterCreationFee(vendingFactoryParameters?.params?.creation_fee?.amount) + } + if (VENDING_FACTORY_UPDATABLE_ADDRESS) { + const vendingFactoryUpdatableParameters = await client.queryContractSmart(VENDING_FACTORY_UPDATABLE_ADDRESS, { + params: {}, + }) + setVendingMinterUpdatableCreationFee(vendingFactoryUpdatableParameters?.params?.creation_fee?.amount) + } + } + const checkwalletBalance = () => { if (!wallet.initialized) throw new Error('Wallet not connected.') if (minterType === 'vending' && whitelistDetails?.whitelistType === 'new' && whitelistDetails.memberLimit) { const amountNeeded = Math.ceil(Number(whitelistDetails.memberLimit) / 1000) * 100000000 + - (collectionDetails?.updatable ? 5000000000 : 3000000000) + (collectionDetails?.updatable ? Number(vendingMinterUpdatableCreationFee) : Number(vendingMinterCreationFee)) if (amountNeeded >= Number(wallet.balance[0].amount)) throw new Error( `Insufficient wallet balance to instantiate the required contracts. Needed amount: ${( @@ -880,11 +922,11 @@ const CollectionCreationPage: NextPage = () => { const amountNeeded = minterType === 'vending' ? collectionDetails?.updatable - ? 5000000000 - : 3000000000 + ? Number(vendingMinterUpdatableCreationFee) + : Number(vendingMinterCreationFee) : collectionDetails?.updatable - ? 3000000000 - : 1000000000 + ? Number(baseMinterUpdatableCreationFee) + : Number(baseMinterCreationFee) if (amountNeeded >= Number(wallet.balance[0].amount)) throw new Error( `Insufficient wallet balance to instantiate the required contracts. Needed amount: ${( @@ -908,6 +950,10 @@ const CollectionCreationPage: NextPage = () => { setIsMintingComplete(false) }, [minterType, baseMinterDetails?.baseMinterAcquisitionMethod, uploadDetails?.uploadMethod]) + useEffect(() => { + void fetchFactoryParameters() + }, [wallet.client]) + return (
{ ipfs://{baseTokenUri as string} @@ -956,7 +1002,7 @@ const CollectionCreationPage: NextPage = () => { From abc46aad4b4fc1d18d36ed6010344f990ebe83e2 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sat, 1 Apr 2023 16:46:53 +0300 Subject: [PATCH 4/4] Bump Studio version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9a50ef..23c1db2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stargaze-studio", - "version": "0.5.3", + "version": "0.5.4", "workspaces": [ "packages/*" ],