04월 24일 월요일
민팅 후 이미지 불러오기
Remix에서 tokenOfOwnerByIndex 의
(방금 생성한 NFT의 메타데이터 주소 = 내가 가지고 있는 가장 마지막NFT)임을 이용해 token id값의 이미지 주소를 조회해 불러옴
가장 마지막 주소를 아는 방법은 balanceOf 함수를 이용해 총 갯수 -1을 통해 (배열이기때문에) 값을 알아옴
const balanceOf = await nftContract.methods.balanceOf(account).call(); const tokenOfOwnerByIndex = await nftContract.methods .tokenOfOwnerByIndex(account, parseInt(balanceOf) - 1) .call(); // console.log(tokenOfOwnerByIndex); const tokenURI = await nftContract.methods .tokenURI(tokenOfOwnerByIndex) .call();
layer를 이용한 이미지 생성하기
GIT주소 : https://github.com/HashLips/hashlips_art_engine
클론 후 npm update-> npm i-> layer폴더 수정-> config 수정-> npm run build 후 이미지 생성된것 확인한 후 피나타에 이미지 폴더 업로드 후 config 업데이트 후 npm run update_info 해주고 json파일 업데이트 된 것 확인 할 것!
오늘 배운 것 :
각종 팁 :