Template will help you set up website, where users can decrypt and download files, that were assigned to their NFTs.
User flow:
- User connects it's wallet
- Website lists NFTs in that wallet
- User selects NFT and uses it to decrypt and download file from IPFS
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensionsfrom VSCode's command palette - Find
TypeScript and JavaScript Language Features, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Windowfrom the command palette.
See Vite Configuration Reference.
npm installnpm run devnpm run buildLint with ESLint
npm run lintBefore the template can interact with the Phala Schrödinger’s NFT Smart Contract, it needs to be manually configured.
To configure the template, do the following:
- Create .env file
- Set up configuration as displayed in env sample
- VITE_NFT_ADDRESS is address of NFT collection. User needs to have an NFT, and file is linked directly to that NFT.
- VITE_CONTRACT_ADDRESS is address of Phala smart contract, visible in Apillon console.
Example:
# NFT Collection address
VITE_NFT_ADDRESS=0xC280459C8C8bd3d1870A69e9b547230C5aFF4022
# NFT Collection CHAIN ID
# Moonbase
VITE_NFT_CHAIN_ID=0x507
# Moonbeam
#VITE_NFT_CHAIN_ID=0x504
# Astar
#VITE_NFT_CHAIN_ID=0x250
# PHALA CONTRACT ADDRESS
VITE_CONTRACT_ADDRESS=0xd61a5c16cec10ca3ace980388765e5a5fc746e3cddaae3242330ce054c895cb9Once you have updated the .env file, save it. Now the website files are ready to be deployed.
To deploy the website on Apillon hosting you need to build project with a command below:
npm run buildAnd then deploy folder dist according to this documentation: Wiki
- If not already, register to Apillon.io
- Log in to Apillon console and create new website inside your project.
- Select all files of your website (as configured in the previous step) and use drag&drop action to pull the files into the Hosting bucket
- Once the files are uploaded, push them to Staging and finally to the Production
- Add your custom domain (as displayed in the dashboards UI)
- Review your newly deployed website