PageSourceSearch

https://realmint.io/assets/prepareAuthorization-CD0gH-WB.js

js realmint.io collected 2026-10-05 07:10:22 UTC 5,559 bytes, 1 lines download raw bytes

1import{B as y,bH as _,co as v,bn as I,b0 as k,u as B,es as q,c9 as x,et as z,eu as S,ev as L,cc as E,cW as O,cK as N,cN as R,ew as j,ex as M,ey as D,cZ as P,ez as T,eA as W,cf as H,eB as U,eC as $}from"./usePrivy-DyyEMsbu-ASy2XScR.js";class G extends y{constructor(a){super(`Call bundle failed with status: ${a.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=a}}const A="0x5792579257925792579257925792579257925792579257925792579257925792",F=v(0,{size:32});async function Q(s,a){var m;const{account:d=s.account,chain:p=s.chain,experimental_fallback:w,experimental_fallbackDelay:f=32,forceAtomic:l=!1,id:u,version:g="2.0.0"}=a,h=d?S(d):null;let e=a.capabilities;s.dataSuffix&&!((m=a.capabilities)!=null&&m.dataSuffix)&&(typeof s.dataSuffix=="string"?e={...a.capabilities,dataSuffix:{value:s.dataSuffix,optional:!0}}:e={...a.capabilities,dataSuffix:{value:s.dataSuffix.value,...s.dataSuffix.required?{}:{optional:!0}}});const b=a.calls.map(c=>{const t=c,n=t.abi?_({abi:t.abi,functionName:t.functionName,args:t.args}):t.data;return{data:t.dataSuffix&&n?I([n,t.dataSuffix]):n,to:t.to,value:t.value?v(t.value):void 0}});try{const c=await s.request({method:"wallet_sendCalls",params:[{atomicRequired:l,calls:b,capabilities:e,chainId:v(p.id),from:h==null?void 0:h.address,id:u,version:g}]},{retryCount:0});return typeof c=="string"?{id:c}:c}catch(c){const t=c;if(w&&(t.name==="MethodNotFoundRpcError"||t.name==="MethodNotSupportedRpcError"||t.name==="UnknownRpcError"||t.details.toLowerCase().includes("does not exist / is not available")||t.details.toLowerCase().includes("missing or invalid. request()")||t.details.toLowerCase().includes("did not match any variant of untagged enum")||t.details.toLowerCase().includes("account upgraded to unsupported contract")||t.details.toLowerCase().includes("eip-7702 not supported")||t.details.toLowerCase().includes("unsupported wc_ method")||t.details.toLowerCase().includes("feature toggled misconfigured")||t.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))){if(e&&Object.values(e).some(r=>!r.optional)){const r="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new k(new y(r,{details:r}))}if(l&&b.length>1){const i="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new B(new y(i,{details:i}))}const n=[];for(const i of b){try{const r=await q(s,{account:h,chain:p,data:i.data,to:i.to,value:i.value?x(i.value):void 0});n.push({status:"fulfilled",value:r})}catch(r){n.push({reason:r,status:"rejected"})}f>0&&await new Promise(r=>setTimeout(r,f))}if(n.every(i=>i.status==="rejected"))throw n[0].reason;const o=n.map(i=>i.status==="fulfilled"?i.value:F);return{id:I([...o,v(p.id,{size:32}),A])}}throw z(c,{...a,account:h,chain:a.chain})}}async function K(s,a){async function d(e){if(e.endsWith(A.slice(2))){const m=O(N(e,-64,-32)),c=N(e,0,-64).slice(2).match(/.{1,64}/g),t=await Promise.all(c.map(o=>F.slice(2)!==o?s.request({method:"eth_getTransactionReceipt",params:[`0x${o}`]},{dedupe:!0}):void 0)),n=t.some(o=>o===null)?100:t.every(o=>(o==null?void 0:o.status)==="0x1")?200:t.every(o=>(o==null?void 0:o.status)==="0x0")?500:600;return{atomic:!1,chainId:E(m),receipts:t.filter(Boolean),status:n,version:"2.0.0"}}return s.request({method:"wallet_getCallsStatus",params:[e]})}const{atomic:p=!1,chainId:w,receipts:f,version:l="2.0.0",...u}=await d(a.id),[g,h]=(()=>{const e=u.status;return e>=100&&e<200?["pending",e]:e>=200&&e<300?["success",e]:e>=300&&e<700?["failure",e]:e==="CONFIRMED"?["success",200]:e==="PENDING"?["pending",100]:[void 0,e]})();return{...u,atomic:p,chainId:w?E(w):void 0,receipts:(f==null?void 0:f.map(e=>({...e,blockNumber:x(e.blockNumber),gasUsed:x(e.gasUsed),status:L[e.status]})))??[],statusCode:h,status:g,version:l}}async function V(s,a){const{id:d,pollingInterval:p=s.pollingInterval,status:w=({statusCode:n})=>n===200||n>=300,retryCount:f=4,retryDelay:l=({count:n})=>~~(1<<n)*200,timeout:u=6e4,throwOnFailure:g=!1}
1=a,h=R(["waitForCallsStatus",s.uid,d]),{promise:e,resolve:b,reject:m}=j();let c;const t=M(h,{resolve:b,reject:m},n=>{const o=D(async()=>{const i=r=>{clearTimeout(c),o(),r(),t()};try{const r=await P(async()=>{const C=await T(s,K,"getCallsStatus")({id:d});if(g&&C.status==="failure")throw new G(C);return C},{retryCount:f,delay:l});if(!w(r))return;i(()=>n.resolve(r))}catch(r){i(()=>n.reject(r))}},{interval:p,emitOnBegin:!0});return o});return c=u?setTimeout(()=>{t(),clearTimeout(c),m(new Z({id:d}))},u):void 0,await e}class Z extends y{constructor({id:a}){super(`Timed out while waiting for call bundle with id "${a}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}const X="0x6492649264926492649264926492649264926492649264926492649264926492",Y="0x0000000000000000000000000000000000000000000000000000000000000000";async function ee(s,a){var g;const{account:d=s.account,chainId:p,nonce:w}=a;if(!d)throw new W({docsPath:"/docs/eip7702/prepareAuthorization"});const f=S(d),l=(()=>{if(a.executor)return a.executor==="self"?a.executor:S(a.executor)})(),u={address:a.contractAddress??a.address,chainId:p,nonce:w};return typeof u.chainId>"u"&&(u.chainId=((g=s.chain)==null?void 0:g.id)??await T(s,U,"getChainId")({})),typeof u.nonce>"u"&&(u.nonce=await T(s,$,"getTransactionCount")({address:f.address,blockTag:"pending"}),(l==="self"||l!=null&&l.address&&H(l.address,f.address))&&(u.nonce+=1)),u}export{G as B,Z as W,X as e,K as g,ee as p,Q as s,V as w,Y as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.