NEAR MESSAGING SERVICE (NMS) is convenient service that makes it simple, easy, and secure for NEAR accounts to exchange messages with each other. The system is completely decentralized and takes advantage of the advantages and power of the NEAR Protocol. Please see detail at NMS Official Website.
- Prerequisites:
Make sure you've installed [Node.js] ≥ 14
And then install yarn:npm install --global yarn
On Ubuntu, you may need to install additional tools to build some libraries:apt-get install build-essential
On Window, you may need to install additional tools: Cygwin or MsBuild. - Clone the project from github and change directory to nms foler
- Install dependencies:
yarn install
- Build contract:
yarn build:contract
- Deploy dev contract:
dev:deploy:contract
You will see the contract account in log.
You can use near-cli command line to call to the contract. - Run the local development server
Open the file .env and set value for keyVUE_APP_CONTRACT_NAME
by above contract account.
And then runyarn fe
Now you can view http://localhost:8080 have a local development environment!
Go ahead and play with the app and the code. As you make code changes, the app will automatically reload.
- Connect to the NEAR account
Install near-cli by command:npm i -g near-cli
Runnear login
and connect to main NEAR account. The account we use is nearmessage.testnet - Create sub account from main NEAR account to receive fee from the app
near create-account fee.nearmessage.testnet --masterAccount nearmessage.testnet --initialBalance 0.01
- Create sub account from main NEAR account to deploy the contract
near create-account app.nearmessage.testnet --masterAccount nearmessage.testnet --initialBalance 100
- Build the contract
yarn build:contract
- Deploy the contract
near deploy --wasmFile ./out/main.wasm --initFunction "setOwnerAddress" --initArgs '{"address": "nearmessage.testnet"}' --accountId app.nearmessage.testnet
- Config the contract
Run below commands to config the contract:near call app.nearmessage.testnet setFeeAddress '{"address": "fee.nearmessage.testnet"}' --accountId nearmessage.testnet
And run below command to check:near view app.nearmessage.testnet getStatics '{}' --accountId nearmessage.testnet
- Config the file .env
Open the file .env and set value for keyVUE_APP_CONTRACT_NAME
by the NMS contract:app.nearmessage.testnet
- Build the NMS frontend
Delete dist folder and run below command:yarn build-fe
- Upload to your host
Now, you can upload all files in dist folder to your host.
Sometimes you may need to configure more in your server, please see Server Configurations