Skip to content

Commit d9a2afb

Browse files
committed
fix
1 parent 79887e0 commit d9a2afb

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

backend/utils/decodeTxs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ const decodeTxsV2 = (
203203
resolve: (message: DecodedMessage) => any,
204204
reject: (err: string) => any
205205
) => {
206-
fetch(`http://${rpc_url}/block?height=${block_height}`, { signal: AbortSignal.timeout(15 * 1000) })
206+
fetch(`${rpc_url}/block?height=${block_height}`, { signal: AbortSignal.timeout(15 * 1000) })
207207
.then((response: any) => response.json())
208208
.then(response => {
209209
const successfulTxs: string[] = [];

backend/utils/getPubkeysOfActiveValidatorsByHeight.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ async function fetchActiveValidatorsRecursive(
77
allValidators: string[] = [],
88
total?: number
99
): Promise<string[]> {
10-
11-
return fetch(`http://${base_url}/validators?height=${block_height}&page=${page}&per_page=100`)
10+
11+
return fetch(`${base_url}/validators?height=${block_height}&page=${page}&per_page=100`)
1212
.then(response => response.json())
1313
.then((response: any) => {
1414
const validators = response?.result.validators?.map((v: any) => v.pub_key.value) || [];
1515
allValidators.push(...validators);
1616

17-
if (total == undefined) total = response?.result.total ?? validators.length;
17+
if (total == undefined) total = response?.result.total ?? validators.length;
1818

1919
if (allValidators.length < (total ? total : 0)) return fetchActiveValidatorsRecursive(base_url, block_height, page + 1, allValidators, total)
2020
return allValidators;

backend/utils/getTxsByHeight.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ export interface DataInterface {
2121
const getTxsByHeight = (base_url: string, block_height: number, denom: string, bech32_prefix: string, retry_count: number, fetch_time: boolean, callback: (err: string | null, decodedTxs: any) => any) => {
2222

2323
const promises = [
24-
fetch(`http://${base_url}/block_results?height=${block_height}`, { signal: AbortSignal.timeout(15 * 1000) }).then((response: any) => response.json())
24+
fetch(`${base_url}/block_results?height=${block_height}`, { signal: AbortSignal.timeout(15 * 1000) }).then((response: any) => response.json())
2525
];
2626

2727
if (fetch_time)
2828
promises.push(
29-
fetch(`http://${base_url}/block?height=${block_height}`, { signal: AbortSignal.timeout(15 * 1000) }).then((response: any) => response.json())
29+
fetch(`${base_url}/block?height=${block_height}`, { signal: AbortSignal.timeout(15 * 1000) }).then((response: any) => response.json())
3030
);
3131

3232
Promise.allSettled(promises)
3333
.then(([block_results_promise_res, block_promise_res]) => {
34-
34+
3535
if (retry_count >= RETRY_TOTAL) return callback(`max_retry_count exceeded`, { block_height: block_height })
3636
if (
3737
(block_promise_res && block_promise_res.status == 'rejected') ||
3838
(block_promise_res && !block_promise_res.value) ||
3939
block_results_promise_res.status == 'rejected'
4040
)
4141
return getTxsByHeight(base_url, block_height, denom, bech32_prefix, retry_count + 1, fetch_time, callback);
42-
42+
4343
const data = block_promise_res ? block_promise_res.value : '';
4444
const data_block_results = block_results_promise_res.value;
4545

@@ -54,9 +54,9 @@ const getTxsByHeight = (base_url: string, block_height: number, denom: string, b
5454
time = data.result?.block?.header?.time;
5555

5656
if (
57-
!data_block_results.result ||
57+
!data_block_results.result ||
5858
(
59-
!data_block_results.result.finalize_block_events &&
59+
!data_block_results.result.finalize_block_events &&
6060
!data_block_results.result.begin_block_events &&
6161
!data_block_results.result.end_block_events
6262
)
@@ -65,17 +65,17 @@ const getTxsByHeight = (base_url: string, block_height: number, denom: string, b
6565
if (!data_block_results.result.txs_results)
6666
data_block_results.result.txs_results = [];
6767
const defaultEvents = data_block_results.result.txs_results.flatMap((eachTx: any) => eachTx.events);
68-
68+
6969
const finalizeBlockEvents = [
7070
...data_block_results.result.begin_block_events || [],
7171
...data_block_results.result.end_block_events || [],
7272
...data_block_results.result.finalize_block_events || [],
7373
...defaultEvents
7474
];
75-
75+
7676
const messages: DecodedMessage[] | null = convertEventsToMessageFormat({ height: block_height, chain_identifier: 'cosmoshub' }, finalizeBlockEvents, time, denom);
7777
const events: Event[][] = [];
78-
78+
7979
let poppedIndices = [];
8080
for (let i = 0; i < data_block_results.result.txs_results.length; i++) {
8181
const tx = data_block_results.result.txs_results[i];
@@ -85,7 +85,7 @@ const getTxsByHeight = (base_url: string, block_height: number, denom: string, b
8585
};
8686
events.push(tx.events);
8787
}
88-
88+
8989
decodeTxsV2(
9090
{
9191
rpc_url: base_url,
@@ -100,7 +100,7 @@ const getTxsByHeight = (base_url: string, block_height: number, denom: string, b
100100
if (err)
101101
return callback(err, null);
102102
if (messages && messages.length > 0) decodedTxs.push({ messages: messages });
103-
103+
104104
return callback(null, {
105105
time: time,
106106
decodedTxs: decodedTxs

0 commit comments

Comments
 (0)