1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3871],{78633:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_BASE_URL=void 0,t.DEFAULT_BASE_URL="https://safe-client.safe.global"},62742:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.deleteEndpoint=t.getEndpoint=t.postEndpoint=void 0;let s=n(99185);function i(e,t,n,i){let r=(0,s.insertParams)(t,n),a=(0,s.stringifyQuery)(i);return`${e}${r}${a}`}t.postEndpoint=function(e,t,n){let r=i(e,t,null==n?void 0:n.path,null==n?void 0:n.query);return(0,s.fetchData)(r,null==n?void 0:n.body)},t.getEndpoint=function(e,t,n,r){if(r)return(0,s.fetchData)(r);let a=i(e,t,null==n?void 0:n.path,null==n?void 0:n.query);return(0,s.fetchData)(a)},t.deleteEndpoint=function(e,t,n){let r=i(e,t,null==n?void 0:n.path);return(0,s.deleteData)(r)}},10441: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.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.proposeTransaction=t.postSafeGasEstimation=t.getTransactionDetails=t.getTransactionQueue=t.getTransactionHistory=t.getCollectiblesPage=t.getCollectibles=t.getOwnedSafes=t.getFiatCurrencies=t.getBalances=t.getMultisigTransactions=t.getModuleTransactions=t.getIncomingTransfers=t.getSafeInfo=t.setBaseUrl=void 0;let r=n(62742),a=n(78633);i(n(61964),t),i(n(16261),t),i(n(31069),t),i(n(38558),t),i(n(44256),t),i(n(54948),t),i(n(76238),t),i(n(93134),t),i(n(60559),t);let o=a.DEFAULT_BASE_URL;t.setBaseUrl=e=>{o=e},t.getSafeInfo=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:e,address:t}})},t.getIncomingTransfers=function(e,t,n,s){return(0,r.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,r.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,r.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,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:e,address:t,currency:n},query:s})},t.getFiatCurrencies=function(){return(0,r.getEndpoint)(o,"/v1/balances/supported-fiat-codes")},t.getOwnedSafes=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:e,address:t}})},t.getCollectibles=function(e,t,n={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:n})},t.getCollectiblesPage=function(e,t,n={},s){return(0,r.getEndpoint)(o,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:e,address:t},query:n},s)},t.getTransactionHistory=function(e,t,n){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:e,safe_address:t},query:{}},n)},t.getTransactionQueue=function(e,t,n,s){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:e,safe_address:t},query:{trusted:s}},n)},t.getTransactionDetails=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:e,transactionId:t}})},t.postSafeGasEstimation=function(e,t,n){return(0,r.postEndpoint)(o,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:e,safe_address:t},body:n})},t.proposeTransaction=function(e,t,n){return(0,r.postEndpoint)(o,"/v1/c
1hains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:e,safe_address:t},body:n})},t.getChainsConfig=function(e){return(0,r.getEndpoint)(o,"/v1/chains",{query:e})},t.getChainConfig=function(e){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}",{path:{chainId:e}})},t.getSafeApps=function(e,t={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safe-apps",{path:{chainId:e},query:t})},t.getMasterCopies=function(e){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:e}})},t.getDecodedData=function(e,t,n){return(0,r.postEndpoint)(o,"/v1/chains/{chainId}/data-decoder",{path:{chainId:e},body:{data:t,to:n}})},t.getSafeMessages=function(e,t,n){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:e,safe_address:t},query:{}},n)},t.getSafeMessage=function(e,t){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:e,message_hash:t}})},t.proposeSafeMessage=function(e,t,n){return(0,r.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,r.postEndpoint)(o,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:e,message_hash:t},body:n})},t.getDelegates=function(e,t={}){return(0,r.getEndpoint)(o,"/v1/chains/{chainId}/delegates",{path:{chainId:e},query:t})},t.registerDevice=function(e){return(0,r.postEndpoint)(o,"/v1/register/notifications",{body:e})},t.unregisterSafe=function(e,t,n){return(0,r.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,r.deleteEndpoint)(o,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:e,uuid:t}})}},38558: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"},44256: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"},76238:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},54948:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},60559: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"},16261: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"},61964: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"},93134: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"},31069:function(e,t){var n,s,i,r,a,o,c,u,l,d;Object.defineProperty(t,"__esModule",{value:!0}),t.LabelValue=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",(r=t.TransactionTokenType||(t.TransactionTokenType={})).ERC20="ERC20",r.ERC721="ERC721",r.NATIVE_COIN="NATIVE_COIN",(a=t.SettingsInfoType||(t.SettingsInfoType={})).SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",a.ADD_OWNER="ADD_OWNER",a.REMOVE_OWNER="REMOVE_OWNER",a.SWAP_OWNER="SWAP_OWNER",a.CHANGE_THRESHOLD="CHANGE_THRESHOLD",a.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",a.ENABLE_MODULE="ENABLE_MODULE",a.DISABLE_MODULE="DISABLE_MODULE",a.SET_GUARD="SET_GUARD",a.DELETE_GUARD="DELETE_GUARD",(o=t.TransactionInfoType||(t.TransactionInfoType={})).TRANSFER="Transfer",o.SETTINGS_CHANGE="SettingsChange",o.CUSTOM="Custom",o.CREATION="Creation",(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.LabelValue||(t.LabelValue={})).Queued="Queued",d.Next="Next"},99185:function(e,t){var n=this&&this.__awaiter||function(e,t,n,s){return new(n||(n=Promise))(function(i,r){function a(e){try{c(s.next(e))}catch(e){r(e)}}function o(e){try{c(s.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,o)}c((s=s.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteData=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(t){if(e.headers&&"0"!==e.headers.get("content-length"))throw Error(`Invalid response content: ${e.statusText}`)}if(!e.ok)throw Error(s(t)?`${t.code}: ${t.message}`: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){return n(this,void 0,void 0,function*(){let n;return null!=t&&(n={method:"POST",body:"string"==typeof t?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}}),i((yield fetch(e,n)))})},t.deleteData=function(e){return n(this,void 0,void 0,function*(){return i((yield fetch(e,{method:"DELETE"})))})}},23871:function(e,t,n){n.d(t,{default:function(){return e8}});let s=()=>"9.1.0",i=e=>e.toString(16).padStart(2,"0"),r=e=>{let t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,i).join("")},a=()=>"undefined"!=typeof window?r(10):new Date().getTime().toString(36);class o{}o.makeRequest=(e,t)=>
1({id:a(),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}),(e2=e3||(e3={})).sendTransactions="sendTransactions",e2.rpcCall="rpcCall",e2.getChainInfo="getChainInfo",e2.getSafeInfo="getSafeInfo",e2.getTxBySafeTxHash="getTxBySafeTxHash",e2.getSafeBalances="getSafeBalances",e2.signMessage="signMessage",e2.signTypedMessage="signTypedMessage",e2.getEnvironmentInfo="getEnvironmentInfo",e2.getOffChainSignature="getOffChainSignature",e2.requestAddressBook="requestAddressBook",e2.wallet_getPermissions="wallet_getPermissions",e2.wallet_requestPermissions="wallet_requestPermissions",(e4||(e4={})).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]),r=!0;return Array.isArray(this.allowedOrigins)&&(r=void 0!==this.allowedOrigins.find(t=>t.test(e))),!!t&&s&&"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,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(10441);class l{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw Error("Invalid safeTxHash");return(await this.communicator.send(e3.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){return(await this.communicator.send(e3.signMessage,{message:e})).data}async signTypedMessage(e){if(!u(e))throw Error("Invalid typed data");return(await this.communicator.send(e3.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(e3.sendTransactions,{txs:e,params:t})).data}}let d="eth_call",f=(e="latest")=>e,h=(e=!1)=>e,p=e=>Number.isInteger(e)?`0x${e.toString(16)}`:e;class g{constructor(e){this.communicator=e,this.call=this.buildRequest({call:d,formatters:[null,f]}),this.getBalance=this.buildRequest({call:"eth_getBalance",formatters:[null,f]}),this.getCode=this.buildRequest({call:"eth_getCode",formatters:[null,f]}),this.getStorageAt=this.buildRequest({call:"eth_getStorageAt",formatters:[null,p,f]}),this.getPastLogs=this.buildRequest({call:"eth_getLogs"}),this.getBlockByHash=this.buildRequest({call:"eth_getBlockByHash",formatters:[null,h]}),this.getBlockByNumber=this.buildRequest({call:"eth_getBlockByNumber",formatters:[p,h]}),this.getTransactionByHash=this.buildRequest({call:"eth_getTransactionByHash"}),this.getTransactionReceipt=this.buildRequest({call:"eth_getTransactionReceipt"}),this.getTransactionCount=this.buildRequest({call:"eth_getTransactionCount",formatters:[null,f]}),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:n}=e;return async e=>(n&&Array.isArray(e)&&n.forEach((t,n)=>{t&&(e[n]=t(e[n]))}),(await this.communicator.send(e3.rpcCall,{call:t,params:e||[]})).data)}}function y(e){return"string"==typeof e[0]?m(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 m(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}function E(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new D(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 b(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}function I(e){return b(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}let T="2.21.2",A={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:T};
1class v extends Error{constructor(e,t={}){let n=t.cause instanceof v?t.cause.details:t.cause?.message?t.cause.message:t.details,s=t.cause instanceof v&&t.cause.docsPath||t.docsPath,i=A.getDocsUrl?.({...t,docsPath:s});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...A.version?[`Version: ${A.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 S extends v{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 w extends v{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${I(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class O extends v{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch. 4Expected length (params): ${e} 5Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class _ extends v{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 N extends v{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${E(e.abiItem)}\`, and`,`\`${t.type}\` in \`${E(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class C extends v{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`,{name:"BytesSizeMismatchError"})}}class M extends v{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type. 7Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class $ extends v{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}class D extends v{constructor(e){super(`"${e}" is not a valid definition type. 8Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}}class x extends v{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class P extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}class L extends v{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 R extends v{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 B(e,{dir:t,size:n=32}={}){return"string"==typeof e?U(e,{dir:t,size:n}):function(e,{dir:t,size:n=32}={}){if(null===n)return e;if(e.length>n)throw new R({size:e.length,targetSize:n,type:"bytes"});let s=new Uint8Array(n);for(let i=0;i<n;i++){let r="right"===t;s[r?i:n-i-1]=e[r?i:e.length-i-1]}return s}(e,{dir:t,size:n})}function U(e,{dir:t,size:n=32}={}){if(null===n)return e;let s=e.replace("0x","");if(s.length>2*n)throw new R({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s["right"===t?"padEnd":"padStart"](2*n,"0")}`}class z extends v{constructor({max:e,min:t,signed:n,size:s,value:i}
8){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 k extends v{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function j(e,{size:t}){if(I(e)>t)throw new k({givenSize:I(e),maxSize:t})}let H=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function F(e,t={}){return"number"==typeof e||"bigint"==typeof e?W(e,t):"string"==typeof e?K(e,t):"boolean"==typeof e?G(e,t):q(e,t)}function G(e,t={}){let n=`0x${Number(e)}`;return"number"==typeof t.size?(j(n,{size:t.size}),B(n,{size:t.size})):n}function q(e,t={}){let n="";for(let t=0;t<e.length;t++)n+=H[e[t]];let s=`0x${n}`;return"number"==typeof t.size?(j(s,{size:t.size}),B(s,{dir:"right",size:t.size})):s}function W(e,t={}){let n;let{signed:s,size:i}=t,r=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 a="bigint"==typeof n&&s?-n-1n:0;if(n&&r>n||r<a){let t="bigint"==typeof e?"n":"";throw new z({max:n?`${n}${t}`:void 0,min:`${a}${t}`,signed:s,size:i,value:`${e}${t}`})}let o=`0x${(s&&r<0?(1n<<BigInt(8*i))+BigInt(r):r).toString(16)}`;return i?B(o,{size:i}):o}let V=new TextEncoder;function K(e,t={}){return q(V.encode(e),t)}let X=new TextEncoder;function Q(e,t={}){return"number"==typeof e||"bigint"==typeof e?Z(W(e,t)):"boolean"==typeof e?function(e,t={}){let n=new Uint8Array(1);return(n[0]=Number(e),"number"==typeof t.size)?(j(n,{size:t.size}),B(n,{size:t.size})):n}(e,t):b(e)?Z(e,t):ee(e,t)}let Y={zero:48,nine:57,A:65,F:70,a:97,f:102};function J(e){return e>=Y.zero&&e<=Y.nine?e-Y.zero:e>=Y.A&&e<=Y.F?e-(Y.A-10):e>=Y.a&&e<=Y.f?e-(Y.a-10):void 0}function Z(e,t={}){let n=e;t.size&&(j(n,{size:t.size}),n=B(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);let i=s.length/2,r=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=J(s.charCodeAt(t++)),i=J(s.charCodeAt(t++));if(void 0===n||void 0===i)throw new v(`Invalid byte sequence ("${s[t-2]}${s[t-1]}" in "${s}").`);r[e]=16*n+i}return r}function ee(e,t={}){let n=X.encode(e);return"number"==typeof t.size?(j(n,{size:t.size}),B(n,{dir:"right",size:t.size})):n}function et(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function en(e,...t){if(!(e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function es(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}let ei=BigInt(4294967296-1),er=BigInt(32),ea=(e,t,n)=>e<<n|t>>>32-n,eo=(e,t,n)=>t<<n|e>>>32-n,ec=(e,t,n)=>t<<n-32|e>>>64-n,eu=(e,t,n)=>e<<n-32|t>>>64-n,el=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),ed=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],ef=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function eh(e){for(let t=0;t<e.length;t++)e[t]=ef(e[t])}function ep(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}(e)),en(e),e}class eg{clone(){return this._cloneInto()}}let ey=[],em=[],eE=[],eb=BigInt(0),eI=BigInt(1),eT=BigInt(2),eA=BigInt(7),ev=BigInt(256),eS=BigInt(113);for(let e=0,t=eI,n=1,s=0;e<24;e++){[n,s]=[s,(2*n+3*s)%5],ey.push(2*(5*s+n)),em.push((e+1)*(e+2)/2%64);let i=eb;for(let e=0;e<7;e++)(t=(t<<eI^(t>>eA)*eS)%ev)&eT&&(i^=eI<<(eI<<BigInt(e))-eI);eE.push(i)}let[ew,eO]=function(e,t=!1){let n=new Uint32Array(e.length),s=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:r,l:a}=function(e,t=!1){return t?{h:Number(e&ei),l:Number(e>>er&ei)}:{h:0|Number(e>>er&ei),l:0|Number(e&ei)}}(e[i],t);[n[i],s[i]]=[r,a]}return[n,s]}(eE,!0),e_=(e,t,n)=>n>32?ec(e,t,n):ea(e,t,n),eN=(e,t,n)=>n>32?eu(e,t,n):eo(e,t,n);class eC extends eg{constructor(e,t,n,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,et(n),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=el(this.state)}keccak(){ed||eh(this.state32),function(e,t=24){let n=new Uint32Array(10);for(let s=24-t;s<24;s++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let s=(t+8)%10,i=(t+2)%10,r=n[i],a=n[i+1],o=e_(r,a,1)^n[s],c=eN(r,a,1)^n[s+1];for(let n=0;n<50;n+=10)e[t+n]^=o,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let s=em[n],r=e_(t,i,s),a=eN(t,i,s),o=ey[n];t=e[o],i=e[o+1],e[o]=r,e[o+1]=a}for(let t=0;t<50;t+=10){for(let s=0;s<10;s++)n[s]=e[t+s];for(let s=0;s<10;s++)e[t+s]^=~n[(s+2)%10]&n[(s+4)%10]}e[0]^=ew[s],e[1]^=eO[s]}n.fill(0)}(this.state32,this.rounds),ed||eh(this.state32),this.posOut=0,this.pos=0}update(e){es(this);let{blockLen:t,state:n}=this,s=(e=ep(e)).length;for(let i=0;i<s;){let r=Math.min(t-this.pos,s-i);for(let t=0;t<r;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:s}=this;e[n]^=t,(128&t)!=0&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){es(this,!1),en(e),this.finish();let t=this.state,{blockLen:n}=this;for(let s=0,i=e.length;s<i;){this.posOut>=n&&this.keccak();let r=Math.min(n-this.posOut,i-s);e.set(t.subarray(this.posOut,this.posOut+r),s),this.posOut+=r,s+=r}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return et(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(!function(e,t){en(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:s,rounds:i,enableXOF:r}=this;return e||(e=new eC(t,n,s,r,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=s,e.enableXOF=r,e.destroyed=this.destroyed,e}}let eM=function(e){let t=t=>e().update(ep(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}(()=>new eC(136,1,32));function e$(e,t){let n=eM(b(e,{strict:!1})?Q(e):e);return"bytes"===(t||"hex")?n:F(n)}let eD=new P(8192),ex=/^0x[a-fA-F0-9]{40}$/,eP=new P(8192);function eL(e,t){let{strict:n=!0}=t??{},s=`${e}.${n}`;if(eP.has(s))return eP.get(s);let i=!!ex.test(e)&&(e.toLowerCase()===e||!n||function(e,t){if(eD.has(`${e}.undefined`))return eD.get(`${e}.undefined`);let n=e.substring(2).toLowerCase(),s=e$(ee(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 r=`0x${i.join("")}`;return eD.set(`${e}.${t}`,r),r}(e)===e);return eP.set(s,i),i}function eR(e,t,n,{strict:s}={}){return b(e,{strict:!1})?function(e,t,n,{strict:s}={}){eB(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&eU(i,t,n),i}(e,t,n,{strict:s}):function(e,t,n,{strict:s}={}){eB(e,t);let i=e.slice(t,n);return s&&eU(i,t,n),i}(e,t,n,{strict:s})}function eB(e,t){if("number"==typeof t&&t>0&&t>I(e)-1)throw new L({offset:t,position:"start",size:I(e)})}function eU(e,t,n){if("number"==typeof t&&"number"==typeof n&&I(e)!==n-t)throw new L({offset:n,position:"end",size:I(e)})}function ez(e,t){if(e.length!==t.length)throw new O({expectedLength:e.length,givenLength:t.length});let n=ek(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,r]=s;return function(t,{length:n,param:s}){let i=null===n;if(!Array.isArray(t))throw new $(t);if(!i&&t.length!==n)throw new S({expectedLength:n,givenLength:t.length,type:`${s.type}[${n}]`});let r=!1,a=[];for(let n=0;n<t.length;n++){let i=e({param:s,value:t[n]});i.dynamic&&(r=!0),a.push(i)}if(i||r){let e=ek(a);if(i){let t=W(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?y([t,e]):t}}if(r)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:y(a.map(({encoded:e})=>e))}}(n,{length:i,param:{...t,type:r}})}if("tuple"===t.type)return function(t,{param:n}){let s=!1,i=[];for(let r=0;r<n.components.length;r++){let a=n.components[r],o=Array.isArray(t)?r:a.name,c=e({param:a,value:t[o]});i.push(c),c.dynamic&&(s=!0)}return{dynamic:s,encoded:s?ek(i):y(i.map(({encoded:e})=>e))}}(n,{param:t});if("address"===t.type)return function(e){if(!eL(e))throw new x({address:e});return{dynamic:!1,encoded:U(e.toLowerCase())}}(n);if("bool"===t.type)return function(e){if("boolean"!=typeof e)throw new v(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:U(G(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=I(e);if(!n){let t=e;return s%32!=0&&(t=U(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:y([U(W(s,{size:32})),t])}}if(s!==Number.parseInt(n))throw new w({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:U(e,{dir:"right"})}}(n,{param:t});if("string"===t.type)return function(e){let t=K(e),n=Math.ceil(I(t)/32),s=[];for(let e=0;e<n;e++)s.push(U(eR(t,32*e,(e+1)*32),{dir:"right"}));return{dynamic:!0,encoded:y([U(W(I(t),{size:32})),...s])}}(n);throw new M(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 ek(e){let t=0;for(let n=0;n<e.length;n++){let{dynamic:s,encoded:i}=e[n];s?t+=32:t+=I(i)}let n=[],s=[],i=0;for(let r=0;r<e.length;r++){let{dynamic:a,encoded:o}=e[r];a?(n.push(W(t+i,{size:32})),s.push(o),i+=I(o)):n.push(o)}return y([...n,...s])}let ej=e=>e$(Q(e)),eH=/^tuple(?<array>(\[(\d*)\])*)$/;function eF(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 eG=e=>(function(e){let t=!0,n="",s=0,i="",r=!1;for(let a=0;a<e.length;a++){let o=e[a];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){r=!0;break}continue}if(" "===o){","!==e[a-1]&&","!==n&&",("!==n&&(n="",t=!1);continue}i+=o,n+=o}}if(!r)throw new v("Unable to normalize signature.");return i})("string"==typeof e?e:"function"===e.type?`function ${e.name}(${eF(e.inputs)})${e.stateMutability&&"nonpayable"!==e.stateMutability?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${eF(e.outputs)})`:""}`:"event"===e.type?`event ${e.name}(${eF(e.inputs)})`:"error"===e.type?`error ${e.name}(${eF(e.inputs)})`:"constructor"===e.type?`constructor(${eF(e.inputs)})${"payable"===e.stateMutability?" payable":""}`:"fallback"===e.type?"fallback()":"receive() external payable"),eq=e=>eR(ej(eG(e)),0,4),eW="/docs/contract/encodeFunctionData";function eV(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,r=b(i,{strict:!1}),a=n.filter(e=>r?"function"===e.type?eq(e)===i:"event"===e.type&&ej(eG(e))===i:"name"in e&&e.name===i);if(0!==a.length){if(1===a.length)return a[0];for(let e of a)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 eL(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 r=t[i],a=n[i];if("tuple"===r.type&&"tuple"===a.type&&"components"in r&&"components"in a)return e(r.components,a.components,s[i]);let o=[r.type,a.type];if(o.includes("address")&&o.includes("bytes20")||(o.includes("address")&&o.includes("string")||o.includes("address")&&o.includes("bytes"))&&eL(s[i],{strict:!1}))return o}}(e.inputs,t.inputs,s);if(n)throw new N({abiItem:e,type:n[0]},{abiItem:t,type:n[1]})}t=e}}return t||a[0]}}({abi:t,args:n,name:s});if(!e)throw new _(s,{docsPath:eW});i=e}if("function"!==i.type)throw new _(void 0,{docsPath:eW});return{abi:[i],functionName:eq(E(i))}}(e),i=n[0];return m([s,("inputs"in i&&i.inputs?ez(i.inputs,t??[]):void 0)??"0x"])}let eK=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,eX=/^(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 eQ({data:e,primaryType:t,types:n}){return e$(function e({data:t,primaryType:n,types:s}){let i=[{type:"bytes32"}],r=[function({primaryType:e,types:t}){return e$(F(function({primaryType:e,types:t}){let n="",s=function e({primaryType:t,types:n},s=new Set){let i=t.match(/^\w*/u),r=i?.[0];if(s.has(r)||void 0===n[r])return s;for(let t of(s.add(r),n[r]))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 a of s[n]){let[n,o]=function t({types:n,name:s,type:i,value:r}){if(void 0!==n[i])return[{type:"bytes32"},e$(e({data:r,primaryType:i,types:n}))];if("bytes"===i){let e=r.length%2?"0":"";return[{type:"bytes32"},e$(r=`0x${e+r.slice(2)}`)]}if("string"===i)return[{type:"bytes32"},e$(F(r))];if(i.lastIndexOf("]")===i.length-1){let e=i.slice(0,i.lastIndexOf("[")),a=r.map(i=>t({name:s,type:e,types:n,value:i}));return[{type:"bytes32"},e$(ez(a.map(([e])=>e),a.map(([,e])=>e)))]}return[{type:i},r]}({types:s,name:a.name,type:a.type,value:t[a.name]});i.push(n),r.push(o)}return ez(i,r)}({data:e,primaryType:t,types:n}))}class eY extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n,Object.setPrototypeOf(this,eY.prototype)}}class eJ{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(e3.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new eY("Permissions request is invalid",4001);try{return(await this.communicator.send(e3.wallet_requestPermissions,e)).data}catch{throw new eY("Permissions rejected",4001)}}isPermissionRequestValid(e){return e.every(e=>"object"==typeof e&&Object.keys(e).every(e=>!!Object.values(e4).includes(e)))}}let eZ=(e,t)=>t.some(t=>t.parentCapability===e);class e0{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(e3.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(e3.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(e3.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){let n=await this.getInfo(),s=eV({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,params:[{to:n.safeAddress,data:s},"latest"]};try{return"0x1626ba7e"===(await this.communicator.send(e3.rpcCall,i)).data.slice(0,10).toLowerCase()}catch(e){return!1}}async check1271SignatureBytes(e,t="0x"){let n=await this.getInfo(),s=eV({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,params:[{to:n.safeAddress,data:s},"latest"]};try{return"0x20c13b0b"===(await this.communicator.send(e3.rpcCall,i)).data.slice(0,10).toLowerCase()}catch(e){return!1}}calculateMessageHash(e){return e$(function(e){let t="string"==typeof e?K(e):"string"==typeof e.raw?e.raw:q(e.raw);return y([K(`\x19Ethereum Signed Message: 9${I(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");
9n=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,r=(e,t)=>{for(let n of e){let{name:e,type:s}=n,a=t[e],o=s.match(eX);if(o&&("number"==typeof a||"bigint"==typeof a)){let[e,t,n]=o;W(a,{signed:"int"===t,size:Number.parseInt(n)/8})}if("address"===s&&"string"==typeof a&&!eL(a))throw new x({address:a});let c=s.match(eK);if(c){let[e,t]=c;if(t&&I(a)!==Number.parseInt(t))throw new C({expectedSize:Number.parseInt(t),givenSize:I(a)})}let u=i[s];u&&r(u,a)}};i.EIP712Domain&&t&&r(i.EIP712Domain,t),"EIP712Domain"!==s&&r(i[s],n)}({domain:t,message:n,primaryType:s,types:i});let r=["0x1901"];return t&&r.push(function({domain:e,types:t}){return eQ({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:i})),"EIP712Domain"!==s&&r.push(eQ({data:n,primaryType:s,types:i})),e$(y(r))}({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(e3.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(e3.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(e3.requestAddressBook,void 0)).data}}!function(e,t,n,s){var i,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(a=(r<3?i(a):r>3?i(t,n,a):i(t,n))||a);r>3&&a&&Object.defineProperty(t,n,a)}([(e,t,n)=>{let s=n.value;return n.value=async function(){let e=new eJ(this.communicator),n=await e.getPermissions();if(eZ(t,n)||(n=await e.requestPermissions([{[t]:{}}])),!eZ(t,n))throw new eY("Permissions rejected",4001);return s.apply(this)},n}],e0.prototype,"requestAddressBook",null);class e1{constructor(e={}){let{allowedDomains:t=null,debug:n=!1}=e;this.communicator=new c(t,n),this.eth=new g(this.communicator),this.txs=new l(this.communicator),this.safe=new e0(this.communicator),this.wallet=new eJ(this.communicator)}}var e2,e3,e4,e8=e1}}]);
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.