From a999f54d48742a7a9f832a1393f81e369d8329b5 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 26 May 2023 14:40:01 +0300 Subject: [PATCH 1/6] Update .env.example --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index cdedc47..47ea061 100644 --- a/.env.example +++ b/.env.example @@ -8,8 +8,8 @@ NEXT_PUBLIC_VENDING_MINTER_FLEX_CODE_ID=2080 NEXT_PUBLIC_BASE_MINTER_CODE_ID=1910 NEXT_PUBLIC_VENDING_FACTORY_ADDRESS="stars1ukaladct74um4lhn6eru0d9hdrcqzj3q8sjrfcg7226xey0xc2gsy0gl22" NEXT_PUBLIC_VENDING_FACTORY_UPDATABLE_ADDRESS="stars1fnfywcnzzwledr93at65qm8gf953tjxgh6u2u4r8n9vsdv7u75eqe7ecn3" -NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS="stars1l5v0vgly8r9jw4exeajnftymr29kn70n23gpl2g5fylaww2pzkhq0rks7c" -NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars10rmaxgnjvskuumgv7e2awqkhdqdcygkwrz8a8vvt88szj7fc7xlq5jcs3f" +NEXT_PUBLIC_VENDING_FACTORY_FLEX_ADDRESS="stars1gy6hr9sq9fzrykzw0emmehnjy27agreuepjrfnjnlwlugg29l2qqt0yu2j" +NEXT_PUBLIC_BASE_FACTORY_ADDRESS="stars18kzfpdgx36m95mszchegnk7car4sq03uvg25zeph2j7xg3rk03cs007sxr" NEXT_PUBLIC_BASE_FACTORY_UPDATABLE_ADDRESS="stars13pw8r33dsnghlxfj2upaywf38z2fc6npuw9maq9e5cpet4v285sscgzjp2" NEXT_PUBLIC_SG721_NAME_ADDRESS="stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr" NEXT_PUBLIC_WHITELIST_CODE_ID=2093 From 9534ad399e372f9230f4f05d09a49410681552d4 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 26 May 2023 14:50:35 +0300 Subject: [PATCH 2/6] Catch factory parameters query errors --- pages/collections/create.tsx | 48 +++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index cee0888..2bb4fb9 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -1,4 +1,5 @@ /* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable no-nested-ternary */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ @@ -976,31 +977,56 @@ const CollectionCreationPage: NextPage = () => { const client = wallet.client if (!client) return if (BASE_FACTORY_ADDRESS) { - const baseFactoryParameters = await client.queryContractSmart(BASE_FACTORY_ADDRESS, { params: {} }) + const baseFactoryParameters = await client + .queryContractSmart(BASE_FACTORY_ADDRESS, { params: {} }) + .catch((error) => { + toast.error(`${error.message}`, { style: { maxWidth: 'none' } }) + addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() }) + }) setBaseMinterCreationFee(baseFactoryParameters?.params?.creation_fee?.amount) } if (BASE_FACTORY_UPDATABLE_ADDRESS) { - const baseFactoryUpdatableParameters = await client.queryContractSmart(BASE_FACTORY_UPDATABLE_ADDRESS, { - params: {}, - }) + const baseFactoryUpdatableParameters = await client + .queryContractSmart(BASE_FACTORY_UPDATABLE_ADDRESS, { + params: {}, + }) + .catch((error) => { + toast.error(`${error.message}`, { style: { maxWidth: 'none' } }) + addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() }) + }) setBaseMinterUpdatableCreationFee(baseFactoryUpdatableParameters?.params?.creation_fee?.amount) } if (VENDING_FACTORY_ADDRESS) { - const vendingFactoryParameters = await client.queryContractSmart(VENDING_FACTORY_ADDRESS, { params: {} }) + const vendingFactoryParameters = await client + .queryContractSmart(VENDING_FACTORY_ADDRESS, { params: {} }) + .catch((error) => { + toast.error(`${error.message}`, { style: { maxWidth: 'none' } }) + addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() }) + }) setVendingMinterCreationFee(vendingFactoryParameters?.params?.creation_fee?.amount) setMinimumMintPrice(vendingFactoryParameters?.params?.min_mint_price?.amount) } if (VENDING_FACTORY_UPDATABLE_ADDRESS) { - const vendingFactoryUpdatableParameters = await client.queryContractSmart(VENDING_FACTORY_UPDATABLE_ADDRESS, { - params: {}, - }) + const vendingFactoryUpdatableParameters = await client + .queryContractSmart(VENDING_FACTORY_UPDATABLE_ADDRESS, { + params: {}, + }) + .catch((error) => { + toast.error(`${error.message}`, { style: { maxWidth: 'none' } }) + addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() }) + }) setVendingMinterUpdatableCreationFee(vendingFactoryUpdatableParameters?.params?.creation_fee?.amount) setMinimumUpdatableMintPrice(vendingFactoryUpdatableParameters?.params?.min_mint_price?.amount) } if (VENDING_FACTORY_FLEX_ADDRESS) { - const vendingFactoryFlexParameters = await client.queryContractSmart(VENDING_FACTORY_FLEX_ADDRESS, { - params: {}, - }) + const vendingFactoryFlexParameters = await client + .queryContractSmart(VENDING_FACTORY_FLEX_ADDRESS, { + params: {}, + }) + .catch((error) => { + toast.error(`${error.message}`, { style: { maxWidth: 'none' } }) + addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() }) + }) setVendingMinterFlexCreationFee(vendingFactoryFlexParameters?.params?.creation_fee?.amount) setMinimumFlexMintPrice(vendingFactoryFlexParameters?.params?.min_mint_price?.amount) } From 66bfd262f4ede422519fad146a10ff46874d20e6 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Fri, 26 May 2023 14:59:15 +0300 Subject: [PATCH 3/6] Display flexible collections in the My Collections list --- pages/collections/myCollections.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/collections/myCollections.tsx b/pages/collections/myCollections.tsx index 46dc5da..8d600f0 100644 --- a/pages/collections/myCollections.tsx +++ b/pages/collections/myCollections.tsx @@ -49,7 +49,7 @@ const CollectionList: NextPage = () => { .then((contractType) => { if (contractType?.includes('sg-base-minter')) { setMyOneOfOneCollections((prevState) => [...prevState, collection]) - } else if (contractType?.includes('sg-minter')) { + } else if (contractType?.includes('sg-minter') || contractType?.includes('flex')) { setMyStandardCollections((prevState) => [...prevState, collection]) } }) From 81cac0ff5be44726add496c9bd7814af392c0bc0 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 28 May 2023 17:46:50 +0300 Subject: [PATCH 4/6] Update contract helpers --- contracts/sg721/contract.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/contracts/sg721/contract.ts b/contracts/sg721/contract.ts index bce6b13..ec2f880 100644 --- a/contracts/sg721/contract.ts +++ b/contracts/sg721/contract.ts @@ -89,6 +89,7 @@ export interface SG721Instance { updateTokenMetadata: (tokenId: string, tokenURI: string) => Promise batchUpdateTokenMetadata: (tokenIds: string, tokenURI: string) => Promise freezeTokenMetadata: () => Promise + enableUpdatable: () => Promise } export interface Sg721Messages { @@ -107,6 +108,7 @@ export interface Sg721Messages { updateTokenMetadata: (tokenId: string, tokenURI: string) => UpdateTokenMetadataMessage batchUpdateTokenMetadata: (tokenIds: string, tokenURI: string) => BatchUpdateTokenMetadataMessage freezeTokenMetadata: () => FreezeTokenMetadataMessage + enableUpdatable: () => EnableUpdatableMessage } export interface TransferNFTMessage { @@ -247,6 +249,13 @@ export interface FreezeTokenMetadataMessage { funds: Coin[] } +export interface EnableUpdatableMessage { + sender: string + contract: string + msg: { enable_updatable: Record } + funds: Coin[] +} + export interface UpdateCollectionInfoMessage { sender: string contract: string @@ -687,6 +696,20 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con return res.transactionHash } + const enableUpdatable = async (): Promise => { + const res = await client.execute( + txSigner, + contractAddress, + { + enable_updatable: {}, + }, + 'auto', + '', + [coin('500000000', 'ustars')], + ) + return res.transactionHash + } + return { contractAddress, ownerOf, @@ -716,6 +739,7 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con updateTokenMetadata, batchUpdateTokenMetadata, freezeTokenMetadata, + enableUpdatable, } } @@ -963,6 +987,17 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con } } + const enableUpdatable = () => { + return { + sender: txSigner, + contract: contractAddress, + msg: { + enable_updatable: {}, + }, + funds: [coin('500000000', 'ustars')], + } + } + const updateCollectionInfo = (collectionInfo: CollectionInfo) => { return { sender: txSigner, @@ -1001,6 +1036,7 @@ export const SG721 = (client: SigningCosmWasmClient, txSigner: string): SG721Con updateTokenMetadata, batchUpdateTokenMetadata, freezeTokenMetadata, + enableUpdatable, } } From f0a35565b856d0716b17698739f9e3581bf991f7 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Sun, 28 May 2023 20:51:10 +0300 Subject: [PATCH 5/6] Update Collection Actions list --- components/collections/actions/actions.ts | 61 +++++++++++------------ 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/components/collections/actions/actions.ts b/components/collections/actions/actions.ts index c459038..63ab38d 100644 --- a/components/collections/actions/actions.ts +++ b/components/collections/actions/actions.ts @@ -35,6 +35,7 @@ export const ACTION_TYPES = [ 'update_token_metadata', 'batch_update_token_metadata', 'freeze_token_metadata', + 'enable_updatable', ] as const export interface ActionListItem { @@ -205,6 +206,11 @@ export const SG721_UPDATABLE_ACTION_LIST: ActionListItem[] = [ name: 'Freeze Token Metadata', description: `Render the metadata for tokens no longer updatable`, }, + { + id: 'enable_updatable', + name: 'Enable Updatable', + description: `Render a collection updatable following a migration`, + }, ] export interface DispatchExecuteProps { @@ -212,43 +218,28 @@ export interface DispatchExecuteProps { [k: string]: unknown } -type Select = T - /** @see {@link VendingMinterInstance}{@link BaseMinterInstance} */ -export type DispatchExecuteArgs = { +export interface DispatchExecuteArgs { minterContract: string sg721Contract: string vendingMinterMessages?: VendingMinterInstance baseMinterMessages?: BaseMinterInstance sg721Messages?: SG721Instance txSigner: string -} & ( - | { type: undefined } - | { type: Select<'mint_token_uri'>; tokenUri: string } - | { type: Select<'update_mint_price'>; price: string } - | { type: Select<'update_discount_price'>; price: string } - | { type: Select<'remove_discount_price'> } - | { type: Select<'mint_to'>; recipient: string } - | { type: Select<'mint_for'>; recipient: string; tokenId: number } - | { type: Select<'batch_mint'>; recipient: string; batchNumber: number } - | { type: Select<'set_whitelist'>; whitelist: string } - | { type: Select<'update_start_time'>; startTime: string } - | { type: Select<'update_start_trading_time'>; startTime?: string } - | { type: Select<'update_per_address_limit'>; limit: number } - | { type: Select<'shuffle'> } - | { type: Select<'transfer'>; recipient: string; tokenId: number } - | { type: Select<'batch_transfer'>; recipient: string; tokenIds: string } - | { type: Select<'burn'>; tokenId: number } - | { type: Select<'batch_burn'>; tokenIds: string } - | { type: Select<'batch_mint_for'>; recipient: string; tokenIds: string } - | { type: Select<'airdrop'>; recipients: string[] } - | { type: Select<'burn_remaining'> } - | { type: Select<'update_collection_info'>; collectionInfo: CollectionInfo | undefined } - | { type: Select<'freeze_collection_info'> } - | { type: Select<'update_token_metadata'>; tokenId: number; tokenUri: string } - | { type: Select<'batch_update_token_metadata'>; tokenIds: string; baseUri: string } - | { type: Select<'freeze_token_metadata'> } -) + type: string | undefined + tokenUri: string + price: string + recipient: string + tokenId: number + batchNumber: number + whitelist: string + startTime: string | undefined + limit: number + tokenIds: string + recipients: string[] + collectionInfo: CollectionInfo | undefined + baseUri: string +} export const dispatchExecute = async (args: DispatchExecuteArgs) => { const { vendingMinterMessages, baseMinterMessages, sg721Messages, txSigner } = args @@ -281,7 +272,7 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => { return vendingMinterMessages.setWhitelist(txSigner, args.whitelist) } case 'update_start_time': { - return vendingMinterMessages.updateStartTime(txSigner, args.startTime) + return vendingMinterMessages.updateStartTime(txSigner, args.startTime as string) } case 'update_start_trading_time': { return vendingMinterMessages.updateStartTradingTime(txSigner, args.startTime) @@ -304,6 +295,9 @@ export const dispatchExecute = async (args: DispatchExecuteArgs) => { case 'freeze_token_metadata': { return sg721Messages.freezeTokenMetadata() } + case 'enable_updatable': { + return sg721Messages.enableUpdatable() + } case 'shuffle': { return vendingMinterMessages.shuffle(txSigner) } @@ -368,7 +362,7 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => { return vendingMinterMessages(minterContract)?.setWhitelist(args.whitelist) } case 'update_start_time': { - return vendingMinterMessages(minterContract)?.updateStartTime(args.startTime) + return vendingMinterMessages(minterContract)?.updateStartTime(args.startTime as string) } case 'update_start_trading_time': { return vendingMinterMessages(minterContract)?.updateStartTradingTime(args.startTime as string) @@ -391,6 +385,9 @@ export const previewExecutePayload = (args: DispatchExecuteArgs) => { case 'freeze_token_metadata': { return sg721Messages(sg721Contract)?.freezeTokenMetadata() } + case 'enable_updatable': { + return sg721Messages(sg721Contract)?.enableUpdatable() + } case 'shuffle': { return vendingMinterMessages(minterContract)?.shuffle() } From 103cb3ef857e152496a22f50cea4db9e607b799d Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Mon, 29 May 2023 09:53:11 +0300 Subject: [PATCH 6/6] Bump Studio version --- .env.example | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 47ea061..55a00c5 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -APP_VERSION=0.6.1 +APP_VERSION=0.6.2 NEXT_PUBLIC_PINATA_ENDPOINT_URL=https://api.pinata.cloud/pinning/pinFileToIPFS NEXT_PUBLIC_SG721_CODE_ID=2092 diff --git a/package.json b/package.json index 3bdcb91..6b8e26b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stargaze-studio", - "version": "0.6.1", + "version": "0.6.2", "workspaces": [ "packages/*" ],