fixed same depositor-withdrawer issue, added css for server logs
This commit is contained in:
parent
73dd2ff748
commit
042a38fd2b
@ -9,11 +9,11 @@
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
|
||||
<style>
|
||||
html, body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
color: #ffffff;
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
color: #ffffff;
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
@ -42,11 +42,39 @@
|
||||
ul, li { list-style: none; }
|
||||
a, u { text-decoration: none; }
|
||||
a:hover{
|
||||
/* color: initial; */
|
||||
text-decoration:none;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
/* ::-webkit-scrollbar {
|
||||
height: 4px; /* height of horizontal scrollbar ← You're missing this */
|
||||
/* width: 4px; /* width of vertical scrollbar */
|
||||
/* border: 1px solid #d5d5d5;
|
||||
} */
|
||||
|
||||
/*change the thinkness of the scrollbar here*/
|
||||
::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0);
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
/*add a shadow to the scrollbar here*/
|
||||
::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 0px rgba(0,0,0,0);
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
/*this is the little scrolly dealio in the bar*/
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
background: #d5d5d5;
|
||||
height: 3px;
|
||||
}
|
||||
/*nobody needs this little scrollbar corner, I mean really, get rid of it haha*/
|
||||
::-webkit-scrollbar-corner { display: none; height: 0px; width: 0px; }
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
@ -62,6 +90,7 @@
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.center-div {
|
||||
display: block;
|
||||
align-items: center;
|
||||
@ -145,7 +174,7 @@
|
||||
.bg-lightblue2 {background-color: #93b7ec}
|
||||
.bg-red {background-color: #f44336;} /* Red */
|
||||
.bg-grey {background-color: #e7e7e7; color: black;} /* Gray */
|
||||
.bg-black {background-color: #555555;}
|
||||
.bg-black {background-color: #101010;}
|
||||
.bg-white {background-color: #ffffff;}
|
||||
.bg-purple {background-color: #9f93ec}
|
||||
.bg-olive {background-color: olivedrab}
|
||||
@ -214,24 +243,24 @@
|
||||
}
|
||||
|
||||
#talkbubble {
|
||||
width: 75%;
|
||||
height: 75%;
|
||||
background: #ec9393;
|
||||
position: relative;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
width: 75%;
|
||||
height: 75%;
|
||||
background: #ec9393;
|
||||
position: relative;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
#talkbubble:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 26px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 13px solid transparent;
|
||||
border-right: 26px solid #ec9393;
|
||||
border-bottom: 13px solid transparent;
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 26px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 13px solid transparent;
|
||||
border-right: 26px solid #ec9393;
|
||||
border-bottom: 13px solid transparent;
|
||||
}
|
||||
.push-left {
|
||||
float: left;
|
||||
@ -241,23 +270,23 @@
|
||||
}
|
||||
|
||||
#talkbubble {
|
||||
width: 80%;
|
||||
height: 75%;
|
||||
position: relative;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
width: 80%;
|
||||
height: 75%;
|
||||
position: relative;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
#talkbubble:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 26px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 13px solid transparent;
|
||||
border-right: 26px solid #ec9293;
|
||||
border-bottom: 13px solid transparent;
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 26px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 13px solid transparent;
|
||||
border-right: 26px solid #ec9293;
|
||||
border-bottom: 13px solid transparent;
|
||||
}
|
||||
|
||||
.action-keys-right, .action-keys-left {
|
||||
@ -346,10 +375,84 @@
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Server logs */
|
||||
pre {
|
||||
max-height: 20em;
|
||||
font-family: monospace;
|
||||
font-size: 1em;
|
||||
padding: 2px 5px;
|
||||
color: #0f0;
|
||||
background-color: #111;
|
||||
border: 1px solid #030;
|
||||
overflow: auto;
|
||||
margin : 0;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.w3-sidebar {
|
||||
height: 100%;
|
||||
width: auto;
|
||||
transition: width 2s ease 0s;
|
||||
-webkit-transition: width 2s;
|
||||
position: fixed!important;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.w3-bar-block .w3-bar-item {
|
||||
display: block;
|
||||
padding: 8px 16px;
|
||||
text-align: left;
|
||||
border: none;
|
||||
white-space: normal;
|
||||
float: none;
|
||||
outline: 0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.w3-large {
|
||||
font-size: 18px!important;
|
||||
}
|
||||
|
||||
.w3-teal, .w3-hover-teal:hover {
|
||||
color: #fff!important;
|
||||
}
|
||||
|
||||
.w3-xlarge {
|
||||
font-size: 24px!important;
|
||||
}
|
||||
|
||||
.sidenav {
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
top: 20px;
|
||||
left: 10px;
|
||||
background: #eee;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.sidebar_div {
|
||||
z-index: 1;
|
||||
top: 20px;
|
||||
left: 10px;
|
||||
background: #eee;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="sidenav">
|
||||
<div class="w3-sidebar w3-bar-block" style="display:none" id="mySidebar">
|
||||
<div onclick="w3_close()" class="w3-bar-item w3-button w3-large bg-black">Close</div>
|
||||
<pre id="log">Event information log
|
||||
=====================
|
||||
</pre>
|
||||
</div>
|
||||
<div class="w3-button w3-teal w3-xlarge" onclick="w3_open()">☰</div>
|
||||
</div>
|
||||
|
||||
<div class="box bg-purple">
|
||||
<div class="center-div">
|
||||
<em>
|
||||
@ -398,6 +501,9 @@
|
||||
<div class="box bg-grey">
|
||||
<div class="center-div" id="my_trades_div"></div>
|
||||
<div class="center-div" id="withdraw_deposit_table"></div>
|
||||
</div>
|
||||
<div class="box bg-green">
|
||||
|
||||
</div>
|
||||
<div class="box bg-lightblue">
|
||||
<div class="center-div">
|
||||
@ -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 =
|
||||
`<table>
|
||||
<tr>
|
||||
<th>Withdrawer Flo Id</th>
|
||||
<th>Depositor Flo Id</th>
|
||||
<th>Amount</th>
|
||||
<th>Action required</th>
|
||||
</tr>`;
|
||||
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 +=
|
||||
`<p>Please click the button below only if you received the cash.</p>`;
|
||||
action_req +=
|
||||
`<button class="button bg-green fs-16 mg-5" onclick="localbitcoinplusplus.actions.claim_deposit_withdraw('${claim_id}')">I received the money.</button>`;
|
||||
} else if (localbitcoinplusplus.wallets.my_local_flo_address == wd.depositor_flo_id) {
|
||||
action_req +=
|
||||
`<p>Please click the button below only if you actually deposited the money.
|
||||
Any fake claim can cause a heavy penalty.</p>`;
|
||||
action_req +=
|
||||
`<button class="button bg-red fs-16 mg-5" onclick="localbitcoinplusplus.actions.claim_deposit_withdraw('${claim_id}')" >I deposited the money.</button>`;
|
||||
}
|
||||
}
|
||||
|
||||
} else if(wdf => wdf.status == 1
|
||||
&& localbitcoinplusplus.wallets.my_local_flo_address == wd.trader_flo_address) {
|
||||
action_req += `<p>No Depositor found yet.</p>`;
|
||||
let t = `<table>
|
||||
<tr>
|
||||
<th>Withdrawer Flo Id</th>
|
||||
<th>Depositor Flo Id</th>
|
||||
<th>Amount</th>
|
||||
<th>Action required</th>
|
||||
</tr>`;
|
||||
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 += `<p>Please click the button below only if you received the cash.</p>`;
|
||||
action_req += `<button onclick="localbitcoinplusplus.actions.claim_deposit_withdraw('${claim_id}')">I received the money.</button>`;
|
||||
} else if(localbitcoinplusplus.wallets.my_local_flo_address==wd.depositor_flo_id) {
|
||||
action_req += `<p>Please click the button below only if you actually deposited the money.
|
||||
Any fake claim can cause a heavy penalty.</p>`;
|
||||
action_req += `<button onclick="localbitcoinplusplus.actions.claim_deposit_withdraw('${claim_id}')" >I deposited the money.</button>`;
|
||||
}
|
||||
}
|
||||
|
||||
t += `<tr>
|
||||
<td>${wd.trader_flo_address}</td>
|
||||
<td>${wd.depositor_flo_id}</td>
|
||||
<td>${wd.withdraw_amount}</td>
|
||||
<td>${action_req}</td>`;
|
||||
t += `</tr>`;
|
||||
|
||||
});
|
||||
|
||||
t += `</table>`;
|
||||
|
||||
t += ` </table>`;
|
||||
|
||||
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 =
|
||||
`<p><strong>Please pay the amount to following address:</strong></p>
|
||||
<p>${resp.msg}</p>`;
|
||||
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";
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user