This file contains 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); |
This file contains 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("/roundTrip/{address}") | |
public ErgoPayResponse roundTrip(@PathVariable String address) { | |
// sends 1 ERG around to and from the address | |
ErgoPayResponse response = new ErgoPayResponse(); | |
try { | |
boolean isMainNet = isMainNetAddress(address); | |
long amountToSend = 1000L * 1000L * 1000L; | |
Address sender = Address.create(address); |
This file contains 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
private ReducedTransaction getReducedSendTx(boolean isMainNet, long amountToSend, Address sender, Address recipient) { | |
NetworkType networkType = isMainNet ? NetworkType.MAINNET : NetworkType.TESTNET; | |
return RestApiErgoClient.create( | |
getDefaultNodeUrl(isMainNet), | |
networkType, | |
"", | |
RestApiErgoClient.getDefaultExplorerUrl(networkType) | |
).execute(ctx -> { | |
ErgoTreeContract contract = new ErgoTreeContract(recipient.getErgoAddress().script()); | |
UnsignedTransaction unsignedTransaction = BoxOperations.putToContractTxUnsigned(ctx, |
This file contains 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
package org.ergoplatform.ergopay; | |
import com.fasterxml.jackson.annotation.JsonInclude; | |
public class ErgoPayResponse { | |
@JsonInclude(JsonInclude.Include.NON_NULL) | |
public String message; | |
@JsonInclude(JsonInclude.Include.NON_NULL) | |
public Severity messageSeverity; | |
@JsonInclude(JsonInclude.Include.NON_NULL) |
This file contains 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
const {app, BrowserWindow, Menu} = require('electron') | |
// Keep a global reference of the window object, if you don't, the window will | |
// be closed automatically when the JavaScript object is garbage collected. | |
let win | |
function createWindow () { | |
// Create the browser window. | |
Menu.setApplicationMenu(null) |
This file contains 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
package rs.pedjaapps.smc.view; | |
import com.badlogic.gdx.controllers.Controller; | |
import com.badlogic.gdx.controllers.PovDirection; | |
import com.badlogic.gdx.scenes.scene2d.Actor; | |
import com.badlogic.gdx.scenes.scene2d.ui.Label; | |
import com.badlogic.gdx.scenes.scene2d.ui.Skin; | |
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; | |
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; | |
import com.badlogic.gdx.utils.Align; |