[token-server] Initialize a new app to manage rewards tokens
Summary:
token-server will be used to
- Validate eligibility for token rewards for Cashtab users
- Send token rewards to Cashtab users (eligibility will be reset after a certain time. token rewards can only be claimed by hitting an endpoint exposed by this server from https://cashtab.com)
- Potential future token issuance use cases, e.g. alias tokens as NFTs
Initialize with mocha, CI integration, eslint, and README.
Stub functionality -- app connects to ChronikClientNode websocket and exposes a status endpoint.
Test Plan:
npm test
confirm CI with ./contrib/teamcity/build-configurations.py token-server-tests
node index.js and observe log
From my machine after waiting for a block:
chronik-client connected to websocket hosted by wss://chronik.pay2stay.com/xec/ws Express server started on port 3333 /status from IP: ::1, host localhost:3333 { type: 'Block', msgType: 'BLK_CONNECTED', blockHash: '00000000000000001da2a9a5693b38c5a330e7e3703d0effab6c28b41aa050bb', blockHeight: 833731 } { type: 'Block', msgType: 'BLK_FINALIZED', blockHash: '00000000000000001da2a9a5693b38c5a330e7e3703d0effab6c28b41aa050bb', blockHeight: 833731 }
navigate to http://localhost:3333/status and view {"status":"running"}
Confirm that ctrl+c will shut down the server
From my machine:
^Ctoken-server shut down by ctrl+c
Reviewers: #bitcoin_abc, emack
Reviewed By: #bitcoin_abc, emack
Subscribers: emack
Differential Revision: https://reviews.bitcoinabc.org/D15586