1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5848],{85848:(e,t,n)=>{n.d(t,{baseAccount:()=>s,safe:()=>u});var i=n(79442),a=n(81972),r=n(25733),c=n(63516),o=n(84284);function s(e={}){let t,d,h,u;return(0,i.U)(i=>({id:"baseAccount",name:"Base Account",rdns:"app.base.account",type:"baseAccount",async connect({chainId:e,withCapabilities:t,...n}={}){try{let s=await this.getProvider(),l=e??i.chains[0]?.id;if(!l)throw new a.nk;let w=await s.request({method:"wallet_connect",params:[{capabilities:"capabilities"in n&&n.capabilities?n.capabilities:{},chainIds:[(0,r.cK)(l),...i.chains.filter(e=>e.id!==l).map(e=>(0,r.cK)(e.id))]}]}),p=w.accounts.map(e=>({address:(0,c.b)(e.address),capabilities:e.capabilities??{}})),m=Number(w.chainIds[0]);if(d||(d=this.onAccountsChanged.bind(this),s.on("accountsChanged",d)),h||(h=this.onChainChanged.bind(this),s.on("chainChanged",h)),u||(u=this.onDisconnect.bind(this),s.on("disconnect",u)),e&&m!==e){let t=await this.switchChain({chainId:e}).catch(e=>{if(e.code===o.vx.code)throw e;return{id:m}});m=t?.id??m}return{accounts:t?p:p.map(e=>e.address),chainId:m}}catch(e){if(/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(e.message))throw new o.vx(e);throw e}},async disconnect(){let e=await this.getProvider();d&&(e.removeListener("accountsChanged",d),d=void 0),h&&(e.removeListener("chainChanged",h),h=void 0),u&&(e.removeListener("disconnect",u),u=void 0),e.disconnect()},async getAccounts(){let e=await this.getProvider();return(await e.request({method:"eth_accounts"})).map(e=>(0,c.b)(e))},async getChainId(){let e=await this.getProvider();return Number(await e.request({method:"eth_chainId"}))}
1,async getProvider(){if(!t){let a="string"==typeof e.preference?{options:e.preference}:{...e.preference,options:e.preference?.options??"all"},{createBaseAccountSDK:r}=await n.e(5943).then(n.bind(n,65943));t=r({...e,appChainIds:i.chains.map(e=>e.id),preference:a}).getProvider()}return t},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:e,chainId:t}){let n=i.chains.find(e=>e.id===t);if(!n)throw new o.ch(new a.nk);let c=await this.getProvider();try{return await c.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,r.cK)(n.id)}]}),n}catch(i){if(4902===i.code)try{let i,a;i=e?.blockExplorerUrls?e.blockExplorerUrls:n.blockExplorers?.default.url?[n.blockExplorers?.default.url]:[],a=e?.rpcUrls?.length?e.rpcUrls:[n.rpcUrls.default?.http[0]??""];let o={blockExplorerUrls:i,chainId:(0,r.cK)(t),chainName:e?.chainName??n.name,iconUrls:e?.iconUrls,nativeCurrency:e?.nativeCurrency??n.nativeCurrency,rpcUrls:a};return await c.request({method:"wallet_addEthereumChain",params:[o]}),n}catch(e){throw new o.vx(e)}throw new o.ch(i)}},onAccountsChanged(e){0===e.length?this.onDisconnect():i.emitter.emit("change",{accounts:e.map(e=>(0,c.b)(e))})},onChainChanged(e){let t=Number(e);i.emitter.emit("change",{chainId:t})},async onDisconnect(e){i.emitter.emit("disconnect");let t=await this.getProvider();d&&(t.removeListener("accountsChanged",d),d=void 0),h&&(t.removeListener("chainChanged",h),h=void 0),u&&(t.removeListener("disconnect",u),u=void 0)}}))}var d=n(53589),h=n(66254);function u(e={}){let t,a,{shimDisconnect:r=!1}=e;return(0,i.U)(i=>({id:"safe",name:"Safe",type:u.type,async connect({withCapabilities:e}={}){let t=await this.getProvider();if(!t)throw new d.N;let n=await this.getAccounts(),c=await this.getChainId();return a||(a=this.onDisconnect.bind(this),t.on("disconnect",a)),r&&await i.storage?.removeItem("safe.disconnected"),{accounts:e?n.map(e=>({address:e,capabilities:{}})):n,chainId:c}},async disconnect(){let e=await this.getProvider();if(!e)throw new d.N;a&&(e.removeListener("disconnect",a),a=void 0),r&&await i.storage?.setItem("safe.disconnected",!0)},async getAccounts(){let e=await this.getProvider();if(!e)throw new d.N;return(await e.request({method:"eth_accounts"})).map(c.b)}
1,async getProvider(){if("undefined"!=typeof window&&window?.parent!==window){if(!t){let{default:i}=await Promise.all([n.e(2572),n.e(8615)]).then(n.bind(n,38615)),a=new i(e),r=await (0,h.w)(()=>a.safe.getInfo(),{timeout:e.unstable_getInfoTimeout??10});if(!r)throw Error("Could not load Safe information");t=new(await (async()=>{let e=await Promise.all([n.e(2572),n.e(7626)]).then(n.t.bind(n,47626,19));return"function"!=typeof e.SafeAppProvider&&"function"==typeof e.default.SafeAppProvider?e.default.SafeAppProvider:e.SafeAppProvider})())(r,a)}return t}},async getChainId(){let e=await this.getProvider();if(!e)throw new d.N;return Number(e.chainId)},async isAuthorized(){try{if(r&&await i.storage?.getItem("safe.disconnected"))return!1;return!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){i.emitter.emit("disconnect")}}))}u.type="safe"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.