Skip to content

Commit 8adfa86

Browse files
Allow non-checksummed addresses (#2206)
* Allow non-checksummed addresses * Fix ENS addresses * Missed this one * Also this one
1 parent 1051f63 commit 8adfa86

File tree

17 files changed

+64
-68
lines changed

17 files changed

+64
-68
lines changed

components/bear-market-airdrop/Blocks/Hero/ContractsDeployed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export const ContractsDeployed: React.FC<ContractsDeployedProps> = ({
226226
/>
227227
<Text>Want to be eligible for future airdrops?</Text>
228228
<TrackedLink
229-
href="https://thirdweb.com/dashboard/contracts/deploy"
229+
href="/dashboard/contracts/deploy"
230230
target="_blank"
231231
category={BEAR_MARKET_TRACKING_CATEGORY}
232232
label="contracts_deployed"

components/bear-market-airdrop/Blocks/Hero/Unboxed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ You can claim one too at:`,
276276
</ButtonGroup>
277277
<Button
278278
as="a"
279-
href="https://thirdweb.com"
279+
href="/"
280280
target="_blank"
281281
bg={colorMode === "light" ? "black" : "white"}
282282
color={colorMode === "light" ? "white" : "black"}

components/contract-components/contract-deploy-form/custom-contract.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ const CustomContractForm: React.FC<CustomContractFormProps> = ({
479479
<Text>
480480
Import so I can find it in the list of my contracts at{" "}
481481
<TrackedLink
482-
href="https://thirdweb.com/dashboard"
482+
href="/dashboard"
483483
isExternal
484484
category="custom-contract"
485485
label="visit-dashboard"

components/contract-components/published-contract/addresses-modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Flex, Link, useDisclosure } from "@chakra-ui/react";
2+
import { THIRDWEB_DOMAIN } from "constants/urls";
23
import { useAllChainsData } from "hooks/chains/allChains";
34
import { Drawer, Heading, Text } from "tw-components";
45

@@ -61,7 +62,7 @@ export const AddressesModal: React.FC<AddressesModalProps> = ({
6162
{chainIdToChainRecord[parseInt(chainId)]?.name}
6263
</Text>
6364
<Link
64-
href={`https://thirdweb.com/${chainId}/${address}`}
65+
href={`${THIRDWEB_DOMAIN}/${chainId}/${address}`}
6566
isExternal
6667
color="blue.500"
6768
>

components/contract-components/published-contract/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
import { ContractFunctionsOverview } from "components/contract-functions/contract-functions";
3131
import { replaceDeployerAddress } from "components/explore/publisher";
3232
import { ShareButton } from "components/share-buttom";
33+
import { THIRDWEB_DOMAIN } from "constants/urls";
3334
import { Extensions } from "contract-ui/tabs/overview/components/Extensions";
3435
import { format } from "date-fns";
3536
import { correctAndUniqueLicenses } from "lib/licenses";
@@ -104,7 +105,7 @@ export const PublishedContract: React.FC<PublishedContractProps> = ({
104105

105106
const publisherProfile = usePublisherProfile(contract.publisher);
106107

107-
const currentRoute = `https://thirdweb.com${router.asPath.replace(
108+
const currentRoute = `${THIRDWEB_DOMAIN}${router.asPath.replace(
108109
"/publish",
109110
"",
110111
)}`.replace("deployer.thirdweb.eth", "thirdweb.eth");

contract-ui/tabs/listings/components/list-form.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,7 @@ export const CreateListingsForm: React.FC<NFTMintForm> = ({
361361
<Text color="orange.800" _dark={{ color: "orange.900" }}>
362362
There are no NFTs owned by this wallet. You need NFTs to create a
363363
listing. You can create NFTs with thirdweb.{" "}
364-
<Link
365-
href="https://thirdweb.com/explore/nft"
366-
color="blue.600"
367-
isExternal
368-
>
364+
<Link href="/explore/nft" color="blue.600" isExternal>
369365
Explore NFT contracts
370366
</Link>
371367
.

pages/[chainSlug]/[...paths].tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ import { fetchChain } from "utils/fetchChain";
3939
import { ThirdwebNextPage } from "utils/types";
4040
import { shortenIfAddress } from "utils/usedapp-external";
4141
import { ClientOnly } from "../../components/ClientOnly/ClientOnly";
42+
import { THIRDWEB_DOMAIN } from "constants/urls";
43+
import { getAddress } from "ethers/lib/utils";
4244

4345
type EVMContractProps = {
4446
contractInfo?: EVMContractInfo;
@@ -269,7 +271,7 @@ EVMContractPage.getLayout = (page, props: EVMContractProps) => {
269271
.replace("Mainnet", "")
270272
.replace("Testnet", "")
271273
.trim();
272-
const url = `https://thirdweb.com/${props.contractInfo?.chainSlug}/${props.contractInfo?.contractAddress}/`;
274+
const url = `${THIRDWEB_DOMAIN}/${props.contractInfo?.chainSlug}/${props.contractInfo?.contractAddress}/`;
273275
const SEOTitle = `${displayName} | ${
274276
cleanedChainName ? `${cleanedChainName} ` : ""
275277
}Smart Contract`;
@@ -354,8 +356,15 @@ export const getStaticProps: GetStaticProps<EVMContractProps> = async (ctx) => {
354356
let address: string | null = null;
355357
const queryClient = new QueryClient();
356358

359+
const lowercaseAddress = contractAddress.toLowerCase();
360+
const checksummedAdress = lowercaseAddress.endsWith("eth")
361+
? lowercaseAddress
362+
: getAddress(lowercaseAddress);
363+
357364
try {
358-
const queryResult = await queryClient.fetchQuery(ensQuery(contractAddress));
365+
const queryResult = await queryClient.fetchQuery(
366+
ensQuery(checksummedAdress),
367+
);
359368
address = queryResult?.address;
360369
} catch {
361370
return {
@@ -413,7 +422,7 @@ export const getStaticProps: GetStaticProps<EVMContractProps> = async (ctx) => {
413422
dehydratedState: dehydrate(queryClient),
414423
contractInfo: {
415424
chainSlug,
416-
contractAddress,
425+
contractAddress: checksummedAdress,
417426
chain,
418427
},
419428
detectedExtension,

pages/build/base.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ const Base: ThirdwebNextPage = () => {
507507
},
508508
{
509509
text: "Browse templates",
510-
href: "https://thirdweb.com/templates",
510+
href: "/templates",
511511
},
512512
],
513513
},
@@ -533,7 +533,7 @@ const Base: ThirdwebNextPage = () => {
533533
},
534534
{
535535
text: "Browse templates",
536-
href: "https://thirdweb.com/templates",
536+
href: "/templates",
537537
},
538538
],
539539
},
@@ -551,7 +551,7 @@ const Base: ThirdwebNextPage = () => {
551551
},
552552
{
553553
text: "Browse templates",
554-
href: "https://thirdweb.com/templates",
554+
href: "/templates",
555555
},
556556
],
557557
},

pages/community/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const communitySections = [
8888
cards: [
8989
{
9090
image: "/assets/community/home/ambassadors.svg",
91-
link: "https://thirdweb.com/ambassadors",
91+
link: "/ambassadors",
9292
title: "Ambassadors",
9393
description: "",
9494
},

pages/embedded-wallets.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const EmbeddedWalletsLanding: ThirdwebNextPage = () => {
223223
image={require("public/assets/landingpage/desktop/analytics.png")}
224224
mobileImage={require("public/assets/landingpage/mobile/analytics.png")}
225225
TRACKING_CATEGORY={TRACKING_CATEGORY}
226-
href="https://thirdweb.com/dashboard/wallets/analytics"
226+
href="/dashboard/wallets/analytics"
227227
colSpan={1}
228228
/>
229229
</LandingGridSection>

0 commit comments

Comments
 (0)