Where to add API key for Ankr RPC in viem #1081
-
|
Hi, I'm using eth scaffold and getting the following error when calling eth_getCode via Ankr's BSC RPC: I understand that I need to provide an API key, but I’m not sure where exactly to add it in my viem setup. Could you please guide me on the correct way to configure Ankr's RPC URL with an API key? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Hey you ovveride rpc with for bsc chain in scaffold-eth-2/packages/nextjs/scaffold.config.ts Lines 30 to 33 in 19f0ea1 rpcOverrides: {
// Example:
// [chains.mainnet.id]: "https://mainnet.buidlguidl.com",
[chains.bsc.id]: `https://rpc.ankr.com/bsc/${process.env.NEXT_PUBLIC_ANKR_API_KEY}`,
},Make sure you add the api-key which you got from ankr in |
Beta Was this translation helpful? Give feedback.
-
|
there is no rpcOverrides in scaffold.config.ts |
Beta Was this translation helpful? Give feedback.
Hey you can add those file changes to your repo, they are minimal 🙌 :
https://github.com/scaffold-eth/scaffold-eth-2/pull/1057/files