TosiDrop / vm-frontend

Frontend for TosiDrop
MIT License
6 stars 6 forks source link

Fix ADAHandle support #102

Closed reqlez closed 2 years ago

reqlez commented 2 years ago

After we converted from using SEAL's API to check addresses for faster query times ( and to offload some of the processing from Seal's API into the client ) We lost ADAHandle support, apparently that his API was handling.

A person should be able to enter a payment address ( gets converted to stake address via lib ), a stake address or an ADAHandle name. This name will have to be converted to hex and sent to Koios API ( as an example, this is for $boris handle, "boris" converts to 626f726973 in HEX ):

curl "https://api.koios.rest/api/v0/asset_address_list?_asset_policy=f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a&_asset_name=626f726973"

We should add the following logic: If address starts with $ remove the $, convert to hex, and send it to Koios Api.

Response from API will be: [{"payment_address":"addr1qxnczhf8pg6z4xhmmxqcqvehdwnf0fcj7kc2nfhszch3aq8x6mcsda3y6njfulqnphug43w96le0fe85qts4t7ld4meqxtlegl","quantity":"1"}]

( if the handle is not found, response will be empty )

Then, this address can be converted to stake address before sending it over to VM API.

The policy to supply to Koios for mainnet and testnet are different ( however, i actually don't know anybody with a testnet handle... so not sure who we are going to check as a test with the testnet version... ) Mainnet: f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a Testnet: 8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3

Here is also a demo how they are doing it with Blockfrost, but again, we can use Koios. https://docs.adahandle.com/quick-start

Eventually, adahandle will release their own API for this, since they might be posting more than a single policy ID in the future, and having to check all policy IDs might be extra work later.

wolf31o2 commented 2 years ago

I have many testnet handles. I can send one.

reqlez commented 2 years ago

I have many testnet handles. I can send one.

Well, as long as SOMEBODY tests with a testnet handle, it's fine. That's great!