text: let account;const initializeMina=async()=>{const e=document.getElementById("connectButton"),n=document.getElementById("getAccounts"),t=document.getElementById("getAccountsResult");e.onclick=async()=>{if(window.mina){e.innerText="Onboarding in progress";let n=await window.mina.requestAccounts().catch((e=>e));if(n.result){let t=n.result;account=t,document.getElementById("accounts").innerHTML=t,e.innerText="Connected",e.disabled=!0}else e.innerText=n.error.message}else alert("No provider was found 请先安装 auro-wallet")},n.onclick=async()=>{if(window.mina){let e=await window.mina.requestAccounts().catch((e=>e)),n=e.result;t.innerHTML=n||e.error.message}};const s=document.getElementById("sendButton"),c=document.getElementById("sendAmountInput"),o=document.getElementById("receiveAddressInput"),a=document.getElementById("sendResultDisplay");s.onclick=async()=>{let e=account&&account.length>0?account[0]:"",n=await window.mina.signTransfer({amount:c.value,from:e,to:o.value}).catch((e=>e));n.result?a.innerHTML=n.result.hash:a.innerHTML=n.error.message};const i=document.getElementById("stakingButton"),u=document.getElementById("vaildatorAddressInput"),l=document.getElementById("stakingResultDisplay");i.onclick=async()=>{let e=account&&account.length>0?account[0]:"",n=await window.mina.signStaking({from:e,to:u.value}).catch((e=>e));console.log("dapp-staking--0",n),n.result?l.innerHTML=n.result.hash:l.innerHTML=n.error.message};const r=document.getElementById("signMessageButton"),d=document.getElementById("signMessageContent"),m=document.getElementById("signMessageResult"),g=document.getElementById("signVerifyButton"),w=document.getElementById("verifyResult");let y;function B(n){console.log("handleNewAccounts==0",n),Array.isArray(n)&&(document.getElementById("accounts").innerHTML=n,0===n.length&&(e.innerText="Connect",e.disabled=!1))}r.onclick=async()=>{let e=account&&account.length>0?account[0]:"";y=await window.mina.signMessage({from:e,message:d.value}).catch((e=>e)),y.result?m.innerHTML=y.result.signature:m.innerHTML=y.error.message},g.onclick=async()=>{let e=await window.mina.verifyMessage({message:y.result?.signature}).catch((e=>e));e.result?w.innerHTML=e.result:w.innerHTML=e.error.message},setTimeout((()=>{window.mina&&window.mina.onAccountChange(B)}),200)};window.addEventListener("DOMContentLoaded",initializeMina);