Page MenuHomePhabricator

[chronik-client] Update GenesisInfo to return hex string for data key of ALP tokens
Needs ReviewPublic

Authored by bytesofman on Sun, Nov 24, 12:42.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

This matches existing patterns in chronik-client. IMO we should stick to hex strings for API returns. API returns for tokens -- esp GenesisInfo -- needs to be cached as it never changes. Caching Uint8Array is complicated because it is not JSON. But hex strings are easy.

ecash-lib has available toHex and fromHex methods that make conversion easy depending on dev needs.

auth as a Uint8Array would require special handling in Cashtab's existing caching mechanism if we do not make this change.

Test Plan

CI tests

Event Timeline

Failed tests logs:

====== ALP: TxBuilder P2PKH ALP.ALP TxBuilder P2PKH ALP ======
AssertionError: expected { …(4) } to deeply equal { …(4) }
    at Context.<anonymous> (tests/alp.test.ts:121:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual

       {
         "genesisInfo": {
           "authPubkey": "03040506"
      -    "data": "01020304"
      +    "data": "1,2,3,4"
           "decimals": 4
           "tokenName": "ALP Token Name"
           "tokenTicker": "ALP TOKEN"
           "url": "https://example.com"

Each failure log is accessible here:
ALP: TxBuilder P2PKH ALP.ALP TxBuilder P2PKH ALP