[React] 그냥 프론트 metamask 계정을 가져오는 방법
Web3.0을 작업할 때 가장 좋은 점은 프론트엔드만 써도 꽤 그럴 듯하게 만들 수 있다는 점이다. 예를 들어, 저기있는 "Link With MetaMask" 저 버튼을 누를 때 크롬 확장프로그램인 메타마스크에 아무 조건(특히 CORS 같은 거 없이!) 접근할 수 있다. 생각보다 되게 쉬워서 놀랐다. 1. window.ethereum.request() const connectWithMetaMask = useCallback(async() => { // check the envs with hooks. if (!isMetaMaskInstalled && !isMobile) return; try { const account = await window.ethereum.request({ method: "eth_req..
2022.09.27