forked from Emmy123222/Stellar-Search
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-network.js
More file actions
39 lines (32 loc) · 1.18 KB
/
Copy pathdebug-network.js
File metadata and controls
39 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Debug script to check Freighter network
// Run this in browser console when Freighter is connected
async function checkFreighterNetwork() {
try {
// Check if Freighter is available
if (!window.freighter) {
console.log('❌ Freighter extension not found');
return;
}
// Get network details
const networkDetails = await window.freighter.getNetworkDetails();
console.log('🌐 Network Details:', networkDetails);
if (networkDetails.network === 'TESTNET') {
console.log('✅ Freighter is on TESTNET - Ready for x402 payments!');
} else {
console.log(`❌ Wrong network: ${networkDetails.network}`);
console.log('🔧 Please switch Freighter to Testnet in extension settings');
}
// Check if connected
const isConnected = await window.freighter.isConnected();
console.log('🔗 Connected:', isConnected);
// Get address if connected
if (isConnected.isConnected) {
const address = await window.freighter.getAddress();
console.log('👤 Address:', address.address);
}
} catch (error) {
console.log('❌ Error checking network:', error.message);
}
}
// Run the check
checkFreighterNetwork();