@@ -182,9 +182,9 @@ function process_transaction_data(rd, dl) {
182
182
br_set_session ( "monitor_timer" , now ( ) ) ;
183
183
}
184
184
const api_info = check_api ( rd . payment ) ,
185
- api_data = api_info . data ;
186
- rdo . thislist . removeClass ( "pmstatloaded" ) ;
187
- update_transaction_count ( rdo . statuspanel , "reset ") ;
185
+ api_data = api_info . data ,
186
+ current_list = rdo . thislist
187
+ current_list . addClass ( "loading" ) . removeClass ( "pmstatloaded ") ;
188
188
route_network_request ( rd , api_data , rdo ) ;
189
189
return
190
190
}
@@ -206,7 +206,7 @@ function finalize_request_state(rdo) {
206
206
// src === "requests"
207
207
const current_list = rdo . thislist ;
208
208
if ( current_list && current_list . hasClass ( "scan" ) ) {
209
- current_list . removeClass ( "scan open" ) . addClass ( "pmstatloaded" ) ;
209
+ current_list . removeClass ( "scan open loading " ) . addClass ( "pmstatloaded" ) ;
210
210
const request_id = rdo . requestid ,
211
211
transaction_list = rdo . transactionlist ,
212
212
transaction_items = transaction_list . children ( "li" ) ;
@@ -348,15 +348,12 @@ function route_blockchain_rpc(rd, api_data, rdo) {
348
348
}
349
349
350
350
// Processes transaction scan results and handles Ethereum L2, confirmations, and UI updates based on match type
351
- function process_scan_results ( rd , api_data , rdo , counter , tx_details , l2 ) {
351
+ function process_scan_results ( rd , api_data , rdo , tx_details , l2 ) {
352
352
glob_let . apikey_fails = false ;
353
353
const src = rdo . source ,
354
354
pending = rdo . pending
355
355
tx_hash = tx_details . txhash || rd . txhash ;
356
356
if ( src === "requests" ) {
357
- if ( counter ) {
358
- update_transaction_count ( rdo . statuspanel , counter ) ;
359
- }
360
357
const current_list = rdo . thislist ;
361
358
if ( current_list ) {
362
359
current_list . removeClass ( "no_network" ) ;
@@ -722,7 +719,7 @@ function create_transaction_item(tx_details, request_type) {
722
719
unconfirmed_text = tl ( "unconfirmedtx" ) ,
723
720
checked_span = "<span class='icon-checkmark' title='" + confirmation_title + "'></span>" ,
724
721
confirmation_span = is_confirmed ? checked_span : confirmations ? "<div class='txli_conf' title='" + confirmation_title + "'><div class='confbar'></div><span>" + confirmation_title + "</span></div>" :
725
- "<div class='txli_conf' title='" + unconfirmed_text + "'><div class='confbar'></div><span>" + unconfirmed_text + "</span></div>" ,
722
+ "<div class='txli_conf unconfirmed ' title='" + unconfirmed_text + "'><div class='confbar'></div><span>" + unconfirmed_text + "</span></div>" ,
726
723
tx_list_item = $ ( "<li><div class='txli_content'>" + formatted_date + confirmation_span + "<div class='txli_conf txl_canceled'><span class='icon-blocked'></span>" + tl ( "canceled" ) + "</div><span class='tx_val'> + " + value_string + " <span class='icon-eye show_tx' title='view on blockexplorer'></span></span></div></li>" ) ;
727
724
if ( glob_let . tx_list . includes ( tx_hash ) ) { // check for indexed transaction id's
728
725
return request_type === "outgoing" ? null : tx_list_item ;
@@ -787,11 +784,12 @@ function validate_payment_amounts(rd, rdo) {
787
784
no_conf = rd . no_conf || first_confirmations === false ,
788
785
conf = no_conf ? 0 : first_confirmations ,
789
786
latest_transaction_time = first_transaction . data ( "transactiontime" ) ,
790
- time_offset = Math . abs ( now ( ) - ( first_transaction_time - glob_const . timezone ) ) ,
791
- single_transaction = transaction_count === 1 ,
792
- is_recent = time_offset < 300000 && single_transaction ,
787
+ timezone = glob_const . timezone ,
788
+ first_time_offset = parseInt ( now ( ) - ( first_transaction_time - timezone ) ) ,
789
+ last_time_offset = parseInt ( now ( ) - ( latest_transaction_time - timezone ) ) ,
790
+ is_recent = ( first_time_offset < 300000 && last_time_offset < 300000 ) ,
793
791
crypto_amount = parseFloat ( rd . cc_amount ) ,
794
- amount_margin = 0.95 ;
792
+ amount_margin = 0.97 ;
795
793
let recent_data = false ,
796
794
transaction_counter = 0 ,
797
795
crypto_status = "pending" ,
@@ -813,16 +811,19 @@ function validate_payment_amounts(rd, rdo) {
813
811
crypto_payment_timestamp = transaction_data . transactiontime ,
814
812
crypto_transaction_hash = transaction_data . txhash ,
815
813
total_crypto_amount += parseFloat ( transaction_data . ccval ) || 0 ; // sum of outputs
816
- if ( crypto_confirmations >= correction_confirmations || no_conf || transaction_data . setconfirmations === false ) { // check all confirmations + whitelist for currencies unable to fetch confirmations
817
- is_crypto_confirmed = true ;
818
- if ( total_crypto_amount >= crypto_amount * amount_margin ) { // compensation for small fluctuations in rounding amount
819
- current_transaction . addClass ( "exceed" ) . nextAll ( ) . addClass ( "exceed" ) ;
820
- return false ;
814
+ if ( total_crypto_amount >= crypto_amount * amount_margin ) { // compensation for small fluctuations in rounding amount
815
+ current_transaction . prevAll ( ) . remove ( ) ;
816
+ if ( crypto_confirmations >= correction_confirmations || no_conf || transaction_data . setconfirmations === false ) { // check all confirmations + whitelist for currencies unable to fetch confirmations
817
+ is_crypto_confirmed = true ;
818
+ } else {
819
+ is_crypto_confirmed = false ;
821
820
}
822
- } else {
823
- is_crypto_confirmed = false ;
821
+ return false ;
824
822
}
825
823
} ) ;
824
+ if ( transaction_counter ) {
825
+ update_transaction_count ( rdo . statuspanel , transaction_counter ) ;
826
+ }
826
827
const conf_bar = transaction_items . find ( ".confbar" ) ;
827
828
if ( conf_bar . length ) {
828
829
conf_bar . each ( function ( i ) {
@@ -832,7 +833,7 @@ function validate_payment_amounts(rd, rdo) {
832
833
if ( total_crypto_amount >= crypto_amount * amount_margin ) { // compensation for small fluctuations in rounding amount
833
834
if ( is_crypto_confirmed === false ) { // check confirmations outside the loop
834
835
crypto_status = "pending" ,
835
- crypto_pending = single_transaction && crypto_transaction_hash ? "polling" : pending_status ; // switch to tx polling if there's only one transaction and txhash is known
836
+ crypto_pending = transaction_count === 1 && crypto_transaction_hash ? "polling" : pending_status ; // switch to tx polling if there's only one transaction and txhash is known
836
837
} else {
837
838
crypto_status = "paid" ,
838
839
crypto_pending = "no" ;
@@ -851,7 +852,7 @@ function validate_payment_amounts(rd, rdo) {
851
852
local_exchange_rate = fiat_exchange_rates ? fiat_exchange_rates [ rd . fiatcurrency ] : null ,
852
853
usd_eur_exchange_rate = fiat_exchange_rates ? fiat_exchange_rates . usd : null ;
853
854
if ( local_exchange_rate && usd_eur_exchange_rate ) {
854
- const usd_rate = crypto_exchange_rates ? crypto_exchange_rates . ccrate : null ;
855
+ const usd_rate = crypto_exchange_rates . ccrate || null ;
855
856
if ( usd_rate ) {
856
857
const usd_value = total_crypto_amount * usd_rate ,
857
858
eur_value = usd_value / usd_eur_exchange_rate ;
@@ -892,11 +893,9 @@ function update_transaction_count(status_panel, count) {
892
893
status_panel . attr ( "data-count" , 0 ) . text ( "+ " + 0 ) ;
893
894
return
894
895
}
895
- const current_count = parseInt ( status_panel . attr ( "data-count" ) ) ,
896
- new_count = current_count + count ;
897
- if ( ! new_count ) return
898
- status_panel . attr ( "data-count" , new_count ) . text ( "+ " + new_count ) ;
899
- if ( new_count > 1 ) {
896
+ if ( ! count ) return
897
+ status_panel . attr ( "data-count" , count ) . text ( "+ " + count ) ;
898
+ if ( count > 1 ) {
900
899
status_panel . closest ( ".rqli" ) . find ( ".metalist .show_tx" ) . hide ( ) ;
901
900
}
902
901
}
@@ -935,7 +934,8 @@ function fetch_fiat_rates(rd, rdo, api_list, fiat_api) {
935
934
const fiat_currency = rd . fiatcurrency ;
936
935
if ( fiat_currency ) {
937
936
const currency_symbol = fiat_currency . toUpperCase ( ) ,
938
- payload = get_historic_fiatprice_api_payload ( fiat_api , currency_symbol , rd . latestinput ) ;
937
+ payload = get_historic_fiatprice_api_payload ( fiat_api , currency_symbol , rd . latestinput ) ,
938
+ current_list = rdo . thislist ;
939
939
api_proxy ( {
940
940
"api" : fiat_api ,
941
941
"search" : payload ,
@@ -1076,16 +1076,14 @@ function fetch_crypto_rates(rd, rdo, fiat_api, api_list, api, currency_rate, usd
1076
1076
api_result ;
1077
1077
if ( data && ! data . error ) {
1078
1078
const request_list = rdo . thislist ,
1079
- tx_list = request_list . find ( ".transactionlist li" ) ,
1080
- tx_list_length = tx_list . length ,
1081
- tx_reverse = tx_list_length > 1 ? tx_list . get ( ) . reverse ( ) : tx_list ,
1079
+ transaction_items = request_list . find ( ".transactionlist li" ) ,
1080
+ transaction_reverse = transaction_items . length > 1 ? transaction_items . get ( ) . reverse ( ) : transaction_items ,
1082
1081
latest_confirm = rd . latestconf ,
1083
1082
total_amount = rd . amount ,
1084
- set_confirmations = rd . set_confirmations || 1 ; // Default to 1
1085
- is_erc20 = rd . erc20 ,
1083
+ set_confirmations = rd . set_confirmations || 1 , // Default to 1
1086
1084
historic_usd_value = ( total_amount / currency_rate ) * usd_rate ,
1087
- margin = historic_usd_value < 2 ? 0.60 : 0.95 ; // be flexible with small amounts
1088
- let tx_counter = 0 ,
1085
+ margin = historic_usd_value < 2 ? 0.60 : 0.97 ; // be flexible with small amounts
1086
+ let transaction_counter = 0 ,
1089
1087
confirmations = 0 ,
1090
1088
paymenttimestamp ,
1091
1089
txhash ,
@@ -1094,12 +1092,13 @@ function fetch_crypto_rates(rd, rdo, fiat_api, api_list, api, currency_rate, usd
1094
1092
confirmed = false ,
1095
1093
status = "pending" ,
1096
1094
pending = rd . pending ;
1097
- $ ( tx_reverse ) . each ( function ( i ) {
1098
- tx_counter ++ ;
1099
- const current_node = $ ( this ) ,
1100
- node_data = current_node . data ( ) ,
1101
- transaction_timestamp = node_data . transactiontime ,
1102
- transaction_value = node_data . ccval ,
1095
+ $ ( transaction_reverse ) . each ( function ( i ) {
1096
+ transaction_counter ++ ;
1097
+ const current_transaction = $ ( this ) ,
1098
+ transaction_data = current_transaction . data ( ) ,
1099
+ correction_confirmations = transaction_data . instant_lock ? 0 : set_confirmations ; // correction if dash instant_lock
1100
+ transaction_timestamp = transaction_data . transactiontime ,
1101
+ transaction_value = transaction_data . ccval ,
1103
1102
values = {
1104
1103
"fiatapisrc" : fiat_api ,
1105
1104
"apisrc" : api ,
@@ -1110,24 +1109,27 @@ function fetch_crypto_rates(rd, rdo, fiat_api, api_list, api, currency_rate, usd
1110
1109
} ,
1111
1110
historic_object = match_price_timestamps ( api , values , data , transaction_timestamp ) ,
1112
1111
historic_price = historic_object . price ,
1113
- conf_correct = node_data . instant_lock ? 0 : set_confirmations ; // correction if dash instant_lock
1114
- current_node . data ( "historic" , historic_object ) ;
1115
- confirmations = node_data . confirmations , // check confirmations
1112
+ conf_correct = transaction_data . instant_lock ? 0 : set_confirmations ; // correction if dash instant_lock
1113
+ current_transaction . data ( "historic" , historic_object ) ;
1114
+ confirmations = transaction_data . confirmations , // check confirmations
1116
1115
paymenttimestamp = transaction_timestamp ,
1117
- txhash = node_data . txhash ,
1116
+ txhash = transaction_data . txhash ,
1118
1117
receivedamount += parseFloat ( transaction_value ) || 0 ; // sum of outputs CC
1119
- if ( ( historic_price && confirmations >= conf_correct ) || rd . no_conf === true || node_data . setconfirmations === false ) { // check all confirmations + whitelist for currencies unable to fetch confirmations
1120
- confirmed = true ;
1121
- } else {
1122
- confirmed = false ;
1123
- }
1124
1118
let current_usd_sum = received_usd += parseFloat ( historic_price * transaction_value ) || 0 ;
1125
1119
if ( current_usd_sum >= historic_usd_value * margin ) { //minus 5% dollar for volatility compensation
1126
- current_node . addClass ( "exceed" ) . nextAll ( ) . addClass ( "exceed" ) ;
1120
+ current_transaction . prevAll ( ) . remove ( ) ;
1121
+ if ( ( historic_price && confirmations >= conf_correct ) || rd . no_conf === true || transaction_data . setconfirmations === false ) { // check all confirmations + whitelist for currencies unable to fetch confirmations
1122
+ confirmed = true ;
1123
+ } else {
1124
+ confirmed = false ;
1125
+ }
1127
1126
return false ;
1128
1127
}
1129
1128
} ) ;
1130
- const conf_bar = tx_list . find ( ".confbar" ) ;
1129
+ if ( transaction_counter ) {
1130
+ update_transaction_count ( rdo . statuspanel , transaction_counter ) ;
1131
+ }
1132
+ const conf_bar = transaction_items . find ( ".confbar" ) ;
1131
1133
if ( conf_bar . length ) {
1132
1134
conf_bar . each ( function ( i ) {
1133
1135
animate_confbar ( $ ( this ) , i ) ;
@@ -1137,7 +1139,7 @@ function fetch_crypto_rates(rd, rdo, fiat_api, api_list, api, currency_rate, usd
1137
1139
if ( received_usd >= historic_usd_value * margin ) { // check total incoming amount // minus 5% dollar for volatility compensation
1138
1140
if ( confirmed === false ) { // check confirmations outside the loop
1139
1141
status = "pending" ,
1140
- pending = tx_counter === 1 && txhash ? "polling" : pending ; // switch to tx polling if there's only one transaction and txhash is known
1142
+ pending = transaction_counter === 1 && txhash ? "polling" : pending ; // switch to tx polling if there's only one transaction and txhash is known
1141
1143
} else {
1142
1144
status = "paid" ,
1143
1145
pending = "no" ;
0 commit comments