Skip to content

Commit 94289d2

Browse files
authored
Merge branch 'main' into docs-bulk-updates
2 parents bf9f3ed + 283dc28 commit 94289d2

File tree

342 files changed

+2510
-1307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+2510
-1307
lines changed

.changeset/shaky-seals-cheer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Include native tokens in Insight.getOwnedTokens

apps/dashboard/src/@/api/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export async function getUniversalBridgeWalletUsage(args: {
426426
console.error(
427427
`Failed to fetch universal bridge wallet stats: ${res?.status} - ${res.statusText} - ${reason}`,
428428
);
429-
return null;
429+
return [];
430430
}
431431

432432
const json = await res.json();

apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import { MultiSelect } from "@/components/blocks/multi-select";
44
import { SelectWithSearch } from "@/components/blocks/select-with-search";
55
import { Badge } from "@/components/ui/badge";
6+
import { ChainIconClient } from "components/icons/ChainIcon";
7+
import { useAllChainsData } from "hooks/chains/allChains";
68
import { useCallback, useMemo } from "react";
79
import type { ThirdwebClient } from "thirdweb";
8-
import { ChainIconClient } from "../../../components/icons/ChainIcon";
9-
import { useAllChainsData } from "../../../hooks/chains/allChains";
1010

1111
function cleanChainName(chainName: string) {
1212
return chainName.replace("Mainnet", "");

apps/dashboard/src/@/components/blocks/TokenSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import { useAllChainsData } from "hooks/chains/allChains";
2+
import { useTokensData } from "hooks/tokens/tokens";
13
import { useCallback, useMemo } from "react";
24
import {
35
NATIVE_TOKEN_ADDRESS,
46
type ThirdwebClient,
57
getAddress,
68
} from "thirdweb";
79
import { shortenAddress } from "thirdweb/utils";
8-
import { useAllChainsData } from "../../../hooks/chains/allChains";
9-
import { useTokensData } from "../../../hooks/tokens/tokens";
1010
import { replaceIpfsUrl } from "../../../lib/sdk";
1111
import { fallbackChainIcon } from "../../../utils/chain-icons";
1212
import type { TokenMetadata } from "../../api/universal-bridge/tokens";

apps/dashboard/src/@/components/blocks/charts/area-chart.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import {
1515
ChartTooltip,
1616
ChartTooltipContent,
1717
} from "@/components/ui/chart";
18-
import { formatDate } from "date-fns";
19-
import { useMemo } from "react";
20-
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
18+
import { cn } from "@/lib/utils";
2119
import {
2220
EmptyChartState,
2321
LoadingChartState,
24-
} from "../../../../components/analytics/empty-chart-state";
25-
import { cn } from "../../../lib/utils";
22+
} from "components/analytics/empty-chart-state";
23+
import { formatDate } from "date-fns";
24+
import { useMemo } from "react";
25+
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
2626

2727
type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
2828
header?: {

apps/dashboard/src/@/components/blocks/charts/bar-chart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ import {
1717
ChartTooltip,
1818
ChartTooltipContent,
1919
} from "@/components/ui/chart";
20-
import { formatDate } from "date-fns";
21-
import { useMemo } from "react";
20+
import { cn } from "@/lib/utils";
2221
import {
2322
EmptyChartState,
2423
LoadingChartState,
25-
} from "../../../../components/analytics/empty-chart-state";
26-
import { cn } from "../../../lib/utils";
24+
} from "components/analytics/empty-chart-state";
25+
import { formatDate } from "date-fns";
26+
import { useMemo } from "react";
2727

2828
type ThirdwebBarChartProps<TConfig extends ChartConfig> = {
2929
// metadata

apps/dashboard/src/@/components/blocks/dismissible-alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

3+
import { useLocalStorage } from "hooks/useLocalStorage";
34
import { XIcon } from "lucide-react";
4-
import { useLocalStorage } from "../../../hooks/useLocalStorage";
55
import { Button } from "../ui/button";
66

77
export function DismissibleAlert(props: {

apps/dashboard/src/@/components/blocks/pricing-card.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { Badge } from "@/components/ui/badge";
44
import { Button } from "@/components/ui/button";
55
import { ToolTipLabel } from "@/components/ui/tooltip";
66
import { cn } from "@/lib/utils";
7+
import { RenewSubscriptionButton } from "components/settings/Account/Billing/renew-subscription/renew-subscription-button";
8+
import { useTrack } from "hooks/analytics/useTrack";
79
import { CheckIcon, DollarSignIcon } from "lucide-react";
810
import Link from "next/link";
911
import type React from "react";
12+
import { remainingDays } from "utils/date-utils";
1013
import { TEAM_PLANS } from "utils/pricing";
11-
import { RenewSubscriptionButton } from "../../../components/settings/Account/Billing/renew-subscription/renew-subscription-button";
12-
import { useTrack } from "../../../hooks/analytics/useTrack";
13-
import { remainingDays } from "../../../utils/date-utils";
1414
import type { ProductSKU } from "../../lib/billing";
1515
import { CheckoutButton } from "../billing";
1616

apps/dashboard/src/@/components/blocks/wallet-address.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
HoverCardContent,
66
HoverCardTrigger,
77
} from "@/components/ui/hover-card";
8-
import { useThirdwebClient } from "@/constants/thirdweb.client";
98
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
109
import { useClipboard } from "hooks/useClipboard";
1110
import { CheckIcon, CopyIcon, XIcon } from "lucide-react";
@@ -24,8 +23,8 @@ export function WalletAddress(props: {
2423
shortenAddress?: boolean;
2524
className?: string;
2625
iconClassName?: string;
26+
client: ThirdwebClient;
2727
}) {
28-
const thirdwebClient = useThirdwebClient();
2928
// default back to zero address if no address provided
3029
const address = useMemo(() => props.address || ZERO_ADDRESS, [props.address]);
3130

@@ -40,7 +39,7 @@ export function WalletAddress(props: {
4039

4140
const profiles = useSocialProfiles({
4241
address: address,
43-
client: thirdwebClient,
42+
client: props.client,
4443
});
4544

4645
const { onCopy, hasCopied } = useClipboard(address, 2000);
@@ -78,7 +77,7 @@ export function WalletAddress(props: {
7877
<WalletAvatar
7978
address={address}
8079
profiles={profiles.data || []}
81-
thirdwebClient={thirdwebClient}
80+
thirdwebClient={props.client}
8281
iconClassName={props.iconClassName}
8382
/>
8483
)}
@@ -122,7 +121,7 @@ export function WalletAddress(props: {
122121
) : (
123122
profiles.data?.map((profile) => {
124123
const walletAvatarLink = resolveSchemeWithErrorHandler({
125-
client: thirdwebClient,
124+
client: props.client,
126125
uri: profile.avatar,
127126
});
128127

apps/dashboard/src/@/components/ui/NavLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use client";
22

33
import { cn } from "@/lib/utils";
4+
import { useTrack } from "hooks/analytics/useTrack";
45
import Link from "next/link";
56
import { usePathname } from "next/navigation";
6-
import { useTrack } from "../../../hooks/analytics/useTrack";
77

88
export type NavButtonProps = {
99
className?: string;

apps/dashboard/src/@/components/ui/code/code.server.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ export type CodeProps = {
66
code: string;
77
lang: BundledLanguage;
88
className?: string;
9+
ignoreFormattingErrors?: boolean;
910
};
1011

1112
export const CodeServer: React.FC<CodeProps> = async ({
1213
code,
1314
lang,
1415
className,
16+
ignoreFormattingErrors,
1517
}) => {
16-
const { html, formattedCode } = await getCodeHtml(code, lang);
18+
const { html, formattedCode } = await getCodeHtml(code, lang, {
19+
ignoreFormattingErrors,
20+
});
1721
return <RenderCode code={formattedCode} html={html} className={className} />;
1822
};

apps/dashboard/src/@/constants/thirdweb.client.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

apps/dashboard/src/@/lib/time.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { differenceInCalendarDays } from "date-fns";
21
import {
32
type DurationId,
43
type Range,
54
getLastNDaysRange,
6-
} from "../../components/analytics/date-range-selector";
5+
} from "components/analytics/date-range-selector";
6+
import { differenceInCalendarDays } from "date-fns";
77

88
export function normalizeTime(date: Date) {
99
const newDate = new Date(date);

apps/dashboard/src/@3rdweb-sdk/react/components/connect-wallet/index.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
"use client";
22

33
import { Button } from "@/components/ui/button";
4-
import { useThirdwebClient } from "@/constants/thirdweb.client";
54
import { useStore } from "@/lib/reactive";
65
import { getSDKTheme } from "app/(app)/components/sdk-component-theme";
6+
import { LazyConfigureNetworkModal } from "components/configure-networks/LazyConfigureNetworkModal";
77
import { CustomChainRenderer } from "components/selects/CustomChainRenderer";
88
import { mapV4ChainToV5Chain } from "contexts/map-chains";
99
import { useTrack } from "hooks/analytics/useTrack";
10+
import { useAllChainsData } from "hooks/chains/allChains";
1011
import { useTheme } from "next-themes";
1112
import Image from "next/image";
1213
import Link from "next/link";
1314
import { usePathname } from "next/navigation";
1415
import { useCallback, useMemo, useState } from "react";
15-
import type { Chain } from "thirdweb";
16+
import type { Chain, ThirdwebClient } from "thirdweb";
1617
import {
1718
ConnectButton,
1819
type NetworkSelectorProps,
@@ -21,8 +22,6 @@ import {
2122
} from "thirdweb/react";
2223
import { useFavoriteChainIds } from "../../../../app/(app)/(dashboard)/(chain)/components/client/star-button";
2324
import { doLogout } from "../../../../app/(app)/login/auth-actions";
24-
import { LazyConfigureNetworkModal } from "../../../../components/configure-networks/LazyConfigureNetworkModal";
25-
import { useAllChainsData } from "../../../../hooks/chains/allChains";
2625
import {
2726
type StoredChain,
2827
addRecentlyUsedChainId,
@@ -36,9 +35,11 @@ export const CustomConnectWallet = (props: {
3635
signInLinkButtonClassName?: string;
3736
detailsButtonClassName?: string;
3837
chain?: Chain;
38+
client: ThirdwebClient;
3939
isLoggedIn: boolean;
4040
}) => {
41-
const thirdwebClient = useThirdwebClient();
41+
const client = props.client;
42+
4243
const loginRequired =
4344
props.loginRequired === undefined ? true : props.loginRequired;
4445

@@ -140,7 +141,7 @@ export const CustomConnectWallet = (props: {
140141
<>
141142
<ConnectButton
142143
theme={getSDKTheme(t)}
143-
client={thirdwebClient}
144+
client={client}
144145
connectModal={{
145146
privacyPolicyUrl: "/privacy-policy",
146147
termsOfServiceUrl: "/terms",
@@ -175,7 +176,7 @@ export const CustomConnectWallet = (props: {
175176
renderChain(props) {
176177
return (
177178
<CustomChainRenderer
178-
client={thirdwebClient}
179+
client={client}
179180
{...props}
180181
openEditChainModal={(c) => {
181182
setIsNetworkConfigModalOpen(true);
@@ -197,6 +198,7 @@ export const CustomConnectWallet = (props: {
197198
open={isNetworkConfigModalOpen}
198199
onOpenChange={setIsNetworkConfigModalOpen}
199200
editChain={editChain}
201+
client={client}
200202
/>
201203
</>
202204
);
@@ -276,12 +278,11 @@ function ConnectWalletWelcomeScreen(props: {
276278
export function useCustomConnectModal() {
277279
const { connect } = useConnectModal();
278280
const { theme } = useTheme();
279-
const thirdwebClient = useThirdwebClient();
280281

281282
return useCallback(
282-
(options?: { chain?: Chain }) => {
283+
(options: { chain?: Chain; client: ThirdwebClient }) => {
283284
return connect({
284-
client: thirdwebClient,
285+
client: options.client,
285286
appMetadata: {
286287
name: "thirdweb",
287288
logoUrl: "https://thirdweb.com/favicon.ico",
@@ -299,7 +300,7 @@ export function useCustomConnectModal() {
299300
theme: getSDKTheme(theme === "light" ? "light" : "dark"),
300301
});
301302
},
302-
[connect, theme, thirdwebClient],
303+
[connect, theme],
303304
);
304305
}
305306

apps/dashboard/src/@3rdweb-sdk/react/hooks/useDashboardStorageUpload.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
import { useThirdwebClient } from "@/constants/thirdweb.client";
21
import { useMutation } from "@tanstack/react-query";
2+
import type { ThirdwebClient } from "thirdweb";
33
import { upload } from "thirdweb/storage";
44

55
type DashboardUploadOptions = {
66
uploadWithoutDirectory?: boolean;
77
metadata?: Record<string, string>;
8+
client: ThirdwebClient;
89
};
910

10-
export function useDashboardStorageUpload(options?: DashboardUploadOptions) {
11-
const thirdwebClient = useThirdwebClient();
11+
export function useDashboardStorageUpload(options: DashboardUploadOptions) {
1212
return useMutation({
1313
mutationFn: async (files: Array<File | string>): Promise<string[]> => {
1414
const uris = await upload({
15-
client: thirdwebClient,
1615
files,
1716
...options,
1817
});

apps/dashboard/src/app/(app)/(dashboard)/(bridge)/routes/components/server/routelist-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Card, CardContent, CardHeader } from "@/components/ui/card";
2+
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
23
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
34
import { defineChain } from "thirdweb";
45
import { getChainMetadata } from "thirdweb/chains";
5-
import { serverThirdwebClient } from "../../../../../../../@/constants/thirdweb-client.server";
66

77
type RouteListCardProps = {
88
originChainId: number;

0 commit comments

Comments
 (0)