@@ -14,6 +14,7 @@ import {
1414} from "../utils/globals" ;
1515import contracts from "../utils/contracts" ;
1616import { initProfileTokens } from "../utils/utils" ;
17+ import { checkCurrentRate } from '../services/passportPurchase'
1718import {
1819 getPassportsInfoForProfile ,
1920 getVpnTimeUsed ,
@@ -28,6 +29,7 @@ const listenProfileVer = async (
2829 _setProfiles : ( profiles : profile [ ] ) => void ,
2930 _setActivePassport : ( profiles : freePassport ) => void ,
3031 _updateCurrentPassport : ( ) => Promise < void > ,
32+ setMiningData : ( response : nodeResponse ) => void
3133) => {
3234 epoch = await conetProvider . getBlockNumber ( ) ;
3335
@@ -49,7 +51,8 @@ const listenProfileVer = async (
4951 runningList . push ( getProfileAssets ( profiles [ 0 ] , profiles [ 1 ] ) ) ;
5052
5153 await Promise . all ( runningList ) ;
52-
54+ // get rate update
55+ checkCurrentRate ( setMiningData ) ;
5356 await getVpnTimeUsed ( ) ;
5457
5558 await getPassportsInfoForProfile ( profiles [ 0 ] ) ;
@@ -84,15 +87,13 @@ const getProfileAssets = async (profile: profile, solanaProfile: profile) => {
8487 profile . tokens = initProfileTokens ( ) ;
8588 }
8689
87- const [ cCNTP , conet , conetDepin , conet_eth , eth , sol , sp ] =
90+ const [ cCNTP , conet , conetDepin , conet_eth , eth ] =
8891 await Promise . all ( [
8992 scanCCNTP ( key ) ,
9093 scanCONETHolesky ( key ) ,
9194 scanCONETDepin ( key ) ,
9295 scanConetETH ( key ) ,
93- scanETH ( key ) ,
94- scanSolanaSol ( solanaKey ) ,
95- scanSolanaSp ( solanaKey ) ,
96+ scanETH ( key )
9697 ] ) ;
9798
9899 if ( profile . tokens ?. cCNTP ) {
@@ -177,34 +178,6 @@ const getProfileAssets = async (profile: profile, solanaProfile: profile) => {
177178 } ;
178179 }
179180
180- if ( solanaProfile . tokens ?. sol ) {
181- solanaProfile . tokens . sol . balance =
182- sol === false ? solanaProfile . tokens . sol . balance : sol ?. toFixed ( 6 ) ;
183- } else {
184- solanaProfile . tokens . sol = {
185- balance : sol === false ? "" : sol ?. toFixed ( 6 ) ,
186- network : "Solana Mainnet" ,
187- decimal : 18 ,
188- contract : "" ,
189- name : "sol" ,
190- } ;
191- }
192-
193- if ( solanaProfile . tokens ?. sp ) {
194- solanaProfile . tokens . sp . balance =
195- sp === false
196- ? solanaProfile . tokens . sp . balance
197- : parseFloat ( sp ) . toFixed ( 6 ) ;
198- } else {
199- solanaProfile . tokens . sp = {
200- balance : sp === false ? "" : parseFloat ( sp ) . toFixed ( 6 ) ,
201- network : "Solana Mainnet" ,
202- decimal : 18 ,
203- contract : "" ,
204- name : "sp" ,
205- } ;
206- }
207-
208181 const temp = CoNET_Data ;
209182
210183 if ( ! temp ) {
@@ -250,7 +223,7 @@ const scanETH = async (walletAddr: string) => {
250223 return await scan_natural_balance ( walletAddr , ethProvider ) ;
251224} ;
252225
253- const scanSolanaSol = async ( walletAddr : string ) => {
226+ const scanSolanaSol = async ( walletAddr : string , randomSolanaRPC : string ) => {
254227 try {
255228 // Validate wallet address format
256229 if ( ! PublicKey . isOnCurve ( walletAddr ) ) {
@@ -264,7 +237,7 @@ const scanSolanaSol = async (walletAddr: string) => {
264237 params : [ walletAddr ] ,
265238 } ;
266239
267- const response = await fetch ( solanaRpc , {
240+ const response = await fetch ( randomSolanaRPC , {
268241 method : "POST" ,
269242 headers : {
270243 "Content-Type" : "application/json" ,
@@ -288,8 +261,8 @@ const scanSolanaSol = async (walletAddr: string) => {
288261 }
289262} ;
290263
291- const scanSolanaSp = async ( walletAddr : string ) => {
292- return await scan_spl_balance ( walletAddr , contracts . PassportSolana . address ) ;
264+ const scanSolanaSp = async ( walletAddr : string , solanaRPC_url : string ) => {
265+ return await scan_spl_balance ( walletAddr , contracts . PassportSolana . address , solanaRPC_url ) ;
293266} ;
294267
295268const scan_erc20_balance : (
@@ -324,7 +297,7 @@ const scan_natural_balance = async (walletAddr: string, provider: any) => {
324297 }
325298} ;
326299
327- const scan_spl_balance = async ( walletAddr : string , tokenAddress : string ) => {
300+ const scan_spl_balance = async ( walletAddr : string , tokenAddress : string , solanaRPC_url : string ) => {
328301 try {
329302 const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" ; // Solana SPL Token Program ID
330303
@@ -339,7 +312,7 @@ const scan_spl_balance = async (walletAddr: string, tokenAddress: string) => {
339312 ] ,
340313 } ;
341314
342- const response = await fetch ( solanaRpc , {
315+ const response = await fetch ( solanaRPC_url , {
343316 method : "POST" ,
344317 headers : {
345318 "Content-Type" : "application/json" ,
0 commit comments