mongo = require("./mongoHelp.js") config = require("./config.js") javalon = require("javalon") function txHandler(tx,user){ return new Promise((resolve,reject) => { mongo.get(config.database, "users", {"username": user.username}).then(userArr => { if (userArr[0].status == "Inactive"){ reject(userArr[0].username+" has not been activated send "+parseFloat(userArr[0].price)/100+" DTC to "+config.accountCreator.username+" with a memo line of '"+ userArr[0]._id+"' or contact "+config.discordUser+" on Discord to arrange alternate payment") } else if (userArr.length == 0){ reject("Something serious has gone wrong contact "+config.discordUser+" on Discord") } else { console.log(userArr[0]) signedTx = javalon.sign(userArr[0].keys.priv, userArr[0].username, tx) javalon.sendTransaction(signedTx, function(err, res) { if (err){ reject(err) } else { resolve(res) } }) } }) }) } module.exports = txHandler