Skip to content

Commit 960853a

Browse files
committed
fix: do not use CHAIN_N_RPC_URL in prividium mode
1 parent c91ea28 commit 960853a

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

packages/auth-server-api/.env.example

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RPC_URL=http://127.0.0.1:8545
1919
#
2020
# Required per chain:
2121
# CHAIN_N_ID - Chain ID (positive integer)
22-
# CHAIN_N_RPC_URL - RPC endpoint URL
22+
# CHAIN_N_RPC_URL - RPC endpoint URL (optional in Prividium mode)
2323
#
2424
# Optional per chain:
2525
# CHAIN_N_BASE_TOKEN_DECIMALS - Native token decimals (defaults to 18)
@@ -41,10 +41,9 @@ RATE_LIMIT_DEPLOY_WINDOW_MS=3600000 # 1 hour
4141
# SESSION_VALIDATOR_ADDRESS=0x...
4242

4343
# Prividium Mode Configuration (OPTIONAL)
44-
# When enabled, requires user authentication via Prividium and routes deployments through Prividium RPC proxy
44+
# When enabled, requires user authentication via Prividium and uses the Prividium SDK for RPC and auth
4545
# PRIVIDIUM_MODE=true
46-
# PRIVIDIUM_RPC_PROXY_BASE_URL=https://rpc.prividium.io
47-
# PRIVIDIUM_PERMISSIONS_BASE_URL=https://permissions.prividium.io
46+
# PRIVIDIUM_API_URL=https://api.prividium.io
4847
# PRIVIDIUM_ADMIN_PRIVATE_KEY=0x... # Private key of a user with 'admin' role in Prividium
4948
# PRIVIDIUM_TEMPLATE_KEY=sso-smart-account # Template key for whitelisting deployed contracts
5049
# SSO_AUTH_SERVER_BASE_URL=https://sso.example.com # Base URL of the SSO auth server frontend (used as SIWE domain for admin authorization)

packages/auth-server-api/src/config.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ function parseSupportedChains(): Chain[] {
118118
const rpcUrl = process.env[`CHAIN_${chainIndex}_RPC_URL`];
119119
const decimalsStr = process.env[`CHAIN_${chainIndex}_BASE_TOKEN_DECIMALS`];
120120

121-
if (!rpcUrl) {
121+
// RPC URL is required in non-prividium mode (prividium uses SDK transport)
122+
if (!rpcUrl && !env.PRIVIDIUM_MODE) {
122123
console.error(`CHAIN_${chainIndex}_RPC_URL is required but not provided`);
123124
process.exit(1);
124125
}
@@ -140,12 +141,14 @@ function parseSupportedChains(): Chain[] {
140141
}
141142
}
142143

143-
// Validate RPC URL format
144-
try {
145-
new URL(rpcUrl);
146-
} catch {
147-
console.error(`CHAIN_${chainIndex}_RPC_URL is not a valid URL: ${rpcUrl}`);
148-
process.exit(1);
144+
// Validate RPC URL format if provided
145+
if (rpcUrl) {
146+
try {
147+
new URL(rpcUrl);
148+
} catch {
149+
console.error(`CHAIN_${chainIndex}_RPC_URL is not a valid URL: ${rpcUrl}`);
150+
process.exit(1);
151+
}
149152
}
150153

151154
// Create chain with defaults for name and currency
@@ -159,7 +162,7 @@ function parseSupportedChains(): Chain[] {
159162
},
160163
rpcUrls: {
161164
default: {
162-
http: [rpcUrl],
165+
http: rpcUrl ? [rpcUrl] : [],
163166
},
164167
},
165168
});

0 commit comments

Comments
 (0)