diff --git a/public/fn.js b/public/fn.js index 1b59c26..f225ab0 100644 --- a/public/fn.js +++ b/public/fn.js @@ -52,7 +52,7 @@ const tokenAPI = { }).catch(error => reject(error)) }) }, - sendToken: function(privKey, amount, message = "", receiverID = floGlobals.adminID, token = 'rupee') { + sendToken: function(privKey, amount, receiverID, message = "", token = 'rupee') { return new Promise((resolve, reject) => { let senderID = floCrypto.getFloID(privKey); if (typeof amount !== "number" || amount <= 0) @@ -364,11 +364,11 @@ function cancelOrder(type, id, floID, proxySecret) { }) } -function depositFLO(quantity, floID, privKey, proxySecret) { +function depositFLO(quantity, floID, sinkID, privKey, proxySecret) { return new Promise((resolve, reject) => { if (typeof quantity !== "number" || quantity <= floGlobals.fee) return reject(`Invalid quantity (${quantity})`); - floBlockchainAPI.sendTx(floID, floGlobals.adminID, quantity, privKey, 'Deposit FLO in market').then(txid => { + floBlockchainAPI.sendTx(floID, sinkID, quantity, privKey, 'Deposit FLO in market').then(txid => { let request = { floID: floID, txid: txid, @@ -422,11 +422,11 @@ function withdrawFLO(quantity, floID, proxySecret) { }) } -function depositRupee(quantity, floID, privKey, proxySecret) { +function depositRupee(quantity, floID, sinkID, privKey, proxySecret) { return new Promise((resolve, reject) => { if (!floCrypto.verifyPrivKey(privKey, floID)) return reject("Invalid Private Key"); - tokenAPI.sendToken(privKey, quantity, 'Deposit Rupee in market').then(txid => { + tokenAPI.sendToken(privKey, quantity, sinkID, 'Deposit Rupee in market').then(txid => { let request = { floID: floID, txid: txid, diff --git a/public/home.html b/public/home.html index 5a978f0..c02e190 100644 --- a/public/home.html +++ b/public/home.html @@ -382,6 +382,7 @@

+ @@ -1194,9 +1195,9 @@ if (type === 'deposit') { const privKey = getRef('get_private_key').value; if (asset === 'FLO') { - await depositFLO(quantity, proxy.userID, privKey, proxySecret) + await depositFLO(quantity, proxy.userID, proxy.sinkID, privKey, proxySecret) } else { - await depositRupee(quantity, proxy.userID, privKey, proxySecret) + await depositRupee(quantity, proxy.userID, proxy.sinkID, privKey, proxySecret) } showWalletResult('success', `Sent ${asset} deposit request`, 'This may take upto 30 mins to reflect in your wallet.') } else { @@ -1565,6 +1566,9 @@ this.private = null; this.public = null; }, + get sinkID(){ + return getRef("sink_id").value; + }, set userID(id){ localStorage.setItem("user_ID", id); this.user = id; @@ -1680,6 +1684,7 @@ document.querySelectorAll(".user-content").forEach(elem => elem.classList.remove('hide-completely')) getRef('trade_form').classList.remove('hide-completely') getRef("user_id").value = acc.floID; + getRef("sink_id").value = acc.sinkID; //FLO Balance let flo_total = acc.coins.reduce((a, x) => a + x.quantity, 0); let flo_locked = acc.sellOrders.reduce((a, x) => a + x.quantity, 0); diff --git a/src/request.js b/src/request.js index 5fcc6f8..8f4055e 100644 --- a/src/request.js +++ b/src/request.js @@ -278,6 +278,7 @@ function Account(req, res) { timestamp: data.timestamp }, data.sign, data.floID).then(req_str => { market.getAccountDetails(data.floID).then(result => { + result.sinkID = global.sinkID; if (trustedIDs.includes(data.floID)) result.subAdmin = true; res.send(result);