From d7235264f9076de3c3e0fe6913529c7f23578138 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Mon, 22 Jan 2024 23:22:42 +0300 Subject: [PATCH 1/8] Include export options for collection holder snapshots --- pages/snapshots/snapshot.tsx | 73 ++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/pages/snapshots/snapshot.tsx b/pages/snapshots/snapshot.tsx index 63c8590..df07b9f 100644 --- a/pages/snapshots/snapshot.tsx +++ b/pages/snapshots/snapshot.tsx @@ -26,8 +26,12 @@ const Snapshots: NextPage = () => { defaultValue: '', }) - const snapshotEndpoint = `https://metabase.constellations.zone/api/public/card/b5764fb2-9a23-4ecf-866b-dec79c4c461e/query/json?parameters=%5B%7B%22type%22%3A%22category%22%2C%22value%22%3A%22${collectionAddressState.value}%22%2C%22id%22%3A%22cb34b7a8-70cf-ba86-8d9c-360b5b2fedd3%22%2C%22target%22%3A%5B%22variable%22%2C%5B%22template-tag%22%2C%22collection_addr%22%5D%5D%7D%5D` - // function to download .json from the endpoint + const [includeStaked, setIncludeStaked] = useState(true) + const [includeListed, setIncludeListed] = useState(true) + const [exportIndividualTokens, setExportIndividualTokens] = useState(false) + + const snapshotEndpoint = `https://metabase.constellations.zone/api/public/card/4cf9550e-5eb7-4fe7-bd3b-dc33229f53dc/query/json?parameters=%5B%7B%22type%22%3A%22category%22%2C%22value%22%3A%22${collectionAddressState.value}%22%2C%22id%22%3A%22cb34b7a8-70cf-ba86-8d9c-360b5b2fedd3%22%2C%22target%22%3A%5B%22variable%22%2C%5B%22template-tag%22%2C%22collection_addr%22%5D%5D%7D%5D` + const download = (content: string, fileName: string, contentType: string) => { const a = document.createElement('a') const file = new Blob([content], { type: contentType }) @@ -51,6 +55,45 @@ const Snapshots: NextPage = () => { +
+

Snapshot Options

+
+ + + +
+
+ + + ) +} + +export default withMetadata(Chain, { center: false }) diff --git a/pages/snapshots/snapshot.tsx b/pages/snapshots/holders.tsx similarity index 92% rename from pages/snapshots/snapshot.tsx rename to pages/snapshots/holders.tsx index df07b9f..4ed360f 100644 --- a/pages/snapshots/snapshot.tsx +++ b/pages/snapshots/holders.tsx @@ -8,6 +8,8 @@ import { ContractPageHeader } from 'components/ContractPageHeader' import { AddressInput } from 'components/forms/FormInput' import { useInputState } from 'components/forms/FormInput.hooks' +import { LinkTabs } from 'components/LinkTabs' +import { snapshotLinkTabs } from 'components/LinkTabs.data' import { SelectCollection } from 'components/SelectCollection' import type { NextPage } from 'next' import { NextSeo } from 'next-seo' @@ -17,7 +19,7 @@ import toast from 'react-hot-toast' import { withMetadata } from 'utils/layout' import { links } from 'utils/links' -const Snapshots: NextPage = () => { +const Holders: NextPage = () => { const [collectionAddress, setCollectionAddress] = useState('') const collectionAddressState = useInputState({ id: 'collection-address', @@ -52,14 +54,14 @@ const Snapshots: NextPage = () => { link={links.Documentation} title="Snapshots" /> - +

Snapshot Options

- + ) } From 19e5fd0abb2f22b701709d84d4176fcaee75022a Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Wed, 24 Jan 2024 12:27:02 +0300 Subject: [PATCH 6/8] Recommend active user list exports for free mints --- pages/collections/create.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pages/collections/create.tsx b/pages/collections/create.tsx index aed40ce..9bd31b7 100644 --- a/pages/collections/create.tsx +++ b/pages/collections/create.tsx @@ -1902,6 +1902,13 @@ const CollectionCreationPage: NextPage = () => { Setting the unit price as 0 for public minting may render the collection vulnerable for bot attacks. Please consider creating a whitelist of addresses that can mint for free instead. +
+
+ You may export a list of active Stargaze addresses using + + Snapshots + +
From 2a293f1a62da2ac1b301952eb3431ff3f4b33fb5 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Wed, 24 Jan 2024 12:35:28 +0300 Subject: [PATCH 7/8] Add empty collection address warning --- pages/snapshots/holders.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/snapshots/holders.tsx b/pages/snapshots/holders.tsx index 5f928ec..3fecfe3 100644 --- a/pages/snapshots/holders.tsx +++ b/pages/snapshots/holders.tsx @@ -101,6 +101,12 @@ const Holders: NextPage = () => { className="px-4 py-2 font-bold text-white bg-stargaze rounded-md" isLoading={isLoading} onClick={() => { + if (collectionAddress.length === 0) { + toast.error('Please select a collection or enter a valid collection address.', { + style: { maxWidth: 'none' }, + }) + return + } setIsLoading(true) fetch(snapshotEndpoint) .then((response) => response.json()) From e219566cd2b14febfd7090f2da834ba5d9543e56 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Wed, 24 Jan 2024 12:39:14 +0300 Subject: [PATCH 8/8] Add empty collection address warning - 2 --- pages/snapshots/holders.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/snapshots/holders.tsx b/pages/snapshots/holders.tsx index 3fecfe3..f011a16 100644 --- a/pages/snapshots/holders.tsx +++ b/pages/snapshots/holders.tsx @@ -101,7 +101,7 @@ const Holders: NextPage = () => { className="px-4 py-2 font-bold text-white bg-stargaze rounded-md" isLoading={isLoading} onClick={() => { - if (collectionAddress.length === 0) { + if (collectionAddressState.value.length === 0) { toast.error('Please select a collection or enter a valid collection address.', { style: { maxWidth: 'none' }, })