T2551
Depends on D12898
This diff fleshes out the `isAliasAvailable` function which is structured as follows:
1. Retrieves tx history for the payment address via `chronik.script().history()` (Note: caching will be done in a later diff)
2. Parses all incoming txs for that payment address that contains its hash160 in output[1] (since output[0] is always the OP_RETURN hex) PLUS fee paid is greater or equal to `minFee`.
3. Extracts the OP_RETURN hex from output[1] and feeds it to the ol' `parseOpReturn()` function, which will spit out a neatly structured array of OP_RETURN elements
4. Parse the OP_RETURN array to extract the alias name from array index 2, as long as array index 1 is the alias registration prefix hex.
5. Verify the expected payment fee for the extracted aliasName and if valid, add this alias to an array of registered aliases onchain.
6. If the user's alias input is in this array of registered aliases onchain, then isAliasAvailable is false. Otherwise it returns true and enables progression to registration.
I've thrown a whole bunch of random shit at the payment address, including cashtab messaging, airdrop one-to-many txs, and it's filtering well all the same.
For reference, I've registered the following aliases onchain: `antony`, `ringo`, `coco`, `foo1`, `crab`, `plonk`, `hhhuhiohkj`, `fffff`, `coolio` and `foo`.
Debug statements kept in for this diff so you can see the list of registered aliases in the console log for validation.
[Cashtab] [Alias] pt 1 - Create scaffold for new Identity component
[Cashtab] [Alias] pt 2 - Upgrade sendXec() to handle alias registration
**[Cashtab] [Alias] pt 3 - Implement isAliasAvailable function**
[Cashtab] [Alias] pt 4 - Implement isAddressRegistered function
[Cashtab] [Alias] pt 5 - Implement getAddressFromAlias function
[Cashtab] [Alias] pt 6 - Implement isLocalAliasStateLatest function
[Cashtab] [Alias] pt 7 - Enable alias lookup for Send XEC component
[Cashtab] [Alias] pt 8 - Enable alias lookup for Send Token component
[Cashtab] [Alias] pt 9 - Implement pricing mechanism
[Cashtab] [Alias] pt 10 - Server cron job
[Cashtab] [Alias] pt 11 - Upgrade tx history to recognize alias registration txs