In-node chronik may return a tokenId of 000000000000.... for an unknown token. Handle this case, as an API call to chronik.token(000...) will always throw an error.
Details
- Reviewers
emack - Group Reviewers
Restricted Project - Commits
- rABC1fc1657ef25e: [Cashtab] Handle unknown tokens
npm test
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Is there a difference between an unknown token vs an invalid token that does not conform to SLPv1 or ALP standards?
Yes -- we get the 000...000 token id when we have a token of a known prefix (e.g. slpv1 or alp) but unknown type (e.g. chronik only indexes slpv1 and slpv2). In some cases, it might just "be invalid" -- but we don't know, as the spec for an unsupported version number is unknown to chronik.
for practical purposes of this diff, tho -- it ensures that cashtab won't break if any token utxo or in tx history is returned by chronik with this all-zeros tokenId.
Here's an example of an invalid token tx, where we still get a tokenId: https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/modules/chronik-client/test/integration/token_slp_mint_vault.ts#L328
Here are some unknown token txs:
https://explorer.e.cash/tx/74a8598eed00672e211553a69e22334128199883fe79eb4ad64f9c0b7909735c
https://explorer.e.cash/tx/c0781d432cf4126d27739903c5d4d7298fab7ccb6721736d8483e2935d7d94cb