> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ankarachain.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Supported Networks: Chain IDs, RPC URLs, and Explorers

> The getNetwork() function and NETWORKS map provide chain IDs, RPC URLs, and explorer links for every supported Ankara Chain network.

The `@ankarachain/sdk` ships a `NETWORKS` map and a `getNetwork()` helper that give you the full configuration for every supported chain — chain ID, public RPC URL, block explorer link, and native currency details — without any runtime fetching. You can use them directly when building custom integrations or to validate that a given network identifier is supported before constructing a config.

```typescript theme={null}
import { getNetwork, NETWORKS } from "@ankarachain/sdk";
```

***

## `getNetwork()`

Returns the `NetworkConfig` object for a given network key. Throws an `Error` if the key is not in the `NETWORKS` map.

```typescript theme={null}
// Overloaded signatures (all return the same NETWORKS entry):
function getNetwork(network: EVMSupportedNetwork): EVMNetworkConfig;
function getNetwork(network: StellarSupportedNetwork): StellarNetworkConfig;
function getNetwork(network: SupportedNetwork): NetworkConfig;
```

**Example:**

```typescript theme={null}
import { getNetwork } from "@ankarachain/sdk";

const poly = getNetwork("polygon");
console.log(poly.chainId);     // 137
console.log(poly.rpcUrl);      // "https://polygon-rpc.com"
console.log(poly.explorerUrl); // "https://polygonscan.com"

const stellar = getNetwork("stellar-testnet");
console.log(stellar.networkPassphrase); // "Test SDF Network ; September 2015"
console.log(stellar.rpcUrl);            // "https://soroban-testnet.stellar.org"
```

***

## `NETWORKS` constant

The full map of every built-in network configuration, keyed by `SupportedNetwork`.

```typescript theme={null}
export const NETWORKS: Record<SupportedNetwork, NetworkConfig> = {
  "polygon-amoy": {
    chainFamily: "evm",
    chainId: 80002,
    name: "Polygon Amoy Testnet",
    rpcUrl: "https://rpc-amoy.polygon.technology",
    explorerUrl: "https://amoy.polygonscan.com",
    nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18 },
  },
  polygon: {
    chainFamily: "evm",
    chainId: 137,
    name: "Polygon Mainnet",
    rpcUrl: "https://polygon-rpc.com",
    explorerUrl: "https://polygonscan.com",
    nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
  },
  ethereum: {
    chainFamily: "evm",
    chainId: 1,
    name: "Ethereum Mainnet",
    rpcUrl: "https://eth.llamarpc.com",
    explorerUrl: "https://etherscan.io",
    nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  },
  bnb: {
    chainFamily: "evm",
    chainId: 56,
    name: "BNB Smart Chain",
    rpcUrl: "https://bsc-dataseed.binance.org",
    explorerUrl: "https://bscscan.com",
    nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
  },
  celo: {
    chainFamily: "evm",
    chainId: 42220,
    name: "Celo Mainnet",
    rpcUrl: "https://forno.celo.org",
    explorerUrl: "https://celoscan.io",
    nativeCurrency: { name: "CELO", symbol: "CELO", decimals: 18 },
  },
  localhost: {
    chainFamily: "evm",
    chainId: 31337,
    name: "Hardhat Local",
    rpcUrl: "http://127.0.0.1:8545",
    explorerUrl: "",
    nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  },
  "stellar-testnet": {
    chainFamily: "stellar",
    networkPassphrase: "Test SDF Network ; September 2015",
    name: "Stellar Testnet",
    rpcUrl: "https://soroban-testnet.stellar.org",
    explorerUrl: "https://stellar.expert/explorer/testnet",
    nativeCurrency: { name: "Lumens", symbol: "XLM", decimals: 7 },
  },
  stellar: {
    chainFamily: "stellar",
    networkPassphrase: "Public Global Stellar Network ; September 2015",
    rpcUrl: "",  // must be overridden via rpcUrl in AnkaraChainConfig for pubnet
    name: "Stellar Mainnet",
    explorerUrl: "https://stellar.expert/explorer/public",
    nativeCurrency: { name: "Lumens", symbol: "XLM", decimals: 7 },
  },
};
```

***

## Supported networks table

| Network key | Chain family | Chain ID | RPC URL | Explorer |
| - | - | - | - | - |
| `polygon` | EVM | 137 | [https://polygon-rpc.com](https://polygon-rpc.com) | [https://polygonscan.com](https://polygonscan.com) |
| `polygon-amoy` | EVM | 80002 | [https://rpc-amoy.polygon.technology](https://rpc-amoy.polygon.technology) | [https://amoy.polygonscan.com](https://amoy.polygonscan.com) |
| `ethereum` | EVM | 1 | [https://eth.llamarpc.com](https://eth.llamarpc.com) | [https://etherscan.io](https://etherscan.io) |
| `bnb` | EVM | 56 | [https://bsc-dataseed.binance.org](https://bsc-dataseed.binance.org) | [https://bscscan.com](https://bscscan.com) |
| `celo` | EVM | 42220 | [https://forno.celo.org](https://forno.celo.org) | [https://celoscan.io](https://celoscan.io) |
| `localhost` | EVM | 31337 | [http://127.0.0.1:8545](http://127.0.0.1:8545) | — |
| `stellar-testnet` | Stellar | — | [https://soroban-testnet.stellar.org](https://soroban-testnet.stellar.org) | [https://stellar.expert/explorer/testnet](https://stellar.expert/explorer/testnet) |
| `stellar` | Stellar | — | *(must be overridden)* | [https://stellar.expert/explorer/public](https://stellar.expert/explorer/public) |

<Note>
  Stellar networks do not have a numeric chain ID. They are identified by their `networkPassphrase`. Stellar Mainnet has no official free public Soroban RPC — you must supply your own via `rpcUrl` in your `StellarAnkaraChainConfig` when deploying to mainnet.
</Note>

***

## Overriding the RPC URL

You can pass a custom `rpcUrl` in your config to point the SDK at a private or premium RPC node — Alchemy, Infura, QuickNode, etc. The SDK will use your URL instead of the public default.

```typescript theme={null}
import { TokenFactory } from "@ankarachain/sdk";
import { Wallet } from "ethers";

const factory = new TokenFactory({
  network: "polygon",
  signer: new Wallet(process.env.PRIVATE_KEY!),
  rpcUrl: "https://polygon-mainnet.g.alchemy.com/v2/YOUR_API_KEY",
});
```

This is strongly recommended in production. Public RPC endpoints are rate-limited and unsuitable for high-volume use.

***

## `EVMNetworkConfig` and `StellarNetworkConfig` shapes

Both shapes share `name`, `rpcUrl`, `explorerUrl`, and `nativeCurrency`, but differ in their chain-identifying fields:

```typescript theme={null}
export interface EVMNetworkConfig {
  chainFamily: "evm";
  chainId: number;
  name: string;
  rpcUrl: string;
  explorerUrl: string;
  nativeCurrency: { name: string; symbol: string; decimals: number };
}

export interface StellarNetworkConfig {
  chainFamily: "stellar";
  networkPassphrase: string;  // identifies which Stellar network a transaction targets
  name: string;
  rpcUrl: string;             // Soroban RPC endpoint — not a Horizon URL
  explorerUrl: string;
  nativeCurrency: { name: string; symbol: string; decimals: number };
}
```

Discriminate between them using the `chainFamily` field:

```typescript theme={null}
import { getNetwork } from "@ankarachain/sdk";

const config = getNetwork("stellar-testnet");

if (config.chainFamily === "stellar") {
  console.log(config.networkPassphrase);
} else {
  console.log(config.chainId);
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.