Skip to content

Commit 6c9621d

Browse files
authored
Merge branch 'main' into greg/tool-4164-migrate-dashboard-analytics
2 parents 95f3fff + 3d7c2d4 commit 6c9621d

File tree

106 files changed

+575
-544
lines changed

Some content is hidden

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

106 files changed

+575
-544
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
49+
uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
5050
with:
5151
languages: ${{ matrix.language }}
5252
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -59,7 +59,7 @@ jobs:
5959
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6060
# If this step fails, then you should remove it and run the build manually (see below)
6161
- name: Autobuild
62-
uses: github/codeql-action/autobuild@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
62+
uses: github/codeql-action/autobuild@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
6363

6464
# ℹ️ Command-line programs to run using the OS shell.
6565
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,4 +72,4 @@ jobs:
7272
# ./location_of_script_within_repo/buildscript.sh
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
75+
uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Create release Pull Request or publish to NPM
3838
id: changesets
39-
uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc #v1.4.0
39+
uses: changesets/action@746c25e23caa47dceb6a48ee85b4cbc5a9f5f293 #v1.4.0
4040
with:
4141
publish: pnpm release
4242
version: pnpm version-packages

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { defineDashboardChain } from "lib/defineDashboardChain";
33
import { ZERO_ADDRESS, isAddress, toTokens } from "thirdweb";
44
import { getWalletBalance } from "thirdweb/wallets";
5-
import { getUserThirdwebClient } from "../../app/(app)/api/lib/getAuthToken";
5+
import { serverThirdwebClient } from "../constants/thirdweb-client.server";
66

77
type BalanceQueryResponse = Array<{
88
balance: string;
@@ -23,7 +23,6 @@ export async function getTokenBalancesFromMoralis(params: {
2323
error: string;
2424
}
2525
> {
26-
const client = await getUserThirdwebClient();
2726
const { contractAddress, chainId } = params;
2827

2928
if (!isAddress(contractAddress)) {
@@ -39,7 +38,7 @@ export async function getTokenBalancesFromMoralis(params: {
3938
const balance = await getWalletBalance({
4039
address: contractAddress,
4140
chain,
42-
client,
41+
client: serverThirdwebClient,
4342
});
4443
return [
4544
{
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { getConfiguredThirdwebClient } from "./thirdweb.server";
2+
3+
export function getClientThirdwebClient(params?: {
4+
jwt: string | undefined | null;
5+
teamId: string | undefined | null;
6+
}) {
7+
return getConfiguredThirdwebClient({
8+
secretKey: params?.jwt ?? undefined,
9+
teamId: params?.teamId ?? undefined,
10+
});
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import "server-only";
2+
3+
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "./env";
4+
import { getConfiguredThirdwebClient } from "./thirdweb.server";
5+
6+
export const serverThirdwebClient = getConfiguredThirdwebClient({
7+
teamId: undefined,
8+
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
9+
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useActiveAccount } from "thirdweb/react";
44
import type { GetAuthTokenResponse } from "../../app/(app)/api/auth/get-auth-token/route";
55
import { LAST_USED_TEAM_ID } from "../../constants/cookies";
66
import { getCookie } from "../../lib/cookie";
7-
import { getThirdwebClient } from "./thirdweb.server";
7+
import { getClientThirdwebClient } from "./thirdweb-client.client";
88

99
// returns a thirdweb client with optional JWT passed i
1010

@@ -38,7 +38,7 @@ export function useThirdwebClient(jwt?: string) {
3838
return useMemo(
3939
// prefer jwt from props over the one from the token query if it exists
4040
() =>
41-
getThirdwebClient({
41+
getClientThirdwebClient({
4242
jwt: jwt || query.data,
4343
teamId: lastUsedTeamId,
4444
}),

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
DASHBOARD_THIRDWEB_CLIENT_ID,
3-
DASHBOARD_THIRDWEB_SECRET_KEY,
43
IPFS_GATEWAY_URL,
54
} from "@/constants/env";
65
import {
@@ -12,7 +11,7 @@ import {
1211
THIRDWEB_SOCIAL_API_DOMAIN,
1312
THIRDWEB_STORAGE_DOMAIN,
1413
} from "constants/urls";
15-
import { createThirdwebClient } from "thirdweb";
14+
import { type ThirdwebClient, createThirdwebClient } from "thirdweb";
1615
import { populateEip712Transaction } from "thirdweb/transaction";
1716
import {
1817
getTransactionDecorator,
@@ -22,15 +21,10 @@ import {
2221
import { getZkPaymasterData } from "thirdweb/wallets/smart";
2322
import { getVercelEnv } from "../../lib/vercel-utils";
2423

25-
// returns a thirdweb client with optional JWT passed in
26-
export function getThirdwebClient(
27-
options:
28-
| {
29-
jwt: string | null | undefined;
30-
teamId: string | undefined;
31-
}
32-
| undefined,
33-
) {
24+
export function getConfiguredThirdwebClient(options: {
25+
secretKey: string | undefined;
26+
teamId: string | undefined;
27+
}): ThirdwebClient {
3428
if (getVercelEnv() !== "production") {
3529
// if not on production: run this when creating a client to set the domains
3630
setThirdwebDomains({
@@ -78,8 +72,8 @@ export function getThirdwebClient(
7872
}
7973

8074
return createThirdwebClient({
81-
teamId: options?.teamId,
82-
secretKey: options?.jwt ? options.jwt : DASHBOARD_THIRDWEB_SECRET_KEY,
75+
teamId: options.teamId,
76+
secretKey: options.secretKey,
8377
clientId: DASHBOARD_THIRDWEB_CLIENT_ID,
8478
config: {
8579
storage: {

apps/dashboard/src/app/(app)/(dashboard)/(bridge)/bridge/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getThirdwebClient } from "@/constants/thirdweb.server";
21
import type { Metadata } from "next";
2+
import { getClientThirdwebClient } from "../../../../../@/constants/thirdweb-client.client";
33
import { UniversalBridgeEmbed } from "./components/client/UniversalBridgeEmbed";
44

55
const title = "Universal Bridge: Swap, Bridge, and On-Ramp";
@@ -19,7 +19,7 @@ export default async function RoutesPage({
1919
searchParams,
2020
}: { searchParams: Record<string, string | string[]> }) {
2121
const { chainId } = searchParams;
22-
const client = getThirdwebClient(undefined);
22+
const client = getClientThirdwebClient(undefined);
2323
return (
2424
<div className="relative mx-auto flex h-screen w-full flex-col items-center justify-center overflow-hidden border py-10">
2525
<main className="container z-10 flex justify-center">

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Card, CardContent, CardHeader } from "@/components/ui/card";
22
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
3-
import type { ThirdwebClient } from "thirdweb";
43
import { defineChain } from "thirdweb";
54
import { getChainMetadata } from "thirdweb/chains";
5+
import { serverThirdwebClient } from "../../../../../../../@/constants/thirdweb-client.server";
66

77
type RouteListCardProps = {
88
originChainId: number;
@@ -15,7 +15,6 @@ type RouteListCardProps = {
1515
destinationTokenIconUri?: string | null;
1616
destinationTokenSymbol: string;
1717
destinationTokenName: string;
18-
client: ThirdwebClient;
1918
};
2019

2120
export async function RouteListCard({
@@ -27,7 +26,6 @@ export async function RouteListCard({
2726
destinationTokenAddress,
2827
destinationTokenIconUri,
2928
destinationTokenName,
30-
client,
3129
}: RouteListCardProps) {
3230
const [
3331
originChain,
@@ -42,13 +40,13 @@ export async function RouteListCard({
4240
originTokenIconUri
4341
? resolveSchemeWithErrorHandler({
4442
uri: originTokenIconUri,
45-
client,
43+
client: serverThirdwebClient,
4644
})
4745
: undefined,
4846
destinationTokenIconUri
4947
? resolveSchemeWithErrorHandler({
5048
uri: destinationTokenIconUri,
51-
client,
49+
client: serverThirdwebClient,
5250
})
5351
: undefined,
5452
]);

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { CopyTextButton } from "@/components/ui/CopyTextButton";
22
import { TableCell, TableRow } from "@/components/ui/table";
3+
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
34
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
4-
import type { ThirdwebClient } from "thirdweb";
55
import { defineChain, getChainMetadata } from "thirdweb/chains";
66

77
type RouteListRowProps = {
@@ -15,7 +15,6 @@ type RouteListRowProps = {
1515
destinationTokenIconUri?: string | null;
1616
destinationTokenSymbol?: string;
1717
destinationTokenName?: string;
18-
client: ThirdwebClient;
1918
};
2019

2120
export async function RouteListRow({
@@ -27,7 +26,6 @@ export async function RouteListRow({
2726
destinationTokenAddress,
2827
destinationTokenIconUri,
2928
destinationTokenSymbol,
30-
client,
3129
}: RouteListRowProps) {
3230
const [
3331
originChain,
@@ -42,13 +40,13 @@ export async function RouteListRow({
4240
originTokenIconUri
4341
? resolveSchemeWithErrorHandler({
4442
uri: originTokenIconUri,
45-
client,
43+
client: serverThirdwebClient,
4644
})
4745
: undefined,
4846
destinationTokenIconUri
4947
? resolveSchemeWithErrorHandler({
5048
uri: destinationTokenIconUri,
51-
client,
49+
client: serverThirdwebClient,
5250
})
5351
: undefined,
5452
]);

0 commit comments

Comments
 (0)