@windingtree/lpms-cli
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

@windingtree/lpms-cli

@windingtree/lpms-cli

Console utility for ease access to LPMS APIs

Setup

yarn add @windingtree/lpms-cli
lpms
Usage: lpms [options] [command]

LPMS API CLI

Options:
  -V, --version       output the version number
  -h, --help          display help for command

Commands:
  config [options]    Adds or removes configuration properties
  mnemonic [options]  Generates random 24 word mnemonic
  salt                Returns a random salt string (bytes32)
  wallet [options]    Wallet account information
  login [options]     Makes login with password
  storage [options]   Uploads files to storage
  addresses           Returns addresses of service provider roles
  register [options]  Registration of the service provider
  facility [options]  Operation with the facility
  item [options]      Operations with a item
  stub [options]      Operations with stubs
  help [command]      display help for command

Configuration

lpms config --set apiUrl --value http://localhost:5000
lpms config --set providerUri --value https://sokol.poa.network
lpms config --get providerUri

Full list of config properties

  • apiUrl: lpms-server API URI
  • providerUri: Blockchain provider URI
  • mnemonic: Wallet mnemonic. Can be generated and saved with the mnemonic command
  • defaultAccountIndex: Default wallet account index. 0 by default
  • salt: Unique salt string, Required for creation and registration of the service provider. Can be generated and saved with the sale command
  • lineRegistry: Address of the smart contract of the Service PRoviders Registry (Videre protocol)

Login

lpms login --login manager --password winwin
"manager" user has been successfully logged in

Wallet mnemonic generation

lpms mnemonic
lpms mnemonic --save
lpms mnemonic --save --index 0
  • --save saves the mnemonic to the CLI config
  • --index sets the default account index
history pudding dynamic dynamic staff village pupil prison nut father goose column lonely meadow effort aunt sure biology surround echo bachelor mechanic artwork void

Mnemonic has been successfully saved to the CLI config

Wallet status information

lpms wallet
lpms wallet --index 1
lpms wallet --index 1 --keys
  • --index specifies the idex of the account to display
  • --keys export of the public and private keys
Account idex: 0
Wallet account: 0xcF76325B47a0edF0723DC4071A73C41B4FBc44eA (0.0 xDAI)
Public key: 0x048498a9f26844c54f88...e6b7a836bd25487ef1994bf291979e9dbc8
Private key: 0xa0d132baf98616634f19a368bc99e8e4bc6f4f140eefb31dc8b80096c0c24f8b

Getting addresses of servers roles

lpms addresses
┌─────────┬───────────┬──────────────────────────────────────────────┐
│ (index) │   role    │                   address                    │
├─────────┼───────────┼──────────────────────────────────────────────┤
│    0    │   'api'   │ '0x8c27Aa036fE743162A09Cbb46bf6AA98C60c103d' │
│    1    │ 'bidder'  │ '0x2760e234062C4a04494DE11b1521C36f947DbdE8' │
│    2    │ 'manager' │ '0xE67297b5556728499392B2fF72c3596A43d42800' │
│    3    │  'staff'  │ '0x8e811c0D0969865D6Cb632Fb820f2275396D7AA6' │
└─────────┴───────────┴──────────────────────────────────────────────┘

Uploading files to storage

lpms storage --file ./path/to/README.md
./README.md has been uploaded successfully. Storage Id: bafkreiddp6nksmdoe6rw7rakpwrr3yosh6hnzzkwrc2nuuiemk74aa3mqy

Salt string generation

lpms salt
Random salt string: 0x18b6369b08e7e3b3776ba41653c39d7ec3f4806eeab047518d1c06479d178ec7

Registration of the service provider

Getting Id

lpms register --line stays --salt 0xa47669298673f7d2c0d76cb399f902d2dddbe937040ecc40c550b2ed05da95ea --id

Registration

stays must be initialized and registered

lpms register --line stays --salt 0xa47669298673f7d2c0d76cb399f902d2dddbe937040ecc40c550b2ed05da95ea

Facility management

Activation

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --activate

Deactivation

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --deactivate

Adding/updating the facility metadata

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --data ./path/to/metadata.json

Getting of the facility metadata

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7

Removal of the facility

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --remove

Adding of modifiers to the facility

Modifiers keys: day_of_week, occupancy, length_of_stay

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --modifier <key> --data ./path/to/modifier.json

Getting of modifiers from the facility

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --modifier <key>

Deleting of modifiers from the facility

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --modifier <key> --remove

Adding of rules to the facility

Rules keys: notice_required, length_of_stay

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --rule <key> --data ./path/to/rule.json

Getting of rules from the facility

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --rule <key>

Deleting of rules from the facility

lpms facility --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --rule <key> --remove

Items management

Adding/updating item metadata

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --itemType space --data ./path/to/metadata.json

Getting of the item metadata

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b

Removal of the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --remove

Getting availability (default or on date) of the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --availability default
lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --availability 2022-07-11

Adding availability to the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --availability default --data ./path/to/availability.json
lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --availability 2022-07-11 --data ./path/to/availability.json

Removal of availability from the item

Note: you cannot remove the default kind of availability from the item. To change default availability you should just add it

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --availability 2022-07-11 --numSpaces 1 --remove

Adding of modifiers to the facility

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --modifier <key> --data ./path/to/modifier.json

Getting of modifiers from the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --modifier <key>

Deleting of modifiers from the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --modifier <key> --remove

Adding of rules to the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --rule <key> --data ./path/to/rule.json

Getting of rules from the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --rule <key>

Deleting of rules from the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --rule <key> --remove

Adding of rates to the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --rate <key> --rateType items --data ./path/to/rule.json

Getting of rules from the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --rate <key> --rateType items

Deleting of rules from the item

lpms item --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --rate <key> --rateType items --remove

Stubs

Getting all stubs of the facility

lpms stub --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --index 0 --perPage 10

Getting a stub of the facility by date

lpms stub --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7 --date 2022-08-12 --index 0 --perPage 10

Getting a stub of the item of the facility

lpms stub --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7  --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --index 0 --perPage 10

Getting a stub of the item of the facility by date

lpms stub --facilityId 0x8991ad64938cc0ceecc328dd28107facab94f509d1bd54ff3cf4511164edf1c7  --itemId 0x01e5404aa35dfe2b33fe4a714bfd301e0b5723dbbaf48454ee44b741b484900b --date 2022-08-12 --index 0 --perPage 10

Readme

Keywords

none

Package Sidebar

Install

npm i @windingtree/lpms-cli

Weekly Downloads

100

Version

0.5.0

License

none

Unpacked Size

1.03 MB

Total Files

260

Last publish

Collaborators

  • kostysh
  • kvakes
  • tomashq