creating a provider?
about 2 years ago by dc
seems like something has broken in the SDK
based on this code:
const provider = new ethers.providers.AlchemyProvider('mumbai', apiKey);
gives
TypeError: Cannot read properties of null (reading 'name')
node_modules/@ethersproject/providers/src.ts/alchemy-provider.ts:57
switch (network.name) {
I also tried passing an object
const netObj = {
// name: 'MATIC_MUMBAI',
name: 'polygon-mumbai',
// chainId: 80001 // FIXME
}
using
"alchemy-sdk": "^2.0.2",
OK so the working magic codes are:
const netObj = {
// name: 'MATIC_MUMBAI',
// name: 'polygon-mumbai',
name: 'maticmum',
chainId: 80001 // hardwired bullshit
}
const provider = new ethers.providers.AlchemyProvider(netObj, apiKey);
is there a way to get the hardwired chainId somehow?