
from base_class import BaseVariableFunction
from base_class import *
baseclass = BaseVariableFunction(__file__)

old_print = print
 

def timestamped_print(*args, **kwargs):
    old_print(datetime.datetime.utcnow().replace(
        microsecond=0), *args, **kwargs)

 

print = timestamped_print
print('\n'*5)
print(f"{'{:<6}'.format('ENTER')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")
 
# def makescreenurl( urlname,urlparam):
#     _url = urlname + urlparam
#     return '=HYPERLINK("{}","{}")'.format(_url, _url)


def get_solscan_url():
    global str_tokenaddress
    

    if (baseclass.analysis_token_path /str_tokenaddress/
                       f"{str_tokenaddress}_top_gmgn_sol.xlsx").exists():
        df_top_gmgn_sol = pd.read_excel(baseclass.analysis_token_path /str_tokenaddress/
                       f"{str_tokenaddress}_top_gmgn_sol.xlsx", dtype=object)
        # if "ATA_solscan_url" not in df_top_gmgn_sol.columns:
        df_top_gmgn_sol['ATA_solscan_url'] = df_top_gmgn_sol.apply(lambda ser: baseclass.makescreenurl(
                "https://solscan.io/account/" ,ser["ATA"]), axis=1)
        df_top_gmgn_sol.to_excel(baseclass.analysis_token_path /str_tokenaddress/
                        f"{str_tokenaddress}_top_gmgn_sol.xlsx",  index=False)
                
    
        
    if (baseclass.analysis_token_path /str_tokenaddress/
                       f"{str_tokenaddress}_holder_gmgn_sol.xlsx").exists():
        df_holder_gmgn_sol = pd.read_excel(baseclass.analysis_token_path /str_tokenaddress /
                       f"{str_tokenaddress}_holder_gmgn_sol.xlsx", dtype=object)
        # if "ATA_solscan_url" not in df_holder_gmgn_sol.columns:
        df_holder_gmgn_sol['ATA_solscan_url'] = df_holder_gmgn_sol.apply(lambda ser: baseclass.makescreenurl(
                "https://solscan.io/account/" ,ser["ATA"]), axis=1)
        df_holder_gmgn_sol.to_excel(baseclass.analysis_token_path /str_tokenaddress /
                        f"{str_tokenaddress}_holder_gmgn_sol.xlsx", index=False)
                

    return

str_tokenaddress = "4GULMPKBJLruChBZWksZzukAg1AjSCmCTMn9ny2Xpump"
 
get_solscan_url()
print(f"{'{:<6}'.format('END')} {baseclass.scriptfilename} ----------------NOTE-----------NOTE---------------")

