1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4060],{47073:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_BASE_URL=void 0,t.DEFAULT_BASE_URL="https://safe-client.safe.global"},7637:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getEndpoint=t.deleteEndpoint=t.putEndpoint=t.postEndpoint=void 0;let s=n(93340);function i(e,t,n,i){let a=(0,s.insertParams)(t,n),r=(0,s.stringifyQuery)(i);return`${e}${a}${r}`}t.postEndpoint=function(e,t,n){let a=i(e,t,null==n?void 0:n.path,null==n?void 0:n.query);return(0,s.fetchData)(a,"POST",null==n?void 0:n.body,null==n?void 0:n.headers,null==n?void 0:n.credentials)},t.putEndpoint=function(e,t,n){let a=i(e,t,null==n?void 0:n.path,null==n?void 0:n.query);return(0,s.fetchData)(a,"PUT",null==n?void 0:n.body,null==n?void 0:n.headers,null==n?void 0:n.credentials)},t.deleteEndpoint=function(e,t,n){let a=i(e,t,null==n?void 0:n.path,null==n?void 0:n.query);return(0,s.fetchData)(a,"DELETE",null==n?void 0:n.body,null==n?void 0:n.headers,null==n?void 0:n.credentials)},t.getEndpoint=function(e,t,n,a){if(a)return(0,s.getData)(a,void 0,null==n?void 0:n.credentials);let r=i(e,t,null==n?void 0:n.path,null==n?void 0:n.query);return(0,s.getData)(r,null==n?void 0:n.headers,null==n?void 0:n.credentials)}},29323:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,s,i)}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteAccount=t.getAccount=t.createAccount=t.verifyAuth=t.getAuthNonce=t.getContract=t.getSafeOverviews=t.unsubscribeAll=t.unsubscribeSingle=t.registerRecoveryModule=t.deleteRegisteredEmail=t.getRegisteredEmail=t.verifyEmail=t.resendEmailVerificationCode=t.changeEmail=t.registerEmail=t.unregisterDevice=t.unregisterSafe=t.registerDevice=t.getDelegates=t.confirmSafeMessage=t.proposeSafeMessage=t.getSafeMessage=t.getSafeMessages=t.getDecodedData=t.getMasterCopies=t.getSafeApps=t.getChainConfig=t.getChainsConfig=t.getConfirmationView=t.proposeTransaction=t.getNonces=t.postSafeGasEstimation=t.deleteTransaction=t.getTransactionDetails=t.getTransactionQueue=t.getTransactionHistory=t.getCollectiblesPage=t.getCollectibles=t.getAllOwnedSafes=t.getOwnedSafes=t.getFiatCurrencies=t.getBalances=t.getMultisigTransactions=t.getModuleTransactions=t.getIncomingTransfers=t.getSafeInfo=t.getRelayCount=t.relayTransaction=t.setBaseUrl=void 0,t.putAccountDataSettings=t.getAccountDataSettings=t.getAccountDataTypes=void 0;let a=n(7637),r=n(47073);i(n(39468),t),i(n(55517),t),i(n(41471),t),i(n(41621),t),i(n(94969),t),i(n(5012),t),i(n(83015),t),i(n(99005),t),i(n(71091),t),i(n(81570),t);let o=r.DEFAULT_BASE_URL;t.setBaseUrl=e=>{o=e},t.relayTransaction=function(e,t){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/relay",{path:{chainId:e},body:t})},t.getRelayCount=function(e,t){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:e,address:t}})},t.getSafeInfo=function(e,t){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},t.getIncomingTransfers=function(e,t,n,s){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:e,address:t},query:n},s)},t.getModuleTransactions=function(e,t,n,s){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:e,address:t},query:n},s)},t.getMultisigTransactions=function(e,t,n,s){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:e,address:t},query:n},s)},t.getBalances=function(e,t,n="usd",s={}){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:n},query:s})},t.getFiatCurrencies=function(){return(0,a.getEndpoint)(o,"/v1/balances/supported-fiat-codes")}
1,t.getOwnedSafes=function(e,t){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},t.getAllOwnedSafes=function(e){return(0,a.getEndpoint)(o,"/v1/owners/{address}/safes",{path:{address:e}})},t.getCollectibles=function(e,t,n={}){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:n})},t.getCollectiblesPage=function(e,t,n={},s){return(0,a.getEndpoint)(o,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:n},s)},t.getTransactionHistory=function(e,t,n={},s){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:n},s)},t.getTransactionQueue=function(e,t,n={},s){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:n},s)},t.getTransactionDetails=function(e,t){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},t.deleteTransaction=function(e,t,n){return(0,a.deleteEndpoint)(o,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:e,safeTxHash:t},body:{signature:n}})},t.postSafeGasEstimation=function(e,t,n){return(0,a.postEndpoint)(o,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:n})},t.getNonces=function(e,t){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:e,safe_address:t}})},t.proposeTransaction=function(e,t,n){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:n})},t.getConfirmationView=function(e,t,n,s){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:e,safe_address:t},body:{data:n,to:s}})},t.getChainsConfig=function(e){return(0,a.getEndpoint)(o,"/v1/chains",{query:e})},t.getChainConfig=function(e){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}",{path:{chainId:e}})},t.getSafeApps=function(e,t={}){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},t.getMasterCopies=function(e){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},t.getDecodedData=function(e,t,n){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t,to:n}})},t.getSafeMessages=function(e,t,n){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},n)},t.getSafeMessage=function(e,t){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},t.proposeSafeMessage=function(e,t,n){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},body:n})},t.confirmSafeMessage=function(e,t,n){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:n})},t.getDelegates=function(e,t={}){return(0,a.getEndpoint)(o,"/v2/chains/{chainId}/delegates",{path:{chainId:e},query:t})},t.registerDevice=function(e){return(0,a.postEndpoint)(o,"/v1/register/notifications",{body:e})},t.unregisterSafe=function(e,t,n){return(0,a.deleteEndpoint)(o,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:e,safe_address:t,uuid:n}})},t.unregisterDevice=function(e,t){return(0,a.deleteEndpoint)(o,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:e,uuid:t}})},t.registerEmail=function(e,t,n,s){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:e,safe_address:t},body:n,headers:s})},t.changeEmail=function(e,t,n,s,i){return(0,a.putEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:e,safe_address:t,signer:n},body:s,headers:i})},t.resendEmailVerificationCode=function(e,t,n){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:e,safe_address:t,signer:n},body:""})},t.verifyEmail=function(e,t,n,s){return(0,a.putEndpoint)(o,"/v1/c
1hains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:e,safe_address:t,signer:n},body:s})},t.getRegisteredEmail=function(e,t,n,s){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:e,safe_address:t,signer:n},headers:s})},t.deleteRegisteredEmail=function(e,t,n,s){return(0,a.deleteEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:e,safe_address:t,signer:n},headers:s})},t.registerRecoveryModule=function(e,t,n){return(0,a.postEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:e,safe_address:t},body:n})},t.unsubscribeSingle=function(e){return(0,a.deleteEndpoint)(o,"/v1/subscriptions",{query:e})},t.unsubscribeAll=function(e){return(0,a.deleteEndpoint)(o,"/v1/subscriptions/all",{query:e})},t.getSafeOverviews=function(e,t){return(0,a.getEndpoint)(o,"/v1/safes",{query:Object.assign(Object.assign({},t),{safes:e.join(",")})})},t.getContract=function(e,t){return(0,a.getEndpoint)(o,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:e,contractAddress:t}})},t.getAuthNonce=function(){return(0,a.getEndpoint)(o,"/v1/auth/nonce",{credentials:"include"})},t.verifyAuth=function(e){return(0,a.postEndpoint)(o,"/v1/auth/verify",{body:e,credentials:"include"})},t.createAccount=function(e){return(0,a.postEndpoint)(o,"/v1/accounts",{body:e,credentials:"include"})},t.getAccount=function(e){return(0,a.getEndpoint)(o,"/v1/accounts/{address}",{path:{address:e},credentials:"include"})},t.deleteAccount=function(e){return(0,a.deleteEndpoint)(o,"/v1/accounts/{address}",{path:{address:e},credentials:"include"})},t.getAccountDataTypes=function(){return(0,a.getEndpoint)(o,"/v1/accounts/data-types")},t.getAccountDataSettings=function(e){return(0,a.getEndpoint)(o,"/v1/accounts/{address}/data-settings",{path:{address:e},credentials:"include"})},t.putAccountDataSettings=function(e,t){return(0,a.putEndpoint)(o,"/v1/accounts/{address}/data-settings",{path:{address:e},body:t,credentials:"include"})}},41621:function(e,t){var n,s,i;Object.defineProperty(t,"__esModule",{value:!0}),t.FEATURES=t.GAS_PRICE_TYPE=t.RPC_AUTHENTICATION=void 0,(n=t.RPC_AUTHENTICATION||(t.RPC_AUTHENTICATION={})).API_KEY_PATH="API_KEY_PATH",n.NO_AUTHENTICATION="NO_AUTHENTICATION",n.UNKNOWN="UNKNOWN",(s=t.GAS_PRICE_TYPE||(t.GAS_PRICE_TYPE={})).ORACLE="ORACLE",s.FIXED="FIXED",s.FIXED_1559="FIXED1559",s.UNKNOWN="UNKNOWN",(i=t.FEATURES||(t.FEATURES={})).ERC721="ERC721",i.SAFE_APPS="SAFE_APPS",i.CONTRACT_INTERACTION="CONTRACT_INTERACTION",i.DOMAIN_LOOKUP="DOMAIN_LOOKUP",i.SPENDING_LIMIT="SPENDING_LIMIT",i.EIP1559="EIP1559",i.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",i.TX_SIMULATION="TX_SIMULATION",i.EIP1271="EIP1271"},94969:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenType=void 0,(n=t.TokenType||(t.TokenType={})).ERC20="ERC20",n.ERC721="ERC721",n.NATIVE_TOKEN="NATIVE_TOKEN"},83015:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConfirmationViewTypes=void 0,(n=t.ConfirmationViewTypes||(t.ConfirmationViewTypes={})).COW_SWAP_ORDER="COW_SWAP_ORDER",n.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER"},5012:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},71091:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceType=void 0,(n=t.DeviceType||(t.DeviceType={})).ANDROID="ANDROID",n.IOS="IOS",n.WEB="WEB"},81570:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},55517:function(e,t){var n,s;Object.defineProperty(t,"__esModule",{value:!0}
1),t.SafeAppSocialPlatforms=t.SafeAppFeatures=t.SafeAppAccessPolicyTypes=void 0,(n=t.SafeAppAccessPolicyTypes||(t.SafeAppAccessPolicyTypes={})).NoRestrictions="NO_RESTRICTIONS",n.DomainAllowlist="DOMAIN_ALLOWLIST",(t.SafeAppFeatures||(t.SafeAppFeatures={})).BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS",(s=t.SafeAppSocialPlatforms||(t.SafeAppSocialPlatforms={})).TWITTER="TWITTER",s.GITHUB="GITHUB",s.DISCORD="DISCORD"},39468:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ImplementationVersionState=void 0,(n=t.ImplementationVersionState||(t.ImplementationVersionState={})).UP_TO_DATE="UP_TO_DATE",n.OUTDATED="OUTDATED",n.UNKNOWN="UNKNOWN"},99005:function(e,t){var n,s;Object.defineProperty(t,"__esModule",{value:!0}),t.SafeMessageStatus=t.SafeMessageListItemType=void 0,(n=t.SafeMessageListItemType||(t.SafeMessageListItemType={})).DATE_LABEL="DATE_LABEL",n.MESSAGE="MESSAGE",(s=t.SafeMessageStatus||(t.SafeMessageStatus={})).NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",s.CONFIRMED="CONFIRMED"},41471:function(e,t){var n,s,i,a,r,o,c,u,l,d,f,p;Object.defineProperty(t,"__esModule",{value:!0}),t.LabelValue=t.StartTimeValue=t.DurationType=t.DetailedExecutionInfoType=t.TransactionListItemType=t.ConflictType=t.TransactionInfoType=t.SettingsInfoType=t.TransactionTokenType=t.TransferDirection=t.TransactionStatus=t.Operation=void 0,(n=t.Operation||(t.Operation={}))[n.CALL=0]="CALL",n[n.DELEGATE=1]="DELEGATE",(s=t.TransactionStatus||(t.TransactionStatus={})).AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",s.AWAITING_EXECUTION="AWAITING_EXECUTION",s.CANCELLED="CANCELLED",s.FAILED="FAILED",s.SUCCESS="SUCCESS",(i=t.TransferDirection||(t.TransferDirection={})).INCOMING="INCOMING",i.OUTGOING="OUTGOING",i.UNKNOWN="UNKNOWN",(a=t.TransactionTokenType||(t.TransactionTokenType={})).ERC20="ERC20",a.ERC721="ERC721",a.NATIVE_COIN="NATIVE_COIN",(r=t.SettingsInfoType||(t.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",r.ADD_OWNER="ADD_OWNER",r.REMOVE_OWNER="REMOVE_OWNER",r.SWAP_OWNER="SWAP_OWNER",r.CHANGE_THRESHOLD="CHANGE_THRESHOLD",r.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",r.ENABLE_MODULE="ENABLE_MODULE",r.DISABLE_MODULE="DISABLE_MODULE",r.SET_GUARD="SET_GUARD",r.DELETE_GUARD="DELETE_GUARD",(o=t.TransactionInfoType||(t.TransactionInfoType={})).TRANSFER="Transfer",o.SETTINGS_CHANGE="SettingsChange",o.CUSTOM="Custom",o.CREATION="Creation",o.SWAP_ORDER="SwapOrder",o.TWAP_ORDER="TwapOrder",o.SWAP_TRANSFER="SwapTransfer",(c=t.ConflictType||(t.ConflictType={})).NONE="None",c.HAS_NEXT="HasNext",c.END="End",(u=t.TransactionListItemType||(t.TransactionListItemType={})).TRANSACTION="TRANSACTION",u.LABEL="LABEL",u.CONFLICT_HEADER="CONFLICT_HEADER",u.DATE_LABEL="DATE_LABEL",(l=t.DetailedExecutionInfoType||(t.DetailedExecutionInfoType={})).MULTISIG="MULTISIG",l.MODULE="MODULE",(d=t.DurationType||(t.DurationType={})).AUTO="AUTO",d.LIMIT_DURATION="LIMIT_DURATION",(f=t.StartTimeValue||(t.StartTimeValue={})).AT_MINING_TIME="AT_MINING_TIME",f.AT_EPOCH="AT_EPOCH",(p=t.LabelValue||(t.LabelValue={})).Queued="Queued",p.Next="Next"},93340:function(e,t){var n=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(i,a){function r(e){try{c(s.next(e))}catch(e){a(e)}}function o(e){try{c(s.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((s=s.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.fetchData=t.stringifyQuery=t.insertParams=void 0;let s=e=>"object"==typeof e&&null!==e&&"code"in e&&"message"in e;function i(e){return n(this,void 0,void 0,function*(){let t;try{t=yield e.json()}catch(e){t={}}if(!e.ok)throw Error(s(t)?`CGW error - ${t.code}: ${t.message}`:`CGW error - status ${e.statusText}`);return t})}t.insertParams=function(e,t){return t?Object.keys(t).reduce((e,n)=>{var s;return s=String(t[n]),e.replace(RegExp(`\\{${n}\\}`,"g"),s)},e):e},t.stringifyQuery=function(e){if(!e)return"";let t=new URLSearchParams;Object.keys(e).forEach(n=>{null!=e[n]&&t.append(n,String(e[n]))});let n=t.toString();return n?`?${n}`:""},t.fetchData=function(e,t,s,a,r){return n(this,void 0,void 0,function*(){let n={method:null!=t?t:"POST",headers:Object.assign({"Content-Type":"application/json"},a)};return r&&(n.credentials=r),null!=s&&(n.body="string"==typeof s?s:JSON.stringify(s)),i((yield fetch(e,n
1)))})},t.getData=function(e,t,s){return n(this,void 0,void 0,function*(){let n={method:"GET"};return t&&(n.headers=Object.assign(Object.assign({},t),{"Content-Type":"application/json"})),s&&(n.credentials=s),i((yield fetch(e,n)))})}},14060:function(e,t,n){n.d(t,{default:function(){return eN}});let s=()=>"9.1.0",i=e=>e.toString(16).padStart(2,"0"),a=e=>{let t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,i).join("")},r=()=>"undefined"!=typeof window?a(10):new Date().getTime().toString(36);class o{}o.makeRequest=(e,t)=>({id:r(),method:e,params:t,env:{sdkVersion:s()}}),o.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t}),o.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n}),(Z=ee||(ee={})).sendTransactions="sendTransactions",Z.rpcCall="rpcCall",Z.getChainInfo="getChainInfo",Z.getSafeInfo="getSafeInfo",Z.getTxBySafeTxHash="getTxBySafeTxHash",Z.getSafeBalances="getSafeBalances",Z.signMessage="signMessage",Z.signTypedMessage="signTypedMessage",Z.getEnvironmentInfo="getEnvironmentInfo",Z.getOffChainSignature="getOffChainSignature",Z.requestAddressBook="requestAddressBook",Z.wallet_getPermissions="wallet_getPermissions",Z.wallet_requestPermissions="wallet_requestPermissions",(et||(et={})).requestAddressBook="requestAddressBook";class c{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:n})=>{let s=!this.isServer&&n===window.parent,i=void 0!==t.version&&parseInt(t.version.split(".")[0]),a=!0;return Array.isArray(this.allowedOrigins)&&(a=void 0!==this.allowedOrigins.find(t=>t.test(e))),!!t&&s&&"number"==typeof i&&i>=1&&a},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,n=this.callbacks.get(t);n&&(n(e),this.callbacks.delete(t))},this.send=(e,t)=>{let n=o.makeRequest(e,t);if(this.isServer)throw Error("Window doesn't exist");return window.parent.postMessage(n,"*"),new Promise((e,t)=>{this.callbacks.set(n.id,n=>{if(!n.success){t(Error(n.error));return}e(n)})})},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}}let u=e=>"object"==typeof e&&null!=e&&"domain"in e&&"types"in e&&"message"in e;n(29323);class l{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw Error("Invalid safeTxHash");return(await this.communicator.send(ee.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){return(await this.communicator.send(ee.signMessage,{message:e})).data}async signTypedMessage(e){if(!u(e))throw Error("Invalid typed data");return(await this.communicator.send(ee.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(ee.sendTransactions,{txs:e,params:t})).data}}let d={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"},f={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class p{constructor(e){this.communicator=e,this.call=this.buildRequest({call:d.eth_call,formatters:[null,f.defaultBlockParam]}),this.getBalance=this.buildRequest({call:d.eth_getBalance,formatters:[null,f.defaultBlockParam]}),this.getCode=this.buildRequest({call:d.eth_getCode,formatters:[null,f.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:d.eth_getStorageAt,formatters:[null,f.blockNumberToHex,f.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:d.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:d.eth_getBlockByHash,formatters:[null,f.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:d.eth_getBlockByNumber,formatters:[f.blockNumberToHex,f.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:d.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:d.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:d.eth_getTransactionCount,formatters:[null,f.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:d.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:d.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:d.safe_setSettings})}buildRequest(e){let{call:t,formatters:n}=e;return async e=>
1(n&&Array.isArray(e)&&n.forEach((t,n)=>{t&&(e[n]=t(e[n]))}),(await this.communicator.send(ee.rpcCall,{call:t,params:e||[]})).data)}}function h(e){return"string"==typeof e[0]?g(e):function(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),s=0;for(let t of e)n.set(t,s),s+=t.length;return n}(e)}function g(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}function y(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new P(e.type);return`${e.name}(${function e(t,{includeName:n=!1}={}){return t?t.map(t=>(function(t,{includeName:n}){return t.type.startsWith("tuple")?`(${e(t.components,{includeName:n})})${t.type.slice(5)}`:t.type+(n&&t.name?` ${t.name}`:"")})(t,{includeName:n})).join(n?", ":","):""}(e.inputs,{includeName:t})})`}function m(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}function E(e){return m(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}let T="2.21.18",v={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:T};class b extends Error{constructor(e,t={}){let n=t.cause instanceof b?t.cause.details:t.cause?.message?t.cause.message:t.details,s=t.cause instanceof b&&t.cause.docsPath||t.docsPath,i=v.getDocsUrl?.({...t,docsPath:s});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...v.version?[`Version: ${v.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=s,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=T}walk(e){return function e(t,n){return n?.(t)?t:t&&"object"==typeof t&&"cause"in t?e(t.cause,n):n?null:t}(this,e)}}class A extends b{constructor({expectedLength:e,givenLength:t,type:n}){super(`ABI encoding array length mismatch for type ${n}. 2Expected length: ${e} 3Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class I extends b{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${E(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class _ extends b{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch. 4Expected length (params): ${e} 5Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class S extends b{constructor(e,{docsPath:t}={}){super(`Function ${e?`"${e}" `:""}not found on ABI. 6Make sure you are using the correct ABI and that the function exists on it.`,{docsPath:t,name:"AbiFunctionNotFoundError"})}}class O extends b{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${y(e.abiItem)}\`, and`,`\`${t.type}\` in \`${y(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class w extends b{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`,{name:"BytesSizeMismatchError"})}}class N extends b{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type. 7Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class C extends b{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}class P extends b{constructor(e){super(`"${e}" is not a valid definition type. 8Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}}class D extends b{constructor({address:e}){super(`Address "${e}
8" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class M extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}class R extends b{constructor({offset:e,position:t,size:n}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}}class $ extends b{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function x(e,{dir:t,size:n=32}={}){return"string"==typeof e?L(e,{dir:t,size:n}):function(e,{dir:t,size:n=32}={}){if(null===n)return e;if(e.length>n)throw new $({size:e.length,targetSize:n,type:"bytes"});let s=new Uint8Array(n);for(let i=0;i<n;i++){let a="right"===t;s[a?i:n-i-1]=e[a?i:e.length-i-1]}return s}(e,{dir:t,size:n})}function L(e,{dir:t,size:n=32}={}){if(null===n)return e;let s=e.replace("0x","");if(s.length>2*n)throw new $({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s["right"===t?"padEnd":"padStart"](2*n,"0")}`}class B extends b{constructor({max:e,min:t,signed:n,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${8*s}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class U extends b{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function z(e,{size:t}){if(E(e)>t)throw new U({givenSize:E(e),maxSize:t})}let j=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function k(e,t={}){return"number"==typeof e||"bigint"==typeof e?W(e,t):"string"==typeof e?q(e,t):"boolean"==typeof e?H(e,t):G(e,t)}function H(e,t={}){let n=`0x${Number(e)}`;return"number"==typeof t.size?(z(n,{size:t.size}),x(n,{size:t.size})):n}function G(e,t={}){let n="";for(let t=0;t<e.length;t++)n+=j[e[t]];let s=`0x${n}`;return"number"==typeof t.size?(z(s,{size:t.size}),x(s,{dir:"right",size:t.size})):s}function W(e,t={}){let n;let{signed:s,size:i}=t,a=BigInt(e);i?n=s?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(n=BigInt(Number.MAX_SAFE_INTEGER));let r="bigint"==typeof n&&s?-n-1n:0;if(n&&a>n||a<r){let t="bigint"==typeof e?"n":"";throw new B({max:n?`${n}${t}`:void 0,min:`${r}${t}`,signed:s,size:i,value:`${e}${t}`})}let o=`0x${(s&&a<0?(1n<<BigInt(8*i))+BigInt(a):a).toString(16)}`;return i?x(o,{size:i}):o}let F=new TextEncoder;function q(e,t={}){return G(F.encode(e),t)}let V=new TextEncoder;function K(e,t={}){return"number"==typeof e||"bigint"==typeof e?Y(W(e,t)):"boolean"==typeof e?function(e,t={}){let n=new Uint8Array(1);return(n[0]=Number(e),"number"==typeof t.size)?(z(n,{size:t.size}),x(n,{size:t.size})):n}(e,t):m(e)?Y(e,t):J(e,t)}let X={zero:48,nine:57,A:65,F:70,a:97,f:102};function Q(e){return e>=X.zero&&e<=X.nine?e-X.zero:e>=X.A&&e<=X.F?e-(X.A-10):e>=X.a&&e<=X.f?e-(X.a-10):void 0}function Y(e,t={}){let n=e;t.size&&(z(n,{size:t.size}),n=x(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);let i=s.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=Q(s.charCodeAt(t++)),i=Q(s.charCodeAt(t++));if(void 0===n||void 0===i)throw new b(`Invalid byte sequence ("${s[t-2]}${s[t-1]}" in "${s}").`);a[e]=16*n+i}return a}function J(e,t={}){let n=V.encode(e);return"number"==typeof t.size?(z(n,{size:t.size}),x(n,{dir:"right",size:t.size})):n}var Z,ee,et,en=n(85875);function es(e,t){let n=(0,en.fr)(m(e,{strict:!1})?K(e):e);return"bytes"===(t||"hex")?n:k(n)}let ei=new M(8192),ea=/^0x[a-fA-F0-9]{40}$/,er=new M(8192);function eo(e,t){let{strict:n=!0}=t??{},s=`${e}.${n}`;if(er.has(s))return er.get(s);let i=!!ea.test(e)&&(e.toLowerCase()===e||!n||function(e,t){if(ei.has(`${e}.${t}`))return ei.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),s=es(J(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let e=0;e<40;e+=2)s[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&s[e>>1])>
8=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join("")}`;return ei.set(`${e}.${t}`,a),a}(e)===e);return er.set(s,i),i}function ec(e,t,n,{strict:s}={}){return m(e,{strict:!1})?function(e,t,n,{strict:s}={}){eu(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&el(i,t,n),i}(e,t,n,{strict:s}):function(e,t,n,{strict:s}={}){eu(e,t);let i=e.slice(t,n);return s&&el(i,t,n),i}(e,t,n,{strict:s})}function eu(e,t){if("number"==typeof t&&t>0&&t>E(e)-1)throw new R({offset:t,position:"start",size:E(e)})}function el(e,t,n){if("number"==typeof t&&"number"==typeof n&&E(e)!==n-t)throw new R({offset:n,position:"end",size:E(e)})}function ed(e,t){if(e.length!==t.length)throw new _({expectedLength:e.length,givenLength:t.length});let n=ef(function({params:e,values:t}){let n=[];for(let s=0;s<e.length;s++)n.push(function e({param:t,value:n}){let s=function(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}(t.type);if(s){let[i,a]=s;return function(t,{length:n,param:s}){let i=null===n;if(!Array.isArray(t))throw new C(t);if(!i&&t.length!==n)throw new A({expectedLength:n,givenLength:t.length,type:`${s.type}[${n}]`});let a=!1,r=[];for(let n=0;n<t.length;n++){let i=e({param:s,value:t[n]});i.dynamic&&(a=!0),r.push(i)}if(i||a){let e=ef(r);if(i){let t=W(r.length,{size:32});return{dynamic:!0,encoded:r.length>0?h([t,e]):t}}if(a)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:h(r.map(({encoded:e})=>e))}}(n,{length:i,param:{...t,type:a}})}if("tuple"===t.type)return function(t,{param:n}){let s=!1,i=[];for(let a=0;a<n.components.length;a++){let r=n.components[a],o=Array.isArray(t)?a:r.name,c=e({param:r,value:t[o]});i.push(c),c.dynamic&&(s=!0)}return{dynamic:s,encoded:s?ef(i):h(i.map(({encoded:e})=>e))}}(n,{param:t});if("address"===t.type)return function(e){if(!eo(e))throw new D({address:e});return{dynamic:!1,encoded:L(e.toLowerCase())}}(n);if("bool"===t.type)return function(e){if("boolean"!=typeof e)throw new b(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:L(H(e))}}(n);if(t.type.startsWith("uint")||t.type.startsWith("int"))return function(e,{signed:t}){return{dynamic:!1,encoded:W(e,{size:32,signed:t})}}(n,{signed:t.type.startsWith("int")});if(t.type.startsWith("bytes"))return function(e,{param:t}){let[,n]=t.type.split("bytes"),s=E(e);if(!n){let t=e;return s%32!=0&&(t=L(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:h([L(W(s,{size:32})),t])}}if(s!==Number.parseInt(n))throw new I({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:L(e,{dir:"right"})}}(n,{param:t});if("string"===t.type)return function(e){let t=q(e),n=Math.ceil(E(t)/32),s=[];for(let e=0;e<n;e++)s.push(L(ec(t,32*e,(e+1)*32),{dir:"right"}));return{dynamic:!0,encoded:h([L(W(E(t),{size:32})),...s])}}(n);throw new N(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}({param:e[s],value:t[s]}));return n}({params:e,values:t}));return 0===n.length?"0x":n}function ef(e){let t=0;for(let n=0;n<e.length;n++){let{dynamic:s,encoded:i}=e[n];s?t+=32:t+=E(i)}let n=[],s=[],i=0;for(let a=0;a<e.length;a++){let{dynamic:r,encoded:o}=e[a];r?(n.push(W(t+i,{size:32})),s.push(o),i+=E(o)):n.push(o)}return h([...n,...s])}let ep=e=>es(K(e)),eh=/^tuple(?<array>(\[(\d*)\])*)$/;function eg(e){let t="",n=e.length;for(let s=0;s<n;s++)t+=function e(t){let n=t.type;if(eh.test(t.type)&&"components"in t){n="(";let s=t.components.length;for(let i=0;i<s;i++)n+=e(t.components[i]),i<s-1&&(n+=", ");let i=function(e,t){let n=e.exec(t);return n?.groups}(eh,t.type);return n+=`)${i?.array??""}`,e({...t,type:n})}return("indexed"in t&&t.indexed&&(n=`${n}
8 indexed`),t.name)?`${n} ${t.name}`:n}(e[s]),s!==n-1&&(t+=", ");return t}let ey=e=>(function(e){let t=!0,n="",s=0,i="",a=!1;for(let r=0;r<e.length;r++){let o=e[r];if(["(",")",","].includes(o)&&(t=!0),"("===o&&s++,")"===o&&s--,t){if(0===s){if(" "===o&&["event","function",""].includes(i))i="";else if(i+=o,")"===o){a=!0;break}continue}if(" "===o){","!==e[r-1]&&","!==n&&",("!==n&&(n="",t=!1);continue}i+=o,n+=o}}if(!a)throw new b("Unable to normalize signature.");return i})("string"==typeof e?e:"function"===e.type?`function ${e.name}(${eg(e.inputs)})${e.stateMutability&&"nonpayable"!==e.stateMutability?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${eg(e.outputs)})`:""}`:"event"===e.type?`event ${e.name}(${eg(e.inputs)})`:"error"===e.type?`error ${e.name}(${eg(e.inputs)})`:"constructor"===e.type?`constructor(${eg(e.inputs)})${"payable"===e.stateMutability?" payable":""}`:"fallback"===e.type?"fallback()":"receive() external payable"),em=e=>ec(ep(ey(e)),0,4),eE="/docs/contract/encodeFunctionData";function eT(e){let{args:t}=e,{abi:n,functionName:s}=1===e.abi.length&&e.functionName?.startsWith("0x")?e:function(e){let{abi:t,args:n,functionName:s}=e,i=t[0];if(s){let e=function(e){let t;let{abi:n,args:s=[],name:i}=e,a=m(i,{strict:!1}),r=n.filter(e=>a?"function"===e.type?em(e)===i:"event"===e.type&&ep(ey(e))===i:"name"in e&&e.name===i);if(0!==r.length){if(1===r.length)return r[0];for(let e of r)if("inputs"in e){if(!s||0===s.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(e.inputs&&0!==e.inputs.length&&e.inputs.length===s.length&&s.every((t,n)=>{let s="inputs"in e&&e.inputs[n];return!!s&&function e(t,n){let s=typeof t,i=n.type;switch(i){case"address":return eo(t,{strict:!1});case"bool":return"boolean"===s;case"function":case"string":return"string"===s;default:if("tuple"===i&&"components"in n)return Object.values(n.components).every((n,s)=>e(Object.values(t)[s],n));if(/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(i))return"number"===s||"bigint"===s;if(/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(i))return"string"===s||t instanceof Uint8Array;
8if(/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(i))return Array.isArray(t)&&t.every(t=>e(t,{...n,type:i.replace(/(\[[0-9]{0,}\])$/,"")}));return!1}}(t,s)})){if(t&&"inputs"in t&&t.inputs){let n=function e(t,n,s){for(let i in t){let a=t[i],r=n[i];if("tuple"===a.type&&"tuple"===r.type&&"components"in a&&"components"in r)return e(a.components,r.components,s[i]);let o=[a.type,r.type];if(o.includes("address")&&o.includes("bytes20")||(o.includes("address")&&o.includes("string")||o.includes("address")&&o.includes("bytes"))&&eo(s[i],{strict:!1}))return o}}(e.inputs,t.inputs,s);if(n)throw new O({abiItem:e,type:n[0]},{abiItem:t,type:n[1]})}t=e}}return t||r[0]}}({abi:t,args:n,name:s});if(!e)throw new S(s,{docsPath:eE});i=e}if("function"!==i.type)throw new S(void 0,{docsPath:eE});return{abi:[i],functionName:em(y(i))}}(e),i=n[0];return g([s,("inputs"in i&&i.inputs?ed(i.inputs,t??[]):void 0)??"0x"])}let ev=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,eb=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function eA({data:e,primaryType:t,types:n}){return es(function e({data:t,primaryType:n,types:s}){let i=[{type:"bytes32"}],a=[function({primaryType:e,types:t}){return es(k(function({primaryType:e,types:t}){let n="",s=function e({primaryType:t,types:n},s=new Set){let i=t.match(/^\w*/u),a=i?.[0];if(s.has(a)||void 0===n[a])return s;for(let t of(s.add(a),n[a]))e({primaryType:t.type,types:n},s);return s}({primaryType:e,types:t});for(let i of(s.delete(e),[e,...Array.from(s).sort()]))n+=`${i}(${t[i].map(({name:e,type:t})=>`${t} ${e}`).join(",")})`;return n}({primaryType:e,types:t})))}({primaryType:n,types:s})];for(let r of s[n]){let[n,o]=function t({types:n,name:s,type:i,value:a}){if(void 0!==n[i])return[{type:"bytes32"},es(e({data:a,primaryType:i,types:n}))];if("bytes"===i){let e=a.length%2?"0":"";return[{type:"bytes32"},es(a=`0x${e+a.slice(2)}`)]}if("string"===i)return[{type:"bytes32"},es(k(a))];if(i.lastIndexOf("]")===i.length-1){let e=i.slice(0,i.lastIndexOf("[")),r=a.map(i=>t({name:s,type:e,types:n,value:i}));return[{type:"bytes32"},es(ed(r.map(([e])=>e),r.map(([,e])=>e)))]}return[{type:i},a]}({types:s,name:r.name,type:r.type,value:t[r.name]});i.push(n),a.push(o)}return ed(i,a)}({data:e,primaryType:t,types:n}))}class eI extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n,Object.setPrototypeOf(this,eI.prototype)}}class e_{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(ee.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new eI("Permissions request is invalid",4001);try{return(await this.communicator.send(ee.wallet_requestPermissions,e)).data}catch{throw new eI("Permissions rejected",4001)}}isPermissionRequestValid(e){return e.every(e=>"object"==typeof e&&Object.keys(e).every(e=>!!Object.values(et).includes(e)))}}let eS=(e,t)=>t.some(t=>t.parentCapability===e);class eO{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(ee.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(ee.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(ee.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){let n=await this.getInfo(),s=eT({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:d.eth_call,params:[{to:n.safeAddress,data:s},"latest"]};try{return"0x1626ba7e"===(await this.communicator.send(ee.rpcCall,i)).data.slice(0,10).toLowerCase()}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){let n=await this.getInfo(),s=eT({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:d.eth_call,params:[{to:n.safeAddress,data:s},"latest"]};try{return"0x20c13b0b"===(await this.communicator.send(ee.rpcCall,i)).data.slice(0,10).toLowerCase()}catch(e){return!1}}calculateMessageHash(e){return es(function(e){let t="string"==typeof e?q(e):"str
8ing"==typeof e.raw?e.raw:G(e.raw);return h([q(`�Ethereum Signed Message: 9${E(t)}`),t])}(e),void 0)}calculateTypedMessageHash(e){let t="object"==typeof e.domain.chainId?e.domain.chainId.toNumber():Number(e.domain.chainId),n=e.primaryType;if(!n){let t=Object.values(e.types),s=Object.keys(e.types).filter(e=>t.every(t=>t.every(({type:t})=>t.replace("[","").replace("]","")!==e)));if(0===s.length||s.length>1)throw Error("Please specify primaryType");n=s[0]}return function(e){let{domain:t={},message:n,primaryType:s}=e,i={EIP712Domain:function({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},"number"==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:n,primaryType:s,types:i}=e,a=(e,t)=>{for(let n of e){let{name:e,type:s}=n,r=t[e],o=s.match(eb);if(o&&("number"==typeof r||"bigint"==typeof r)){let[e,t,n]=o;W(r,{signed:"int"===t,size:Number.parseInt(n)/8})}if("address"===s&&"string"==typeof r&&!eo(r))throw new D({address:r});let c=s.match(ev);if(c){let[e,t]=c;if(t&&E(r)!==Number.parseInt(t))throw new w({expectedSize:Number.parseInt(t),givenSize:E(r)})}let u=i[s];u&&a(u,r)}};i.EIP712Domain&&t&&a(i.EIP712Domain,t),"EIP712Domain"!==s&&a(i[s],n)}({domain:t,message:n,primaryType:s,types:i});let a=["0x1901"];return t&&a.push(function({domain:e,types:t}){return eA({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:i})),"EIP712Domain"!==s&&a.push(eA({data:n,primaryType:s,types:i})),es(h(a))}({message:e.message,domain:{...e.domain,chainId:t,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt},types:e.types,primaryType:n})}async getOffChainSignature(e){return(await this.communicator.send(ee.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let n;if("string"==typeof e&&(n=async()=>{let n=this.calculateMessageHash(e);return await this.isMessageHashSigned(n,t)}),u(e)&&(n=async()=>{let n=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(n,t)}),n)return await n();throw Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){for(let n of[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)])if(await n(e,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(ee.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(ee.requestAddressBook,void 0)).data}}!function(e,t,n,s){var i,a=arguments.length,r=a<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(a<3?i(r):a>3?i(t,n,r):i(t,n))||r);a>3&&r&&Object.defineProperty(t,n,r)}([(e,t,n)=>{let s=n.value;return n.value=async function(){let e=new e_(this.communicator),n=await e.getPermissions();if(eS(t,n)||(n=await e.requestPermissions([{[t]:{}}])),!eS(t,n))throw new eI("Permissions rejected",4001);return s.apply(this)},n}],eO.prototype,"requestAddressBook",null);class ew{constructor(e={}){let{allowedDomains:t=null,debug:n=!1}=e;this.communicator=new c(t,n),this.eth=new p(this.communicator),this.txs=new l(this.communicator),this.safe=new eO(this.communicator),this.wallet=new e_(this.communicator)}}var eN=ew}}]);
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.