1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6539],{17506:(e,t,s)=>{s.d(t,{A:()=>o});var a=s(53412),n=s(80533),i=s(95624),r=s(37364);function o(e,t){return(0,a.S)(function(e){let t="string"==typeof e?(0,r.i3)(e):"string"==typeof e.raw?e.raw:(0,r.My)(e.raw),s=(0,r.i3)(`\x19Ethereum Signed Message: 2${(0,i.E)(t)}`);return(0,n.xW)([s,t])}(e),t)}},20971:(e,t,s)=>{s.d(t,{H4:()=>f,v8:()=>m,$$:()=>y});var a=s(14484),n=s(30706),i=s(55649),r=s(93146);class o extends r.C{constructor({domain:e}){super(`Invalid domain "${(0,i.A)(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class c extends r.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 l extends r.C{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}var u=s(13867),d=s(95624),h=s(37364),g=s(68143);function m(e){let{domain:t,message:s,primaryType:a,types:n}=e,r=(e,t)=>{let s={...t};for(let t of e){let{name:e,type:a}=t;"address"===a&&(s[e]=s[e].toLowerCase())}return s},o=n.EIP712Domain&&t?r(n.EIP712Domain,t):{},c=(()=>{if("EIP712Domain"!==a)return r(n[a],s)})();return(0,i.A)({domain:o,message:c,primaryType:a,types:n})}function y(e){let{domain:t,message:s,primaryType:i,types:r}=e,m=(e,t)=>{for(let s of e){let{name:e,type:i}=s,o=t[e],c=i.match(g.Ge);if(c&&("number"==typeof o||"bigint"==typeof o)){let[e,t,s]=c;(0,h.cK)(o,{signed:"int"===t,size:Number.parseInt(s,10)/8})}if("address"===i&&"string"==typeof o&&!(0,u.P)(o))throw new n.M({address:o});let y=i.match(g.BD);if(y){let[e,t]=y;if(t&&(0,d.E)(o)!==Number.parseInt(t,10))throw new a.BI({expectedSize:Number.parseInt(t,10),givenSize:(0,d.E)(o)})}let f=r[i];f&&(function(e){if("address"===e||"bool"===e||"string"===e||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new l({type:e})}(i),m(f,o))}};if(r.EIP712Domain&&t){if("object"!=typeof t)throw new o({domain:t});m(r.EIP712Domain,t)}if("EIP712Domain"!==i)if(r[i])m(r[i],s);else throw new c({primaryType:i,types:r})}function f({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)}},43885:(e,t,s)=>{s.d(t,{Zh:()=>c});var a=s(19945),n=s(80533),i=s(37364),r=s(53412),o=s(20971);function c(e){let{domain:t={},message:s,primaryType:a}=e,i={EIP712Domain:(0,o.H4)({domain:t}),...e.types};(0,o.$$)({domain:t,message:s,primaryType:a,types:i});let c=["0x1901"];return t&&c.push(function({domain:e,types:t}){return l({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:i})),"EIP712Domain"!==a&&c.push(l({data:s,primaryType:a,types:i})),(0,r.S)((0,n.xW)(c))}function l({data:e,primaryType:t,types:s}){let n=function e({data:t,primaryType:s,types:n}){let o=[{type:"bytes32"}],c=[function({primaryType:e,types:t}){let s=(0,i.nj)(function({primaryType:e,types:t}){let s="",a=function e({primaryType:t,types:s},a=new Set){let n=t.match(/^\w*/u),i=n?.[0];if(a.has(i)||void 0===s[i])return a;for(let t of(a.add(i),s[i]))e({primaryType:t.type,types:s},a);return a}({primaryType:e,types:t});for(let n of(a.delete(e),[e,...Array.from(a).sort()]))s+=`${n}(${t[n].map(({name:e,type:t})=>`${t} ${e}`).join(",")})`;return s}({primaryType:e,types:t}));return(0,r.S)(s)}({primaryType:s,types:n})];for(let l of n[s]){let[s,u]=function t({types:s,name:n,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,i.nj)(c))];if(o.lastIndexOf("]")===o.length-1){let e=o.slice(0,o.lastIndexOf("[")),i=c.map(a=>t({name:n,type:e,types:s,value:a}));return[{type:"bytes32"},(0,r.S)((0,a.h)(i.map(([e])=>e),i.map(([,e])=>e)))]}return[{type:o},c]}({types:n,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)(n)}},76539:(e,t,s)=>{s.r(t),s.d(t,{MessageFormatter:()=>i,Methods:()=>c,Operation:()=>u.Operation,RPC_CALLS:()=>h,RestrictedMethods:()=>l,TokenType:()=>u.TokenType,TransactionStatus:()=>u.TransactionStatus,TransferDirection:()=>u.TransferDirection,default:()=>T,getSDKVersion:()=>a,isObjectEIP712TypedData:()=>o});let a=()=>"9.1.0",n=e=>e.toString(16).padStart(2,"0");class i{}i.makeRequest=(e,t)=>
2({id:"undefined"!=typeof window?(e=>{let t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,n).join("")})(10):new Date().getTime().toString(36),method:e,params:t,env:{sdkVersion:a()}}),i.makeResponse=(e,t,s)=>({id:e,success:!0,version:s,data:t}),i.makeErrorResponse=(e,t,s)=>({id:e,success:!1,error:t,version:s}),function(e){e.sendTransactions="sendTransactions",e.rpcCall="rpcCall",e.getChainInfo="getChainInfo",e.getSafeInfo="getSafeInfo",e.getTxBySafeTxHash="getTxBySafeTxHash",e.getSafeBalances="getSafeBalances",e.signMessage="signMessage",e.signTypedMessage="signTypedMessage",e.getEnvironmentInfo="getEnvironmentInfo",e.getOffChainSignature="getOffChainSignature",e.requestAddressBook="requestAddressBook",e.wallet_getPermissions="wallet_getPermissions",e.wallet_requestPermissions="wallet_requestPermissions"}(c||(c={})),(l||(l={})).requestAddressBook="requestAddressBook";class r{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer="undefined"==typeof window,this.isValidMessage=({origin:e,data:t,source:s})=>{let a=!t,n=!this.isServer&&s===window.parent,i=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&&n&&"number"==typeof i&&i>=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=>{if(!s.success)return void t(Error(s.error));e(s)})})},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}}let o=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;var c,l,u=s(30295);class d{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw Error("Invalid safeTxHash");return(await this.communicator.send(c.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){return(await this.communicator.send(c.signMessage,{message:e})).data}async signTypedMessage(e){if(!o(e))throw Error("Invalid typed data");return(await this.communicator.send(c.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(c.sendTransactions,{txs:e,params:t})).data}}let h={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},g={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class m{constructor(e){this.communicator=e,this.call=this.buildRequest({call:h.eth_call,formatters:[null,g.defaultBlockParam]}),this.getBalance=this.buildRequest({call:h.eth_getBalance,formatters:[null,g.defaultBlockParam]}),this.getCode=this.buildRequest({call:h.eth_getCode,formatters:[null,g.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:h.eth_getStorageAt,formatters:[null,g.blockNumberToHex,g.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:h.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:h.eth_getBlockByHash,formatters:[null,g.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:h.eth_getBlockByNumber,formatters:[g.blockNumberToHex,g.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:h.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:h.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:h.eth_getTransactionCount,formatters:[null,g.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:h.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:h.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:h.safe_setSettings})}buildRequest(e){let{call:t,formatters:s}=e;return async e=>
2(s&&Array.isArray(e)&&s.forEach((t,s)=>{t&&(e[s]=t(e[s]))}),(await this.communicator.send(c.rpcCall,{call:t,params:e||[]})).data)}}var y=s(72658),f=s(17506),p=s(43885);class b extends Error{constructor(e,t,s){super(e),this.code=t,this.data=s,Object.setPrototypeOf(this,b.prototype)}}class w{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(c.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(c.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(l).includes(e)))}}let S=(e,t)=>t.some(t=>t.parentCapability===e);class v{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(c.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(c.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(c.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){let s=await this.getInfo(),a=(0,y.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]}),n={call:h.eth_call,params:[{to:s.safeAddress,data:a},"latest"]};try{return"0x1626ba7e"===(await this.communicator.send(c.rpcCall,n)).data.slice(0,10).toLowerCase()}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){let s=await this.getInfo(),a=(0,y.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]}),n={call:h.eth_call,params:[{to:s.safeAddress,data:a},"latest"]};try{return"0x20c13b0b"===(await this.communicator.send(c.rpcCall,n)).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,p.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(c.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)}),o(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(c.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(c.requestAddressBook,void 0)).data}}!function(e,t,s,a){var n,i=arguments.length,r=i<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--)(n=e[o])&&(r=(i<3?n(r):i>3?n(t,s,r):n(t,s))||r);i>3&&r&&Object.defineProperty(t,s,r)}([(e,t,s)=>{let a=s.value;return s.value=async function(){let e=new w(this.communicator),s=await e.getPermissions();if(S(t,s)||(s=await e.requestPermissions([{[t]:{}}])),!S(t,s))throw new b("Permissions rejected",4001);return a.apply(this)},s}],v.prototype,"requestAddressBook",null);class _{constructor(e={}){let{allowedDomains:t=null,debug:s=!1}=e;this.communicator=new r(t,s),this.eth=new m(this.communicator),this.txs=new d(this.communicator),this.safe=new v(this.communicator),this.wallet=new w(this.communicator)}}let T=_}}]);
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.