ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Avalanche Mainnet/Fuji Infura support

Open charlie-kim opened this issue 2 years ago • 6 comments

Describe the Feature

Similar to https://github.com/ethers-io/ethers.js/issues/3323, creating a InfuraProvider instance with chain ID 43114(mainnet), 43113(fuji testnet) generates unsupported network error.

{
  reason: 'unsupported network',
  code: 'INVALID_ARGUMENT',
  argument: 'network',
  value: { chainId: 43114, name: 'unknown' }
}

Code Example

new ethers.providers.InfuraProvider(43114, {
  projectId: infuraProjectId,
  projectSecret: infuraProjectSecret,
})

charlie-kim avatar Jan 17 '23 21:01 charlie-kim

This is still WIP. Any estimated time for it to be completed?

woosal1337 avatar Jan 23 '23 21:01 woosal1337

@charlie-kim @woosal1337 To bypass the 'unsupported network' error with Avalanche networks, switch to using ethers.JsonRpcProvider with your network's RPC URL.

0x7An avatar Mar 28 '24 17:03 0x7An

Is Avalanche json-rpc compatible with Ethereum?

For some reason I thought it wasn’t. But if it is, I can add it to the InfuraProvider.

ricmoo avatar Mar 28 '24 18:03 ricmoo

@ricmoo Looks like only C-Chain is compatible.

https://docs.infura.io/api/networks/avalanche-c-chain/json-rpc-methods

0x7An avatar Mar 28 '24 18:03 0x7An

@charlie-kim @woosal1337 To bypass the 'unsupported network' error with Avalanche networks, switch to using ethers.JsonRpcProvider with your network's RPC URL.

Thanks. But ethers.JsonRpcProvider makes extra request to get chain ID. It will be better to use ethers. InfuraProvider.

charlie-kim avatar Mar 28 '24 20:03 charlie-kim

@ricmoo any update on this, please?

charlie-kim avatar Jun 10 '24 20:06 charlie-kim