@reown/appkit-cdn 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{W3MFrameProviderSingleton-B9E01rnL.js → W3MFrameProviderSingleton-CRF_1us_.js} +4057 -4187
  2. package/dist/{W3MFrameProviderSingleton-C56DqhGz.cjs → W3MFrameProviderSingleton-EQdqCGSY.cjs} +38 -38
  3. package/dist/ethers.cjs +1 -1
  4. package/dist/ethers.js +1403 -1415
  5. package/dist/{hooks.module-OoOP-iZR.js → hooks.module-Bo49CUkD.js} +1 -1
  6. package/dist/{hooks.module-COfcimjS.cjs → hooks.module-Dv1obaBy.cjs} +1 -1
  7. package/dist/{index-BT6RyUGl.js → index-B4aMSR4c.js} +10 -10
  8. package/dist/{index-Bl5DrNCU.cjs → index-BuOJ8QNL.cjs} +1 -1
  9. package/dist/{index-j73t9fcB.js → index-ByE-R0E1.js} +2 -2
  10. package/dist/{index-BsaPadk9.js → index-C2gFFabd.js} +6 -6
  11. package/dist/{index-DyAlQ2Ty.js → index-CG2NGIOC.js} +2 -2
  12. package/dist/{index-BeGUtgfx.js → index-CHb2nMaf.js} +2 -2
  13. package/dist/{index-DbrEGMZZ.cjs → index-CKVZVFq_.cjs} +1 -1
  14. package/dist/{index-Dv8gb9FV.cjs → index-CLxU5hsA.cjs} +1 -1
  15. package/dist/{index-CpPWzw23.js → index-CQRSLm_m.js} +1 -1
  16. package/dist/{index-CG2oM48r.cjs → index-CcTeiaz4.cjs} +1 -1
  17. package/dist/{index-BFJW4qjy.cjs → index-CeQNoxrU.cjs} +1 -1
  18. package/dist/{index-DYI6oRae.cjs → index-DH3qaBPp.cjs} +1 -1
  19. package/dist/{index-CCzK6s6K.js → index-DVFjsAEF.js} +2 -2
  20. package/dist/{index-BDDqX_wu.cjs → index-DwRBfwIO.cjs} +1 -1
  21. package/dist/{index-C0D6DuSI.cjs → index-h3CAtOy2.cjs} +1 -1
  22. package/dist/{index-BmTGKb68.js → index-hXCH-znD.js} +2 -2
  23. package/dist/{index.es-0FqNLiLo.cjs → index.es-DnJzv0Jm.cjs} +2 -2
  24. package/dist/{index.es-BhyAt79s.js → index.es-bcU603NI.js} +2 -2
  25. package/dist/{metamask-sdk-DPJxxXN8.js → metamask-sdk-CXJHRcL2.js} +1 -1
  26. package/dist/{metamask-sdk-DXmxCf94.cjs → metamask-sdk-my5l20D3.cjs} +1 -1
  27. package/dist/{native-BIdabKvi.cjs → native-AlGArcwp.cjs} +1 -1
  28. package/dist/{native-CbXTOHOX.js → native-CAgUwsyb.js} +1 -1
  29. package/dist/{w3m-modal-BLwMni5B.cjs → w3m-modal-BC3zgDJa.cjs} +4 -4
  30. package/dist/{w3m-modal-BjrYlIco.js → w3m-modal-BNjtW4Kj.js} +43 -43
  31. package/dist/{wagmi-IJnCtsrt.js → wagmi-BSo7cFxV.js} +3317 -3325
  32. package/dist/{wagmi-CTSe_XEF.cjs → wagmi-D-vZdxZZ.cjs} +14 -14
  33. package/dist/wagmi.cjs +1 -1
  34. package/dist/wagmi.js +2 -2
  35. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
- import { m as I, b9 as Rr, B, s as Ba, ba as Bi, bb as Di, bc as Qe, n as Da, b8 as Ha } from "./W3MFrameProviderSingleton-B9E01rnL.js";
2
- import { a as ce, b as Ir, r as Dt, j as Ua } from "./hooks.module-OoOP-iZR.js";
1
+ import { n as I, ba as Rr, B, s as Ba, bb as Bi, bc as Di, bd as Qe, o as Da, b9 as Ha } from "./W3MFrameProviderSingleton-CRF_1us_.js";
2
+ import { a as ce, b as Ir, r as Dt, j as Ua } from "./hooks.module-Bo49CUkD.js";
3
3
  var Hi = {}, Ft = {}, Ar = {};
4
4
  Object.defineProperty(Ar, "__esModule", { value: !0 });
5
5
  Ar.walletLogo = void 0;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./W3MFrameProviderSingleton-C56DqhGz.cjs"),N=require("./wagmi-CTSe_XEF.cjs"),P=()=>"9.1.0",Ge=e=>e.toString(16).padStart(2,"0"),We=e=>{const n=new Uint8Array(e/2);return window.crypto.getRandomValues(n),Array.from(n,Ge).join("")},qe=()=>typeof window<"u"?We(10):new Date().getTime().toString(36);class O{}O.makeRequest=(e,n)=>({id:qe(),method:e,params:n,env:{sdkVersion:P()}});O.makeResponse=(e,n,t)=>({id:e,success:!0,version:t,data:n});O.makeErrorResponse=(e,n,t)=>({id:e,success:!1,error:n,version:t});exports.Methods=void 0;(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"})(exports.Methods||(exports.Methods={}));exports.RestrictedMethods=void 0;(function(e){e.requestAddressBook="requestAddressBook"})(exports.RestrictedMethods||(exports.RestrictedMethods={}));class Ve{constructor(n=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:i,data:r,source:s})=>{const u=!r,l=!this.isServer&&s===window.parent,g=typeof r.version<"u"&&parseInt(r.version.split(".")[0]),A=typeof g=="number"&&g>=1;let h=!0;return Array.isArray(this.allowedOrigins)&&(h=this.allowedOrigins.find(I=>I.test(i))!==void 0),!u&&l&&A&&h},this.logIncomingMessage=i=>{console.info(`Safe Apps SDK v1: A message was received from origin ${i.origin}. `,i.data)},this.onParentMessage=i=>{this.isValidMessage(i)&&(this.debugMode&&this.logIncomingMessage(i),this.handleIncomingMessage(i.data))},this.handleIncomingMessage=i=>{const{id:r}=i,s=this.callbacks.get(r);s&&(s(i),this.callbacks.delete(r))},this.send=(i,r)=>{const s=O.makeRequest(i,r);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise((u,l)=>{this.callbacks.set(s.id,g=>{if(!g.success){l(new Error(g.error));return}u(g)})})},this.allowedOrigins=n,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}}const R=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var Fe={},E={},_={},M=m.commonjsGlobal&&m.commonjsGlobal.__awaiter||function(e,n,t,i){function r(s){return s instanceof t?s:new t(function(u){u(s)})}return new(t||(t=Promise))(function(s,u){function l(h){try{A(i.next(h))}catch(I){u(I)}}function g(h){try{A(i.throw(h))}catch(I){u(I)}}function A(h){h.done?s(h.value):r(h.value).then(l,g)}A((i=i.apply(e,n||[])).next())})};Object.defineProperty(_,"__esModule",{value:!0});_.getData=_.fetchData=_.stringifyQuery=_.insertParams=void 0;const ke=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function Ke(e,n,t){return e.replace(new RegExp(`\\{${n}\\}`,"g"),t)}function Xe(e,n){return n?Object.keys(n).reduce((t,i)=>Ke(t,i,String(n[i])),e):e}_.insertParams=Xe;function Qe(e){if(!e)return"";const n=new URLSearchParams;Object.keys(e).forEach(i=>{e[i]!=null&&n.append(i,String(e[i]))});const t=n.toString();return t?`?${t}`:""}_.stringifyQuery=Qe;function p(e){return M(this,void 0,void 0,function*(){let n;try{n=yield e.json()}catch{n={}}if(!e.ok){const t=ke(n)?`CGW error - ${n.code}: ${n.message}`:`CGW error - status ${e.statusText}`;throw new Error(t)}return n})}function $e(e,n,t,i,r){return M(this,void 0,void 0,function*(){const s=Object.assign({"Content-Type":"application/json"},i),u={method:n??"POST",headers:s};r&&(u.credentials=r),t!=null&&(u.body=typeof t=="string"?t:JSON.stringify(t));const l=yield fetch(e,u);return p(l)})}_.fetchData=$e;function Ye(e,n,t){return M(this,void 0,void 0,function*(){const i={method:"GET"};n&&(i.headers=Object.assign(Object.assign({},n),{"Content-Type":"application/json"})),t&&(i.credentials=t);const r=yield fetch(e,i);return p(r)})}_.getData=Ye;Object.defineProperty(E,"__esModule",{value:!0});E.getEndpoint=E.deleteEndpoint=E.putEndpoint=E.postEndpoint=void 0;const S=_;function C(e,n,t,i){const r=(0,S.insertParams)(n,t),s=(0,S.stringifyQuery)(i);return`${e}${r}${s}`}function Je(e,n,t){const i=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.fetchData)(i,"POST",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.postEndpoint=Je;function ze(e,n,t){const i=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.fetchData)(i,"PUT",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.putEndpoint=ze;function Ze(e,n,t){const i=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.fetchData)(i,"DELETE",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.deleteEndpoint=Ze;function xe(e,n,t,i){if(i)return(0,S.getData)(i,void 0,t==null?void 0:t.credentials);const r=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.getData)(r,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.getEndpoint=xe;var b={};Object.defineProperty(b,"__esModule",{value:!0});b.DEFAULT_BASE_URL=void 0;b.DEFAULT_BASE_URL="https://safe-client.safe.global";var L={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(n){n.UP_TO_DATE="UP_TO_DATE",n.OUTDATED="OUTDATED",n.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(L);var B={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(n){n.NoRestrictions="NO_RESTRICTIONS",n.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(n){n.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(n){n.TWITTER="TWITTER",n.GITHUB="GITHUB",n.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(B);var H={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.StartTimeValue=e.DurationType=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,function(n){n[n.CALL=0]="CALL",n[n.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(n){n.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",n.AWAITING_EXECUTION="AWAITING_EXECUTION",n.CANCELLED="CANCELLED",n.FAILED="FAILED",n.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(n){n.INCOMING="INCOMING",n.OUTGOING="OUTGOING",n.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(n){n.ERC20="ERC20",n.ERC721="ERC721",n.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(n){n.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(n){n.TRANSFER="Transfer",n.SETTINGS_CHANGE="SettingsChange",n.CUSTOM="Custom",n.CREATION="Creation",n.SWAP_ORDER="SwapOrder",n.TWAP_ORDER="TwapOrder",n.SWAP_TRANSFER="SwapTransfer"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(n){n.NONE="None",n.HAS_NEXT="HasNext",n.END="End"}(e.ConflictType||(e.ConflictType={})),function(n){n.TRANSACTION="TRANSACTION",n.LABEL="LABEL",n.CONFLICT_HEADER="CONFLICT_HEADER",n.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(n){n.MULTISIG="MULTISIG",n.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(n){n.AUTO="AUTO",n.LIMIT_DURATION="LIMIT_DURATION"}(e.DurationType||(e.DurationType={})),function(n){n.AT_MINING_TIME="AT_MINING_TIME",n.AT_EPOCH="AT_EPOCH"}(e.StartTimeValue||(e.StartTimeValue={})),function(n){n.Queued="Queued",n.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(H);var j={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(n){n.API_KEY_PATH="API_KEY_PATH",n.NO_AUTHENTICATION="NO_AUTHENTICATION",n.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(n){n.ORACLE="ORACLE",n.FIXED="FIXED",n.FIXED_1559="FIXED1559",n.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(n){n.ERC721="ERC721",n.SAFE_APPS="SAFE_APPS",n.CONTRACT_INTERACTION="CONTRACT_INTERACTION",n.DOMAIN_LOOKUP="DOMAIN_LOOKUP",n.SPENDING_LIMIT="SPENDING_LIMIT",n.EIP1559="EIP1559",n.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",n.TX_SIMULATION="TX_SIMULATION",n.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(j);var U={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(n){n.ERC20="ERC20",n.ERC721="ERC721",n.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(U);var G={};Object.defineProperty(G,"__esModule",{value:!0});var W={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfirmationViewTypes=void 0,function(n){n.COW_SWAP_ORDER="COW_SWAP_ORDER",n.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER"}(e.ConfirmationViewTypes||(e.ConfirmationViewTypes={}))})(W);var q={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,function(n){n.DATE_LABEL="DATE_LABEL",n.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(n){n.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",n.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(q);var V={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceType=void 0,function(n){n.ANDROID="ANDROID",n.IOS="IOS",n.WEB="WEB"}(e.DeviceType||(e.DeviceType={}))})(V);var F={};Object.defineProperty(F,"__esModule",{value:!0});(function(e){var n=m.commonjsGlobal&&m.commonjsGlobal.__createBinding||(Object.create?function(a,c,o,d){d===void 0&&(d=o);var v=Object.getOwnPropertyDescriptor(c,o);(!v||("get"in v?!c.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return c[o]}}),Object.defineProperty(a,d,v)}:function(a,c,o,d){d===void 0&&(d=o),a[d]=c[o]}),t=m.commonjsGlobal&&m.commonjsGlobal.__exportStar||function(a,c){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(c,o)&&n(c,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.deleteAccount=e.getAccount=e.createAccount=e.verifyAuth=e.getAuthNonce=e.getContract=e.getSafeOverviews=e.unsubscribeAll=e.unsubscribeSingle=e.registerRecoveryModule=e.deleteRegisteredEmail=e.getRegisteredEmail=e.verifyEmail=e.resendEmailVerificationCode=e.changeEmail=e.registerEmail=e.unregisterDevice=e.unregisterSafe=e.registerDevice=e.getDelegates=e.confirmSafeMessage=e.proposeSafeMessage=e.getSafeMessage=e.getSafeMessages=e.getDecodedData=e.getMasterCopies=e.getSafeApps=e.getChainConfig=e.getChainsConfig=e.getConfirmationView=e.proposeTransaction=e.getNonces=e.postSafeGasEstimation=e.deleteTransaction=e.getTransactionDetails=e.getTransactionQueue=e.getTransactionHistory=e.getCollectiblesPage=e.getCollectibles=e.getAllOwnedSafes=e.getOwnedSafes=e.getFiatCurrencies=e.getBalances=e.getMultisigTransactions=e.getModuleTransactions=e.getIncomingTransfers=e.getSafeInfo=e.getRelayCount=e.relayTransaction=e.setBaseUrl=void 0,e.putAccountDataSettings=e.getAccountDataSettings=e.getAccountDataTypes=void 0;const i=E,r=b;t(L,e),t(B,e),t(H,e),t(j,e),t(U,e),t(G,e),t(W,e),t(q,e),t(V,e),t(F,e);let s=r.DEFAULT_BASE_URL;const u=a=>{s=a};e.setBaseUrl=u;function l(a,c){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/relay",{path:{chainId:a},body:c})}e.relayTransaction=l;function g(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:a,address:c}})}e.getRelayCount=g;function A(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:a,address:c}})}e.getSafeInfo=A;function h(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:a,address:c},query:o},d)}e.getIncomingTransfers=h;function I(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getModuleTransactions=I;function X(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getMultisigTransactions=X;function Q(a,c,o="usd",d={}){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:a,address:c,currency:o},query:d})}e.getBalances=Q;function $(){return(0,i.getEndpoint)(s,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=$;function Y(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:a,address:c}})}e.getOwnedSafes=Y;function J(a){return(0,i.getEndpoint)(s,"/v1/owners/{address}/safes",{path:{address:a}})}e.getAllOwnedSafes=J;function z(a,c,o={}){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o})}e.getCollectibles=z;function Z(a,c,o={},d){return(0,i.getEndpoint)(s,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o},d)}e.getCollectiblesPage=Z;function x(a,c,o={},d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionHistory=x;function ee(a,c,o={},d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionQueue=ee;function ne(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:a,transactionId:c}})}e.getTransactionDetails=ne;function te(a,c,o){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:a,safeTxHash:c},body:{signature:o}})}e.deleteTransaction=te;function ie(a,c,o){return(0,i.postEndpoint)(s,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:a,safe_address:c},body:o})}e.postSafeGasEstimation=ie;function ae(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:a,safe_address:c}})}e.getNonces=ae;function se(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:a,safe_address:c},body:o})}e.proposeTransaction=se;function ce(a,c,o,d){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:a,safe_address:c},body:{data:o,to:d}})}e.getConfirmationView=ce;function oe(a){return(0,i.getEndpoint)(s,"/v1/chains",{query:a})}e.getChainsConfig=oe;function re(a){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}",{path:{chainId:a}})}e.getChainConfig=re;function de(a,c={}){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safe-apps",{path:{chainId:a},query:c})}e.getSafeApps=de;function ue(a){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:a}})}e.getMasterCopies=ue;function le(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/data-decoder",{path:{chainId:a},body:{data:c,to:o}})}e.getDecodedData=le;function fe(a,c,o){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},query:{}},o)}e.getSafeMessages=fe;function ge(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:a,message_hash:c}})}e.getSafeMessage=ge;function he(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},body:o})}e.proposeSafeMessage=he;function Ee(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:a,message_hash:c},body:o})}e.confirmSafeMessage=Ee;function _e(a,c={}){return(0,i.getEndpoint)(s,"/v2/chains/{chainId}/delegates",{path:{chainId:a},query:c})}e.getDelegates=_e;function Te(a){return(0,i.postEndpoint)(s,"/v1/register/notifications",{body:a})}e.registerDevice=Te;function ve(a,c,o){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:a,safe_address:c,uuid:o}})}e.unregisterSafe=ve;function Ae(a,c){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:a,uuid:c}})}e.unregisterDevice=Ae;function Ie(a,c,o,d){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:a,safe_address:c},body:o,headers:d})}e.registerEmail=Ie;function Se(a,c,o,d,v){return(0,i.putEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},body:d,headers:v})}e.changeEmail=Se;function me(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:a,safe_address:c,signer:o},body:""})}e.resendEmailVerificationCode=me;function ye(a,c,o,d){return(0,i.putEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:a,safe_address:c,signer:o},body:d})}e.verifyEmail=ye;function Oe(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.getRegisteredEmail=Oe;function Ne(a,c,o,d){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.deleteRegisteredEmail=Ne;function Ce(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:a,safe_address:c},body:o})}e.registerRecoveryModule=Ce;function be(a){return(0,i.deleteEndpoint)(s,"/v1/subscriptions",{query:a})}e.unsubscribeSingle=be;function De(a){return(0,i.deleteEndpoint)(s,"/v1/subscriptions/all",{query:a})}e.unsubscribeAll=De;function Re(a,c){return(0,i.getEndpoint)(s,"/v1/safes",{query:Object.assign(Object.assign({},c),{safes:a.join(",")})})}e.getSafeOverviews=Re;function Me(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:a,contractAddress:c}})}e.getContract=Me;function we(){return(0,i.getEndpoint)(s,"/v1/auth/nonce",{credentials:"include"})}e.getAuthNonce=we;function Pe(a){return(0,i.postEndpoint)(s,"/v1/auth/verify",{body:a,credentials:"include"})}e.verifyAuth=Pe;function pe(a){return(0,i.postEndpoint)(s,"/v1/accounts",{body:a,credentials:"include"})}e.createAccount=pe;function Le(a){return(0,i.getEndpoint)(s,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.getAccount=Le;function Be(a){return(0,i.deleteEndpoint)(s,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.deleteAccount=Be;function He(){return(0,i.getEndpoint)(s,"/v1/accounts/data-types")}e.getAccountDataTypes=He;function je(a){return(0,i.getEndpoint)(s,"/v1/accounts/{address}/data-settings",{path:{address:a},credentials:"include"})}e.getAccountDataSettings=je;function Ue(a,c){return(0,i.putEndpoint)(s,"/v1/accounts/{address}/data-settings",{path:{address:a},body:c,credentials:"include"})}e.putAccountDataSettings=Ue})(Fe);class en{constructor(n){this.communicator=n}async getBySafeTxHash(n){if(!n)throw new Error("Invalid safeTxHash");return(await this.communicator.send(exports.Methods.getTxBySafeTxHash,{safeTxHash:n})).data}async signMessage(n){const t={message:n};return(await this.communicator.send(exports.Methods.signMessage,t)).data}async signTypedMessage(n){if(!R(n))throw new Error("Invalid typed data");return(await this.communicator.send(exports.Methods.signTypedMessage,{typedData:n})).data}async send({txs:n,params:t}){if(!n||!n.length)throw new Error("No transactions were passed");const i={txs:n,params:t};return(await this.communicator.send(exports.Methods.sendTransactions,i)).data}}const f={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"},T={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class nn{constructor(n){this.communicator=n,this.call=this.buildRequest({call:f.eth_call,formatters:[null,T.defaultBlockParam]}),this.getBalance=this.buildRequest({call:f.eth_getBalance,formatters:[null,T.defaultBlockParam]}),this.getCode=this.buildRequest({call:f.eth_getCode,formatters:[null,T.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:f.eth_getStorageAt,formatters:[null,T.blockNumberToHex,T.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:f.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:f.eth_getBlockByHash,formatters:[null,T.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:f.eth_getBlockByNumber,formatters:[T.blockNumberToHex,T.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:f.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:f.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:f.eth_getTransactionCount,formatters:[null,T.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:f.eth_gasPrice}),this.getEstimateGas=t=>this.buildRequest({call:f.eth_estimateGas})([t]),this.setSafeSettings=this.buildRequest({call:f.safe_setSettings})}buildRequest(n){const{call:t,formatters:i}=n;return async r=>{i&&Array.isArray(r)&&i.forEach((l,g)=>{l&&(r[g]=l(r[g]))});const s={call:t,params:r||[]};return(await this.communicator.send(exports.Methods.rpcCall,s)).data}}}const tn="0x1626ba7e",an="0x20c13b0b",D=4001;class y extends Error{constructor(n,t,i){super(n),this.code=t,this.data=i,Object.setPrototypeOf(this,y.prototype)}}class k{constructor(n){this.communicator=n}async getPermissions(){return(await this.communicator.send(exports.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(n){if(!this.isPermissionRequestValid(n))throw new y("Permissions request is invalid",D);try{return(await this.communicator.send(exports.Methods.wallet_requestPermissions,n)).data}catch{throw new y("Permissions rejected",D)}}isPermissionRequestValid(n){return n.every(t=>typeof t=="object"?Object.keys(t).every(i=>!!Object.values(exports.RestrictedMethods).includes(i)):!1)}}const w=(e,n)=>n.some(t=>t.parentCapability===e),sn=()=>(e,n,t)=>{const i=t.value;return t.value=async function(){const r=new k(this.communicator);let s=await r.getPermissions();if(w(n,s)||(s=await r.requestPermissions([{[n]:{}}])),!w(n,s))throw new y("Permissions rejected",D);return i.apply(this)},t};var cn=function(e,n,t,i){var r=arguments.length,s=r<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,n,t,i);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(s=(r<3?u(s):r>3?u(n,t,s):u(n,t))||s);return r>3&&s&&Object.defineProperty(n,t,s),s};class K{constructor(n){this.communicator=n}async getChainInfo(){return(await this.communicator.send(exports.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(exports.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:n="usd"}={}){return(await this.communicator.send(exports.Methods.getSafeBalances,{currency:n})).data}async check1271Signature(n,t="0x"){const i=await this.getInfo(),r=N.encodeFunctionData({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:[n,t]}),s={call:f.eth_call,params:[{to:i.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(exports.Methods.rpcCall,s)).data.slice(0,10).toLowerCase()===tn}catch{return!1}}async check1271SignatureBytes(n,t="0x"){const i=await this.getInfo(),r=N.encodeFunctionData({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:[n,t]}),s={call:f.eth_call,params:[{to:i.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(exports.Methods.rpcCall,s)).data.slice(0,10).toLowerCase()===an}catch{return!1}}calculateMessageHash(n){return N.hashMessage(n)}calculateTypedMessageHash(n){const t=typeof n.domain.chainId=="object"?n.domain.chainId.toNumber():Number(n.domain.chainId);let i=n.primaryType;if(!i){const r=Object.values(n.types),s=Object.keys(n.types).filter(u=>r.every(l=>l.every(({type:g})=>g.replace("[","").replace("]","")!==u)));if(s.length===0||s.length>1)throw new Error("Please specify primaryType");i=s[0]}return N.hashTypedData({message:n.message,domain:{...n.domain,chainId:t,verifyingContract:n.domain.verifyingContract,salt:n.domain.salt},types:n.types,primaryType:i})}async getOffChainSignature(n){return(await this.communicator.send(exports.Methods.getOffChainSignature,n)).data}async isMessageSigned(n,t="0x"){let i;if(typeof n=="string"&&(i=async()=>{const r=this.calculateMessageHash(n);return await this.isMessageHashSigned(r,t)}),R(n)&&(i=async()=>{const r=this.calculateTypedMessageHash(n);return await this.isMessageHashSigned(r,t)}),i)return await i();throw new Error("Invalid message type")}async isMessageHashSigned(n,t="0x"){const i=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of i)if(await r(n,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(exports.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(exports.Methods.requestAddressBook,void 0)).data}}cn([sn()],K.prototype,"requestAddressBook",null);class on{constructor(n={}){const{allowedDomains:t=null,debug:i=!1}=n;this.communicator=new Ve(t,i),this.eth=new nn(this.communicator),this.txs=new en(this.communicator),this.safe=new K(this.communicator),this.wallet=new k(this.communicator)}}const rn=on;exports.MessageFormatter=O;exports.RPC_CALLS=f;exports.default=rn;exports.getSDKVersion=P;exports.isObjectEIP712TypedData=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./W3MFrameProviderSingleton-EQdqCGSY.cjs"),N=require("./wagmi-D-vZdxZZ.cjs"),P=()=>"9.1.0",Ge=e=>e.toString(16).padStart(2,"0"),We=e=>{const n=new Uint8Array(e/2);return window.crypto.getRandomValues(n),Array.from(n,Ge).join("")},qe=()=>typeof window<"u"?We(10):new Date().getTime().toString(36);class O{}O.makeRequest=(e,n)=>({id:qe(),method:e,params:n,env:{sdkVersion:P()}});O.makeResponse=(e,n,t)=>({id:e,success:!0,version:t,data:n});O.makeErrorResponse=(e,n,t)=>({id:e,success:!1,error:n,version:t});exports.Methods=void 0;(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"})(exports.Methods||(exports.Methods={}));exports.RestrictedMethods=void 0;(function(e){e.requestAddressBook="requestAddressBook"})(exports.RestrictedMethods||(exports.RestrictedMethods={}));class Ve{constructor(n=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:i,data:r,source:s})=>{const u=!r,l=!this.isServer&&s===window.parent,g=typeof r.version<"u"&&parseInt(r.version.split(".")[0]),A=typeof g=="number"&&g>=1;let h=!0;return Array.isArray(this.allowedOrigins)&&(h=this.allowedOrigins.find(I=>I.test(i))!==void 0),!u&&l&&A&&h},this.logIncomingMessage=i=>{console.info(`Safe Apps SDK v1: A message was received from origin ${i.origin}. `,i.data)},this.onParentMessage=i=>{this.isValidMessage(i)&&(this.debugMode&&this.logIncomingMessage(i),this.handleIncomingMessage(i.data))},this.handleIncomingMessage=i=>{const{id:r}=i,s=this.callbacks.get(r);s&&(s(i),this.callbacks.delete(r))},this.send=(i,r)=>{const s=O.makeRequest(i,r);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(s,"*"),new Promise((u,l)=>{this.callbacks.set(s.id,g=>{if(!g.success){l(new Error(g.error));return}u(g)})})},this.allowedOrigins=n,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}}const R=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var Fe={},E={},_={},M=m.commonjsGlobal&&m.commonjsGlobal.__awaiter||function(e,n,t,i){function r(s){return s instanceof t?s:new t(function(u){u(s)})}return new(t||(t=Promise))(function(s,u){function l(h){try{A(i.next(h))}catch(I){u(I)}}function g(h){try{A(i.throw(h))}catch(I){u(I)}}function A(h){h.done?s(h.value):r(h.value).then(l,g)}A((i=i.apply(e,n||[])).next())})};Object.defineProperty(_,"__esModule",{value:!0});_.getData=_.fetchData=_.stringifyQuery=_.insertParams=void 0;const ke=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function Ke(e,n,t){return e.replace(new RegExp(`\\{${n}\\}`,"g"),t)}function Xe(e,n){return n?Object.keys(n).reduce((t,i)=>Ke(t,i,String(n[i])),e):e}_.insertParams=Xe;function Qe(e){if(!e)return"";const n=new URLSearchParams;Object.keys(e).forEach(i=>{e[i]!=null&&n.append(i,String(e[i]))});const t=n.toString();return t?`?${t}`:""}_.stringifyQuery=Qe;function p(e){return M(this,void 0,void 0,function*(){let n;try{n=yield e.json()}catch{n={}}if(!e.ok){const t=ke(n)?`CGW error - ${n.code}: ${n.message}`:`CGW error - status ${e.statusText}`;throw new Error(t)}return n})}function $e(e,n,t,i,r){return M(this,void 0,void 0,function*(){const s=Object.assign({"Content-Type":"application/json"},i),u={method:n??"POST",headers:s};r&&(u.credentials=r),t!=null&&(u.body=typeof t=="string"?t:JSON.stringify(t));const l=yield fetch(e,u);return p(l)})}_.fetchData=$e;function Ye(e,n,t){return M(this,void 0,void 0,function*(){const i={method:"GET"};n&&(i.headers=Object.assign(Object.assign({},n),{"Content-Type":"application/json"})),t&&(i.credentials=t);const r=yield fetch(e,i);return p(r)})}_.getData=Ye;Object.defineProperty(E,"__esModule",{value:!0});E.getEndpoint=E.deleteEndpoint=E.putEndpoint=E.postEndpoint=void 0;const S=_;function C(e,n,t,i){const r=(0,S.insertParams)(n,t),s=(0,S.stringifyQuery)(i);return`${e}${r}${s}`}function Je(e,n,t){const i=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.fetchData)(i,"POST",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.postEndpoint=Je;function ze(e,n,t){const i=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.fetchData)(i,"PUT",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.putEndpoint=ze;function Ze(e,n,t){const i=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.fetchData)(i,"DELETE",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.deleteEndpoint=Ze;function xe(e,n,t,i){if(i)return(0,S.getData)(i,void 0,t==null?void 0:t.credentials);const r=C(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,S.getData)(r,t==null?void 0:t.headers,t==null?void 0:t.credentials)}E.getEndpoint=xe;var b={};Object.defineProperty(b,"__esModule",{value:!0});b.DEFAULT_BASE_URL=void 0;b.DEFAULT_BASE_URL="https://safe-client.safe.global";var L={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(n){n.UP_TO_DATE="UP_TO_DATE",n.OUTDATED="OUTDATED",n.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(L);var B={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(n){n.NoRestrictions="NO_RESTRICTIONS",n.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(n){n.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(n){n.TWITTER="TWITTER",n.GITHUB="GITHUB",n.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(B);var H={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.StartTimeValue=e.DurationType=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,function(n){n[n.CALL=0]="CALL",n[n.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(n){n.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",n.AWAITING_EXECUTION="AWAITING_EXECUTION",n.CANCELLED="CANCELLED",n.FAILED="FAILED",n.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(n){n.INCOMING="INCOMING",n.OUTGOING="OUTGOING",n.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(n){n.ERC20="ERC20",n.ERC721="ERC721",n.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(n){n.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(n){n.TRANSFER="Transfer",n.SETTINGS_CHANGE="SettingsChange",n.CUSTOM="Custom",n.CREATION="Creation",n.SWAP_ORDER="SwapOrder",n.TWAP_ORDER="TwapOrder",n.SWAP_TRANSFER="SwapTransfer"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(n){n.NONE="None",n.HAS_NEXT="HasNext",n.END="End"}(e.ConflictType||(e.ConflictType={})),function(n){n.TRANSACTION="TRANSACTION",n.LABEL="LABEL",n.CONFLICT_HEADER="CONFLICT_HEADER",n.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(n){n.MULTISIG="MULTISIG",n.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(n){n.AUTO="AUTO",n.LIMIT_DURATION="LIMIT_DURATION"}(e.DurationType||(e.DurationType={})),function(n){n.AT_MINING_TIME="AT_MINING_TIME",n.AT_EPOCH="AT_EPOCH"}(e.StartTimeValue||(e.StartTimeValue={})),function(n){n.Queued="Queued",n.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(H);var j={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(n){n.API_KEY_PATH="API_KEY_PATH",n.NO_AUTHENTICATION="NO_AUTHENTICATION",n.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(n){n.ORACLE="ORACLE",n.FIXED="FIXED",n.FIXED_1559="FIXED1559",n.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(n){n.ERC721="ERC721",n.SAFE_APPS="SAFE_APPS",n.CONTRACT_INTERACTION="CONTRACT_INTERACTION",n.DOMAIN_LOOKUP="DOMAIN_LOOKUP",n.SPENDING_LIMIT="SPENDING_LIMIT",n.EIP1559="EIP1559",n.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",n.TX_SIMULATION="TX_SIMULATION",n.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(j);var U={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(n){n.ERC20="ERC20",n.ERC721="ERC721",n.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(U);var G={};Object.defineProperty(G,"__esModule",{value:!0});var W={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfirmationViewTypes=void 0,function(n){n.COW_SWAP_ORDER="COW_SWAP_ORDER",n.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER"}(e.ConfirmationViewTypes||(e.ConfirmationViewTypes={}))})(W);var q={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,function(n){n.DATE_LABEL="DATE_LABEL",n.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(n){n.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",n.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(q);var V={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceType=void 0,function(n){n.ANDROID="ANDROID",n.IOS="IOS",n.WEB="WEB"}(e.DeviceType||(e.DeviceType={}))})(V);var F={};Object.defineProperty(F,"__esModule",{value:!0});(function(e){var n=m.commonjsGlobal&&m.commonjsGlobal.__createBinding||(Object.create?function(a,c,o,d){d===void 0&&(d=o);var v=Object.getOwnPropertyDescriptor(c,o);(!v||("get"in v?!c.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return c[o]}}),Object.defineProperty(a,d,v)}:function(a,c,o,d){d===void 0&&(d=o),a[d]=c[o]}),t=m.commonjsGlobal&&m.commonjsGlobal.__exportStar||function(a,c){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(c,o)&&n(c,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.deleteAccount=e.getAccount=e.createAccount=e.verifyAuth=e.getAuthNonce=e.getContract=e.getSafeOverviews=e.unsubscribeAll=e.unsubscribeSingle=e.registerRecoveryModule=e.deleteRegisteredEmail=e.getRegisteredEmail=e.verifyEmail=e.resendEmailVerificationCode=e.changeEmail=e.registerEmail=e.unregisterDevice=e.unregisterSafe=e.registerDevice=e.getDelegates=e.confirmSafeMessage=e.proposeSafeMessage=e.getSafeMessage=e.getSafeMessages=e.getDecodedData=e.getMasterCopies=e.getSafeApps=e.getChainConfig=e.getChainsConfig=e.getConfirmationView=e.proposeTransaction=e.getNonces=e.postSafeGasEstimation=e.deleteTransaction=e.getTransactionDetails=e.getTransactionQueue=e.getTransactionHistory=e.getCollectiblesPage=e.getCollectibles=e.getAllOwnedSafes=e.getOwnedSafes=e.getFiatCurrencies=e.getBalances=e.getMultisigTransactions=e.getModuleTransactions=e.getIncomingTransfers=e.getSafeInfo=e.getRelayCount=e.relayTransaction=e.setBaseUrl=void 0,e.putAccountDataSettings=e.getAccountDataSettings=e.getAccountDataTypes=void 0;const i=E,r=b;t(L,e),t(B,e),t(H,e),t(j,e),t(U,e),t(G,e),t(W,e),t(q,e),t(V,e),t(F,e);let s=r.DEFAULT_BASE_URL;const u=a=>{s=a};e.setBaseUrl=u;function l(a,c){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/relay",{path:{chainId:a},body:c})}e.relayTransaction=l;function g(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:a,address:c}})}e.getRelayCount=g;function A(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:a,address:c}})}e.getSafeInfo=A;function h(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:a,address:c},query:o},d)}e.getIncomingTransfers=h;function I(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getModuleTransactions=I;function X(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getMultisigTransactions=X;function Q(a,c,o="usd",d={}){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:a,address:c,currency:o},query:d})}e.getBalances=Q;function $(){return(0,i.getEndpoint)(s,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=$;function Y(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:a,address:c}})}e.getOwnedSafes=Y;function J(a){return(0,i.getEndpoint)(s,"/v1/owners/{address}/safes",{path:{address:a}})}e.getAllOwnedSafes=J;function z(a,c,o={}){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o})}e.getCollectibles=z;function Z(a,c,o={},d){return(0,i.getEndpoint)(s,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o},d)}e.getCollectiblesPage=Z;function x(a,c,o={},d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionHistory=x;function ee(a,c,o={},d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionQueue=ee;function ne(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:a,transactionId:c}})}e.getTransactionDetails=ne;function te(a,c,o){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:a,safeTxHash:c},body:{signature:o}})}e.deleteTransaction=te;function ie(a,c,o){return(0,i.postEndpoint)(s,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:a,safe_address:c},body:o})}e.postSafeGasEstimation=ie;function ae(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:a,safe_address:c}})}e.getNonces=ae;function se(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:a,safe_address:c},body:o})}e.proposeTransaction=se;function ce(a,c,o,d){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:a,safe_address:c},body:{data:o,to:d}})}e.getConfirmationView=ce;function oe(a){return(0,i.getEndpoint)(s,"/v1/chains",{query:a})}e.getChainsConfig=oe;function re(a){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}",{path:{chainId:a}})}e.getChainConfig=re;function de(a,c={}){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safe-apps",{path:{chainId:a},query:c})}e.getSafeApps=de;function ue(a){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:a}})}e.getMasterCopies=ue;function le(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/data-decoder",{path:{chainId:a},body:{data:c,to:o}})}e.getDecodedData=le;function fe(a,c,o){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},query:{}},o)}e.getSafeMessages=fe;function ge(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:a,message_hash:c}})}e.getSafeMessage=ge;function he(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},body:o})}e.proposeSafeMessage=he;function Ee(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:a,message_hash:c},body:o})}e.confirmSafeMessage=Ee;function _e(a,c={}){return(0,i.getEndpoint)(s,"/v2/chains/{chainId}/delegates",{path:{chainId:a},query:c})}e.getDelegates=_e;function Te(a){return(0,i.postEndpoint)(s,"/v1/register/notifications",{body:a})}e.registerDevice=Te;function ve(a,c,o){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:a,safe_address:c,uuid:o}})}e.unregisterSafe=ve;function Ae(a,c){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:a,uuid:c}})}e.unregisterDevice=Ae;function Ie(a,c,o,d){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:a,safe_address:c},body:o,headers:d})}e.registerEmail=Ie;function Se(a,c,o,d,v){return(0,i.putEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},body:d,headers:v})}e.changeEmail=Se;function me(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:a,safe_address:c,signer:o},body:""})}e.resendEmailVerificationCode=me;function ye(a,c,o,d){return(0,i.putEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:a,safe_address:c,signer:o},body:d})}e.verifyEmail=ye;function Oe(a,c,o,d){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.getRegisteredEmail=Oe;function Ne(a,c,o,d){return(0,i.deleteEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.deleteRegisteredEmail=Ne;function Ce(a,c,o){return(0,i.postEndpoint)(s,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:a,safe_address:c},body:o})}e.registerRecoveryModule=Ce;function be(a){return(0,i.deleteEndpoint)(s,"/v1/subscriptions",{query:a})}e.unsubscribeSingle=be;function De(a){return(0,i.deleteEndpoint)(s,"/v1/subscriptions/all",{query:a})}e.unsubscribeAll=De;function Re(a,c){return(0,i.getEndpoint)(s,"/v1/safes",{query:Object.assign(Object.assign({},c),{safes:a.join(",")})})}e.getSafeOverviews=Re;function Me(a,c){return(0,i.getEndpoint)(s,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:a,contractAddress:c}})}e.getContract=Me;function we(){return(0,i.getEndpoint)(s,"/v1/auth/nonce",{credentials:"include"})}e.getAuthNonce=we;function Pe(a){return(0,i.postEndpoint)(s,"/v1/auth/verify",{body:a,credentials:"include"})}e.verifyAuth=Pe;function pe(a){return(0,i.postEndpoint)(s,"/v1/accounts",{body:a,credentials:"include"})}e.createAccount=pe;function Le(a){return(0,i.getEndpoint)(s,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.getAccount=Le;function Be(a){return(0,i.deleteEndpoint)(s,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.deleteAccount=Be;function He(){return(0,i.getEndpoint)(s,"/v1/accounts/data-types")}e.getAccountDataTypes=He;function je(a){return(0,i.getEndpoint)(s,"/v1/accounts/{address}/data-settings",{path:{address:a},credentials:"include"})}e.getAccountDataSettings=je;function Ue(a,c){return(0,i.putEndpoint)(s,"/v1/accounts/{address}/data-settings",{path:{address:a},body:c,credentials:"include"})}e.putAccountDataSettings=Ue})(Fe);class en{constructor(n){this.communicator=n}async getBySafeTxHash(n){if(!n)throw new Error("Invalid safeTxHash");return(await this.communicator.send(exports.Methods.getTxBySafeTxHash,{safeTxHash:n})).data}async signMessage(n){const t={message:n};return(await this.communicator.send(exports.Methods.signMessage,t)).data}async signTypedMessage(n){if(!R(n))throw new Error("Invalid typed data");return(await this.communicator.send(exports.Methods.signTypedMessage,{typedData:n})).data}async send({txs:n,params:t}){if(!n||!n.length)throw new Error("No transactions were passed");const i={txs:n,params:t};return(await this.communicator.send(exports.Methods.sendTransactions,i)).data}}const f={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"},T={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class nn{constructor(n){this.communicator=n,this.call=this.buildRequest({call:f.eth_call,formatters:[null,T.defaultBlockParam]}),this.getBalance=this.buildRequest({call:f.eth_getBalance,formatters:[null,T.defaultBlockParam]}),this.getCode=this.buildRequest({call:f.eth_getCode,formatters:[null,T.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:f.eth_getStorageAt,formatters:[null,T.blockNumberToHex,T.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:f.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:f.eth_getBlockByHash,formatters:[null,T.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:f.eth_getBlockByNumber,formatters:[T.blockNumberToHex,T.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:f.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:f.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:f.eth_getTransactionCount,formatters:[null,T.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:f.eth_gasPrice}),this.getEstimateGas=t=>this.buildRequest({call:f.eth_estimateGas})([t]),this.setSafeSettings=this.buildRequest({call:f.safe_setSettings})}buildRequest(n){const{call:t,formatters:i}=n;return async r=>{i&&Array.isArray(r)&&i.forEach((l,g)=>{l&&(r[g]=l(r[g]))});const s={call:t,params:r||[]};return(await this.communicator.send(exports.Methods.rpcCall,s)).data}}}const tn="0x1626ba7e",an="0x20c13b0b",D=4001;class y extends Error{constructor(n,t,i){super(n),this.code=t,this.data=i,Object.setPrototypeOf(this,y.prototype)}}class k{constructor(n){this.communicator=n}async getPermissions(){return(await this.communicator.send(exports.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(n){if(!this.isPermissionRequestValid(n))throw new y("Permissions request is invalid",D);try{return(await this.communicator.send(exports.Methods.wallet_requestPermissions,n)).data}catch{throw new y("Permissions rejected",D)}}isPermissionRequestValid(n){return n.every(t=>typeof t=="object"?Object.keys(t).every(i=>!!Object.values(exports.RestrictedMethods).includes(i)):!1)}}const w=(e,n)=>n.some(t=>t.parentCapability===e),sn=()=>(e,n,t)=>{const i=t.value;return t.value=async function(){const r=new k(this.communicator);let s=await r.getPermissions();if(w(n,s)||(s=await r.requestPermissions([{[n]:{}}])),!w(n,s))throw new y("Permissions rejected",D);return i.apply(this)},t};var cn=function(e,n,t,i){var r=arguments.length,s=r<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,n,t,i);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(s=(r<3?u(s):r>3?u(n,t,s):u(n,t))||s);return r>3&&s&&Object.defineProperty(n,t,s),s};class K{constructor(n){this.communicator=n}async getChainInfo(){return(await this.communicator.send(exports.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(exports.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:n="usd"}={}){return(await this.communicator.send(exports.Methods.getSafeBalances,{currency:n})).data}async check1271Signature(n,t="0x"){const i=await this.getInfo(),r=N.encodeFunctionData({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:[n,t]}),s={call:f.eth_call,params:[{to:i.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(exports.Methods.rpcCall,s)).data.slice(0,10).toLowerCase()===tn}catch{return!1}}async check1271SignatureBytes(n,t="0x"){const i=await this.getInfo(),r=N.encodeFunctionData({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:[n,t]}),s={call:f.eth_call,params:[{to:i.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(exports.Methods.rpcCall,s)).data.slice(0,10).toLowerCase()===an}catch{return!1}}calculateMessageHash(n){return N.hashMessage(n)}calculateTypedMessageHash(n){const t=typeof n.domain.chainId=="object"?n.domain.chainId.toNumber():Number(n.domain.chainId);let i=n.primaryType;if(!i){const r=Object.values(n.types),s=Object.keys(n.types).filter(u=>r.every(l=>l.every(({type:g})=>g.replace("[","").replace("]","")!==u)));if(s.length===0||s.length>1)throw new Error("Please specify primaryType");i=s[0]}return N.hashTypedData({message:n.message,domain:{...n.domain,chainId:t,verifyingContract:n.domain.verifyingContract,salt:n.domain.salt},types:n.types,primaryType:i})}async getOffChainSignature(n){return(await this.communicator.send(exports.Methods.getOffChainSignature,n)).data}async isMessageSigned(n,t="0x"){let i;if(typeof n=="string"&&(i=async()=>{const r=this.calculateMessageHash(n);return await this.isMessageHashSigned(r,t)}),R(n)&&(i=async()=>{const r=this.calculateTypedMessageHash(n);return await this.isMessageHashSigned(r,t)}),i)return await i();throw new Error("Invalid message type")}async isMessageHashSigned(n,t="0x"){const i=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of i)if(await r(n,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(exports.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(exports.Methods.requestAddressBook,void 0)).data}}cn([sn()],K.prototype,"requestAddressBook",null);class on{constructor(n={}){const{allowedDomains:t=null,debug:i=!1}=n;this.communicator=new Ve(t,i),this.eth=new nn(this.communicator),this.txs=new en(this.communicator),this.safe=new K(this.communicator),this.wallet=new k(this.communicator)}}const rn=on;exports.MessageFormatter=O;exports.RPC_CALLS=f;exports.default=rn;exports.getSDKVersion=P;exports.isObjectEIP712TypedData=R;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./W3MFrameProviderSingleton-C56DqhGz.cjs"),o=t.proxy({status:"uninitialized"}),u={state:o,subscribeKey(n,e){return t.subscribeKey(o,n,e)},subscribe(n){return t.subscribe(o,()=>n(o))},_getClient(){if(!o._client)throw new Error("SIWEController client not set");return o._client},async getNonce(n){const i=await this._getClient().getNonce(n);return this.setNonce(i),i},async getSession(){try{const e=await this._getClient().getSession();return e&&(this.setSession(e),this.setStatus("success")),e||void 0}catch{return}},createMessage(n){const i=this._getClient().createMessage(n);return this.setMessage(i),i},async verifyMessage(n){return await this._getClient().verifyMessage(n)},async signIn(){return await this._getClient().signIn()},async signOut(){var e;const n=this._getClient();await n.signOut(),this.setStatus("ready"),this.setSession(void 0),(e=n.onSignOut)==null||e.call(n)},onSignIn(n){var i;const e=this._getClient();(i=e.onSignIn)==null||i.call(e,n)},onSignOut(){var e;const n=this._getClient();(e=n.onSignOut)==null||e.call(n)},async setSIWEClient(n){o._client=t.ref(n),o.session=await this.getSession(),o.status=o.session?"success":"ready",t.ChainController.setAccountProp("siweStatus",o.status,"eip155"),t.OptionsController.setIsSiweEnabled(n.options.enabled)},setNonce(n){o.nonce=n},setStatus(n){o.status=n,t.ChainController.setAccountProp("siweStatus",o.status,"eip155")},setMessage(n){o.message=n},setSession(n){o.session=n,o.status=n?"success":"ready",t.ChainController.setAccountProp("siweStatus",o.status,"eip155")}},d=t.i`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./W3MFrameProviderSingleton-EQdqCGSY.cjs"),o=t.proxy({status:"uninitialized"}),u={state:o,subscribeKey(n,e){return t.subscribeKey(o,n,e)},subscribe(n){return t.subscribe(o,()=>n(o))},_getClient(){if(!o._client)throw new Error("SIWEController client not set");return o._client},async getNonce(n){const i=await this._getClient().getNonce(n);return this.setNonce(i),i},async getSession(){try{const e=await this._getClient().getSession();return e&&(this.setSession(e),this.setStatus("success")),e||void 0}catch{return}},createMessage(n){const i=this._getClient().createMessage(n);return this.setMessage(i),i},async verifyMessage(n){return await this._getClient().verifyMessage(n)},async signIn(){return await this._getClient().signIn()},async signOut(){var e;const n=this._getClient();await n.signOut(),this.setStatus("ready"),this.setSession(void 0),(e=n.onSignOut)==null||e.call(n)},onSignIn(n){var i;const e=this._getClient();(i=e.onSignIn)==null||i.call(e,n)},onSignOut(){var e;const n=this._getClient();(e=n.onSignOut)==null||e.call(n)},async setSIWEClient(n){o._client=t.ref(n),o.session=await this.getSession(),o.status=o.session?"success":"ready",t.ChainController.setAccountProp("siweStatus",o.status,"eip155"),t.OptionsController.setIsSiweEnabled(n.options.enabled)},setNonce(n){o.nonce=n},setStatus(n){o.status=n,t.ChainController.setAccountProp("siweStatus",o.status,"eip155")},setMessage(n){o.message=n},setSession(n){o.session=n,o.status=n?"success":"ready",t.ChainController.setAccountProp("siweStatus",o.status,"eip155")}},d=t.i`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1,5 +1,5 @@
1
- import { p as b, q as x, r as v, t as E, g as c, O as C, u as T, v as m, w as y, o as u, x as A, y as _, z as d, k as g, D as S, F as I, M as O, R as N } from "./W3MFrameProviderSingleton-B9E01rnL.js";
2
- import { J as k, Y as z, G as D } from "./W3MFrameProviderSingleton-B9E01rnL.js";
1
+ import { q as b, r as x, t as v, u as E, h as c, O as C, v as T, w as m, x as y, p as u, y as A, z as _, D as d, l as g, F as S, G as I, M as O, R as N } from "./W3MFrameProviderSingleton-CRF_1us_.js";
2
+ import { J as k, Y as z, I as D } from "./W3MFrameProviderSingleton-CRF_1us_.js";
3
3
  const i = b({
4
4
  status: "uninitialized"
5
5
  }), p = {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./W3MFrameProviderSingleton-C56DqhGz.cjs"),Uw=":";function $n(i){const[t,e]=i.split(Uw);return{namespace:t,reference:e}}function Gl(i,t=[]){const e=[];return Object.keys(i).forEach(s=>{if(t.length&&!t.includes(s))return;const o=i[s];e.push(...o.accounts)}),e}function Ap(i,t){return i.includes(":")?[i]:t.chains||[]}var $w=Object.defineProperty,Yl=Object.getOwnPropertySymbols,zw=Object.prototype.hasOwnProperty,Lw=Object.prototype.propertyIsEnumerable,Wl=(i,t,e)=>t in i?$w(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zl=(i,t)=>{for(var e in t||(t={}))zw.call(t,e)&&Wl(i,e,t[e]);if(Yl)for(var e of Yl(t))Lw.call(t,e)&&Wl(i,e,t[e]);return i};const Kw="ReactNative",mr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Hw="js";function Hn(){return typeof A.process$1<"u"&&typeof A.process$1.versions<"u"&&typeof A.process$1.versions.node<"u"}function Gn(){return!A.getDocument_1()&&!!A.getNavigator_1()&&navigator.product===Kw}function Yn(){return!Hn()&&!!A.getNavigator_1()&&!!A.getDocument_1()}function Wn(){return Gn()?mr.reactNative:Hn()?mr.node:Yn()?mr.browser:mr.unknown}function Vw(){var i;try{return Gn()&&typeof A.global<"u"&&typeof(A.global==null?void 0:A.global.Application)<"u"?(i=A.global.Application)==null?void 0:i.applicationId:void 0}catch{return}}function Jw(i,t){let e=A.queryString.parse(i);return e=Zl(Zl({},e),t),i=A.queryString.stringify(e),i}function Qw(){return A.getWindowMetadata_1()||{name:"",description:"",url:"",icons:[""]}}function Gw(){if(Wn()===mr.reactNative&&typeof A.global<"u"&&typeof(A.global==null?void 0:A.global.Platform)<"u"){const{OS:e,Version:s}=A.global.Platform;return[e,s].join("-")}const i=A.detect();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Yw(){var i;const t=Wn();return t===mr.browser?[t,((i=A.getLocation_1())==null?void 0:i.host)||"unknown"].join(":"):t}function Ww(i,t,e){const s=Gw(),o=Yw();return[[i,t].join("-"),[Hw,e].join("-"),s,o].join("/")}function Zw({protocol:i,version:t,relayUrl:e,sdkVersion:s,auth:o,projectId:a,useOnCloseEvent:h,bundleId:p}){const v=e.split("?"),y=Ww(i,t,s),M={auth:o,ua:y,projectId:a,useOnCloseEvent:h||void 0,origin:p||void 0},P=Jw(v[1]||"",M);return v[0]+"?"+P}function ws(i,t){return i.filter(e=>t.includes(e)).length===i.length}function Ep(i){return Object.fromEntries(i.entries())}function Ip(i){return new Map(Object.entries(i))}function ys(i=A.cjs.FIVE_MINUTES,t){const e=A.cjs.toMiliseconds(i||A.cjs.FIVE_MINUTES);let s,o,a;return{resolve:h=>{a&&s&&(clearTimeout(a),s(h))},reject:h=>{a&&o&&(clearTimeout(a),o(h))},done:()=>new Promise((h,p)=>{a=setTimeout(()=>{p(new Error(t))},e),s=h,o=p})}}function Qs(i,t,e){return new Promise(async(s,o)=>{const a=setTimeout(()=>o(new Error(e)),t);try{const h=await i;s(h)}catch(h){o(h)}clearTimeout(a)})}function Sp(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${i}`)}function Xw(i){return Sp("topic",i)}function tb(i){return Sp("id",i)}function Pp(i){const[t,e]=i.split(":"),s={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")s.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))s.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return s}function Ue(i,t){return A.cjs.fromMiliseconds(Date.now()+A.cjs.toMiliseconds(i))}function rs(i){return Date.now()>=A.cjs.toMiliseconds(i)}function It(i,t){return`${i}${t?`:${t}`:""}`}function Yo(i=[],t=[]){return[...new Set([...i,...t])]}async function eb({id:i,topic:t,wcDeepLink:e}){var s;try{if(!e)return;const o=typeof e=="string"?JSON.parse(e):e;let a=o==null?void 0:o.href;if(typeof a!="string")return;a.endsWith("/")&&(a=a.slice(0,-1));const h=`${a}/wc?requestId=${i}&sessionTopic=${t}`,p=Wn();if(p===mr.browser){if(!((s=A.getDocument_1())!=null&&s.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}h.startsWith("https://")||h.startsWith("http://")?window.open(h,"_blank","noreferrer noopener"):window.open(h,"_self","noreferrer noopener")}else p===mr.reactNative&&typeof(A.global==null?void 0:A.global.Linking)<"u"&&await A.global.Linking.openURL(h)}catch(o){console.error(o)}}async function rb(i,t){try{return await i.getItem(t)||(Yn()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}function ib(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}var Mp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof A.global<"u"?A.global:typeof self<"u"?self:{};function sb(i){var t=i.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var o=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:function(){return i[s]}})}),e}var Cp={exports:{}};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./W3MFrameProviderSingleton-EQdqCGSY.cjs"),Uw=":";function $n(i){const[t,e]=i.split(Uw);return{namespace:t,reference:e}}function Gl(i,t=[]){const e=[];return Object.keys(i).forEach(s=>{if(t.length&&!t.includes(s))return;const o=i[s];e.push(...o.accounts)}),e}function Ap(i,t){return i.includes(":")?[i]:t.chains||[]}var $w=Object.defineProperty,Yl=Object.getOwnPropertySymbols,zw=Object.prototype.hasOwnProperty,Lw=Object.prototype.propertyIsEnumerable,Wl=(i,t,e)=>t in i?$w(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Zl=(i,t)=>{for(var e in t||(t={}))zw.call(t,e)&&Wl(i,e,t[e]);if(Yl)for(var e of Yl(t))Lw.call(t,e)&&Wl(i,e,t[e]);return i};const Kw="ReactNative",mr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Hw="js";function Hn(){return typeof A.process$1<"u"&&typeof A.process$1.versions<"u"&&typeof A.process$1.versions.node<"u"}function Gn(){return!A.getDocument_1()&&!!A.getNavigator_1()&&navigator.product===Kw}function Yn(){return!Hn()&&!!A.getNavigator_1()&&!!A.getDocument_1()}function Wn(){return Gn()?mr.reactNative:Hn()?mr.node:Yn()?mr.browser:mr.unknown}function Vw(){var i;try{return Gn()&&typeof A.global<"u"&&typeof(A.global==null?void 0:A.global.Application)<"u"?(i=A.global.Application)==null?void 0:i.applicationId:void 0}catch{return}}function Jw(i,t){let e=A.queryString.parse(i);return e=Zl(Zl({},e),t),i=A.queryString.stringify(e),i}function Qw(){return A.getWindowMetadata_1()||{name:"",description:"",url:"",icons:[""]}}function Gw(){if(Wn()===mr.reactNative&&typeof A.global<"u"&&typeof(A.global==null?void 0:A.global.Platform)<"u"){const{OS:e,Version:s}=A.global.Platform;return[e,s].join("-")}const i=A.detect();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Yw(){var i;const t=Wn();return t===mr.browser?[t,((i=A.getLocation_1())==null?void 0:i.host)||"unknown"].join(":"):t}function Ww(i,t,e){const s=Gw(),o=Yw();return[[i,t].join("-"),[Hw,e].join("-"),s,o].join("/")}function Zw({protocol:i,version:t,relayUrl:e,sdkVersion:s,auth:o,projectId:a,useOnCloseEvent:h,bundleId:p}){const v=e.split("?"),y=Ww(i,t,s),M={auth:o,ua:y,projectId:a,useOnCloseEvent:h||void 0,origin:p||void 0},P=Jw(v[1]||"",M);return v[0]+"?"+P}function ws(i,t){return i.filter(e=>t.includes(e)).length===i.length}function Ep(i){return Object.fromEntries(i.entries())}function Ip(i){return new Map(Object.entries(i))}function ys(i=A.cjs.FIVE_MINUTES,t){const e=A.cjs.toMiliseconds(i||A.cjs.FIVE_MINUTES);let s,o,a;return{resolve:h=>{a&&s&&(clearTimeout(a),s(h))},reject:h=>{a&&o&&(clearTimeout(a),o(h))},done:()=>new Promise((h,p)=>{a=setTimeout(()=>{p(new Error(t))},e),s=h,o=p})}}function Qs(i,t,e){return new Promise(async(s,o)=>{const a=setTimeout(()=>o(new Error(e)),t);try{const h=await i;s(h)}catch(h){o(h)}clearTimeout(a)})}function Sp(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${i}`)}function Xw(i){return Sp("topic",i)}function tb(i){return Sp("id",i)}function Pp(i){const[t,e]=i.split(":"),s={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")s.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))s.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return s}function Ue(i,t){return A.cjs.fromMiliseconds(Date.now()+A.cjs.toMiliseconds(i))}function rs(i){return Date.now()>=A.cjs.toMiliseconds(i)}function It(i,t){return`${i}${t?`:${t}`:""}`}function Yo(i=[],t=[]){return[...new Set([...i,...t])]}async function eb({id:i,topic:t,wcDeepLink:e}){var s;try{if(!e)return;const o=typeof e=="string"?JSON.parse(e):e;let a=o==null?void 0:o.href;if(typeof a!="string")return;a.endsWith("/")&&(a=a.slice(0,-1));const h=`${a}/wc?requestId=${i}&sessionTopic=${t}`,p=Wn();if(p===mr.browser){if(!((s=A.getDocument_1())!=null&&s.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}h.startsWith("https://")||h.startsWith("http://")?window.open(h,"_blank","noreferrer noopener"):window.open(h,"_self","noreferrer noopener")}else p===mr.reactNative&&typeof(A.global==null?void 0:A.global.Linking)<"u"&&await A.global.Linking.openURL(h)}catch(o){console.error(o)}}async function rb(i,t){try{return await i.getItem(t)||(Yn()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}function ib(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}var Mp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof A.global<"u"?A.global:typeof self<"u"?self:{};function sb(i){var t=i.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var o=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:function(){return i[s]}})}),e}var Cp={exports:{}};/**
2
2
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
3
3
  *
4
4
  * @version 0.8.0
@@ -40,4 +40,4 @@ __p += '`),Rt&&(J+=`' +
40
40
  function print() { __p += __j.call(arguments, '') }
41
41
  `:`;
42
42
  `)+J+`return __p
43
- }`;var _t=Vl(function(){return qt(_,nt+"return "+J).apply(e,x)});if(_t.source=J,mc(_t))throw _t;return _t}function Jy(r){return jt(r).toLowerCase()}function Qy(r){return jt(r).toUpperCase()}function Gy(r,n,c){if(r=jt(r),r&&(c||n===e))return eu(r);if(!r||!(n=fr(n)))return r;var l=kr(r),g=kr(n),_=ru(l,g),x=iu(l,g)+1;return Xi(l,_,x).join("")}function Yy(r,n,c){if(r=jt(r),r&&(c||n===e))return r.slice(0,nu(r)+1);if(!r||!(n=fr(n)))return r;var l=kr(r),g=iu(l,kr(n))+1;return Xi(l,0,g).join("")}function Wy(r,n,c){if(r=jt(r),r&&(c||n===e))return r.replace(Jt,"");if(!r||!(n=fr(n)))return r;var l=kr(r),g=ru(l,kr(n));return Xi(l,g).join("")}function Zy(r,n){var c=Te,l=Ct;if(be(n)){var g="separator"in n?n.separator:g;c="length"in n?bt(n.length):c,l="omission"in n?fr(n.omission):l}r=jt(r);var _=r.length;if(Ns(r)){var x=kr(r);_=x.length}if(c>=_)return r;var R=c-Os(l);if(R<1)return l;var F=x?Xi(x,0,R).join(""):r.slice(0,R);if(g===e)return F+l;if(x&&(R+=F.length-R),vc(g)){if(r.slice(R).search(g)){var z,L=F;for(g.global||(g=Ta(g.source,jt(Zt.exec(g))+"g")),g.lastIndex=0;z=g.exec(L);)var J=z.index;F=F.slice(0,J===e?R:J)}}else if(r.indexOf(fr(g),R)!=R){var Z=F.lastIndexOf(g);Z>-1&&(F=F.slice(0,Z))}return F+l}function Xy(r){return r=jt(r),r&&se.test(r)?r.replace(Yt,C0):r}var tw=js(function(r,n,c){return r+(c?" ":"")+n.toUpperCase()}),bc=Ju("toUpperCase");function Hl(r,n,c){return r=jt(r),n=c?e:n,n===e?E0(r)?N0(r):d0(r):r.match(n)||[]}var Vl=At(function(r,n){try{return ur(r,e,n)}catch(c){return mc(c)?c:new vt(c)}}),ew=Oi(function(r,n){return br(n,function(c){c=oi(c),Ri(r,c,dc(r[c],r))}),r});function rw(r){var n=r==null?0:r.length,c=ft();return r=n?we(r,function(l){if(typeof l[1]!="function")throw new _r(h);return[c(l[0]),l[1]]}):[],At(function(l){for(var g=-1;++g<n;){var _=r[g];if(ur(_[0],this,l))return ur(_[1],this,l)}})}function iw(r){return Cg(Er(r,P))}function _c(r){return function(){return r}}function sw(r,n){return r==null||r!==r?n:r}var nw=Gu(),ow=Gu(!0);function rr(r){return r}function Ac(r){return Su(typeof r=="function"?r:Er(r,P))}function aw(r){return Mu(Er(r,P))}function cw(r,n){return Cu(r,Er(n,P))}var hw=At(function(r,n){return function(c){return An(c,r,n)}}),uw=At(function(r,n){return function(c){return An(r,c,n)}});function Ec(r,n,c){var l=Fe(n),g=Ao(n,l);c==null&&!(be(n)&&(g.length||!l.length))&&(c=n,n=r,r=this,g=Ao(n,Fe(n)));var _=!(be(c)&&"chain"in c)||!!c.chain,x=Fi(r);return br(g,function(R){var F=n[R];r[R]=F,x&&(r.prototype[R]=function(){var z=this.__chain__;if(_||z){var L=r(this.__wrapped__),J=L.__actions__=Xe(this.__actions__);return J.push({func:F,args:arguments,thisArg:r}),L.__chain__=z,L}return F.apply(r,Ji([this.value()],arguments))})}),r}function lw(){return qe._===this&&(qe._=k0),this}function Ic(){}function fw(r){return r=bt(r),At(function(n){return xu(n,r)})}var pw=ec(we),dw=ec(Yh),gw=ec(Pa);function Jl(r){return cc(r)?Ma(oi(r)):Hg(r)}function mw(r){return function(n){return r==null?e:ls(r,n)}}var vw=Wu(),yw=Wu(!0);function Sc(){return[]}function Pc(){return!1}function ww(){return{}}function bw(){return""}function _w(){return!0}function Aw(r,n){if(r=bt(r),r<1||r>N)return[];var c=f,l=Le(r,f);n=ft(n),r-=f;for(var g=Ra(l,n);++c<r;)n(c);return g}function Ew(r){return yt(r)?we(r,oi):pr(r)?[r]:Xe(pl(jt(r)))}function Iw(r){var n=++D0;return jt(r)+n}var Sw=Co(function(r,n){return r+n},0),Pw=rc("ceil"),Mw=Co(function(r,n){return r/n},1),Cw=rc("floor");function xw(r){return r&&r.length?_o(r,rr,$a):e}function Rw(r,n){return r&&r.length?_o(r,ft(n,2),$a):e}function Nw(r){return Xh(r,rr)}function Ow(r,n){return Xh(r,ft(n,2))}function Tw(r){return r&&r.length?_o(r,rr,Ha):e}function Fw(r,n){return r&&r.length?_o(r,ft(n,2),Ha):e}var Dw=Co(function(r,n){return r*n},1),qw=rc("round"),kw=Co(function(r,n){return r-n},0);function Bw(r){return r&&r.length?xa(r,rr):0}function jw(r,n){return r&&r.length?xa(r,ft(n,2)):0}return w.after=av,w.ary=Il,w.assign=Qv,w.assignIn=Bl,w.assignInWith=$o,w.assignWith=Gv,w.at=Yv,w.before=Sl,w.bind=dc,w.bindAll=ew,w.bindKey=Pl,w.castArray=wv,w.chain=_l,w.chunk=C1,w.compact=x1,w.concat=R1,w.cond=rw,w.conforms=iw,w.constant=_c,w.countBy=Bm,w.create=Wv,w.curry=Ml,w.curryRight=Cl,w.debounce=xl,w.defaults=Zv,w.defaultsDeep=Xv,w.defer=cv,w.delay=hv,w.difference=N1,w.differenceBy=O1,w.differenceWith=T1,w.drop=F1,w.dropRight=D1,w.dropRightWhile=q1,w.dropWhile=k1,w.fill=B1,w.filter=Um,w.flatMap=Lm,w.flatMapDeep=Km,w.flatMapDepth=Hm,w.flatten=vl,w.flattenDeep=j1,w.flattenDepth=U1,w.flip=uv,w.flow=nw,w.flowRight=ow,w.fromPairs=$1,w.functions=oy,w.functionsIn=ay,w.groupBy=Vm,w.initial=L1,w.intersection=K1,w.intersectionBy=H1,w.intersectionWith=V1,w.invert=hy,w.invertBy=uy,w.invokeMap=Qm,w.iteratee=Ac,w.keyBy=Gm,w.keys=Fe,w.keysIn=er,w.map=Do,w.mapKeys=fy,w.mapValues=py,w.matches=aw,w.matchesProperty=cw,w.memoize=ko,w.merge=dy,w.mergeWith=jl,w.method=hw,w.methodOf=uw,w.mixin=Ec,w.negate=Bo,w.nthArg=fw,w.omit=gy,w.omitBy=my,w.once=lv,w.orderBy=Ym,w.over=pw,w.overArgs=fv,w.overEvery=dw,w.overSome=gw,w.partial=gc,w.partialRight=Rl,w.partition=Wm,w.pick=vy,w.pickBy=Ul,w.property=Jl,w.propertyOf=mw,w.pull=Y1,w.pullAll=wl,w.pullAllBy=W1,w.pullAllWith=Z1,w.pullAt=X1,w.range=vw,w.rangeRight=yw,w.rearg=pv,w.reject=tv,w.remove=tm,w.rest=dv,w.reverse=fc,w.sampleSize=rv,w.set=wy,w.setWith=by,w.shuffle=iv,w.slice=em,w.sortBy=ov,w.sortedUniq=cm,w.sortedUniqBy=hm,w.split=Ly,w.spread=gv,w.tail=um,w.take=lm,w.takeRight=fm,w.takeRightWhile=pm,w.takeWhile=dm,w.tap=xm,w.throttle=mv,w.thru=Fo,w.toArray=Dl,w.toPairs=$l,w.toPairsIn=zl,w.toPath=Ew,w.toPlainObject=kl,w.transform=_y,w.unary=vv,w.union=gm,w.unionBy=mm,w.unionWith=vm,w.uniq=ym,w.uniqBy=wm,w.uniqWith=bm,w.unset=Ay,w.unzip=pc,w.unzipWith=bl,w.update=Ey,w.updateWith=Iy,w.values=zs,w.valuesIn=Sy,w.without=_m,w.words=Hl,w.wrap=yv,w.xor=Am,w.xorBy=Em,w.xorWith=Im,w.zip=Sm,w.zipObject=Pm,w.zipObjectDeep=Mm,w.zipWith=Cm,w.entries=$l,w.entriesIn=zl,w.extend=Bl,w.extendWith=$o,Ec(w,w),w.add=Sw,w.attempt=Vl,w.camelCase=xy,w.capitalize=Ll,w.ceil=Pw,w.clamp=Py,w.clone=bv,w.cloneDeep=Av,w.cloneDeepWith=Ev,w.cloneWith=_v,w.conformsTo=Iv,w.deburr=Kl,w.defaultTo=sw,w.divide=Mw,w.endsWith=Ry,w.eq=jr,w.escape=Ny,w.escapeRegExp=Oy,w.every=jm,w.find=$m,w.findIndex=gl,w.findKey=ty,w.findLast=zm,w.findLastIndex=ml,w.findLastKey=ey,w.floor=Cw,w.forEach=Al,w.forEachRight=El,w.forIn=ry,w.forInRight=iy,w.forOwn=sy,w.forOwnRight=ny,w.get=yc,w.gt=Sv,w.gte=Pv,w.has=cy,w.hasIn=wc,w.head=yl,w.identity=rr,w.includes=Jm,w.indexOf=z1,w.inRange=My,w.invoke=ly,w.isArguments=ds,w.isArray=yt,w.isArrayBuffer=Mv,w.isArrayLike=tr,w.isArrayLikeObject=Ee,w.isBoolean=Cv,w.isBuffer=ts,w.isDate=xv,w.isElement=Rv,w.isEmpty=Nv,w.isEqual=Ov,w.isEqualWith=Tv,w.isError=mc,w.isFinite=Fv,w.isFunction=Fi,w.isInteger=Nl,w.isLength=jo,w.isMap=Ol,w.isMatch=Dv,w.isMatchWith=qv,w.isNaN=kv,w.isNative=Bv,w.isNil=Uv,w.isNull=jv,w.isNumber=Tl,w.isObject=be,w.isObjectLike=_e,w.isPlainObject=Cn,w.isRegExp=vc,w.isSafeInteger=$v,w.isSet=Fl,w.isString=Uo,w.isSymbol=pr,w.isTypedArray=$s,w.isUndefined=zv,w.isWeakMap=Lv,w.isWeakSet=Kv,w.join=J1,w.kebabCase=Ty,w.last=Sr,w.lastIndexOf=Q1,w.lowerCase=Fy,w.lowerFirst=Dy,w.lt=Hv,w.lte=Vv,w.max=xw,w.maxBy=Rw,w.mean=Nw,w.meanBy=Ow,w.min=Tw,w.minBy=Fw,w.stubArray=Sc,w.stubFalse=Pc,w.stubObject=ww,w.stubString=bw,w.stubTrue=_w,w.multiply=Dw,w.nth=G1,w.noConflict=lw,w.noop=Ic,w.now=qo,w.pad=qy,w.padEnd=ky,w.padStart=By,w.parseInt=jy,w.random=Cy,w.reduce=Zm,w.reduceRight=Xm,w.repeat=Uy,w.replace=$y,w.result=yy,w.round=qw,w.runInContext=O,w.sample=ev,w.size=sv,w.snakeCase=zy,w.some=nv,w.sortedIndex=rm,w.sortedIndexBy=im,w.sortedIndexOf=sm,w.sortedLastIndex=nm,w.sortedLastIndexBy=om,w.sortedLastIndexOf=am,w.startCase=Ky,w.startsWith=Hy,w.subtract=kw,w.sum=Bw,w.sumBy=jw,w.template=Vy,w.times=Aw,w.toFinite=Di,w.toInteger=bt,w.toLength=ql,w.toLower=Jy,w.toNumber=Pr,w.toSafeInteger=Jv,w.toString=jt,w.toUpper=Qy,w.trim=Gy,w.trimEnd=Yy,w.trimStart=Wy,w.truncate=Zy,w.unescape=Xy,w.uniqueId=Iw,w.upperCase=tw,w.upperFirst=bc,w.each=Al,w.eachRight=El,w.first=yl,Ec(w,function(){var r={};return si(w,function(n,c){Qt.call(w.prototype,c)||(r[c]=n)}),r}(),{chain:!1}),w.VERSION=s,br(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){w[r].placeholder=w}),br(["drop","take"],function(r,n){St.prototype[r]=function(c){c=c===e?1:Re(bt(c),0);var l=this.__filtered__&&!n?new St(this):this.clone();return l.__filtered__?l.__takeCount__=Le(c,l.__takeCount__):l.__views__.push({size:Le(c,f),type:r+(l.__dir__<0?"Right":"")}),l},St.prototype[r+"Right"]=function(c){return this.reverse()[r](c).reverse()}}),br(["filter","map","takeWhile"],function(r,n){var c=n+1,l=c==d||c==I;St.prototype[r]=function(g){var _=this.clone();return _.__iteratees__.push({iteratee:ft(g,3),type:c}),_.__filtered__=_.__filtered__||l,_}}),br(["head","last"],function(r,n){var c="take"+(n?"Right":"");St.prototype[r]=function(){return this[c](1).value()[0]}}),br(["initial","tail"],function(r,n){var c="drop"+(n?"":"Right");St.prototype[r]=function(){return this.__filtered__?new St(this):this[c](1)}}),St.prototype.compact=function(){return this.filter(rr)},St.prototype.find=function(r){return this.filter(r).head()},St.prototype.findLast=function(r){return this.reverse().find(r)},St.prototype.invokeMap=At(function(r,n){return typeof r=="function"?new St(this):this.map(function(c){return An(c,r,n)})}),St.prototype.reject=function(r){return this.filter(Bo(ft(r)))},St.prototype.slice=function(r,n){r=bt(r);var c=this;return c.__filtered__&&(r>0||n<0)?new St(c):(r<0?c=c.takeRight(-r):r&&(c=c.drop(r)),n!==e&&(n=bt(n),c=n<0?c.dropRight(-n):c.take(n-r)),c)},St.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},St.prototype.toArray=function(){return this.take(f)},si(St.prototype,function(r,n){var c=/^(?:filter|find|map|reject)|While$/.test(n),l=/^(?:head|last)$/.test(n),g=w[l?"take"+(n=="last"?"Right":""):n],_=l||/^find/.test(n);g&&(w.prototype[n]=function(){var x=this.__wrapped__,R=l?[1]:arguments,F=x instanceof St,z=R[0],L=F||yt(x),J=function(Et){var Rt=g.apply(w,Ji([Et],R));return l&&Z?Rt[0]:Rt};L&&c&&typeof z=="function"&&z.length!=1&&(F=L=!1);var Z=this.__chain__,nt=!!this.__actions__.length,pt=_&&!Z,_t=F&&!nt;if(!_&&L){x=_t?x:new St(this);var dt=r.apply(x,R);return dt.__actions__.push({func:Fo,args:[J],thisArg:e}),new Ar(dt,Z)}return pt&&_t?r.apply(this,R):(dt=this.thru(J),pt?l?dt.value()[0]:dt.value():dt)})}),br(["pop","push","shift","sort","splice","unshift"],function(r){var n=no[r],c=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",l=/^(?:pop|shift)$/.test(r);w.prototype[r]=function(){var g=arguments;if(l&&!this.__chain__){var _=this.value();return n.apply(yt(_)?_:[],g)}return this[c](function(x){return n.apply(yt(x)?x:[],g)})}}),si(St.prototype,function(r,n){var c=w[n];if(c){var l=c.name+"";Qt.call(qs,l)||(qs[l]=[]),qs[l].push({name:n,func:c})}}),qs[Mo(e,Q).name]=[{name:"wrapper",func:e}],St.prototype.clone=X0,St.prototype.reverse=tg,St.prototype.value=eg,w.prototype.at=Rm,w.prototype.chain=Nm,w.prototype.commit=Om,w.prototype.next=Tm,w.prototype.plant=Dm,w.prototype.reverse=qm,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=km,w.prototype.first=w.prototype.head,gn&&(w.prototype[gn]=Fm),w},Ts=O0();os?((os.exports=Ts)._=Ts,Aa._=Ts):qe._=Ts}).call(kn)})(lh,lh.exports);var jI=Object.defineProperty,UI=Object.defineProperties,$I=Object.getOwnPropertyDescriptors,up=Object.getOwnPropertySymbols,zI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,lp=(i,t,e)=>t in i?jI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jo=(i,t)=>{for(var e in t||(t={}))zI.call(t,e)&&lp(i,e,t[e]);if(up)for(var e of up(t))LI.call(t,e)&&lp(i,e,t[e]);return i},KI=(i,t)=>UI(i,$I(t));function Qr(i,t,e){var s;const o=$n(i);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${BI}?chainId=${o.namespace}:${o.reference}&projectId=${e}`}function Ss(i){return i.includes(":")?i.split(":")[1]:i}function qd(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function HI(i,t){const e=Object.keys(t.namespaces).filter(o=>o.includes(i));if(!e.length)return[];const s=[];return e.forEach(o=>{const a=t.namespaces[o].accounts;s.push(...a)}),s}function Qc(i={},t={}){const e=fp(i),s=fp(t);return lh.exports.merge(e,s)}function fp(i){var t,e,s,o;const a={};if(!Qn(i))return a;for(const[h,p]of Object.entries(i)){const v=bh(h)?[h]:p.chains,y=p.methods||[],M=p.events||[],P=p.rpcMap||{},T=Un(h);a[T]=KI(Jo(Jo({},a[T]),p),{chains:Yo(v,(t=a[T])==null?void 0:t.chains),methods:Yo(y,(e=a[T])==null?void 0:e.methods),events:Yo(M,(s=a[T])==null?void 0:s.events),rpcMap:Jo(Jo({},P),(o=a[T])==null?void 0:o.rpcMap)})}return a}function VI(i){return i.includes(":")?i.split(":")[2]:i}function pp(i){const t={};for(const[e,s]of Object.entries(i)){const o=s.methods||[],a=s.events||[],h=s.accounts||[],p=bh(e)?[e]:s.chains?s.chains:qd(s.accounts);t[e]={chains:p,methods:o,events:a,accounts:h}}return t}function Gc(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}const kd={},Ut=i=>kd[i],Yc=(i,t)=>{kd[i]=t};class JI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}var QI=Object.defineProperty,GI=Object.defineProperties,YI=Object.getOwnPropertyDescriptors,dp=Object.getOwnPropertySymbols,WI=Object.prototype.hasOwnProperty,ZI=Object.prototype.propertyIsEnumerable,gp=(i,t,e)=>t in i?QI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mp=(i,t)=>{for(var e in t||(t={}))WI.call(t,e)&&gp(i,e,t[e]);if(dp)for(var e of dp(t))ZI.call(t,e)&&gp(i,e,t[e]);return i},vp=(i,t)=>GI(i,YI(t));class XI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const s=e||Qr(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=parseInt(Ss(e));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,s;let o=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const a=parseInt(o,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,o;const a=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const h=this.client.session.get(t.topic),p=((o=h==null?void 0:h.sessionProperties)==null?void 0:o.capabilities)||{};if(p!=null&&p[a])return p==null?void 0:p[a];const v=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:vp(mp({},h.sessionProperties||{}),{capabilities:vp(mp({},p||{}),{[a]:v})})})}catch(y){console.warn("Failed to update session with capabilities",y)}return v}}class t8{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class e8{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class r8{constructor(t){this.name="algorand",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const s=e||Qr(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class i8{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),o=Ss(e);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class s8{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class n8{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class o8{constructor(t){this.name="near",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||Qr(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace);return typeof s>"u"?void 0:new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class a8{constructor(t){this.name=Hs,this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(o=>{const a=$n(o);s[`${a.namespace}:${a.reference}`]=this.createHttpProvider(o)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}var c8=Object.defineProperty,h8=Object.defineProperties,u8=Object.getOwnPropertyDescriptors,yp=Object.getOwnPropertySymbols,l8=Object.prototype.hasOwnProperty,f8=Object.prototype.propertyIsEnumerable,wp=(i,t,e)=>t in i?c8(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Qo=(i,t)=>{for(var e in t||(t={}))l8.call(t,e)&&wp(i,e,t[e]);if(yp)for(var e of yp(t))f8.call(t,e)&&wp(i,e,t[e]);return i},Wc=(i,t)=>h8(i,u8(t));class Ph{constructor(t){this.events=new A.Gg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:A.Wg(A.k({level:(t==null?void 0:t.logger)||cp})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new Ph(t);return await e.initialize(),e}async request(t,e,s){const[o,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(o).request({request:Qo({},t),chainId:`${o}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,o){const a=new Date().getTime();this.request(t,s,o).then(h=>e(null,A.formatJsonRpcResult(a,h))).catch(h=>e(h,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Gt("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:e,response:s}=await this.client.authenticate(t);e&&(this.uri=e,this.events.emit("display_uri",e));const o=await s();if(this.session=o.session,this.session){const a=pp(this.session.namespaces);this.namespaces=Qc(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return o}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(a=>{this.session=a;const h=pp(a.namespaces);this.namespaces=Qc(this.namespaces,h),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==Dd)throw a;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,o]=this.validateChain(t),a=this.getProvider(s);a.name===Hs?a.setDefaultChain(`${s}:${o}`,e):a.setDefaultChain(o,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(yi(e)){for(const s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Sh.init({core:this.providerOpts.core,logger:this.providerOpts.logger||cp,relayUrl:this.providerOpts.relayUrl||DI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(e=>Un(e)))];Yc("client",this.client),Yc("events",this.events),Yc("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=HI(e,this.session),o=qd(s),a=Qc(this.namespaces,this.optionalNamespaces),h=Wc(Qo({},a[e]),{accounts:s,chains:o});switch(e){case"eip155":this.rpcProviders[e]=new XI({namespace:h});break;case"algorand":this.rpcProviders[e]=new r8({namespace:h});break;case"solana":this.rpcProviders[e]=new t8({namespace:h});break;case"cosmos":this.rpcProviders[e]=new e8({namespace:h});break;case"polkadot":this.rpcProviders[e]=new JI({namespace:h});break;case"cip34":this.rpcProviders[e]=new i8({namespace:h});break;case"elrond":this.rpcProviders[e]=new s8({namespace:h});break;case"multiversx":this.rpcProviders[e]=new n8({namespace:h});break;case"near":this.rpcProviders[e]=new o8({namespace:h});break;default:this.rpcProviders[Hs]?this.rpcProviders[Hs].updateNamespace(h):this.rpcProviders[Hs]=new a8({namespace:h})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:e}=t,{event:s}=e;if(s.name==="accountsChanged"){const o=s.data;o&&yi(o)&&this.events.emit("accountsChanged",o.map(VI))}else if(s.name==="chainChanged"){const o=e.chainId,a=e.event.data,h=Un(o),p=Gc(o)!==Gc(a)?`${h}:${Gc(a)}`:o;this.onChainChanged(p)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s;const{namespaces:o}=e,a=(s=this.client)==null?void 0:s.session.get(t);this.session=Wc(Qo({},a),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",Wc(Qo({},Gt("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Gr.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[Hs]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e,optionalNamespaces:s,sessionProperties:o}=t;e&&Object.keys(e).length&&(this.namespaces=e),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",e),this.persist("optionalNamespaces",s)}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(h=>Un(h)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const o=Un(Object.keys(this.namespaces)[0]),a=this.rpcProviders[o].getDefaultChain();return[o,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,o]=this.validateChain(t);o&&(e||this.getProvider(s).setDefaultChain(o),this.namespaces[s]?this.namespaces[s].defaultChain=o:this.namespaces[`${s}:${o}`]?this.namespaces[`${s}:${o}`].defaultChain=o:this.namespaces[`${s}:${o}`]={defaultChain:o},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",o))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,e){this.client.core.storage.setItem(`${hp}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${hp}/${t}`)}}const p8=Ph,d8="wc",g8="ethereum_provider",m8=`${d8}@2:${g8}:`,v8="https://rpc.walletconnect.com/v1/",ua=["eth_sendTransaction","personal_sign"],Bd=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],la=["chainChanged","accountsChanged"],jd=["chainChanged","accountsChanged","message","disconnect","connect"];var y8=Object.defineProperty,w8=Object.defineProperties,b8=Object.getOwnPropertyDescriptors,bp=Object.getOwnPropertySymbols,_8=Object.prototype.hasOwnProperty,A8=Object.prototype.propertyIsEnumerable,_p=(i,t,e)=>t in i?y8(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vs=(i,t)=>{for(var e in t||(t={}))_8.call(t,e)&&_p(i,e,t[e]);if(bp)for(var e of bp(t))A8.call(t,e)&&_p(i,e,t[e]);return i},Zc=(i,t)=>w8(i,b8(t));function fa(i){return Number(i[0].split(":")[1])}function Go(i){return`0x${i.toString(16)}`}function E8(i){const{chains:t,optionalChains:e,methods:s,optionalMethods:o,events:a,optionalEvents:h,rpcMap:p}=i;if(!yi(t))throw new Error("Invalid chains");const v={chains:t,methods:s||ua,events:a||la,rpcMap:Vs({},t.length?{[fa(t)]:p[fa(t)]}:{})},y=a==null?void 0:a.filter(D=>!la.includes(D)),M=s==null?void 0:s.filter(D=>!ua.includes(D));if(!e&&!h&&!o&&!(y!=null&&y.length)&&!(M!=null&&M.length))return{required:t.length?v:void 0};const P=(y==null?void 0:y.length)&&(M==null?void 0:M.length)||!e,T={chains:[...new Set(P?v.chains.concat(e||[]):e)],methods:[...new Set(v.methods.concat(o!=null&&o.length?o:Bd))],events:[...new Set(v.events.concat(h!=null&&h.length?h:jd))],rpcMap:p};return{required:t.length?v:void 0,optional:e.length?T:void 0}}class ma{constructor(){this.events=new A.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=m8,this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new ma;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,s){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),s)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:s}=E8(this.rpc);try{const o=await new Promise(async(h,p)=>{var v;this.rpc.showQrModal&&((v=this.modal)==null||v.subscribeModal(y=>{!y.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),p(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Zc(Vs({namespaces:Vs({},e&&{[this.namespace]:e})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(y=>{h(y)}).catch(y=>{p(new Error(y.message))})});if(!o)return;const a=Gl(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Go(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async authenticate(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const e=await new Promise(async(o,a)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(Zc(Vs({},t),{chains:this.rpc.chains})).then(p=>{o(p)}).catch(p=>{a(new Error(p.message))})}),s=e.session;if(s){const o=Gl(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Go(this.chainId)})}return e}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:e}=t,{event:s}=e;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",Go(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",Zc(Vs({},Gt("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,s;this.rpc.showQrModal&&((e=this.modal)==null||e.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",Go(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,s,o]=t.split(":");return{chainId:`${e}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,s;const o=(e=t==null?void 0:t.chains)!=null?e:[],a=(s=t==null?void 0:t.optionalChains)!=null?s:[],h=o.concat(a);if(!h.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const p=o.length?(t==null?void 0:t.methods)||ua:[],v=o.length?(t==null?void 0:t.events)||la:[],y=(t==null?void 0:t.optionalMethods)||[],M=(t==null?void 0:t.optionalEvents)||[],P=(t==null?void 0:t.rpcMap)||this.buildRpcMap(h,t.projectId),T=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(D=>this.formatChainId(D)),optionalChains:a.map(D=>this.formatChainId(D)),methods:p,events:v,optionalMethods:y,optionalEvents:M,rpcMap:P,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:T,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,e)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?fa(this.rpc.chains):fa(this.rpc.optionalChains),this.signer=await p8.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions,customStoragePrefix:t.customStoragePrefix,telemetryEnabled:t.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-Dv8gb9FV.cjs")).then(o=>o.index);e=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(Vs({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:s,rpcMap:o}=t;e&&yi(e)&&(this.rpc.chains=e.map(a=>this.formatChainId(a)),e.forEach(a=>{this.rpc.rpcMap[a]=(o==null?void 0:o[a])||this.getRpcUrl(a)})),s&&yi(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(a=>this.formatChainId(a)),s.forEach(a=>{this.rpc.rpcMap[a]=(o==null?void 0:o[a])||this.getRpcUrl(a)}))}getRpcUrl(t,e){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${v8}?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e==null?void 0:e.accounts),this.setAccounts(e==null?void 0:e.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(e=>this.parseAccount(e))}}const I8=ma;exports.EthereumProvider=I8;exports.OPTIONAL_EVENTS=jd;exports.OPTIONAL_METHODS=Bd;exports.REQUIRED_EVENTS=la;exports.REQUIRED_METHODS=ua;exports.default=ma;
43
+ }`;var _t=Vl(function(){return qt(_,nt+"return "+J).apply(e,x)});if(_t.source=J,mc(_t))throw _t;return _t}function Jy(r){return jt(r).toLowerCase()}function Qy(r){return jt(r).toUpperCase()}function Gy(r,n,c){if(r=jt(r),r&&(c||n===e))return eu(r);if(!r||!(n=fr(n)))return r;var l=kr(r),g=kr(n),_=ru(l,g),x=iu(l,g)+1;return Xi(l,_,x).join("")}function Yy(r,n,c){if(r=jt(r),r&&(c||n===e))return r.slice(0,nu(r)+1);if(!r||!(n=fr(n)))return r;var l=kr(r),g=iu(l,kr(n))+1;return Xi(l,0,g).join("")}function Wy(r,n,c){if(r=jt(r),r&&(c||n===e))return r.replace(Jt,"");if(!r||!(n=fr(n)))return r;var l=kr(r),g=ru(l,kr(n));return Xi(l,g).join("")}function Zy(r,n){var c=Te,l=Ct;if(be(n)){var g="separator"in n?n.separator:g;c="length"in n?bt(n.length):c,l="omission"in n?fr(n.omission):l}r=jt(r);var _=r.length;if(Ns(r)){var x=kr(r);_=x.length}if(c>=_)return r;var R=c-Os(l);if(R<1)return l;var F=x?Xi(x,0,R).join(""):r.slice(0,R);if(g===e)return F+l;if(x&&(R+=F.length-R),vc(g)){if(r.slice(R).search(g)){var z,L=F;for(g.global||(g=Ta(g.source,jt(Zt.exec(g))+"g")),g.lastIndex=0;z=g.exec(L);)var J=z.index;F=F.slice(0,J===e?R:J)}}else if(r.indexOf(fr(g),R)!=R){var Z=F.lastIndexOf(g);Z>-1&&(F=F.slice(0,Z))}return F+l}function Xy(r){return r=jt(r),r&&se.test(r)?r.replace(Yt,C0):r}var tw=js(function(r,n,c){return r+(c?" ":"")+n.toUpperCase()}),bc=Ju("toUpperCase");function Hl(r,n,c){return r=jt(r),n=c?e:n,n===e?E0(r)?N0(r):d0(r):r.match(n)||[]}var Vl=At(function(r,n){try{return ur(r,e,n)}catch(c){return mc(c)?c:new vt(c)}}),ew=Oi(function(r,n){return br(n,function(c){c=oi(c),Ri(r,c,dc(r[c],r))}),r});function rw(r){var n=r==null?0:r.length,c=ft();return r=n?we(r,function(l){if(typeof l[1]!="function")throw new _r(h);return[c(l[0]),l[1]]}):[],At(function(l){for(var g=-1;++g<n;){var _=r[g];if(ur(_[0],this,l))return ur(_[1],this,l)}})}function iw(r){return Cg(Er(r,P))}function _c(r){return function(){return r}}function sw(r,n){return r==null||r!==r?n:r}var nw=Gu(),ow=Gu(!0);function rr(r){return r}function Ac(r){return Su(typeof r=="function"?r:Er(r,P))}function aw(r){return Mu(Er(r,P))}function cw(r,n){return Cu(r,Er(n,P))}var hw=At(function(r,n){return function(c){return An(c,r,n)}}),uw=At(function(r,n){return function(c){return An(r,c,n)}});function Ec(r,n,c){var l=Fe(n),g=Ao(n,l);c==null&&!(be(n)&&(g.length||!l.length))&&(c=n,n=r,r=this,g=Ao(n,Fe(n)));var _=!(be(c)&&"chain"in c)||!!c.chain,x=Fi(r);return br(g,function(R){var F=n[R];r[R]=F,x&&(r.prototype[R]=function(){var z=this.__chain__;if(_||z){var L=r(this.__wrapped__),J=L.__actions__=Xe(this.__actions__);return J.push({func:F,args:arguments,thisArg:r}),L.__chain__=z,L}return F.apply(r,Ji([this.value()],arguments))})}),r}function lw(){return qe._===this&&(qe._=k0),this}function Ic(){}function fw(r){return r=bt(r),At(function(n){return xu(n,r)})}var pw=ec(we),dw=ec(Yh),gw=ec(Pa);function Jl(r){return cc(r)?Ma(oi(r)):Hg(r)}function mw(r){return function(n){return r==null?e:ls(r,n)}}var vw=Wu(),yw=Wu(!0);function Sc(){return[]}function Pc(){return!1}function ww(){return{}}function bw(){return""}function _w(){return!0}function Aw(r,n){if(r=bt(r),r<1||r>N)return[];var c=f,l=Le(r,f);n=ft(n),r-=f;for(var g=Ra(l,n);++c<r;)n(c);return g}function Ew(r){return yt(r)?we(r,oi):pr(r)?[r]:Xe(pl(jt(r)))}function Iw(r){var n=++D0;return jt(r)+n}var Sw=Co(function(r,n){return r+n},0),Pw=rc("ceil"),Mw=Co(function(r,n){return r/n},1),Cw=rc("floor");function xw(r){return r&&r.length?_o(r,rr,$a):e}function Rw(r,n){return r&&r.length?_o(r,ft(n,2),$a):e}function Nw(r){return Xh(r,rr)}function Ow(r,n){return Xh(r,ft(n,2))}function Tw(r){return r&&r.length?_o(r,rr,Ha):e}function Fw(r,n){return r&&r.length?_o(r,ft(n,2),Ha):e}var Dw=Co(function(r,n){return r*n},1),qw=rc("round"),kw=Co(function(r,n){return r-n},0);function Bw(r){return r&&r.length?xa(r,rr):0}function jw(r,n){return r&&r.length?xa(r,ft(n,2)):0}return w.after=av,w.ary=Il,w.assign=Qv,w.assignIn=Bl,w.assignInWith=$o,w.assignWith=Gv,w.at=Yv,w.before=Sl,w.bind=dc,w.bindAll=ew,w.bindKey=Pl,w.castArray=wv,w.chain=_l,w.chunk=C1,w.compact=x1,w.concat=R1,w.cond=rw,w.conforms=iw,w.constant=_c,w.countBy=Bm,w.create=Wv,w.curry=Ml,w.curryRight=Cl,w.debounce=xl,w.defaults=Zv,w.defaultsDeep=Xv,w.defer=cv,w.delay=hv,w.difference=N1,w.differenceBy=O1,w.differenceWith=T1,w.drop=F1,w.dropRight=D1,w.dropRightWhile=q1,w.dropWhile=k1,w.fill=B1,w.filter=Um,w.flatMap=Lm,w.flatMapDeep=Km,w.flatMapDepth=Hm,w.flatten=vl,w.flattenDeep=j1,w.flattenDepth=U1,w.flip=uv,w.flow=nw,w.flowRight=ow,w.fromPairs=$1,w.functions=oy,w.functionsIn=ay,w.groupBy=Vm,w.initial=L1,w.intersection=K1,w.intersectionBy=H1,w.intersectionWith=V1,w.invert=hy,w.invertBy=uy,w.invokeMap=Qm,w.iteratee=Ac,w.keyBy=Gm,w.keys=Fe,w.keysIn=er,w.map=Do,w.mapKeys=fy,w.mapValues=py,w.matches=aw,w.matchesProperty=cw,w.memoize=ko,w.merge=dy,w.mergeWith=jl,w.method=hw,w.methodOf=uw,w.mixin=Ec,w.negate=Bo,w.nthArg=fw,w.omit=gy,w.omitBy=my,w.once=lv,w.orderBy=Ym,w.over=pw,w.overArgs=fv,w.overEvery=dw,w.overSome=gw,w.partial=gc,w.partialRight=Rl,w.partition=Wm,w.pick=vy,w.pickBy=Ul,w.property=Jl,w.propertyOf=mw,w.pull=Y1,w.pullAll=wl,w.pullAllBy=W1,w.pullAllWith=Z1,w.pullAt=X1,w.range=vw,w.rangeRight=yw,w.rearg=pv,w.reject=tv,w.remove=tm,w.rest=dv,w.reverse=fc,w.sampleSize=rv,w.set=wy,w.setWith=by,w.shuffle=iv,w.slice=em,w.sortBy=ov,w.sortedUniq=cm,w.sortedUniqBy=hm,w.split=Ly,w.spread=gv,w.tail=um,w.take=lm,w.takeRight=fm,w.takeRightWhile=pm,w.takeWhile=dm,w.tap=xm,w.throttle=mv,w.thru=Fo,w.toArray=Dl,w.toPairs=$l,w.toPairsIn=zl,w.toPath=Ew,w.toPlainObject=kl,w.transform=_y,w.unary=vv,w.union=gm,w.unionBy=mm,w.unionWith=vm,w.uniq=ym,w.uniqBy=wm,w.uniqWith=bm,w.unset=Ay,w.unzip=pc,w.unzipWith=bl,w.update=Ey,w.updateWith=Iy,w.values=zs,w.valuesIn=Sy,w.without=_m,w.words=Hl,w.wrap=yv,w.xor=Am,w.xorBy=Em,w.xorWith=Im,w.zip=Sm,w.zipObject=Pm,w.zipObjectDeep=Mm,w.zipWith=Cm,w.entries=$l,w.entriesIn=zl,w.extend=Bl,w.extendWith=$o,Ec(w,w),w.add=Sw,w.attempt=Vl,w.camelCase=xy,w.capitalize=Ll,w.ceil=Pw,w.clamp=Py,w.clone=bv,w.cloneDeep=Av,w.cloneDeepWith=Ev,w.cloneWith=_v,w.conformsTo=Iv,w.deburr=Kl,w.defaultTo=sw,w.divide=Mw,w.endsWith=Ry,w.eq=jr,w.escape=Ny,w.escapeRegExp=Oy,w.every=jm,w.find=$m,w.findIndex=gl,w.findKey=ty,w.findLast=zm,w.findLastIndex=ml,w.findLastKey=ey,w.floor=Cw,w.forEach=Al,w.forEachRight=El,w.forIn=ry,w.forInRight=iy,w.forOwn=sy,w.forOwnRight=ny,w.get=yc,w.gt=Sv,w.gte=Pv,w.has=cy,w.hasIn=wc,w.head=yl,w.identity=rr,w.includes=Jm,w.indexOf=z1,w.inRange=My,w.invoke=ly,w.isArguments=ds,w.isArray=yt,w.isArrayBuffer=Mv,w.isArrayLike=tr,w.isArrayLikeObject=Ee,w.isBoolean=Cv,w.isBuffer=ts,w.isDate=xv,w.isElement=Rv,w.isEmpty=Nv,w.isEqual=Ov,w.isEqualWith=Tv,w.isError=mc,w.isFinite=Fv,w.isFunction=Fi,w.isInteger=Nl,w.isLength=jo,w.isMap=Ol,w.isMatch=Dv,w.isMatchWith=qv,w.isNaN=kv,w.isNative=Bv,w.isNil=Uv,w.isNull=jv,w.isNumber=Tl,w.isObject=be,w.isObjectLike=_e,w.isPlainObject=Cn,w.isRegExp=vc,w.isSafeInteger=$v,w.isSet=Fl,w.isString=Uo,w.isSymbol=pr,w.isTypedArray=$s,w.isUndefined=zv,w.isWeakMap=Lv,w.isWeakSet=Kv,w.join=J1,w.kebabCase=Ty,w.last=Sr,w.lastIndexOf=Q1,w.lowerCase=Fy,w.lowerFirst=Dy,w.lt=Hv,w.lte=Vv,w.max=xw,w.maxBy=Rw,w.mean=Nw,w.meanBy=Ow,w.min=Tw,w.minBy=Fw,w.stubArray=Sc,w.stubFalse=Pc,w.stubObject=ww,w.stubString=bw,w.stubTrue=_w,w.multiply=Dw,w.nth=G1,w.noConflict=lw,w.noop=Ic,w.now=qo,w.pad=qy,w.padEnd=ky,w.padStart=By,w.parseInt=jy,w.random=Cy,w.reduce=Zm,w.reduceRight=Xm,w.repeat=Uy,w.replace=$y,w.result=yy,w.round=qw,w.runInContext=O,w.sample=ev,w.size=sv,w.snakeCase=zy,w.some=nv,w.sortedIndex=rm,w.sortedIndexBy=im,w.sortedIndexOf=sm,w.sortedLastIndex=nm,w.sortedLastIndexBy=om,w.sortedLastIndexOf=am,w.startCase=Ky,w.startsWith=Hy,w.subtract=kw,w.sum=Bw,w.sumBy=jw,w.template=Vy,w.times=Aw,w.toFinite=Di,w.toInteger=bt,w.toLength=ql,w.toLower=Jy,w.toNumber=Pr,w.toSafeInteger=Jv,w.toString=jt,w.toUpper=Qy,w.trim=Gy,w.trimEnd=Yy,w.trimStart=Wy,w.truncate=Zy,w.unescape=Xy,w.uniqueId=Iw,w.upperCase=tw,w.upperFirst=bc,w.each=Al,w.eachRight=El,w.first=yl,Ec(w,function(){var r={};return si(w,function(n,c){Qt.call(w.prototype,c)||(r[c]=n)}),r}(),{chain:!1}),w.VERSION=s,br(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){w[r].placeholder=w}),br(["drop","take"],function(r,n){St.prototype[r]=function(c){c=c===e?1:Re(bt(c),0);var l=this.__filtered__&&!n?new St(this):this.clone();return l.__filtered__?l.__takeCount__=Le(c,l.__takeCount__):l.__views__.push({size:Le(c,f),type:r+(l.__dir__<0?"Right":"")}),l},St.prototype[r+"Right"]=function(c){return this.reverse()[r](c).reverse()}}),br(["filter","map","takeWhile"],function(r,n){var c=n+1,l=c==d||c==I;St.prototype[r]=function(g){var _=this.clone();return _.__iteratees__.push({iteratee:ft(g,3),type:c}),_.__filtered__=_.__filtered__||l,_}}),br(["head","last"],function(r,n){var c="take"+(n?"Right":"");St.prototype[r]=function(){return this[c](1).value()[0]}}),br(["initial","tail"],function(r,n){var c="drop"+(n?"":"Right");St.prototype[r]=function(){return this.__filtered__?new St(this):this[c](1)}}),St.prototype.compact=function(){return this.filter(rr)},St.prototype.find=function(r){return this.filter(r).head()},St.prototype.findLast=function(r){return this.reverse().find(r)},St.prototype.invokeMap=At(function(r,n){return typeof r=="function"?new St(this):this.map(function(c){return An(c,r,n)})}),St.prototype.reject=function(r){return this.filter(Bo(ft(r)))},St.prototype.slice=function(r,n){r=bt(r);var c=this;return c.__filtered__&&(r>0||n<0)?new St(c):(r<0?c=c.takeRight(-r):r&&(c=c.drop(r)),n!==e&&(n=bt(n),c=n<0?c.dropRight(-n):c.take(n-r)),c)},St.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},St.prototype.toArray=function(){return this.take(f)},si(St.prototype,function(r,n){var c=/^(?:filter|find|map|reject)|While$/.test(n),l=/^(?:head|last)$/.test(n),g=w[l?"take"+(n=="last"?"Right":""):n],_=l||/^find/.test(n);g&&(w.prototype[n]=function(){var x=this.__wrapped__,R=l?[1]:arguments,F=x instanceof St,z=R[0],L=F||yt(x),J=function(Et){var Rt=g.apply(w,Ji([Et],R));return l&&Z?Rt[0]:Rt};L&&c&&typeof z=="function"&&z.length!=1&&(F=L=!1);var Z=this.__chain__,nt=!!this.__actions__.length,pt=_&&!Z,_t=F&&!nt;if(!_&&L){x=_t?x:new St(this);var dt=r.apply(x,R);return dt.__actions__.push({func:Fo,args:[J],thisArg:e}),new Ar(dt,Z)}return pt&&_t?r.apply(this,R):(dt=this.thru(J),pt?l?dt.value()[0]:dt.value():dt)})}),br(["pop","push","shift","sort","splice","unshift"],function(r){var n=no[r],c=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",l=/^(?:pop|shift)$/.test(r);w.prototype[r]=function(){var g=arguments;if(l&&!this.__chain__){var _=this.value();return n.apply(yt(_)?_:[],g)}return this[c](function(x){return n.apply(yt(x)?x:[],g)})}}),si(St.prototype,function(r,n){var c=w[n];if(c){var l=c.name+"";Qt.call(qs,l)||(qs[l]=[]),qs[l].push({name:n,func:c})}}),qs[Mo(e,Q).name]=[{name:"wrapper",func:e}],St.prototype.clone=X0,St.prototype.reverse=tg,St.prototype.value=eg,w.prototype.at=Rm,w.prototype.chain=Nm,w.prototype.commit=Om,w.prototype.next=Tm,w.prototype.plant=Dm,w.prototype.reverse=qm,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=km,w.prototype.first=w.prototype.head,gn&&(w.prototype[gn]=Fm),w},Ts=O0();os?((os.exports=Ts)._=Ts,Aa._=Ts):qe._=Ts}).call(kn)})(lh,lh.exports);var jI=Object.defineProperty,UI=Object.defineProperties,$I=Object.getOwnPropertyDescriptors,up=Object.getOwnPropertySymbols,zI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,lp=(i,t,e)=>t in i?jI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jo=(i,t)=>{for(var e in t||(t={}))zI.call(t,e)&&lp(i,e,t[e]);if(up)for(var e of up(t))LI.call(t,e)&&lp(i,e,t[e]);return i},KI=(i,t)=>UI(i,$I(t));function Qr(i,t,e){var s;const o=$n(i);return((s=t.rpcMap)==null?void 0:s[o.reference])||`${BI}?chainId=${o.namespace}:${o.reference}&projectId=${e}`}function Ss(i){return i.includes(":")?i.split(":")[1]:i}function qd(i){return i.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function HI(i,t){const e=Object.keys(t.namespaces).filter(o=>o.includes(i));if(!e.length)return[];const s=[];return e.forEach(o=>{const a=t.namespaces[o].accounts;s.push(...a)}),s}function Qc(i={},t={}){const e=fp(i),s=fp(t);return lh.exports.merge(e,s)}function fp(i){var t,e,s,o;const a={};if(!Qn(i))return a;for(const[h,p]of Object.entries(i)){const v=bh(h)?[h]:p.chains,y=p.methods||[],M=p.events||[],P=p.rpcMap||{},T=Un(h);a[T]=KI(Jo(Jo({},a[T]),p),{chains:Yo(v,(t=a[T])==null?void 0:t.chains),methods:Yo(y,(e=a[T])==null?void 0:e.methods),events:Yo(M,(s=a[T])==null?void 0:s.events),rpcMap:Jo(Jo({},P),(o=a[T])==null?void 0:o.rpcMap)})}return a}function VI(i){return i.includes(":")?i.split(":")[2]:i}function pp(i){const t={};for(const[e,s]of Object.entries(i)){const o=s.methods||[],a=s.events||[],h=s.accounts||[],p=bh(e)?[e]:s.chains?s.chains:qd(s.accounts);t[e]={chains:p,methods:o,events:a,accounts:h}}return t}function Gc(i){return typeof i=="number"?i:i.includes("0x")?parseInt(i,16):(i=i.includes(":")?i.split(":")[1]:i,isNaN(Number(i))?i:Number(i))}const kd={},Ut=i=>kd[i],Yc=(i,t)=>{kd[i]=t};class JI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}var QI=Object.defineProperty,GI=Object.defineProperties,YI=Object.getOwnPropertyDescriptors,dp=Object.getOwnPropertySymbols,WI=Object.prototype.hasOwnProperty,ZI=Object.prototype.propertyIsEnumerable,gp=(i,t,e)=>t in i?QI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mp=(i,t)=>{for(var e in t||(t={}))WI.call(t,e)&&gp(i,e,t[e]);if(dp)for(var e of dp(t))ZI.call(t,e)&&gp(i,e,t[e]);return i},vp=(i,t)=>GI(i,YI(t));class XI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const s=e||Qr(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=parseInt(Ss(e));t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,s;let o=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const a=parseInt(o,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:o}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,s,o;const a=(s=(e=t.request)==null?void 0:e.params)==null?void 0:s[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const h=this.client.session.get(t.topic),p=((o=h==null?void 0:h.sessionProperties)==null?void 0:o.capabilities)||{};if(p!=null&&p[a])return p==null?void 0:p[a];const v=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:vp(mp({},h.sessionProperties||{}),{capabilities:vp(mp({},p||{}),{[a]:v})})})}catch(y){console.warn("Failed to update session with capabilities",y)}return v}}class t8{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class e8{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class r8{constructor(t){this.name="algorand",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const s=e||Qr(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);return typeof s>"u"?void 0:new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class i8{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const s=this.getCardanoRPCUrl(e),o=Ss(e);t[o]=this.createHttpProvider(o,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class s8{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class n8{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;const o=Ss(e);t[o]=this.createHttpProvider(o,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class o8{constructor(t){this.name="near",this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const s=e||Qr(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var s;t[e]=this.createHttpProvider(e,(s=this.namespace.rpcMap)==null?void 0:s[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace);return typeof s>"u"?void 0:new A.o(new A.f$1(s,Ut("disableProviderPing")))}}class a8{constructor(t){this.name=Hs,this.namespace=t.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Gr.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var t,e;const s={};return(e=(t=this.namespace)==null?void 0:t.accounts)==null||e.forEach(o=>{const a=$n(o);s[`${a.namespace}:${a.reference}`]=this.createHttpProvider(o)}),s}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const s=this.createHttpProvider(t,e);s&&(this.httpProviders[t]=s)}createHttpProvider(t,e){const s=e||Qr(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new A.o(new A.f$1(s,Ut("disableProviderPing")))}}var c8=Object.defineProperty,h8=Object.defineProperties,u8=Object.getOwnPropertyDescriptors,yp=Object.getOwnPropertySymbols,l8=Object.prototype.hasOwnProperty,f8=Object.prototype.propertyIsEnumerable,wp=(i,t,e)=>t in i?c8(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Qo=(i,t)=>{for(var e in t||(t={}))l8.call(t,e)&&wp(i,e,t[e]);if(yp)for(var e of yp(t))f8.call(t,e)&&wp(i,e,t[e]);return i},Wc=(i,t)=>h8(i,u8(t));class Ph{constructor(t){this.events=new A.Gg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:A.Wg(A.k({level:(t==null?void 0:t.logger)||cp})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new Ph(t);return await e.initialize(),e}async request(t,e,s){const[o,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(o).request({request:Qo({},t),chainId:`${o}:${a}`,topic:this.session.topic,expiry:s})}sendAsync(t,e,s,o){const a=new Date().getTime();this.request(t,s,o).then(h=>e(null,A.formatJsonRpcResult(a,h))).catch(h=>e(h,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Gt("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:e,response:s}=await this.client.authenticate(t);e&&(this.uri=e,this.events.emit("display_uri",e));const o=await s();if(this.session=o.session,this.session){const a=pp(this.session.namespaces);this.namespaces=Qc(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return o}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:o}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await o().then(a=>{this.session=a;const h=pp(a.namespaces);this.namespaces=Qc(this.namespaces,h),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==Dd)throw a;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[s,o]=this.validateChain(t),a=this.getProvider(s);a.name===Hs?a.setDefaultChain(`${s}:${o}`,e):a.setDefaultChain(o,e)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(yi(e)){for(const s of e)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Sh.init({core:this.providerOpts.core,logger:this.providerOpts.logger||cp,relayUrl:this.providerOpts.relayUrl||DI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(e=>Un(e)))];Yc("client",this.client),Yc("events",this.events),Yc("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const s=HI(e,this.session),o=qd(s),a=Qc(this.namespaces,this.optionalNamespaces),h=Wc(Qo({},a[e]),{accounts:s,chains:o});switch(e){case"eip155":this.rpcProviders[e]=new XI({namespace:h});break;case"algorand":this.rpcProviders[e]=new r8({namespace:h});break;case"solana":this.rpcProviders[e]=new t8({namespace:h});break;case"cosmos":this.rpcProviders[e]=new e8({namespace:h});break;case"polkadot":this.rpcProviders[e]=new JI({namespace:h});break;case"cip34":this.rpcProviders[e]=new i8({namespace:h});break;case"elrond":this.rpcProviders[e]=new s8({namespace:h});break;case"multiversx":this.rpcProviders[e]=new n8({namespace:h});break;case"near":this.rpcProviders[e]=new o8({namespace:h});break;default:this.rpcProviders[Hs]?this.rpcProviders[Hs].updateNamespace(h):this.rpcProviders[Hs]=new a8({namespace:h})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:e}=t,{event:s}=e;if(s.name==="accountsChanged"){const o=s.data;o&&yi(o)&&this.events.emit("accountsChanged",o.map(VI))}else if(s.name==="chainChanged"){const o=e.chainId,a=e.event.data,h=Un(o),p=Gc(o)!==Gc(a)?`${h}:${Gc(a)}`:o;this.onChainChanged(p)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var s;const{namespaces:o}=e,a=(s=this.client)==null?void 0:s.session.get(t);this.session=Wc(Qo({},a),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",Wc(Qo({},Gt("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Gr.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[Hs]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e,optionalNamespaces:s,sessionProperties:o}=t;e&&Object.keys(e).length&&(this.namespaces=e),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=o,this.persist("namespaces",e),this.persist("optionalNamespaces",s)}validateChain(t){const[e,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,s];if(e&&!Object.keys(this.namespaces||{}).map(h=>Un(h)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&s)return[e,s];const o=Un(Object.keys(this.namespaces)[0]),a=this.rpcProviders[o].getDefaultChain();return[o,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[s,o]=this.validateChain(t);o&&(e||this.getProvider(s).setDefaultChain(o),this.namespaces[s]?this.namespaces[s].defaultChain=o:this.namespaces[`${s}:${o}`]?this.namespaces[`${s}:${o}`].defaultChain=o:this.namespaces[`${s}:${o}`]={defaultChain:o},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",o))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,e){this.client.core.storage.setItem(`${hp}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${hp}/${t}`)}}const p8=Ph,d8="wc",g8="ethereum_provider",m8=`${d8}@2:${g8}:`,v8="https://rpc.walletconnect.com/v1/",ua=["eth_sendTransaction","personal_sign"],Bd=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],la=["chainChanged","accountsChanged"],jd=["chainChanged","accountsChanged","message","disconnect","connect"];var y8=Object.defineProperty,w8=Object.defineProperties,b8=Object.getOwnPropertyDescriptors,bp=Object.getOwnPropertySymbols,_8=Object.prototype.hasOwnProperty,A8=Object.prototype.propertyIsEnumerable,_p=(i,t,e)=>t in i?y8(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Vs=(i,t)=>{for(var e in t||(t={}))_8.call(t,e)&&_p(i,e,t[e]);if(bp)for(var e of bp(t))A8.call(t,e)&&_p(i,e,t[e]);return i},Zc=(i,t)=>w8(i,b8(t));function fa(i){return Number(i[0].split(":")[1])}function Go(i){return`0x${i.toString(16)}`}function E8(i){const{chains:t,optionalChains:e,methods:s,optionalMethods:o,events:a,optionalEvents:h,rpcMap:p}=i;if(!yi(t))throw new Error("Invalid chains");const v={chains:t,methods:s||ua,events:a||la,rpcMap:Vs({},t.length?{[fa(t)]:p[fa(t)]}:{})},y=a==null?void 0:a.filter(D=>!la.includes(D)),M=s==null?void 0:s.filter(D=>!ua.includes(D));if(!e&&!h&&!o&&!(y!=null&&y.length)&&!(M!=null&&M.length))return{required:t.length?v:void 0};const P=(y==null?void 0:y.length)&&(M==null?void 0:M.length)||!e,T={chains:[...new Set(P?v.chains.concat(e||[]):e)],methods:[...new Set(v.methods.concat(o!=null&&o.length?o:Bd))],events:[...new Set(v.events.concat(h!=null&&h.length?h:jd))],rpcMap:p};return{required:t.length?v:void 0,optional:e.length?T:void 0}}class ma{constructor(){this.events=new A.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=m8,this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new ma;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,s){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),s)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:s}=E8(this.rpc);try{const o=await new Promise(async(h,p)=>{var v;this.rpc.showQrModal&&((v=this.modal)==null||v.subscribeModal(y=>{!y.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),p(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Zc(Vs({namespaces:Vs({},e&&{[this.namespace]:e})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(y=>{h(y)}).catch(y=>{p(new Error(y.message))})});if(!o)return;const a=Gl(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Go(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async authenticate(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const e=await new Promise(async(o,a)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(Zc(Vs({},t),{chains:this.rpc.chains})).then(p=>{o(p)}).catch(p=>{a(new Error(p.message))})}),s=e.session;if(s){const o=Gl(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Go(this.chainId)})}return e}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:e}=t,{event:s}=e;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",Go(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",Zc(Vs({},Gt("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,s;this.rpc.showQrModal&&((e=this.modal)==null||e.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",Go(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,s,o]=t.split(":");return{chainId:`${e}:${s}`,address:o}}setAccounts(t){this.accounts=t.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,s;const o=(e=t==null?void 0:t.chains)!=null?e:[],a=(s=t==null?void 0:t.optionalChains)!=null?s:[],h=o.concat(a);if(!h.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const p=o.length?(t==null?void 0:t.methods)||ua:[],v=o.length?(t==null?void 0:t.events)||la:[],y=(t==null?void 0:t.optionalMethods)||[],M=(t==null?void 0:t.optionalEvents)||[],P=(t==null?void 0:t.rpcMap)||this.buildRpcMap(h,t.projectId),T=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(D=>this.formatChainId(D)),optionalChains:a.map(D=>this.formatChainId(D)),methods:p,events:v,optionalMethods:y,optionalEvents:M,rpcMap:P,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:T,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const s={};return t.forEach(o=>{s[o]=this.getRpcUrl(o,e)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?fa(this.rpc.chains):fa(this.rpc.optionalChains),this.signer=await p8.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions,customStoragePrefix:t.customStoragePrefix,telemetryEnabled:t.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-CLxU5hsA.cjs")).then(o=>o.index);e=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(Vs({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:s,rpcMap:o}=t;e&&yi(e)&&(this.rpc.chains=e.map(a=>this.formatChainId(a)),e.forEach(a=>{this.rpc.rpcMap[a]=(o==null?void 0:o[a])||this.getRpcUrl(a)})),s&&yi(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(a=>this.formatChainId(a)),s.forEach(a=>{this.rpc.rpcMap[a]=(o==null?void 0:o[a])||this.getRpcUrl(a)}))}getRpcUrl(t,e){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${v8}?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e==null?void 0:e.accounts),this.setAccounts(e==null?void 0:e.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(e=>this.parseAccount(e))}}const I8=ma;exports.EthereumProvider=I8;exports.OPTIONAL_EVENTS=jd;exports.OPTIONAL_METHODS=Bd;exports.REQUIRED_EVENTS=la;exports.REQUIRED_METHODS=ua;exports.default=ma;
@@ -1,4 +1,4 @@
1
- import { bc as Ns, l as be, be as yb, bf as tt, bg as Th, bh as xa, bi as Wr, bj as qr, bk as Wp, B as Os, bl as Xp, bm as Zp, bn as wb, bo as td, bp as Ef, bq as vh, br as ba, bs as bb, bt as _b, bu as Ab, bv as Eb, bw as dn, bx as Ib, by as tr, bz as _r, ba as gs, bA as Na, bB as Sb, bC as Pb, bD as Mb, bE as If, bF as Cb, bG as xb, bH as Nb, bI as Rb, bJ as an, bK as Fh, bL as ti, bM as Ob, bN as Dh, bO as qh, bP as Ra, bQ as kh, bR as ed, bS as Vi, bT as gi, bU as ro, bV as lo, bW as en, bX as Mi } from "./W3MFrameProviderSingleton-B9E01rnL.js";
1
+ import { bd as Ns, m as be, bf as yb, bg as tt, bh as Th, bi as xa, bj as Wr, bk as qr, bl as Wp, B as Os, bm as Xp, bn as Zp, bo as wb, bp as td, bq as Ef, br as vh, bs as ba, bt as bb, bu as _b, bv as Ab, bw as Eb, bx as dn, by as Ib, bz as tr, bA as _r, bb as gs, bB as Na, bC as Sb, bD as Pb, bE as Mb, bF as If, bG as Cb, bH as xb, bI as Nb, bJ as Rb, bK as an, bL as Fh, bM as ti, bN as Ob, bO as Dh, bP as qh, bQ as Ra, bR as kh, bS as ed, bT as Vi, bU as gi, bV as ro, bW as lo, bX as en, bY as Mi } from "./W3MFrameProviderSingleton-CRF_1us_.js";
2
2
  const Tb = ":";
3
3
  function io(i) {
4
4
  const [t, e] = i.split(Tb);
@@ -11628,7 +11628,7 @@ class Zh {
11628
11628
  if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? Ca(this.rpc.chains) : Ca(this.rpc.optionalChains), this.signer = await o4.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions, customStoragePrefix: t.customStoragePrefix, telemetryEnabled: t.telemetryEnabled }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
11629
11629
  let e;
11630
11630
  try {
11631
- const { WalletConnectModal: s } = await import("./index-BsaPadk9.js").then((o) => o.i);
11631
+ const { WalletConnectModal: s } = await import("./index-C2gFFabd.js").then((o) => o.i);
11632
11632
  e = s;
11633
11633
  } catch {
11634
11634
  throw new Error("To use QR modal, please install @walletconnect/modal package");
@@ -1,4 +1,4 @@
1
- import { b8 as vW, m as Cs, B as TL } from "./W3MFrameProviderSingleton-B9E01rnL.js";
1
+ import { b9 as vW, n as Cs, B as TL } from "./W3MFrameProviderSingleton-CRF_1us_.js";
2
2
  var Hw = { exports: {} };
3
3
  (function(wW, LL) {
4
4
  (function(Ie, Pu) {