Clone and setup the lpms-server code from git@github.com:windingtree/lpms-server.git
clone git@github.com:windingtree/lpms-server.git ./<your-lpms-directory>
cd ./<your-directory>
git checkout develop
yarnCreate .env.local file in the root of ./<your-lpms-directory> with the following content:
API_URL=http://localhost:5000
CLIENT_URL=http://localhost:3000
PORT=5000
APP_ACCESS_TOKEN_KEY=123
APP_REFRESH_TOKEN_KEY=456
APP_WALLET_PASSPHRASE=123
DEBUG_LPMS_SERVER=true
APP_PROMETHEUS_PORT=9100
PROMETHEUS_ENABLED=false
APP_NETWORK_PROVIDER=http://127.0.0.1:8545
APP_VERIFYING_CONTRACT=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
APP_LINE=stays
APP_VERSION=1
Start the server:
yarn devSetup the CLI package from the npm repository
npm i -g @windingtree/lpms-cliClone and setup the CLI repository from git@github.com:windingtree/lpms-cli.git
git clone git@github.com:windingtree/lpms-cli.git ./<your-cli-directory>
cd ./<your-cli-directory>
yarnAdd configuration variables required for local testing
lpms config --set apiUrl --value http://localhost:5000
lpms config --set providerUri --value http://127.0.0.1:8545
lpms config --set mnemonic --value "test test test test test test test test test test test junk"
lpms config --set lineRegistry --value 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9Login to the lpms-server
lpms login --login manager --password winwinGet system address from the lpms-server
lpms addressesDuring the next step you have to add
apiaddress (index: 0) to the script. See below
Clone and setup the stays-contracts code from git@github.com:windingtree/stays-contracts.git
git clone git@github.com:windingtree/stays-contracts.git ./<your-stays-contracts>
cd ./<your-stays-contracts>
git checkout main
yarnUpdate contracts deployment script ./deploy/001.ts at the line 113. You should add api address there. This address will be credited with 1 ETH (required for the possibility of transactions sending).
Setup smart contracts environment using hardhat node
yarn hardhat nodecd ./<your-cli-directory>
mkdir temp
npx ts-node ./scripts/facility.tsThe facility metadata file will be generated in the
./tempdirectory.
This script will create:
./temp/0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902.json./temp/ruleFacility.json./temp/modifierFacility.json
lpms register --line stays --salt 0xa47669298673f7d2c0d76cb399f902d2dddbe937040ecc40c550b2ed05da95eaThe facility Id
0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902is generated from the givensaltand admin wallet address (index: 0). If you change thesaltor use anothermnemonic(in the CLI config) then your facility Id will be different.
lpms facility --facilityId 0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902 --data ./temp/0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902.jsonlpms facility --facilityId 0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902 --rule notice_required --data ./temp/ruleFacility.jsonlpms facility --facilityId 0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902 --modifier length_of_stay --data ./temp/modifierFacility.jsoncd ./<your-cli-directory>
npx ts-node ./scripts/space.tsThe item (space) metadata file will be generated in the
./tempdirectory.
This script will create:
./temp/0x7ccd15bc59ef5d782fed4ad73c84acd2f5e383f318333e5c5da336bf27066359.json./temp/rateSpace.json./temp/modifierSpace.json
lpms item --facilityId 0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902 --itemId 0x7ccd15bc59ef5d782fed4ad73c84acd2f5e383f318333e5c5da336bf27066359 --itemType space --data ./temp/0x7ccd15bc59ef5d782fed4ad73c84acd2f5e383f318333e5c5da336bf27066359.jsonlpms item --facilityId 0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902 --itemId 0x7ccd15bc59ef5d782fed4ad73c84acd2f5e383f318333e5c5da336bf27066359 --rate default --rateType items --data ./temp/rateSpace.jsonlpms item --facilityId 0xaf2834d4bbf6d988986e1e3d32140bd9f19ef389562f62eeb1568d42f8afd902 --itemId 0x7ccd15bc59ef5d782fed4ad73c84acd2f5e383f318333e5c5da336bf27066359 --modifier length_of_stay --data ./temp/modifierSpace.json