1- import { blast_CNTPAbi , ClaimableConetPointAbi } from "./../utils/abis" ;
1+ import { blast_CNTPAbi } from "./../utils/abis" ;
22import { ethers } from "ethers" ;
33import {
44 conetDepinProvider ,
55 conetProvider ,
66 ethProvider ,
77} from "../utils/constants" ;
8- import { CoNET_Data , setCoNET_Data } from "../utils/globals" ;
8+ import {
9+ CoNET_Data ,
10+ processingBlock ,
11+ setCoNET_Data ,
12+ setProcessingBlock ,
13+ } from "../utils/globals" ;
914import contracts from "../utils/contracts" ;
1015import { initProfileTokens } from "../utils/utils" ;
11- import { getFreePassportInfo , getVpnTimeUsed } from "./wallets" ;
16+ import { getVpnTimeUsed } from "./wallets" ;
1217
1318let epoch = 0 ;
1419
@@ -19,19 +24,27 @@ const listenProfileVer = async (callback: (profiles: profile[]) => void) => {
1924 if ( block === epoch + 1 ) {
2025 epoch ++ ;
2126
22- const profiles = CoNET_Data ?. profiles ;
23- if ( ! profiles ) {
24- return ;
25- }
26- const runningList : any [ ] = [ ] ;
27+ if ( processingBlock === true ) return ;
28+
29+ if ( block % 10 === 0 ) {
30+ setProcessingBlock ( true ) ;
2731
28- runningList . push ( getProfileAssets ( profiles [ 0 ] ) ) ;
32+ const profiles = CoNET_Data ?. profiles ;
33+ if ( ! profiles ) {
34+ return ;
35+ }
36+ const runningList : any [ ] = [ ] ;
2937
30- await Promise . all ( runningList ) ;
38+ runningList . push ( getProfileAssets ( profiles [ 0 ] ) ) ;
3139
32- await getVpnTimeUsed ( ) ;
40+ await Promise . all ( runningList ) ;
3341
34- if ( CoNET_Data ?. profiles [ 0 ] ) callback ( CoNET_Data ?. profiles ) ;
42+ await getVpnTimeUsed ( ) ;
43+
44+ if ( CoNET_Data ?. profiles [ 0 ] ) callback ( CoNET_Data ?. profiles ) ;
45+
46+ setProcessingBlock ( false ) ;
47+ }
3548 }
3649 } ) ;
3750
0 commit comments