casinocoin / casinocoin-token-wallet

CasinoCoin Token Wallet for the Desktop
MIT License
2 stars 0 forks source link

Addition of payID #26

Open GAFO opened 4 years ago

GAFO commented 4 years ago

Hey there, I want you to add the payID functionality within the Token Wallet. Basically you just resolve the payID e.g. abc$example.com to an wallet address and the little Guide for that follows below:

`1) Check if an URL with the format a$b - with b as example.com and a an variable string - is given in the text field (use the same method like you would for checking a wallet address format, e.g. regular expressions)

2) take the URL and reformat it from a$b to b/a e.g. example.com/a

3) Send a HTTP GET request to the reformated URL with the following two header params (key : value)

PayID-Version : 1.0 Accept : application/cscl-mainnet+json

4) You will receive a JSON response which looks like:

On Success:

{ "addresses": [ { "paymentNetwork": "CSCL", "environment": "MAINNET", "addressDetailsType": "CryptoAddressDetails", "addressDetails": { "address": "ca6atxgNqYd7MrkX1LNiyGZ2Gt1emxg9Mh" } } ], "payId": "gafo666$cscl.me" }

If not found:

{ "statusCode": 404, "error": "Not Found", "message": "Payment information for gafo6667$cscl.me in CSCL on MAINNET could not be found." }

5) Extract the value of the "address" field if you received the correct response (correct one has e.g. no "statusCode" field, regarding the check if the response was correct)

6) Use the extracted value (address) and check if it has the correct address format ( c...... )

7) Show the address in a list and let the user click on it to go to the send screen - if the response or address was invalid display "not found" and do not let the user continue to the send sceeen (gray out)

`

Greetings GAFO666