all db functions promisified
This commit is contained in:
parent
2eb1383142
commit
ea5ec88785
@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title>Document</title>
|
<title>LocalBitcoinPlusPlus</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.tradebox {
|
.tradebox {
|
||||||
|
|||||||
@ -9156,35 +9156,6 @@
|
|||||||
]);
|
]);
|
||||||
return promises;
|
return promises;
|
||||||
},
|
},
|
||||||
// get_sharable_db_data: function(callback) {
|
|
||||||
// let sharable_data = {};
|
|
||||||
|
|
||||||
// readAllDB("buyOrders", function(buyOrdersres) {
|
|
||||||
// sharable_data.buyOrders = buyOrdersres;
|
|
||||||
|
|
||||||
// readAllDB("sellOrders", function(sellOrdersres) {
|
|
||||||
// sharable_data.sellOrders = sellOrdersres;
|
|
||||||
|
|
||||||
// readAllDB("btc_balances", function(btc_balancesres) {
|
|
||||||
// sharable_data.btc_balances = btc_balancesres;
|
|
||||||
|
|
||||||
// readAllDB("cash_balances", function(cash_balancesres) {
|
|
||||||
// sharable_data.cash_balances = cash_balancesres;
|
|
||||||
|
|
||||||
// readAllDB("deposit", function(depositres) {
|
|
||||||
// sharable_data.deposit = depositres;
|
|
||||||
|
|
||||||
// readAllDB("withdraw_cash", function(withdraw_cashres) {
|
|
||||||
// sharable_data.withdraw_cash = withdraw_cashres;
|
|
||||||
// return callback(sharable_data);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
// },
|
|
||||||
|
|
||||||
claim_deposit_withdraw: function(claim_id) {
|
claim_deposit_withdraw: function(claim_id) {
|
||||||
if (typeof claim_id=="string" && claim_id.length>0) {
|
if (typeof claim_id=="string" && claim_id.length>0) {
|
||||||
@ -9367,8 +9338,8 @@
|
|||||||
return my_pvt_key;
|
return my_pvt_key;
|
||||||
},
|
},
|
||||||
getUserPublicKey: function(flo_address, callback) {
|
getUserPublicKey: function(flo_address, callback) {
|
||||||
readDB('userPublicData', flo_address, function(res) {
|
readDB('userPublicData', flo_address).then(function(res) {
|
||||||
if (typeof res=="object") {
|
if (typeof res=="object" && typeof res.trader_flo_pubKey=="string") {
|
||||||
return callback(res.trader_flo_pubKey);
|
return callback(res.trader_flo_pubKey);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -9421,23 +9392,26 @@
|
|||||||
|
|
||||||
/** CHECK HERE IF USER IS INDULGED IN ANY MORE TRADE.
|
/** CHECK HERE IF USER IS INDULGED IN ANY MORE TRADE.
|
||||||
IF TRUE RETURN ERROR */
|
IF TRUE RETURN ERROR */
|
||||||
// readAllDB("deposit", function(res) {
|
readAllDB("deposit").then(function(response) {
|
||||||
// if (typeof res == "object" && res.length>0) {
|
let res = response.result;
|
||||||
// let canUserTrade = res.map(function(user) {
|
if (typeof res == "object" && res.length>0) {
|
||||||
// return respective_trader_id == user.trader_flo_address;
|
let canUserTrade = res.map(function(user) {
|
||||||
// });
|
return respective_trader_id == user.trader_flo_address;
|
||||||
// if (canUserTrade.includes(true)) {
|
});
|
||||||
// request.response = `Trader id ${respective_trader_id} is not clear for trade currently.
|
if (canUserTrade.includes(true)) {
|
||||||
// You must finish your previous pending orders to qualify again to trade.`;
|
request.response = `Trader id ${respective_trader_id} is not clear for trade currently.
|
||||||
// return false;
|
You must finish your previous pending orders to qualify again to trade.`;
|
||||||
// }
|
return false;
|
||||||
// }
|
}
|
||||||
// });
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Check if user id is in deposit or withdraw. If true prevent him from trading
|
// Check if user id is in deposit or withdraw. If true prevent him from trading
|
||||||
try {
|
try {
|
||||||
readAllDB('withdraw_cash', function(res) {
|
readAllDB('withdraw_cash').then(function(respnse) {
|
||||||
let check_deposit_withdraw_id_array = res.filter(f=>f.status===2)
|
let res = response.result;
|
||||||
|
if (typeof res=="object") {
|
||||||
|
let check_deposit_withdraw_id_array = res.filter(f=>f.status===2)
|
||||||
.map(m=>{
|
.map(m=>{
|
||||||
if (m.trader_flo_address==respective_trader_id||m.deposit_withdraw_id_array==respective_trader_id) {
|
if (m.trader_flo_address==respective_trader_id||m.deposit_withdraw_id_array==respective_trader_id) {
|
||||||
let server_msg = `Trader id ${respective_trader_id} is not clear for trade currently.
|
let server_msg = `Trader id ${respective_trader_id} is not clear for trade currently.
|
||||||
@ -9450,7 +9424,8 @@
|
|||||||
doSend(server_response);
|
doSend(server_response);
|
||||||
throw new Error("User has not finished previous pending actions.");
|
throw new Error("User has not finished previous pending actions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
@ -9570,12 +9545,13 @@
|
|||||||
throw new Error('Failed to determine Super node signing key.');
|
throw new Error('Failed to determine Super node signing key.');
|
||||||
}
|
}
|
||||||
|
|
||||||
readDB("localbitcoinUser", "00-01", function (su_data) {
|
readDB("localbitcoinUser", "00-01").then(function (su_data) {
|
||||||
if (typeof su_data == "object" && typeof su_data.myLocalFLOPublicKey ==
|
if (typeof su_data == "object" && typeof su_data.myLocalFLOPublicKey ==
|
||||||
"string" &&
|
"string" &&
|
||||||
su_data.myLocalFLOPublicKey.length > 0 &&
|
su_data.myLocalFLOPublicKey.length > 0 &&
|
||||||
localbitcoinplusplus.master_configurations.supernodesPubKeys
|
localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||||
.includes(su_data.myLocalFLOPublicKey)) {
|
.includes(su_data.myLocalFLOPublicKey)) {
|
||||||
|
|
||||||
let receivedTradeInfoHash = Crypto.SHA256(JSON.stringify(
|
let receivedTradeInfoHash = Crypto.SHA256(JSON.stringify(
|
||||||
receivedTradeInfo));
|
receivedTradeInfo));
|
||||||
|
|
||||||
@ -9680,7 +9656,7 @@
|
|||||||
params.status = 1;
|
params.status = 1;
|
||||||
let receivedTradeInfo = { ...params };
|
let receivedTradeInfo = { ...params };
|
||||||
|
|
||||||
readDB("localbitcoinUser", "00-01", function (su_data) {
|
readDB("localbitcoinUser", "00-01").then(function (su_data) {
|
||||||
if (typeof su_data == "object" && typeof su_data.myLocalFLOPublicKey ==
|
if (typeof su_data == "object" && typeof su_data.myLocalFLOPublicKey ==
|
||||||
"string" &&
|
"string" &&
|
||||||
su_data.myLocalFLOPublicKey.length > 0 &&
|
su_data.myLocalFLOPublicKey.length > 0 &&
|
||||||
@ -9701,7 +9677,7 @@
|
|||||||
// YOU NEED TO DETERMINE A BANK ACCOUNT HERE IF NO ONE IS WITHDRAWING
|
// YOU NEED TO DETERMINE A BANK ACCOUNT HERE IF NO ONE IS WITHDRAWING
|
||||||
try {
|
try {
|
||||||
addDB("deposit", receivedTradeInfo);
|
addDB("deposit", receivedTradeInfo);
|
||||||
readDBbyIndex("withdraw_cash", "status", 1,
|
readDBbyIndex("withdraw_cash", "status", 1).then(
|
||||||
function (
|
function (
|
||||||
withdrawers_list) {
|
withdrawers_list) {
|
||||||
if (typeof withdrawers_list ==
|
if (typeof withdrawers_list ==
|
||||||
@ -9822,7 +9798,7 @@
|
|||||||
params.status = 1;
|
params.status = 1;
|
||||||
if (params.product == "BTC") {
|
if (params.product == "BTC") {
|
||||||
// Check how much Bitcoins the user can withdraw
|
// Check how much Bitcoins the user can withdraw
|
||||||
readDB("btc_balances", params.trader_flo_address, function (
|
readDB("btc_balances", params.trader_flo_address).then(function (
|
||||||
btc_balance_res) {
|
btc_balance_res) {
|
||||||
if (typeof btc_balance_res == "object" && typeof btc_balance_res
|
if (typeof btc_balance_res == "object" && typeof btc_balance_res
|
||||||
.trader_flo_address == "string" &&
|
.trader_flo_address == "string" &&
|
||||||
@ -9849,7 +9825,8 @@
|
|||||||
let receiverBTCAddress = params.receivinAddress
|
let receiverBTCAddress = params.receivinAddress
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
readAllDB("deposit", function (deposit_list) {
|
readAllDB("deposit").then(function (deposit_list_res) {
|
||||||
|
let deposit_list = deposit_list_res.result;
|
||||||
if (typeof deposit_list == "object" &&
|
if (typeof deposit_list == "object" &&
|
||||||
deposit_list.length > 0) {
|
deposit_list.length > 0) {
|
||||||
deposit_list = deposit_list.filter(
|
deposit_list = deposit_list.filter(
|
||||||
@ -9889,7 +9866,7 @@
|
|||||||
|
|
||||||
// doSend btc_private_key_shamirs_id from system_btc_reserves_private_keys
|
// doSend btc_private_key_shamirs_id from system_btc_reserves_private_keys
|
||||||
valid_btc_list.map(vbl=>{
|
valid_btc_list.map(vbl=>{
|
||||||
readDBbyIndex('system_btc_reserves_private_keys', 'btc_address', vbl.deposited_btc_address, function(res) {
|
readDBbyIndex('system_btc_reserves_private_keys', 'btc_address', vbl.deposited_btc_address).then(function(res) {
|
||||||
let retrieve_pvtkey_req_id = res[0].id;
|
let retrieve_pvtkey_req_id = res[0].id;
|
||||||
res[0].btc_private_key_shamirs_id.map(bpks=>{
|
res[0].btc_private_key_shamirs_id.map(bpks=>{
|
||||||
let retrieve_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
let retrieve_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
||||||
@ -9931,7 +9908,7 @@
|
|||||||
AND RECEIVER HAS CONFIRMED WITHDRAW*/
|
AND RECEIVER HAS CONFIRMED WITHDRAW*/
|
||||||
|
|
||||||
// Check how much Cash user can withdraw
|
// Check how much Cash user can withdraw
|
||||||
readDB("cash_balances", params.trader_flo_address, function (
|
readDB("cash_balances", params.trader_flo_address).then(function (
|
||||||
cash_balances_res) {
|
cash_balances_res) {
|
||||||
if (typeof cash_balances_res == "object" && typeof cash_balances_res
|
if (typeof cash_balances_res == "object" && typeof cash_balances_res
|
||||||
.trader_flo_address == "string" &&
|
.trader_flo_address == "string" &&
|
||||||
@ -9954,7 +9931,7 @@
|
|||||||
status: 1 // withdraw request called
|
status: 1 // withdraw request called
|
||||||
}
|
}
|
||||||
|
|
||||||
readDB("localbitcoinUser", "00-01", function (
|
readDB("localbitcoinUser", "00-01").then(function (
|
||||||
su_data) {
|
su_data) {
|
||||||
if (typeof su_data == "object" &&
|
if (typeof su_data == "object" &&
|
||||||
typeof su_data.myLocalFLOPublicKey ==
|
typeof su_data.myLocalFLOPublicKey ==
|
||||||
@ -10045,9 +10022,9 @@
|
|||||||
if(typeof pkChunks.private_key_chunk !== "undefined") return pkChunks.private_key_chunk.privateKeyChunks;
|
if(typeof pkChunks.private_key_chunk !== "undefined") return pkChunks.private_key_chunk.privateKeyChunks;
|
||||||
}).filter(val => val !== undefined);
|
}).filter(val => val !== undefined);
|
||||||
|
|
||||||
readDB('withdraw_btc', withdraw_id, function(withdraw_res) {
|
readDB('withdraw_btc', withdraw_id).then(function(withdraw_res) {
|
||||||
if (typeof withdraw_res == "object") {
|
if (typeof withdraw_res == "object") {
|
||||||
readDB('system_btc_reserves_private_keys', retrieve_pvtkey_req_id, function(btc_reserves) {
|
readDB('system_btc_reserves_private_keys', retrieve_pvtkey_req_id).then(function(btc_reserves) {
|
||||||
if (typeof btc_reserves == "object") {
|
if (typeof btc_reserves == "object") {
|
||||||
let transaction_key = btc_reserves.supernode_transaction_key;
|
let transaction_key = btc_reserves.supernode_transaction_key;
|
||||||
if (transaction_key.length>0) {
|
if (transaction_key.length>0) {
|
||||||
@ -10073,7 +10050,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
readDBbyIndex('deposit', 'btc_address', withdraw_res.utxo_addr, function(deposit_arr) {
|
readDBbyIndex('deposit', 'btc_address', withdraw_res.utxo_addr).then(function(deposit_arr) {
|
||||||
if (typeof deposit_arr=="object") {
|
if (typeof deposit_arr=="object") {
|
||||||
let eqBTC = localbitcoinplusplus.trade.prototype.calculateBTCEquivalentOfCash(withdraw_res.receiverBTCEquivalentInCash);
|
let eqBTC = localbitcoinplusplus.trade.prototype.calculateBTCEquivalentOfCash(withdraw_res.receiverBTCEquivalentInCash);
|
||||||
eqBTC = parseFloat(eqBTC);
|
eqBTC = parseFloat(eqBTC);
|
||||||
@ -10266,7 +10243,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Check buyer's INR balance
|
//Check buyer's INR balance
|
||||||
readDB("cash_balances", params.trader_flo_address, function (res) {
|
readDB("cash_balances", params.trader_flo_address).then(function (res) {
|
||||||
if (typeof res !== "undefined" && typeof res.cash_balance == "number" && !isNaN(res.cash_balance)) {
|
if (typeof res !== "undefined" && typeof res.cash_balance == "number" && !isNaN(res.cash_balance)) {
|
||||||
let buyer_cash_balance = parseFloat(res.cash_balance);
|
let buyer_cash_balance = parseFloat(res.cash_balance);
|
||||||
let buy_price_btc = parseFloat(params.buy_price);
|
let buy_price_btc = parseFloat(params.buy_price);
|
||||||
@ -10282,7 +10259,7 @@
|
|||||||
let res_btc;
|
let res_btc;
|
||||||
|
|
||||||
// supernode data query
|
// supernode data query
|
||||||
readDB('localbitcoinUser', '00-01', function (user_data) {
|
readDB('localbitcoinUser', '00-01').then(function (user_data) {
|
||||||
if (typeof user_data == "object" && typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY ==
|
if (typeof user_data == "object" && typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY ==
|
||||||
"string" && localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY.length >
|
"string" && localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY.length >
|
||||||
0) {
|
0) {
|
||||||
@ -10331,7 +10308,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check BTC balance of the seller
|
// Check BTC balance of the seller
|
||||||
readDB("btc_balances", params.trader_flo_address, function (res) {
|
readDB("btc_balances", params.trader_flo_address).then(function (res) {
|
||||||
if (typeof res !== "undefined" && typeof res.trader_flo_address == "string" && res.trader_flo_address
|
if (typeof res !== "undefined" && typeof res.trader_flo_address == "string" && res.trader_flo_address
|
||||||
.length > 0 &&
|
.length > 0 &&
|
||||||
typeof res.btc_balance == "number" && res.btc_balance > 0) {
|
typeof res.btc_balance == "number" && res.btc_balance > 0) {
|
||||||
@ -10347,7 +10324,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// supernode data query
|
// supernode data query
|
||||||
readDB('localbitcoinUser', '00-01', function (user_data) {
|
readDB('localbitcoinUser', '00-01').then(function (user_data) {
|
||||||
if (typeof user_data == "object" && typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY ==
|
if (typeof user_data == "object" && typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY ==
|
||||||
"string" && localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY.length > 0) {
|
"string" && localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY.length > 0) {
|
||||||
|
|
||||||
@ -10537,9 +10514,11 @@
|
|||||||
/*Finds the best buy sell id match for a trade*/
|
/*Finds the best buy sell id match for a trade*/
|
||||||
createTradePipes() {
|
createTradePipes() {
|
||||||
try {
|
try {
|
||||||
readAllDB("sellOrders", function (sellOrdersList) {
|
readAllDB("sellOrders").then(function (sellOrdersListRes) {
|
||||||
|
let sellOrdersList = sellOrdersListRes.result;
|
||||||
if (sellOrdersList.length > 0) {
|
if (sellOrdersList.length > 0) {
|
||||||
readAllDB("buyOrders", function (buyOrdersList) {
|
readAllDB("buyOrders").then(function (buyOrdersListRes) {
|
||||||
|
let buyOrdersList = buyOrdersListRes.result;
|
||||||
if (buyOrdersList.length > 0) {
|
if (buyOrdersList.length > 0) {
|
||||||
localbitcoinplusplus.master_configurations.validTradingAmount.map(
|
localbitcoinplusplus.master_configurations.validTradingAmount.map(
|
||||||
li => {
|
li => {
|
||||||
@ -10596,7 +10575,7 @@
|
|||||||
buyPipeObj.buy_price == sellPipeObj.buy_price
|
buyPipeObj.buy_price == sellPipeObj.buy_price
|
||||||
) {
|
) {
|
||||||
// Check buyer's cash balance
|
// Check buyer's cash balance
|
||||||
readDB("cash_balances", buyPipeObj.trader_flo_address, function (buyPipeCashRes) {
|
readDB("cash_balances", buyPipeObj.trader_flo_address).then(function (buyPipeCashRes) {
|
||||||
if (typeof buyPipeCashRes == "object" && typeof buyPipeCashRes.cash_balance ==
|
if (typeof buyPipeCashRes == "object" && typeof buyPipeCashRes.cash_balance ==
|
||||||
"number") {
|
"number") {
|
||||||
let buyer_cash_balance = parseFloat(buyPipeCashRes.cash_balance);
|
let buyer_cash_balance = parseFloat(buyPipeCashRes.cash_balance);
|
||||||
@ -10613,7 +10592,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check seller's BTC balance
|
// Check seller's BTC balance
|
||||||
readDB("btc_balances", sellPipeObj.trader_flo_address, function (sellPipeBTCRes) {
|
readDB("btc_balances", sellPipeObj.trader_flo_address).then(function (sellPipeBTCRes) {
|
||||||
if (typeof sellPipeBTCRes == "object" && typeof sellPipeBTCRes.btc_balance ==
|
if (typeof sellPipeBTCRes == "object" && typeof sellPipeBTCRes.btc_balance ==
|
||||||
"number") {
|
"number") {
|
||||||
let seller_btc_balance = parseFloat(sellPipeBTCRes.btc_balance)
|
let seller_btc_balance = parseFloat(sellPipeBTCRes.btc_balance)
|
||||||
@ -10630,7 +10609,7 @@
|
|||||||
|
|
||||||
// Increase buyer's BTC balance
|
// Increase buyer's BTC balance
|
||||||
let buyerBTCResponseObject;
|
let buyerBTCResponseObject;
|
||||||
readDB("btc_balances", buyPipeObj.trader_flo_address,
|
readDB("btc_balances", buyPipeObj.trader_flo_address).then(
|
||||||
function (buyPipeBTCRes) {
|
function (buyPipeBTCRes) {
|
||||||
if (typeof buyPipeBTCRes == "object" && typeof buyPipeBTCRes
|
if (typeof buyPipeBTCRes == "object" && typeof buyPipeBTCRes
|
||||||
.btc_balance == "number") {
|
.btc_balance == "number") {
|
||||||
@ -10657,7 +10636,7 @@
|
|||||||
|
|
||||||
// Increase seller's Cash balance
|
// Increase seller's Cash balance
|
||||||
let sellerCashResponseObject;
|
let sellerCashResponseObject;
|
||||||
readDB("cash_balances", sellPipeObj.trader_flo_address,
|
readDB("cash_balances", sellPipeObj.trader_flo_address).then(
|
||||||
function (sellPipeCashRes) {
|
function (sellPipeCashRes) {
|
||||||
if (typeof sellPipeCashRes ==
|
if (typeof sellPipeCashRes ==
|
||||||
"object" && typeof sellPipeCashRes
|
"object" && typeof sellPipeCashRes
|
||||||
@ -10689,7 +10668,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// supernode data query
|
// supernode data query
|
||||||
readDB('localbitcoinUser', '00-01',
|
readDB('localbitcoinUser', '00-01').then(
|
||||||
function (user_data) {
|
function (user_data) {
|
||||||
if (typeof user_data ==
|
if (typeof user_data ==
|
||||||
"object" && typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY ==
|
"object" && typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY ==
|
||||||
@ -11105,7 +11084,7 @@
|
|||||||
let received_resp = res_obj.params[0];
|
let received_resp = res_obj.params[0];
|
||||||
try {
|
try {
|
||||||
if (received_resp.trader_flo_id.length>0 && received_resp.server_msg.length>0) {
|
if (received_resp.trader_flo_id.length>0 && received_resp.server_msg.length>0) {
|
||||||
readDB("localbitcoinUser", "00-01", function(res) {
|
readDB("localbitcoinUser", "00-01").then(function(res) {
|
||||||
if (typeof res=="object" && res.myLocalFLOAddress.length>0) {
|
if (typeof res=="object" && res.myLocalFLOAddress.length>0) {
|
||||||
if (res.myLocalFLOAddress===received_resp.trader_flo_id) {
|
if (res.myLocalFLOAddress===received_resp.trader_flo_id) {
|
||||||
writeToScreen(received_resp.server_msg);
|
writeToScreen(received_resp.server_msg);
|
||||||
@ -11216,7 +11195,7 @@
|
|||||||
if (typeof resp.withdrawer_data=="object") {
|
if (typeof resp.withdrawer_data=="object") {
|
||||||
updateinDB("withdraw_cash", resp.withdrawer_data, resp.withdrawer_data.trader_flo_address);
|
updateinDB("withdraw_cash", resp.withdrawer_data, resp.withdrawer_data.trader_flo_address);
|
||||||
}
|
}
|
||||||
readDB("localbitcoinUser", "00-01", function (user) {
|
readDB("localbitcoinUser", "00-01").then(function (user) {
|
||||||
if (typeof user == "object" && user.myLocalFLOAddress == resp.data.trader_flo_address) {
|
if (typeof user == "object" && user.myLocalFLOAddress == resp.data.trader_flo_address) {
|
||||||
let counterTraderAccountAddress =
|
let counterTraderAccountAddress =
|
||||||
`<p><strong>Please pay the amount to following address:</strong></p>
|
`<p><strong>Please pay the amount to following address:</strong></p>
|
||||||
@ -11294,7 +11273,7 @@
|
|||||||
break;
|
break;
|
||||||
case "send_back_shamirs_secret_supernode_pvtkey":
|
case "send_back_shamirs_secret_supernode_pvtkey":
|
||||||
if (typeof res_obj.params == "object" && typeof res_obj.params[0] == "object") {
|
if (typeof res_obj.params == "object" && typeof res_obj.params[0] == "object") {
|
||||||
readDB("supernode_private_key_chunks", res_obj.params[0].chunk_val, function(res) {
|
readDB("supernode_private_key_chunks", res_obj.params[0].chunk_val).then(function(res) {
|
||||||
let send_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
let send_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
||||||
.send_rpc
|
.send_rpc
|
||||||
.call(this, "retrieve_shamirs_secret_supernode_pvtkey",
|
.call(this, "retrieve_shamirs_secret_supernode_pvtkey",
|
||||||
@ -11318,9 +11297,7 @@
|
|||||||
break;
|
break;
|
||||||
case "send_back_shamirs_secret_btc_pvtkey":
|
case "send_back_shamirs_secret_btc_pvtkey":
|
||||||
if (typeof res_obj.params == "object" && typeof res_obj.params[0] == "object") {
|
if (typeof res_obj.params == "object" && typeof res_obj.params[0] == "object") {
|
||||||
readDB("supernode_private_key_chunks", res_obj.params[0].chunk_val, function(res) {
|
readDB("supernode_private_key_chunks", res_obj.params[0].chunk_val).then(function(res) {
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
let send_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
let send_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
||||||
.send_rpc
|
.send_rpc
|
||||||
.call(this, "retrieve_shamirs_secret_btc_pvtkey",
|
.call(this, "retrieve_shamirs_secret_btc_pvtkey",
|
||||||
@ -11374,7 +11351,7 @@
|
|||||||
user_claim_request.sign, user_claim_request.userPubKey)) {
|
user_claim_request.sign, user_claim_request.userPubKey)) {
|
||||||
//If the request is valid, find out if the requester is depositor or withdrawer
|
//If the request is valid, find out if the requester is depositor or withdrawer
|
||||||
|
|
||||||
readDB("withdraw_cash", withdraw_order_id, function(withdraw_data) {
|
readDB("withdraw_cash", withdraw_order_id).then(function(withdraw_data) {
|
||||||
if (typeof withdraw_data=="object") {
|
if (typeof withdraw_data=="object") {
|
||||||
if (withdraw_data.depositor_flo_id==user_id) {
|
if (withdraw_data.depositor_flo_id==user_id) {
|
||||||
// Depositor claimed to deposit the cash
|
// Depositor claimed to deposit the cash
|
||||||
@ -11397,7 +11374,7 @@
|
|||||||
doSend(update_withdraw_cash_obj);
|
doSend(update_withdraw_cash_obj);
|
||||||
} else if (withdraw_data.trader_flo_address==user_id) {
|
} else if (withdraw_data.trader_flo_address==user_id) {
|
||||||
// Withdrawer confirmed the payment
|
// Withdrawer confirmed the payment
|
||||||
readDBbyIndex('cash_balances', 'trader_flo_address', withdraw_data.depositor_flo_id, function(depositor_cash_data) {
|
readDBbyIndex('cash_balances', 'trader_flo_address', withdraw_data.depositor_flo_id).then(function(depositor_cash_data) {
|
||||||
if (typeof depositor_cash_data=="object") {
|
if (typeof depositor_cash_data=="object") {
|
||||||
if (depositor_cash_data.length==0) {
|
if (depositor_cash_data.length==0) {
|
||||||
depositor_cash_data = {cash_balance:0, trader_flo_address:withdraw_data.depositor_flo_id};
|
depositor_cash_data = {cash_balance:0, trader_flo_address:withdraw_data.depositor_flo_id};
|
||||||
@ -11405,7 +11382,7 @@
|
|||||||
}
|
}
|
||||||
depositor_cash_data.cash_balance += parseFloat(withdraw_data.withdraw_amount);
|
depositor_cash_data.cash_balance += parseFloat(withdraw_data.withdraw_amount);
|
||||||
updateinDB('cash_balances', depositor_cash_data);
|
updateinDB('cash_balances', depositor_cash_data);
|
||||||
removeByIndex('deposit', 'trader_flo_address', depositor_cash_data.trader_flo_address, function() {});
|
removeByIndex('deposit', 'trader_flo_address', depositor_cash_data.trader_flo_address);
|
||||||
removeinDB('withdraw_cash', withdraw_data.id);
|
removeinDB('withdraw_cash', withdraw_data.id);
|
||||||
|
|
||||||
let update_cash_balance_obj = {
|
let update_cash_balance_obj = {
|
||||||
@ -11469,7 +11446,7 @@
|
|||||||
|
|
||||||
if ((update_cash_balance_obj_res_hash==withdraw_success_response.hash) && update_cash_balance_obj_res_verification==true) {
|
if ((update_cash_balance_obj_res_hash==withdraw_success_response.hash) && update_cash_balance_obj_res_verification==true) {
|
||||||
updateinDB('cash_balances', withdraw_success_response.depositor_cash_data);
|
updateinDB('cash_balances', withdraw_success_response.depositor_cash_data);
|
||||||
removeByIndex('deposit', 'trader_flo_address', withdraw_success_response.depositor_cash_data.trader_flo_address, function() {});
|
removeByIndex('deposit', 'trader_flo_address', withdraw_success_response.depositor_cash_data.trader_flo_address);
|
||||||
removeinDB('withdraw_cash', withdraw_success_response.withdraw_id);
|
removeinDB('withdraw_cash', withdraw_success_response.withdraw_id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -11786,43 +11763,66 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function readDB(tablename, key) {
|
function readDB(tablename, id) {
|
||||||
try {
|
return new Promise((resolve, reject)=>{
|
||||||
let tx = db.transaction(tablename, 'readonly')
|
var transaction = db.transaction([tablename]);
|
||||||
let store = tx.objectStore(tablename)
|
var objectStore = transaction.objectStore(tablename);
|
||||||
let promise = await store.get(key)
|
var request = objectStore.get(id);
|
||||||
return promise;
|
|
||||||
} catch (error) {
|
|
||||||
return new Error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function readDBbyIndex(tablename, index, indexValue, callback) {
|
request.onerror = function (event) {
|
||||||
var transaction = db.transaction([tablename]);
|
reject("Unable to retrieve data from database!");
|
||||||
var objectStore = transaction.objectStore(tablename);
|
};
|
||||||
let response = [];
|
|
||||||
objectStore.openCursor().onerror = function (event) {
|
request.onsuccess = function (event) {
|
||||||
console.error("Error fetching data");
|
if (request.result) {
|
||||||
return new Error(event);
|
resolve(request.result);
|
||||||
};
|
} else {
|
||||||
objectStore.openCursor().onsuccess = function (event) {
|
reject("Data couldn't be found in your database!");
|
||||||
let cursor = event.target.result;
|
|
||||||
if (cursor) {
|
|
||||||
if (cursor.value[index] == indexValue) {
|
|
||||||
response.push(cursor.value);
|
|
||||||
}
|
}
|
||||||
cursor.continue();
|
};
|
||||||
} else {
|
});
|
||||||
callback(response);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function readAllDB(tablename) {
|
function readDBbyIndex(tablename, index, indexValue) {
|
||||||
let tx = db.transaction(tablename, 'readonly')
|
return new Promise((resolve, reject)=>{
|
||||||
let store = tx.objectStore(tablename)
|
var transaction = db.transaction([tablename]);
|
||||||
let allSavedItems = await store.getAll()
|
var objectStore = transaction.objectStore(tablename);
|
||||||
return allSavedItems;
|
let response = [];
|
||||||
|
objectStore.openCursor().onerror = function (event) {
|
||||||
|
console.error("Error fetching data");
|
||||||
|
reject(event);
|
||||||
|
};
|
||||||
|
objectStore.openCursor().onsuccess = function (event) {
|
||||||
|
let cursor = event.target.result;
|
||||||
|
if (cursor) {
|
||||||
|
if (cursor.value[index] == indexValue) {
|
||||||
|
response.push(cursor.value);
|
||||||
|
}
|
||||||
|
cursor.continue();
|
||||||
|
} else {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function readAllDB(tablename) {
|
||||||
|
return new Promise((resolve, reject)=>{
|
||||||
|
var objectStore = db.transaction(tablename).objectStore(tablename);
|
||||||
|
let response = [];
|
||||||
|
objectStore.openCursor().onerror = function (event) {
|
||||||
|
reject("Error fetching data");
|
||||||
|
};
|
||||||
|
objectStore.openCursor().onsuccess = function (event) {
|
||||||
|
let cursor = event.target.result;
|
||||||
|
if (cursor) {
|
||||||
|
response.push(cursor.value);
|
||||||
|
cursor.continue();
|
||||||
|
} else {
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addDB(tablename, dbObject) {
|
async function addDB(tablename, dbObject) {
|
||||||
@ -11861,21 +11861,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeByIndex(tablename, indexName, indexValue, callback) {
|
function removeByIndex(tablename, indexName, indexValue) {
|
||||||
var request = db.transaction([tablename], "readwrite")
|
return new Promise((resolve, reject)=>{
|
||||||
|
var request = db.transaction([tablename], "readwrite")
|
||||||
.objectStore(tablename);
|
.objectStore(tablename);
|
||||||
var index = request.index(indexName);
|
var index = request.index(indexName);
|
||||||
var request = index.openCursor(IDBKeyRange.only(indexValue));
|
var request = index.openCursor(IDBKeyRange.only(indexValue));
|
||||||
request.onsuccess = function() {
|
request.onsuccess = function() {
|
||||||
var cursor = request.result;
|
var cursor = request.result;
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
cursor.delete();
|
cursor.delete();
|
||||||
cursor.continue();
|
cursor.continue();
|
||||||
|
} else {
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
request.onerror = function(e) {
|
||||||
|
reject(e);
|
||||||
}
|
}
|
||||||
};
|
})
|
||||||
request.onerror = function(e) {
|
|
||||||
return new Error(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeAllinDB(tablename) {
|
async function removeAllinDB(tablename) {
|
||||||
@ -11926,21 +11930,21 @@
|
|||||||
ask_flo_addr_btn.addEventListener('click', function () {
|
ask_flo_addr_btn.addEventListener('click', function () {
|
||||||
let ask_flo_addr = document.getElementById('ask_flo_addr');
|
let ask_flo_addr = document.getElementById('ask_flo_addr');
|
||||||
let ask_flo_addr_val = ask_flo_addr.value.trim();
|
let ask_flo_addr_val = ask_flo_addr.value.trim();
|
||||||
|
|
||||||
if (ask_flo_addr_val == null || typeof ask_flo_addr_val == undefined || ask_flo_addr_val ==
|
if (ask_flo_addr_val == null || typeof ask_flo_addr_val == undefined || ask_flo_addr_val ==
|
||||||
"") {
|
"") {
|
||||||
throw new Error('Empty or invalid FLO address.');
|
throw new Error('Empty or invalid FLO address.');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
readDB("localbitcoinUser", "00-01", function (idbData) {
|
readDB("localbitcoinUser", "00-01").then(function (idbData) {
|
||||||
if (typeof idbData.myLocalFLOPublicKey == undefined || idbData.myLocalFLOPublicKey
|
if (typeof idbData.myLocalFLOPublicKey == undefined || idbData.myLocalFLOPublicKey
|
||||||
.trim() == '') {
|
.trim() == '') {
|
||||||
let user_pvt_key = prompt("Please Enter your private key");
|
let user_pvt_key = prompt("Please Enter your private key");
|
||||||
if (user_pvt_key.trim() !== "") {
|
if (user_pvt_key.trim() !== "") {
|
||||||
|
|
||||||
let newKeys = RM_WALLET.generateFloKeys(user_pvt_key);
|
let newKeys = RM_WALLET.generateFloKeys(user_pvt_key);
|
||||||
|
|
||||||
if (typeof newKeys == 'object' && typeof newKeys.address !==
|
if (typeof newKeys == 'object' && typeof newKeys.address !==
|
||||||
undefined) {
|
undefined) {
|
||||||
localbitcoinplusplusObj.myLocalFLOAddress = newKeys.address;
|
localbitcoinplusplusObj.myLocalFLOAddress = newKeys.address;
|
||||||
@ -11949,12 +11953,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Declare the user flo address
|
// Declare the user flo address
|
||||||
const MY_LOCAL_FLO_ADDRESS = localbitcoinplusplus.wallets.my_local_flo_address = idbData.myLocalFLOAddress;
|
const MY_LOCAL_FLO_ADDRESS = localbitcoinplusplus.wallets.my_local_flo_address = idbData.myLocalFLOAddress;
|
||||||
const MY_LOCAL_FLO_PUBLIC_KEY = localbitcoinplusplus.wallets.my_local_flo_public_key = idbData.myLocalFLOPublicKey;
|
const MY_LOCAL_FLO_PUBLIC_KEY = localbitcoinplusplus.wallets.my_local_flo_public_key = idbData.myLocalFLOPublicKey;
|
||||||
|
|
||||||
readDB('userPublicData', MY_LOCAL_FLO_ADDRESS, function(pubic_data_response) {
|
readDB('userPublicData', MY_LOCAL_FLO_ADDRESS).then(function(pubic_data_response) {
|
||||||
if (typeof pubic_data_response !== "object") {
|
if (typeof pubic_data_response !== "object") {
|
||||||
let user_public_data_object = {
|
let user_public_data_object = {
|
||||||
trader_flo_address: MY_LOCAL_FLO_ADDRESS,
|
trader_flo_address: MY_LOCAL_FLO_ADDRESS,
|
||||||
@ -11970,42 +11974,41 @@
|
|||||||
doSend(add_user_public_data_req);
|
doSend(add_user_public_data_req);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// rebuild private key
|
// rebuild private key
|
||||||
let supernode_transaction_key_arr = [];
|
let supernode_transaction_key_arr = [];
|
||||||
//if (localbitcoinplusplus.master_configurations.supernodesPubKeys.includes(idbData.myLocalFLOPublicKey)) {
|
readAllDB("my_supernode_private_key_chunks").then(function(chunks_res) {
|
||||||
readAllDB("my_supernode_private_key_chunks", function(chunks) {
|
let chunks = chunks_res.result;
|
||||||
if (typeof chunks == "object" && chunks.length>0) {
|
if (typeof chunks == "object" && chunks.length>0) {
|
||||||
let txKey = chunks.map(chunk=>{
|
let txKey = chunks.map(chunk=>{
|
||||||
let retrieve_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
let retrieve_pvtkey_req = localbitcoinplusplus.rpc.prototype
|
||||||
.send_rpc
|
.send_rpc
|
||||||
.call(this, "send_back_shamirs_secret_supernode_pvtkey",
|
.call(this, "send_back_shamirs_secret_supernode_pvtkey",
|
||||||
{chunk_val:chunk.id});
|
{chunk_val:chunk.id});
|
||||||
doSend(retrieve_pvtkey_req);
|
doSend(retrieve_pvtkey_req);
|
||||||
supernode_transaction_key_arr.push(chunk.supernode_transaction_key);
|
supernode_transaction_key_arr.push(chunk.supernode_transaction_key);
|
||||||
return supernode_transaction_key_arr;
|
return supernode_transaction_key_arr;
|
||||||
}).filter(function (e, i, c) {
|
}).filter(function (e, i, c) {
|
||||||
return c.indexOf(e) === i;
|
return c.indexOf(e) === i;
|
||||||
});
|
});
|
||||||
const TRANSACTION_KEY = localbitcoinplusplus.wallets.supernode_transaction_key = txKey[0][0];
|
const TRANSACTION_KEY = localbitcoinplusplus.wallets.supernode_transaction_key = txKey[0][0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//}
|
|
||||||
|
|
||||||
localbitcoinplusplus.actions.sync_with_supernode(MY_LOCAL_FLO_ADDRESS);
|
localbitcoinplusplus.actions.sync_with_supernode(MY_LOCAL_FLO_ADDRESS);
|
||||||
|
|
||||||
//localbitcoinuserdiv
|
//localbitcoinuserdiv
|
||||||
document.getElementById("localbitcoinuserdiv").innerHTML = `<p>Address: ${idbData.myLocalFLOAddress}<p>`;
|
document.getElementById("localbitcoinuserdiv").innerHTML = `<p>Address: ${idbData.myLocalFLOAddress}<p>`;
|
||||||
|
|
||||||
/* Give user the facillity to trade */
|
/* Give user the facillity to trade */
|
||||||
var buyul = document.getElementById('buyul');
|
var buyul = document.getElementById('buyul');
|
||||||
var sellul = document.getElementById('sellul');
|
var sellul = document.getElementById('sellul');
|
||||||
|
|
||||||
function getEventTarget(e) {
|
function getEventTarget(e) {
|
||||||
e = e || window.event; // for browsers compatibility
|
e = e || window.event; // for browsers compatibility
|
||||||
return e.target || e.srcElement;
|
return e.target || e.srcElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
buyul.onclick = function (event) {
|
buyul.onclick = function (event) {
|
||||||
let target = getEventTarget(event);
|
let target = getEventTarget(event);
|
||||||
let intAmount = parseFloat(target.innerHTML.match(/\d+/)[0]); // Amount of INR/BTC/whatever in integer
|
let intAmount = parseFloat(target.innerHTML.match(/\d+/)[0]); // Amount of INR/BTC/whatever in integer
|
||||||
@ -12019,7 +12022,7 @@
|
|||||||
"BTC", "INR", intAmount);
|
"BTC", "INR", intAmount);
|
||||||
doSend(buytrade);
|
doSend(buytrade);
|
||||||
}
|
}
|
||||||
|
|
||||||
sellul.onclick = function (event) {
|
sellul.onclick = function (event) {
|
||||||
let target = getEventTarget(event);
|
let target = getEventTarget(event);
|
||||||
if (typeof idbData.myLocalFLOAddress == undefined || idbData.myLocalFLOAddress
|
if (typeof idbData.myLocalFLOAddress == undefined || idbData.myLocalFLOAddress
|
||||||
@ -12033,17 +12036,17 @@
|
|||||||
"BTC", "INR", intAmount);
|
"BTC", "INR", intAmount);
|
||||||
doSend(selltrade);
|
doSend(selltrade);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deposit / Withdraw asset
|
// Deposit / Withdraw asset
|
||||||
depositWithdrawAsset(idbData.myLocalFLOAddress);
|
depositWithdrawAsset(idbData.myLocalFLOAddress);
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"ERROR: Failed to initialise the localbitcoinUser database. You are unable to trade at the moment."
|
"ERROR: Failed to initialise the localbitcoinUser database. You are unable to trade at the moment."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -12232,13 +12235,6 @@
|
|||||||
return Math.floor(Math.random(a, b) * multiple);
|
return Math.floor(Math.random(a, b) * multiple);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Function to check if user is currently involved in any operation
|
|
||||||
function isUserAlreadyTrading(usersFloAddress) {
|
|
||||||
let userCurrentBuyOrder = readAllDB("buyOrders", function (buyList) {
|
|
||||||
console.log(buyList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze*/
|
/*https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze*/
|
||||||
function deepFreeze(object) {
|
function deepFreeze(object) {
|
||||||
// Retrieve the property names defined on object
|
// Retrieve the property names defined on object
|
||||||
@ -12295,7 +12291,7 @@
|
|||||||
trader_deposits.status = 2;
|
trader_deposits.status = 2;
|
||||||
updateinDB("deposit", trader_deposits, trader_deposits.trader_flo_address);
|
updateinDB("deposit", trader_deposits, trader_deposits.trader_flo_address);
|
||||||
|
|
||||||
readDBbyIndex('system_btc_reserves_private_keys', 'btc_address', trader_deposits.btc_address, function(reserve_res) {
|
readDBbyIndex('system_btc_reserves_private_keys', 'btc_address', trader_deposits.btc_address).then(function(reserve_res) {
|
||||||
if (typeof reserve_res=="object") {
|
if (typeof reserve_res=="object") {
|
||||||
reserve_res.balance = balance;
|
reserve_res.balance = balance;
|
||||||
updateinDB('system_btc_reserves_private_keys', reserve_res, reserve_res.id);
|
updateinDB('system_btc_reserves_private_keys', reserve_res, reserve_res.id);
|
||||||
@ -12306,10 +12302,10 @@
|
|||||||
trader_flo_address: trader_deposits.trader_flo_address,
|
trader_flo_address: trader_deposits.trader_flo_address,
|
||||||
btc_balance: balance
|
btc_balance: balance
|
||||||
}
|
}
|
||||||
readDB('btc_balances', trader_deposits.trader_flo_address, function (res_btc_balances) {
|
readDB('btc_balances', trader_deposits.trader_flo_address).then(function (res_btc_balances) {
|
||||||
if (typeof res_btc_balances == "object" && typeof res_btc_balances.btc_balance ==
|
if (typeof res_btc_balances == "object" && typeof res_btc_balances.result ==
|
||||||
"number") {
|
"object" && typeof res_btc_balances.result.btc_balance=="number") {
|
||||||
updatedBTCbalances.btc_balance += parseFloat(res_btc_balances.btc_balance);
|
updatedBTCbalances.btc_balance += parseFloat(res_btc_balances.result.btc_balance);
|
||||||
}
|
}
|
||||||
// Update BTC balance of user in btc_balances
|
// Update BTC balance of user in btc_balances
|
||||||
updateinDB("btc_balances", updatedBTCbalances, trader_deposits.btc_address);
|
updateinDB("btc_balances", updatedBTCbalances, trader_deposits.btc_address);
|
||||||
@ -12323,7 +12319,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
readDBbyIndex("deposit", 'status', 1, function (res) {
|
readDBbyIndex("deposit", 'status', 1).then(function (res) {
|
||||||
res.map(function (deposit_trade) {
|
res.map(function (deposit_trade) {
|
||||||
if (deposit_trade.product == "BTC") {
|
if (deposit_trade.product == "BTC") {
|
||||||
validateDepositedBTCBalance(deposit_trade);
|
validateDepositedBTCBalance(deposit_trade);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user