import{L as b,l as h,m as p,o as g,q as m,w as f}from"./thirdweb-Co3M1EyP.js";const u=new b(1e3);async function H(i){const{account:n,calls:l}=i,o=l.map(a=>({...a,chain:i.chain})),t=[],c=g(65);if(u.set(c,t),n.sendBatchTransaction){const a=await m({account:n,transactions:o});t.push(a.transactionHash),u.set(c,t)}else for(const a of o){const r=await f({account:n,transaction:a});t.push(r.transactionHash),u.set(c,t)}return c}async function k(i){const{chain:n,client:l,id:o}=i,t=u.get(o);if(!t)throw new Error("Failed to get calls status, unknown bundle id");const c=h({chain:n,client:l});let a="success";const r=await Promise.all(t.map(d=>p(c,{hash:d}).then(s=>({blockHash:s.blockHash,blockNumber:s.blockNumber,gasUsed:s.gasUsed,logs:s.logs.map(e=>({address:e.address,data:e.data,topics:e.topics})),status:s.status,transactionHash:s.transactionHash})).catch(()=>(a="pending",null))));return{atomic:!1,chainId:n.id,id:o,receipts:r.filter(d=>d!==null),status:a,statusCode:200,version:"2.0.0"}}async function x(i){const{chain:n,client:l,id:o}=i,t=u.get(o);if(!t)throw new Error("Failed to get calls status, unknown bundle id");const c=h({chain:n,client:l});let a=200;const r=[];for(const d of t)try{const s=await p(c,{hash:d});r.push({blockHash:s.blockHash,blockNumber:`0x${s.blockNumber.toString(16)}`,gasUsed:`0x${s.gasUsed.toString(16)}`,logs:s.logs.map(e=>({address:e.address,data:e.data,topics:e.topics})),status:s.status==="success"?"0x1":"0x0",transactionHash:s.transactionHash})}catch{a=100}return{atomic:!1,chainId:`0x${n.id.toString(16)}`,id:o,receipts:r,status:a,version:"2.0.0"}}export{k as inAppWalletGetCallsStatus,x as inAppWalletGetCallsStatusRaw,H as inAppWalletSendCalls};
