commit
5bab23ebce
@ -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_PINATA_ENDPOINT_URL=https://api.pinata.cloud/pinning/pinFileToIPFS
|
||||||
NEXT_PUBLIC_SG721_CODE_ID=1911
|
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_BASE_MINTER_CODE_ID=1910
|
||||||
NEXT_PUBLIC_VENDING_FACTORY_ADDRESS="stars1ynec878x5phexq3hj4zdgvp6r5ayfmxks38kvunwyjugqn3hqeqq3cgtuw"
|
NEXT_PUBLIC_VENDING_FACTORY_ADDRESS="stars1ynec878x5phexq3hj4zdgvp6r5ayfmxks38kvunwyjugqn3hqeqq3cgtuw"
|
||||||
NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS="stars1fnfywcnzzwledr93at65qm8gf953tjxgh6u2u4r8n9vsdv7u75eqe7ecn3"
|
NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS="stars1fnfywcnzzwledr93at65qm8gf953tjxgh6u2u4r8n9vsdv7u75eqe7ecn3"
|
||||||
NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars1sr37phnuahzsc6tpner9875g3fy69khlgvvyzgs2vjtuupw6lffqd7lark"
|
NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars10rmaxgnjvskuumgv7e2awqkhdqdcygkwrz8a8vvt88szj7fc7xlq5jcs3f"
|
||||||
NEXT_PUBLIC_BASE_FACTORY_UPDATABLE_ADDRESS="stars13pw8r33dsnghlxfj2upaywf38z2fc6npuw9maq9e5cpet4v285sscgzjp2"
|
NEXT_PUBLIC_BASE_FACTORY_UPDATABLE_ADDRESS="stars13pw8r33dsnghlxfj2upaywf38z2fc6npuw9maq9e5cpet4v285sscgzjp2"
|
||||||
NEXT_PUBLIC_SG721_NAME_ADDRESS="stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr"
|
NEXT_PUBLIC_SG721_NAME_ADDRESS="stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr"
|
||||||
NEXT_PUBLIC_WHITELIST_CODE_ID=1913
|
NEXT_PUBLIC_WHITELIST_CODE_ID=1913
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/* eslint-disable eslint-comments/disable-enable-pair */
|
/* 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 { useBaseMinterContract } from 'contracts/baseMinter'
|
||||||
import type { CollectionInfo, SG721Instance } from 'contracts/sg721'
|
import type { CollectionInfo, SG721Instance } from 'contracts/sg721'
|
||||||
@ -48,8 +46,8 @@ export interface ActionListItem {
|
|||||||
export const BASE_ACTION_LIST: ActionListItem[] = [
|
export const BASE_ACTION_LIST: ActionListItem[] = [
|
||||||
{
|
{
|
||||||
id: 'mint_token_uri',
|
id: 'mint_token_uri',
|
||||||
name: 'Append New Token',
|
name: 'Add New Token',
|
||||||
description: `Mint a new token and append it to the collection`,
|
description: `Mint a new token and add it to the collection`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'update_start_trading_time',
|
id: 'update_start_trading_time',
|
||||||
|
@ -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"
|
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"
|
htmlFor="inlineRadio6"
|
||||||
>
|
>
|
||||||
Append a New Token to an Existing 1/1 Collection
|
Add a New Token to an Existing 1/1 Collection
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,7 +13,7 @@ import { Tooltip } from 'components/Tooltip'
|
|||||||
import type { ChangeEvent } from 'react'
|
import type { ChangeEvent } from 'react'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { toast } from 'react-hot-toast'
|
import { toast } from 'react-hot-toast'
|
||||||
import { SG721_UPDATABLE_CODE_ID } from 'utils/constants'
|
import { SG721_CODE_ID } from 'utils/constants'
|
||||||
|
|
||||||
import { TextInput } from '../../forms/FormInput'
|
import { TextInput } from '../../forms/FormInput'
|
||||||
import type { MinterType } from '../actions/Combobox'
|
import type { MinterType } from '../actions/Combobox'
|
||||||
@ -185,7 +185,9 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte
|
|||||||
<div className="max-w-[200px] max-h-[200px] rounded border-2">
|
<div className="max-w-[200px] max-h-[200px] rounded border-2">
|
||||||
<img
|
<img
|
||||||
alt="no-preview-available"
|
alt="no-preview-available"
|
||||||
src={`https://ipfs.io/ipfs/${coverImageUrl.substring(coverImageUrl.lastIndexOf('ipfs://') + 7)}`}
|
src={`https://ipfs-gw.stargaze-apis.com/ipfs/${coverImageUrl.substring(
|
||||||
|
coverImageUrl.lastIndexOf('ipfs://') + 7,
|
||||||
|
)}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -243,7 +245,7 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Conditional test={SG721_UPDATABLE_CODE_ID > 0}>
|
<Conditional test={SG721_CODE_ID > 0}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
backgroundColor="bg-blue-500"
|
backgroundColor="bg-blue-500"
|
||||||
label={
|
label={
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
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 { coin } from '@cosmjs/proto-signing'
|
|
||||||
import type { logs } from '@cosmjs/stargate'
|
import type { logs } from '@cosmjs/stargate'
|
||||||
import { BASE_FACTORY_ADDRESS } from 'utils/constants'
|
import { BASE_FACTORY_ADDRESS } from 'utils/constants'
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ export interface BaseFactoryInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BaseFactoryMessages {
|
export interface BaseFactoryMessages {
|
||||||
createBaseMinter: (msg: Record<string, unknown>, updatable?: boolean) => CreateBaseMinterMessage
|
createBaseMinter: (msg: Record<string, unknown>, funds: Coin[], updatable?: boolean) => CreateBaseMinterMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateBaseMinterMessage {
|
export interface CreateBaseMinterMessage {
|
||||||
@ -86,12 +85,16 @@ export const baseFactory = (client: SigningCosmWasmClient, txSigner: string): Ba
|
|||||||
}
|
}
|
||||||
|
|
||||||
const messages = (contractAddress: string) => {
|
const messages = (contractAddress: string) => {
|
||||||
const createBaseMinter = (msg: Record<string, unknown>, updatable?: boolean): CreateBaseMinterMessage => {
|
const createBaseMinter = (
|
||||||
|
msg: Record<string, unknown>,
|
||||||
|
funds: Coin[],
|
||||||
|
updatable?: boolean,
|
||||||
|
): CreateBaseMinterMessage => {
|
||||||
return {
|
return {
|
||||||
sender: txSigner,
|
sender: txSigner,
|
||||||
contract: contractAddress,
|
contract: contractAddress,
|
||||||
msg,
|
msg,
|
||||||
funds: [coin(updatable ? '3000000000' : '250000000', 'ustars')],
|
funds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,5 +25,5 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
|
|||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
const { messages } = useBaseFactoryContract()
|
const { messages } = useBaseFactoryContract()
|
||||||
const { contract } = args
|
const { contract } = args
|
||||||
return messages(contract)?.createBaseMinter(args.msg, args.updatable)
|
return messages(contract)?.createBaseMinter(args.msg, args.funds, args.updatable)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import type { logs } from '@cosmjs/stargate'
|
|||||||
import type { Timestamp } from '@stargazezone/types/contracts/minter/shared-types'
|
import type { Timestamp } from '@stargazezone/types/contracts/minter/shared-types'
|
||||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import { BASE_FACTORY_ADDRESS } from 'utils/constants'
|
|
||||||
|
|
||||||
export interface InstantiateResponse {
|
export interface InstantiateResponse {
|
||||||
readonly contractAddress: string
|
readonly contractAddress: string
|
||||||
@ -114,10 +113,9 @@ export interface BaseMinterContract {
|
|||||||
export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): BaseMinterContract => {
|
export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): BaseMinterContract => {
|
||||||
const use = (contractAddress: string): BaseMinterInstance => {
|
const use = (contractAddress: string): BaseMinterInstance => {
|
||||||
//Query
|
//Query
|
||||||
const getFactoryParameters = async (): Promise<any> => {
|
const getFactoryParameters = async (factoryAddress: string): Promise<any> => {
|
||||||
const res = await client.queryContractSmart(BASE_FACTORY_ADDRESS, { params: {} })
|
const res = await client.queryContractSmart(factoryAddress, { params: {} })
|
||||||
return res
|
return res
|
||||||
console.log(res)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getConfig = async (): Promise<any> => {
|
const getConfig = async (): Promise<any> => {
|
||||||
@ -136,16 +134,15 @@ export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): Bas
|
|||||||
|
|
||||||
//Execute
|
//Execute
|
||||||
const mint = async (senderAddress: string, tokenUri: string): Promise<string> => {
|
const mint = async (senderAddress: string, tokenUri: string): Promise<string> => {
|
||||||
//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), {
|
||||||
const factoryParameters = await toast.promise(getFactoryParameters(), {
|
|
||||||
loading: 'Querying Factory Parameters...',
|
loading: 'Querying Factory Parameters...',
|
||||||
error: 'Querying Factory Parameters failed!',
|
error: 'Querying Factory Parameters failed!',
|
||||||
success: 'Query successful! Minting...',
|
success: 'Query successful! Minting...',
|
||||||
})
|
})
|
||||||
console.log(factoryParameters.params.mint_fee_bps)
|
console.log(factoryParameters.params.mint_fee_bps)
|
||||||
|
|
||||||
const price = (await getConfig()).config?.mint_price.amount
|
const price = response.config?.mint_price.amount
|
||||||
if (!price) {
|
if (!price) {
|
||||||
throw new Error(
|
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.',
|
'Unable to retrieve a valid mint price. It may be that the given contract address does not belong to a Base Minter contract.',
|
||||||
@ -162,8 +159,9 @@ export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): Bas
|
|||||||
'',
|
'',
|
||||||
[coin((Number(price) * Number(factoryParameters.params.mint_fee_bps)) / 100 / 100, 'ustars')],
|
[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<string> => {
|
const updateStartTradingTime = async (senderAddress: string, time?: Timestamp): Promise<string> => {
|
||||||
@ -181,14 +179,15 @@ export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): Bas
|
|||||||
}
|
}
|
||||||
|
|
||||||
const batchMint = async (senderAddress: string, baseUri: string, batchCount: number): Promise<string> => {
|
const batchMint = async (senderAddress: string, baseUri: string, batchCount: number): Promise<string> => {
|
||||||
const factoryParameters = await toast.promise(getFactoryParameters(), {
|
const txHash = await getConfig().then(async (response) => {
|
||||||
|
const factoryParameters = await toast.promise(getFactoryParameters(response?.config?.factory), {
|
||||||
loading: 'Querying Factory Parameters...',
|
loading: 'Querying Factory Parameters...',
|
||||||
error: 'Querying Factory Parameters failed!',
|
error: 'Querying Factory Parameters failed!',
|
||||||
success: 'Query successful! Minting...',
|
success: 'Query successful! Minting...',
|
||||||
})
|
})
|
||||||
console.log(factoryParameters.params.mint_fee_bps)
|
console.log(factoryParameters.params.mint_fee_bps)
|
||||||
|
|
||||||
const price = (await getConfig()).config?.mint_price.amount
|
const price = response.config?.mint_price.amount
|
||||||
if (!price) {
|
if (!price) {
|
||||||
throw new Error(
|
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.',
|
'Unable to retrieve a valid mint price. It may be that the given contract address does not belong to a Base Minter contract.',
|
||||||
@ -217,6 +216,8 @@ export const baseMinter = (client: SigningCosmWasmClient, txSigner: string): Bas
|
|||||||
const res = await client.signAndBroadcast(senderAddress, executeContractMsgs, 'auto', 'batch mint')
|
const res = await client.signAndBroadcast(senderAddress, executeContractMsgs, 'auto', 'batch mint')
|
||||||
|
|
||||||
return res.transactionHash
|
return res.transactionHash
|
||||||
|
})
|
||||||
|
return txHash
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
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 { coin } from '@cosmjs/proto-signing'
|
|
||||||
import type { logs } from '@cosmjs/stargate'
|
import type { logs } from '@cosmjs/stargate'
|
||||||
import { VENDING_FACTORY_ADDRESS } from 'utils/constants'
|
import { VENDING_FACTORY_ADDRESS } from 'utils/constants'
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ export interface VendingFactoryInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface VendingFactoryMessages {
|
export interface VendingFactoryMessages {
|
||||||
createVendingMinter: (msg: Record<string, unknown>, updatable?: boolean) => CreateVendingMinterMessage
|
createVendingMinter: (msg: Record<string, unknown>, funds: Coin[], updatable?: boolean) => CreateVendingMinterMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateVendingMinterMessage {
|
export interface CreateVendingMinterMessage {
|
||||||
@ -79,12 +78,16 @@ export const vendingFactory = (client: SigningCosmWasmClient, txSigner: string):
|
|||||||
}
|
}
|
||||||
|
|
||||||
const messages = (contractAddress: string) => {
|
const messages = (contractAddress: string) => {
|
||||||
const createVendingMinter = (msg: Record<string, unknown>, updatable?: boolean): CreateVendingMinterMessage => {
|
const createVendingMinter = (
|
||||||
|
msg: Record<string, unknown>,
|
||||||
|
funds: Coin[],
|
||||||
|
updatable?: boolean,
|
||||||
|
): CreateVendingMinterMessage => {
|
||||||
return {
|
return {
|
||||||
sender: txSigner,
|
sender: txSigner,
|
||||||
contract: contractAddress,
|
contract: contractAddress,
|
||||||
msg,
|
msg,
|
||||||
funds: [coin(updatable ? '5000000000' : '3000000000', 'ustars')],
|
funds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,5 +25,5 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => {
|
|||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
const { messages } = useVendingFactoryContract()
|
const { messages } = useVendingFactoryContract()
|
||||||
const { contract } = args
|
const { contract } = args
|
||||||
return messages(contract)?.createVendingMinter(args.msg, args.updatable)
|
return messages(contract)?.createVendingMinter(args.msg, args.funds, args.updatable)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stargaze-studio",
|
"name": "stargaze-studio",
|
||||||
"version": "0.5.3",
|
"version": "0.5.4",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
|
@ -88,6 +88,11 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
const [royaltyDetails, setRoyaltyDetails] = useState<RoyaltyDetailsDataProps | null>(null)
|
const [royaltyDetails, setRoyaltyDetails] = useState<RoyaltyDetailsDataProps | null>(null)
|
||||||
const [minterType, setMinterType] = useState<MinterType>('vending')
|
const [minterType, setMinterType] = useState<MinterType>('vending')
|
||||||
|
|
||||||
|
const [vendingMinterCreationFee, setVendingMinterCreationFee] = useState<string | null>(null)
|
||||||
|
const [baseMinterCreationFee, setBaseMinterCreationFee] = useState<string | null>(null)
|
||||||
|
const [vendingMinterUpdatableCreationFee, setVendingMinterUpdatableCreationFee] = useState<string | null>(null)
|
||||||
|
const [baseMinterUpdatableCreationFee, setBaseMinterUpdatableCreationFee] = useState<string | null>(null)
|
||||||
|
|
||||||
const [uploading, setUploading] = useState(false)
|
const [uploading, setUploading] = useState(false)
|
||||||
const [isMintingComplete, setIsMintingComplete] = useState(false)
|
const [isMintingComplete, setIsMintingComplete] = useState(false)
|
||||||
const [creatingCollection, setCreatingCollection] = useState(false)
|
const [creatingCollection, setCreatingCollection] = useState(false)
|
||||||
@ -336,7 +341,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
.then((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' },
|
style: { maxWidth: 'none' },
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
})
|
})
|
||||||
@ -355,7 +360,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
.use(baseMinterDetails?.existingBaseMinter as string)
|
.use(baseMinterDetails?.existingBaseMinter as string)
|
||||||
?.mint(wallet.address, `${uploadDetails?.baseTokenURI?.trim()}`)
|
?.mint(wallet.address, `${uploadDetails?.baseTokenURI?.trim()}`)
|
||||||
.then((result) => {
|
.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' },
|
style: { maxWidth: 'none' },
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
})
|
})
|
||||||
@ -452,7 +457,14 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
messages: vendingFactoryMessages,
|
messages: vendingFactoryMessages,
|
||||||
txSigner: wallet.address,
|
txSigner: wallet.address,
|
||||||
msg,
|
msg,
|
||||||
funds: [coin(collectionDetails?.updatable ? '5000000000' : '3000000000', 'ustars')],
|
funds: [
|
||||||
|
coin(
|
||||||
|
collectionDetails?.updatable
|
||||||
|
? (vendingMinterUpdatableCreationFee as string)
|
||||||
|
: (vendingMinterCreationFee as string),
|
||||||
|
'ustars',
|
||||||
|
),
|
||||||
|
],
|
||||||
updatable: collectionDetails?.updatable,
|
updatable: collectionDetails?.updatable,
|
||||||
}
|
}
|
||||||
const data = await vendingFactoryDispatchExecute(payload)
|
const data = await vendingFactoryDispatchExecute(payload)
|
||||||
@ -503,7 +515,12 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
messages: baseFactoryMessages,
|
messages: baseFactoryMessages,
|
||||||
txSigner: wallet.address,
|
txSigner: wallet.address,
|
||||||
msg,
|
msg,
|
||||||
funds: [coin(collectionDetails?.updatable ? '3000000000' : '250000000', 'ustars')],
|
funds: [
|
||||||
|
coin(
|
||||||
|
collectionDetails?.updatable ? (baseMinterUpdatableCreationFee as string) : (baseMinterCreationFee as string),
|
||||||
|
'ustars',
|
||||||
|
),
|
||||||
|
],
|
||||||
updatable: collectionDetails?.updatable,
|
updatable: collectionDetails?.updatable,
|
||||||
}
|
}
|
||||||
await baseFactoryDispatchExecute(payload)
|
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 = () => {
|
const checkwalletBalance = () => {
|
||||||
if (!wallet.initialized) throw new Error('Wallet not connected.')
|
if (!wallet.initialized) throw new Error('Wallet not connected.')
|
||||||
if (minterType === 'vending' && whitelistDetails?.whitelistType === 'new' && whitelistDetails.memberLimit) {
|
if (minterType === 'vending' && whitelistDetails?.whitelistType === 'new' && whitelistDetails.memberLimit) {
|
||||||
const amountNeeded =
|
const amountNeeded =
|
||||||
Math.ceil(Number(whitelistDetails.memberLimit) / 1000) * 100000000 +
|
Math.ceil(Number(whitelistDetails.memberLimit) / 1000) * 100000000 +
|
||||||
(collectionDetails?.updatable ? 5000000000 : 3000000000)
|
(collectionDetails?.updatable ? Number(vendingMinterUpdatableCreationFee) : Number(vendingMinterCreationFee))
|
||||||
if (amountNeeded >= Number(wallet.balance[0].amount))
|
if (amountNeeded >= Number(wallet.balance[0].amount))
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Insufficient wallet balance to instantiate the required contracts. Needed amount: ${(
|
`Insufficient wallet balance to instantiate the required contracts. Needed amount: ${(
|
||||||
@ -880,11 +922,11 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
const amountNeeded =
|
const amountNeeded =
|
||||||
minterType === 'vending'
|
minterType === 'vending'
|
||||||
? collectionDetails?.updatable
|
? collectionDetails?.updatable
|
||||||
? 5000000000
|
? Number(vendingMinterUpdatableCreationFee)
|
||||||
: 3000000000
|
: Number(vendingMinterCreationFee)
|
||||||
: collectionDetails?.updatable
|
: collectionDetails?.updatable
|
||||||
? 3000000000
|
? Number(baseMinterUpdatableCreationFee)
|
||||||
: 250000000
|
: Number(baseMinterCreationFee)
|
||||||
if (amountNeeded >= Number(wallet.balance[0].amount))
|
if (amountNeeded >= Number(wallet.balance[0].amount))
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Insufficient wallet balance to instantiate the required contracts. Needed amount: ${(
|
`Insufficient wallet balance to instantiate the required contracts. Needed amount: ${(
|
||||||
@ -908,12 +950,16 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
setIsMintingComplete(false)
|
setIsMintingComplete(false)
|
||||||
}, [minterType, baseMinterDetails?.baseMinterAcquisitionMethod, uploadDetails?.uploadMethod])
|
}, [minterType, baseMinterDetails?.baseMinterAcquisitionMethod, uploadDetails?.uploadMethod])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
void fetchFactoryParameters()
|
||||||
|
}, [wallet.client])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<NextSeo
|
<NextSeo
|
||||||
title={
|
title={
|
||||||
minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing'
|
minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing'
|
||||||
? 'Append Token'
|
? 'Add Token'
|
||||||
: 'Create Collection'
|
: 'Create Collection'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -921,7 +967,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
<div className="mt-5 space-y-5 text-center">
|
<div className="mt-5 space-y-5 text-center">
|
||||||
<h1 className="font-heading text-4xl font-bold">
|
<h1 className="font-heading text-4xl font-bold">
|
||||||
{minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing'
|
{minterType === 'base' && baseMinterDetails?.baseMinterAcquisitionMethod === 'existing'
|
||||||
? 'Append Token'
|
? 'Add Token'
|
||||||
: 'Create Collection'}
|
: 'Create Collection'}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
@ -947,7 +993,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
<Anchor
|
<Anchor
|
||||||
className="text-stargaze hover:underline"
|
className="text-stargaze hover:underline"
|
||||||
external
|
external
|
||||||
href={`https://ipfs.stargaze.zone/ipfs/${baseTokenUri as string}`}
|
href={`https://ipfs-gw.stargaze-apis.com/ipfs/${baseTokenUri as string}`}
|
||||||
>
|
>
|
||||||
ipfs://{baseTokenUri as string}
|
ipfs://{baseTokenUri as string}
|
||||||
</Anchor>
|
</Anchor>
|
||||||
@ -956,7 +1002,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
<Anchor
|
<Anchor
|
||||||
className="text-stargaze hover:underline"
|
className="text-stargaze hover:underline"
|
||||||
external
|
external
|
||||||
href={`https://ipfs.stargaze.zone/ipfs/${baseTokenUri?.substring(
|
href={`https://ipfs-gw.stargaze-apis.com/ipfs/${baseTokenUri?.substring(
|
||||||
baseTokenUri.lastIndexOf('ipfs://') + 7,
|
baseTokenUri.lastIndexOf('ipfs://') + 7,
|
||||||
)}/`}
|
)}/`}
|
||||||
>
|
>
|
||||||
@ -1195,7 +1241,7 @@ const CollectionCreationPage: NextPage = () => {
|
|||||||
onClick={performUploadAndMintChecks}
|
onClick={performUploadAndMintChecks}
|
||||||
variant="solid"
|
variant="solid"
|
||||||
>
|
>
|
||||||
Mint & Append Token(s)
|
Mint & Add Token(s)
|
||||||
</Button>
|
</Button>
|
||||||
</Conditional>
|
</Conditional>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user