프로젝트는 기본 react 프로젝트에 실행해봤다.
(나의 경우 이 파일의 위치는 reactDir/test_app)
화면에 버튼이 뜨긴 떴지만 아무 일도 일어나지 않는다...
코드는 이러하다.
import { EthereumProvider } from "@walletconnect/ethereum-provider";
export default function App() {
async function tryConnect() {
const provider = await EthereumProvider.init({
projectId : "cdb3f2394c9b363fa73094e7eb02db42", // REQUIRED your projectId
chains : 1, // REQUIRED chain ids
// methods, // OPTIONAL ethereum methods
events : "connect", // OPTIONAL ethereum events
// rpcMap, // OPTIONAL rpc urls for each chain
// metadata, // OPTIONAL metadata of your app
// showQrModal, // OPTIONAL - `true` by default
});
// Web3Modal is enabled by default and will display a QR code modal
await provider.enable();
}
return (
<div>
<div className="user">
</div>
<div className="connect">
<button type="button" onClick={tryConnect}>
active
</button>
</div>
</div>
);
}