@@ -58,7 +58,7 @@ $(document).ready(function() {
58
58
59
59
// ** Currency Settings **
60
60
61
- // Function to handle editing confirmations for cryptocurrency transactions
61
+ // Handles UI interactions for editing cryptocurrency confirmation settings using emoji-based visual indicators
62
62
function edit_confirmations ( ) {
63
63
$ ( document ) . on ( "click" , ".cc_settinglist li[data-id='confirmations'] .edit_trigger" , function ( ) {
64
64
const thistrigger = $ ( this ) ,
@@ -139,7 +139,7 @@ function edit_confirmations() {
139
139
} )
140
140
}
141
141
142
- // Function to handle submission of confirmation settings
142
+ // Processes form submission for cryptocurrency confirmation count changes with validation
143
143
function submit_confirmations ( ) {
144
144
$ ( document ) . on ( "click" , "#conf_formbox input.submit" , function ( e ) {
145
145
e . preventDefault ( ) ;
@@ -156,7 +156,7 @@ function submit_confirmations() {
156
156
} )
157
157
}
158
158
159
- // Function to handle the reuse address toggle switch
159
+ // Manages toggling of address reuse settings with user warnings for different cryptocurrencies
160
160
function reuse_address_trigger ( ) {
161
161
$ ( document ) . on ( "mouseup" , ".cc_settinglist li[data-id='Reuse address'] .switchpanel.custom" , function ( ) {
162
162
const this_switch = $ ( this ) ,
@@ -189,7 +189,7 @@ function reuse_address_trigger() {
189
189
} )
190
190
}
191
191
192
- // Function to handle generic cryptocurrency switch toggles
192
+ // Controls generic boolean switch toggles for cryptocurrency settings with automatic state persistence
193
193
function cc_switch ( ) {
194
194
$ ( document ) . on ( "mouseup" , ".cc_settinglist li .switchpanel.bool" , function ( ) {
195
195
const thistrigger = $ ( this ) ,
@@ -202,7 +202,7 @@ function cc_switch() {
202
202
} )
203
203
}
204
204
205
- // Function to handle editing block explorer settings
205
+ // Manages block explorer selection UI with dynamic option population from available explorer list
206
206
function edit_blockexplorer ( ) {
207
207
$ ( document ) . on ( "click" , ".cc_settinglist li[data-id='blockexplorers']" , function ( ) {
208
208
const current_li = $ ( this ) ,
@@ -268,7 +268,7 @@ function edit_blockexplorer() {
268
268
} )
269
269
}
270
270
271
- // Function to handle submission of block explorer settings
271
+ // Processes block explorer selection changes and updates UI state with validation
272
272
function submit_blockexplorer ( ) {
273
273
$ ( document ) . on ( "click" , "#be_formbox input.submit" , function ( e ) {
274
274
e . preventDefault ( ) ;
@@ -284,7 +284,7 @@ function submit_blockexplorer() {
284
284
} )
285
285
}
286
286
287
- // Function to handle editing RPC node settings for APIs and WebSockets
287
+ // Handles RPC/API endpoint configuration UI for both HTTP and WebSocket connections with placeholder suggestions
288
288
function edit_rpcnode ( ) {
289
289
$ ( document ) . on ( "click" , ".cc_settinglist li[data-id='apis'], .cc_settinglist li[data-id='websockets']" , function ( ) {
290
290
const current_li = $ ( this ) ,
@@ -359,7 +359,7 @@ function edit_rpcnode() {
359
359
} )
360
360
}
361
361
362
- // Function to get RPC placeholders for different currencies and API types
362
+ // Provides template URL examples for different cryptocurrency node configurations and API types
363
363
function get_rpc_placeholder ( currency ) {
364
364
return {
365
365
"apisnano1" : "eg: http://127.0.0.1:7076" ,
@@ -377,7 +377,7 @@ function get_rpc_placeholder(currency) {
377
377
}
378
378
}
379
379
380
- // Function to test and append RPC options for different cryptocurrencies
380
+ // Tests RPC endpoints for connectivity and appends validated options to the selection UI with status indicators
381
381
function test_append_rpc ( thiscurrency , optionlist , key , value , selected ) {
382
382
if ( glob_let . ap_id === "apis" ) {
383
383
if ( thiscurrency === "ethereum" || glob_let . is_erc20t === true ) {
@@ -504,7 +504,7 @@ function test_append_rpc(thiscurrency, optionlist, key, value, selected) {
504
504
}
505
505
}
506
506
507
- // Function to create and append an RPC option list item
507
+ // Creates and styles a UI element for RPC node options with live status indicators and deletion controls
508
508
function rpc_option_li ( optionlist , live , key , value , selected , checked ) {
509
509
const liveclass = live ? " live" : " offline" ,
510
510
selected_class = selected ? " rpc_selected" : "" ,
@@ -517,7 +517,7 @@ function rpc_option_li(optionlist, live, key, value, selected, checked) {
517
517
option . slideDown ( 500 ) ;
518
518
}
519
519
520
- // Function to handle RPC node selection
520
+ // Handles RPC node selection in UI with offline node detection and data persistence
521
521
function test_rpcnode ( ) {
522
522
$ ( document ) . on ( "click" , "#settingsbox .selectbox .options > div" , function ( e ) {
523
523
const target = $ ( e . target ) ;
@@ -539,7 +539,7 @@ function test_rpcnode() {
539
539
} )
540
540
}
541
541
542
- // Function to handle RPC node submission
542
+ // Validates and processes RPC node submission with duplicate checking and connection testing
543
543
function submit_rpcnode ( ) {
544
544
$ ( document ) . on ( "click" , "#settingsbox input.submit" , function ( e ) {
545
545
e . preventDefault ( ) ;
@@ -575,7 +575,7 @@ function submit_rpcnode() {
575
575
} )
576
576
}
577
577
578
- // Function to test RPC connection for various cryptocurrencies
578
+ // Tests RPC/WebSocket connectivity for multiple cryptocurrency protocols with error handling
579
579
function test_rpc ( rpc_input_box , rpc_data , currency ) {
580
580
const cant_connect = translate ( "unabletoconnect" ) ;
581
581
if ( glob_let . ap_id === "apis" ) {
@@ -723,7 +723,7 @@ function test_rpc(rpc_input_box, rpc_data, currency) {
723
723
}
724
724
}
725
725
726
- // Function to finalize RPC submission and update settings
726
+ // Updates UI and persists RPC configuration after successful validation
727
727
function pass_rpc_submit ( thiscurrency , thisvalue , newnode ) {
728
728
const rpc_setting_li = cs_node ( thiscurrency , glob_let . ap_id ) ,
729
729
options = rpc_setting_li . data ( "options" ) ,
@@ -741,7 +741,7 @@ function pass_rpc_submit(thiscurrency, thisvalue, newnode) {
741
741
save_cc_settings ( thiscurrency , true ) ;
742
742
}
743
743
744
- // Function to handle removal of RPC nodes
744
+ // Manages removal of custom RPC nodes with safeguards for default nodes
745
745
function remove_rpcnode ( ) {
746
746
$ ( document ) . on ( "click" , "#settingsbox .options .opt_icon_box .icon-bin" , function ( e ) {
747
747
e . preventDefault ( ) ;
@@ -782,7 +782,7 @@ function remove_rpcnode() {
782
782
} )
783
783
}
784
784
785
- // Function to construct RPC URL with optional authentication
785
+ // Constructs authenticated RPC URLs with protocol and credential handling
786
786
function get_rpc_url ( rpc_data ) {
787
787
if ( rpc_data === false ) {
788
788
return false ;
@@ -796,7 +796,7 @@ function get_rpc_url(rpc_data) {
796
796
return hasprefix ? urlsplit [ 0 ] + "://" + login_param + urlsplit [ 1 ] : url ;
797
797
}
798
798
799
- // Function to handle editing of Xpub settings
799
+ // Displays Xpub key information with QR code generation and deletion options
800
800
function edit_xpub_trigger ( ) {
801
801
$ ( document ) . on ( "click" , ".cc_settinglist li[data-id='Xpub'] .atext" , function ( ) {
802
802
if ( ! glob_let . test_derive ) {
@@ -833,7 +833,7 @@ function edit_xpub_trigger() {
833
833
} )
834
834
}
835
835
836
- // Function to handle deletion of Xpub
836
+ // Handles Xpub deletion with user confirmation and state cleanup
837
837
function delete_xpub ( ) {
838
838
$ ( document ) . on ( "click" , "#delete_xpub" , function ( ) {
839
839
const result = confirm ( translate ( "delete" ) + " " + translate ( "bip32xpub" ) + "?" ) ;
@@ -856,7 +856,7 @@ function delete_xpub() {
856
856
} )
857
857
}
858
858
859
- // Function to handle callback after Xpub deletion
859
+ // Updates address list UI after Xpub key deletion
860
860
function delete_xpub_cb ( currency , x_pubid , uncheck ) {
861
861
const xpublist = filter_addressli ( currency , "xpubid" , x_pubid ) ;
862
862
xpublist . each ( function ( ) {
@@ -868,15 +868,15 @@ function delete_xpub_cb(currency, x_pubid, uncheck) {
868
868
} ) ;
869
869
}
870
870
871
- // Function to handle callback after adding Xpub
871
+ // Updates address list UI after adding new Xpub key
872
872
function add_xpub_cb ( currency , x_pubid ) {
873
873
const xpublist = filter_addressli ( currency , "xpubid" , x_pubid ) ;
874
874
xpublist . each ( function ( ) {
875
875
$ ( this ) . addClass ( "xpubv" ) . removeClass ( "xpubu" ) . attr ( "data-checked" , "true" ) . data ( "checked" , true ) ;
876
876
} ) ;
877
877
}
878
878
879
- // Function to handle Xpub switch in currency settings
879
+ // Handles enabling/disabling Xpub functionality in currency settings
880
880
function xpub_cc_switch ( ) {
881
881
$ ( document ) . on ( "mouseup" , ".cc_settinglist li[data-id='Xpub'] .switchpanel.custom" , function ( ) {
882
882
if ( glob_let . test_derive !== true ) {
@@ -918,7 +918,7 @@ function xpub_cc_switch() {
918
918
} )
919
919
}
920
920
921
- // Function to handle editing of Xpub
921
+ // Displays form for adding new Xpub key with QR scanning support
922
922
function edit_xpub ( ad ) {
923
923
const currency = ad . currency ,
924
924
cpid = ad . ccsymbol + "-" + currency ,
@@ -949,7 +949,7 @@ function edit_xpub(ad) {
949
949
}
950
950
}
951
951
952
- // Function to handle Xpub input changes
952
+ // Validates Xpub input format and triggers address derivation on valid input
953
953
function xpub_change ( ) {
954
954
$ ( document ) . on ( "input" , "#xpub_input" , function ( e ) {
955
955
const thisnode = $ ( this ) ,
@@ -965,15 +965,15 @@ function xpub_change() {
965
965
} )
966
966
}
967
967
968
- // Function to trigger Xpub submission
968
+ // Triggers validation and saving of entered Xpub key
969
969
function submit_xpub_trigger ( ) {
970
970
$ ( document ) . on ( "click" , "#xpubformbox input.submit" , function ( e ) {
971
971
e . preventDefault ( ) ;
972
972
validate_xpub ( $ ( this ) . closest ( "#xpubformbox" ) ) ;
973
973
} )
974
974
}
975
975
976
- // Function to validate Xpub
976
+ // Performs comprehensive validation of Xpub key with address derivation and state updates
977
977
function validate_xpub ( thisnode ) {
978
978
const this_data = thisnode . data ( ) ,
979
979
currency = this_data . currency ,
@@ -1065,7 +1065,7 @@ function validate_xpub(thisnode) {
1065
1065
currency_check ( currency ) ;
1066
1066
}
1067
1067
1068
- // Function to handle Xpub validation failure
1068
+ // Handles failed Xpub validation with error notification
1069
1069
function xpub_fail ( currency ) {
1070
1070
const errormessage = translate ( "invalidxpub" , {
1071
1071
"currency" : currency
@@ -1074,20 +1074,20 @@ function xpub_fail(currency) {
1074
1074
clear_xpub_inputs ( ) ;
1075
1075
}
1076
1076
1077
- // Function to clear Xpub input fields
1077
+ // Resets Xpub input form state
1078
1078
function clear_xpub_inputs ( ) {
1079
1079
$ ( "#ad_info_wrap" ) . slideUp ( 200 , function ( ) {
1080
1080
$ ( "#ad_info_wrap .td_box" ) . html ( "" ) ;
1081
1081
} ) ;
1082
1082
clear_xpub_checkboxes ( ) ;
1083
1083
}
1084
1084
1085
- // Function to clear Xpub checkboxes
1085
+ // Resets Xpub confirmation checkboxes
1086
1086
function clear_xpub_checkboxes ( ) {
1087
1087
$ ( "#pk_confirmwrap, #matchwrap" ) . attr ( "data-checked" , "false" ) . data ( "checked" , false ) ;
1088
1088
}
1089
1089
1090
- // Function to generate Xpub derivation list
1090
+ // Generates preview of derived addresses from Xpub key
1091
1091
function xpub_derivelists ( currency , xpub ) {
1092
1092
try {
1093
1093
const coindat = getcoindata ( currency ) ,
@@ -1115,7 +1115,7 @@ function xpub_derivelists(currency, xpub) {
1115
1115
}
1116
1116
}
1117
1117
1118
- // Function to check if Xpub is valid
1118
+ // Validates Xpub format against currency-specific patterns
1119
1119
function check_xpub ( address , prefix , currency ) {
1120
1120
const prefixes = {
1121
1121
bitcoin : "zpub|xpub" ,
@@ -1126,7 +1126,7 @@ function check_xpub(address, prefix, currency) {
1126
1126
return new RegExp ( regex ) . test ( address ) ;
1127
1127
}
1128
1128
1129
- // Function to handle key management
1129
+ // Controls UI for key derivation settings and management
1130
1130
function key_management ( ) {
1131
1131
$ ( document ) . on ( "click" , ".cc_settinglist li[data-id='Key derivations'] .atext" , function ( ) {
1132
1132
const thisnode = $ ( this ) ,
@@ -1158,7 +1158,7 @@ function key_management() {
1158
1158
} )
1159
1159
}
1160
1160
1161
- // Function to handle SegWit switch
1161
+ // Manages SegWit address format switching with confirmations
1162
1162
function segwit_switch ( ) {
1163
1163
$ ( document ) . on ( "mouseup" , "#segw_box .toggle_segwit .switchpanel" , function ( ) {
1164
1164
if ( is_viewonly ( ) === true ) {
@@ -1203,12 +1203,12 @@ function segwit_switch() {
1203
1203
} )
1204
1204
}
1205
1205
1206
- // Function to trigger BIP39 settings
1206
+ // Triggers BIP39 key derivation settings UI
1207
1207
function bip39_sc ( coinsc ) {
1208
1208
$ ( "#" + coinsc + "_settings .cc_settinglist li[data-id='Key derivations'] .atext" ) . trigger ( "click" ) ;
1209
1209
}
1210
1210
1211
- // Function to display Xpub info popup
1211
+ // Displays detailed Xpub information with QR code and derived addresses
1212
1212
function xpub_info_pu ( currency , xpub ) {
1213
1213
const coindat = getcoindata ( currency ) ,
1214
1214
bip32dat = getbip32dat ( currency ) ,
@@ -1263,14 +1263,14 @@ function xpub_info_pu(currency, xpub) {
1263
1263
} , 550 ) ;
1264
1264
}
1265
1265
1266
- // Function to trigger API key addition
1266
+ // Triggers API key input dialog
1267
1267
function trigger_apikey ( ) {
1268
1268
$ ( document ) . on ( "click" , "#add_api" , function ( ) {
1269
1269
add_apikey ( $ ( this ) . attr ( "data-api" ) ) ;
1270
1270
} )
1271
1271
}
1272
1272
1273
- // Function to add API key
1273
+ // Displays form for adding new API key
1274
1274
function add_apikey ( api ) {
1275
1275
const get_key = $ ( "#apikeys" ) . data ( api ) ,
1276
1276
api_key = get_key || "" ,
@@ -1292,7 +1292,7 @@ function add_apikey(api) {
1292
1292
} , 800 ) ;
1293
1293
}
1294
1294
1295
- // Function to submit API key
1295
+ // Validates and saves entered API key
1296
1296
function submit_apikey ( ) {
1297
1297
$ ( document ) . on ( "click" , "#add_apikey input.submit" , function ( e ) {
1298
1298
e . preventDefault ( ) ;
@@ -1317,7 +1317,7 @@ function submit_apikey() {
1317
1317
} )
1318
1318
}
1319
1319
1320
- // Function to reset coin settings
1320
+ // Triggers confirmation dialog for resetting coin settings
1321
1321
function reset_coinsettings_trigger ( ) {
1322
1322
$ ( document ) . on ( "click" , ".reset_cc_settings" , function ( ) {
1323
1323
const thistrigger = $ ( this ) ,
@@ -1328,7 +1328,7 @@ function reset_coinsettings_trigger() {
1328
1328
} )
1329
1329
}
1330
1330
1331
- // Perform coin settings reset
1331
+ // Initiates coin settings reset after user confirmation
1332
1332
function reset_coinsettings ( trigger ) {
1333
1333
const currency = trigger . attr ( "data-currency" ) ,
1334
1334
result = confirm ( translate ( "resetconfirm" , {
@@ -1340,7 +1340,7 @@ function reset_coinsettings(trigger) {
1340
1340
reset_coinsettings_function ( currency ) ;
1341
1341
}
1342
1342
1343
- // Function to perform coin settings reset
1343
+ // Performs coin settings reset while preserving critical configurations
1344
1344
function reset_coinsettings_function ( currency ) {
1345
1345
const current_settings = br_get_local ( currency + "_settings" , true ) ;
1346
1346
if ( current_settings ) {
0 commit comments