Skip to content

Commit 8870c63

Browse files
authored
Merge branch 'main' into gi/product-feedback-top-menu
2 parents 057c54e + 1c6b124 commit 8870c63

File tree

783 files changed

+27786
-16712
lines changed

Some content is hidden

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

783 files changed

+27786
-16712
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ See our [open source page](https://thirdweb.com/open-source) for more informatio
172172
- [Documentation](https://portal.thirdweb.com/)
173173
- [Templates](https://thirdweb.com/templates)
174174
- [YouTube](https://www.youtube.com/c/thirdweb)
175+
- [X/Twitter](https://x.com/thirdweb)
176+
- [Telegram](https://t.me/officialthirdweb)
175177

176178
## Support
177179

apps/dashboard/.eslintrc.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,30 @@ module.exports = {
9595
'Import "posthog-js" directly only within the analytics helpers ("src/@/analytics/*"). Use the exported helpers from "@/analytics/track" elsewhere.',
9696
name: "posthog-js",
9797
},
98+
{
99+
importNames: ["useSendTransaction"],
100+
message:
101+
'Use `import { useSendAndConfirmTx } from "@/hooks/useSendTx";` instead',
102+
name: "thirdweb/react",
103+
},
104+
{
105+
importNames: ["useSendAndConfirmTransaction"],
106+
message:
107+
'Use `import { useSendAndConfirmTx } from "@/hooks/useSendTx";` instead',
108+
name: "thirdweb/react",
109+
},
110+
{
111+
importNames: ["sendTransaction"],
112+
message:
113+
'Use `import { useSendAndConfirmTx } from "@/hooks/useSendTx";` instead if used in react component',
114+
name: "thirdweb",
115+
},
116+
{
117+
importNames: ["sendAndConfirmTransaction"],
118+
message:
119+
'Use `import { useSendAndConfirmTx } from "@/hooks/useSendTx";` instead if used in react component',
120+
name: "thirdweb",
121+
},
98122
],
99123
patterns: [
100124
{

apps/dashboard/.storybook/preview.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import type { Preview } from "@storybook/nextjs";
2-
import "../src/global.css";
2+
import "@workspace/ui/global.css";
33
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4+
import { Button } from "@workspace/ui/components/button";
45
import { MoonIcon, SunIcon } from "lucide-react";
5-
import { ThemeProvider, useTheme } from "next-themes";
66
import { Inter as interFont } from "next/font/google";
7-
// biome-ignore lint/style/useImportType: <explanation>
8-
import React from "react";
9-
import { useEffect } from "react";
7+
import { ThemeProvider, useTheme } from "next-themes";
8+
// biome-ignore lint/style/useImportType: ok
9+
import React, { useEffect } from "react";
1010
import { Toaster } from "sonner";
11-
import { Button } from "../src/@/components/ui/button";
1211

1312
const queryClient = new QueryClient();
1413

@@ -69,9 +68,7 @@ const preview: Preview = {
6968

7069
export default preview;
7170

72-
function StoryLayout(props: {
73-
children: React.ReactNode;
74-
}) {
71+
function StoryLayout(props: { children: React.ReactNode }) {
7572
const { setTheme, theme } = useTheme();
7673

7774
useEffect(() => {

apps/dashboard/framer-rewrites.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ module.exports = [
6464
"/enterprise",
6565
"/token",
6666
"/vault",
67+
"/monetize/bridge",
6768
];

apps/dashboard/knip.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
],
99
"ignoreBinaries": ["only-allow"],
1010
"ignoreDependencies": [
11+
"@thirdweb-dev/api",
1112
"@thirdweb-dev/service-utils",
1213
"@thirdweb-dev/vault-sdk",
1314
"thirdweb",
1415
"@types/color",
1516
"fast-xml-parser",
1617
"@workspace/ui",
17-
"tailwindcss-animate"
18+
"tailwindcss-animate",
19+
"@radix-ui/react-tooltip",
20+
"shiki",
21+
"react-children-utilities",
22+
"react-markdown",
23+
"remark-gfm"
1824
],
1925
"next": true,
2026
"project": ["src/**"]

apps/dashboard/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@shazow/whatsabi": "0.22.2",
2424
"@tanstack/react-query": "5.81.5",
2525
"@tanstack/react-table": "^8.21.3",
26+
"@thirdweb-dev/api": "workspace:*",
2627
"@thirdweb-dev/service-utils": "workspace:*",
2728
"@thirdweb-dev/vault-sdk": "workspace:*",
2829
"@vercel/functions": "2.2.2",
@@ -34,6 +35,7 @@
3435
"compare-versions": "^6.1.0",
3536
"date-fns": "4.1.0",
3637
"fast-xml-parser": "^5.2.5",
38+
"fetch-event-stream": "0.1.5",
3739
"fuse.js": "7.1.0",
3840
"input-otp": "^1.4.1",
3941
"ioredis": "^5.6.1",
@@ -60,7 +62,7 @@
6062
"remark-gfm": "4.0.1",
6163
"responsive-rsc": "0.0.7",
6264
"server-only": "^0.0.1",
63-
"shiki": "1.27.0",
65+
"shiki": "3.12.0",
6466
"sonner": "2.0.6",
6567
"spdx-correct": "^3.2.0",
6668
"stripe": "17.7.0",

apps/dashboard/src/@/actions/proxies.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type ProxyActionParams = {
1414
body?: string;
1515
headers?: Record<string, string>;
1616
parseAsText?: boolean;
17+
signal?: AbortSignal;
1718
};
1819

1920
type ProxyActionResult<T> =

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { unstable_cache } from "next/cache";
44
import { ANALYTICS_SERVICE_URL } from "@/constants/server-envs";
55
import { normalizeTime } from "@/lib/time";
66
import type {
7+
AIUsageStats,
78
AnalyticsQueryParams,
89
EcosystemWalletStats,
910
EngineCloudStats,
@@ -204,6 +205,41 @@ export function getInAppWalletUsage(
204205
return cached_getInAppWalletUsage(normalizedParams(params), authToken);
205206
}
206207

208+
const cached_getAiUsage = unstable_cache(
209+
async (
210+
params: AnalyticsQueryParams,
211+
authToken: string,
212+
): Promise<AIUsageStats[]> => {
213+
const searchParams = buildSearchParams(params);
214+
const res = await fetchAnalytics({
215+
authToken,
216+
url: `v2/nebula/usage?${searchParams.toString()}`,
217+
init: {
218+
method: "GET",
219+
},
220+
});
221+
222+
if (res?.status !== 200) {
223+
const reason = await res?.text();
224+
console.error(
225+
`Failed to fetch AI usage, ${res?.status} - ${res.statusText} - ${reason}`,
226+
);
227+
return [];
228+
}
229+
230+
const json = await res.json();
231+
return json.data as AIUsageStats[];
232+
},
233+
["getAiUsage"],
234+
{
235+
revalidate: 60 * 60, // 1 hour
236+
},
237+
);
238+
239+
export function getAiUsage(params: AnalyticsQueryParams, authToken: string) {
240+
return cached_getAiUsage(normalizedParams(params), authToken);
241+
}
242+
207243
const cached_getUserOpUsage = unstable_cache(
208244
async (
209245
params: AnalyticsQueryParams,

apps/dashboard/src/@/api/universal-bridge/developer.ts

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -297,38 +297,53 @@ export type PaymentsResponse = {
297297
totalCount: number;
298298
};
299299
};
300+
301+
type BridgePaymentType = "buy" | "sell" | "transfer";
302+
type OnrampPaymentType = "onramp";
303+
300304
export type Payment = {
305+
// common
301306
id: string;
302-
blockNumber?: bigint;
303-
transactionId: string;
307+
createdAt: string;
304308
clientId: string;
305-
sender: string;
306309
receiver: string;
307-
developerFeeRecipient: string;
308-
developerFeeBps: number;
309310
transactions: Array<{
310311
chainId: number;
311312
transactionHash: string;
312313
}>;
313314
status: "PENDING" | "COMPLETED" | "FAILED" | "NOT_FOUND";
314-
type: "buy" | "sell" | "transfer";
315-
originAmount: bigint;
316-
destinationAmount: bigint;
317-
purchaseData: unknown;
318-
originToken: {
319-
address: string;
320-
symbol: string;
321-
decimals: number;
322-
chainId: number;
323-
};
315+
316+
destinationAmount: string;
324317
destinationToken: {
325318
address: string;
326319
symbol: string;
327320
decimals: number;
328321
chainId: number;
329322
};
330-
createdAt: string;
331-
};
323+
purchaseData: unknown;
324+
} & (
325+
| {
326+
type: BridgePaymentType;
327+
transactionId: string;
328+
blockNumber?: string;
329+
sender: string;
330+
developerFeeRecipient: string;
331+
developerFeeBps: number;
332+
originAmount: string;
333+
originToken: {
334+
address: string;
335+
symbol: string;
336+
decimals: number;
337+
chainId: number;
338+
};
339+
}
340+
| {
341+
onrampId: string;
342+
type: OnrampPaymentType;
343+
}
344+
);
345+
346+
export type BridgePayment = Extract<Payment, { type: BridgePaymentType }>;
332347

333348
export async function getPayments(props: {
334349
clientId: string;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "@/constants/public-envs";
2+
import { UB_BASE_URL } from "./constants";
3+
import type { TokenMetadata } from "./types";
4+
5+
export async function getUniversalBridgeTokens(props: {
6+
chainId?: number;
7+
address?: string;
8+
}) {
9+
const url = new URL(`${UB_BASE_URL}/v1/tokens`);
10+
11+
if (props.chainId) {
12+
url.searchParams.append("chainId", String(props.chainId));
13+
}
14+
if (props.address) {
15+
url.searchParams.append("tokenAddress", props.address);
16+
}
17+
url.searchParams.append("limit", "1000");
18+
url.searchParams.append("includePrices", "false");
19+
20+
const res = await fetch(url.toString(), {
21+
headers: {
22+
"Content-Type": "application/json",
23+
"x-client-id": NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
24+
} as Record<string, string>,
25+
method: "GET",
26+
});
27+
28+
if (!res.ok) {
29+
const text = await res.text();
30+
throw new Error(text);
31+
}
32+
33+
const json = await res.json();
34+
return json.data as Array<TokenMetadata>;
35+
}

0 commit comments

Comments
 (0)