@@ -36337,54 +36443,37 @@
}
},
- build_deposit_withdraw_table: function (withdraw_data) {
- if (typeof withdraw_data == "object" && withdraw_data.length > 0
- && (localbitcoinplusplus.wallets.my_local_flo_address == wd.trader_flo_address
- || localbitcoinplusplus.wallets.my_local_flo_address == wd.depositor_flo_id)) {
+ build_deposit_withdraw_table: function(withdraw_data) {
+ if (typeof withdraw_data == "object" && withdraw_data.length>0) {
let action_req = ``;
- let t =
- `
-
- | Withdrawer Flo Id |
- Depositor Flo Id |
- Amount |
- Action required |
-
`;
- withdraw_data.map(wd => {
- if (wdf => (wdf.status == 2 || wdf.status == 3)) {
-
- if (typeof localbitcoinplusplus.wallets.my_local_flo_address == "string") {
- let claim_id =
- `${wd.id}!!${localbitcoinplusplus.wallets.my_local_flo_address}`;
- if (localbitcoinplusplus.wallets.my_local_flo_address == wd.trader_flo_address) {
- action_req +=
- `Please click the button below only if you received the cash.
`;
- action_req +=
- ``;
- } else if (localbitcoinplusplus.wallets.my_local_flo_address == wd.depositor_flo_id) {
- action_req +=
- `Please click the button below only if you actually deposited the money.
- Any fake claim can cause a heavy penalty.
`;
- action_req +=
- ``;
- }
- }
-
- } else if(wdf => wdf.status == 1
- && localbitcoinplusplus.wallets.my_local_flo_address == wd.trader_flo_address) {
- action_req += `No Depositor found yet.
`;
+ let t = `
+
+ | Withdrawer Flo Id |
+ Depositor Flo Id |
+ Amount |
+ Action required |
+
`;
+ withdraw_data.filter(wdf=>(wdf.status==2 || wdf.status==3)).map(wd=>{
+ if(typeof localbitcoinplusplus.wallets.my_local_flo_address=="string") {
+ let claim_id = `${wd.id}!!${localbitcoinplusplus.wallets.my_local_flo_address}`;
+ if (localbitcoinplusplus.wallets.my_local_flo_address==wd.trader_flo_address) {
+ action_req += `Please click the button below only if you received the cash.
`;
+ action_req += ``;
+ } else if(localbitcoinplusplus.wallets.my_local_flo_address==wd.depositor_flo_id) {
+ action_req += `Please click the button below only if you actually deposited the money.
+ Any fake claim can cause a heavy penalty.
`;
+ action_req += ``;
+ }
}
-
t += `
| ${wd.trader_flo_address} |
${wd.depositor_flo_id} |
${wd.withdraw_amount} |
${action_req} | `;
t += `
`;
-
});
-
- t += `
`;
+
+ t += `
`;
modalWindow(t);
}
@@ -36946,10 +37035,32 @@
if (typeof params.trader_flo_address == "string") respective_trader_id = params.trader_flo_address;
request.response = {};
+ if (method=="sync_with_supernode") {
+ RM_RPC.filter_legit_requests(function (is_valid_request) {
+ if (is_valid_request === true && params.job ==
+ "SYNC_MY_LOCAL_DB_WITH_SUPERNODE_DB" && params.trader_flo_address.length >
+ 0) {
+ const tableArray = ["deposit", "withdraw_cash", "withdraw_btc",
+ "crypto_balances", "cash_balances", "userPublicData"
+ ];
+ localbitcoinplusplus.actions.get_sharable_db_data(tableArray).then(
+ function (su_db_data) {
+ if (typeof su_db_data == "object") {
+ su_db_data.trader_flo_address = params.trader_flo_address;
+ let server_sync_response = RM_RPC
+ .send_rpc
+ .call(this, "server_sync_response",
+ su_db_data);
+ doSend(server_sync_response);
+ }
+ });
+ }
+ });
+ }
+
if (localbitcoinplusplus.master_configurations.supernodesPubKeys.includes(
localbitcoinplusplus.wallets.my_local_flo_public_key)) {
try {
-
// CHECK HERE IF USER IS INDULGED IN ANY MORE TRADE. IF TRUE RETURN ERROR
await readAllDB("deposit").then(function (res) {
if (typeof res == "object" && res.length > 0) {
@@ -36959,7 +37070,17 @@
if (canUserTrade.includes(true)) {
request.response =
`Trader id ${respective_trader_id} is not clear for trade currently.
- You must finish your previous pending orders to qualify again to trade.`;
+ You must finish your previous pending orders to qualify again to trade.`;
+
+ const RM_RPC = new localbitcoinplusplus.rpc;
+ let server_response = RM_RPC
+ .send_rpc
+ .call(this, "supernode_message", {
+ "trader_flo_id": respective_trader_id,
+ "server_msg": request.response
+ });
+ doSend(server_response);
+ throw new Error(request.response);
return false;
}
}
@@ -36975,7 +37096,7 @@
respective_trader_id) {
let server_msg =
`Trader id ${respective_trader_id} is not clear for trade currently.
- You must finish your previous pending deposit/withdraw action to qualify again to trade.`;
+ You must finish your previous pending deposit/withdraw action to qualify again to trade.`;
const RM_RPC = new localbitcoinplusplus.rpc;
let server_response = RM_RPC
@@ -37075,28 +37196,8 @@
});
break;
case "sync_with_supernode":
- RM_RPC.filter_legit_requests(function (is_valid_request) {
- if (is_valid_request === true && params.job ==
- "SYNC_MY_LOCAL_DB_WITH_SUPERNODE_DB" && params.trader_flo_address.length >
- 0) {
- const tableArray = ["deposit", "withdraw_cash", "withdraw_btc",
- "crypto_balances", "cash_balances", "userPublicData"
- ];
- localbitcoinplusplus.actions.get_sharable_db_data(tableArray).then(
- function (su_db_data) {
- if (typeof su_db_data == "object") {
- su_db_data.trader_flo_address = params.trader_flo_address;
- let server_sync_response = RM_RPC
- .send_rpc
- .call(this, "server_sync_response",
- su_db_data);
- doSend(server_sync_response);
- return;
- }
- });
- }
- });
- break;
+ // already processed above
+ break;
case "deposit_asset_request":
RM_RPC.filter_legit_requests(function (is_valid_request) {
@@ -38217,7 +38318,7 @@
break;
default:
- alert("Unknown method called for execution.");
+ console.warn("Unknown method called for execution.");
break;
}
}
@@ -38856,9 +38957,7 @@
let new_seller_btc_balance =
seller_btc_balance -
eqBTCSeller;
- new_seller_btc_balance = parseFloat(
- new_seller_btc_balance).toFixed(
- 8);
+ new_seller_btc_balance = parseFloat(new_seller_btc_balance).toFixed(8);
let sellerBTCResponseObject = {
id: `${sellPipeObj.trader_flo_address}_${sellPipeObj.product}`,
trader_flo_address: sellPipeObj
@@ -39511,6 +39610,7 @@
JSON.stringify(res_obj));
break;
case "server_sync_response":
+
if (typeof res_obj.params == "object" && typeof res_obj.params[0] == "object") {
let su_db_data = res_obj.params[0];
if (typeof localbitcoinplusplus.wallets.my_local_flo_address !== "string" ||
@@ -39555,6 +39655,7 @@
// Pass data to build_deposit_withdraw_table function
try {
console.log(su_db_data.withdraw_cash);
+ console.log("djfhsdjhjkdsfhksjdhfkjh");
localbitcoinplusplus.actions.build_deposit_withdraw_table(su_db_data.withdraw_cash);
} catch (error) {
@@ -39582,7 +39683,7 @@
let counterTraderAccountAddress =
`
Please pay the amount to following address:
${resp.msg}
`;
- alert(counterTraderAccountAddress);
+ modalWindow(counterTraderAccountAddress);
}
});
}
@@ -39775,39 +39876,7 @@
readDB("withdraw_cash", withdraw_order_id).then(async function (
withdraw_data) {
if (typeof withdraw_data == "object") {
- if (withdraw_data.depositor_flo_id == user_id) {
- // Depositor claimed to deposit the cash
- withdraw_data.status = 3;
- updateinDB('withdraw_cash', withdraw_data,
- withdraw_data.id);
- let update_withdraw_cash_obj_data = {
- depositor_claim: withdraw_data
- };
- let update_withdraw_cash_obj_data_str =
- JSON.stringify(
- update_withdraw_cash_obj_data);
- let update_withdraw_cash_obj_data_hash =
- Crypto.SHA256(
- update_withdraw_cash_obj_data_str);
- let update_withdraw_cash_obj_data_sign =
- RM_WALLET
- .sign(
- update_withdraw_cash_obj_data_hash,
- localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY
- );
- update_withdraw_cash_obj_data.hash =
- update_withdraw_cash_obj_data_hash;
- update_withdraw_cash_obj_data.sign =
- update_withdraw_cash_obj_data_sign;
- update_withdraw_cash_obj_data.publicKey =
- localbitcoinplusplus.wallets.my_local_flo_public_key;
- let update_withdraw_cash_obj = RM_RPC
- .send_rpc
- .call(this,
- "update_all_withdraw_cash_depositor_claim",
- update_withdraw_cash_obj_data);
- doSend(update_withdraw_cash_obj);
- } else if (withdraw_data.trader_flo_address ==
+ if (withdraw_data.trader_flo_address ==
user_id) {
// Withdrawer confirmed the payment
let depositor_cash_id =
@@ -39884,6 +39953,39 @@
doSend(update_cash_balance_req);
}
}
+ else if (withdraw_data.depositor_flo_id == user_id) {
+ // Depositor claimed to deposit the cash
+ withdraw_data.status = 3;
+ updateinDB('withdraw_cash', withdraw_data,
+ withdraw_data.id);
+ let update_withdraw_cash_obj_data = {
+ depositor_claim: withdraw_data
+ };
+ let update_withdraw_cash_obj_data_str =
+ JSON.stringify(
+ update_withdraw_cash_obj_data);
+ let update_withdraw_cash_obj_data_hash =
+ Crypto.SHA256(
+ update_withdraw_cash_obj_data_str);
+ let update_withdraw_cash_obj_data_sign =
+ RM_WALLET
+ .sign(
+ update_withdraw_cash_obj_data_hash,
+ localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY
+ );
+ update_withdraw_cash_obj_data.hash =
+ update_withdraw_cash_obj_data_hash;
+ update_withdraw_cash_obj_data.sign =
+ update_withdraw_cash_obj_data_sign;
+ update_withdraw_cash_obj_data.publicKey =
+ localbitcoinplusplus.wallets.my_local_flo_public_key;
+ let update_withdraw_cash_obj = RM_RPC
+ .send_rpc
+ .call(this,
+ "update_all_withdraw_cash_depositor_claim",
+ update_withdraw_cash_obj_data);
+ doSend(update_withdraw_cash_obj);
+ }
return true;
}
});
@@ -41489,6 +41591,22 @@
.addNewUserNodeInKbucket("FLO_TEST", genAddr.address, data);
}
}
+
+ // log event in the console
+ function LogEvent(msg) {
+ log.textContent += msg + "\n";
+ var ot = log.scrollHeight - log.clientHeight;
+ if (ot > 0) log.scrollTop = ot;
+ }
+
+ function w3_open() {
+ document.getElementById("mySidebar").style.width = "98%";
+ document.getElementById("mySidebar").style.display = "block";
+ }
+
+ function w3_close() {
+ document.getElementById("mySidebar").style.display = "none";
+ }