Skip to content

Commit 4e6dfab

Browse files
committed
chore: use configured bridge domain
1 parent dfe29f0 commit 4e6dfab

File tree

7 files changed

+47
-19
lines changed

7 files changed

+47
-19
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
THIRDWEB_RPC_DOMAIN,
1111
THIRDWEB_SOCIAL_API_DOMAIN,
1212
THIRDWEB_STORAGE_DOMAIN,
13+
THIRDWEB_BRIDGE_URL,
1314
} from "constants/urls";
1415
import { type ThirdwebClient, createThirdwebClient } from "thirdweb";
1516
import { populateEip712Transaction } from "thirdweb/transaction";
@@ -35,6 +36,7 @@ export function getConfiguredThirdwebClient(options: {
3536
social: THIRDWEB_SOCIAL_API_DOMAIN,
3637
bundler: THIRDWEB_BUNDLER_DOMAIN,
3738
insight: THIRDWEB_INSIGHT_API_DOMAIN,
39+
bridge: THIRDWEB_BRIDGE_URL,
3840
});
3941
}
4042

apps/dashboard/src/constants/urls.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ export const THIRDWEB_INSIGHT_API_DOMAIN =
2626

2727
export const THIRDWEB_ANALYTICS_DOMAIN =
2828
process.env.NEXT_PUBLIC_ANALYTICS_URL || "c.thirdweb-dev.com";
29+
30+
export const THIRDWEB_BRIDGE_URL =
31+
process.env.NEXT_PUBLIC_BRIDGE_URL || "bridge.thirdweb-dev.com";

apps/login/src/lib/dev-mode.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
THIRDWEB_RPC_DOMAIN,
77
THIRDWEB_SOCIAL_API_DOMAIN,
88
THIRDWEB_STORAGE_DOMAIN,
9+
THIRDWEB_BRIDGE_DOMAIN,
910
} from "../lib/urls";
1011
import { getVercelEnv } from "../lib/vercel";
1112

@@ -19,6 +20,7 @@ export function initDevMode() {
1920
storage: THIRDWEB_STORAGE_DOMAIN,
2021
social: THIRDWEB_SOCIAL_API_DOMAIN,
2122
bundler: THIRDWEB_BUNDLER_DOMAIN,
23+
bridge: THIRDWEB_BRIDGE_DOMAIN,
2224
});
2325
}
2426
}

apps/login/src/lib/urls.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ export const THIRDWEB_SOCIAL_API_DOMAIN =
1616

1717
export const THIRDWEB_BUNDLER_DOMAIN =
1818
process.env.NEXT_PUBLIC_BUNDLER_URL || "bundler.thirdweb-dev.com";
19+
20+
export const THIRDWEB_BRIDGE_DOMAIN =
21+
process.env.NEXT_PUBLIC_BRIDGE_URL || "bridge.thirdweb-dev.com";

apps/playground-web/src/lib/client.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ setThirdwebDomains({
1010
pay: process.env.NEXT_PUBLIC_PAY_URL,
1111
analytics: process.env.NEXT_PUBLIC_ANALYTICS_URL,
1212
insight: process.env.NEXT_PUBLIC_INSIGHT_URL,
13+
bridge: process.env.NEXT_PUBLIC_BRIDGE_URL,
1314
});
1415

1516
const isDev =
@@ -19,24 +20,24 @@ const isDev =
1920
export const THIRDWEB_CLIENT = createThirdwebClient(
2021
process.env.THIRDWEB_SECRET_KEY
2122
? {
22-
secretKey: process.env.THIRDWEB_SECRET_KEY,
23-
clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID as string,
24-
config: {
25-
storage: isDev
26-
? {
27-
gatewayUrl: "https://gateway.pinata.cloud/ipfs/",
28-
}
29-
: undefined,
30-
},
31-
}
23+
secretKey: process.env.THIRDWEB_SECRET_KEY,
24+
clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID as string,
25+
config: {
26+
storage: isDev
27+
? {
28+
gatewayUrl: "https://gateway.pinata.cloud/ipfs/",
29+
}
30+
: undefined,
31+
},
32+
}
3233
: {
33-
clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID as string,
34-
config: {
35-
storage: isDev
36-
? {
37-
gatewayUrl: "https://gateway.pinata.cloud/ipfs/",
38-
}
39-
: undefined,
40-
},
34+
clientId: process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID as string,
35+
config: {
36+
storage: isDev
37+
? {
38+
gatewayUrl: "https://gateway.pinata.cloud/ipfs/",
39+
}
40+
: undefined,
4141
},
42+
},
4243
);
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
export const UNIVERSAL_BRIDGE_URL = "https://bridge.thirdweb.com/v1";
1+
import { getThirdwebDomains } from "../utils/domains.js";
2+
3+
const getBridgeBaseUrl = () => {
4+
const bridgeDomain: string = getThirdwebDomains().bridge;
5+
return bridgeDomain.startsWith("localhost")
6+
? `http://${bridgeDomain}`
7+
: `https://${bridgeDomain}`;
8+
};
9+
10+
export const UNIVERSAL_BRIDGE_URL = `${getBridgeBaseUrl()}/v1`;

packages/thirdweb/src/utils/domains.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ type DomainOverrides = {
4444
* @default "engine.thirdweb.com"
4545
*/
4646
engineCloud?: string;
47+
/**
48+
* The base URL for the universal bridge service.
49+
* @default "bridge.thirdweb.com"
50+
*/
51+
bridge?: string;
4752
};
4853

4954
export const DEFAULT_RPC_URL = "rpc.thirdweb.com";
@@ -55,6 +60,7 @@ const DEFAULT_BUNDLER_URL = "bundler.thirdweb.com";
5560
const DEFAULT_ANALYTICS_URL = "c.thirdweb.com";
5661
const DEFAULT_INSIGHT_URL = "insight.thirdweb.com";
5762
const DEFAULT_ENGINE_CLOUD_URL = "engine.thirdweb.com";
63+
const DEFAULT_BRIDGE_URL = "bridge.thirdweb.com";
5864

5965
let domains: { [k in keyof DomainOverrides]-?: string } = {
6066
rpc: DEFAULT_RPC_URL,
@@ -66,6 +72,7 @@ let domains: { [k in keyof DomainOverrides]-?: string } = {
6672
analytics: DEFAULT_ANALYTICS_URL,
6773
insight: DEFAULT_INSIGHT_URL,
6874
engineCloud: DEFAULT_ENGINE_CLOUD_URL,
75+
bridge: DEFAULT_BRIDGE_URL,
6976
};
7077

7178
export const setThirdwebDomains = (DomainOverrides: DomainOverrides) => {
@@ -79,6 +86,7 @@ export const setThirdwebDomains = (DomainOverrides: DomainOverrides) => {
7986
analytics: DomainOverrides.analytics ?? DEFAULT_ANALYTICS_URL,
8087
insight: DomainOverrides.insight ?? DEFAULT_INSIGHT_URL,
8188
engineCloud: DomainOverrides.engineCloud ?? DEFAULT_ENGINE_CLOUD_URL,
89+
bridge: DomainOverrides.bridge ?? DEFAULT_BRIDGE_URL,
8290
};
8391
};
8492

0 commit comments

Comments
 (0)