PageSourceSearch

https://www.contractreader.io/_next/static/chunks/9326.c656a01270f3cbe7.js

js contractreader.io collected 2026-10-03 23:55:46 UTC 12,203 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9326],{1379:(e,t,s)=>{s.d(t,{A:()=>o});var a=s(74517),i=s(58798),n=s(38047),r=s(81645);function o(e,t){let s,o;return(0,a.S)((s="string"==typeof e?(0,r.i3)(e):"string"==typeof e.raw?e.raw:(0,r.My)(e.raw),o=(0,r.i3)(`\x19Ethereum Signed Message:
2${(0,n.E)(s)}`),(0,i.xW)([o,s])),t)}},42841:(e,t,s)=>{s.d(t,{Zh:()=>f});var a=s(23414),i=s(58798),n=s(81645),r=s(74517),o=s(79313),c=s(45755),l=s(40474),u=s(76200);class d extends u.C{constructor({domain:e}){super(`Invalid domain "${(0,l.A)(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class h extends u.C{constructor({primaryType:e,types:t}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(t))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class m extends u.C{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}var g=s(57512),y=s(38047),p=s(3796);function f(e){let{domain:t={},message:s,primaryType:a}=e,l={EIP712Domain:function({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},("number"==typeof e?.chainId||"bigint"==typeof e?.chainId)&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}({domain:t}),...e.types};!function(e){let{domain:t,message:s,primaryType:a,types:i}=e,r=(e,t)=>{for(let s of e){let{name:e,type:a}=s,l=t[e],u=a.match(p.Ge);if(u&&("number"==typeof l||"bigint"==typeof l)){let[e,t,s]=u;(0,n.cK)(l,{signed:"int"===t,size:Number.parseInt(s,10)/8})}if("address"===a&&"string"==typeof l&&!(0,g.P)(l))throw new c.M({address:l});let d=a.match(p.BD);if(d){let[e,t]=d;if(t&&(0,y.E)(l)!==Number.parseInt(t,10))throw new o.BI({expectedSize:Number.parseInt(t,10),givenSize:(0,y.E)(l)})}let h=i[a];h&&(function(e){if("address"===e||"bool"===e||"string"===e||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new m({type:e})}(a),r(h,l))}};if(i.EIP712Domain&&t){if("object"!=typeof t)throw new d({domain:t});r(i.EIP712Domain,t)}if("EIP712Domain"!==a)if(i[a])r(i[a],s);else throw new h({primaryType:a,types:i})}({domain:t,message:s,primaryType:a,types:l});let u=["0x1901"];return t&&u.push(function({domain:e,types:t}){return w({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:l})),"EIP712Domain"!==a&&u.push(w({data:s,primaryType:a,types:l})),(0,r.S)((0,i.xW)(u))}function w({data:e,primaryType:t,types:s}){let i=function e({data:t,primaryType:s,types:i}){let o=[{type:"bytes32"}],c=[function({primaryType:e,types:t}){let s=(0,n.nj)(function({primaryType:e,types:t}){let s="",a=function e({primaryType:t,types:s},a=new Set){let i=t.match(/^\w*/u),n=i?.[0];if(a.has(n)||void 0===s[n])return a;for(let t of(a.add(n),s[n]))e({primaryType:t.type,types:s},a);return a}({primaryType:e,types:t});for(let i of(a.delete(e),[e,...Array.from(a).sort()]))s+=`${i}(${t[i].map(({name:e,type:t})=>`${t} ${e}`).join(",")})`;return s}({primaryType:e,types:t}));return(0,r.S)(s)}({primaryType:s,types:i})];for(let l of i[s]){let[s,u]=function t({types:s,name:i,type:o,value:c}){if(void 0!==s[o])return[{type:"bytes32"},(0,r.S)(e({data:c,primaryType:o,types:s}))];if("bytes"===o)return[{type:"bytes32"},(0,r.S)(c)];if("string"===o)return[{type:"bytes32"},(0,r.S)((0,n.nj)(c))];if(o.lastIndexOf("]")===o.length-1){let e=o.slice(0,o.lastIndexOf("[")),n=c.map(a=>t({name:i,type:e,types:s,value:a}));return[{type:"bytes32"},(0,r.S)((0,a.h)(n.map(([e])=>e),n.map(([,e])=>e)))]}return[{type:o},c]}({types:i,name:l.name,type:l.type,value:t[l.name]});o.push(s),c.push(u)}return(0,a.h)(o,c)}({data:e,primaryType:t,types:s});return(0,r.S)(i)}},49326:(e,t,s)=>{s.d(t,{default:()=>P});let a=e=>e.toString(16).padStart(2,"0");class i{}i.makeRequest=(e,t)=>({id:(()=>{if("u">typeof window){let e;return e=new Uint8Array(5),window.crypto.getRandomValues(e),Array.from(e,a).join("")}return new Date().getTime().toString(36)})(),method:e,params:t,env:{sdkVersion:"9.1.0"}}),i.makeResponse=(e,t,s)=>({id:e,success:!0,version:s,data:t}),i.makeErrorResponse=(e,t,s)=>
2({id:e,success:!1,error:t,version:s}),(m=g||(g={})).sendTransactions="sendTransactions",m.rpcCall="rpcCall",m.getChainInfo="getChainInfo",m.getSafeInfo="getSafeInfo",m.getTxBySafeTxHash="getTxBySafeTxHash",m.getSafeBalances="getSafeBalances",m.signMessage="signMessage",m.signTypedMessage="signTypedMessage",m.getEnvironmentInfo="getEnvironmentInfo",m.getOffChainSignature="getOffChainSignature",m.requestAddressBook="requestAddressBook",m.wallet_getPermissions="wallet_getPermissions",m.wallet_requestPermissions="wallet_requestPermissions",(y||(y={})).requestAddressBook="requestAddressBook";class n{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="u"<typeof window,this.isValidMessage=({origin:e,data:t,source:s})=>{let a=!t,i=!this.isServer&&s===window.parent,n=void 0!==t.version&&parseInt(t.version.split(".")[0]),r=!0;return Array.isArray(this.allowedOrigins)&&(r=void 0!==this.allowedOrigins.find(t=>t.test(e))),!a&&i&&"number"==typeof n&&n>=1&&r},this.logIncomingMessage=e=>{console.info(`Safe Apps SDK v1: A message was received from origin ${e.origin}. `,e.data)},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{let{id:t}=e,s=this.callbacks.get(t);s&&(s(e),this.callbacks.delete(t))},this.send=(e,t)=>{let s=i.makeRequest(e,t);if(this.isServer)throw Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise((e,t)=>{this.callbacks.set(s.id,s=>{s.success?e(s):t(Error(s.error))})})},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}}let r=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;s(67099);class o{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw Error("Invalid safeTxHash");return(await this.communicator.send(g.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){return(await this.communicator.send(g.signMessage,{message:e})).data}async signTypedMessage(e){if(!r(e))throw Error("Invalid typed data");return(await this.communicator.send(g.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw Error("No transactions were passed");return(await this.communicator.send(g.sendTransactions,{txs:e,params:t})).data}}let c="eth_call",l=(e="latest")=>e,u=(e=!1)=>e,d=e=>Number.isInteger(e)?`0x${e.toString(16)}`:e;class h{constructor(e){this.communicator=e,this.call=this.buildRequest({call:c,formatters:[null,l]}),this.getBalance=this.buildRequest({call:"eth_getBalance",formatters:[null,l]}),this.getCode=this.buildRequest({call:"eth_getCode",formatters:[null,l]}),this.getStorageAt=this.buildRequest({call:"eth_getStorageAt",formatters:[null,d,l]}),this.getPastLogs=this.buildRequest({call:"eth_getLogs"}),this.getBlockByHash=this.buildRequest({call:"eth_getBlockByHash",formatters:[null,u]}),this.getBlockByNumber=this.buildRequest({call:"eth_getBlockByNumber",formatters:[d,u]}),this.getTransactionByHash=this.buildRequest({call:"eth_getTransactionByHash"}),this.getTransactionReceipt=this.buildRequest({call:"eth_getTransactionReceipt"}),this.getTransactionCount=this.buildRequest({call:"eth_getTransactionCount",formatters:[null,l]}),this.getGasPrice=this.buildRequest({call:"eth_gasPrice"}),this.getEstimateGas=e=>this.buildRequest({call:"eth_estimateGas"})([e]),this.setSafeSettings=this.buildRequest({call:"safe_setSettings"})}buildRequest(e){let{call:t,formatters:s}=e;return async e=>(s&&Array.isArray(e)&&s.forEach((t,s)=>{t&&(e[s]=t(e[s]))}),(await this.communicator.send(g.rpcCall,{call:t,params:e||[]})).data)}}var m,g,y,p=s(14237),f=s(1379),w=s(42841);class b extends Error{constructor(e,t,s){super(e),this.code=t,this.data=s,Object.setPrototypeOf(this,b.prototype)}}class S{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(g.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new b("Permissions request is invalid",4001);try{return(await this.communicator.send(g.wallet_requestPermissions,e)).data}catch{throw new b("Permissions rejected",4001)}}isPermissionRequestValid(e){return e.every(e=>"object"==typeof e&&Object.keys(e).every(e=>!!Object.values(y).includes(e)))}}let v=(e,t)=>
2t.some(t=>t.parentCapability===e);class I{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(g.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(g.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(g.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){let s=await this.getInfo(),a=(0,p.p)({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,t]}),i={call:c,params:[{to:s.safeAddress,data:a},"latest"]};try{return"0x1626ba7e"===(await this.communicator.send(g.rpcCall,i)).data.slice(0,10).toLowerCase()}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){let s=await this.getInfo(),a=(0,p.p)({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,t]}),i={call:c,params:[{to:s.safeAddress,data:a},"latest"]};try{return"0x20c13b0b"===(await this.communicator.send(g.rpcCall,i)).data.slice(0,10).toLowerCase()}catch(e){return!1}}calculateMessageHash(e){return(0,f.A)(e)}calculateTypedMessageHash(e){let t="object"==typeof e.domain.chainId?e.domain.chainId.toNumber():Number(e.domain.chainId),s=e.primaryType;if(!s){let t=Object.values(e.types),a=Object.keys(e.types).filter(e=>t.every(t=>t.every(({type:t})=>t.replace("[","").replace("]","")!==e)));if(0===a.length||a.length>1)throw Error("Please specify primaryType");s=a[0]}return(0,w.Zh)({message:e.message,domain:{...e.domain,chainId:t,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt},types:e.types,primaryType:s})}async getOffChainSignature(e){return(await this.communicator.send(g.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let s;if("string"==typeof e&&(s=async()=>{let s=this.calculateMessageHash(e);return await this.isMessageHashSigned(s,t)}),r(e)&&(s=async()=>{let s=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(s,t)}),s)return await s();throw Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){for(let s of[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)])if(await s(e,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(g.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(g.requestAddressBook,void 0)).data}}!function(e,t,s,a){var i,n=arguments.length,r=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,s):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,a);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(n<3?i(r):n>3?i(t,s,r):i(t,s))||r);n>3&&r&&Object.defineProperty(t,s,r)}([(e,t,s)=>{let a=s.value;return s.value=async function(){let e=new S(this.communicator),s=await e.getPermissions();if(v(t,s)||(s=await e.requestPermissions([{[t]:{}}])),!v(t,s))throw new b("Permissions rejected",4001);return a.apply(this)},s}],I.prototype,"requestAddressBook",null);class M{constructor(e={}){const{allowedDomains:t=null,debug:s=!1}=e;this.communicator=new n(t,s),this.eth=new h(this.communicator),this.txs=new o(this.communicator),this.safe=new I(this.communicator),this.wallet=new S(this.communicator)}}let P=M}}]);

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.