Cross-Chain EVM Requests
All our API methods are supported for cross-chain calls. You only need to specify the chain
parameter. For example, this request will query block info on Polygon:
import Moralis from "moralis";
import { EvmChain } from "@moralisweb3/common-evm-utils";
evmApi.block.getBlock({
blockNumberOrHash: "33000000",
chain: EvmChain.POLYGON,
});
If no chain
is specified, it will, by default, be set to the defaultEvmApiChain
, which is set in your config (defaults to "Ethereum mainnet").
Change the Default Chain​
To change the default chain, you can specify defaultEvmApiChain
in your config:
import Moralis from "moralis";
import { EvmChain } from "@moralisweb3/common-evm-utils";
Moralis.start({
apiKey: "YOUR_API_KEY",
defaultEvmApiChain: EvmChain.POLYGON,
});
Moralis.EvmApi.block.getBlock({
blockNumberOrHash: "33000000",
});
Supported EVM Chains​
Name | Chain Id (Int) | Chain Id (Hex) | EvmChain | Type |
---|---|---|---|---|
Ethereum Mainnet | 1 | 0x1 | EvmChain.ETHEREUM | Mainnet |
Ethereum Sepolia | 11155111 | 0xaa36a7 | EvmChain.SEPOLIA | Testnet |
Ethereum Holesky | 17000 | 0x4268 | EvmChain.HOLESKY | Testnet |
Polygon Mainnet | 137 | 0x89 | EvmChain.POLYGON | Mainnet |
Polygon Amoy | 80002 | 0x13881 | EvmChain.POLYGON_AMOY | Testnet |
Binance Smart Chain Mainnet | 56 | 0x38 | EvmChain.BSC | Mainnet |
Binance Smart Chain Testnet | 97 | 0x61 | EvmChain.BSC_TESTNET | Testnet |
Avalanche C-Chain | 43114 | 0xa86a | EvmChain.AVALANCHE | Mainnet |
Fantom | 250 | 0xfa | EvmChain.FANTOM | Mainnet |
Cronos Mainnet | 25 | 0x19 | EvmChain.CRONOS | Mainnet |
Palm | 11297108109 | 0x2a15c308d | EvmChain.PALM | Mainnet |
Arbitrum | 42161 | 0xa4b1 | EvmChain.ARBITRUM | Mainnet |
Gnosis | 100 | 0x64 | EvmChain.GNOSIS | Mainnet |
Gnosis Chiado | 10200 | 0x27d8 | EvmChain.GNOSIS_TESTNET | Testnet |
Base | 8453 | 0x2105 | EvmChain.BASE | Mainnet |
Base Sepolia | 84532 | 0x14a34 | EvmChain.BASE_SEPOLIA | Testnet |
Optimism | 10 | 0xa | EvmChain.OPTIMISM | Mainnet |
Optimism Sepolia | 11155420 | 0xaa37dc | EvmChain.OPTIMISM_SEPOLIA | Testnet |
Linea | 59144 | 0xe708 | EvmChain.LINEA | Mainnet |
Linea Sepolia | 59141 | 0xe705 | EvmChain.LINEA_SEPOLIA | Testnet |
Moonbeam | 1284 | 0x504 | EvmChain.MOONBEAM | Mainnet |
Moonriver | 1285 | 0x505 | EvmChain.MOONRIVER | Testnet |
Moonbase | 1287 | 0x507 | EvmChain.MOONBASE | Testnet |
Chiliz Mainnet | 88888 | 0x15b38 | EvmChain.CHILIZ | Mainnet |
Chiliz Testnet | 88882 | 0x15b32 | EvmChain.CHILIZ_TESTNET | Testnet |
Solana​
Change the Default Network​
We have two networks for the Solana API, which you can configure similarly. You can specify the mainnet or devnet:
import Moralis from "moralis";
import { SolNetwork } from "@moralisweb3/common-sol-utils";
Moralis.start({
apiKey: "YOUR_API_KEY",
defaultSolNetwork: SolNetwork.DEVNET,
});
Moralis.SolApi.account.getBalance({
address: "ADDRESS",
});
Supported Solana Networks​
Name | SolNetwork | Type |
---|---|---|
Solana mainnet | SolNetwork.MAINNET | Mainnet |
Solana devnet | SolNetwork.DEVNET | Testnet |