Initial commit: add .gitignore and README
This commit is contained in:
72
scripts/verify-env.ts
Normal file
72
scripts/verify-env.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env tsx
|
||||
|
||||
/**
|
||||
* Quick verification that environment variables are being loaded correctly
|
||||
*
|
||||
* Usage:
|
||||
* tsx scripts/verify-env.ts
|
||||
*/
|
||||
|
||||
// Load dotenv FIRST
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
console.log('Environment Variable Verification');
|
||||
console.log('='.repeat(50));
|
||||
|
||||
// Check if dotenv loaded the .env file
|
||||
const envFile = dotenv.config();
|
||||
if (envFile.error) {
|
||||
console.log('⚠ .env file not found (this is okay if using system env vars)');
|
||||
} else {
|
||||
console.log('✓ .env file loaded');
|
||||
}
|
||||
|
||||
console.log('');
|
||||
|
||||
// Check RPC URLs
|
||||
const rpcUrls = {
|
||||
'MAINNET_RPC_URL': process.env.MAINNET_RPC_URL,
|
||||
'BASE_RPC_URL': process.env.BASE_RPC_URL,
|
||||
'ARBITRUM_RPC_URL': process.env.ARBITRUM_RPC_URL,
|
||||
'OPTIMISM_RPC_URL': process.env.OPTIMISM_RPC_URL,
|
||||
'POLYGON_RPC_URL': process.env.POLYGON_RPC_URL,
|
||||
};
|
||||
|
||||
console.log('RPC URLs:');
|
||||
for (const [key, value] of Object.entries(rpcUrls)) {
|
||||
if (value) {
|
||||
const display = value.length > 50
|
||||
? `${value.substring(0, 30)}...${value.substring(value.length - 10)}`
|
||||
: value;
|
||||
const hasPlaceholder = value.includes('YOUR_KEY') || value.includes('YOUR_INFURA_KEY');
|
||||
console.log(` ${key}: ${hasPlaceholder ? '⚠ PLACEHOLDER' : '✓'} ${display}`);
|
||||
} else {
|
||||
console.log(` ${key}: ✗ Not set`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
|
||||
// Check other vars
|
||||
if (process.env.PRIVATE_KEY) {
|
||||
console.log('PRIVATE_KEY: ✓ Set (not shown)');
|
||||
} else {
|
||||
console.log('PRIVATE_KEY: ✗ Not set (optional)');
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('='.repeat(50));
|
||||
|
||||
// Test network loading
|
||||
try {
|
||||
// This will import networks.ts which should use the env vars
|
||||
const { getNetwork } = await import('../src/strat/config/networks.js');
|
||||
const network = getNetwork('mainnet');
|
||||
console.log(`Network config test: ✓ Loaded (RPC: ${network.rpcUrl.substring(0, 30)}...)`);
|
||||
} catch (error: any) {
|
||||
console.log(`Network config test: ✗ Failed - ${error.message}`);
|
||||
}
|
||||
|
||||
console.log('');
|
||||
|
||||
Reference in New Issue
Block a user