Dev Tutorial

Environment Setup

  • node.js v16

Install node v16 on Ubuntu:

sudo apt install npm
sudo npm i -g n
sudo n 16

Get the code

git clone <https://github.com/momentswap/momentswap.git>

Install dependencies

cd momentswap
npm install

Contract deployment

Set the wallet private key to the .env file:

<aside> ⚠️ Convert the address starting with 0x to FIL address:https://explorer.glif.io/

</aside>

Compile the contract:

Deploy the contract to the Filecoin mainnet:

The default network is Hyperspace testnet, add the --network filecoinMainnet parameter

After each successful deployment, the contract address will be returned. Add the contract address to the .env file:

IPFS storage configuration

The NFT resources in the MomentSwap website are stored on the IPFS network and need to configure the nft.storage API key

Application address:https://nft.storage/

Fill the applied API key to the .env file:

Deploy UI using Fleek

Visit and log in:https://app.fleek.co/

Authorize github and select the momentswap repository:

<aside> ⚠️ If you are not in the development group of the momentswap repository, you need to fork the code to your own repository to select it

</aside>

Select the IPFS network and click Next:

Select the main branch:

Select the NextJS framework:

Modify the build command:

Replace with

Set the environment variables:

<aside> ⚠️ WALLET_PRIVATE_KEY is a required field, otherwise compilation error will occur, and temporary wallet private keys can be used to complete the deployment

</aside>

The frontend defaults to the Hyperspace test network. To switch to the Fil main network, you can add the environment variable settings:

Start deployment:

Last updated