我做错了什么?当尝试从https://infura.io/连接我的项目id时,我在运行后得到以下错误:
$ npx hardhat run scripts/deploy.js --network mumbai
错误:
ProviderError: project ID没有访问多边形l2
这是我的文件
require("@nomiclabs/hardhat-waffle");
require("dotenv").config();
const privateKey = process.env.PRIVATE_KEY;
const projectId = process.env.PROJECT_ID;
if (privateKey.error) {
throw privateKey.error;
}
if (projectId.error) {
throw projectId.error;
}
module.exports = {
networks: {
hardhat: {
chainId: 1337,
},
mumbai: {
url: `https://polygon-mumbai.infura.io/v3/${projectId}`,
accounts: [privateKey],
},
mainnet: {
url: `https://arbitrum-mainnet.infura.io/v3/${projectId}`,
accounts: [privateKey],
},
matic: {
url: "https://rpc-mainnet.maticvigil.com",
accounts: [privateKey],
},
},
solidity: "0.8.4",
};
实际上我想明白了,原来我需要在我的帐户设置中启用polygon beta,并为furit .io添加计费信息
Alchemy - https://dashboard.alchemyapi.io/是一个与多边形网络交互的替代方案。不需要账单信息