Mumbai : "unsupported getDefaultProvider network"

Hi!
I try to test my code for Polygon network on the testnet Mumbai.
When I change my settings from Kovan to Mumbai using Infura, I face this error message : “unsupported getDefaultProvider network”.
No problem on Kovan, it works as I expect to.
Do you know what can be the problem ?

import { ethers } from "ethers";
const fs = require("fs");
const mnemonic = fs.readFileSync(".secretMnemo").toString().trim();
let path = "m/44'/60'/0'/0/1";
const wallet = ethers.Wallet.fromMnemonic(mnemonic, path);
console.log(wallet.address);
const infuraKeyMumbai = fs.readFileSync(".secretInfuraKeyMumbai").toString().trim();
const provider = ethers.getDefaultProvider('mumbai', {
    infura: "https://polygon-mumbai.infura.io/v3/" + infuraKeyMumbai
}); 

Error :
reason: ‘unsupported getDefaultProvider network’,
code: ‘NETWORK_ERROR’,
operation: ‘getDefaultProvider’,
network: ‘mumbai’

Thanks for your help!

I respond to myself in case it can help someone:
The Ethers default provider does not currently support Mumbai.
For now the easiest thing to do is either register with INFURA for your own polygon-enabled account and use the InfuraProvider.

3 Likes