我正在学习freecodecamp Patrick教程,介绍如何为Ethereum智能合同创建前端,我不知道为什么当我打开本地主机控制台时会出现错误。
supportedChain is deprecated, please pass networks instead
我已经安装了元问题/检测提供程序。
npm i @metamask/detect-provider
下面是app.tsx脚本:
import './App.css';
import { DAppProvider, ChainId, useEthers, Config, Kovan} from '@usedapp/core';
import {Header} from "./components/Header";
import { YourWallet } from './components/yourWallet';
import {Container} from "@material-ui/core";
import { Main } from "./components/Main";
function App() {
return (
<DAppProvider config={{
supportedChains: [ChainId.Kovan],
notifications: {
expirationPeriod: 1000,
checkInterval: 1000
}
}}>
<Container maxWidth="md">
<Header />
<Main />
</Container>
</DAppProvider>
);
}
export default App;如果有人能帮忙的话,那将是很有帮助的:)
发布于 2022-04-03 10:10:21
错误太明显了。使用supportedChains代替networks
function MyApp({ Component, pageProps }: AppProps) {
return (
<DAppProvider
config={{
networks: [Kovan],
notifications: {
expirationPeriod: 1000,
checkInterval: 100,
},
}}
>
<Component {...pageProps} />
</DAppProvider>
);
}https://stackoverflow.com/questions/71724543
复制相似问题