Update collection creation logic

This commit is contained in:
Serkan Reis 2024-04-02 22:58:51 +03:00
parent 85ac7a4f71
commit a295dd5d4a
7 changed files with 173 additions and 38 deletions

View File

@ -16,8 +16,9 @@ NEXT_PUBLIC_VENDING_FACTORY_ADDRESS="stars18h7ugh8eaug7wr0w4yjw0ls5s937z35pnkg93
NEXT_PUBLIC_FEATURED_VENDING_FACTORY_ADDRESS="stars14pd96yk3t6gq9l6uyrkg0n5dr09n8rt5y9v3at8x4wl4lrkxhlzq4trqmh" NEXT_PUBLIC_FEATURED_VENDING_FACTORY_ADDRESS="stars14pd96yk3t6gq9l6uyrkg0n5dr09n8rt5y9v3at8x4wl4lrkxhlzq4trqmh"
NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS="stars1h65nms9gwg4vdktyqj84tu50gwlm34e0eczl5w2ezllxuzfxy9esa9qlt0" NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS="stars1h65nms9gwg4vdktyqj84tu50gwlm34e0eczl5w2ezllxuzfxy9esa9qlt0"
NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS="stars1hvu2ghqkcnvhtj2fc6wuazxt4dqcftslp2rwkkkcxy269a35a9pq60ug2q" NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS="stars1hvu2ghqkcnvhtj2fc6wuazxt4dqcftslp2rwkkkcxy269a35a9pq60ug2q"
NEXT_PUBLIC_VENDING_FACTORY_MERKLE_TREE_ADDRESS="stars167tudcsr9n2y9ljgk4cwxhs0cvkfkk0hh6c3dzngsz7m5s9jmqnsdgr3jy"
NEXT_PUBLIC_FEATURED_VENDING_FACTORY_FLEX_ADDRESS="stars1udlmmnmmnnqamh36hy6d7azn3ycv23yymkmg6558ntalvyt2pz7s8lhgcd" NEXT_PUBLIC_FEATURED_VENDING_FACTORY_FLEX_ADDRESS="stars1udlmmnmmnnqamh36hy6d7azn3ycv23yymkmg6558ntalvyt2pz7s8lhgcd"
NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS= # NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS=
# NEXT_PUBLIC_VENDING_IBC_ATOM_FACTORY_ADDRESS= # NEXT_PUBLIC_VENDING_IBC_ATOM_FACTORY_ADDRESS=
# NEXT_PUBLIC_VENDING_IBC_ATOM_UPDATABLE_FACTORY_ADDRESS= # NEXT_PUBLIC_VENDING_IBC_ATOM_UPDATABLE_FACTORY_ADDRESS=
@ -40,6 +41,7 @@ NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS=
# NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_ADDRESS= # NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_ADDRESS=
# NEXT_PUBLIC_VENDING_IBC_TIA_UPDATABLE_FACTORY_ADDRESS= # NEXT_PUBLIC_VENDING_IBC_TIA_UPDATABLE_FACTORY_ADDRESS=
# NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS= # NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS=
# NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_MERKLE_TREE_ADDRESS=
# NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS= # NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS=
# NEXT_PUBLIC_VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS= # NEXT_PUBLIC_VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS=

View File

@ -78,7 +78,7 @@ export const WhitelistUpload = ({ onChange }: WhitelistUploadProps) => {
const printableData = data?.map((item) => item.replace(regex, '')) const printableData = data?.map((item) => item.replace(regex, ''))
const names = printableData?.filter((address) => address !== '' && address.endsWith('.stars')) const names = printableData?.filter((address) => address !== '' && address.endsWith('.stars'))
const strippedNames = names?.map((name) => name.split('.')[0]) const strippedNames = names?.map((name) => name.split('.')[0])
console.log(names) console.log('names: ', names)
if (strippedNames?.length) { if (strippedNames?.length) {
await toast await toast
.promise(resolveAddresses(strippedNames), { .promise(resolveAddresses(strippedNames), {

View File

@ -181,7 +181,9 @@ export const WhitelistDetails = ({
endDate, endDate,
whitelistStandardArray, whitelistStandardArray,
whitelistFlexArray, whitelistFlexArray,
whitelistMerkleTreeArray,
whitelistState, whitelistState,
whitelistType,
addressListState.values, addressListState.values,
adminsMutable, adminsMutable,
]) ])

View File

@ -26,6 +26,7 @@ import {
OPEN_EDITION_UPDATABLE_IBC_USK_FACTORY_ADDRESS, OPEN_EDITION_UPDATABLE_IBC_USK_FACTORY_ADDRESS,
VENDING_FACTORY_ADDRESS, VENDING_FACTORY_ADDRESS,
VENDING_FACTORY_FLEX_ADDRESS, VENDING_FACTORY_FLEX_ADDRESS,
VENDING_FACTORY_MERKLE_TREE_ADDRESS,
VENDING_FACTORY_UPDATABLE_ADDRESS, VENDING_FACTORY_UPDATABLE_ADDRESS,
VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS, VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS,
VENDING_IBC_ATOM_FACTORY_ADDRESS, VENDING_IBC_ATOM_FACTORY_ADDRESS,
@ -44,6 +45,7 @@ import {
VENDING_IBC_NBTC_UPDATABLE_FACTORY_FLEX_ADDRESS, VENDING_IBC_NBTC_UPDATABLE_FACTORY_FLEX_ADDRESS,
VENDING_IBC_TIA_FACTORY_ADDRESS, VENDING_IBC_TIA_FACTORY_ADDRESS,
VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS, VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS,
VENDING_IBC_TIA_FACTORY_MERKLE_TREE_ADDRESS,
VENDING_IBC_TIA_UPDATABLE_FACTORY_ADDRESS, VENDING_IBC_TIA_UPDATABLE_FACTORY_ADDRESS,
VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS, VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS,
VENDING_IBC_USDC_FACTORY_ADDRESS, VENDING_IBC_USDC_FACTORY_ADDRESS,
@ -84,6 +86,7 @@ export interface MinterInfo {
supportedToken: TokenInfo supportedToken: TokenInfo
updatable?: boolean updatable?: boolean
flexible?: boolean flexible?: boolean
merkleTree?: boolean
featured?: boolean featured?: boolean
} }
@ -267,6 +270,7 @@ export const vendingStarsMinter: MinterInfo = {
supportedToken: stars, supportedToken: stars,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -276,6 +280,7 @@ export const vendingFeaturedStarsMinter: MinterInfo = {
supportedToken: stars, supportedToken: stars,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: true, featured: true,
} }
@ -285,6 +290,7 @@ export const vendingUpdatableStarsMinter: MinterInfo = {
supportedToken: stars, supportedToken: stars,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -294,6 +300,7 @@ export const vendingIbcAtomMinter: MinterInfo = {
supportedToken: ibcAtom, supportedToken: ibcAtom,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -303,6 +310,7 @@ export const vendingUpdatableIbcAtomMinter: MinterInfo = {
supportedToken: ibcAtom, supportedToken: ibcAtom,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -312,6 +320,7 @@ export const vendingIbcUsdcMinter: MinterInfo = {
supportedToken: ibcUsdc, supportedToken: ibcUsdc,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -321,6 +330,7 @@ export const vendingFeaturedIbcUsdcMinter: MinterInfo = {
supportedToken: ibcUsdc, supportedToken: ibcUsdc,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: true, featured: true,
} }
@ -330,6 +340,7 @@ export const vendingIbcTiaMinter: MinterInfo = {
supportedToken: ibcTia, supportedToken: ibcTia,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -339,6 +350,7 @@ export const vendingFeaturedIbcTiaMinter: MinterInfo = {
supportedToken: ibcTia, supportedToken: ibcTia,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: true, featured: true,
} }
@ -348,6 +360,7 @@ export const vendingIbcNbtcMinter: MinterInfo = {
supportedToken: ibcNbtc, supportedToken: ibcNbtc,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -357,6 +370,7 @@ export const vendingUpdatableIbcUsdcMinter: MinterInfo = {
supportedToken: ibcUsdc, supportedToken: ibcUsdc,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -366,6 +380,7 @@ export const vendingUpdatableIbcTiaMinter: MinterInfo = {
supportedToken: ibcTia, supportedToken: ibcTia,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -375,6 +390,7 @@ export const vendingUpdatableIbcNbtcMinter: MinterInfo = {
supportedToken: ibcNbtc, supportedToken: ibcNbtc,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -384,6 +400,7 @@ export const vendingIbcUskMinter: MinterInfo = {
supportedToken: ibcUsk, supportedToken: ibcUsk,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -393,6 +410,7 @@ export const vendingUpdatableIbcUskMinter: MinterInfo = {
supportedToken: ibcUsk, supportedToken: ibcUsk,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -402,6 +420,7 @@ export const vendingIbcKujiMinter: MinterInfo = {
supportedToken: ibcKuji, supportedToken: ibcKuji,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -411,6 +430,7 @@ export const vendingIbcHuahuaMinter: MinterInfo = {
supportedToken: ibcHuahua, supportedToken: ibcHuahua,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -420,6 +440,7 @@ export const vendingIbcCrbrusMinter: MinterInfo = {
supportedToken: ibcCrbrus, supportedToken: ibcCrbrus,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -429,6 +450,7 @@ export const vendingNativeStardustMinter: MinterInfo = {
supportedToken: nativeStardust, supportedToken: nativeStardust,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -438,6 +460,7 @@ export const vendingUpdatableNativeStardustMinter: MinterInfo = {
supportedToken: nativeStardust, supportedToken: nativeStardust,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -447,6 +470,7 @@ export const vendingNativeBrnchMinter: MinterInfo = {
supportedToken: nativeBrnch, supportedToken: nativeBrnch,
updatable: false, updatable: false,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -456,6 +480,7 @@ export const vendingUpdatableNativeBrnchMinter: MinterInfo = {
supportedToken: nativeBrnch, supportedToken: nativeBrnch,
updatable: true, updatable: true,
flexible: false, flexible: false,
merkleTree: false,
featured: false, featured: false,
} }
@ -490,6 +515,7 @@ export const flexibleVendingStarsMinter: MinterInfo = {
supportedToken: stars, supportedToken: stars,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -499,6 +525,7 @@ export const flexibleFeaturedVendingStarsMinter: MinterInfo = {
supportedToken: stars, supportedToken: stars,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: true, featured: true,
} }
@ -508,6 +535,7 @@ export const flexibleVendingUpdatableStarsMinter: MinterInfo = {
supportedToken: stars, supportedToken: stars,
updatable: true, updatable: true,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -517,6 +545,7 @@ export const flexibleVendingIbcAtomMinter: MinterInfo = {
supportedToken: ibcAtom, supportedToken: ibcAtom,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -526,6 +555,7 @@ export const flexibleVendingUpdatableIbcAtomMinter: MinterInfo = {
supportedToken: ibcAtom, supportedToken: ibcAtom,
updatable: true, updatable: true,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -535,6 +565,7 @@ export const flexibleVendingIbcUsdcMinter: MinterInfo = {
supportedToken: ibcUsdc, supportedToken: ibcUsdc,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -544,6 +575,7 @@ export const flexibleFeaturedVendingIbcUsdcMinter: MinterInfo = {
supportedToken: ibcUsdc, supportedToken: ibcUsdc,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: true, featured: true,
} }
@ -553,6 +585,7 @@ export const flexibleVendingIbcTiaMinter: MinterInfo = {
supportedToken: ibcTia, supportedToken: ibcTia,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -562,6 +595,7 @@ export const flexibleFeaturedVendingIbcTiaMinter: MinterInfo = {
supportedToken: ibcTia, supportedToken: ibcTia,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: true, featured: true,
} }
@ -571,6 +605,7 @@ export const flexibleVendingIbcNbtcMinter: MinterInfo = {
supportedToken: ibcNbtc, supportedToken: ibcNbtc,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -580,6 +615,7 @@ export const flexibleVendingUpdatableIbcUsdcMinter: MinterInfo = {
supportedToken: ibcUsdc, supportedToken: ibcUsdc,
updatable: true, updatable: true,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -589,6 +625,7 @@ export const flexibleVendingUpdatableIbcTiaMinter: MinterInfo = {
supportedToken: ibcTia, supportedToken: ibcTia,
updatable: true, updatable: true,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -598,6 +635,7 @@ export const flexibleVendingUpdatableIbcNbtcMinter: MinterInfo = {
supportedToken: ibcNbtc, supportedToken: ibcNbtc,
updatable: true, updatable: true,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -607,6 +645,7 @@ export const flexibleVendingIbcUskMinter: MinterInfo = {
supportedToken: ibcUsk, supportedToken: ibcUsk,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -616,6 +655,7 @@ export const flexibleVendingUpdatableIbcUskMinter: MinterInfo = {
supportedToken: ibcUsk, supportedToken: ibcUsk,
updatable: true, updatable: true,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -625,6 +665,7 @@ export const flexibleVendingIbcKujiMinter: MinterInfo = {
supportedToken: ibcKuji, supportedToken: ibcKuji,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -634,6 +675,7 @@ export const flexibleVendingIbcHuahuaMinter: MinterInfo = {
supportedToken: ibcHuahua, supportedToken: ibcHuahua,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -643,6 +685,7 @@ export const flexibleVendingIbcCrbrusMinter: MinterInfo = {
supportedToken: ibcCrbrus, supportedToken: ibcCrbrus,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -652,6 +695,7 @@ export const flexibleVendingStrdstMinter: MinterInfo = {
supportedToken: nativeStardust, supportedToken: nativeStardust,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -661,6 +705,7 @@ export const flexibleVendingBrnchMinter: MinterInfo = {
supportedToken: nativeBrnch, supportedToken: nativeBrnch,
updatable: false, updatable: false,
flexible: true, flexible: true,
merkleTree: false,
featured: false, featured: false,
} }
@ -686,3 +731,25 @@ export const flexibleVendingMinterList = [
flexibleVendingStrdstMinter, flexibleVendingStrdstMinter,
flexibleVendingBrnchMinter, flexibleVendingBrnchMinter,
] ]
export const merkleTreeVendingStarsMinter: MinterInfo = {
id: 'merkletree-vending-stars-minter',
factoryAddress: VENDING_FACTORY_MERKLE_TREE_ADDRESS,
supportedToken: stars,
updatable: false,
flexible: false,
merkleTree: true,
featured: false,
}
export const merkleTreeVendingIbcTiaMinter: MinterInfo = {
id: 'merkletree-vending-ibc-tia-minter',
factoryAddress: VENDING_IBC_TIA_FACTORY_MERKLE_TREE_ADDRESS,
supportedToken: ibcTia,
updatable: false,
flexible: false,
merkleTree: true,
featured: false,
}
export const merkleTreeVendingMinterList = [merkleTreeVendingStarsMinter, merkleTreeVendingIbcTiaMinter]

2
env.d.ts vendored
View File

@ -29,6 +29,7 @@ declare namespace NodeJS {
readonly NEXT_PUBLIC_FEATURED_VENDING_FACTORY_ADDRESS: string readonly NEXT_PUBLIC_FEATURED_VENDING_FACTORY_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS: string readonly NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_FACTORY_MERKLE_TREE_ADDRESS: string
readonly NEXT_PUBLIC_FEATURED_VENDING_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_FEATURED_VENDING_FACTORY_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS: string readonly NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_IBC_ATOM_FACTORY_ADDRESS: string readonly NEXT_PUBLIC_VENDING_IBC_ATOM_FACTORY_ADDRESS: string
@ -55,6 +56,7 @@ declare namespace NodeJS {
readonly NEXT_PUBLIC_FEATURED_VENDING_IBC_USDC_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_FEATURED_VENDING_IBC_USDC_FACTORY_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_IBC_USDC_UPDATABLE_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_VENDING_IBC_USDC_UPDATABLE_FACTORY_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_MERKLE_TREE_ADDRESS: string
readonly NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS: string
readonly NEXT_PUBLIC_VENDING_IBC_NBTC_FACTORY_FLEX_ADDRESS: string readonly NEXT_PUBLIC_VENDING_IBC_NBTC_FACTORY_FLEX_ADDRESS: string

View File

@ -34,7 +34,12 @@ import { FormControl } from 'components/FormControl'
import { LoadingModal } from 'components/LoadingModal' import { LoadingModal } from 'components/LoadingModal'
import type { OpenEditionMinterCreatorDataProps } from 'components/openEdition/OpenEditionMinterCreator' import type { OpenEditionMinterCreatorDataProps } from 'components/openEdition/OpenEditionMinterCreator'
import { OpenEditionMinterCreator } from 'components/openEdition/OpenEditionMinterCreator' import { OpenEditionMinterCreator } from 'components/openEdition/OpenEditionMinterCreator'
import { flexibleVendingMinterList, openEditionMinterList, vendingMinterList } from 'config/minter' import {
flexibleVendingMinterList,
merkleTreeVendingMinterList,
openEditionMinterList,
vendingMinterList,
} 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'
@ -67,6 +72,8 @@ import {
VENDING_FACTORY_UPDATABLE_ADDRESS, VENDING_FACTORY_UPDATABLE_ADDRESS,
WHITELIST_CODE_ID, WHITELIST_CODE_ID,
WHITELIST_FLEX_CODE_ID, WHITELIST_FLEX_CODE_ID,
WHITELIST_MERKLE_TREE_API_URL,
WHITELIST_MERKLE_TREE_CODE_ID,
} from 'utils/constants' } from 'utils/constants'
import { checkTokenUri } from 'utils/isValidTokenUri' import { checkTokenUri } from 'utils/isValidTokenUri'
import { withMetadata } from 'utils/layout' import { withMetadata } from 'utils/layout'
@ -88,6 +95,7 @@ const CollectionCreationPage: NextPage = () => {
baseMinter: baseMinterContract, baseMinter: baseMinterContract,
vendingMinter: vendingMinterContract, vendingMinter: vendingMinterContract,
whitelist: whitelistContract, whitelist: whitelistContract,
whitelistMerkleTree: whitelistMerkleTreeContract,
vendingFactory: vendingFactoryContract, vendingFactory: vendingFactoryContract,
baseFactory: baseFactoryContract, baseFactory: baseFactoryContract,
} = useContracts() } = useContracts()
@ -513,41 +521,84 @@ const CollectionCreationPage: NextPage = () => {
if (!wallet.isWalletConnected) throw new Error('Wallet not connected') if (!wallet.isWalletConnected) throw new Error('Wallet not connected')
if (!whitelistContract) throw new Error('Contract not found') if (!whitelistContract) throw new Error('Contract not found')
const standardMsg = { if (whitelistDetails?.whitelistType === 'standard' || whitelistDetails?.whitelistType === 'flex') {
members: whitelistDetails?.members, const standardMsg = {
start_time: whitelistDetails?.startTime, members: whitelistDetails.members,
end_time: whitelistDetails?.endTime, start_time: whitelistDetails.startTime,
mint_price: coin( end_time: whitelistDetails.endTime,
String(Number(whitelistDetails?.unitPrice)), mint_price: coin(
mintTokenFromVendingFactory ? mintTokenFromVendingFactory.denom : 'ustars', String(Number(whitelistDetails.unitPrice)),
), mintTokenFromVendingFactory ? mintTokenFromVendingFactory.denom : 'ustars',
per_address_limit: whitelistDetails?.perAddressLimit, ),
member_limit: whitelistDetails?.memberLimit, per_address_limit: whitelistDetails.perAddressLimit,
admins: whitelistDetails?.admins || [wallet.address], member_limit: whitelistDetails.memberLimit,
admins_mutable: whitelistDetails?.adminsMutable, admins: whitelistDetails.admins || [wallet.address],
admins_mutable: whitelistDetails.adminsMutable,
}
const flexMsg = {
members: whitelistDetails.members,
start_time: whitelistDetails.startTime,
end_time: whitelistDetails.endTime,
mint_price: coin(
String(Number(whitelistDetails.unitPrice)),
mintTokenFromVendingFactory ? mintTokenFromVendingFactory.denom : 'ustars',
),
member_limit: whitelistDetails.memberLimit,
admins: whitelistDetails.admins || [wallet.address],
admins_mutable: whitelistDetails.adminsMutable,
}
const data = await whitelistContract.instantiate(
whitelistDetails.whitelistType === 'standard' ? WHITELIST_CODE_ID : WHITELIST_FLEX_CODE_ID,
whitelistDetails.whitelistType === 'standard' ? standardMsg : flexMsg,
'Stargaze Whitelist Contract',
wallet.address,
)
return data.contractAddress
} else if (whitelistDetails?.whitelistType === 'merkletree') {
const members = whitelistDetails.members as string[]
const membersCsv = members.join('\n')
const membersBlob = new Blob([membersCsv], { type: 'text/csv' })
const membersFile = new File([membersBlob], 'members.csv', { type: 'text/csv' })
const formData = new FormData()
formData.append('whitelist', membersFile)
const response = await axios
.post(`${WHITELIST_MERKLE_TREE_API_URL}/create_whitelist`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
})
.catch((error) => {
console.log('error', error)
throw new Error('Error fetching root hash from Whitelist Merkle Tree API.')
})
const rootHash = response.data.root_hash
console.log('rootHash', rootHash)
const merkleTreeMsg = {
merkle_root: rootHash,
merkle_tree_uri: null,
start_time: whitelistDetails.startTime,
end_time: whitelistDetails.endTime,
mint_price: coin(
String(Number(whitelistDetails.unitPrice)),
mintTokenFromVendingFactory ? mintTokenFromVendingFactory.denom : 'ustars',
),
per_address_limit: whitelistDetails.perAddressLimit,
admins: whitelistDetails.admins || [wallet.address],
admins_mutable: whitelistDetails.adminsMutable,
}
const data = await whitelistMerkleTreeContract?.instantiate(
WHITELIST_MERKLE_TREE_CODE_ID,
merkleTreeMsg,
'Stargaze Whitelist Merkle Tree Contract',
wallet.address,
)
return data?.contractAddress
} }
const flexMsg = {
members: whitelistDetails?.members,
start_time: whitelistDetails?.startTime,
end_time: whitelistDetails?.endTime,
mint_price: coin(
String(Number(whitelistDetails?.unitPrice)),
mintTokenFromVendingFactory ? mintTokenFromVendingFactory.denom : 'ustars',
),
member_limit: whitelistDetails?.memberLimit,
admins: whitelistDetails?.admins || [wallet.address],
admins_mutable: whitelistDetails?.adminsMutable,
}
const data = await whitelistContract.instantiate(
whitelistDetails?.whitelistType === 'standard' ? WHITELIST_CODE_ID : WHITELIST_FLEX_CODE_ID,
whitelistDetails?.whitelistType === 'standard' ? standardMsg : flexMsg,
'Stargaze Whitelist Contract',
wallet.address,
)
return data.contractAddress
} }
const instantiateVendingMinter = async (baseUri: string, coverImageUri: string, whitelist?: string) => { const instantiateVendingMinter = async (baseUri: string, coverImageUri: string, whitelist?: string) => {
@ -1047,6 +1098,8 @@ const CollectionCreationPage: NextPage = () => {
//check if the address belongs to a whitelist contract (see performChecks()) //check if the address belongs to a whitelist contract (see performChecks())
const config = await contract?.config() const config = await contract?.config()
if (JSON.stringify(config).includes('whale_cap')) whitelistDetails.whitelistType = 'flex' if (JSON.stringify(config).includes('whale_cap')) whitelistDetails.whitelistType = 'flex'
else if (!JSON.stringify(config).includes('member_limit') || config?.member_limit === 0)
whitelistDetails.whitelistType = 'merkletree'
else whitelistDetails.whitelistType = 'standard' else whitelistDetails.whitelistType = 'standard'
if (Number(config?.start_time) !== Number(mintingDetails?.startTime)) { if (Number(config?.start_time) !== Number(mintingDetails?.startTime)) {
const whitelistStartDate = new Date(Number(config?.start_time) / 1000000) const whitelistStartDate = new Date(Number(config?.start_time) / 1000000)
@ -1084,7 +1137,10 @@ const CollectionCreationPage: NextPage = () => {
(!whitelistDetails.perAddressLimit || whitelistDetails.perAddressLimit === 0) (!whitelistDetails.perAddressLimit || whitelistDetails.perAddressLimit === 0)
) )
throw new Error('Per address limit is required') throw new Error('Per address limit is required')
if (!whitelistDetails.memberLimit || whitelistDetails.memberLimit === 0) if (
whitelistDetails.whitelistType !== 'merkletree' &&
(!whitelistDetails.memberLimit || whitelistDetails.memberLimit === 0)
)
throw new Error('Member limit is required') throw new Error('Member limit is required')
if (Number(whitelistDetails.startTime) >= Number(whitelistDetails.endTime)) if (Number(whitelistDetails.startTime) >= Number(whitelistDetails.endTime))
throw new Error('Whitelist start time cannot be equal to or later than the whitelist end time') throw new Error('Whitelist start time cannot be equal to or later than the whitelist end time')
@ -1277,13 +1333,16 @@ const CollectionCreationPage: NextPage = () => {
const client = await wallet.getCosmWasmClient() const client = await wallet.getCosmWasmClient()
const vendingFactoryForSelectedDenom = vendingMinterList const vendingFactoryForSelectedDenom = vendingMinterList
.concat(flexibleVendingMinterList) .concat(flexibleVendingMinterList)
.concat(merkleTreeVendingMinterList)
.find( .find(
(minter) => (minter) =>
minter.supportedToken === mintingDetails?.selectedMintToken && minter.supportedToken === mintingDetails?.selectedMintToken &&
minter.updatable === collectionDetails?.updatable && minter.updatable === collectionDetails?.updatable &&
minter.flexible === (whitelistDetails?.whitelistType === 'flex') && minter.flexible === (whitelistDetails?.whitelistType === 'flex') &&
minter.merkleTree === (whitelistDetails?.whitelistType === 'merkletree') &&
minter.featured === isFeaturedCollection, minter.featured === isFeaturedCollection,
)?.factoryAddress )?.factoryAddress
console.log('Vending Factory: ', vendingFactoryForSelectedDenom)
if (vendingFactoryForSelectedDenom) { if (vendingFactoryForSelectedDenom) {
setIsMatchingVendingFactoryPresent(true) setIsMatchingVendingFactoryPresent(true)

View File

@ -16,6 +16,7 @@ export const VENDING_FACTORY_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_A
export const FEATURED_VENDING_FACTORY_ADDRESS = process.env.NEXT_PUBLIC_FEATURED_VENDING_FACTORY_ADDRESS export const FEATURED_VENDING_FACTORY_ADDRESS = process.env.NEXT_PUBLIC_FEATURED_VENDING_FACTORY_ADDRESS
export const VENDING_FACTORY_UPDATABLE_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS export const VENDING_FACTORY_UPDATABLE_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS
export const VENDING_FACTORY_FLEX_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS export const VENDING_FACTORY_FLEX_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS
export const VENDING_FACTORY_MERKLE_TREE_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_MERKLE_TREE_ADDRESS
export const FEATURED_VENDING_FACTORY_FLEX_ADDRESS = process.env.NEXT_PUBLIC_FEATURED_VENDING_FACTORY_FLEX_ADDRESS export const FEATURED_VENDING_FACTORY_FLEX_ADDRESS = process.env.NEXT_PUBLIC_FEATURED_VENDING_FACTORY_FLEX_ADDRESS
export const VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS export const VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS = process.env.NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_FLEX_ADDRESS
export const VENDING_IBC_ATOM_FACTORY_ADDRESS = process.env.NEXT_PUBLIC_VENDING_IBC_ATOM_FACTORY_ADDRESS export const VENDING_IBC_ATOM_FACTORY_ADDRESS = process.env.NEXT_PUBLIC_VENDING_IBC_ATOM_FACTORY_ADDRESS
@ -47,6 +48,8 @@ export const FEATURED_VENDING_IBC_USDC_FACTORY_FLEX_ADDRESS =
export const VENDING_IBC_USDC_UPDATABLE_FACTORY_FLEX_ADDRESS = export const VENDING_IBC_USDC_UPDATABLE_FACTORY_FLEX_ADDRESS =
process.env.NEXT_PUBLIC_VENDING_IBC_USDC_UPDATABLE_FACTORY_FLEX_ADDRESS process.env.NEXT_PUBLIC_VENDING_IBC_USDC_UPDATABLE_FACTORY_FLEX_ADDRESS
export const VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS = process.env.NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS export const VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS = process.env.NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS
export const VENDING_IBC_TIA_FACTORY_MERKLE_TREE_ADDRESS =
process.env.NEXT_PUBLIC_VENDING_IBC_TIA_FACTORY_MERKLE_TREE_ADDRESS
export const FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS = export const FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS =
process.env.NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS process.env.NEXT_PUBLIC_FEATURED_VENDING_IBC_TIA_FACTORY_FLEX_ADDRESS
export const VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS = export const VENDING_IBC_TIA_UPDATABLE_FACTORY_FLEX_ADDRESS =