1import{d4 as O,d5 as te}from"./index-wJ_mvtmj.js";import{h as ye,a as pe}from"./hashMessage-DeK1q_17.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aacbbdc0-cee8-45cc-932e-3f2919ee7672",e._sentryDebugIdIdentifier="sentry-dbid-aacbbdc0-cee8-45cc-932e-3f2919ee7672")}catch{}})();{var w=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};w._sentryModuleMetadata=w._sentryModuleMetadata||{},w._sentryModuleMetadata[new w.Error().stack]=Object.assign({},w._sentryModuleMetadata[new w.Error().stack],{"_sentryBundlerPluginAppKey:venus-evm":!0})}const se=()=>"9.1.0",me=e=>e.toString(16).padStart(2,"0"),_e=e=>{const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t,me).join("")},Ee=()=>typeof window<"u"?_e(10):new Date().getTime().toString(36);class L{}L.makeRequest=(e,t)=>({id:Ee(),method:e,params:t,env:{sdkVersion:se()}});L.makeResponse=(e,t,i)=>({id:e,success:!0,version:i,data:t});L.makeErrorResponse=(e,t,i)=>({id:e,success:!1,error:t,version:i});var y;(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"})(y||(y={}));var k;(function(e){e.requestAddressBook="requestAddressBook"})(k||(k={}));class Te{constructor(t=null,i=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:a,data:c,source:r})=>{const u=!c,l=!this.isServer&&r===window.parent,p=typeof c.version<"u"&&parseInt(c.version.split(".")[0]),b=typeof p=="number"&&p>=1;let _=!0;return Array.isArray(this.allowedOrigins)&&(_=this.allowedOrigins.find(E=>E.test(a))!==void 0),!u&&l&&b&&_},this.logIncomingMessage=a=>{console.info(`Safe Apps SDK v1: A message was received from origin ${a.origin}. `,a.data)},this.onParentMessage=a=>{this.isValidMessage(a)&&(this.debugMode&&this.logIncomingMessage(
1a),this.handleIncomingMessage(a.data))},this.handleIncomingMessage=a=>{const{id:c}=a,r=this.callbacks.get(c);r&&(r(a),this.callbacks.delete(c))},this.send=(a,c)=>{const r=L.makeRequest(a,c);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(r,"*"),new Promise((u,l)=>{this.callbacks.set(r.id,p=>{if(!p.success){l(new Error(p.error));return}u(p)})})},this.allowedOrigins=t,this.debugMode=i,this.isServer||window.addEventListener("message",this.onParentMessage)}}const ee=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var R={},v={},S={},Z={exports:{}};(function(e,t){var i=typeof self<"u"?self:O,a=function(){function r(){this.fetch=!1,this.DOMException=i.DOMException}return r.prototype=i,new r}();(function(r){(function(u){var l={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};function p(n){return n&&DataView.prototype.isPrototypeOf(n)}if(l.arrayBuffer)var b=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],_=ArrayBuffer.isView||function(n){return n&&b.indexOf(Object.prototype.toString.call(n))>-1};function E(n){if(typeof n!="string"&&(n=String(n)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(n))throw new TypeError("Invalid character in header field name");return n.toLowerCase()}function U(n){return typeof n!="string"&&(n=String(n)),n}function N(n){var s={next:function(){var o=n.shift();return{done:o===void 0,value:o}}};return l.iterable&&(s[Symbol.iterator]=function(){return s}),s}function g(n){this.map={},n instanceof g?n.forEach(function(s,o){this.append(o,s)},this):Array.isArray(n)?n.forEach(function(s){this.append(s[0],s[1])},this):n&&Object.getOwnPropertyNames(n).forEach(function(s){this.append(s,n[s])},this)}g.prototype.append=function(n,s){n=E(n),s=U(s);var o=this.map[n];this.map[n]=o?o+", "+s:s},g.prototype.delete=function(n){delete this.map[E(n)]},g.prototype.get=function(n){return n=E(n),this.has(n)?this.map[n]:null},g.prototype.has=function(n){return this.map.hasOwnProperty(E(n))},g.prototype.set=function(n,s){this.map[E(n)]=U(s)},g.prototype.forEach=function(n,s){for(var o in this.map)this.map.hasOwnProperty(o)&&n.call(s,this.map[o],o,this)},g.prototype.keys=function(){var n=[];return this.forEach(function(s,o){n.push(o)}),N(n)},g.prototype.values=function(){var n=[];return this.forEach(function(s){n.push(s)}),N(n)},g.prototype.entries=function(){var n=[];return this.forEach(function(s,o){n.push([o,s])}),N(n)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function C(n){if(n.bodyUsed)return Promise.reject(new TypeError("Already read"));n.bodyUsed=!0}function H(n){return new Promise(function(s,o){n.onload=function(){s(n.result)},n.onerror=function(){o(n.error)}})}function V(n){var s=new FileReader,o=H(s);return s.readAsArrayBuffer(n),o}function W(n){var s=new FileReader,o=H(s);return s.readAsText(n),o}function K(n){for(var s=new Uint8Array(n),o=new Array(s.length),f=0;f<s.length;f++)o[f]=String.fromCharCode(s[f]);return o.join("")}
vendor: 5,040 bytes, line 1
1function j(n){if(n.slice)return n.slice(0);var s=new Uint8Array(n.byteLength);return s.set(new Uint8Array(n)),s.buffer}function q(){return this.bodyUsed=!1,this._initBody=function(n){this._bodyInit=n,n?typeof n=="string"?this._bodyText=n:l.blob&&Blob.prototype.isPrototypeOf(n)?this._bodyBlob=n:l.formData&&FormData.prototype.isPrototypeOf(n)?this._bodyFormData=n:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(n)?this._bodyText=n.toString():l.arrayBuffer&&l.blob&&p(n)?(this._bodyArrayBuffer=j(n.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(n)||_(n))?this._bodyArrayBuffer=j(n):this._bodyText=n=Object.prototype.toString.call(n):this._bodyText="",this.headers.get("content-type")||(typeof n=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(n)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var n=C(this);if(n)return n;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?C(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(V)}),this.text=function(){var n=C(this);if(n)return n;if(this._bodyBlob)return W(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(K(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(Q)}),this.json=function(){return this.text().then(JSON.parse)},this}var X=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(n){var s=n.toUpperCase();return X.indexOf(s)>-1?s:n}function A(n,s){s=s||{};var o=s.body;if(n instanceof A){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url,this.credentials=n.credentials,s.headers||(this.headers=new g(n.headers)),this.method=n.method,this.mode=n.mode,this.signal=n.signal,!o&&n._bodyInit!=null&&(o=n._bodyInit,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=s.credentials||this.credentials||"same-origin",(s.headers||!this.headers)&&(this.headers=new g(s.headers)),this.method=$(s.method||this.method||"GET"),this.mode=s.mode||this.mode||null,this.signal=s.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})};function Q(n){var s=new FormData;return n.trim().split("&").forEach(function(o){if(o){var f=o.split("="),h=f.shift().replace(/\+/g," "),d=f.join("=").replace(/\+/g," ");s.append(decodeURIComponent(h),decodeURIComponent(d))}}),s}function z(n){var s=new g,o=n.replace(/\r?\n[\t ]+/g," ");return o.split(/\r?\n/).forEach(function(f){var h=f.split(":"),d=h.shift().trim();if(d){var F=h.join(":").trim();s.append(d,F)}}),s}q.call(A.prototype);function T(n,s){s||(s={}),this.type="default",this.status=s.status===void 0?200:s.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in s?s.statusText:"OK",this.headers=new g(s.headers),this.url=s.url||"",this._initBody(n)}q.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},T.error=function(){var n=new T(null,{status:0,statusText:""});return n.type="error",n};var Y=[301,302,303,307,308];T.redirect=function(n,s){if(Y.indexOf(s)===-1)throw new RangeError("Invalid status code");return new T(null,{status:s,headers:{location:n}})},u.DOMException=r.DOMException;try{new u.DOMException}catch{u.DOMException=function(s,o){this.message=s,this.name=o;var f=Error(s);this.stack=f.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function P(n,s){return new Promise(function(o,f){var h=new A(n,s);if(h.signal&&h.signal.aborted)return f(new u.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function F(){d.abort()}d.onload=function(){var D={status:d.status,statusText:d.statusText,headers:z(d.getAllResponseHeaders()||"")};D.url="responseURL"in d?d.responseURL:D.headers.get("X-Request-URL");var J="response"in d?d.response:d.responseText;o(new T(J,D))},d.onerror=function(){f(new TypeError("Network request failed"))},d.ontimeout=function(){f(new TypeError("Network request failed"))},d.onabort=function(){f(new u.DOMException("Aborted","AbortError"))},d.open(h.method,h.url,!0),h.credentials==="include"?d.withCredentials=!0:h.credentials==="omit"&&(d.withCredentials=!1),"responseType"in d&&l.blob&&(d.responseType="blob"),h.headers.forEac
1h(function(D,J){d.setRequestHeader(J,D)}),h.signal&&(h.signal.addEventListener("abort",F),d.onreadystatechange=function(){d.readyState===4&&h.signal.removeEventListener("abort",F)}),d.send(typeof h._bodyInit>"u"?null:h._bodyInit)})}return P.polyfill=!0,r.fetch||(r.fetch=P,r.Headers=g,r.Request=A,r.Response=T),u.Headers=g,u.Request=A,u.Response=T,u.fetch=P,Object.defineProperty(u,"__esModule",{value:!0}),u})({})})(a),a.fetch.ponyfill=!0,delete a.fetch.polyfill;var c=a;t=c.fetch,t.default=c.fetch,t.fetch=c.fetch,t.Headers=c.Headers,t.Request=c.Request,t.Response=c.Response,e.exports=t})(Z,Z.exports);var be=Z.exports,Ae=O&&O.__awaiter||function(e,t,i,a){function c(r){return r instanceof i?r:new i(function(u){u(r)})}return new(i||(i=Promise))(function(r,u){function l(_){try{b(a.next(_))}catch(E){u(E)}}function p(_){try{b(a.throw(_))}catch(E){u(E)}}function b(_){_.done?r(_.value):c(_.value).then(l,p)}b((a=a.apply(e,t||[])).next())})},Ie=O&&O.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(S,"__esModule",{value:!0});S.fetchData=S.stringifyQuery=S.insertParams=void 0;const Oe=Ie(be),Se=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function we(e,t,i){return e.replace(new RegExp(`\\{${t}\\}`,"g"),i)}function ve(e,t){return t?Object.keys(t).reduce((i,a)=>we(i,a,String(t[a])),e):e}S.insertParams=ve;function Ne(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach(a=>{e[a]!=null&&t.append(a,String(e[a]))});const i=t.toString();return i?`?${i}`:""}S.stringifyQuery=Ne;function Ce(e,t){return Ae(this,void 0,void 0,function*(){let i;t!=null&&(i={method:"POST",body:typeof t=="string"?t:JSON.stringify(t),headers:{"Content-Type":"application/json"}});const a=yield(0,Oe.default)(e,i);let c;try{c=yield a.json()}catch{if(a.headers&&a.headers.get("content-length")!=="0")throw new Error(`Invalid response content: ${a.statusText}`)}if(!a.ok){const r=Se(c)?`${c.code}: ${c.message}`:a.statusText;throw new Error(r)}return c})}S.fetchData=Ce;Object.defineProperty(v,"__esModule",{value:!0});v.getEndpoint=v.postEndpoint=void 0;const B=S;function ae(e,t,i,a){const c=(0,B.insertParams)(t,i),r=(0,B.stringifyQuery)(a);return`${e}${c}${r}`}function Pe(e,t,i){const a=ae(e,t,i==null?void 0:i.path,i==null?void 0:i.query);return(0,B.fetchData)(a,i==null?void 0:i.body)}v.postEndpoint=Pe;function De(e,t,i,a){if(a)return(0,B.fetchData)(a);const c=ae(e,t,i==null?void 0:i.path,i==null?void 0:i.query);return(0,B.fetchData)(c)}v.getEndpoint=De;var G={};Object.defineProperty(G,"__esModule",{value:!0});G.DEFAULT_BASE_URL=void 0;G.DEFAULT_BASE_URL="https://safe-client.safe.global";var ie={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(t){t.UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(ie);var re={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}
1),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(t){t.NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(t){t.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(t){t.TWITTER="TWITTER",t.GITHUB="GITHUB",t.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(re);var oe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,function(t){t[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(t){t.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",t.AWAITING_EXECUTION="AWAITING_EXECUTION",t.CANCELLED="CANCELLED",t.FAILED="FAILED",t.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(t){t.INCOMING="INCOMING",t.OUTGOING="OUTGOING",t.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(t){t.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",t.ADD_OWNER="ADD_OWNER",t.REMOVE_OWNER="REMOVE_OWNER",t.SWAP_OWNER="SWAP_OWNER",t.CHANGE_THRESHOLD="CHANGE_THRESHOLD",t.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",t.ENABLE_MODULE="ENABLE_MODULE",t.DISABLE_MODULE="DISABLE_MODULE",t.SET_GUARD="SET_GUARD",t.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(t){t.TRANSFER="Transfer",t.SETTINGS_CHANGE="SettingsChange",t.CUSTOM="Custom",t.CREATION="Creation"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(t){t.NONE="None",t.HAS_NEXT="HasNext",t.END="End"}(e.ConflictType||(e.ConflictType={})),function(t){t.TRANSACTION="TRANSACTION",t.LABEL="LABEL",t.CONFLICT_HEADER="CONFLICT_HEADER",t.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(t){t.MULTISIG="MULTISIG",t.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(t){t.Queued="Queued",t.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(oe);var ce={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(t){t.API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(t){t.ORACLE="ORACLE",t.FIXED="FIXED",t.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(t){t.ERC721="ERC721",t.SAFE_APPS="SAFE_APPS",t.CONTRACT_INTERACTION="CONTRACT_INTERACTION",t.DOMAIN_LOOKUP="DOMAIN_LOOKUP",t.SPENDING_LIMIT="SPENDING_LIMIT",t.EIP1559="EIP1559",t.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",t.TX_SIMULATION="TX_SIMULATION",t.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(ce);var ue={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(ue);var fe={};Object.defineProperty(fe,"__esModule",{value:!0});var le={};
1Object.defineProperty(le,"__esModule",{value:!0});var de={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,function(t){t.DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(t){t.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",t.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(de);(function(e){var t=O&&O.__createBinding||(Object.create?function(n,s,o,f){f===void 0&&(f=o);var h=Object.getOwnPropertyDescriptor(s,o);(!h||("get"in h?!s.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(n,f,h)}:function(n,s,o,f){f===void 0&&(f=o),n[f]=s[o]}),i=O&&O.__exportStar||function(n,s){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.confirmSafeMessage=e.proposeSafeMessage=e.getSafeMessage=e.getSafeMessages=e.getDecodedData=e.getMasterCopies=e.getSafeApps=e.getChainConfig=e.getChainsConfig=e.proposeTransaction=e.postSafeGasEstimation=e.getTransactionDetails=e.getTransactionQueue=e.getTransactionHistory=e.getCollectiblesPage=e.getCollectibles=e.getOwnedSafes=e.getFiatCurrencies=e.getBalances=e.getMultisigTransactions=e.getModuleTransactions=e.getIncomingTransfers=e.getSafeInfo=e.setBaseUrl=void 0;const a=v,c=G;i(ie,e),i(re,e),i(oe,e),i(ce,e),i(ue,e),i(fe,e),i(le,e),i(de,e);let r=c.DEFAULT_BASE_URL;const u=n=>{r=n};e.setBaseUrl=u;function l(n,s){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:n,address:s}})}e.getSafeInfo=l;function p(n,s,o,f){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:n,address:s},query:o},f)}e.getIncomingTransfers=p;function b(n,s,o,f){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:n,address:s},query:o},f)}e.getModuleTransactions=b;function _(n,s,o,f){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:n,address:s},query:o},f)}e.getMultisigTransactions=_;function E(n,s,o="usd",f={}){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:n,address:s,currency:o},query:f})}e.getBalances=E;function U(){return(0,a.getEndpoint)(r,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=U;function N(n,s){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:n,address:s}})}e.getOwnedSafes=N;function g(n,s,o={}){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:n,address:s},query:o})}e.getCollectibles=g;function C(n,s,o={},f){return(0,a.getEndpoint)(r,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:n,address:s},query:o},f)}e.getCollectiblesPage=C;function H(n,s,o){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:n,safe_address:s},query:{}},o)}e.getTransactionHistory=H;function V(n,s,o,f){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:n,safe_address:s},query:{trusted:f}},o)}e.getTransactionQueue=V;function W(n,s){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:n,transactionId:s}})}e.getTransactionDetails=W;function K(n,s,o){return(0,a.postEndpoint)(r,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:n,safe_address:s},body:o})}e.postSafeGasEstimation=K;function j(n,s,o){return(0,a.postEndpoint)(r,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:n,safe_address:s},body:o})}e.proposeTransaction=j;function q(n){return(0,a.getEndpoint)(r,"/v1/chains",{query:n})}e.getChainsConfig=q;function X(n){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}",{path:{chainId:n}})}e.getChainConfig=X;function $(n,s={}){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safe-apps",{path:{chainId:n},query:s})}e.getSafeApps=$;function A(n){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:n}})}e.getMasterCopies=A;function Q(n,s){return(0,a.postEndpoint)(r,"/v1/chains/{chainId}/data-decoder",{path:{chainId:n},body:{data:s}})}e.getDecodedData=Q;function z(n,s,o){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:n,safe_address:s},query:{}},o)}e.getSafeMessages=z;function T(n,s){return(0,a.getEndpoint)(r,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:n,message_hash:s}})}e.getSafeMessage=T;function Y(n,s,o){return(0,a.postEndpoint)(r,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:n,safe_address:s},body:o})}e.proposeSafeMessage=Y;function P(n,s,o){return(0,a.postEndpoint)(r,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:n,message_hash:s},body:o})}e.confirmSafeMessage=P})(R);class Re{constructor(t){this.communicator=t}async getBySafeTxHash(t){if(!t)throw new Error("Invalid safeTxHash");return(await this.communicator.send(y.getTxBySafeTxHash,{safeTxHash:t})).data}async signMessage(t){const i={message:t};return(await this.communicator.send(y.signMessage,i)).data}async signTypedMessage(t){if(!ee(t))throw new Error("Invalid typed data");return(await this.communicator.send(y.signTypedMessage,{typedData:t})).data}async send({txs:t,params:i}){if(!t||!t.length)throw new Error("No transactions were passed");const a={txs:t,params:i};return(await this.communicator.send(y.sendTransactions,a)).data}}const m={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"},I={defaultBlockParam:(e="latest")=>
1e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class Be{constructor(t){this.communicator=t,this.call=this.buildRequest({call:m.eth_call,formatters:[null,I.defaultBlockParam]}),this.getBalance=this.buildRequest({call:m.eth_getBalance,formatters:[null,I.defaultBlockParam]}),this.getCode=this.buildRequest({call:m.eth_getCode,formatters:[null,I.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:m.eth_getStorageAt,formatters:[null,I.blockNumberToHex,I.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:m.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:m.eth_getBlockByHash,formatters:[null,I.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:m.eth_getBlockByNumber,formatters:[I.blockNumberToHex,I.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:m.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:m.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:m.eth_getTransactionCount,formatters:[null,I.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:m.eth_gasPrice}),this.getEstimateGas=i=>this.buildRequest({call:m.eth_estimateGas})([i]),this.setSafeSettings=this.buildRequest({call:m.safe_setSettings})}buildRequest(t){const{call:i,formatters:a}=t;return async c=>{a&&Array.isArray(c)&&a.forEach((l,p)=>{l&&(c[p]=l(c[p]))});const r={call:i,params:c||[]};return(await this.communicator.send(y.rpcCall,r)).data}}}const Me="0x1626ba7e",Le="0x20c13b0b",x=4001;class M extends Error{constructor(t,i,a){super(t),this.code=i,this.data=a,Object.setPrototypeOf(this,M.prototype)}}class he{constructor(t){this.communicator=t}async getPermissions(){return(await this.communicator.send(y.wallet_getPermissions,void 0)).data}async requestPermissions(t){if(!this.isPermissionRequestValid(t))throw new M("Permissions request is invalid",x);try{return(await this.communicator.send(y.wallet_requestPermissions,t)).data}catch{throw new M("Permissions rejected",x)}}isPermissionRequestValid(t){return t.every(i=>typeof i=="object"?Object.keys(i).every(a=>!!Object.values(k).includes(a)):!1)}}const ne=(e,t)=>t.some(i=>i.parentCapability===e),Ue=()=>(e,t,i)=>{const a=i.value;return i.value=async function(){const c=new he(this.communicator);let r=await c.getPermissions();if(ne(t,r)||(r=await c.requestPermissions([{[t]:{}}])),!ne(t,r))throw new M("Permissions rejected",x);return a.apply(this)},i};var He=function(e,t,i,a){var c=arguments.length,r=c<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,i):a,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(e,t,i,a);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(r=(c<3?u(r):c>3?u(t,i,r):u(t,i))||r);return c>3&&r&&Object.defineProperty(t,i,r),r};class ge{constructor(t){this.communicator=t}async getChainInfo(){return(await this.communicator.send(y.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(y.getSafeInfo,void 0)).data}async experimental_getBalances({currency:t="usd"}={}){return(await this.communicator.send(y.getSafeBalances,{currency:t})).data}async check1271Signature(t,i="0x"){const a=await this.getInfo(),c=te({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:[t,i]}),r={call:m.eth_call,params:[{to:a.safeAddress,data:c},"latest"]};try{return(await this.communicator.send(y.rpcCall,r)).data.slice(0,10).toLowerCase()===Me}catch{return!1}}async check1271SignatureBytes(t,i="0x"){const a=await this.getInfo(),c=te({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:[t,i]}),r={call:m.eth_call,params:[{to:a.safeAddress,data:c},"latest"]};try{return(await this.communicator.send(y.rpcCall,r)).data.slice(0,10).toLowerCase()===Le}catch{return!1}}calculateMessageHash(t){return ye(t)}calculateTypedMessageHash(t){const i=typeof t.domain.chainId=="object"?t.domain.chainId.toNumber():Number(t.domain.chainId);let a=t.primaryType;if(!a){const c=Object.values(t.types),r=Object.keys(t.types).filter(u=>c.every(l=>l.every(({type:p})=>p.replace("[","").replace("]","")!==u)));if(r.length===0||r.length>1)throw new Error("Please specify primaryType");a=r[0]}return pe({message:t.message,domain:{...t.domain,chainId:i,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:a})}async getOffChainSignature(t){return(await this.communicator.send(y.getOffChainSignature,t)).data}async isMessageSigned(t,i="0x"){let a;if(typeof t=="string"&&(a=async()=>{const c=this.calculateMessageHash(t);return await this.isMessageHashSigned(c,i)}),ee(t)&&(a=async()=>{const c=this.calculateTypedMessageHash(t);return await this.isMessageHashSigned(c,i)}),a)return await a();throw new Error("Invalid message type")}async isMessageHashSigned(t,i="0x"){const a=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const c of a)if(await c(t,i))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(y.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(y.requestAddressBook,void 0)).data}}He([Ue()],ge.prototype,"requestAddressBook",null);class je{constructor(t={}){const{allowedDomains:i=null,debug:a=!1}=t;this.communicator=new Te(i,a),this.eth=new Be(this.communicator),this.txs=new Re(this.communicator),this.safe=new ge(this.communicator),this.wallet=new he(this.communicator)}}const ke=Object.freeze(Object.defineProperty({__proto__:null,MessageFormatter:L,get Methods(){return y},Operation:R.Operation,RPC_CALLS:m,get RestrictedMethods(){return k},TokenType:R.TokenType,TransactionStatus:R.TransactionStatus,TransferDirection:R.TransferDirection,default:je,getSDKVersion:se,isObjectEIP712TypedData:ee},Symbol.toStringTag,{value:"Module"}));
1export{ke as e}; 2//# sourceMappingURL=index-4h3yRP0n.js.map
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.