fixed various ui issues related to trade, deposit and withdraw
This commit is contained in:
parent
1e6dcd1904
commit
b04ec508c7
442
index.html
442
index.html
@ -1070,8 +1070,8 @@
|
||||
}
|
||||
/*# sourceMappingURL=main.css.map */</style>
|
||||
<style>
|
||||
/* Server logs */
|
||||
pre {
|
||||
/* Server logs */
|
||||
pre {
|
||||
max-height: 20em;
|
||||
font-family: monospace;
|
||||
font-size: 1em;
|
||||
@ -1166,76 +1166,62 @@
|
||||
<button class="hover">Ok</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="show_message" class="hide">
|
||||
<svg id="error_icon" class="notification-icon hide-completely" viewBox="0 0 100 100">
|
||||
<title>Error icon</title>
|
||||
<path d="M50,0a50,50,0,1,0,50,50A50,50,0,0,0,50,0ZM46,27.18A.79.79,0,0,1,46.6,27h7.72a.79.79,0,0,1,.79.79l-1,28.76a.79.79,0,0,
|
||||
1-.79.79H47.46a.77.77,0,0,1-.56-.23.73.73,0,0,1-.23-.56l-.86-28.76A.77.77,0,0,1,46,27.18Zm7.68,44.39A4.91,4.91,0,0,1,50,73.05a5.08,5.08,
|
||||
0,0,1-5.21-5.21A5,5,0,0,1,50,62.63a5,5,0,0,1,3.73,1.45,5.18,5.18,0,0,1,1.42,3.76A5.11,5.11,0,0,1,53.72,71.57Z"/>
|
||||
</svg>
|
||||
<svg id="done_icon" class="notification-icon" viewBox="0 0 100 100">
|
||||
<title>Done icon</title>
|
||||
<path d="M50,0a50,50,0,1,0,50,50A50,50,0,0,0,50,0ZM80.85,32.37,40.3,72.92a1.24,1.24,0,0,1-1.75,0l-19.4-19.4a1.23,1.23,0,0,1,0-1.75l3.54-3.54a1.23,
|
||||
1.23,0,0,1,1.74,0L38.55,62.35a1.24,1.24,0,0,0,1.75,0L75.57,27.08a1.23,1.23,0,0,1,1.74,0l3.54,3.54A1.23,1.23,0,0,1,80.85,32.37Z"/>
|
||||
</svg>
|
||||
<div>
|
||||
<h5>Notification</h5>
|
||||
<span id="notification_text">Message</span>
|
||||
</div>
|
||||
<button id="hide_banner_btn">
|
||||
<svg viewBox="0 0 50 50">
|
||||
<title>Close this notification</title>
|
||||
<line x1="50" y1="0" x2="0" y2="50"/>
|
||||
<line x1="0" y1="0" x2="50" y2="50"/>
|
||||
<div id="show_message" class="hide">
|
||||
<svg id="error_icon" class="notification-icon hide-completely" viewBox="0 0 100 100">
|
||||
<title>Error icon</title>
|
||||
<path d="M50,0a50,50,0,1,0,50,50A50,50,0,0,0,50,0ZM46,27.18A.79.79,0,0,1,46.6,27h7.72a.79.79,0,0,1,.79.79l-1,28.76a.79.79,0,0,
|
||||
1-.79.79H47.46a.77.77,0,0,1-.56-.23.73.73,0,0,1-.23-.56l-.86-28.76A.77.77,0,0,1,46,27.18Zm7.68,44.39A4.91,4.91,0,0,1,50,73.05a5.08,5.08,
|
||||
0,0,1-5.21-5.21A5,5,0,0,1,50,62.63a5,5,0,0,1,3.73,1.45,5.18,5.18,0,0,1,1.42,3.76A5.11,5.11,0,0,1,53.72,71.57Z"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<!--<svg id="background" viewBox="0 0 2064.612 1967.514">
|
||||
<defs>
|
||||
<filter id="Rectangle_12" x="0" y="0" width="1502.184" height="1449.184" filterUnits="userSpaceOnUse">
|
||||
<feComposite in="SourceGraphic"/>
|
||||
</filter>
|
||||
</defs>
|
||||
<rect id="Rectangle_4" data-name="Rectangle 4" width="1387" height="637" rx="60" transform="translate(71 1517.087) rotate(-45)" fill="#17bf65"/>
|
||||
<g transform="matrix(1, 0, 0, 1, 0, 0)" filter="url(#Rectangle_12)">
|
||||
<rect id="Rectangle_12-2" data-name="Rectangle 12" width="1387" height="637" rx="60" transform="translate(521.43 6) rotate(45)" fill="#6decb9"/>
|
||||
</g>
|
||||
<circle id="Ellipse_3" data-name="Ellipse 3" cx="34.5" cy="34.5" r="34.5" transform="translate(1502.612 769.248)" fill="#b2ffe8"/>
|
||||
<circle id="Ellipse_2" data-name="Ellipse 2" cx="98" cy="98" r="98" transform="translate(1868.612 1036.248)" fill="#b2b2ff"/>
|
||||
</svg>-->
|
||||
|
||||
<!--Sign in popup-->
|
||||
<div class="popup-container solid-background">
|
||||
<div id="sign_in_popup" class="popup">
|
||||
<div class="container-header">
|
||||
<h1>Sign In</h1>
|
||||
</div>
|
||||
<p class="expand light-text">Welcome to RanchiMall Crypto exchange <b>Local Bitcoin++</b></p>
|
||||
<label class="input">
|
||||
<input id="get_priv_key_field" type="password" required>
|
||||
<div class="label">Private Key</div>
|
||||
</label>
|
||||
<div class="action expand" onclick="signIn(this)">
|
||||
<button class="primary-btn expand" type="submit" disabled>
|
||||
Sign In
|
||||
</button>
|
||||
<svg viewBox="0 0 73 73" class="loader">
|
||||
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<p class="light-text">
|
||||
Don't have private key, get it from <a href="https://flo-webwallet.duckdns.org/" target="_blank">here</a>.
|
||||
</p>
|
||||
<svg id="sign_in_illustration" viewBox="0 0 612 276.03">
|
||||
<defs><style>.a{fill:#ee2a7b;}.b{fill:#9e1f63;}.c{fill:#da1c5c;}</style></defs>
|
||||
<title>Untitled-1</title>
|
||||
<polygon class="a" points="0 0 0 276.03 195.07 207.16 233.66 0 0 0"/>
|
||||
<polygon class="b" points="114.09 0 117.19 27.93 356.1 132.63 536.42 0 114.09 0"/>
|
||||
<polygon class="c" points="480.49 0 538.11 99.8 612 99.8 612 0 480.49 0"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<svg id="done_icon" class="notification-icon" viewBox="0 0 100 100">
|
||||
<title>Done icon</title>
|
||||
<path d="M50,0a50,50,0,1,0,50,50A50,50,0,0,0,50,0ZM80.85,32.37,40.3,72.92a1.24,1.24,0,0,1-1.75,0l-19.4-19.4a1.23,1.23,0,0,1,0-1.75l3.54-3.54a1.23,
|
||||
1.23,0,0,1,1.74,0L38.55,62.35a1.24,1.24,0,0,0,1.75,0L75.57,27.08a1.23,1.23,0,0,1,1.74,0l3.54,3.54A1.23,1.23,0,0,1,80.85,32.37Z"/>
|
||||
</svg>
|
||||
<div>
|
||||
<h5>Notification</h5>
|
||||
<span id="notification_text">Message</span>
|
||||
</div>
|
||||
<button id="hide_banner_btn">
|
||||
<svg viewBox="0 0 50 50">
|
||||
<title>Close this notification</title>
|
||||
<line x1="50" y1="0" x2="0" y2="50"/>
|
||||
<line x1="0" y1="0" x2="50" y2="50"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<!--Sign in popup-->
|
||||
<div class="popup-container solid-background hide">
|
||||
<div id="sign_in_popup" class="popup">
|
||||
<div class="container-header">
|
||||
<h1>Sign In</h1>
|
||||
</div>
|
||||
<p class="expand light-text">Welcome to RanchiMall Crypto exchange <b>Local Bitcoin++</b></p>
|
||||
<label class="input">
|
||||
<input id="get_priv_key_field" type="password" required>
|
||||
<div class="label">Private Key</div>
|
||||
</label>
|
||||
<div class="action expand" id="signInBtn">
|
||||
<button class="primary-btn expand" type="submit" disabled>
|
||||
Sign In
|
||||
</button>
|
||||
<svg viewBox="0 0 73 73" class="loader">
|
||||
<path d="M72.5,36.5c0,19.88-16.12,36-36,36s-36-16.12-36-36s16.12-36,36-36S72.5,16.62,72.5,36.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
<p class="light-text">
|
||||
Don't have private key, get it from <a href="https://flo-webwallet.duckdns.org/" target="_blank">here</a>.
|
||||
</p>
|
||||
<svg id="sign_in_illustration" viewBox="0 0 612 276.03">
|
||||
<defs><style>.a{fill:#ee2a7b;}.b{fill:#9e1f63;}.c{fill:#da1c5c;}</style></defs>
|
||||
<title>Untitled-1</title>
|
||||
<polygon class="a" points="0 0 0 276.03 195.07 207.16 233.66 0 0 0"/>
|
||||
<polygon class="b" points="114.09 0 117.19 27.93 356.1 132.63 536.42 0 114.09 0"/>
|
||||
<polygon class="c" points="480.49 0 538.11 99.8 612 99.8 612 0 480.49 0"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<header id="main_header" class="flex">
|
||||
<span class="expand">
|
||||
@ -1460,7 +1446,7 @@
|
||||
</svg>
|
||||
<h3>Buy Crypto</h3>
|
||||
<div class="action" id="trade_buy_button">
|
||||
<button class="btn" type="submit" disabled>
|
||||
<button class="btn" type="submit">
|
||||
Buy
|
||||
</button>
|
||||
<svg viewBox="0 0 73 73" class="loader">
|
||||
@ -1474,11 +1460,6 @@
|
||||
<div class="crypto-selector flex expand" id="selectListFiatBuy"></div>
|
||||
<h5>Select Amount</h5>
|
||||
<div class="crypto-selector flex expand" id="selectListTradingAmountBuy"></div>
|
||||
|
||||
<label class="input">
|
||||
<input type="number" inputmode="numeric" required>
|
||||
<div class="label">Buy worth of</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="popup-container hide">
|
||||
@ -1490,7 +1471,7 @@
|
||||
</svg>
|
||||
<h3>Sell Crypto</h3>
|
||||
<div class="action" id="trade_sell_button">
|
||||
<button class="btn" type="submit" disabled>
|
||||
<button class="btn" type="submit">
|
||||
Sell
|
||||
</button>
|
||||
<svg viewBox="0 0 73 73" class="loader">
|
||||
@ -1504,10 +1485,6 @@
|
||||
<div class="crypto-selector flex expand" id="selectListFiatSell"></div>
|
||||
<h5>Select Amount</h5>
|
||||
<div class="crypto-selector flex expand" id="selectListTradingAmountSell"></div>
|
||||
<label class="input">
|
||||
<input type="number" inputmode="numeric" required>
|
||||
<div class="label">Sell worth of</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Crypto section-->
|
||||
@ -1543,7 +1520,7 @@
|
||||
<div class="label">Reciever's FLO ID</div>
|
||||
</label>
|
||||
<label class="input">
|
||||
<input name="amount" type="number" inputmode="numeric" required>
|
||||
<input name="amount" type="number" required>
|
||||
<div class="label">Amount</div>
|
||||
</label>
|
||||
</div>
|
||||
@ -1568,16 +1545,17 @@
|
||||
<h5>Select Crypto</h5>
|
||||
<div class="crypto-selector flex expand" id="deposit_crypto_div"></div>
|
||||
<label class="input">
|
||||
<input id="trade_amount_select" type="number" inputmode="numeric" required>
|
||||
<input id="trade_amount_select" type="number" required>
|
||||
<div class="label">Amount</div>
|
||||
</label>
|
||||
<h5>Click After Sending Crypto To Exchange</h5>
|
||||
<div class="flex expand" id="cnf_crypto_deposit"></div>
|
||||
<label class="input">
|
||||
<input type="button">
|
||||
<div class="flex expand" id="cnf_crypto_deposit">
|
||||
<div class="action">
|
||||
<button class="btn">
|
||||
<div class="label">Confirm Deposit</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="popup-container hide">
|
||||
<div id="withdraw_crypto_popup" class="popup">
|
||||
@ -1588,7 +1566,7 @@
|
||||
</svg>
|
||||
<h3>Withdraw Crypto</h3>
|
||||
<div class="action" id="withdrawCryptoButton">
|
||||
<button class="btn" type="submit" disabled>
|
||||
<button class="btn" type="submit">
|
||||
withdraw
|
||||
</button>
|
||||
<svg viewBox="0 0 73 73" class="loader">
|
||||
@ -1603,7 +1581,7 @@
|
||||
<div class="label">Recieving crypto Address</div>
|
||||
</label>
|
||||
<label class="input">
|
||||
<input id="crypto_withdraw_amount" type="number" inputmode="numeric" required>
|
||||
<input id="crypto_withdraw_amount" type="number" required>
|
||||
<div class="label">Amount</div>
|
||||
</label>
|
||||
</div>
|
||||
@ -1631,7 +1609,7 @@
|
||||
<div class="label">Depositer's UPI address</div>
|
||||
</label>
|
||||
<label class="input">
|
||||
<input name="amount" type="number" inputmode="numeric" required>
|
||||
<input name="amount" type="number" required>
|
||||
<div class="label">Amount</div>
|
||||
</label>
|
||||
<h3 id="upiToAddress" class="hide-completely"></h3>
|
||||
@ -1659,7 +1637,7 @@
|
||||
<div class="label">Recieving UPI address</div>
|
||||
</label>
|
||||
<label class="input">
|
||||
<input name="amount" type="number" name="hi" inputmode="numeric" required>
|
||||
<input name="amount" type="number" name="hi" required>
|
||||
<div class="label">Amount</div>
|
||||
</label>
|
||||
</div>
|
||||
@ -1678,12 +1656,13 @@
|
||||
card.classList.add('order', 'grid', 'grid-2')
|
||||
currency === 'INR' ? currencySymbol = '₹' : currencySymbol = '$';
|
||||
card.innerHTML = `<div class="details">
|
||||
<h3>${type}</h3>
|
||||
<h3>${type.toUpperCase()}</h3>
|
||||
${product} worth ${currencySymbol}${price}
|
||||
<h5>Trade Id</h5>
|
||||
<span class="breakable">${tradeId}</span>
|
||||
</div>
|
||||
<button id="${tradeId}" class="cancel-order">Cancel</button>`;
|
||||
<button id="${tradeId}-${localbitcoinplusplus.wallets.my_local_flo_address}-${type}"
|
||||
class="cancel-order">Cancel</button>`;
|
||||
return card;
|
||||
}
|
||||
}
|
||||
@ -1779,7 +1758,7 @@
|
||||
currentTimeout = setTimeout(()=>{
|
||||
banner.classList.add('hide')
|
||||
banner.classList.remove('no-transformations')
|
||||
}, 4000)
|
||||
}, 10000)
|
||||
}
|
||||
// displays a popup for asking permission. Use this instead of JS confirm
|
||||
let askConfirmation = function(message){
|
||||
@ -1987,21 +1966,19 @@
|
||||
console.log(res);
|
||||
if (typeof res == "object") {
|
||||
try {
|
||||
let resp_obj = JSON.parse(res.txid);
|
||||
let resp_txid = resp_obj.txid.result || resp_obj.txid;
|
||||
let msg = `Transaction Id for your deposited crypto asset: ${resp_txid}`;
|
||||
notify(msg);
|
||||
|
||||
msg = `Signed Raw Tx for your deposited crypto asset: ${res.signedTxHash}`;
|
||||
notify(msg);
|
||||
return true;
|
||||
let resp_obj = JSON.parse(res.txid);
|
||||
let resp_txid = resp_obj.txid.result || resp_obj.txid;
|
||||
let msg = `Transaction Id for your deposited crypto asset: ${resp_txid}`;
|
||||
showMessage(msg);
|
||||
notify(msg);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
notify(error);
|
||||
console.warn(error);
|
||||
showMessage(error);
|
||||
notify(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
btnLoading(btn, 'stop')
|
||||
@ -2010,19 +1987,6 @@
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
function signIn(btn){
|
||||
let parentPopup = btn.closest('.popup');
|
||||
btnLoading(btn, 'start')
|
||||
|
||||
//if operation completes{
|
||||
setTimeout(() => {
|
||||
btnLoading(btn, 'stop')
|
||||
hidePopup(parentPopup)
|
||||
notify('Signed In')
|
||||
document.querySelector('main').classList.remove('hide-completely')
|
||||
}, 1000)
|
||||
//}
|
||||
}
|
||||
|
||||
function refreshBalance(type, btn){
|
||||
let newBalance ;
|
||||
@ -16561,50 +16525,62 @@
|
||||
return false;
|
||||
},
|
||||
manually_assign_my_private_key: function() {
|
||||
readDB("localbitcoinUser", "00-01")
|
||||
.then(usr => {
|
||||
if (typeof usr == "object" && usr.myLocalFLOAddress.length > 0) {
|
||||
const RM_WALLET = new localbitcoinplusplus.wallets();
|
||||
const pk_manual = prompt("Please enter your private key: ");
|
||||
let gen_new_keys = RM_WALLET.generateFloKeys(pk_manual);
|
||||
if (gen_new_keys.address == usr.myLocalFLOAddress) {
|
||||
Object.defineProperty(
|
||||
localbitcoinplusplus.wallets,
|
||||
"MY_SUPERNODE_PRIVATE_KEY",
|
||||
{
|
||||
value: gen_new_keys.privateKeyWIF,
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
document.querySelector('main').classList.add('hide-completely')
|
||||
notify('Please provide your FLO private key to Sign in.');
|
||||
showPopup('sign_in_popup');
|
||||
const signInBtn = document.getElementById('signInBtn');
|
||||
signInBtn.onclick = function() {
|
||||
readDB("localbitcoinUser", "00-01")
|
||||
.then(usr => {
|
||||
if (typeof usr == "object" && usr.myLocalFLOAddress.length > 0) {
|
||||
|
||||
const RM_WALLET = new localbitcoinplusplus.wallets();
|
||||
//const pk_manual = prompt("Please enter your private key: ");
|
||||
const pk_manual = document.getElementById('get_priv_key_field').value;
|
||||
let gen_new_keys = RM_WALLET.generateFloKeys(pk_manual);
|
||||
if (gen_new_keys.address == usr.myLocalFLOAddress) {
|
||||
Object.defineProperty(
|
||||
localbitcoinplusplus.wallets,
|
||||
"MY_SUPERNODE_PRIVATE_KEY",
|
||||
{
|
||||
value: gen_new_keys.privateKeyWIF,
|
||||
writable: false,
|
||||
configurable: false,
|
||||
enumerable: false
|
||||
}
|
||||
);
|
||||
notify('Signed in successfully.')
|
||||
document.querySelector('main').classList.remove('hide-completely')
|
||||
hidePopup('sign_in_popup');
|
||||
if (localbitcoinplusplus.is_ui_loaded == false) {
|
||||
dataBaseUIOperations();
|
||||
}
|
||||
|
||||
// Private key is built. Now execute private key dependent functions
|
||||
const RM_WALLET = new localbitcoinplusplus.wallets;
|
||||
const pubkey = RM_WALLET
|
||||
.generateFloKeys(localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY)
|
||||
.pubKeyHex
|
||||
if (localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||
.includes(pubkey)) {
|
||||
reactor.dispatchEvent("user_flo_keys_active", pubkey);
|
||||
}
|
||||
|
||||
Promise.resolve(true);
|
||||
} else {
|
||||
let mes = `WARNING: Failed to build your private key. You can reset keys and generate new keys from keys section below.`;
|
||||
showMessage(mes);
|
||||
Promise.reject(mes);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (localbitcoinplusplus.is_ui_loaded == false) {
|
||||
dataBaseUIOperations();
|
||||
}
|
||||
|
||||
// Private key is built. Now execute private key dependent functions
|
||||
const RM_WALLET = new localbitcoinplusplus.wallets;
|
||||
const pubkey = RM_WALLET
|
||||
.generateFloKeys(localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY)
|
||||
.pubKeyHex
|
||||
if(localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||
.includes(pubkey)) {
|
||||
reactor.dispatchEvent("user_flo_keys_active", pubkey);
|
||||
}
|
||||
|
||||
Promise.resolve(true);
|
||||
} else {
|
||||
let mes = `WARNING: Failed to build your private key. You can reset keys and generate new keys from keys section below.`;
|
||||
showMessage(mes);
|
||||
Promise.reject(mes);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
let mes = `WARNING: Failed to build your private key. You can reset keys and generate new keys from keys section below.`;
|
||||
showMessage(mes);
|
||||
Promise.reject(mes);
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
let mes = `WARNING: Failed to build your private key. You can reset keys and generate new keys from keys section below.`;
|
||||
showMessage(mes);
|
||||
Promise.reject(mes);
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
rebuild_my_private_key: function(transactionKey) {
|
||||
const RM_WALLET = new localbitcoinplusplus.wallets();
|
||||
@ -18169,15 +18145,21 @@
|
||||
request.nodePubKey
|
||||
)
|
||||
) {
|
||||
removeinDB(tradeDB, cancel_request.trade_id).then(
|
||||
id => {
|
||||
removeinDB(tradeDB, cancel_request.trade_id).then(
|
||||
id => {
|
||||
msg_response = {
|
||||
user_flo_addr: cancel_request.trader_flo_address,
|
||||
msg: `Order id ${cancel_request.trade_id} is deleted.`
|
||||
}
|
||||
reactor.dispatchEvent('message_for_user', msg_response);
|
||||
}
|
||||
).catch(e=>{
|
||||
msg_response = {
|
||||
user_flo_addr: cancel_request.trader_flo_address,
|
||||
msg: `Order id ${cancel_request.trade_id} is deleted.`
|
||||
}
|
||||
user_flo_addr: cancel_request.trader_flo_address,
|
||||
msg: `Failed to delete Order id ${cancel_request.trade_id}.`
|
||||
}
|
||||
reactor.dispatchEvent('message_for_user', msg_response);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
err_response = {
|
||||
user_flo_addr: cancel_request.trader_flo_address,
|
||||
@ -18323,6 +18305,9 @@
|
||||
|
||||
let transaction_key = localbitcoinplusplus.actions
|
||||
.master_decrypt(btc_reserves.supernode_transaction_key);
|
||||
if(typeof transaction_key=="string") {
|
||||
transaction_key = JSON.parse(transaction_key);
|
||||
}
|
||||
if (transaction_key.length > 0) {
|
||||
let btc_private_key = RM_WALLET.rebuild_private_key(
|
||||
btc_pk_shares_array,
|
||||
@ -19979,7 +19964,13 @@
|
||||
reactor.dispatchEvent('message_for_user', err_response);
|
||||
}
|
||||
|
||||
);
|
||||
).catch(e=>{
|
||||
msg_response = {
|
||||
user_flo_addr: cancel_request.trader_flo_address,
|
||||
msg: `Failed to delete Order id ${cancel_request.trade_id}.`
|
||||
}
|
||||
reactor.dispatchEvent('message_for_user', msg_response);
|
||||
});
|
||||
} else {
|
||||
err_response = {
|
||||
user_flo_addr: cancel_request.trader_flo_address,
|
||||
@ -20150,6 +20141,9 @@
|
||||
|
||||
let transaction_key = localbitcoinplusplus.actions
|
||||
.master_decrypt(btc_reserves.supernode_transaction_key);
|
||||
if(typeof transaction_key=="string") {
|
||||
transaction_key = JSON.parse(transaction_key);
|
||||
}
|
||||
if (transaction_key.length > 0) {
|
||||
let btc_private_key = RM_WALLET.rebuild_private_key(
|
||||
btc_pk_shares_array,
|
||||
@ -21775,7 +21769,6 @@
|
||||
console.log(trx);
|
||||
|
||||
let signedTxHash = trx.sign(utxo_addr_wif, 1); //SIGHASH_ALL DEFAULT 1
|
||||
showMessage(`Signed Transaction Hash: ${signedTxHash}`);
|
||||
console.log(signedTxHash);
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
@ -22719,15 +22712,14 @@
|
||||
RM_WALLET.distributeShamirsSecretShares(newKeys.privateKeyWIF)
|
||||
.then(() => privateKeyBuilder())
|
||||
.finally(() => {
|
||||
setTimeout(function() {
|
||||
setTimeout(async function() {
|
||||
if (
|
||||
typeof localbitcoinplusplus.wallets
|
||||
.MY_SUPERNODE_PRIVATE_KEY !== "string" ||
|
||||
localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY
|
||||
.length < 1
|
||||
) {
|
||||
RM_WALLET.manually_assign_my_private_key();
|
||||
dataBaseUIOperations();
|
||||
await RM_WALLET.manually_assign_my_private_key();
|
||||
} else if (
|
||||
typeof localbitcoinplusplus.wallets
|
||||
.MY_SUPERNODE_PRIVATE_KEY == "string" &&
|
||||
@ -22839,14 +22831,13 @@
|
||||
// rebuild private key
|
||||
await privateKeyBuilder();
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(async function() {
|
||||
if (
|
||||
typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY !==
|
||||
"string" ||
|
||||
localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY.length < 1
|
||||
) {
|
||||
RM_WALLET.manually_assign_my_private_key();
|
||||
dataBaseUIOperations();
|
||||
await RM_WALLET.manually_assign_my_private_key();
|
||||
} else if (
|
||||
typeof localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY ==
|
||||
"string" &&
|
||||
@ -23092,7 +23083,7 @@
|
||||
// Connection established, build private key and UI
|
||||
await privateKeyBuilder();
|
||||
|
||||
localbitcoinplusplus.actions.delay(10000).then(() => {
|
||||
localbitcoinplusplus.actions.delay(10000).then(async() => {
|
||||
if (
|
||||
typeof localbitcoinplusplus.wallets
|
||||
.MY_SUPERNODE_PRIVATE_KEY !== "string" ||
|
||||
@ -23100,8 +23091,7 @@
|
||||
1
|
||||
) {
|
||||
const RM_WALLET = new localbitcoinplusplus.wallets();
|
||||
RM_WALLET.manually_assign_my_private_key();
|
||||
dataBaseUIOperations();
|
||||
await RM_WALLET.manually_assign_my_private_key();
|
||||
} else if (
|
||||
typeof localbitcoinplusplus.wallets
|
||||
.MY_SUPERNODE_PRIVATE_KEY == "string" &&
|
||||
@ -23545,7 +23535,8 @@
|
||||
addDB("buyOrders", buyOrders_data).then(() => {
|
||||
if(localbitcoinplusplus.wallets.my_local_flo_address
|
||||
===buyOrders_data.trader_flo_address) {
|
||||
showMessage(`Your buy order is placed successfully.`);
|
||||
displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address)
|
||||
notify(`Your buy order is placed successfully.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -23581,9 +23572,8 @@
|
||||
addDB("sellOrders", sellOrders_data).then(() => {
|
||||
if(localbitcoinplusplus.wallets.my_local_flo_address
|
||||
===sellOrders_data.trader_flo_address) {
|
||||
showMessage(
|
||||
`Your sell order is placed successfully.`
|
||||
);
|
||||
displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address);
|
||||
notify(`Your sell order is placed successfully.`);
|
||||
}
|
||||
|
||||
});
|
||||
@ -23889,11 +23879,13 @@
|
||||
);
|
||||
|
||||
Promise.all([p1,p2,p3,p4]).then(()=>{
|
||||
displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address)
|
||||
// Update balances
|
||||
displayBalances(
|
||||
localbitcoinplusplus.wallets.my_local_flo_address
|
||||
);
|
||||
showMessage("Balances updated.")
|
||||
notify("Trade successfull. Balances updated.")
|
||||
showMessage("Trade successfull. Balances updated.")
|
||||
})
|
||||
.catch(e => {throw new Error(e)});
|
||||
|
||||
@ -23999,6 +23991,8 @@
|
||||
typeof res_obj.nodePubKey != "string"
|
||||
|| !localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||
.includes(res_obj.nodePubKey)
|
||||
|| !localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||
.includes(localbitcoinplusplus.wallets.my_local_flo_address)
|
||||
) return;
|
||||
|
||||
readDB(
|
||||
@ -25118,7 +25112,8 @@
|
||||
addDB("buyOrders", buyOrders_data).then(() => {
|
||||
if(localbitcoinplusplus.wallets.my_local_flo_address
|
||||
===buyOrders_data.trader_flo_address) {
|
||||
showMessage(`Your buy order is placed successfully.`);
|
||||
displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address)
|
||||
notify(`Your buy order is placed successfully.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -25147,11 +25142,6 @@
|
||||
if (
|
||||
typeof localbitcoinplusplus.master_configurations
|
||||
.supernodesPubKeys == "object"
|
||||
// Commented this because it prevents usernode to register data in db
|
||||
// while a backup supernode sends it any data like trade_buy
|
||||
|
||||
// && localbitcoinplusplus.master_configurations.supernodesPubKeys.includes(
|
||||
// sellOrders_data.supernodePubKey)
|
||||
) {
|
||||
let isDataSignedBySuperNode = RM_WALLET.verify(
|
||||
sellOrders_data.data_hash,
|
||||
@ -25163,9 +25153,8 @@
|
||||
addDB("sellOrders", sellOrders_data).then(() => {
|
||||
if(localbitcoinplusplus.wallets.my_local_flo_address
|
||||
===sellOrders_data.trader_flo_address) {
|
||||
showMessage(
|
||||
`Your sell order is placed successfully.`
|
||||
);
|
||||
displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address);
|
||||
notify(`Your sell order is placed successfully.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -25483,10 +25472,13 @@
|
||||
);
|
||||
|
||||
Promise.all([pr1,pr2,pr3,pr4]).then(()=>{
|
||||
displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address);
|
||||
// Update balances
|
||||
displayBalances(
|
||||
localbitcoinplusplus.wallets.my_local_flo_address
|
||||
);
|
||||
notify("Trade successfull. Balances updated.")
|
||||
showMessage("Trade successfull. Balances updated.")
|
||||
})
|
||||
.catch(e => {throw new Error(e)});
|
||||
|
||||
@ -25653,6 +25645,8 @@
|
||||
.includes(res_obj.nodePubKey)
|
||||
|| typeof localbitcoinplusplus.newBackupDatabase.db[res_obj.params[0].db_inst]
|
||||
!== "object"
|
||||
|| !localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||
.includes(localbitcoinplusplus.wallets.my_local_flo_address)
|
||||
)
|
||||
return;
|
||||
|
||||
@ -27095,12 +27089,7 @@
|
||||
false
|
||||
);
|
||||
|
||||
Promise.all([b1,b2,b3,b4]).then(()=>{
|
||||
// Update balances
|
||||
displayBalances(
|
||||
localbitcoinplusplus.wallets.my_local_flo_address
|
||||
);
|
||||
})
|
||||
Promise.all([b1,b2,b3,b4])
|
||||
.catch(e => {throw new Error(e)});
|
||||
|
||||
} catch (error) {
|
||||
@ -27461,6 +27450,8 @@
|
||||
.includes(res_obj.nodePubKey)
|
||||
|| typeof localbitcoinplusplus.newBackupDatabase.db[res_obj.params[0].db_inst]
|
||||
!== "object"
|
||||
|| !localbitcoinplusplus.master_configurations.supernodesPubKeys
|
||||
.includes(localbitcoinplusplus.wallets.my_local_flo_address)
|
||||
)
|
||||
return;
|
||||
|
||||
@ -29411,7 +29402,9 @@
|
||||
let objectStoreRequest = request.get(key);
|
||||
objectStoreRequest.onsuccess = function (event) {
|
||||
var myRecord = objectStoreRequest.result;
|
||||
if (typeof myRecord !== "object") {
|
||||
if (myRecord==null
|
||||
|| myRecord== undefined
|
||||
|| typeof myRecord !== "object") {
|
||||
Obj.vectorClock =
|
||||
typeof Obj.vectorClock == "number" ? Obj.vectorClock : 0;
|
||||
if(!exception_datastores.includes(tablename)) {
|
||||
@ -29420,11 +29413,16 @@
|
||||
request = db.transaction([tablename], "readwrite")
|
||||
.objectStore(tablename).put(Obj);
|
||||
} else if (myRecord.vectorClock < Obj.vectorClock) {
|
||||
// Don't sign rather verify data here
|
||||
if(!exception_datastores.includes(tablename)) {
|
||||
Obj = signDBData(Obj);
|
||||
if(verifyDBData(Obj)===true) {
|
||||
request = db.transaction([tablename], "readwrite")
|
||||
.objectStore(tablename).put(Obj);
|
||||
} else {
|
||||
console.trace(Obj);
|
||||
throw new Error('Failed verification at db update');
|
||||
}
|
||||
}
|
||||
request = db.transaction([tablename], "readwrite")
|
||||
.objectStore(tablename).put(Obj);
|
||||
} else {
|
||||
resolve(Obj);
|
||||
}
|
||||
@ -30061,7 +30059,9 @@
|
||||
let objectStoreRequest = this.request.get(key);
|
||||
objectStoreRequest.onsuccess = function(event) {
|
||||
var myRecord = objectStoreRequest.result;
|
||||
if (typeof myRecord !== "object") {
|
||||
if (myRecord==null
|
||||
|| myRecord== undefined
|
||||
|| typeof myRecord !== "object") {
|
||||
Obj.vectorClock =
|
||||
typeof Obj.vectorClock == "number" ? Obj.vectorClock : 0;
|
||||
if(!exception_datastores.includes(tablename)) {
|
||||
@ -30076,8 +30076,8 @@
|
||||
this.request = this.db.transaction([tablename], "readwrite")
|
||||
.objectStore(tablename).put(Obj);
|
||||
} else {
|
||||
console.error('failed verification at backup update');
|
||||
console.trace(Obj);
|
||||
throw new Error('failed verification at backup update');
|
||||
}
|
||||
}
|
||||
|
||||
@ -30552,27 +30552,22 @@
|
||||
my_trades_div.innerHTML = '<h4>No trade orders yet.</h4>'
|
||||
my_trades_div.append(frag);
|
||||
|
||||
var delclassname = document.getElementsByClassName("CANCEL_TRADE");
|
||||
|
||||
Array.from(delclassname).forEach(function(element) {
|
||||
element.addEventListener("click", function(e) {
|
||||
// Function for cancelling trade orders
|
||||
document.getElementById('orders_container').addEventListener('click', (e) => {
|
||||
let container = document.getElementById('orders_container');
|
||||
if(e.target.closest('.cancel-order'))
|
||||
askConfirmation('Are you sure to cancel this trade order?').then((result) => {
|
||||
if(result){
|
||||
let cancel_td = this.id;
|
||||
let trade_opts = cancel_td.split("-");
|
||||
RM_TRADE.cancelTrade(trade_opts[0], trade_opts[1], trade_opts[2]);
|
||||
|
||||
let tradeId = e.target.closest('.cancel-order').id;
|
||||
let trade_opts = tradeId.split("-");
|
||||
RM_TRADE.cancelTrade(trade_opts[0], trade_opts[1], trade_opts[2]);
|
||||
e.target.closest('.order').remove();
|
||||
notify(`Order id: ${tradeId} cancelled.`)
|
||||
showMessage('', `Order id: ${trade_opts[0]} cancelled.`)
|
||||
if(container.children.length === 0)
|
||||
container.innerHTML = '<h4>No trade orders yet.</h4>'
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
};
|
||||
@ -30684,7 +30679,7 @@
|
||||
let parentPopup = this.closest('.popup'),
|
||||
selectedCrypto = parentPopup.querySelector("input[name='crypto']:checked").value,
|
||||
selectedCurrency = parentPopup.querySelector("input[name='currency']:checked").value,
|
||||
buyWorth = parentPopup.querySelector('.input input').value;
|
||||
buyWorth = parentPopup.querySelector("input[name='trading_amount']:checked").value;
|
||||
|
||||
RM_TRADE.place_order(
|
||||
"buy",
|
||||
@ -30708,7 +30703,7 @@
|
||||
let parentPopup = this.closest('.popup'),
|
||||
selectedCrypto = parentPopup.querySelector("input[name='crypto']:checked").value,
|
||||
selectedCurrency = parentPopup.querySelector("input[name='currency']:checked").value,
|
||||
sellWorth = parentPopup.querySelector('.input input').value;
|
||||
sellWorth = parentPopup.querySelector("input[name='trading_amount']:checked").value;
|
||||
|
||||
RM_TRADE.place_order(
|
||||
"sell",
|
||||
@ -30776,9 +30771,9 @@
|
||||
withdrawCryptoButton.addEventListener("click", function(params) {
|
||||
let parentPopup = this.closest('.popup');
|
||||
let asset_type = document.querySelector("input[name='crypto']:checked").value;
|
||||
let receivinAddress = document.getElementById('withdraw_recving_addr')
|
||||
let receivinAddress = document.getElementById('withdraw_recving_addr').value
|
||||
let withdraw_amount= document.getElementById('crypto_withdraw_amount')
|
||||
if (receivinAddress == null || receivinAddress.trim == "") {
|
||||
if (receivinAddress == null || receivinAddress.trim() == "") {
|
||||
err_msg =`You must specify a valid ${asset_type} address to continue.`;
|
||||
showMessage(err_msg);
|
||||
throw new Error(err_msg);
|
||||
@ -31056,7 +31051,6 @@
|
||||
function buildBroadcastTxUI() {
|
||||
const broadcast_tx_ui = document.getElementById("send_crypto_select_div");
|
||||
get_crypto_svg_selection_html('broadcastTx', broadcast_tx_ui);
|
||||
//broadcast_tx_ui.insertAdjacentHTML('beforeend', selectCryptoHtml)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user