"use strict";(self.webpackChunknft_rewards_marketplace=self.webpackChunknft_rewards_marketplace||[]).push([[9858],{59858:(e,a,t)=>{t.d(a,{offchainLookup:()=>g,offchainLookupSignature:()=>m});var r=t(80215),s=t(63476),n=t(80458),o=t(96781);class c extends n.G{constructor({callbackSelector:e,cause:a,data:t,extraData:r,sender:s,urls:n}){var c;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],null!==(c=a.metaMessages)&&void 0!==c&&c.length?"":[],"Offchain Gateway Call:",n&&["  Gateway URL(s):",...n.map((e=>`    ${(0,o.Gr)(e)}`))],`  Sender: ${s}`,`  Data: ${t}`,`  Callback selector: ${e}`,`  Extra data: ${r}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class l extends n.G{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${(0,o.Gr)(a)}`,`Response: ${(0,s.P)(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class d extends n.G{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}var u=t(79144),i=t(22947),f=t(72883),p=t(25543),h=t(32342);var b=t(30221),w=t(11071);const m="0x556f1830",y={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function g(e,{blockNumber:a,blockTag:t,data:n,to:o}){const{args:m}=(0,i.p)({data:n,abi:[y]}),[g,k,v,O,x]=m;try{if(!function(e,a){if(!(0,h.U)(e))throw new p.b({address:e});if(!(0,h.U)(a))throw new p.b({address:a});return e.toLowerCase()===a.toLowerCase()}(o,g))throw new d({sender:g,to:o});const n=await async function({data:e,sender:a,urls:t}){let r=new Error("An unknown error occurred.");for(let d=0;d<t.length;d++){const i=t[d],f=i.includes("{data}")?"GET":"POST",p="POST"===f?{data:e,sender:a}:void 0;try{var n;const t=await fetch(i.replace("{sender}",a).replace("{data}",e),{body:JSON.stringify(p),method:f});let c;if(c=null!==(n=t.headers.get("Content-Type"))&&void 0!==n&&n.startsWith("application/json")?(await t.json()).data:await t.text(),!t.ok){var o;r=new u.Gg({body:p,details:null!==(o=c)&&void 0!==o&&o.error?(0,s.P)(c.error):t.statusText,headers:t.headers,status:t.status,url:i});continue}if(!(0,w.v)(c)){r=new l({result:c,url:i});continue}return c}catch(c){r=new u.Gg({body:p,details:c.message,url:i})}}throw r}({data:v,sender:g,urls:k}),{data:c}=await(0,r.R)(e,{blockNumber:a,blockTag:t,data:(0,b.zo)([O,(0,f.E)([{type:"bytes"},{type:"bytes"}],[n,x])]),to:o});return c}catch(G){throw new c({callbackSelector:O,cause:G,data:n,extraData:x,sender:g,urls:k})}}}}]);
//# sourceMappingURL=9858.b1a2d965.chunk.js.map