Supported ChainPolygon
Polygon API
Access Polygon via the Spectrum unified API. Polygon is a popular EVM-compatible sidechain with low fees and fast transactions, making it ideal for high-volume applications and DeFi protocols.
Properties
| Property | Value |
|---|---|
| Slug | polygon |
| Type | EVM |
| Native Token | MATIC |
| Chain ID | 137 |
Available Methods
| Method | Description |
|---|---|
| getBlockHeight | Latest Polygon block number |
| getBalance | MATIC balance for a wallet |
| getTokenBalance | ERC-20 token balance |
| getTokenMetadata | ERC-20 token info |
| getTokenAllowance | Token spending allowance |
| getPortfolio | Full portfolio with USD values |
| getNftCollection | NFT holdings for a wallet |
| getBlockTransactions | Transactions in a block |
| estimateGas | Gas estimation for a transaction |
| traceTransaction | Internal call trace |
| getHistoricalBalance | Balance at a historical block |
| getCode | Contract bytecode check |
| simulateCall | Simulate a contract call |
| rpcProxy | Raw JSON-RPC passthrough |
| getChainHealth | Polygon RPC health check |
Quick Start
Get the latest Polygon block height:
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_KEY" \
{ "jsonrpc": "2.0", "method": "getBlockHeight", "params": { "chain": "polygon" }, "id": 1 }
Get Balance
Retrieve the MATIC balance for a wallet address:
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_KEY" \
{ "jsonrpc": "2.0", "method": "getBalance", "params": { "chain": "polygon", "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }, "id": 1 }
Get Gas
Compare current gas prices across chains:
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_KEY" \
{ "jsonrpc": "2.0", "method": "compareGas", "params": {}, "id": 1 }
SDK
import { Spectrum } from '@spectrum-nodes/sdk';
const spectrum = new Spectrum({ api: 'https://your-endpoint.simplystaking.xyz/YOUR_API_KEY/' });
// Get latest block height
const block = await spectrum.core.getBlockHeight('polygon');
console.log(block.height);
// Get MATIC balance
const balance = await spectrum.tokens.getBalance('polygon', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045');
console.log(balance.balance);DeFi
Polygon is supported by the following DeFi protocols on Spectrum:
- Aave V3 — lending and borrowing markets
- Beefy — yield optimizer vaults
// Get Aave V3 lending yields on Polygon
const yields = await spectrum.yields.getLending({
chain: 'polygon',
protocol: 'aave-v3'
});
// Get Beefy vault yields on Polygon
const vaults = await spectrum.yields.getLending({
chain: 'polygon',
protocol: 'beefy'
});