Created
February 2, 2022 15:50
-
-
Save MrStahlfelge/0ef0ff8cca2b309150905ec708c9b69f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @GetMapping("/getUserAddress/{sessionId}") | |
| public String getUserAddress(@PathVariable String sessionId) { | |
| UserData userData = sessionService.getUserData(sessionId); | |
| return (userData.p2pkAddress != null) ? userData.p2pkAddress : ""; | |
| } | |
| @GetMapping("/setAddress/{sessionId}/{address}") | |
| public ErgoPayResponse setAddress(@PathVariable String sessionId, @PathVariable String address) { | |
| UserData userData = sessionService.getUserData(sessionId); | |
| ErgoPayResponse response = new ErgoPayResponse(); | |
| // check the address | |
| try { | |
| boolean isMainNet = isMainNetAddress(address); | |
| response.address = address; | |
| userData.p2pkAddress = address; | |
| response.message = "Connected to your address " + address + ".\n\nYou can now continue using the dApp."; | |
| response.messageSeverity = ErgoPayResponse.Severity.INFORMATION; | |
| } catch (Throwable t) { | |
| response.messageSeverity = ErgoPayResponse.Severity.ERROR; | |
| response.message = (t.getMessage()); | |
| } | |
| return response; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment