From e6f0a5b91f74066b04a5b9411052163b50f77f29 Mon Sep 17 00:00:00 2001 From: Serkan Reis Date: Tue, 10 Oct 2023 11:41:52 +0300 Subject: [PATCH] Update Royalty Registry > Query --- pages/contracts/royaltyRegistry/execute.tsx | 2 +- pages/contracts/royaltyRegistry/query.tsx | 51 ++++++++++++++------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/pages/contracts/royaltyRegistry/execute.tsx b/pages/contracts/royaltyRegistry/execute.tsx index f2647c6..873b979 100644 --- a/pages/contracts/royaltyRegistry/execute.tsx +++ b/pages/contracts/royaltyRegistry/execute.tsx @@ -27,7 +27,7 @@ import { INFINITY_SWAP_PROTOCOL_ADDRESS, ROYALTY_REGISTRY_ADDRESS } from 'utils/ import { withMetadata } from 'utils/layout' import { links } from 'utils/links' -const protocolList = [{ name: 'Infinity Swap', address: INFINITY_SWAP_PROTOCOL_ADDRESS }] +export const protocolList = [{ name: 'Infinity Swap', address: INFINITY_SWAP_PROTOCOL_ADDRESS }] const RoyaltyRegistryExecutePage: NextPage = () => { const { royaltyRegistry: contract } = useContracts() diff --git a/pages/contracts/royaltyRegistry/query.tsx b/pages/contracts/royaltyRegistry/query.tsx index b59a009..2138b8f 100644 --- a/pages/contracts/royaltyRegistry/query.tsx +++ b/pages/contracts/royaltyRegistry/query.tsx @@ -17,11 +17,13 @@ import { NextSeo } from 'next-seo' import { useEffect, useState } from 'react' import { toast } from 'react-hot-toast' import { useQuery } from 'react-query' -import { ROYALTY_REGISTRY_ADDRESS } from 'utils/constants' +import { INFINITY_SWAP_PROTOCOL_ADDRESS, ROYALTY_REGISTRY_ADDRESS } from 'utils/constants' import { withMetadata } from 'utils/layout' import { links } from 'utils/links' import { resolveAddress } from 'utils/resolveAddress' +import { protocolList } from './execute' + const RoyaltyRegistryQueryPage: NextPage = () => { const { royaltyRegistry: contract } = useContracts() const wallet = useWallet() @@ -47,12 +49,14 @@ const RoyaltyRegistryQueryPage: NextPage = () => { name: 'protocol-address', title: 'Protocol Address', subtitle: 'Address of the protocol', + defaultValue: INFINITY_SWAP_PROTOCOL_ADDRESS, }) const collectionAddress = collectionAddressState.value const protocolAddress = protocolAddressState.value const [type, setType] = useState('config') + const [manualProtocolInput, setManualProtocolInput] = useState(false) const { data: response } = useQuery( [contractAddress, type, contract, wallet, collectionAddress, protocolAddress] as const, @@ -82,14 +86,14 @@ const RoyaltyRegistryQueryPage: NextPage = () => { const router = useRouter() useEffect(() => { - if (contractAddress.length > 0) { - void router.replace({ query: { contractAddress } }) + if (collectionAddress.length > 0) { + void router.replace({ query: { collectionAddress } }) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [contractAddress]) + }, [collectionAddress]) useEffect(() => { - const initial = new URL(document.URL).searchParams.get('contractAddress') - if (initial && initial.length > 0) contractState.onChange(initial) + const initial = new URL(document.URL).searchParams.get('collectionAddress') + if (initial && initial.length > 0) collectionAddressState.onChange(initial) }, []) return ( @@ -104,7 +108,7 @@ const RoyaltyRegistryQueryPage: NextPage = () => {
- + - - - - + Selected Protocol + + + +