Docs · guide · TypeScript

ethers v6 with FlexYield

JsonRpcProvider with a FetchRequest that carries the key.

Install

npm i ethers

Connect and call

import { ethers } from "ethers";

const request = new ethers.FetchRequest("https://flexyield.io/rpc/eth_mainnet");
request.setHeader("Authorization", "Bearer fy_your_api_key");
const provider = new ethers.JsonRpcProvider(request, undefined, { staticNetwork: true });

console.log(await provider.getBlockNumber());

Replace fy_your_api_key with a key from your dashboard (free tier at registration). Chain slugs: eth_mainnet base_mainnet arbitrum_one optimism_mainnet polygon_pos solana_mainnet — each has its own measured page.

Notes

All guides: integration guides · methods and limits · docs.