@@ -46,7 +46,8 @@ function edit_rpcnode() {
4646 url_placeholder = get_rpc_placeholder ( currency_name ) [ placeholder_key ] ,
4747 btc_chain = is_btchain ( currency_name ) === true ,
4848 default_placeholder = "some.node:port" ,
49- node_select = btc_chain ? "<div class='selectarrows icon-menu2' data-pe='none'></div><div class='options'></div>" : "" ,
49+ scan_btn = glob_let . hascam ? "<div class='qrscanner' data-currency='" + currency_name + "' data-id='add_node' title='scan qr-code'><span class='icon-qrcode'></span></div>" : "<div class='selectarrows icon-menu2' data-pe='none'></div>" ,
50+ node_select = btc_chain ? scan_btn + "<div class='options'></div>" : "" ,
5051 input_form = custom_nodes ? "<div id='rpc_input_box' data-currency='" + currency_name + "' data-erc20='" + glob_let . is_erc20t + "'>\
5152 <h3 class='icon-plus'>" + dialog_title + "</h3>\
5253 <div id='rpc_input'>\
@@ -59,7 +60,7 @@ function edit_rpcnode() {
5960 current_node = item_data . selected ,
6061 node_name = current_node . name ,
6162 node_url = current_node . url ,
62- node_title = ( node_name === "electrum" ) ? node_url : node_name || node_url ,
63+ node_title = ( node_name === "electrum" || node_name === "mempool.space" ) ? node_url : node_name || node_url ,
6364 dialog_html = "\
6465 <div class='formbox' id='settingsbox' data-id='" + glob_let . ap_id + "'>\
6566 <h2 class='icon-sphere'>" + tl ( "choose" ) + " " + currency_name + " " + glob_let . ap_id + "</h2>\
@@ -102,8 +103,8 @@ function edit_rpcnode() {
102103}
103104
104105function fetch_electrum_nodes ( currency , node_url , predefined_nodes , custom_nodes ) {
105- const coin_settings = get_coinsettings ( currency ) ,
106- random_node = get_random_electrum_node ( predefined_nodes ) ;
106+ const existing_nodes = $ . extend ( predefined_nodes , custom_nodes ) ,
107+ random_node = get_random_electrum_node ( existing_nodes ) ;
107108 if ( random_node ) {
108109 const rpc_list = $ ( "#rpc_list" ) ,
109110 api_options = rpc_list . find ( ".options" ) ,
@@ -184,7 +185,6 @@ function fetch_electrum_nodes(currency, node_url, predefined_nodes, custom_nodes
184185 "params" : {
185186 "method" : "POST" ,
186187 "cache" : true ,
187- "timeout" : 20000 ,
188188 "data" : JSON . stringify ( {
189189 "id" : sha_sub ( rpc_url2 , 6 ) ,
190190 "method" : "blockchain.transaction.get" ,
@@ -303,7 +303,6 @@ function validate_and_add_rpc_node(currency_name, api_list, node_id, node_data,
303303 "params" : {
304304 "method" : "POST" ,
305305 "cache" : true ,
306- "timeout" : 20000 ,
307306 "data" : JSON . stringify ( {
308307 "id" : sha_sub ( rpc_url , 6 ) ,
309308 "method" : "blockchain.transaction.get" ,
@@ -328,12 +327,13 @@ function validate_and_add_rpc_node(currency_name, api_list, node_id, node_data,
328327 const api_rpc_url = node_data . api ? glob_const . mempool_space [ currency_name ] : rpc_url ;
329328 api_proxy ( { // mempoolspace API
330329 "api_url" : api_rpc_url + "/api/v1/difficulty-adjustment" ,
331- "proxy" : false ,
330+ "proxy" : api_rpc_url . includes ( ".onion" ) ,
332331 "params" : {
333332 "method" : "GET"
334333 }
335334 } ) . done ( function ( e ) {
336- const result = e . progressPercent || e . difficultyChange || e . estimatedRetargetDate ;
335+ const ar = br_result ( e ) . result ,
336+ result = ar . progressPercent || ar . difficultyChange || ar . estimatedRetargetDate ;
337337 is_live = ( result ) ? true : false ;
338338 create_rpc_node_element ( api_list , is_live , node_id , node_data , is_selected , true ) ;
339339 } ) . fail ( function ( xhr , stat , err ) {
@@ -591,7 +591,6 @@ function validate_rpc_connection(input_section, node_config, currency_name) {
591591 "params" : {
592592 "method" : "POST" ,
593593 "cache" : true ,
594- "timeout" : 20000 ,
595594 "data" : JSON . stringify ( {
596595 "id" : sha_sub ( rpc_url , 6 ) ,
597596 "method" : "blockchain.transaction.get" ,
@@ -615,7 +614,6 @@ function validate_rpc_connection(input_section, node_config, currency_name) {
615614 "params" : {
616615 "method" : "POST" ,
617616 "cache" : true ,
618- "timeout" : 20000 ,
619617 "data" : JSON . stringify ( {
620618 "id" : "scanning" ,
621619 "method" : "blockchain.scripthash.get_history" ,
@@ -633,22 +631,20 @@ function validate_rpc_connection(input_section, node_config, currency_name) {
633631 input_section . addClass ( "live" ) . removeClass ( "offline" ) ;
634632 node_config . name = "electrum" ;
635633 save_rpc_settings ( currency_name , node_config , true ) ;
634+ closeloader ( ) ;
636635 return
637636 }
638637 }
639638 }
640639 test_mempoolspace ( input_section , node_config , rpc_url , currency_name ) ;
641640 } ) . fail ( function ( xhr , stat , err ) {
642641 test_mempoolspace ( input_section , node_config , rpc_url , currency_name ) ;
643- } ) . always ( function ( ) {
644- closeloader ( ) ;
645642 } ) ;
646643 return
647644 }
648645 test_mempoolspace ( input_section , node_config , rpc_url , currency_name ) ;
649646 } ) . fail ( function ( xhr , stat , err ) {
650647 test_mempoolspace ( input_section , node_config , rpc_url , currency_name ) ;
651- closeloader ( ) ;
652648 } ) ;
653649 return
654650 }
@@ -754,7 +750,7 @@ function test_mempoolspace(input_section, node_config, rpc_url, currency_name) {
754750 error_message = tl ( "unabletoconnect" ) ;
755751 api_proxy ( {
756752 "api_url" : rpc_url + "/api/address/" + test_address + "/txs" ,
757- "proxy" : false ,
753+ "proxy" : rpc_url . includes ( ".onion" ) ,
758754 "params" : {
759755 "method" : "GET"
760756 }
@@ -768,6 +764,7 @@ function test_mempoolspace(input_section, node_config, rpc_url, currency_name) {
768764 input_section . addClass ( "live" ) . removeClass ( "offline" ) ;
769765 node_config . name = "mempool.space" ;
770766 save_rpc_settings ( currency_name , node_config , true ) ;
767+ closeloader ( ) ;
771768 return
772769 }
773770 }
@@ -777,6 +774,8 @@ function test_mempoolspace(input_section, node_config, rpc_url, currency_name) {
777774 } ) . fail ( function ( error ) {
778775 input_section . addClass ( "offline" ) . removeClass ( "live" ) ;
779776 popnotify ( "error" , error_message ) ;
777+ } ) . always ( function ( ) {
778+ closeloader ( ) ;
780779 } ) ;
781780}
782781
0 commit comments