Reading Data
Last updated
Was this helpful?
Was this helpful?
import { getNetwork } from "@stellar/freighter-api";
const { network, networkPassphrase, error } = await getNetwork();
if (!error) {
console.log("Network:", network); // e.g., "TESTNET"
console.log("Passphrase:", networkPassphrase);
}import { getNetworkDetails } from "@stellar/freighter-api";
const details = await getNetworkDetails();
if (!details.error) {
console.log("Network:", details.network); // e.g., "TESTNET"
console.log("Horizon:", details.networkUrl); // e.g., "https://horizon-testnet.stellar.org"
console.log("Passphrase:", details.networkPassphrase);
console.log("Soroban RPC:", details.sorobanRpcUrl); // e.g., "https://soroban-testnet.stellar.org"
}