-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path778.index.bundle.js
More file actions
2 lines (2 loc) · 2.67 KB
/
778.index.bundle.js
File metadata and controls
2 lines (2 loc) · 2.67 KB
1
2
"use strict";(self.webpackChunkinterface=self.webpackChunkinterface||[]).push([["778"],{4480:function(e,a,t){t.d(a,{offchainLookup:()=>g,offchainLookupSignature:()=>m});var s=t("7119"),r=t("9740"),n=t("765"),o=t("3961");class c extends n.G{constructor({callbackSelector:e,cause:a,data:t,extraData:s,sender:r,urls:n}){super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],a.metaMessages?.length?"":[],"Offchain Gateway Call:",n&&[" Gateway URL(s):",...n.map(e=>` ${(0,o.G)(e)}`)],` Sender: ${r}`,` Data: ${t}`,` Callback selector: ${e}`,` Extra data: ${s}`].flat(),name:"OffchainLookupError"})}}class i 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.G)(a)}`,`Response: ${(0,r.P)(e)}`],name:"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}`],name:"OffchainLookupSenderMismatchError"})}}var u=t("1859"),f=t("871"),l=t("4364"),p=t("8671"),h=t("8608"),y=t("7313");let m="0x556f1830",w={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:r,to:n}){let{args:o}=(0,f.p)({data:r,abi:[w]}),[i,u,y,m,g]=o,{ccipRead:b}=e,G=b&&"function"==typeof b?.request?b.request:k;try{if(!(0,p.E)(n,i))throw new d({sender:i,to:n});let r=await G({data:y,sender:i,urls:u}),{data:o}=await (0,s.R)(e,{blockNumber:a,blockTag:t,data:(0,h.zo)([m,(0,l.E)([{type:"bytes"},{type:"bytes"}],[r,g])]),to:n});return o}catch(e){throw new c({callbackSelector:m,cause:e,data:r,extraData:g,sender:i,urls:u})}}async function k({data:e,sender:a,urls:t}){let s=Error("An unknown error occurred.");for(let n=0;n<t.length;n++){let o=t[n],c=o.includes("{data}")?"GET":"POST",d="POST"===c?{data:e,sender:a}:void 0,f="POST"===c?{"Content-Type":"application/json"}:{};try{let t;let n=await fetch(o.replace("{sender}",a).replace("{data}",e),{body:JSON.stringify(d),headers:f,method:c});if(t=n.headers.get("Content-Type")?.startsWith("application/json")?(await n.json()).data:await n.text(),!n.ok){s=new u.Gg({body:d,details:t?.error?(0,r.P)(t.error):n.statusText,headers:n.headers,status:n.status,url:o});continue}if(!(0,y.v)(t)){s=new i({result:t,url:o});continue}return t}catch(e){s=new u.Gg({body:d,details:e.message,url:o})}}throw s}}}]);
//# sourceMappingURL=778.index.bundle.js.map