HomePhabricator

[token-server] Initialize a new app to manage rewards tokens

Description

[token-server] Initialize a new app to manage rewards tokens

Summary:
token-server will be used to

  1. Validate eligibility for token rewards for Cashtab users
  2. 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)
  3. 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"}

image.png (117×300 px, 5 KB)

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

Details

Provenance
bytesofmanAuthored on Feb 29 2024, 18:39
bytesofmanPushed on Mar 2 2024, 13:48
Reviewer
Restricted Project
Differential Revision
D15586: [token-server] Initialize a new app to manage rewards tokens
Parents
rABC5f5bae1b08b9: [mock-chronik-client] Support for setting and getting history and utxos by…
Branches
Unknown
Tags
Unknown