Skip to content

Commit 1ed2c6e

Browse files
committed
tx monitoring
1 parent 49dd8f7 commit 1ed2c6e

10 files changed

+235
-183
lines changed

assets_js_bitrequest_config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,14 +1033,14 @@ const glob_config = {
10331033
"icon": "sphere",
10341034
"selected": {
10351035
"name": "bitrequest.app",
1036-
"url": glob_const.main_nano_node,
1036+
"url": "https://www.bitrequest.app:8020",
10371037
"username": "",
10381038
"password": "",
10391039
"display": true
10401040
},
10411041
"apis": [{
10421042
"name": "bitrequest.app",
1043-
"url": glob_const.main_nano_node,
1043+
"url": "https://www.bitrequest.app:8020",
10441044
"username": "",
10451045
"password": "",
10461046
"display": true

assets_js_bitrequest_core.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,21 +1863,6 @@ function continue_cpd() {
18631863
function after_scan_init(api_data) {
18641864
if (is_scanning()) return;
18651865
glob_let.rpc_attempts = {};
1866-
forceclosesocket();
1867-
after_scan(api_data);
1868-
}
1869-
1870-
// Scan address one last time
1871-
function after_scan(api_data) {
1872-
if (glob_const.inframe) {
1873-
loader(true);
1874-
loadertext(translate("lookuppayment", {
1875-
"currency": request.payment,
1876-
"blockexplorer": api_data.name
1877-
}));
1878-
} else {
1879-
hide_paymentdialog();
1880-
}
18811866
const rq_init = request.rq_init,
18821867
request_ts = rq_init + glob_const.timezone,
18831868
set_confirmations = request.set_confirmations || 0,
@@ -1889,7 +1874,21 @@ function after_scan(api_data) {
18891874
"cachetime": 20,
18901875
"source": "after_scan"
18911876
};
1892-
select_rpc(request, api_data, rdo);
1877+
after_scan(request, api_data, rdo);
1878+
}
1879+
1880+
// Scan address one last time
1881+
function after_scan(rd, api_data, rdo) {
1882+
if (glob_const.inframe) {
1883+
loader(true);
1884+
loadertext(translate("lookuppayment", {
1885+
"currency": rd.payment,
1886+
"blockexplorer": api_data.name
1887+
}));
1888+
} else {
1889+
hide_paymentdialog();
1890+
}
1891+
continue_select(rd, api_data, rdo);
18931892
socket_info(api_data, true);
18941893
}
18951894

@@ -2749,8 +2748,8 @@ function reset_paymentdialog() {
27492748
request = null,
27502749
helper = null,
27512750
glob_let.l2s = {},
2752-
glob_let.socket_overflow = 0,
2753-
glob_let.polling_overflow = 0;
2751+
glob_let.apikey_fails = false;
2752+
reset_overflow(); // reset overflow limits
27542753
const wstimeout = setTimeout(function() {
27552754
closesocket();
27562755
}, 500, function() {
@@ -3069,7 +3068,7 @@ function showtransaction_trigger() {
30693068
rqli = thisnode.closest("li.rqli"),
30703069
li_dat = thislist.data(),
30713070
rql_dat = rqli.data(),
3072-
txhash = rqli.txhash || rql_dat.txhash;
3071+
txhash = li_dat.txhash || rql_dat.txhash;
30733072
if (txhash) {
30743073
const lnhash = txhash.startsWith("lightning");
30753074
if (lnhash) {

assets_js_bitrequest_ethl2.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ function query_ethl2_api(rd, rdo, api_dat, l2) {
141141

142142
function scan_ethl2_api(rd, rdo, api_dat, l2) {
143143
glob_let.l2_fetched = {};
144-
const requestid = rd.requestid,
145-
req_l2_arr = rd.eth_l2s;
144+
const req_l2_arr = rd.eth_l2s;
146145
if (empty_obj(req_l2_arr)) { // No l2's
147146
api_callback(rdo);
148147
return
@@ -153,21 +152,20 @@ function scan_ethl2_api(rd, rdo, api_dat, l2) {
153152
if (l2) { // l2 network is known so only scan this network
154153
const api_data = api_dat || q_obj(l2_options, l2 + ".apis.selected")
155154
if (api_data) {
156-
const rq_id = requestid || "",
157-
contract = ctracts[l2],
155+
const contract = ctracts[l2],
158156
dat = {
159157
contract,
160158
rd,
161159
api_data,
162160
rdo
163161
};
164-
glob_let.rpc_attempts[sha_sub(rq_id + api_data.url + l2, 15)] = true;
165162
ethl2_networks(dat, l2);
166163
}
167164
return
168165
}
169166
// scan all supported l2 networks
170-
const l2_length = Object.keys(l2_options).length,
167+
const requestid = rd.requestid,
168+
l2_length = Object.keys(l2_options).length,
171169
add_delay = 2000;
172170
let index = 0,
173171
delay = 0;
@@ -179,15 +177,13 @@ function scan_ethl2_api(rd, rdo, api_dat, l2) {
179177
if (inarr) {
180178
const api_data = api_dat || q_obj(l2_dat, "apis.selected");
181179
if (api_data) {
182-
const rq_id = requestid || "",
183-
contract = ctracts[l2],
180+
const contract = ctracts[l2],
184181
dat = {
185182
contract,
186183
rd,
187184
api_data,
188185
rdo
189186
};
190-
glob_let.rpc_attempts[sha_sub(rq_id + api_data.url + l2, 15)] = true;
191187
ethl2_networks(dat, l2);
192188
}
193189
}
@@ -214,14 +210,11 @@ function scan_ethl2_api(rd, rdo, api_dat, l2) {
214210
}
215211

216212
function poll_ethl2_api(rd, rdo, api_dat, l2) {
217-
const requestid = rd.requestid,
218-
rq_id = requestid || "",
219-
l2_options = fertch_l2s(rd.payment),
213+
const l2_options = fertch_l2s(rd.payment),
220214
api_data = api_dat || q_obj(l2_options, l2 + ".apis.selected"),
221215
api_name = api_data.name,
222216
network = api_data.network;
223217
if (api_name && network) {
224-
glob_let.rpc_attempts[sha_sub(rq_id + api_data.url + l2, 15)] = true;
225218
const ccsymbol = rd.currencysymbol,
226219
ctracts = contracts(ccsymbol),
227220
contract = ctracts[network],
@@ -238,14 +231,23 @@ function poll_ethl2_api(rd, rdo, api_dat, l2) {
238231
// ** L2 Networks **
239232

240233
function ethl2_networks(dat, network) {
241-
const l2 = network || q_obj(dat, "api_data.network");
242-
if (l2 === "arbitrum") {
243-
arbitrum_apis(dat);
244-
} else if (l2 === "polygon") {
245-
polygon_apis(dat);
246-
} else if (l2 === "bnb") {
247-
bnb_apis(dat);
234+
if (dat) {
235+
const url = q_obj(dat, "api_data.url");
236+
if (url) {
237+
const rq_id = q_obj(dat, "rd.requestid") || "",
238+
l2 = network || q_obj(dat, "api_data.network");
239+
glob_let.rpc_attempts[sha_sub(rq_id + url + l2, 15)] = true;
240+
if (l2 === "arbitrum") {
241+
arbitrum_apis(dat);
242+
} else if (l2 === "polygon") {
243+
polygon_apis(dat);
244+
} else if (l2 === "bnb") {
245+
bnb_apis(dat);
246+
}
247+
return
248+
}
248249
}
250+
console.error("error", "missing api data");
249251
}
250252

251253
// Handles Arbitrum APIS

0 commit comments

Comments
 (0)