diff --git a/cash_payments_handler.html b/cash_payments_handler.html index 8d4fa54..88efeaf 100644 --- a/cash_payments_handler.html +++ b/cash_payments_handler.html @@ -11378,16 +11378,12 @@ Object.defineProperty(localbitcoinplusplus, "server", { value: { - //btc_mainnet: "https://blockexplorer.com", btc_mainnet: "https://insight.bitpay.com", - //btc_testnet: "https://testnet.blockexplorer.com", btc_testnet: "https://test-insight.bitpay.com", flo_mainnet: "https://flosight.duckdns.org", flo_testnet: "https://testnet-flosight.duckdns.org", - //flo_testnet: "https://testnet.flocha.in", flo_api_mainnet: "https://ranchimallflo.duckdns.org", flo_api_testnet: "https://ranchimallflo-testnet.duckdns.org", - //flo_api_testnet: "ranchimall1.duckdns.org:5109" }, writable: false, configurable: false, diff --git a/index.html b/index.html index 8c65d3e..901f024 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,1539 @@ Local Bitcoin++ - +
@@ -88,14 +1620,9 @@
-
- - - - -
+ @@ -288,7 +1815,7 @@ - @@ -492,8 +2019,8 @@
Sender's Private Key
-
Send crypto to address
+
Send crypto to this address:

Waiting for Server's response...

@@ -579,11 +2106,11 @@
Select Crypto
@@ -11621,20 +13148,6 @@ const WS = 'ws'; const DBName = "localbitcoinDBUser"; - // MUST REMOVE FROM HERE. FETCH IT FROM A CONFIG FILE - //const masterEncryptionKey = "rEmoVeMefRomHerE"; - - // let ec_key = ''; - // if(typeof localStorage.masterEncryptionKey !== "string" - // || localStorage.masterEncryptionKey.length<1) { - // ec_key = prompt('Enter MASTER ENCRYPT KEY', ''); - // if(ec_key.length) localStorage.setItem('masterEncryptionKey', ec_key); - // } - - // if(typeof localStorage.masterEncryptionKey !== "string" - // || localStorage.masterEncryptionKey.length<1) - // throw new Error('Master Encrypt Key not found.'); - if(DBName !== "localbitcoinDBUser") { let ec_key = ''; if(typeof localStorage.masterEncryptionKey !== "string" @@ -14411,14 +15924,8 @@ ); } } else { - if (typeof conn_su_flo_id == "string") { - my_local_data.lastConnectedTime = +new Date(); - updateinDB("localbitcoinUser", my_local_data); - } else { - mss = `WARNING: Failed to update current supernode connected status in localbitcoinUser.`; - showMessage(mss); - throw new Error(mss); - } + my_local_data.lastConnectedTime = +new Date(); + updateinDB("localbitcoinUser", my_local_data); } } }); @@ -15406,7 +16913,7 @@ DO NOT SHARE OR LOSE THIS PRIVATE KEY. - Else you can lose your desposited assets like Bitcoins or Cash forever. + Else you can lose your deposited assets like Bitcoins or Cash forever. `, '', true, true, true); } @@ -21622,12 +23129,12 @@ let card = document.createElement('div'); card.classList.add('notification'); card.innerHTML = ` +

${message}

Close this notification - -

${message}

` + ` return card; } } @@ -21927,28 +23434,50 @@ e.preventDefault(); } - function areInputsEmpty(parent) { + function areInputsFilled(parent) { let allInputs = parent.querySelectorAll(".input input:not([disabled])"), allRadios = parent.querySelectorAll("input[type='radio']"), - radioStatus, inputStatus, counter = radioGroups = 0; + radioStatus, inputStatus,inputCounter = counter = radioGroups = 0, + notFilled = new Set(); if (parent.querySelector("input[name='trading_amount']")) radioGroups++; if (parent.querySelector("input[name='crypto']")) radioGroups++; if (parent.querySelector("input[name='currency']")) radioGroups++; - inputStatus = [...allInputs].every(input => input.checkValidity()) - - allRadios.forEach(radio => { - if (radio.checked) - counter++; + //inputStatus = [...allInputs].every(input => input.checkValidity()) + allInputs.forEach(input => { + if(input.checkValidity()){ + inputCounter++; + notFilled.delete(input.getAttribute('name')) + } + else{ + inputCounter--; + notFilled.add(input.getAttribute('name')) + } }) + if(inputCounter === allInputs.length) + inputStatus = true; + else + inputStatus = false; + allRadios.forEach(radio => { + if (radio.checked){ + counter++; + if(notFilled.has(radio.getAttribute('name'))) + notFilled.delete(radio.getAttribute('name')) + } + else + notFilled.add(radio.getAttribute('name')) + }) + if (counter === radioGroups) radioStatus = true; + else + radioStatus = true; if (inputStatus && radioStatus) return true else - return false + return [...notFilled] } function formValidation(formElement, e) { @@ -21956,7 +23485,7 @@ preventNonNumericalInput(e); let parent = formElement.closest('.popup'), submitBtn = parent.querySelector("button[type = 'submit']"); - if (areInputsEmpty(parent)) + if (areInputsFilled(parent) === true) submitBtn.disabled = false; else { submitBtn.disabled = true; @@ -21999,8 +23528,12 @@ parent.classList.remove('animate-label') } formValidation(parent.firstElementChild, e) - if (e.key === 'Enter') + if (e.key === 'Enter'){ parent.closest('.popup').querySelector("button[type='submit']").click(); + let unfilledItems = areInputsFilled(parent.closest('.popup')) + if (unfilledItems !== true) + notify(`Please fill ${unfilledItems.toString()}`, 'error', '', true) + } } } document.getElementById('popup-parent').addEventListener('input', (e) => { @@ -22058,7 +23591,7 @@ send_crypto_type = document.querySelector("input[name='crypto']:checked").value, utxo_addr_input = parentPopup.querySelector("input[name='senderFloId']").value, utxo_addr_wif_input = parentPopup.querySelector("input[name='senderPrivateKey']").value, - receiver_address_input = parentPopup.querySelector("input[name='recieverFloId']").value, + receiver_address_input = parentPopup.querySelector("input[name='receiverFloId']").value, receiving_crypto_amount_input = parentPopup.querySelector("input[name='amount']").value; btnLoading(btn, 'start') @@ -22294,7 +23827,7 @@ async function specialOps() { try { const admin_panel_butn = document.getElementById('admin_panel_btn') - admin_panel_butn.classList.remove('hide'); + admin_panel_butn.classList.remove('hide-completely'); localbitcoinplusplus.is_ui_loaded = true; const getClosestSuList = await readAllDB("myClosestSupernodes"); await startWebSocket(`${WS}://${getClosestSuList[0].ip}`); @@ -22798,7 +24331,7 @@ switch (res_obj.event) { case "supernode_went_down": - // This should be run by only 1 Supernode who is the reciever + // This should be run by only 1 Supernode who is the receiver if (localbitcoinplusplus.wallets.my_local_flo_address !== res_obj.receiverFloAddress) return; reactor.dispatchEvent('fireNodeGoodByeEvent', res_obj.data.subject_flo_id); @@ -24086,10 +25619,10 @@ displayBalances( updateUserDepositsResponseObject.trader_flo_address ); - notify(`INFO: Your balance is updated.`); + notify(`INFO: Your balance is updated.`, '', true, true, true); } return true; - }) + }); } else { notify( `WARNING: Failed to update balance in your DB. Please refresh.`, 'error' @@ -25896,7 +27429,7 @@ displayBalances( updateUserDepositsResponseObject.trader_flo_address ); - notify(`INFO: Your balance is updated.`); + notify(`INFO: Your balance is updated.`, '', true, true, true); } return true; }) @@ -28676,7 +30209,6 @@ request.onsuccess = function (event) { db = request.result; doShreeGanesh(); - loadLocalDBData(); }; request.onupgradeneeded = function (event) { @@ -30087,22 +31619,6 @@ } }; - const loadLocalDBData = () => { - // load local db - showMessage(`Loading your local database.`); - readDB("localbitcoinUser", "00-01").then(userInfo => { - let my_flo_id = - userInfo.myLocalFLOAddress.length > 0 - ? userInfo.myLocalFLOAddress - : `No FLO Id found`; - - showMessage(`Your FLO Id: ${my_flo_id}`); - const localbitcoinuserdiv = document.getElementById("localbitcoinuserdiv"); - localbitcoinuserdiv.innerHTML = `${my_flo_id}`; - - }); - }; - const createScript = (id, content) => { let getScriptId = document.getElementById(id); if (getScriptId == null) { @@ -30158,6 +31674,9 @@ readDB("localbitcoinUser", "00-01").then(async function (idbData) { if (typeof localbitcoinplusplus.wallets.my_local_flo_address !== "string" && localbitcoinplusplus.wallets.my_local_flo_address.length <= 0) { + notify(`No FLO Id found. Please Sign in again...`, 'error'); + const localbitcoinuserdiv = document.getElementById("localbitcoinuserdiv"); + localbitcoinuserdiv.innerHTML = `Not Found.`; return false; } @@ -30165,6 +31684,10 @@ const MY_LOCAL_FLO_ADDRESS = localbitcoinplusplus.wallets.my_local_flo_address; const MY_LOCAL_FLO_PUBLIC_KEY = localbitcoinplusplus.wallets.my_local_flo_public_key; + showMessage(`Your FLO Id: ${MY_LOCAL_FLO_ADDRESS}`); + const localbitcoinuserdiv = document.getElementById("localbitcoinuserdiv"); + localbitcoinuserdiv.innerHTML = `${MY_LOCAL_FLO_ADDRESS}`; + // launch supernode kbucket if ( localbitcoinplusplus.master_configurations.supernodesPubKeys.includes( @@ -30181,16 +31704,9 @@ MY_LOCAL_FLO_PUBLIC_KEY ) ) { - if ( - typeof localbitcoinplusplus.MY_SUPERNODE_FLO_ADDRESS == "string" - ) { - idbData.lastConnectedTime = +new Date(); - updateinDB("localbitcoinUser", idbData); - } else { - mss = `WARNING: Failed to update current supernode connected status in localbitcoinUser.`; - showMessage(mss); - throw new Error(mss); - } + idbData.lastConnectedTime = +new Date(); + updateinDB("localbitcoinUser", idbData); + let kbuck = localbitcoinplusplus.kademlia.floIdToKbucketId( localbitcoinplusplus.BASE_BLOCKCHAIN, MY_LOCAL_FLO_ADDRESS @@ -30530,6 +32046,7 @@ get_crypto_svg_selection_html('deposit_assets_type', deposit_crypto_div); function cnf_crypto_deposit() { + notify(`Getting deposited crypto status from server. Please wait...`, ''); RM_RPC.send_rpc .call(this, "refresh_deposit_status_request", { receiver_flo_address: @@ -30571,6 +32088,7 @@ let tradeAmount = helper_functions.truncateDecimals(tradeAmountSelect.value); if (depositCryptoButtonClicked === 1) { document.getElementById('server_deposit_crypto_addr').textContent = `Waiting for servers response...` + document.getElementById('deposit_crypto_h3').textContent = `Deposit ${tradeAmount} ${asset_type} to below address.` showElement('confirm_deposit_btn_section', 'deposit-crypto-group'); //first time clicked depositCryptoButton.firstElementChild.textContent = 'Send from here' @@ -30679,7 +32197,7 @@ validateDepositedCrypto(); } else { cnf_crypto_deposit(); - notify(`Deposit txid ${resp_txid} confirmed.`, '', true) + notify(`Deposit txid ${resp_txid} confirmed.`, '', true); } }