From 461f3409a56c3ca154fae032235192556aca817a Mon Sep 17 00:00:00 2001 From: "zapaz.eth" Date: Wed, 15 May 2024 16:55:40 +0200 Subject: [PATCH] fix initial display --- common/src/apis/api-covalent.ts | 7 ++++--- common/src/apis/api-thegraph.ts | 4 ++-- common/src/collection/collection-list.ts | 6 +----- svelte/src/components/Collection/CollectionSelect.svelte | 2 +- svelte/src/components/Nft/Nft.svelte | 2 +- svelte/src/components/Nfts/Nfts.svelte | 3 +-- svelte/src/stores/collection/collectionSubList.ts | 1 + 7 files changed, 11 insertions(+), 14 deletions(-) diff --git a/common/src/apis/api-covalent.ts b/common/src/apis/api-covalent.ts index 385317398..67ee518ee 100644 --- a/common/src/apis/api-covalent.ts +++ b/common/src/apis/api-covalent.ts @@ -4,7 +4,7 @@ import config from "@kredeum/config/dist/config.json"; import type { FetchResponse } from "../common/fetch"; import type { CollectionFilterType, CollectionType, NftType } from "../common/types"; -import { ADDRESS_ZERO, getChecksumAddress } from "../common/config"; +import { ADDRESS_ZERO, getChecksumAddress, isAddressNotZero } from "../common/config"; import { DEFAULT_NAME, DEFAULT_SYMBOL } from "../common/config"; import { fetchJson, FETCH_LIMIT } from "../common/fetch"; import { keyCollection, keyNft } from "../common/keys"; @@ -36,12 +36,12 @@ const _covalentFetch = async (chainId: number, path: string): Promise = }; const covalentCollections = async (chainId: number, account: string): Promise> => { - // console.log(`covalentCollections ${keyCollection(chainId, account)}\n`); + // console.log(`covalentCollections ${chainId} ${account}\n`); const collections: Map = new Map(); const chainName = networks.getChainName(chainId); - if (!(chainId && chainName && account)) return collections; + if (!(chainId && chainName && isAddressNotZero(account))) return collections; // const match = // eslint-disable-next-line quotes @@ -50,6 +50,7 @@ const covalentCollections = async (chainId: number, account: string): Promise = new Map(); const network = networks.get(chainId); - if (account) { + if (isAddressNotZero(account)) { const query = ` { ownerPerTokenContracts( diff --git a/common/src/collection/collection-list.ts b/common/src/collection/collection-list.ts index 2d474308e..3e82df71b 100644 --- a/common/src/collection/collection-list.ts +++ b/common/src/collection/collection-list.ts @@ -35,7 +35,7 @@ const collectionList = async ( account?: string, mintable?: boolean ): Promise> => { - // console.log(`collectionList ${keyCollections(chainId, account)}\n`); + // console.log(`collectionList ${chainId} ${account}\n`); let collections: Map = new Map(); @@ -55,10 +55,6 @@ const collectionList = async ( collectionsApi = await covalentCollections(chainId, account); // console.log("collectionList covalentCollections", collectionsApi); } - // else if (infuraActive(chainId)) { - // collectionsApi = await infuraCollections(chainId, account); - // // console.log("collectionList infuraCollections", collectionsApi); - // } const lengthBefore = collectionsApi.size; // console.log("collectionsApi BEFORE", collectionsApi); diff --git a/svelte/src/components/Collection/CollectionSelect.svelte b/svelte/src/components/Collection/CollectionSelect.svelte index 75e8774d2..179a33c6e 100644 --- a/svelte/src/components/Collection/CollectionSelect.svelte +++ b/svelte/src/components/Collection/CollectionSelect.svelte @@ -39,7 +39,7 @@ // let i: number = 0; // HANDLE CHANGE : on truthy chainId and account, and whatever mintable - $: $refreshAll, mintable, chainId && handleChangeCollection(); + $: $refreshAll, mintable, account && chainId && handleChangeCollection(); const handleChangeCollection = async (): Promise => { // console.log(`COLLECTION LIST CHANGE #${i++} ${keyCollection(chainId, account || ADDRESS_ZERO)}`); diff --git a/svelte/src/components/Nft/Nft.svelte b/svelte/src/components/Nft/Nft.svelte index 43471b335..d090ce919 100644 --- a/svelte/src/components/Nft/Nft.svelte +++ b/svelte/src/components/Nft/Nft.svelte @@ -49,7 +49,7 @@ ///////////////////////////////////////////////////////////// $: nft = nftStoreAndRefresh(chainId, address, tokenID); ///////////////////////////////////////////////////////////// - // $: console.log("NFT", $nft); + // $: console.log(" { diff --git a/svelte/src/stores/collection/collectionSubList.ts b/svelte/src/stores/collection/collectionSubList.ts index e323ce54d..a3a8ea1e3 100644 --- a/svelte/src/stores/collection/collectionSubList.ts +++ b/svelte/src/stores/collection/collectionSubList.ts @@ -74,6 +74,7 @@ const collectionSubListRefresh = async ( address?: string, mintable = false ): Promise => { + // console.log("collectionSubListRefresh:", chainId, account, address, mintable); if (!chainId) return; const colls = await collectionListLib(chainId, account, mintable);