@@ -3564,11 +3564,53 @@ const getPassportsInfoForAllProfiles = async () => {
35643564 }
35653565
35663566 for ( const profile of profiles ) {
3567- const result = await getPassportsInfoForProfile ( profile ) ;
3568- profile . silentPassPassports = result
3567+ const passports = await getPassportsInfoForProfile ( profile ) ;
3568+ const currentPassport = await getCurrentPassportInfo ( profile ) ;
3569+
3570+ profile . silentPassPassports = passports ;
3571+ profile . activePassport = {
3572+ nftID : currentPassport ?. nftIDs ?. toString ( ) ,
3573+ expires : currentPassport ?. expires ?. toString ( ) ,
3574+ expiresDays : currentPassport ?. expiresDays ?. toString ( ) ,
3575+ premium : currentPassport ?. premium ,
3576+ }
35693577 }
35703578} ;
35713579
3580+ const getCurrentPassportInfoInMainnet = async ( profile : profile ) => {
3581+ if ( ! profile ) {
3582+ return ;
3583+ }
3584+
3585+ const wallet = new ethers . Wallet (
3586+ profile . privateKeyArmor ,
3587+ conetDepinProvider
3588+ ) ;
3589+
3590+ const passportContract = new ethers . Contract (
3591+ passportContractAddress_mainnet ,
3592+ passportAbi_mainnet ,
3593+ wallet
3594+ ) ;
3595+
3596+ try {
3597+ const result = await passportContract . getCurrentPassport ( wallet . address ) ;
3598+ return result ;
3599+ } catch ( ex ) {
3600+ console . log ( ex ) ;
3601+ }
3602+ } ;
3603+
3604+ const getCurrentPassportInfo = async ( profile : profile ) => {
3605+ if ( ! CoNET_Data ) {
3606+ return ;
3607+ }
3608+
3609+ const resultMainnet = await getCurrentPassportInfoInMainnet ( profile ) ;
3610+
3611+ return resultMainnet ;
3612+ } ;
3613+
35723614const getPassportsInfoForProfile = async ( profile : profile ) : Promise < passportInfo [ ] > => {
35733615 const tmpCancunPassports = await getPassportsInfo ( profile , 'cancun' ) ;
35743616 const tmpMainnetPassports = await getPassportsInfo ( profile , 'mainnet' ) ;
0 commit comments