@rango-dev/wallets-react 0.26.1-next.3 → 0.27.0

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 (65) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.js.map +4 -4
  3. package/dist/legacy/constants.d.ts +2 -0
  4. package/dist/legacy/constants.d.ts.map +1 -0
  5. package/dist/legacy/helpers.d.ts +6 -2
  6. package/dist/legacy/helpers.d.ts.map +1 -1
  7. package/dist/legacy/types.d.ts +4 -12
  8. package/dist/legacy/types.d.ts.map +1 -1
  9. package/dist/legacy/useAutoConnect.d.ts +4 -5
  10. package/dist/legacy/useAutoConnect.d.ts.map +1 -1
  11. package/dist/legacy/useLegacyProviders.d.ts +1 -5
  12. package/dist/legacy/useLegacyProviders.d.ts.map +1 -1
  13. package/dist/wallets-react.build.json +1 -1
  14. package/package.json +7 -15
  15. package/src/legacy/constants.ts +1 -0
  16. package/src/legacy/helpers.ts +92 -17
  17. package/src/legacy/types.ts +6 -14
  18. package/src/legacy/useAutoConnect.ts +16 -8
  19. package/src/legacy/useLegacyProviders.ts +7 -45
  20. package/src/provider.tsx +3 -3
  21. package/dist/hub/autoConnect.d.ts +0 -9
  22. package/dist/hub/autoConnect.d.ts.map +0 -1
  23. package/dist/hub/constants.d.ts +0 -3
  24. package/dist/hub/constants.d.ts.map +0 -1
  25. package/dist/hub/helpers.d.ts +0 -19
  26. package/dist/hub/helpers.d.ts.map +0 -1
  27. package/dist/hub/lastConnectedWallets.d.ts +0 -16
  28. package/dist/hub/lastConnectedWallets.d.ts.map +0 -1
  29. package/dist/hub/mod.d.ts +0 -3
  30. package/dist/hub/mod.d.ts.map +0 -1
  31. package/dist/hub/types.d.ts +0 -4
  32. package/dist/hub/types.d.ts.map +0 -1
  33. package/dist/hub/useHubAdapter.d.ts +0 -10
  34. package/dist/hub/useHubAdapter.d.ts.map +0 -1
  35. package/dist/hub/useHubRefs.d.ts +0 -7
  36. package/dist/hub/useHubRefs.d.ts.map +0 -1
  37. package/dist/hub/utils.d.ts +0 -38
  38. package/dist/hub/utils.d.ts.map +0 -1
  39. package/dist/legacy/autoConnect.d.ts +0 -8
  40. package/dist/legacy/autoConnect.d.ts.map +0 -1
  41. package/dist/legacy/mod.d.ts +0 -5
  42. package/dist/legacy/mod.d.ts.map +0 -1
  43. package/dist/legacy/utils.d.ts +0 -3
  44. package/dist/legacy/utils.d.ts.map +0 -1
  45. package/dist/test-utils/env.d.ts +0 -7
  46. package/dist/test-utils/env.d.ts.map +0 -1
  47. package/dist/test-utils/fixtures.d.ts +0 -14
  48. package/dist/test-utils/fixtures.d.ts.map +0 -1
  49. package/dist/useProviders.d.ts +0 -4
  50. package/dist/useProviders.d.ts.map +0 -1
  51. package/src/hub/autoConnect.ts +0 -186
  52. package/src/hub/constants.ts +0 -2
  53. package/src/hub/helpers.ts +0 -67
  54. package/src/hub/lastConnectedWallets.ts +0 -117
  55. package/src/hub/mod.ts +0 -2
  56. package/src/hub/types.ts +0 -12
  57. package/src/hub/useHubAdapter.ts +0 -337
  58. package/src/hub/useHubRefs.ts +0 -41
  59. package/src/hub/utils.ts +0 -389
  60. package/src/legacy/autoConnect.ts +0 -78
  61. package/src/legacy/mod.ts +0 -13
  62. package/src/legacy/utils.ts +0 -7
  63. package/src/test-utils/env.ts +0 -10
  64. package/src/test-utils/fixtures.ts +0 -238
  65. package/src/useProviders.ts +0 -120
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var fe=Object.defineProperty;var c=(e,n)=>fe(e,"name",{value:n,configurable:!0});import{Persistor as ge}from"@rango-dev/wallets-core/legacy";var v="last-connected-wallets",P="hub-v1-last-connected-wallets";import{Persistor as I}from"@rango-dev/wallets-core/legacy";var w=class{static{c(this,"LastConnectedWalletsFromStorage")}#e;constructor(n){this.#e=n}addWallet(n,a){if(this.#e===P)return this.#o(n,a);if(this.#e===v)return this.#r(n);throw new Error("Not implemented")}removeWallets(n){if(this.#e===P)return this.#a(n);if(this.#e===v)return this.#s(n);throw new Error("Not implemented")}list(){if(this.#e===P)return this.#n();if(this.#e===v)return this.#t();throw new Error("Not implemented")}#t(){let a=new I().getItem(v)||[],s={};return a.forEach(d=>{s[d]=[]}),s}#n(){return new I().getItem(P)||{}}#o(n,a){let s=new I,d=s.getItem(this.#e)||{};s.setItem(this.#e,{...d,[n]:a})}#r(n){let a=new I,s=a.getItem(this.#e)||[];a.setItem(v,s.concat(n))}#a(n){let a=new I,s=a.getItem(this.#e)||{};if(!n){a.setItem(this.#e,{});return}n.forEach(d=>{s[d]&&delete s[d]}),a.setItem(this.#e,s)}#s(n){let a=new I,s=a.getItem(this.#e)||[];if(!n){a.setItem(this.#e,[]);return}a.setItem(v,s.filter(d=>!n.includes(d)))}};function Ze(e,n){return e.find(a=>a.type===n)||null}c(Ze,"choose");var H={connected:!1,connecting:!1,reachable:!1,installed:!1,accounts:null,network:null};function $(e,n){if(n.type==="new_state"){let a=e[n.wallet];return a?{...e,[n.wallet]:{...a,[n.name]:n.value}}:{...e,[n.wallet]:{...H,[n.name]:n.value}}}return e}c($,"stateReducer");function K(e){return Object.entries(e).filter(([,n])=>n?.connected).map(([n])=>n)}c(K,"connectedWallets");function q(e){return Object.entries(e).map(([n])=>n)}c(q,"availableWallets");function X(e){let n=new Map;return e.forEach(a=>{let{config:s,...d}=a;n.set(s.type,{actions:d,config:s})}),n}c(X,"checkWalletProviders");function et(e){return e?.constructor?.name==="AsyncFunction"}c(et,"isAsync");function tt(e){let{checkInstallation:n=!0}=e.config;return n}c(tt,"needsCheckInstallation");async function z({type:e,walletActions:n,getState:a}){if(n.canEagerConnect){let s=new w(v),u=!!s.list()[e];u&&!a(e).connected&&B(),u||s.addWallet(e,[])}}c(z,"tryPersistWallet");function J({type:e,walletActions:n}){n.canEagerConnect&&new w(v).removeWallets([e])}c(J,"tryRemoveWalletFromPersistance");function B(){let e=new ge;e.getItem(v)&&e.removeItem(v)}c(B,"clearPersistance");function F(e,n){return c((s,d,u,p,r)=>{e({type:"new_state",wallet:s,name:d,value:u}),n&&n(s,d,u,p,r)},"handler")}c(F,"makeEventHandler");import De from"react";import{createContext as ye}from"react";var E="Context hasn't been initialized yet.",ve={async connect(){throw new Error(E)},async disconnect(){throw new Error(E)},async disconnectAll(){throw new Error(E)},async suggestAndConnect(){throw new Error(E)},state(){throw new Error(E)},canSwitchNetworkTo(){throw new Error(E)},providers(){throw new Error(E)},getWalletInfo(){throw new Error(E)},getSigners(){throw new Error(E)}},L=ye(ve);import{guessProviderStateSelector as te,namespaceStateSelector as ne}from"@rango-dev/wallets-core";import{LegacyEvents as k}from"@rango-dev/wallets-core/legacy";import{generateStoreId as Pe}from"@rango-dev/wallets-core/utils";import{pickVersion as M}from"@rango-dev/wallets-core/utils";import{convertEvmBlockchainMetaToEvmChainInfo as Ee,Networks as i}from"@rango-dev/wallets-shared";import{isEvmBlockchain as We}from"rango-types";import{legacyFormatAddressWithNetwork as Ce}from"@rango-dev/wallets-core/legacy";import{CAIP as he}from"@rango-dev/wallets-core/utils";function we(e){return typeof e=="string"?e:["solana"].includes(e.namespace.toLowerCase())?e.namespace.toUpperCase():e.namespace.toLowerCase()==="eip155"?"ETH":e.reference}c(we,"mapCaipNamespaceToLegacyNetworkName");function T(e){let{chainId:n,address:a}=he.AccountId.parse(e),s=we(n);return Ce(a,s)}c(T,"fromAccountIdToLegacyAddressFormat");async function Q(e){return await e.reduce(async(a,s)=>{let d=await a,u=await s();return[...d,u]},Promise.resolve([]))}c(Q,"sequentiallyRun");function Z(e){return typeof e=="object"&&!Array.isArray(e)}c(Z,"isConnectResultEvm");function ee(e){return Array.isArray(e)}c(ee,"isConnectResultSolana");function x(e,n){let a="0.0.0",s="1.0.0",{isExperimentalEnabled:d=!1}=n||{};if(d){let p=[],r=[];return e.forEach(t=>{try{let o=M(t,s);r.push(o[1])}catch{let o=M(t,a);p.push(o[1])}}),[p,r]}return[e.map(p=>M(p,a)[1]),[]]}c(x,"separateLegacyAndHubProviders");function W(e,n){return e.find(a=>a.id===n)}c(W,"findProviderByType");function oe(e,n,a,s,d,u){e.getAll().forEach((p,r)=>{let t=te(n,r),o=te(a,r),l=[],m=!1,g=!1,h=!1,f=null;p.getAll().forEach(O=>{let j=Pe(r,O.namespaceId),N=ne(n,j),Y=ne(a,j);if(N.network!==null&&(f=N.network),N.network!==Y.network&&(g=!0),Y.accounts?.slice().sort().toString()!==N.accounts?.slice().sort().toString())if(N.accounts){let G=N.accounts.map(T);l?l=[...l,...G]:l=[...G],m=!0}else l=null,h=!0});let C;try{C=S(d,r)}catch(O){console.warn("Having legacy provider is required for including some information like supported chain. ",O)}let y={connected:t.connected,connecting:t.connecting,installed:t.installed,accounts:l,network:f,reachable:!0},A={supportedBlockchains:C?.getWalletInfo(u||[]).supportedChains||[],isContractWallet:!1,isHub:!0};o.installed!==t.installed&&s(r,k.INSTALLED,t.installed,y,A),o.connecting!==t.connecting&&s(r,k.CONNECTING,t.connecting,y,A),o.connected!==t.connected&&s(r,k.CONNECTED,t.connected,y,A),m&&s(r,k.ACCOUNTS,l,y,A),h&&s(r,k.ACCOUNTS,null,y,A),g&&s(r,k.NETWORK,f,y,A)})}c(oe,"checkHubStateAndTriggerEvents");function b(e){switch(e=e,e){case i.AKASH:case i.BANDCHAIN:case i.BITCANNA:case i.BITSONG:case i.BINANCE:case i.CRYPTO_ORG:case i.CHIHUAHUA:case i.COMDEX:case i.COSMOS:case i.CRONOS:case i.DESMOS:case i.EMONEY:case i.INJECTIVE:case i.IRIS:case i.JUNO:case i.KI:case i.KONSTELLATION:case i.KUJIRA:case i.LUMNETWORK:case i.MEDIBLOC:case i.OSMOSIS:case i.PERSISTENCE:case i.REGEN:case i.SECRET:case i.SENTINEL:case i.SIF:case i.STARGAZE:case i.STARNAME:case i.TERRA:case i.THORCHAIN:case i.UMEE:return"Cosmos";case i.AVAX_CCHAIN:case i.ARBITRUM:case i.BOBA:case i.BSC:case i.FANTOM:case i.ETHEREUM:case i.FUSE:case i.GNOSIS:case i.HARMONY:case i.MOONBEAM:case i.MOONRIVER:case i.OPTIMISM:case i.POLYGON:case i.STARKNET:return"Evm";case i.SOLANA:return"Solana";case i.BTC:case i.BCH:case i.DOGE:case i.LTC:case i.TRON:return"UTXO";case i.TON:return"Ton";case i.POLKADOT:case i.AXELAR:case i.MARS:case i.MAYA:case i.STRIDE:case i.Unknown:throw new Error("Namespace isn't supported. network: "+e)}throw new Error("Couldn't matched network with any namespace. it's not discoverable. network: "+e)}c(b,"discoverNamespace");function S(e,n){let[a]=x(e),s=a.find(d=>d.config.type===n);if(!s)throw console.warn(`You have a provider that doesn't have legacy provider. It causes some problems since we need some legacy functionality. Provider Id: ${n}`),new Error(`You need to have legacy implementation to use some methods. Provider Id: ${n}`);return s}c(S,"getLegacyProvider");function _(e,n){if(!e.network)return;let a=n.filter(We);return Ee(a)[e.network]}c(_,"convertNamespaceNetworkToEvmChainId");function re(e,n){return _(e,n)||e.network}c(re,"tryConvertNamespaceNetworkToChainInfo");function ae(e){return Z(e)?{accounts:e.accounts,network:e.network,provider:void 0}:ee(e)?{accounts:e,network:null,provider:void 0}:{accounts:[e],network:null,provider:void 0}}c(ae,"transformHubResultToLegacyResult");import{legacyIsNamespaceDiscoverMode as Fe}from"@rango-dev/wallets-core/legacy";import"@rango-dev/wallets-shared";import{useEffect as pe,useRef as Me,useState as _e}from"react";import{useEffect as D,useReducer as Te}from"react";async function se(e,n){let a=new w(v),s=a.list(),d=Object.keys(s);if(d.length){let u=[];d.forEach(t=>{let o=e.get(t);if(o){let l=n(o);u.push({walletType:t,eagerConnect:l.eagerConnect.bind(l)})}});let p=await Promise.allSettled(u.map(async({eagerConnect:t})=>t()));if(!!p.find(({status:t})=>t==="fulfilled")){let t=[];p.forEach((o,l)=>{let{status:m}=o;m==="rejected"&&t.push(u[l].walletType)}),t.length&&a.removeWallets(t)}}}c(se,"autoConnect");import{LegacyWallet as Se}from"@rango-dev/wallets-core/legacy";import{useContext as Ae,useRef as Ne}from"react";function ce(e){let n=Ne({});function a(s){let d=s.config.type;return typeof n.current[d]>"u"&&(n.current[d]=new Se({config:s.config,handler:e},s.actions)),n.current[d]}return c(a,"updater"),a}c(ce,"useInitializers");function Ie(){let e=Ae(L);if(!e)throw Error("useWallet can only be used within the Provider component");return e}c(Ie,"useWallets");import{useEffect as ke,useRef as Le}from"react";function ie(e){return!!e.allBlockChains?.length&&!!e.autoConnect}c(ie,"shouldTryAutoConnect");function R(e){let n=Le(!1);ke(()=>{ie(e)&&!n.current&&(n.current=!0,e.autoConnectHandler())},[e.autoConnect,e.allBlockChains])}c(R,"useAutoConnect");function U(e){let[n,a]=Te($,{}),s=ce(F(a,e.onUpdateState)),d=e.providers,u=X(d);R({allBlockChains:e.allBlockChains,autoConnect:e.autoConnect,autoConnectHandler:async()=>se(u,s)});let p={async connect(r,t){let o=u.get(r);if(!o)throw new Error(`You should add ${r} to provider first.`);let l=t?.filter(f=>f.namespace!=="DISCOVER_MODE"),m;t&&t.length>0&&(m=t.find(f=>!!f.network)?.network);let h=await s(o).connect(m,l);return e.autoConnect&&z({type:r,walletActions:o.actions,getState:p.state}),[h]},async disconnect(r){let t=u.get(r);if(!t)throw new Error(`You should add ${r} to provider first.`);await s(t).disconnect(),e.autoConnect&&J({type:r,walletActions:t.actions})},async disconnectAll(){let r=[];return K(n).forEach(t=>{let o=u.get(t);if(o){let l=s(o);r.push(l.disconnect())}}),e.autoConnect&&B(),await Promise.allSettled(r)},async suggestAndConnect(r,t){let o=u.get(r);if(!o)throw new Error(`You should add ${r} to provider first.`);return await s(o).suggestAndConnect(t)},state(r){return n[r]||H},canSwitchNetworkTo(r,t){let o=u.get(r);if(!o)return!1;let l=s(o);return l.canSwitchNetworkTo?l.canSwitchNetworkTo(t,l.provider):!1},providers(){let r={};return q(n).forEach(t=>{let o=u.get(t);if(o){let l=s(o);r[t]=l.provider}}),r},getWalletInfo(r){let t=u.get(r);if(!t)throw new Error(`You should add ${r} to provider first.`);return t.actions.getWalletInfo(e.allBlockChains||[])},async getSigners(r){let t=u.get(r);if(!t)throw new Error(`You should add ${r} to provider first.`);let o=s(t),l=o.provider;return o.getSigners(l)}};return D(()=>{u.forEach(r=>{let t=s(r),o=c(()=>{t.onInit&&t.onInit()},"runOnInit"),l=c(m=>{m.target&&m.target.readyState==="complete"&&(o(),document.removeEventListener("readystatechange",l))},"initWhenPageIsReady");o(),document.addEventListener("readystatechange",l)})},[]),D(()=>{e.allBlockChains&&u.forEach(t=>{let o=s(t),l=o.getWalletInfo(e.allBlockChains||[]);o.setInfo({supportedBlockchains:l.supportedChains,isContractWallet:!!l.isContractWallet})})},[e.allBlockChains]),D(()=>{u.forEach(r=>{s(r).setHandler(F(a,e.onUpdateState))})},[e.onUpdateState]),p}c(U,"useLegacyProviders");import{legacyEagerConnectHandler as xe,legacyIsEvmNamespace as be,legacyIsNamespaceDiscoverMode as Re}from"@rango-dev/wallets-core/legacy";async function Oe(e,n,a){let{getHub:s,allBlockChains:d}=a,u=s().get(e);if(!u)throw new Error(`You should add ${e} to provider first then call 'connect'.`);if(!n)throw new Error("Passing namespace to `connect` is required. you can pass DISCOVERY_MODE for legacy.");let p=[];n.forEach(t=>{let o;Re(t)?o=b(t.network):o=t.namespace;let l=u.findByNamespace(o);if(!l)throw new Error(`We couldn't find any provider matched with your request namespace. (requested namespace: ${t.namespace})`);p.push([t,l])});let r=p.map(([t,o])=>{let m=(be(t)?_(t,d||[]):void 0)||t.network;return async()=>await o.connect(m)});return await Q(r)}c(Oe,"eagerConnect");async function le(e){let{getHub:n,allBlockChains:a,getLegacyProvider:s}=e,d=new w(P),u=d.list(),p=Object.keys(u),r=[];if(p.length){let t=[];p.forEach(l=>{let m=s(l),g;try{g=m.getInstance()}catch{console.warn("It seems instance isn't available yet. This can happens when extension not loaded yet (sometimes when opening browser for first time) or extension is disabled.");return}let h=u[l].map(y=>({namespace:y,network:void 0})),f=c(async()=>{if(!m.canEagerConnect)throw new Error(`${l} provider hasn't implemented canEagerConnect.`);return await m.canEagerConnect({instance:g,meta:m.getWalletInfo(a||[]).supportedChains})},"canEagerConnect"),C=c(async()=>Oe(l,h,{allBlockChains:a,getHub:n}),"connectHandler");t.push(xe({canEagerConnect:f,connectHandler:C,providerName:l}).catch(y=>{throw r.push(l),y}))}),await Promise.allSettled(t),p.length>r.length&&d.removeWallets(r)}}c(le,"autoConnect");import{createStore as He,Hub as Be}from"@rango-dev/wallets-core";import{useRef as de}from"react";function ue(e){let n=de(null),a=de(null);function s(){if(n.current!==null)return n.current;let u=He();return n.current=u,u}c(s,"getStore");function d(){if(a.current!==null)return a.current;let u=new Be({store:s()});return e.forEach(p=>{u.add(p.id,p)}),a.current=u,u}return c(d,"getHub"),{getStore:s,getHub:d}}c(ue,"useHubRefs");function V(e){let{getStore:n,getHub:a}=ue(e.providers),[,s]=_e(0),d=Me({onUpdateState:e.onUpdateState,allVersionedProviders:e.allVersionedProviders,allBlockChains:e.allBlockChains});pe(()=>{d.current={onUpdateState:e.onUpdateState,allVersionedProviders:e.allVersionedProviders,allBlockChains:e.allBlockChains}},[e]),pe(()=>{let r=c(()=>{a().init(),s(o=>o+1)},"runOnInit"),t=c(o=>{o.target&&o.target.readyState==="complete"&&(r(),document.removeEventListener("readystatechange",t))},"initHubWhenPageIsReady");r(),document.addEventListener("readystatechange",t),n().subscribe((o,l)=>{d.current.onUpdateState&&oe(a(),o,l,d.current.onUpdateState,d.current.allVersionedProviders,d.current.allBlockChains),s(m=>m+1)})},[]),R({autoConnect:e.autoConnect,allBlockChains:e.allBlockChains,autoConnectHandler:()=>{le({getLegacyProvider:S.bind(null,e.allVersionedProviders),allBlockChains:e.allBlockChains,getHub:a})}});let u=new w(P);return{canSwitchNetworkTo(r,t){let o=S(e.allVersionedProviders,r),l=o.canSwitchNetworkTo;return l?l({network:t,meta:e.allBlockChains||[],provider:o.getInstance()}):!1},async connect(r,t){let o=a().get(r);if(!o)throw new Error(`You should add ${r} to provider first then call 'connect'.`);if(!t)throw new Error("Passing namespace to `connect` is required. you can pass DISCOVERY_MODE for legacy.");let l=[];t.forEach(f=>{let C;Fe(f)?C=b(f.network):C=f.namespace;let y=o.findByNamespace(C);if(!y)throw new Error(`We couldn't find any provider matched with your request namespace. (requested namespace: ${f.namespace})`);l.push([f,y])});let m=l.map(async([f,C])=>{let y=re(f,e.allBlockChains||[]);return C.connect(y).then(ae)}),g=await Promise.all(m);if(S(e.allVersionedProviders,r).canEagerConnect){let f=l.map(C=>C[0].namespace);u.addWallet(r,f)}return g},async disconnect(r){let t=a().get(r);if(!t)throw new Error(`You should add ${r} to provider first then call 'connect'.`);t.getAll().forEach(o=>o.disconnect()),e.autoConnect&&u.removeWallets([r])},disconnectAll(){throw new Error("`disconnectAll` not implemented")},async getSigners(r){let t=S(e.allVersionedProviders,r);return t.getSigners(t.getInstance())},getWalletInfo(r){let t=a().get(r);if(!t)throw new Error(`You should add ${r} to provider first.`);let o=t.info();if(!o)throw new Error("Your provider should have required `info`.");let l=S(e.allVersionedProviders,r),m={DEFAULT:""};return Object.keys(o.extensions).forEach(g=>{let h=g;if(o.extensions[h]==="homepage"&&(m.DEFAULT=o.extensions[h]||""),["firefox","chrome","brave","edge"].includes(h)){let C=h.toUpperCase();m[C]=o.extensions[h]||""}}),{name:o.name,img:o.icon,installLink:m,color:"red",supportedChains:l.getWalletInfo(e.allBlockChains||[]).supportedChains,isContractWallet:!1,mobileWallet:!1,showOnMobile:void 0,isHub:!0,properties:t.info()?.properties}},providers(){let r={};return Array.from(a().getAll().keys()).forEach(t=>{try{let o=S(e.allVersionedProviders,t);r[t]=o.getInstance()}catch(o){console.warn(o)}}),r},state(r){let o=a().state()[r];if(!o)throw new Error(`It seems your requested provider doesn't exist in hub. Provider Id: ${r}`);let l=o.namespaces.filter(g=>g.connected).flatMap(g=>g.accounts?.map(T)).filter(g=>!!g);return{connected:o.connected,connecting:o.connecting,installed:o.installed,reachable:!0,accounts:l,network:null}},suggestAndConnect(r,t){throw new Error("`suggestAndConnect` is not implemented")}}}c(V,"useHubAdapter");function me(e){let{providers:n,...a}=e,[s,d]=x(n,{isExperimentalEnabled:a.configs?.isExperimentalEnabled}),u=U({...a,providers:s}),p=V({...a,providers:d,allVersionedProviders:n});return{canSwitchNetworkTo(t,o){return W(d,t)?p.canSwitchNetworkTo(t,o):u.canSwitchNetworkTo(t,o)},async connect(t,o){return W(d,t)?await p.connect(t,o):await u.connect(t,o)},async disconnect(t){return W(d,t)?await p.disconnect(t):await u.disconnect(t)},async disconnectAll(){return await Promise.allSettled([p.disconnectAll(),u.disconnectAll()])},async getSigners(t){return W(d,t)?p.getSigners(t):u.getSigners(t)},getWalletInfo(t){return W(d,t)?p.getWalletInfo(t):u.getWalletInfo(t)},providers(){let t={};return d.length>0&&(t={...t,...p.providers()}),s.length>0&&(t={...t,...u.providers()}),t},state(t){return W(d,t)?p.state(t):u.state(t)},async suggestAndConnect(t,o){return W(d,t)?p.suggestAndConnect(t,o):await u.suggestAndConnect(t,o)}}}c(me,"useProviders");function Ue(e){let n=me(e);return De.createElement(L.Provider,{value:n},e.children)}c(Ue,"Provider");var Ve=Ue;var je=(p=>(p.CONNECTED="connected",p.CONNECTING="connecting",p.REACHABLE="reachable",p.INSTALLED="installed",p.ACCOUNTS="accounts",p.NETWORK="network",p))(je||{});export{je as Events,Ve as Provider,q as availableWallets,X as checkWalletProviders,Ze as choose,B as clearPersistance,K as connectedWallets,H as defaultWalletState,et as isAsync,F as makeEventHandler,tt as needsCheckInstallation,$ as stateReducer,z as tryPersistWallet,J as tryRemoveWalletFromPersistance,Ie as useWallets};
1
+ var L=Object.defineProperty;var l=(e,n)=>L(e,"name",{value:n,configurable:!0});import{Persistor as w}from"@rango-dev/wallets-core/legacy";var u="last-connected-wallets";function Q(e,n){return e.find(c=>c.type===n)||null}l(Q,"choose");var m={connected:!1,connecting:!1,reachable:!1,installed:!1,accounts:null,network:null};function v(e,n){if(n.type==="new_state"){let c=e[n.wallet];return c?{...e,[n.wallet]:{...c,[n.name]:n.value}}:{...e,[n.wallet]:{...m,[n.name]:n.value}}}return e}l(v,"stateReducer");function P(e){return Object.entries(e).filter(([,n])=>n?.connected).map(([n])=>n)}l(P,"connectedWallets");function I(e){return Object.entries(e).map(([n])=>n)}l(I,"availableWallets");function k(e){let n=new Map;return e.forEach(c=>{let{config:a,...i}=c;n.set(a.type,{actions:i,config:a})}),n}l(k,"checkWalletProviders");function V(e){return e?.constructor?.name==="AsyncFunction"}l(V,"isAsync");function X(e){let{checkInstallation:n=!0}=e.config;return n}l(X,"needsCheckInstallation");async function x({type:e,walletActions:n,getState:c}){if(n.canEagerConnect){let a=new w,i=a.getItem(u);i?.find(t=>!c(t).connected)&&W();let p=!!i?.find(t=>t===e);i&&!p?a.setItem(u,i.concat(e)):a.setItem(u,[e])}}l(x,"tryPersistWallet");function S({type:e,walletActions:n}){if(n.canEagerConnect){let c=new w,a=c.getItem(u);a&&c.setItem(u,a.filter(i=>i!==e))}}l(S,"tryRemoveWalletFromPersistance");function W(){let e=new w;e.getItem(u)&&e.removeItem(u)}l(W,"clearPersistance");async function E(e,n){let c=new w,a=c.getItem(u);if(a&&a.length){let i=[];a.forEach(t=>{let o=e.get(t);if(o){let r=n(o);i.push({walletType:t,eagerConnect:r.eagerConnect.bind(r)})}});let d=await Promise.allSettled(i.map(async({eagerConnect:t})=>t()));if(!!d.find(({status:t})=>t==="fulfilled")){let t=[];d.forEach((o,r)=>{let{status:s}=o;s==="rejected"&&t.push(i[r].walletType)}),t.length&&c.setItem(u,a.filter(o=>!t.includes(o)))}}}l(E,"autoConnect");function h(e,n){return l((a,i,d,p,t)=>{e({type:"new_state",wallet:a,name:i,value:d}),n&&n(a,i,d,p,t)},"handler")}l(h,"makeEventHandler");import _ from"react";import{createContext as B}from"react";var f="Context hasn't been initialized yet.",R={async connect(){throw new Error(f)},async disconnect(){throw new Error(f)},async disconnectAll(){throw new Error(f)},async suggestAndConnect(){throw new Error(f)},state(){throw new Error(f)},canSwitchNetworkTo(){throw new Error(f)},providers(){throw new Error(f)},getWalletInfo(){throw new Error(f)},getSigners(){throw new Error(f)}},g=B(R);import{useEffect as C,useReducer as D}from"react";import{LegacyWallet as O}from"@rango-dev/wallets-core/legacy";import{useContext as H,useRef as M}from"react";function T(e){let n=M({});function c(a){let i=a.config.type;return typeof n.current[i]>"u"&&(n.current[i]=new O({config:a.config,handler:e},a.actions)),n.current[i]}return l(c,"updater"),c}l(T,"useInitializers");function F(){let e=H(g);if(!e)throw Error("useWallet can only be used within the Provider component");return e}l(F,"useWallets");import{useEffect as G,useRef as j}from"react";function A(e){let n=j(!1);G(()=>{e.allBlockChains&&e.allBlockChains.length&&e.autoConnect&&!n.current&&(n.current=!0,(async()=>await E(e.wallets,e.getWalletInstanceFromLegacy))())},[e.autoConnect,e.allBlockChains])}l(A,"useAutoConnect");function N(e){let[n,c]=D(v,{}),a=T(h(c,e.onUpdateState)),i=e.providers,d=k(i);A({wallets:d,allBlockChains:e.allBlockChains,autoConnect:e.autoConnect,getWalletInstanceFromLegacy:a});let p={async connect(t,o,r){let s=d.get(t);if(!s)throw new Error(`You should add ${t} to provider first.`);let b=await a(s).connect(o,r);return e.autoConnect&&x({type:t,walletActions:s.actions,getState:p.state}),b},async disconnect(t){let o=d.get(t);if(!o)throw new Error(`You should add ${t} to provider first.`);await a(o).disconnect(),e.autoConnect&&S({type:t,walletActions:o.actions})},async disconnectAll(){let t=[];return P(n).forEach(o=>{let r=d.get(o);if(r){let s=a(r);t.push(s.disconnect())}}),e.autoConnect&&W(),await Promise.allSettled(t)},async suggestAndConnect(t,o){let r=d.get(t);if(!r)throw new Error(`You should add ${t} to provider first.`);return await a(r).suggestAndConnect(o)},state(t){return n[t]||m},canSwitchNetworkTo(t,o){let r=d.get(t);if(!r)return!1;let s=a(r);return s.canSwitchNetworkTo?s.canSwitchNetworkTo(o,s.provider):!1},providers(){let t={};return I(n).forEach(o=>{let r=d.get(o);if(r){let s=a(r);t[o]=s.provider}}),t},getWalletInfo(t){let o=d.get(t);if(!o)throw new Error(`You should add ${t} to provider first.`);return o.actions.getWalletInfo(e.allBlockChains||[])},async getSigners(t){let o=d.get(t);if(!o)throw new Error(`You should add ${t} to provider first.`);let r=a(o),s=r.provider;return r.getSigners(s)}};return C(()=>{d.forEach(t=>{let o=a(t),r=l(()=>{o.onInit&&o.onInit()},"runOnInit"),s=l(y=>{y.target&&y.target.readyState==="complete"&&(r(),document.removeEventListener("readystatechange",s))},"initWhenPageIsReady");r(),document.addEventListener("readystatechange",s)})},[]),C(()=>{e.allBlockChains&&d.forEach(o=>{let r=a(o),s=r.getWalletInfo(e.allBlockChains||[]);r.setInfo({supportedBlockchains:s.supportedChains,isContractWallet:!!s.isContractWallet})})},[e.allBlockChains]),C(()=>{d.forEach(t=>{a(t).setHandler(h(c,e.onUpdateState))})},[e.onUpdateState]),p}l(N,"useLegacyProviders");function Y(e){let n=N(e);return _.createElement(g.Provider,{value:n},e.children)}l(Y,"Provider");var $=Y;var U=(p=>(p.CONNECTED="connected",p.CONNECTING="connecting",p.REACHABLE="reachable",p.INSTALLED="installed",p.ACCOUNTS="accounts",p.NETWORK="network",p))(U||{});export{U as Events,$ as Provider,E as autoConnect,I as availableWallets,k as checkWalletProviders,Q as choose,W as clearPersistance,P as connectedWallets,m as defaultWalletState,V as isAsync,h as makeEventHandler,X as needsCheckInstallation,v as stateReducer,x as tryPersistWallet,S as tryRemoveWalletFromPersistance,F as useWallets};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/legacy/helpers.ts", "../src/hub/constants.ts", "../src/hub/lastConnectedWallets.ts", "../src/provider.tsx", "../src/legacy/context.ts", "../src/hub/utils.ts", "../src/hub/helpers.ts", "../src/hub/useHubAdapter.ts", "../src/legacy/useLegacyProviders.ts", "../src/legacy/autoConnect.ts", "../src/legacy/hooks.ts", "../src/legacy/useAutoConnect.ts", "../src/legacy/utils.ts", "../src/hub/autoConnect.ts", "../src/hub/useHubRefs.ts", "../src/useProviders.ts", "../src/legacy/types.ts"],
4
- "sourcesContent": ["import type {\n ProviderInterface,\n State,\n WalletActions,\n WalletProviders,\n} from './types.js';\nimport type {\n LegacyOptions as Options,\n LegacyEventHandler as WalletEventHandler,\n LegacyState as WalletState,\n} from '@rango-dev/wallets-core/legacy';\nimport type { WalletType } from '@rango-dev/wallets-shared';\n\nimport { Persistor } from '@rango-dev/wallets-core/legacy';\n\nimport { LEGACY_LAST_CONNECTED_WALLETS } from '../hub/constants.js';\nimport { LastConnectedWalletsFromStorage } from '../hub/lastConnectedWallets.js';\n\nexport function choose(wallets: any[], type: WalletType): any | null {\n return wallets.find((wallet) => wallet.type === type) || null;\n}\n\nexport const defaultWalletState: WalletState = {\n connected: false,\n connecting: false,\n reachable: false,\n installed: false,\n accounts: null,\n network: null,\n};\n\nexport function stateReducer(state: State, action: any) {\n if (action.type === 'new_state') {\n // TODO fix problem and remove ts-ignore\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const target_wallet = state[action.wallet];\n if (!target_wallet) {\n return {\n ...state,\n [action.wallet]: {\n ...defaultWalletState,\n [action.name]: action.value,\n },\n };\n }\n\n return {\n ...state,\n [action.wallet]: {\n ...target_wallet,\n [action.name]: action.value,\n },\n };\n }\n\n return state;\n}\n\nexport function connectedWallets(providersState: State): WalletType[] {\n return Object.entries(providersState)\n .filter(([, wallet_state]) => {\n return wallet_state?.connected;\n })\n .map(([type]) => {\n return type;\n });\n}\n\nexport function availableWallets(providersState: State): WalletType[] {\n return Object.entries(providersState).map(([type]) => {\n return type;\n });\n}\n\nexport function checkWalletProviders(\n list: ProviderInterface[]\n): WalletProviders {\n const wallets: WalletProviders = new Map();\n\n list.forEach((provider) => {\n const { config, ...actions } = provider;\n wallets.set(config.type, {\n actions,\n config,\n });\n });\n\n return wallets;\n}\n\n/* eslint-disable @typescript-eslint/ban-types */\nexport function isAsync(fn: Function) {\n return fn?.constructor?.name === 'AsyncFunction';\n}\n\nexport function needsCheckInstallation(options: Options) {\n const { checkInstallation = true } = options.config;\n return checkInstallation;\n}\n\nexport async function tryPersistWallet({\n type,\n walletActions,\n getState,\n}: {\n type: WalletType;\n walletActions: WalletActions;\n getState: (walletType: WalletType) => WalletState;\n}) {\n if (walletActions.canEagerConnect) {\n const lastConnectedWalletsFromStorage = new LastConnectedWalletsFromStorage(\n LEGACY_LAST_CONNECTED_WALLETS\n );\n const lastConnectedWallets = lastConnectedWalletsFromStorage.list();\n const walletAlreadyPersisted = !!lastConnectedWallets[type];\n\n /*\n *If on the last attempt we are unable to eagerly connect to any wallet and the user connects any wallet manualy,\n *persistance will be outdated and will need to be removed.\n */\n if (walletAlreadyPersisted && !getState(type).connected) {\n clearPersistance();\n }\n\n if (!walletAlreadyPersisted) {\n lastConnectedWalletsFromStorage.addWallet(type, []);\n }\n }\n}\n\nexport function tryRemoveWalletFromPersistance({\n type,\n walletActions,\n}: {\n type: WalletType;\n walletActions: WalletActions;\n}) {\n if (walletActions.canEagerConnect) {\n const lastConnectedWalletsFromStorage = new LastConnectedWalletsFromStorage(\n LEGACY_LAST_CONNECTED_WALLETS\n );\n lastConnectedWalletsFromStorage.removeWallets([type]);\n }\n}\n\nexport function clearPersistance() {\n const persistor = new Persistor<string[]>();\n const wallets = persistor.getItem(LEGACY_LAST_CONNECTED_WALLETS);\n if (wallets) {\n persistor.removeItem(LEGACY_LAST_CONNECTED_WALLETS);\n }\n}\n\n/*\n *Our event handler includes an internal state updater, and a notifier\n *for the outside listener.\n *On creating first wallet refrence, and on chaning `props.onUpdateState`\n *we are using this function.\n */\nexport function makeEventHandler(\n dispatcher: any,\n onUpdateState?: WalletEventHandler\n) {\n const handler: WalletEventHandler = (\n type,\n name,\n value,\n coreState,\n supportedChains\n ) => {\n const action = { type: 'new_state', wallet: type, name, value };\n // Update state\n dispatcher(action);\n\n // Giving the event to the outside listener\n if (onUpdateState) {\n onUpdateState(type, name, value, coreState, supportedChains);\n }\n };\n\n return handler;\n}\n", "export const LEGACY_LAST_CONNECTED_WALLETS = 'last-connected-wallets';\nexport const HUB_LAST_CONNECTED_WALLETS = 'hub-v1-last-connected-wallets';\n", "import { Persistor } from '@rango-dev/wallets-core/legacy';\n\nimport {\n HUB_LAST_CONNECTED_WALLETS,\n LEGACY_LAST_CONNECTED_WALLETS,\n} from './constants.js';\n\nexport interface LastConnectedWalletsStorage {\n [providerId: string]: string[];\n}\n\nexport type LegacyLastConnectedWalletsStorage = string[];\n\n/**\n * We are doing some certain actions on storage for `last-connected-wallets` key.\n * This class helps us to define them in one place and also it has support for both legacy and hub.\n */\nexport class LastConnectedWalletsFromStorage {\n #storageKey: string;\n\n constructor(storageKey: string) {\n this.#storageKey = storageKey;\n }\n\n addWallet(providerId: string, namespaces: string[]): void {\n if (this.#storageKey === HUB_LAST_CONNECTED_WALLETS) {\n return this.#addWalletToHub(providerId, namespaces);\n } else if (this.#storageKey === LEGACY_LAST_CONNECTED_WALLETS) {\n return this.#addWalletToLegacy(providerId);\n }\n throw new Error('Not implemented');\n }\n removeWallets(providerIds?: string[]): void {\n if (this.#storageKey === HUB_LAST_CONNECTED_WALLETS) {\n return this.#removeWalletsFromHub(providerIds);\n } else if (this.#storageKey === LEGACY_LAST_CONNECTED_WALLETS) {\n return this.#removeWalletsFromLegacy(providerIds);\n }\n throw new Error('Not implemented');\n }\n list(): LastConnectedWalletsStorage {\n if (this.#storageKey === HUB_LAST_CONNECTED_WALLETS) {\n return this.#listFromHub();\n } else if (this.#storageKey === LEGACY_LAST_CONNECTED_WALLETS) {\n return this.#listFromLegacy();\n }\n throw new Error('Not implemented');\n }\n\n #listFromLegacy(): LastConnectedWalletsStorage {\n const persistor = new Persistor<LegacyLastConnectedWalletsStorage>();\n const lastConnectedWallets =\n persistor.getItem(LEGACY_LAST_CONNECTED_WALLETS) || [];\n const output: LastConnectedWalletsStorage = {};\n lastConnectedWallets.forEach((provider) => {\n // Setting empty namespaces\n output[provider] = [];\n });\n return output;\n }\n #listFromHub(): LastConnectedWalletsStorage {\n const persistor = new Persistor<LastConnectedWalletsStorage>();\n const lastConnectedWallets =\n persistor.getItem(HUB_LAST_CONNECTED_WALLETS) || {};\n return lastConnectedWallets;\n }\n #addWalletToHub(providerId: string, namespaces: string[]): void {\n const storage = new Persistor<LastConnectedWalletsStorage>();\n const data = storage.getItem(this.#storageKey) || {};\n\n storage.setItem(this.#storageKey, {\n ...data,\n [providerId]: namespaces,\n });\n }\n #addWalletToLegacy(providerId: string): void {\n const storage = new Persistor<LegacyLastConnectedWalletsStorage>();\n const data = storage.getItem(this.#storageKey) || [];\n\n storage.setItem(LEGACY_LAST_CONNECTED_WALLETS, data.concat(providerId));\n }\n #removeWalletsFromHub(providerIds?: string[]): void {\n const persistor = new Persistor<LastConnectedWalletsStorage>();\n const storageState = persistor.getItem(this.#storageKey) || {};\n\n // Remove all wallets\n if (!providerIds) {\n persistor.setItem(this.#storageKey, {});\n return;\n }\n\n // Remove some of the wallets\n providerIds.forEach((providerId) => {\n if (storageState[providerId]) {\n delete storageState[providerId];\n }\n });\n\n persistor.setItem(this.#storageKey, storageState);\n }\n #removeWalletsFromLegacy(providerIds?: string[]): void {\n const persistor = new Persistor<LegacyLastConnectedWalletsStorage>();\n const storageState = persistor.getItem(this.#storageKey) || [];\n\n // Remove all wallets\n if (!providerIds) {\n persistor.setItem(this.#storageKey, []);\n return;\n }\n\n // Remove some of the wallets\n persistor.setItem(\n LEGACY_LAST_CONNECTED_WALLETS,\n storageState.filter((wallet) => !providerIds.includes(wallet))\n );\n }\n}\n", "import type { ProviderProps } from './legacy/types.js';\n\nimport React from 'react';\n\nimport { WalletContext } from './legacy/context.js';\nimport { useProviders } from './useProviders.js';\n\nfunction Provider(props: ProviderProps) {\n const api = useProviders(props);\n\n return (\n <WalletContext.Provider value={api}>\n {props.children}\n </WalletContext.Provider>\n );\n}\n\nexport default Provider;\n", "import type { ProviderContext } from './types.js';\n\nimport { createContext } from 'react';\n\nconst defaultErrorMesssage = \"Context hasn't been initialized yet.\";\nconst defaultContext: ProviderContext = {\n async connect() {\n throw new Error(defaultErrorMesssage);\n },\n async disconnect() {\n throw new Error(defaultErrorMesssage);\n },\n async disconnectAll() {\n throw new Error(defaultErrorMesssage);\n },\n async suggestAndConnect() {\n throw new Error(defaultErrorMesssage);\n },\n state() {\n throw new Error(defaultErrorMesssage);\n },\n canSwitchNetworkTo() {\n throw new Error(defaultErrorMesssage);\n },\n providers() {\n throw new Error(defaultErrorMesssage);\n },\n getWalletInfo() {\n throw new Error(defaultErrorMesssage);\n },\n getSigners() {\n throw new Error(defaultErrorMesssage);\n },\n};\n\nexport const WalletContext = createContext<ProviderContext>(defaultContext);\n", "import type { AllProxiedNamespaces } from './types.js';\nimport type { ConnectResult, ProviderProps } from '../legacy/mod.js';\nimport type { Hub, Provider, State } from '@rango-dev/wallets-core';\nimport type {\n LegacyNamespaceInputForConnect,\n LegacyProviderInterface,\n LegacyEventHandler as WalletEventHandler,\n} from '@rango-dev/wallets-core/legacy';\nimport type { Namespace } from '@rango-dev/wallets-core/namespaces/common';\n\nimport {\n guessProviderStateSelector,\n namespaceStateSelector,\n} from '@rango-dev/wallets-core';\nimport { LegacyEvents as Events } from '@rango-dev/wallets-core/legacy';\nimport {\n generateStoreId,\n type VersionedProviders,\n} from '@rango-dev/wallets-core/utils';\nimport { pickVersion } from '@rango-dev/wallets-core/utils';\nimport {\n type AddEthereumChainParameter,\n convertEvmBlockchainMetaToEvmChainInfo,\n Networks,\n} from '@rango-dev/wallets-shared';\nimport { type BlockchainMeta, isEvmBlockchain } from 'rango-types';\n\nimport {\n fromAccountIdToLegacyAddressFormat,\n isConnectResultEvm,\n isConnectResultSolana,\n} from './helpers.js';\n\n/* Gets a list of hub and legacy providers and returns a tuple which separates them. */\nexport function separateLegacyAndHubProviders(\n providers: VersionedProviders[],\n options?: { isExperimentalEnabled?: boolean }\n): [LegacyProviderInterface[], Provider[]] {\n const LEGACY_VERSION = '0.0.0';\n const HUB_VERSION = '1.0.0';\n const { isExperimentalEnabled = false } = options || {};\n\n if (isExperimentalEnabled) {\n const legacyProviders: LegacyProviderInterface[] = [];\n const hubProviders: Provider[] = [];\n\n providers.forEach((provider) => {\n try {\n const target = pickVersion(provider, HUB_VERSION);\n hubProviders.push(target[1]);\n } catch {\n const target = pickVersion(provider, LEGACY_VERSION);\n legacyProviders.push(target[1]);\n }\n });\n\n return [legacyProviders, hubProviders];\n }\n\n const legacyProviders = providers.map(\n (provider) => pickVersion(provider, LEGACY_VERSION)[1]\n );\n return [legacyProviders, []];\n}\n\nexport function findProviderByType(\n providers: Provider[],\n type: string\n): Provider | undefined {\n return providers.find((provider) => provider.id === type);\n}\n\n/**\n * We will call this function on hub's `subscribe`.\n * it will check states and will emit legacy events for backward compatibility.\n */\nexport function checkHubStateAndTriggerEvents(\n hub: Hub,\n currentState: State,\n previousState: State,\n onUpdateState: WalletEventHandler,\n allProviders: VersionedProviders[],\n allBlockChains: ProviderProps['allBlockChains']\n): void {\n hub.getAll().forEach((provider, providerId) => {\n const currentProviderState = guessProviderStateSelector(\n currentState,\n providerId\n );\n const previousProviderState = guessProviderStateSelector(\n previousState,\n providerId\n );\n\n let accounts: string[] | null = [];\n /*\n * We don't rely `accounts` to make sure we will trigger proper event on this case:\n * previous value: [0x...]\n * current value: []\n */\n let hasAccountChanged = false;\n let hasNetworkChanged = false;\n let hasProviderDisconnected = false;\n // It will pick the last network from namespaces.\n let maybeNetwork = null;\n provider.getAll().forEach((namespace) => {\n const storeId = generateStoreId(providerId, namespace.namespaceId);\n const currentNamespaceState = namespaceStateSelector(\n currentState,\n storeId\n );\n const previousNamespaceState = namespaceStateSelector(\n previousState,\n storeId\n );\n\n if (currentNamespaceState.network !== null) {\n maybeNetwork = currentNamespaceState.network;\n }\n\n // Check for network\n if (currentNamespaceState.network !== previousNamespaceState.network) {\n hasNetworkChanged = true;\n }\n\n // TODO: `accounts` has been frozen, we should check and find where object.freeze() is calling.\n\n // Check for accounts\n if (\n previousNamespaceState.accounts?.slice().sort().toString() !==\n currentNamespaceState.accounts?.slice().sort().toString()\n ) {\n if (currentNamespaceState.accounts) {\n const formattedAddresses = currentNamespaceState.accounts.map(\n fromAccountIdToLegacyAddressFormat\n );\n\n if (accounts) {\n accounts = [...accounts, ...formattedAddresses];\n } else {\n accounts = [...formattedAddresses];\n }\n\n hasAccountChanged = true;\n } else {\n accounts = null;\n hasProviderDisconnected = true;\n }\n }\n });\n\n let legacyProvider;\n try {\n legacyProvider = getLegacyProvider(allProviders, providerId);\n } catch (e) {\n console.warn(\n 'Having legacy provider is required for including some information like supported chain. ',\n e\n );\n }\n\n const coreState = {\n connected: currentProviderState.connected,\n connecting: currentProviderState.connecting,\n installed: currentProviderState.installed,\n accounts: accounts,\n network: maybeNetwork,\n reachable: true,\n };\n\n const eventInfo = {\n supportedBlockchains:\n legacyProvider?.getWalletInfo(allBlockChains || []).supportedChains ||\n [],\n isContractWallet: false,\n isHub: true,\n };\n\n if (previousProviderState.installed !== currentProviderState.installed) {\n onUpdateState(\n providerId,\n Events.INSTALLED,\n currentProviderState.installed,\n coreState,\n eventInfo\n );\n }\n if (previousProviderState.connecting !== currentProviderState.connecting) {\n onUpdateState(\n providerId,\n Events.CONNECTING,\n currentProviderState.connecting,\n coreState,\n eventInfo\n );\n }\n if (previousProviderState.connected !== currentProviderState.connected) {\n onUpdateState(\n providerId,\n Events.CONNECTED,\n currentProviderState.connected,\n coreState,\n eventInfo\n );\n }\n if (hasAccountChanged) {\n onUpdateState(\n providerId,\n Events.ACCOUNTS,\n accounts,\n coreState,\n eventInfo\n );\n }\n if (hasProviderDisconnected) {\n onUpdateState(providerId, Events.ACCOUNTS, null, coreState, eventInfo);\n }\n if (hasNetworkChanged) {\n onUpdateState(\n providerId,\n Events.NETWORK,\n maybeNetwork,\n coreState,\n eventInfo\n );\n }\n });\n}\n\n/**\n * For backward compatibility, there is an special namespace called DISCOVER_MODE.\n * Alongside `DISCOVER_MODE`, `network` will be set as well. here we are manually matching networks to namespaces.\n * This will help us keep the legacy interface and have what hub needs as well.\n */\nexport function discoverNamespace(network: string): Namespace {\n // This trick is using for enforcing exhaustiveness check.\n network = network as unknown as Networks;\n switch (network) {\n case Networks.AKASH:\n case Networks.BANDCHAIN:\n case Networks.BITCANNA:\n case Networks.BITSONG:\n case Networks.BINANCE:\n case Networks.CRYPTO_ORG:\n case Networks.CHIHUAHUA:\n case Networks.COMDEX:\n case Networks.COSMOS:\n case Networks.CRONOS:\n case Networks.DESMOS:\n case Networks.EMONEY:\n case Networks.INJECTIVE:\n case Networks.IRIS:\n case Networks.JUNO:\n case Networks.KI:\n case Networks.KONSTELLATION:\n case Networks.KUJIRA:\n case Networks.LUMNETWORK:\n case Networks.MEDIBLOC:\n case Networks.OSMOSIS:\n case Networks.PERSISTENCE:\n case Networks.REGEN:\n case Networks.SECRET:\n case Networks.SENTINEL:\n case Networks.SIF:\n case Networks.STARGAZE:\n case Networks.STARNAME:\n case Networks.TERRA:\n case Networks.THORCHAIN:\n case Networks.UMEE:\n return 'Cosmos';\n case Networks.AVAX_CCHAIN:\n case Networks.ARBITRUM:\n case Networks.BOBA:\n case Networks.BSC:\n case Networks.FANTOM:\n case Networks.ETHEREUM:\n case Networks.FUSE:\n case Networks.GNOSIS:\n case Networks.HARMONY:\n case Networks.MOONBEAM:\n case Networks.MOONRIVER:\n case Networks.OPTIMISM:\n case Networks.POLYGON:\n case Networks.STARKNET:\n return 'Evm';\n case Networks.SOLANA:\n return 'Solana';\n case Networks.BTC:\n case Networks.BCH:\n case Networks.DOGE:\n case Networks.LTC:\n case Networks.TRON:\n return 'UTXO';\n case Networks.TON:\n return 'Ton';\n case Networks.POLKADOT:\n case Networks.AXELAR:\n case Networks.MARS:\n case Networks.MAYA:\n case Networks.STRIDE:\n case Networks.Unknown:\n throw new Error(\"Namespace isn't supported. network: \" + network);\n }\n\n throw new Error(\n \"Couldn't matched network with any namespace. it's not discoverable. network: \" +\n network\n );\n}\n\nexport function getLegacyProvider(\n allProviders: VersionedProviders[],\n type: string\n): LegacyProviderInterface {\n const [legacy] = separateLegacyAndHubProviders(allProviders);\n const provider = legacy.find((legacyProvider) => {\n return legacyProvider.config.type === type;\n });\n\n if (!provider) {\n console.warn(\n `You have a provider that doesn't have legacy provider. It causes some problems since we need some legacy functionality. Provider Id: ${type}`\n );\n throw new Error(\n `You need to have legacy implementation to use some methods. Provider Id: ${type}`\n );\n }\n\n return provider;\n}\n\n/**\n * In legacy mode, for those who have switch network functionality (like evm), we are using an enum for network names\n * this enum only has meaning for us, and when we are going to connect an instance (e.g. window.ethereum) we should pass chain id.\n */\nexport function convertNamespaceNetworkToEvmChainId(\n namespace: LegacyNamespaceInputForConnect,\n meta: BlockchainMeta[]\n) {\n if (!namespace.network) {\n return undefined;\n }\n\n const evmBlockchainsList = meta.filter(isEvmBlockchain);\n const evmChains = convertEvmBlockchainMetaToEvmChainInfo(evmBlockchainsList);\n\n return evmChains[namespace.network];\n}\n\n/**\n * We are passing an string for chain id (e.g. ETH, POLYGON), but wallet's instances (e.g. window.ethereum) needs chainId (e.g. 0x1).\n * This function will help us to map these strings to proper hex ids.\n *\n * If you need same functionality for other blockchain types (e.g. Cosmos), You can make a separate function and add it here.\n */\nexport function tryConvertNamespaceNetworkToChainInfo(\n namespace: LegacyNamespaceInputForConnect,\n meta: BlockchainMeta[]\n): string | AddEthereumChainParameter | undefined {\n // `undefined` means it's not evm or we couldn't find it in meta.\n const evmChain = convertNamespaceNetworkToEvmChainId(namespace, meta);\n const network = evmChain || namespace.network;\n\n return network;\n}\n\nexport function transformHubResultToLegacyResult(\n res: Awaited<ReturnType<AllProxiedNamespaces['connect']>>\n): ConnectResult {\n if (isConnectResultEvm(res)) {\n return {\n accounts: res.accounts,\n network: res.network,\n provider: undefined,\n };\n } else if (isConnectResultSolana(res)) {\n return {\n accounts: res,\n network: null,\n provider: undefined,\n };\n }\n\n return {\n accounts: [res],\n network: null,\n provider: undefined,\n };\n}\n", "import type { AllProxiedNamespaces } from './types.js';\nimport type {\n Accounts,\n AccountsWithActiveChain,\n} from '@rango-dev/wallets-core/namespaces/common';\n\nimport { legacyFormatAddressWithNetwork as formatAddressWithNetwork } from '@rango-dev/wallets-core/legacy';\nimport { CAIP } from '@rango-dev/wallets-core/utils';\n\nexport function mapCaipNamespaceToLegacyNetworkName(\n chainId: CAIP.ChainIdParams | string\n): string {\n if (typeof chainId === 'string') {\n return chainId;\n }\n const useNamespaceAsNetworkFor = ['solana'];\n\n if (useNamespaceAsNetworkFor.includes(chainId.namespace.toLowerCase())) {\n return chainId.namespace.toUpperCase();\n }\n\n if (chainId.namespace.toLowerCase() === 'eip155') {\n return 'ETH';\n }\n\n return chainId.reference;\n}\n\n/**\n * CAIP's accountId has a format like this: eip155:1:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb\n * Legacy format is something like this: ETH:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb\n * This function will try to convert this two format.\n *\n * @see https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md\n */\nexport function fromAccountIdToLegacyAddressFormat(account: string): string {\n const { chainId, address } = CAIP.AccountId.parse(account);\n const network = mapCaipNamespaceToLegacyNetworkName(chainId);\n return formatAddressWithNetwork(address, network);\n}\n\n/**\n * Getting a list of (lazy) promises and run them one after another.\n */\nexport async function sequentiallyRun<T extends () => Promise<unknown>>(\n promises: Array<T>\n): Promise<Array<T extends () => Promise<infer R> ? R : never>> {\n const result = await promises.reduce(async (prev, task) => {\n const previousResults = await prev;\n const taskResult = await task();\n\n return [...previousResults, taskResult];\n }, Promise.resolve([]) as Promise<any>);\n return result;\n}\n\nexport function isConnectResultEvm(\n result: Awaited<ReturnType<AllProxiedNamespaces['connect']>>\n): result is AccountsWithActiveChain {\n return typeof result === 'object' && !Array.isArray(result);\n}\n\nexport function isConnectResultSolana(\n result: Awaited<ReturnType<AllProxiedNamespaces['connect']>>\n): result is Accounts {\n return Array.isArray(result);\n}\n", "import type { AllProxiedNamespaces, ExtensionLink } from './types.js';\nimport type { Providers } from '../index.js';\nimport type { Provider } from '@rango-dev/wallets-core';\nimport type { LegacyNamespaceInputForConnect } from '@rango-dev/wallets-core/legacy';\nimport type { Namespace } from '@rango-dev/wallets-core/namespaces/common';\nimport type { VersionedProviders } from '@rango-dev/wallets-core/utils';\n\nimport { legacyIsNamespaceDiscoverMode } from '@rango-dev/wallets-core/legacy';\nimport { type WalletInfo } from '@rango-dev/wallets-shared';\nimport { useEffect, useRef, useState } from 'react';\n\nimport {\n type ConnectResult,\n HUB_LAST_CONNECTED_WALLETS,\n type ProviderContext,\n type ProviderProps,\n} from '../legacy/mod.js';\nimport { useAutoConnect } from '../legacy/useAutoConnect.js';\n\nimport { autoConnect } from './autoConnect.js';\nimport { fromAccountIdToLegacyAddressFormat } from './helpers.js';\nimport { LastConnectedWalletsFromStorage } from './lastConnectedWallets.js';\nimport { useHubRefs } from './useHubRefs.js';\nimport {\n checkHubStateAndTriggerEvents,\n discoverNamespace,\n getLegacyProvider,\n transformHubResultToLegacyResult,\n tryConvertNamespaceNetworkToChainInfo,\n} from './utils.js';\n\nexport type UseAdapterParams = Omit<ProviderProps, 'providers'> & {\n providers: Provider[];\n /** This is only will be used to access some parts of the legacy provider that doesn't exists in Hub. */\n allVersionedProviders: VersionedProviders[];\n};\n\nexport function useHubAdapter(params: UseAdapterParams): ProviderContext {\n const { getStore, getHub } = useHubRefs(params.providers);\n const [, rerender] = useState(0);\n // useEffect will run `subscribe` once, so we need a reference and mutate the value if it's changes.\n const dataRef = useRef({\n onUpdateState: params.onUpdateState,\n allVersionedProviders: params.allVersionedProviders,\n allBlockChains: params.allBlockChains,\n });\n\n useEffect(() => {\n dataRef.current = {\n onUpdateState: params.onUpdateState,\n allVersionedProviders: params.allVersionedProviders,\n allBlockChains: params.allBlockChains,\n };\n }, [params]);\n\n // Initialize instances\n useEffect(() => {\n const runOnInit = () => {\n getHub().init();\n\n rerender((currentRender) => currentRender + 1);\n };\n\n // Then will call init whenever page is ready.\n const initHubWhenPageIsReady = (event: Event) => {\n // Then will call init whenever page is ready.\n if (\n event.target &&\n (event.target as Document).readyState === 'complete'\n ) {\n runOnInit();\n document.removeEventListener(\n 'readystatechange',\n initHubWhenPageIsReady\n );\n }\n };\n\n // Try to run, maybe it's ready.\n runOnInit();\n\n /*\n * Try again when the page has been completely loaded.\n * Some of wallets, take some time to be fully injected and loaded.\n */\n document.addEventListener('readystatechange', initHubWhenPageIsReady);\n\n getStore().subscribe((curr, prev) => {\n if (dataRef.current.onUpdateState) {\n checkHubStateAndTriggerEvents(\n getHub(),\n curr,\n prev,\n dataRef.current.onUpdateState,\n dataRef.current.allVersionedProviders,\n dataRef.current.allBlockChains\n );\n }\n rerender((currentRender) => currentRender + 1);\n });\n }, []);\n\n useAutoConnect({\n autoConnect: params.autoConnect,\n allBlockChains: params.allBlockChains,\n autoConnectHandler: () => {\n void autoConnect({\n getLegacyProvider: getLegacyProvider.bind(\n null,\n params.allVersionedProviders\n ),\n allBlockChains: params.allBlockChains,\n getHub,\n });\n },\n });\n\n const lastConnectedWalletsFromStorage = new LastConnectedWalletsFromStorage(\n HUB_LAST_CONNECTED_WALLETS\n );\n\n const api: ProviderContext = {\n canSwitchNetworkTo(type, network) {\n const provider = getLegacyProvider(params.allVersionedProviders, type);\n const switchTo = provider.canSwitchNetworkTo;\n\n if (!switchTo) {\n return false;\n }\n\n return switchTo({\n network,\n meta: params.allBlockChains || [],\n provider: provider.getInstance(),\n });\n },\n async connect(type, namespaces) {\n const wallet = getHub().get(type);\n if (!wallet) {\n throw new Error(\n `You should add ${type} to provider first then call 'connect'.`\n );\n }\n\n if (!namespaces) {\n throw new Error(\n 'Passing namespace to `connect` is required. you can pass DISCOVERY_MODE for legacy.'\n );\n }\n\n // Check `namespace` and look into hub to see how it can match given namespace to hub namespace.\n const targetNamespaces: [\n LegacyNamespaceInputForConnect,\n AllProxiedNamespaces\n ][] = [];\n namespaces.forEach((namespace) => {\n let targetNamespace: Namespace;\n if (legacyIsNamespaceDiscoverMode(namespace)) {\n targetNamespace = discoverNamespace(namespace.network);\n } else {\n targetNamespace = namespace.namespace;\n }\n\n const result = wallet.findByNamespace(targetNamespace);\n\n if (!result) {\n throw new Error(\n `We couldn't find any provider matched with your request namespace. (requested namespace: ${namespace.namespace})`\n );\n }\n\n targetNamespaces.push([namespace, result]);\n });\n\n // Try to run `connect` on matched namespaces\n const connectResultFromTargetNamespaces = targetNamespaces.map(\n async ([namespaceInput, namespace]) => {\n const network = tryConvertNamespaceNetworkToChainInfo(\n namespaceInput,\n params.allBlockChains || []\n );\n\n /*\n * `connect` can have different interfaces (e.g. Solana -> .connect(), EVM -> .connect(\"0x1\") ),\n * our assumption here is all the `connect` hasn't chain or if they have, they will accept it in first argument.\n * By this assumption, always passing a chain should be problematic since it will be ignored if the namespace's `connect` hasn't chain.\n */\n const result = namespace.connect(network);\n return result.then<ConnectResult>(transformHubResultToLegacyResult);\n }\n );\n const connectResultWithLegacyFormat = await Promise.all(\n connectResultFromTargetNamespaces\n );\n\n // If Provider has support for auto connect, we will add the wallet to storage.\n const legacyProvider = getLegacyProvider(\n params.allVersionedProviders,\n type\n );\n if (legacyProvider.canEagerConnect) {\n const namespaces = targetNamespaces.map(\n (targetNamespace) => targetNamespace[0].namespace\n );\n lastConnectedWalletsFromStorage.addWallet(type, namespaces);\n }\n\n return connectResultWithLegacyFormat;\n },\n async disconnect(type) {\n const wallet = getHub().get(type);\n if (!wallet) {\n throw new Error(\n `You should add ${type} to provider first then call 'connect'.`\n );\n }\n\n wallet.getAll().forEach((namespace) => {\n return namespace.disconnect();\n });\n\n if (params.autoConnect) {\n lastConnectedWalletsFromStorage.removeWallets([type]);\n }\n },\n disconnectAll() {\n throw new Error('`disconnectAll` not implemented');\n },\n async getSigners(type) {\n const provider = getLegacyProvider(params.allVersionedProviders, type);\n return provider.getSigners(provider.getInstance());\n },\n getWalletInfo(type) {\n const wallet = getHub().get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n\n const info = wallet.info();\n if (!info) {\n throw new Error('Your provider should have required `info`.');\n }\n\n const provider = getLegacyProvider(params.allVersionedProviders, type);\n\n const installLink: Exclude<WalletInfo['installLink'], string> = {\n DEFAULT: '',\n };\n\n // `extensions` in legacy format was uppercase and also `DEFAULT` was used instead of `homepage`\n Object.keys(info.extensions).forEach((k) => {\n const key = k as ExtensionLink;\n\n if (info.extensions[key] === 'homepage') {\n installLink.DEFAULT = info.extensions[key] || '';\n }\n\n const allowedKeys: ExtensionLink[] = [\n 'firefox',\n 'chrome',\n 'brave',\n 'edge',\n ];\n if (allowedKeys.includes(key)) {\n const upperCasedKey = key.toUpperCase() as keyof Exclude<\n WalletInfo['installLink'],\n string\n >;\n installLink[upperCasedKey] = info.extensions[key] || '';\n }\n });\n\n return {\n name: info.name,\n img: info.icon,\n installLink: installLink,\n // We don't have this values anymore, fill them with some values that communicate this.\n color: 'red',\n supportedChains: provider.getWalletInfo(params.allBlockChains || [])\n .supportedChains,\n isContractWallet: false,\n mobileWallet: false,\n // if set to false here, it will not show the wallet in mobile in anyways. to be compatible with old behavior, undefined is more appropirate.\n showOnMobile: undefined,\n\n isHub: true,\n properties: wallet.info()?.properties,\n };\n },\n providers() {\n const output: Providers = {};\n\n Array.from(getHub().getAll().keys()).forEach((id) => {\n try {\n const provider = getLegacyProvider(params.allVersionedProviders, id);\n output[id] = provider.getInstance();\n } catch (e) {\n console.warn(e);\n }\n });\n\n return output;\n },\n state(type) {\n const result = getHub().state();\n const provider = result[type];\n\n if (!provider) {\n throw new Error(\n `It seems your requested provider doesn't exist in hub. Provider Id: ${type}`\n );\n }\n\n const accounts = provider.namespaces\n .filter((namespace) => namespace.connected)\n .flatMap((namespace) =>\n namespace.accounts?.map(fromAccountIdToLegacyAddressFormat)\n )\n .filter((account): account is string => !!account);\n\n const coreState = {\n connected: provider.connected,\n connecting: provider.connecting,\n installed: provider.installed,\n reachable: true,\n accounts: accounts,\n network: null,\n };\n return coreState;\n },\n suggestAndConnect(_type, _network): never {\n throw new Error('`suggestAndConnect` is not implemented');\n },\n };\n\n return api;\n}\n", "import type { ProviderContext, ProviderProps } from './types.js';\nimport type {\n LegacyNamespaceInputForConnect,\n LegacyNamespaceInputWithDiscoverMode,\n LegacyProviderInterface,\n} from '@rango-dev/wallets-core/legacy';\nimport type { WalletType } from '@rango-dev/wallets-shared';\n\nimport { useEffect, useReducer } from 'react';\n\nimport { autoConnect } from './autoConnect.js';\nimport {\n availableWallets,\n checkWalletProviders,\n clearPersistance,\n connectedWallets,\n defaultWalletState,\n makeEventHandler,\n stateReducer,\n tryPersistWallet,\n tryRemoveWalletFromPersistance,\n} from './helpers.js';\nimport { useInitializers } from './hooks.js';\nimport { useAutoConnect } from './useAutoConnect.js';\n\nexport type LegacyProviderProps = Omit<ProviderProps, 'providers'> & {\n providers: LegacyProviderInterface[];\n};\n\nexport function useLegacyProviders(\n props: LegacyProviderProps\n): ProviderContext {\n const [providersState, dispatch] = useReducer(stateReducer, {});\n\n // Get (or add) wallet instance (`provider`s will be wrapped in a `Wallet`)\n const getWalletInstance = useInitializers(\n makeEventHandler(dispatch, props.onUpdateState)\n );\n\n // Getting providers from props and put all of them in a `Map` with an appropriate interface.\n const listOfProviders = props.providers;\n const wallets = checkWalletProviders(listOfProviders);\n\n useAutoConnect({\n allBlockChains: props.allBlockChains,\n autoConnect: props.autoConnect,\n autoConnectHandler: async () => autoConnect(wallets, getWalletInstance),\n });\n\n // Final API we put in context and it will be available to use for users.\n const api: ProviderContext = {\n async connect(type, namespaces) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n\n /**\n * Discover mode has a meaning in hub, so we are considering whenever a namespace with DISCOVER_MODE reaches here,\n * we can ignore it and don't pass it to provider.\n */\n const namespacesForConnect = namespaces?.filter(\n (\n ns\n ): ns is Exclude<\n LegacyNamespaceInputForConnect,\n LegacyNamespaceInputWithDiscoverMode\n > => {\n return ns.namespace !== 'DISCOVER_MODE';\n }\n );\n // Legacy providers doesn't implemented multiple namespaces, so it will always be one value.\n let network = undefined;\n if (namespaces && namespaces.length > 0) {\n /*\n * This may not be safe in cases there are two `network` for namespaces, the first one will be picked always.\n * But since legacy provider only accepts one value, it shouldn't be happened when we are using legacy mode.\n */\n network = namespaces.find((ns) => !!ns.network)?.network;\n }\n\n const walletInstance = getWalletInstance(wallet);\n const result = await walletInstance.connect(\n network,\n namespacesForConnect\n );\n if (props.autoConnect) {\n void tryPersistWallet({\n type,\n walletActions: wallet.actions,\n getState: api.state,\n });\n }\n\n return [result];\n },\n async disconnect(type) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n\n const walletInstance = getWalletInstance(wallet);\n await walletInstance.disconnect();\n if (props.autoConnect) {\n tryRemoveWalletFromPersistance({ type, walletActions: wallet.actions });\n }\n },\n async disconnectAll() {\n const disconnect_promises: Promise<any>[] = [];\n\n /*\n * When a wallet is initializing, a record will be added to `providersState`\n * So we use them to know what wallet has been initialized then we need to\n * filter connected wallets only.\n */\n connectedWallets(providersState).forEach((type) => {\n const wallet = wallets.get(type);\n\n if (wallet) {\n const walletInstance = getWalletInstance(wallet);\n disconnect_promises.push(walletInstance.disconnect());\n }\n });\n\n if (props.autoConnect) {\n clearPersistance();\n }\n return await Promise.allSettled(disconnect_promises);\n },\n\n async suggestAndConnect(type, network) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n const walletInstance = getWalletInstance(wallet);\n const result = await walletInstance.suggestAndConnect(network);\n\n return result;\n },\n\n state(type) {\n return providersState[type] || defaultWalletState;\n },\n canSwitchNetworkTo(type, network) {\n const wallet = wallets.get(type);\n if (!wallet) {\n return false;\n }\n\n const walletInstance = getWalletInstance(wallet);\n return walletInstance.canSwitchNetworkTo\n ? walletInstance.canSwitchNetworkTo(network, walletInstance.provider)\n : false;\n },\n providers() {\n const providers: { [type in WalletType]?: any } = {};\n availableWallets(providersState).forEach((type) => {\n const wallet = wallets.get(type);\n if (wallet) {\n const walletInstance = getWalletInstance(wallet);\n providers[type] = walletInstance.provider;\n }\n });\n\n return providers;\n },\n getWalletInfo(type) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n\n /*\n * Get wallet info could be used in render methods to show wallets data\n * So, addWalletRef method shouldn't be called in this method\n */\n\n return wallet.actions.getWalletInfo(props.allBlockChains || []);\n },\n async getSigners(type) {\n const wallet = wallets.get(type);\n\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n const walletInstance = getWalletInstance(wallet);\n const provider = walletInstance.provider;\n const result = walletInstance.getSigners(provider);\n\n return result;\n },\n };\n\n // Initialize instances\n useEffect(() => {\n wallets.forEach((wallet) => {\n const walletInstance = getWalletInstance(wallet);\n const runOnInit = () => {\n if (walletInstance.onInit) {\n walletInstance.onInit();\n }\n };\n\n const initWhenPageIsReady = (event: Event) => {\n if (\n event.target &&\n (event.target as Document).readyState === 'complete'\n ) {\n runOnInit();\n\n document.removeEventListener('readystatechange', initWhenPageIsReady);\n }\n };\n\n // Try to run, maybe it's ready.\n runOnInit();\n\n /*\n * Try again when the page has been completely loaded.\n * Some of wallets, take some time to be fully injected and loaded.\n */\n document.addEventListener('readystatechange', initWhenPageIsReady);\n });\n }, []);\n\n // Setting supported blockchains on instances\n useEffect(() => {\n const allBlockChains = props.allBlockChains;\n if (allBlockChains) {\n wallets.forEach((wallet) => {\n const walletInstance = getWalletInstance(wallet);\n const walletInfo = walletInstance.getWalletInfo(\n props.allBlockChains || []\n );\n walletInstance.setInfo({\n supportedBlockchains: walletInfo.supportedChains,\n isContractWallet: !!walletInfo.isContractWallet,\n });\n });\n }\n }, [props.allBlockChains]);\n\n // Setting event handler on instances\n useEffect(() => {\n wallets.forEach((wallet) => {\n const walletInstance = getWalletInstance(wallet);\n walletInstance.setHandler(\n makeEventHandler(dispatch, props.onUpdateState)\n );\n });\n }, [props.onUpdateState]);\n\n return api;\n}\n", "import type { WalletActions, WalletProviders } from './types.js';\nimport type { LegacyWallet as Wallet } from '@rango-dev/wallets-core/legacy';\nimport type { WalletConfig, WalletType } from '@rango-dev/wallets-shared';\n\nimport { LastConnectedWalletsFromStorage } from '../hub/lastConnectedWallets.js';\n\nimport { LEGACY_LAST_CONNECTED_WALLETS } from './mod.js';\n\n/*\n *If a wallet has multiple providers and one of them can be eagerly connected,\n *then the whole wallet will support it at that point and we try to connect to that wallet as usual in eagerConnect method.\n */\nexport async function autoConnect(\n wallets: WalletProviders,\n getWalletInstance: (wallet: {\n actions: WalletActions;\n config: WalletConfig;\n }) => Wallet<any>\n) {\n const lastConnectedWalletsFromStorage = new LastConnectedWalletsFromStorage(\n LEGACY_LAST_CONNECTED_WALLETS\n );\n\n const lastConnectedWallets = lastConnectedWalletsFromStorage.list();\n const walletIds = Object.keys(lastConnectedWallets);\n\n if (walletIds.length) {\n const eagerConnectQueue: {\n walletType: WalletType;\n eagerConnect: () => Promise<any>;\n }[] = [];\n\n walletIds.forEach((walletType) => {\n const wallet = wallets.get(walletType);\n\n if (!!wallet) {\n const walletInstance = getWalletInstance(wallet);\n eagerConnectQueue.push({\n walletType,\n eagerConnect: walletInstance.eagerConnect.bind(walletInstance),\n });\n }\n });\n\n const result = await Promise.allSettled(\n eagerConnectQueue.map(async ({ eagerConnect }) => eagerConnect())\n );\n\n const canRestoreAnyConnection = !!result.find(\n ({ status }) => status === 'fulfilled'\n );\n\n /*\n *After successfully connecting to at least one wallet,\n *we will removing the other wallets from persistence.\n *If we are unable to connect to any wallet,\n *the persistence will not be removed and the eager connection will be retried with another page load.\n */\n if (canRestoreAnyConnection) {\n const walletsToRemoveFromPersistance: WalletType[] = [];\n result.forEach((settleResult, index) => {\n const { status } = settleResult;\n\n if (status === 'rejected') {\n walletsToRemoveFromPersistance.push(\n eagerConnectQueue[index].walletType\n );\n }\n });\n\n if (walletsToRemoveFromPersistance.length) {\n lastConnectedWalletsFromStorage.removeWallets(\n walletsToRemoveFromPersistance\n );\n }\n }\n }\n}\n", "import type { ProviderContext, WalletActions, WalletConfig } from './types.js';\nimport type { LegacyEventHandler as WalletEventHandler } from '@rango-dev/wallets-core/legacy';\n\nimport { LegacyWallet as Wallet } from '@rango-dev/wallets-core/legacy';\nimport { useContext, useRef } from 'react';\n\nimport { WalletContext } from './context.js';\n\nexport type GetWalletInstance = (wallet: {\n actions: WalletActions;\n config: WalletConfig;\n}) => Wallet;\n\nexport function useInitializers(\n onChangeState: WalletEventHandler\n): GetWalletInstance {\n const availableWallets = useRef<{\n [key: string]: Wallet | undefined;\n }>({});\n\n /*\n * If `wallet` hasn't been added to `availableWallets`,\n * Get a instance of `Wallet` and save the refrence in `availableWallets`.\n * Otherwise, return the already created instance.\n */\n function updater(wallet: {\n actions: WalletActions;\n config: WalletConfig;\n }): Wallet {\n const type = wallet.config.type;\n // We only update, if there is no instance available.\n if (typeof availableWallets.current[type] === 'undefined') {\n availableWallets.current[type] = new Wallet(\n {\n config: wallet.config,\n handler: onChangeState,\n },\n wallet.actions\n );\n }\n\n return availableWallets.current[type]!;\n }\n\n return updater;\n}\n\nexport function useWallets(): ProviderContext {\n const context = useContext(WalletContext);\n if (!context) {\n throw Error('useWallet can only be used within the Provider component');\n }\n return context;\n}\n", "import type { ProviderProps } from './types.js';\n\nimport { useEffect, useRef } from 'react';\n\nimport { shouldTryAutoConnect } from './utils.js';\n\nexport function useAutoConnect(\n props: Pick<ProviderProps, 'allBlockChains' | 'autoConnect'> & {\n /**\n * A function to run autoConnect on instances\n */\n autoConnectHandler: () => void;\n }\n) {\n const autoConnectInitiated = useRef(false);\n\n useEffect(() => {\n if (shouldTryAutoConnect(props) && !autoConnectInitiated.current) {\n autoConnectInitiated.current = true;\n props.autoConnectHandler();\n }\n }, [props.autoConnect, props.allBlockChains]);\n}\n", "import type { ProviderProps } from './types.js';\n\nexport function shouldTryAutoConnect(\n props: Pick<ProviderProps, 'allBlockChains' | 'autoConnect'>\n): boolean {\n return !!props.allBlockChains?.length && !!props.autoConnect;\n}\n", "import type { AllProxiedNamespaces } from './types.js';\nimport type { UseAdapterParams } from './useHubAdapter.js';\nimport type { Hub } from '@rango-dev/wallets-core';\nimport type {\n LegacyNamespaceInputForConnect,\n LegacyProviderInterface,\n} from '@rango-dev/wallets-core/legacy';\nimport type { Namespace } from '@rango-dev/wallets-core/namespaces/common';\n\nimport {\n legacyEagerConnectHandler,\n legacyIsEvmNamespace,\n legacyIsNamespaceDiscoverMode,\n} from '@rango-dev/wallets-core/legacy';\n\nimport { HUB_LAST_CONNECTED_WALLETS } from '../legacy/mod.js';\n\nimport { sequentiallyRun } from './helpers.js';\nimport { LastConnectedWalletsFromStorage } from './lastConnectedWallets.js';\nimport {\n convertNamespaceNetworkToEvmChainId,\n discoverNamespace,\n} from './utils.js';\n\n/**\n * Run `.connect` action on some selected namespaces (passed as param) for a provider.\n */\nasync function eagerConnect(\n type: string,\n namespacesInput: LegacyNamespaceInputForConnect[] | undefined,\n params: {\n getHub: () => Hub;\n allBlockChains: UseAdapterParams['allBlockChains'];\n }\n) {\n const { getHub, allBlockChains } = params;\n const wallet = getHub().get(type);\n if (!wallet) {\n throw new Error(\n `You should add ${type} to provider first then call 'connect'.`\n );\n }\n\n if (!namespacesInput) {\n throw new Error(\n 'Passing namespace to `connect` is required. you can pass DISCOVERY_MODE for legacy.'\n );\n }\n\n const targetNamespaces: [\n LegacyNamespaceInputForConnect,\n AllProxiedNamespaces\n ][] = [];\n namespacesInput.forEach((namespaceInput) => {\n let targetNamespace: Namespace;\n if (legacyIsNamespaceDiscoverMode(namespaceInput)) {\n targetNamespace = discoverNamespace(namespaceInput.network);\n } else {\n targetNamespace = namespaceInput.namespace;\n }\n\n const result = wallet.findByNamespace(targetNamespace);\n\n if (!result) {\n throw new Error(\n `We couldn't find any provider matched with your request namespace. (requested namespace: ${namespaceInput.namespace})`\n );\n }\n\n targetNamespaces.push([namespaceInput, result]);\n });\n\n const finalResult = targetNamespaces.map(([info, namespace]) => {\n const evmChain = legacyIsEvmNamespace(info)\n ? convertNamespaceNetworkToEvmChainId(info, allBlockChains || [])\n : undefined;\n const chain = evmChain || info.network;\n\n return async () => await namespace.connect(chain);\n });\n\n /**\n * Sometimes calling methods on a instance in parallel, would cause an error in wallet.\n * We are running a method at a time to make sure we are covering this.\n * e.g. when we are trying to eagerConnect evm and solana on phantom at the same time, the last namespace throw an error.\n */\n return await sequentiallyRun(finalResult);\n}\n\n/*\n *\n * Get last connected wallets from storage then run `.connect` on them if `.canEagerConnect` returns true.\n *\n * Note 1:\n * - It currently use `.getInstance`, `.canEagerConenct` and `getWalletInfo()`.supported chains from legacy provider implementation.\n * - For each namespace, we don't have a separate `.canEagerConnect`. it's only one and will be used for all namespaces.\n */\nexport async function autoConnect(deps: {\n getHub: () => Hub;\n allBlockChains: UseAdapterParams['allBlockChains'];\n getLegacyProvider: (type: string) => LegacyProviderInterface;\n}): Promise<void> {\n const { getHub, allBlockChains, getLegacyProvider } = deps;\n\n // Getting connected wallets from storage\n const lastConnectedWalletsFromStorage = new LastConnectedWalletsFromStorage(\n HUB_LAST_CONNECTED_WALLETS\n );\n const lastConnectedWallets = lastConnectedWalletsFromStorage.list();\n const walletIds = Object.keys(lastConnectedWallets);\n\n const walletsToRemoveFromPersistance: string[] = [];\n\n if (walletIds.length) {\n const eagerConnectQueue: any[] = [];\n\n // Run `.connect` if `.canEagerConnect` returns `true`.\n walletIds.forEach((providerName) => {\n const legacyProvider = getLegacyProvider(providerName);\n\n let legacyInstance: any;\n try {\n legacyInstance = legacyProvider.getInstance();\n } catch (e) {\n console.warn(\n \"It seems instance isn't available yet. This can happens when extension not loaded yet (sometimes when opening browser for first time) or extension is disabled.\"\n );\n return;\n }\n\n const namespaces: LegacyNamespaceInputForConnect[] = lastConnectedWallets[\n providerName\n ].map((namespace) => ({\n namespace: namespace as Namespace,\n network: undefined,\n }));\n\n const canEagerConnect = async () => {\n if (!legacyProvider.canEagerConnect) {\n throw new Error(\n `${providerName} provider hasn't implemented canEagerConnect.`\n );\n }\n return await legacyProvider.canEagerConnect({\n instance: legacyInstance,\n meta: legacyProvider.getWalletInfo(allBlockChains || [])\n .supportedChains,\n });\n };\n const connectHandler = async () => {\n return eagerConnect(providerName, namespaces, {\n allBlockChains,\n getHub,\n });\n };\n\n eagerConnectQueue.push(\n legacyEagerConnectHandler({\n canEagerConnect,\n connectHandler,\n providerName,\n }).catch((e) => {\n walletsToRemoveFromPersistance.push(providerName);\n throw e;\n })\n );\n });\n\n await Promise.allSettled(eagerConnectQueue);\n\n /*\n *After successfully connecting to at least one wallet,\n *we will removing the other wallets from persistence.\n *If we are unable to connect to any wallet,\n *the persistence will not be removed and the eager connection will be retried with another page load.\n */\n const canRestoreAnyConnection =\n walletIds.length > walletsToRemoveFromPersistance.length;\n\n if (canRestoreAnyConnection) {\n lastConnectedWalletsFromStorage.removeWallets(\n walletsToRemoveFromPersistance\n );\n }\n }\n}\n", "import type { Provider, Store } from '@rango-dev/wallets-core';\n\nimport { createStore, Hub } from '@rango-dev/wallets-core';\nimport { useRef } from 'react';\n\nexport function useHubRefs(providers: Provider[]) {\n const store = useRef<Store | null>(null);\n\n const hub = useRef<Hub | null>(null);\n\n // https://react.dev/reference/react/useRef#avoiding-recreating-the-ref-contents\n function getStore() {\n if (store.current !== null) {\n return store.current;\n }\n const createdStore = createStore();\n store.current = createdStore;\n return createdStore;\n }\n\n function getHub(): Hub {\n if (hub.current !== null) {\n return hub.current;\n }\n const createdHub = new Hub({\n store: getStore(),\n });\n /*\n * First add providers to hub\n * This helps to `getWalletInfo` be usable, before initialize.\n */\n providers.forEach((provider) => {\n createdHub.add(provider.id, provider);\n });\n\n hub.current = createdHub;\n return createdHub;\n }\n\n return { getStore, getHub };\n}\n", "import type {\n ExtendedWalletInfo,\n ProviderContext,\n ProviderProps,\n Providers,\n} from './index.js';\nimport type { ConnectResult } from './legacy/mod.js';\nimport type { LegacyState } from '@rango-dev/wallets-core/legacy';\nimport type { SignerFactory } from 'rango-types';\n\nimport {\n findProviderByType,\n separateLegacyAndHubProviders,\n useHubAdapter,\n} from './hub/mod.js';\nimport { useLegacyProviders } from './legacy/mod.js';\n\n/*\n * We have two separate interface for our providers: legacy and hub.\n * This hook sits between this two interface by keeping old interface as main API and try to add Hub providers by using an adapter.\n * For gradual migrating and backward compatibility, we are supporting hub by an adapter besides of the old one.\n */\nfunction useProviders(props: ProviderProps) {\n const { providers, ...restProps } = props;\n const [legacyProviders, hubProviders] = separateLegacyAndHubProviders(\n providers,\n {\n isExperimentalEnabled: restProps.configs?.isExperimentalEnabled,\n }\n );\n\n const legacyApi = useLegacyProviders({\n ...restProps,\n providers: legacyProviders,\n });\n const hubApi = useHubAdapter({\n ...restProps,\n providers: hubProviders,\n allVersionedProviders: providers,\n });\n\n const api: ProviderContext = {\n canSwitchNetworkTo(type, network): boolean {\n if (findProviderByType(hubProviders, type)) {\n return hubApi.canSwitchNetworkTo(type, network);\n }\n return legacyApi.canSwitchNetworkTo(type, network);\n },\n async connect(type, network): Promise<ConnectResult[]> {\n const hubProvider = findProviderByType(hubProviders, type);\n if (hubProvider) {\n return await hubApi.connect(type, network);\n }\n\n return await legacyApi.connect(type, network);\n },\n async disconnect(type): Promise<void> {\n const hubProvider = findProviderByType(hubProviders, type);\n if (hubProvider) {\n return await hubApi.disconnect(type);\n }\n\n return await legacyApi.disconnect(type);\n },\n async disconnectAll() {\n return await Promise.allSettled([\n hubApi.disconnectAll(),\n legacyApi.disconnectAll(),\n ]);\n },\n async getSigners(type): Promise<SignerFactory> {\n const hubProvider = findProviderByType(hubProviders, type);\n if (hubProvider) {\n return hubApi.getSigners(type);\n }\n return legacyApi.getSigners(type);\n },\n getWalletInfo(type): ExtendedWalletInfo {\n const hubProvider = findProviderByType(hubProviders, type);\n if (hubProvider) {\n return hubApi.getWalletInfo(type);\n }\n\n return legacyApi.getWalletInfo(type);\n },\n providers(): Providers {\n let output: Providers = {};\n if (hubProviders.length > 0) {\n output = { ...output, ...hubApi.providers() };\n }\n if (legacyProviders.length > 0) {\n output = { ...output, ...legacyApi.providers() };\n }\n\n return output;\n },\n state(type): LegacyState {\n const hubProvider = findProviderByType(hubProviders, type);\n\n if (hubProvider) {\n return hubApi.state(type);\n }\n\n return legacyApi.state(type);\n },\n async suggestAndConnect(type, network): Promise<ConnectResult> {\n const hubProvider = findProviderByType(hubProviders, type);\n\n if (hubProvider) {\n return hubApi.suggestAndConnect(type, network);\n }\n\n return await legacyApi.suggestAndConnect(type, network);\n },\n };\n\n return api;\n}\n\nexport { useProviders };\n", "import type { ProviderInfo, VersionedProviders } from '@rango-dev/wallets-core';\nimport type {\n LegacyNamespaceInputForConnect,\n LegacyNetwork as Network,\n LegacyEventHandler as WalletEventHandler,\n LegacyWalletInfo as WalletInfo,\n LegacyState as WalletState,\n LegacyWalletType as WalletType,\n} from '@rango-dev/wallets-core/legacy';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\nimport type { PropsWithChildren } from 'react';\n\nexport type State = {\n [key: string]: WalletState | undefined;\n};\n\nexport type ConnectResult = {\n accounts: string[] | null;\n network: Network | null;\n provider: any;\n};\n\nexport type Providers = { [type in WalletType]?: any };\n\nexport type ExtendedWalletInfo = WalletInfo & {\n properties?: ProviderInfo['properties'];\n isHub?: boolean;\n};\n\nexport type ProviderContext = {\n connect(\n type: WalletType,\n namespaces?: LegacyNamespaceInputForConnect[]\n ): Promise<ConnectResult[]>;\n disconnect(type: WalletType): Promise<void>;\n disconnectAll(): Promise<PromiseSettledResult<any>[]>;\n state(type: WalletType): WalletState;\n canSwitchNetworkTo(type: WalletType, network: Network): boolean;\n /**\n * `Provider` in legacy terms means injected instances by wallets into window (e.g. window.ethereum)\n * that can be retrieved by `getInstance`.\n *\n * Note 1: Providers are lazy evaluated, which means you need to call `connect` (or `state`) first, then the value will be shown in object.\n * before doing that, it's a key (wallet name or we call it `type` to be more specific) with null value. (e.g. {metamask: null})\n */\n providers(): Providers;\n getSigners(type: WalletType): Promise<SignerFactory>;\n getWalletInfo(type: WalletType): ExtendedWalletInfo;\n suggestAndConnect(type: WalletType, network: Network): Promise<ConnectResult>;\n};\n\nexport type ProviderProps = PropsWithChildren<{\n onUpdateState?: WalletEventHandler;\n allBlockChains?: BlockchainMeta[];\n autoConnect?: boolean;\n providers: VersionedProviders[];\n configs?: {\n isExperimentalEnabled?: boolean;\n };\n}>;\n\nexport enum Events {\n CONNECTED = 'connected',\n CONNECTING = 'connecting',\n REACHABLE = 'reachable',\n INSTALLED = 'installed',\n ACCOUNTS = 'accounts',\n NETWORK = 'network',\n}\n\nexport type ProviderConnectResult = {\n accounts: string[];\n chainId: string;\n};\n\nexport type GetInstanceOptions = {\n network?: Network;\n currentProvider: any;\n meta: BlockchainMeta[];\n getState: () => WalletState;\n /**\n * We always get the instance once and reuse it whenever we needs. By using this option\n * We can force the library to get a new instance and replace it with the old one.\n *\n * Originally, we used this option for wallet connect 1 and its switching network challenge.\n */\n force?: boolean;\n updateChainId: (chainId: number | string) => void;\n};\n\nexport type GetInstance =\n | (() => any)\n | ((options: GetInstanceOptions) => Promise<any>);\nexport type TryGetInstance =\n | (() => any)\n | ((options: Pick<GetInstanceOptions, 'force' | 'network'>) => Promise<any>);\nexport type Connect = (options: {\n instance: any;\n network?: Network;\n meta: BlockchainMeta[];\n}) => Promise<ProviderConnectResult | ProviderConnectResult[]>;\n\nexport type Disconnect = (options: {\n instance: any;\n destroyInstance: () => void;\n}) => Promise<void>;\n\ntype CleanupSubscribe = () => void;\n\nexport type Subscribe = (options: {\n instance: any;\n state: WalletState;\n meta: BlockchainMeta[];\n updateChainId: (chainId: string) => void;\n updateAccounts: (accounts: string[], chainId?: string) => void;\n connect: (network?: Network) => void;\n disconnect: () => void;\n}) => CleanupSubscribe | void;\n\nexport type SwitchNetwork = (options: {\n instance: any;\n network: Network;\n meta: BlockchainMeta[];\n newInstance?: TryGetInstance;\n getState?: () => WalletState;\n updateChainId: (chainId: string) => void;\n}) => Promise<void>;\n\nexport type Suggest = (options: {\n instance: any;\n network: Network;\n meta: BlockchainMeta[];\n}) => Promise<void>;\n\nexport type CanSwitchNetwork = (options: {\n network: Network;\n meta: BlockchainMeta[];\n provider: any;\n}) => boolean;\n\nexport type CanEagerConnect = (options: {\n instance: any;\n meta: BlockchainMeta[];\n}) => Promise<boolean>;\n\nexport interface WalletActions {\n connect: Connect;\n getInstance: any;\n disconnect?: Disconnect;\n subscribe?: Subscribe;\n // unsubscribe, // coupled to subscribe.\n\n // Optional, but should be provided at the same time.\n suggest?: Suggest;\n switchNetwork?: SwitchNetwork;\n getSigners: (provider: any) => Promise<SignerFactory>;\n canSwitchNetworkTo?: CanSwitchNetwork;\n canEagerConnect?: CanEagerConnect;\n getWalletInfo(allBlockChains: BlockchainMeta[]): WalletInfo;\n}\n\nexport interface WalletConfig {\n type: WalletType;\n defaultNetwork?: Network;\n checkInstallation?: boolean;\n isAsyncInstance?: boolean;\n isAsyncSwitchNetwork?: boolean;\n}\n\nexport type WalletProviders = Map<\n WalletType,\n {\n actions: WalletActions;\n config: WalletConfig;\n }\n>;\n\nexport type ProviderInterface = { config: WalletConfig } & WalletActions;\n"],
5
- "mappings": "iFAaA,OAAS,aAAAA,OAAiB,iCCbnB,IAAMC,EAAgC,yBAChCC,EAA6B,gCCD1C,OAAS,aAAAC,MAAiB,iCAiBnB,IAAMC,EAAN,KAAsC,CAjB7C,MAiB6C,CAAAC,EAAA,wCAC3CC,GAEA,YAAYC,EAAoB,CAC9B,KAAKD,GAAcC,CACrB,CAEA,UAAUC,EAAoBC,EAA4B,CACxD,GAAI,KAAKH,KAAgBI,EACvB,OAAO,KAAKC,GAAgBH,EAAYC,CAAU,EAC7C,GAAI,KAAKH,KAAgBM,EAC9B,OAAO,KAAKC,GAAmBL,CAAU,EAE3C,MAAM,IAAI,MAAM,iBAAiB,CACnC,CACA,cAAcM,EAA8B,CAC1C,GAAI,KAAKR,KAAgBI,EACvB,OAAO,KAAKK,GAAsBD,CAAW,EACxC,GAAI,KAAKR,KAAgBM,EAC9B,OAAO,KAAKI,GAAyBF,CAAW,EAElD,MAAM,IAAI,MAA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,EAA0B,CAEtC,OADoBE,EAAmBR,EAAcM,CAAI,EAEhDF,EAAO,cAAcE,CAAI,EAG3BJ,EAAU,cAAcI,CAAI,CACrC,EACA,WAAuB,CACrB,IAAIG,EAAoB,CAAC,EACzB,OAAIT,EAAa,OAAS,IACxBS,EAAS,CAAE,GAAGA,EAAQ,GAAGL,EAAO,UAAU,CAAE,GAE1CL,EAAgB,OAAS,IAC3BU,EAAS,CAAE,GAAGA,EAAQ,GAAGP,EAAU,UAAU,CAAE,GAG1CO,CACT,EACA,MAAMH,EAAmB,CAGvB,OAFoBE,EAAmBR,EAAcM,CAAI,EAGhDF,EAAO,MAAME,CAAI,EAGnBJ,EAAU,MAAMI,CAAI,CAC7B,EACA,MAAM,kBAAkBA,EAAMC,EAAiC,CAG7D,OAFoBC,EAAmBR,EAAcM,CAAI,EAGhDF,EAAO,kBAAkBE,EAAMC,CAAO,EAGxC,MAAML,EAAU,kBAAkBI,EAAMC,CAAO,CACxD,CACF,CAGF,CA/FSG,EAAAf,GAAA,gBZfT,SAASgB,GAASC,EAAsB,CACtC,IAAMC,EAAMC,GAAaF,CAAK,EAE9B,OACEG,GAAA,cAACC,EAAc,SAAd,CAAuB,MAAOH,GAC5BD,EAAM,QACT,CAEJ,CARSK,EAAAN,GAAA,YAUT,IAAOO,GAAQP,Ga4CR,IAAKQ,QACVA,EAAA,UAAY,YACZA,EAAA,WAAa,aACbA,EAAA,UAAY,YACZA,EAAA,UAAY,YACZA,EAAA,SAAW,WACXA,EAAA,QAAU,UANAA,QAAA",
6
- "names": ["Persistor", "LEGACY_LAST_CONNECTED_WALLETS", "HUB_LAST_CONNECTED_WALLETS", "Persistor", "LastConnectedWalletsFromStorage", "__name", "#storageKey", "storageKey", "providerId", "namespaces", "HUB_LAST_CONNECTED_WALLETS", "#addWalletToHub", "LEGACY_LAST_CONNECTED_WALLETS", "#addWalletToLegacy", "providerIds", "#removeWalletsFromHub", "#removeWalletsFromLegacy", "#listFromHub", "#listFromLegacy", "lastConnectedWallets", "Persistor", "output", "provider", "storage", "data", "persistor", "storageState", "wallet", "choose", "wallets", "type", "wallet", "__name", "defaultWalletState", "stateReducer", "state", "action", "target_wallet", "connectedWallets", "providersState", "wallet_state", "availableWallets", "checkWalletProviders", "list", "provider", "config", "actions", "isAsync", "fn", "needsCheckInstallation", "options", "checkInstallation", "tryPersistWallet", "walletActions", "getState", "lastConnectedWalletsFromStorage", "LastConnectedWalletsFromStorage", "LEGACY_LAST_CONNECTED_WALLETS", "walletAlreadyPersisted", "clearPersistance", "tryRemoveWalletFromPersistance", "persistor", "Persistor", "makeEventHandler", "dispatcher", "onUpdateState", "name", "value", "coreState", "supportedChains", "React", "createContext", "defaultErrorMesssage", "defaultContext", "WalletContext", "guessProviderStateSelector", "namespaceStateSelector", "Events", "generateStoreId", "pickVersion", "convertEvmBlockchainMetaToEvmChainInfo", "Networks", "isEvmBlockchain", "formatAddressWithNetwork", "CAIP", "mapCaipNamespaceToLegacyNetworkName", "chainId", "__name", "fromAccountIdToLegacyAddressFormat", "account", "address", "CAIP", "network", "formatAddressWithNetwork", "sequentiallyRun", "promises", "prev", "task", "previousResults", "taskResult", "isConnectResultEvm", "result", "isConnectResultSolana", "separateLegacyAndHubProviders", "providers", "options", "LEGACY_VERSION", "HUB_VERSION", "isExperimentalEnabled", "legacyProviders", "hubProviders", "provider", "target", "pickVersion", "__name", "findProviderByType", "type", "checkHubStateAndTriggerEvents", "hub", "currentState", "previousState", "onUpdateState", "allProviders", "allBlockChains", "providerId", "currentProviderState", "guessProviderStateSelector", "previousProviderState", "accounts", "hasAccountChanged", "hasNetworkChanged", "hasProviderDisconnected", "maybeNetwork", "namespace", "storeId", "generateStoreId", "currentNamespaceState", "namespaceStateSelector", "previousNamespaceState", "formattedAddresses", "fromAccountIdToLegacyAddressFormat", "legacyProvider", "getLegacyProvider", "e", "coreState", "eventInfo", "Events", "discoverNamespace", "network", "Networks", "legacy", "convertNamespaceNetworkToEvmChainId", "meta", "evmBlockchainsList", "isEvmBlockchain", "convertEvmBlockchainMetaToEvmChainInfo", "tryConvertNamespaceNetworkToChainInfo", "transformHubResultToLegacyResult", "res", "isConnectResultEvm", "isConnectResultSolana", "legacyIsNamespaceDiscoverMode", "useEffect", "useRef", "useState", "useEffect", "useReducer", "autoConnect", "wallets", "getWalletInstance", "lastConnectedWalletsFromStorage", "LastConnectedWalletsFromStorage", "LEGACY_LAST_CONNECTED_WALLETS", "lastConnectedWallets", "walletIds", "eagerConnectQueue", "walletType", "wallet", "walletInstance", "result", "eagerConnect", "status", "walletsToRemoveFromPersistance", "settleResult", "index", "__name", "Wallet", "useContext", "useRef", "useInitializers", "onChangeState", "availableWallets", "useRef", "updater", "wallet", "type", "Wallet", "__name", "useWallets", "context", "useContext", "WalletContext", "useEffect", "useRef", "shouldTryAutoConnect", "props", "__name", "useAutoConnect", "props", "autoConnectInitiated", "useRef", "useEffect", "shouldTryAutoConnect", "__name", "useLegacyProviders", "props", "providersState", "dispatch", "useReducer", "stateReducer", "getWalletInstance", "useInitializers", "makeEventHandler", "listOfProviders", "wallets", "checkWalletProviders", "useAutoConnect", "autoConnect", "api", "type", "namespaces", "wallet", "namespacesForConnect", "ns", "network", "result", "tryPersistWallet", "tryRemoveWalletFromPersistance", "disconnect_promises", "connectedWallets", "walletInstance", "clearPersistance", "defaultWalletState", "providers", "availableWallets", "provider", "useEffect", "runOnInit", "__name", "initWhenPageIsReady", "event", "walletInfo", "legacyEagerConnectHandler", "legacyIsEvmNamespace", "legacyIsNamespaceDiscoverMode", "eagerConnect", "type", "namespacesInput", "params", "getHub", "allBlockChains", "wallet", "targetNamespaces", "namespaceInput", "targetNamespace", "legacyIsNamespaceDiscoverMode", "discoverNamespace", "result", "finalResult", "info", "namespace", "chain", "legacyIsEvmNamespace", "convertNamespaceNetworkToEvmChainId", "sequentiallyRun", "__name", "autoConnect", "deps", "getLegacyProvider", "lastConnectedWalletsFromStorage", "LastConnectedWalletsFromStorage", "HUB_LAST_CONNECTED_WALLETS", "lastConnectedWallets", "walletIds", "walletsToRemoveFromPersistance", "eagerConnectQueue", "providerName", "legacyProvider", "legacyInstance", "namespaces", "canEagerConnect", "connectHandler", "legacyEagerConnectHandler", "e", "createStore", "Hub", "useRef", "useHubRefs", "providers", "store", "useRef", "hub", "getStore", "createdStore", "createStore", "__name", "getHub", "createdHub", "Hub", "provider", "useHubAdapter", "params", "getStore", "getHub", "useHubRefs", "rerender", "useState", "dataRef", "useRef", "useEffect", "runOnInit", "__name", "currentRender", "initHubWhenPageIsReady", "event", "curr", "prev", "checkHubStateAndTriggerEvents", "useAutoConnect", "autoConnect", "getLegacyProvider", "lastConnectedWalletsFromStorage", "LastConnectedWalletsFromStorage", "HUB_LAST_CONNECTED_WALLETS", "type", "network", "provider", "switchTo", "namespaces", "wallet", "targetNamespaces", "namespace", "targetNamespace", "legacyIsNamespaceDiscoverMode", "discoverNamespace", "result", "connectResultFromTargetNamespaces", "namespaceInput", "tryConvertNamespaceNetworkToChainInfo", "transformHubResultToLegacyResult", "connectResultWithLegacyFormat", "info", "installLink", "k", "key", "upperCasedKey", "output", "id", "e", "accounts", "fromAccountIdToLegacyAddressFormat", "account", "_type", "_network", "useProviders", "props", "providers", "restProps", "legacyProviders", "hubProviders", "separateLegacyAndHubProviders", "legacyApi", "useLegacyProviders", "hubApi", "useHubAdapter", "type", "network", "findProviderByType", "output", "__name", "Provider", "props", "api", "useProviders", "React", "WalletContext", "__name", "provider_default", "Events"]
3
+ "sources": ["../src/legacy/helpers.ts", "../src/legacy/constants.ts", "../src/provider.tsx", "../src/legacy/context.ts", "../src/legacy/useLegacyProviders.ts", "../src/legacy/hooks.ts", "../src/legacy/useAutoConnect.ts", "../src/legacy/types.ts"],
4
+ "sourcesContent": ["import type {\n ProviderInterface,\n State,\n WalletActions,\n WalletProviders,\n} from './types.js';\nimport type {\n LegacyOptions as Options,\n LegacyWallet as Wallet,\n LegacyEventHandler as WalletEventHandler,\n LegacyState as WalletState,\n} from '@rango-dev/wallets-core/legacy';\nimport type { WalletConfig, WalletType } from '@rango-dev/wallets-shared';\n\nimport { Persistor } from '@rango-dev/wallets-core/legacy';\n\nimport { LAST_CONNECTED_WALLETS } from './constants.js';\n\nexport function choose(wallets: any[], type: WalletType): any | null {\n return wallets.find((wallet) => wallet.type === type) || null;\n}\n\nexport const defaultWalletState: WalletState = {\n connected: false,\n connecting: false,\n reachable: false,\n installed: false,\n accounts: null,\n network: null,\n};\n\nexport function stateReducer(state: State, action: any) {\n if (action.type === 'new_state') {\n // TODO fix problem and remove ts-ignore\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const target_wallet = state[action.wallet];\n if (!target_wallet) {\n return {\n ...state,\n [action.wallet]: {\n ...defaultWalletState,\n [action.name]: action.value,\n },\n };\n }\n\n return {\n ...state,\n [action.wallet]: {\n ...target_wallet,\n [action.name]: action.value,\n },\n };\n }\n\n return state;\n}\n\nexport function connectedWallets(providersState: State): WalletType[] {\n return Object.entries(providersState)\n .filter(([, wallet_state]) => {\n return wallet_state?.connected;\n })\n .map(([type]) => {\n return type;\n });\n}\n\nexport function availableWallets(providersState: State): WalletType[] {\n return Object.entries(providersState).map(([type]) => {\n return type;\n });\n}\n\nexport function checkWalletProviders(\n list: ProviderInterface[]\n): WalletProviders {\n const wallets: WalletProviders = new Map();\n\n list.forEach((provider) => {\n const { config, ...actions } = provider;\n wallets.set(config.type, {\n actions,\n config,\n });\n });\n\n return wallets;\n}\n\n/* eslint-disable @typescript-eslint/ban-types */\nexport function isAsync(fn: Function) {\n return fn?.constructor?.name === 'AsyncFunction';\n}\n\nexport function needsCheckInstallation(options: Options) {\n const { checkInstallation = true } = options.config;\n return checkInstallation;\n}\n\nexport async function tryPersistWallet({\n type,\n walletActions,\n getState,\n}: {\n type: WalletType;\n walletActions: WalletActions;\n getState: (walletType: WalletType) => WalletState;\n}) {\n if (walletActions.canEagerConnect) {\n const persistor = new Persistor<string[]>();\n const wallets = persistor.getItem(LAST_CONNECTED_WALLETS);\n\n /*\n *If on the last attempt we are unable to eagerly connect to any wallet and the user connects any wallet manualy,\n *persistance will be outdated and will need to be removed.\n */\n const shouldClearPersistance = wallets?.find(\n (walletType) => !getState(walletType).connected\n );\n\n if (shouldClearPersistance) {\n clearPersistance();\n }\n\n const walletAlreadyPersisted = !!wallets?.find((wallet) => wallet === type);\n if (wallets && !walletAlreadyPersisted) {\n persistor.setItem(LAST_CONNECTED_WALLETS, wallets.concat(type));\n } else {\n persistor.setItem(LAST_CONNECTED_WALLETS, [type]);\n }\n }\n}\n\nexport function tryRemoveWalletFromPersistance({\n type,\n walletActions,\n}: {\n type: WalletType;\n walletActions: WalletActions;\n}) {\n if (walletActions.canEagerConnect) {\n const persistor = new Persistor<string[]>();\n const wallets = persistor.getItem(LAST_CONNECTED_WALLETS);\n if (wallets) {\n persistor.setItem(\n LAST_CONNECTED_WALLETS,\n wallets.filter((wallet) => wallet !== type)\n );\n }\n }\n}\n\nexport function clearPersistance() {\n const persistor = new Persistor<string[]>();\n const wallets = persistor.getItem(LAST_CONNECTED_WALLETS);\n if (wallets) {\n persistor.removeItem(LAST_CONNECTED_WALLETS);\n }\n}\n\n/*\n *If a wallet has multiple providers and one of them can be eagerly connected,\n *then the whole wallet will support it at that point and we try to connect to that wallet as usual in eagerConnect method.\n */\nexport async function autoConnect(\n wallets: WalletProviders,\n getWalletInstance: (wallet: {\n actions: WalletActions;\n config: WalletConfig;\n }) => Wallet<any>\n) {\n const persistor = new Persistor<string[]>();\n const lastConnectedWallets = persistor.getItem(LAST_CONNECTED_WALLETS);\n if (lastConnectedWallets && lastConnectedWallets.length) {\n const connect_promises: {\n walletType: WalletType;\n eagerConnect: () => Promise<any>;\n }[] = [];\n lastConnectedWallets.forEach((walletType) => {\n const wallet = wallets.get(walletType);\n\n if (!!wallet) {\n const walletInstance = getWalletInstance(wallet);\n connect_promises.push({\n walletType,\n eagerConnect: walletInstance.eagerConnect.bind(walletInstance),\n });\n }\n });\n\n const result = await Promise.allSettled(\n connect_promises.map(async ({ eagerConnect }) => eagerConnect())\n );\n\n const canRestoreAnyConnection = !!result.find(\n ({ status }) => status === 'fulfilled'\n );\n\n /*\n *After successfully connecting to at least one wallet,\n *we will removing the other wallets from persistence.\n *If we are unable to connect to any wallet,\n *the persistence will not be removed and the eager connection will be retried with another page load.\n */\n if (canRestoreAnyConnection) {\n const walletsToRemoveFromPersistance: WalletType[] = [];\n result.forEach((settleResult, index) => {\n const { status } = settleResult;\n\n if (status === 'rejected') {\n walletsToRemoveFromPersistance.push(\n connect_promises[index].walletType\n );\n }\n });\n\n if (walletsToRemoveFromPersistance.length) {\n persistor.setItem(\n LAST_CONNECTED_WALLETS,\n lastConnectedWallets.filter(\n (walletType) => !walletsToRemoveFromPersistance.includes(walletType)\n )\n );\n }\n }\n }\n}\n/*\n *Our event handler includes an internal state updater, and a notifier\n *for the outside listener.\n *On creating first wallet refrence, and on chaning `props.onUpdateState`\n *we are using this function.\n */\nexport function makeEventHandler(\n dispatcher: any,\n onUpdateState?: WalletEventHandler\n) {\n const handler: WalletEventHandler = (\n type,\n name,\n value,\n coreState,\n supportedChains\n ) => {\n const action = { type: 'new_state', wallet: type, name, value };\n // Update state\n dispatcher(action);\n\n // Giving the event to the outside listener\n if (onUpdateState) {\n onUpdateState(type, name, value, coreState, supportedChains);\n }\n };\n\n return handler;\n}\n", "export const LAST_CONNECTED_WALLETS = 'last-connected-wallets';\n", "import type { ProviderProps } from './legacy/types.js';\n\nimport React from 'react';\n\nimport { WalletContext } from './legacy/context.js';\nimport { useLegacyProviders } from './legacy/useLegacyProviders.js';\n\nfunction Provider(props: ProviderProps) {\n const legacyApi = useLegacyProviders(props);\n\n return (\n <WalletContext.Provider value={legacyApi}>\n {props.children}\n </WalletContext.Provider>\n );\n}\n\nexport default Provider;\n", "import type { ProviderContext } from './types.js';\n\nimport { createContext } from 'react';\n\nconst defaultErrorMesssage = \"Context hasn't been initialized yet.\";\nconst defaultContext: ProviderContext = {\n async connect() {\n throw new Error(defaultErrorMesssage);\n },\n async disconnect() {\n throw new Error(defaultErrorMesssage);\n },\n async disconnectAll() {\n throw new Error(defaultErrorMesssage);\n },\n async suggestAndConnect() {\n throw new Error(defaultErrorMesssage);\n },\n state() {\n throw new Error(defaultErrorMesssage);\n },\n canSwitchNetworkTo() {\n throw new Error(defaultErrorMesssage);\n },\n providers() {\n throw new Error(defaultErrorMesssage);\n },\n getWalletInfo() {\n throw new Error(defaultErrorMesssage);\n },\n getSigners() {\n throw new Error(defaultErrorMesssage);\n },\n};\n\nexport const WalletContext = createContext<ProviderContext>(defaultContext);\n", "import type { ProviderContext, ProviderProps } from './types.js';\nimport type { WalletType } from '@rango-dev/wallets-shared';\n\nimport { useEffect, useReducer } from 'react';\n\nimport {\n availableWallets,\n checkWalletProviders,\n clearPersistance,\n connectedWallets,\n defaultWalletState,\n makeEventHandler,\n stateReducer,\n tryPersistWallet,\n tryRemoveWalletFromPersistance,\n} from './helpers.js';\nimport { useInitializers } from './hooks.js';\nimport { useAutoConnect } from './useAutoConnect.js';\n\nexport function useLegacyProviders(props: ProviderProps): ProviderContext {\n const [providersState, dispatch] = useReducer(stateReducer, {});\n\n // Get (or add) wallet instance (`provider`s will be wrapped in a `Wallet`)\n const getWalletInstance = useInitializers(\n makeEventHandler(dispatch, props.onUpdateState)\n );\n\n // Getting providers from props and put all of them in a `Map` with an appropriate interface.\n const listOfProviders = props.providers;\n const wallets = checkWalletProviders(listOfProviders);\n\n useAutoConnect({\n wallets,\n allBlockChains: props.allBlockChains,\n autoConnect: props.autoConnect,\n getWalletInstanceFromLegacy: getWalletInstance,\n });\n\n // Final API we put in context and it will be available to use for users.\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const api: ProviderContext = {\n async connect(type, network, namespaces) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n const walletInstance = getWalletInstance(wallet);\n const result = await walletInstance.connect(network, namespaces);\n if (props.autoConnect) {\n void tryPersistWallet({\n type,\n walletActions: wallet.actions,\n getState: api.state,\n });\n }\n\n return result;\n },\n async disconnect(type) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n\n const walletInstance = getWalletInstance(wallet);\n await walletInstance.disconnect();\n if (props.autoConnect) {\n tryRemoveWalletFromPersistance({ type, walletActions: wallet.actions });\n }\n },\n async disconnectAll() {\n const disconnect_promises: Promise<any>[] = [];\n\n /*\n * When a wallet is initializing, a record will be added to `providersState`\n * So we use them to know what wallet has been initialized then we need to\n * filter connected wallets only.\n */\n connectedWallets(providersState).forEach((type) => {\n const wallet = wallets.get(type);\n\n if (wallet) {\n const walletInstance = getWalletInstance(wallet);\n disconnect_promises.push(walletInstance.disconnect());\n }\n });\n\n if (props.autoConnect) {\n clearPersistance();\n }\n return await Promise.allSettled(disconnect_promises);\n },\n\n async suggestAndConnect(type, network) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n const walletInstance = getWalletInstance(wallet);\n const result = await walletInstance.suggestAndConnect(network);\n\n return result;\n },\n\n state(type) {\n return providersState[type] || defaultWalletState;\n },\n canSwitchNetworkTo(type, network) {\n const wallet = wallets.get(type);\n if (!wallet) {\n return false;\n }\n\n const walletInstance = getWalletInstance(wallet);\n return walletInstance.canSwitchNetworkTo\n ? walletInstance.canSwitchNetworkTo(network, walletInstance.provider)\n : false;\n },\n providers() {\n const providers: { [type in WalletType]?: any } = {};\n availableWallets(providersState).forEach((type) => {\n const wallet = wallets.get(type);\n if (wallet) {\n const walletInstance = getWalletInstance(wallet);\n providers[type] = walletInstance.provider;\n }\n });\n\n return providers;\n },\n getWalletInfo(type) {\n const wallet = wallets.get(type);\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n\n /*\n * Get wallet info could be used in render methods to show wallets data\n * So, addWalletRef method shouldn't be called in this method\n */\n\n return wallet.actions.getWalletInfo(props.allBlockChains || []);\n },\n async getSigners(type) {\n const wallet = wallets.get(type);\n\n if (!wallet) {\n throw new Error(`You should add ${type} to provider first.`);\n }\n const walletInstance = getWalletInstance(wallet);\n const provider = walletInstance.provider;\n const result = walletInstance.getSigners(provider);\n\n return result;\n },\n };\n\n // Initialize instances\n useEffect(() => {\n wallets.forEach((wallet) => {\n const walletInstance = getWalletInstance(wallet);\n const runOnInit = () => {\n if (walletInstance.onInit) {\n walletInstance.onInit();\n }\n };\n\n const initWhenPageIsReady = (event: Event) => {\n if (\n event.target &&\n (event.target as Document).readyState === 'complete'\n ) {\n runOnInit();\n\n document.removeEventListener('readystatechange', initWhenPageIsReady);\n }\n };\n\n // Try to run, maybe it's ready.\n runOnInit();\n\n /*\n * Try again when the page has been completely loaded.\n * Some of wallets, take some time to be fully injected and loaded.\n */\n document.addEventListener('readystatechange', initWhenPageIsReady);\n });\n }, []);\n\n // Setting supported blockchains on instances\n useEffect(() => {\n const allBlockChains = props.allBlockChains;\n if (allBlockChains) {\n wallets.forEach((wallet) => {\n const walletInstance = getWalletInstance(wallet);\n const walletInfo = walletInstance.getWalletInfo(\n props.allBlockChains || []\n );\n walletInstance.setInfo({\n supportedBlockchains: walletInfo.supportedChains,\n isContractWallet: !!walletInfo.isContractWallet,\n });\n });\n }\n }, [props.allBlockChains]);\n\n // Setting event handler on instances\n useEffect(() => {\n wallets.forEach((wallet) => {\n const walletInstance = getWalletInstance(wallet);\n walletInstance.setHandler(\n makeEventHandler(dispatch, props.onUpdateState)\n );\n });\n }, [props.onUpdateState]);\n\n return api;\n}\n", "import type { ProviderContext, WalletActions, WalletConfig } from './types.js';\nimport type { LegacyEventHandler as WalletEventHandler } from '@rango-dev/wallets-core/legacy';\n\nimport { LegacyWallet as Wallet } from '@rango-dev/wallets-core/legacy';\nimport { useContext, useRef } from 'react';\n\nimport { WalletContext } from './context.js';\n\nexport type GetWalletInstance = (wallet: {\n actions: WalletActions;\n config: WalletConfig;\n}) => Wallet;\n\nexport function useInitializers(\n onChangeState: WalletEventHandler\n): GetWalletInstance {\n const availableWallets = useRef<{\n [key: string]: Wallet | undefined;\n }>({});\n\n /*\n * If `wallet` hasn't been added to `availableWallets`,\n * Get a instance of `Wallet` and save the refrence in `availableWallets`.\n * Otherwise, return the already created instance.\n */\n function updater(wallet: {\n actions: WalletActions;\n config: WalletConfig;\n }): Wallet {\n const type = wallet.config.type;\n // We only update, if there is no instance available.\n if (typeof availableWallets.current[type] === 'undefined') {\n availableWallets.current[type] = new Wallet(\n {\n config: wallet.config,\n handler: onChangeState,\n },\n wallet.actions\n );\n }\n\n return availableWallets.current[type]!;\n }\n\n return updater;\n}\n\nexport function useWallets(): ProviderContext {\n const context = useContext(WalletContext);\n if (!context) {\n throw Error('useWallet can only be used within the Provider component');\n }\n return context;\n}\n", "import type { GetWalletInstance } from './hooks.js';\nimport type { ProviderProps, WalletProviders } from './types.js';\n\nimport { useEffect, useRef } from 'react';\n\nimport { autoConnect } from './helpers.js';\n\nexport function useAutoConnect(\n props: Pick<ProviderProps, 'allBlockChains' | 'autoConnect'> & {\n wallets: WalletProviders;\n getWalletInstanceFromLegacy: GetWalletInstance;\n }\n) {\n const autoConnectInitiated = useRef(false);\n\n // Running auto connect on instances\n useEffect(() => {\n const shouldTryAutoConnect =\n props.allBlockChains &&\n props.allBlockChains.length &&\n props.autoConnect &&\n !autoConnectInitiated.current;\n\n if (shouldTryAutoConnect) {\n autoConnectInitiated.current = true;\n void (async () => {\n await autoConnect(props.wallets, props.getWalletInstanceFromLegacy);\n })();\n }\n }, [props.autoConnect, props.allBlockChains]);\n}\n", "import type {\n LegacyNamespaceData as NamespaceData,\n LegacyNetwork as Network,\n LegacyEventHandler as WalletEventHandler,\n LegacyWalletInfo as WalletInfo,\n LegacyState as WalletState,\n LegacyWalletType as WalletType,\n} from '@rango-dev/wallets-core/legacy';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\nimport type { PropsWithChildren } from 'react';\n\nexport type State = {\n [key: string]: WalletState | undefined;\n};\n\nexport type ConnectResult = {\n accounts: string[] | null;\n network: Network | null;\n provider: any;\n};\n\nexport type Providers = { [type in WalletType]?: any };\n\nexport type ProviderContext = {\n connect(\n type: WalletType,\n network?: Network,\n namespaces?: NamespaceData[]\n ): Promise<ConnectResult>;\n disconnect(type: WalletType): Promise<void>;\n disconnectAll(): Promise<PromiseSettledResult<any>[]>;\n state(type: WalletType): WalletState;\n canSwitchNetworkTo(type: WalletType, network: Network): boolean;\n /**\n * `Provider` in legacy terms means injected instances by wallets into window (e.g. window.ethereum)\n * that can be retrieved by `getInstance`.\n *\n * Note 1: Providers are lazy evaluated, which means you need to call `connect` (or `state`) first, then the value will be shown in object.\n * before doing that, it's a key (wallet name or we call it `type` to be more specific) with null value. (e.g. {metamask: null})\n */\n providers(): Providers;\n getSigners(type: WalletType): Promise<SignerFactory>;\n getWalletInfo(type: WalletType): WalletInfo;\n suggestAndConnect(type: WalletType, network: Network): Promise<ConnectResult>;\n};\n\nexport type ProviderProps = PropsWithChildren<{\n onUpdateState?: WalletEventHandler;\n allBlockChains?: BlockchainMeta[];\n autoConnect?: boolean;\n providers: ProviderInterface[];\n}>;\n\nexport enum Events {\n CONNECTED = 'connected',\n CONNECTING = 'connecting',\n REACHABLE = 'reachable',\n INSTALLED = 'installed',\n ACCOUNTS = 'accounts',\n NETWORK = 'network',\n}\n\nexport type ProviderConnectResult = {\n accounts: string[];\n chainId: string;\n};\n\nexport type GetInstanceOptions = {\n network?: Network;\n currentProvider: any;\n meta: BlockchainMeta[];\n getState: () => WalletState;\n /**\n * We always get the instance once and reuse it whenever we needs. By using this option\n * We can force the library to get a new instance and replace it with the old one.\n *\n * Originally, we used this option for wallet connect 1 and its switching network challenge.\n */\n force?: boolean;\n updateChainId: (chainId: number | string) => void;\n};\n\nexport type GetInstance =\n | (() => any)\n | ((options: GetInstanceOptions) => Promise<any>);\nexport type TryGetInstance =\n | (() => any)\n | ((options: Pick<GetInstanceOptions, 'force' | 'network'>) => Promise<any>);\nexport type Connect = (options: {\n instance: any;\n network?: Network;\n meta: BlockchainMeta[];\n}) => Promise<ProviderConnectResult | ProviderConnectResult[]>;\n\nexport type Disconnect = (options: {\n instance: any;\n destroyInstance: () => void;\n}) => Promise<void>;\n\ntype CleanupSubscribe = () => void;\n\nexport type Subscribe = (options: {\n instance: any;\n state: WalletState;\n meta: BlockchainMeta[];\n updateChainId: (chainId: string) => void;\n updateAccounts: (accounts: string[], chainId?: string) => void;\n connect: (network?: Network) => void;\n disconnect: () => void;\n}) => CleanupSubscribe | void;\n\nexport type SwitchNetwork = (options: {\n instance: any;\n network: Network;\n meta: BlockchainMeta[];\n newInstance?: TryGetInstance;\n getState?: () => WalletState;\n updateChainId: (chainId: string) => void;\n}) => Promise<void>;\n\nexport type Suggest = (options: {\n instance: any;\n network: Network;\n meta: BlockchainMeta[];\n}) => Promise<void>;\n\nexport type CanSwitchNetwork = (options: {\n network: Network;\n meta: BlockchainMeta[];\n provider: any;\n}) => boolean;\n\nexport type CanEagerConnect = (options: {\n instance: any;\n meta: BlockchainMeta[];\n}) => Promise<boolean>;\n\nexport interface WalletActions {\n connect: Connect;\n getInstance: any;\n disconnect?: Disconnect;\n subscribe?: Subscribe;\n // unsubscribe, // coupled to subscribe.\n\n // Optional, but should be provided at the same time.\n suggest?: Suggest;\n switchNetwork?: SwitchNetwork;\n getSigners: (provider: any) => Promise<SignerFactory>;\n canSwitchNetworkTo?: CanSwitchNetwork;\n canEagerConnect?: CanEagerConnect;\n getWalletInfo(allBlockChains: BlockchainMeta[]): WalletInfo;\n}\n\nexport interface WalletConfig {\n type: WalletType;\n defaultNetwork?: Network;\n checkInstallation?: boolean;\n isAsyncInstance?: boolean;\n isAsyncSwitchNetwork?: boolean;\n}\n\nexport type WalletProviders = Map<\n WalletType,\n {\n actions: WalletActions;\n config: WalletConfig;\n }\n>;\n\nexport type ProviderInterface = { config: WalletConfig } & WalletActions;\n"],
5
+ "mappings": "+EAcA,OAAS,aAAAA,MAAiB,iCCdnB,IAAMC,EAAyB,yBDkB/B,SAASC,EAAOC,EAAgB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AM,EACzCa,EAAYC,EAAA,IAAM,CAClBR,EAAe,QACjBA,EAAe,OAAO,CAE1B,EAJkB,aAMZS,EAAsBD,EAACE,GAAiB,CAE1CA,EAAM,QACLA,EAAM,OAAoB,aAAe,aAE1CH,EAAU,EAEV,SAAS,oBAAoB,mBAAoBE,CAAmB,EAExE,EAT4B,uBAY5BF,EAAU,EAMV,SAAS,iBAAiB,mBAAoBE,CAAmB,CACnE,CAAC,CACH,EAAG,CAAC,CAAC,EAGLH,EAAU,IAAM,CACS5B,EAAM,gBAE3BS,EAAQ,QAASO,GAAW,CAC1B,IAAMM,EAAiBjB,EAAkBW,CAAM,EACzCiB,EAAaX,EAAe,cAChCtB,EAAM,gBAAkB,CAAC,CAC3B,EACAsB,EAAe,QAAQ,CACrB,qBAAsBW,EAAW,gBACjC,iBAAkB,CAAC,CAACA,EAAW,gBACjC,CAAC,CACH,CAAC,CAEL,EAAG,CAACjC,EAAM,cAAc,CAAC,EAGzB4B,EAAU,IAAM,CACdnB,EAAQ,QAASO,GAAW,CACHX,EAAkBW,CAAM,EAChC,WACbT,EAAiBL,EAAUF,EAAM,aAAa,CAChD,CACF,CAAC,CACH,EAAG,CAACA,EAAM,aAAa,CAAC,EAEjBY,CACT,CAtMgBkB,EAAA/B,EAAA,sBFZhB,SAASmC,EAASC,EAAsB,CACtC,IAAMC,EAAYC,EAAmBF,CAAK,EAE1C,OACEG,EAAA,cAACC,EAAc,SAAd,CAAuB,MAAOH,GAC5BD,EAAM,QACT,CAEJ,CARSK,EAAAN,EAAA,YAUT,IAAOO,EAAQP,EKoCR,IAAKQ,OACVA,EAAA,UAAY,YACZA,EAAA,WAAa,aACbA,EAAA,UAAY,YACZA,EAAA,UAAY,YACZA,EAAA,SAAW,WACXA,EAAA,QAAU,UANAA,OAAA",
6
+ "names": ["Persistor", "LAST_CONNECTED_WALLETS", "choose", "wallets", "type", "wallet", "__name", "defaultWalletState", "stateReducer", "state", "action", "target_wallet", "connectedWallets", "providersState", "wallet_state", "availableWallets", "checkWalletProviders", "list", "provider", "config", "actions", "isAsync", "fn", "needsCheckInstallation", "options", "checkInstallation", "tryPersistWallet", "walletActions", "getState", "persistor", "Persistor", "LAST_CONNECTED_WALLETS", "walletType", "clearPersistance", "walletAlreadyPersisted", "tryRemoveWalletFromPersistance", "autoConnect", "getWalletInstance", "lastConnectedWallets", "connect_promises", "walletInstance", "result", "eagerConnect", "status", "walletsToRemoveFromPersistance", "settleResult", "index", "makeEventHandler", "dispatcher", "onUpdateState", "name", "value", "coreState", "supportedChains", "React", "createContext", "defaultErrorMesssage", "defaultContext", "WalletContext", "useEffect", "useReducer", "Wallet", "useContext", "useRef", "useInitializers", "onChangeState", "availableWallets", "useRef", "updater", "wallet", "type", "Wallet", "__name", "useWallets", "context", "useContext", "WalletContext", "useEffect", "useRef", "useAutoConnect", "props", "autoConnectInitiated", "useRef", "useEffect", "autoConnect", "__name", "useLegacyProviders", "props", "providersState", "dispatch", "useReducer", "stateReducer", "getWalletInstance", "useInitializers", "makeEventHandler", "listOfProviders", "wallets", "checkWalletProviders", "useAutoConnect", "api", "type", "network", "namespaces", "wallet", "result", "tryPersistWallet", "tryRemoveWalletFromPersistance", "disconnect_promises", "connectedWallets", "walletInstance", "clearPersistance", "defaultWalletState", "providers", "availableWallets", "provider", "useEffect", "runOnInit", "__name", "initWhenPageIsReady", "event", "walletInfo", "Provider", "props", "legacyApi", "useLegacyProviders", "React", "WalletContext", "__name", "provider_default", "Events"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ export declare const LAST_CONNECTED_WALLETS = "last-connected-wallets";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/legacy/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,2BAA2B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { ProviderInterface, State, WalletActions, WalletProviders } from './types.js';
2
- import type { LegacyOptions as Options, LegacyEventHandler as WalletEventHandler, LegacyState as WalletState } from '@rango-dev/wallets-core/legacy';
3
- import type { WalletType } from '@rango-dev/wallets-shared';
2
+ import type { LegacyOptions as Options, LegacyWallet as Wallet, LegacyEventHandler as WalletEventHandler, LegacyState as WalletState } from '@rango-dev/wallets-core/legacy';
3
+ import type { WalletConfig, WalletType } from '@rango-dev/wallets-shared';
4
4
  export declare function choose(wallets: any[], type: WalletType): any | null;
5
5
  export declare const defaultWalletState: WalletState;
6
6
  export declare function stateReducer(state: State, action: any): State;
@@ -19,5 +19,9 @@ export declare function tryRemoveWalletFromPersistance({ type, walletActions, }:
19
19
  walletActions: WalletActions;
20
20
  }): void;
21
21
  export declare function clearPersistance(): void;
22
+ export declare function autoConnect(wallets: WalletProviders, getWalletInstance: (wallet: {
23
+ actions: WalletActions;
24
+ config: WalletConfig;
25
+ }) => Wallet<any>): Promise<void>;
22
26
  export declare function makeEventHandler(dispatcher: any, onUpdateState?: WalletEventHandler): WalletEventHandler;
23
27
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/legacy/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,KAAK,EACL,aAAa,EACb,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,aAAa,IAAI,OAAO,EACxB,kBAAkB,IAAI,kBAAkB,EACxC,WAAW,IAAI,WAAW,EAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAO5D,wBAAgB,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,GAAG,GAAG,IAAI,CAEnE;AAED,eAAO,MAAM,kBAAkB,EAAE,WAOhC,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SA0BrD;AA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LegacyNetwork as Network, LegacyEventHandler as WalletEventHandler, LegacyWalletInfo as WalletInfo, LegacyState as WalletState, LegacyWalletType as WalletType } from '@rango-dev/wallets-core/legacy';
1
+ import type { LegacyNamespaceData as NamespaceData, LegacyNetwork as Network, LegacyEventHandler as WalletEventHandler, LegacyWalletInfo as WalletInfo, LegacyState as WalletState, LegacyWalletType as WalletType } from '@rango-dev/wallets-core/legacy';
3
2
  import type { BlockchainMeta, SignerFactory } from 'rango-types';
4
3
  import type { PropsWithChildren } from 'react';
5
4
  export type State = {
@@ -13,12 +12,8 @@ export type ConnectResult = {
13
12
  export type Providers = {
14
13
  [type in WalletType]?: any;
15
14
  };
16
- export type ExtendedWalletInfo = WalletInfo & {
17
- properties?: ProviderInfo['properties'];
18
- isHub?: boolean;
19
- };
20
15
  export type ProviderContext = {
21
- connect(type: WalletType, namespaces?: LegacyNamespaceInputForConnect[]): Promise<ConnectResult[]>;
16
+ connect(type: WalletType, network?: Network, namespaces?: NamespaceData[]): Promise<ConnectResult>;
22
17
  disconnect(type: WalletType): Promise<void>;
23
18
  disconnectAll(): Promise<PromiseSettledResult<any>[]>;
24
19
  state(type: WalletType): WalletState;
@@ -32,17 +27,14 @@ export type ProviderContext = {
32
27
  */
33
28
  providers(): Providers;
34
29
  getSigners(type: WalletType): Promise<SignerFactory>;
35
- getWalletInfo(type: WalletType): ExtendedWalletInfo;
30
+ getWalletInfo(type: WalletType): WalletInfo;
36
31
  suggestAndConnect(type: WalletType, network: Network): Promise<ConnectResult>;
37
32
  };
38
33
  export type ProviderProps = PropsWithChildren<{
39
34
  onUpdateState?: WalletEventHandler;
40
35
  allBlockChains?: BlockchainMeta[];
41
36
  autoConnect?: boolean;
42
- providers: VersionedProviders[];
43
- configs?: {
44
- isExperimentalEnabled?: boolean;
45
- };
37
+ providers: ProviderInterface[];
46
38
  }>;
47
39
  export declare enum Events {
48
40
  CONNECTED = "connected",
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","s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CAAC;IAItB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACtD,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IACtC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,aAAa,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC;CAC7D;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,MAAM,eAAe,GAAG,GAAG,CAC/B,UAAU,EACV;IACE,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;CACtB,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG,aAAa,CAAC"}
@@ -1,8 +1,7 @@
1
- import type { ProviderProps } from './types.js';
1
+ import type { GetWalletInstance } from './hooks.js';
2
+ import type { ProviderProps, WalletProviders } from './types.js';
2
3
  export declare function useAutoConnect(props: Pick<ProviderProps, 'allBlockChains' | 'autoConnect'> & {
3
- /**
4
- * A function to run autoConnect on instances
5
- */
6
- autoConnectHandler: () => void;
4
+ wallets: WalletProviders;
5
+ getWalletInstanceFromLegacy: GetWalletInstance;
7
6
  }): void;
8
7
  //# sourceMappingURL=useAutoConnect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoConnect.d.ts","sourceRoot":"","sources":["../../src/legacy/useAutoConnect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAMhD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,aAAa,CAAC,GAAG;IAC7D;;OAEG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC,QAUF"}
1
+ {"version":3,"file":"useAutoConnect.d.ts","sourceRoot":"","sources":["../../src/legacy/useAutoConnect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMjE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,aAAa,CAAC,GAAG;IAC7D,OAAO,EAAE,eAAe,CAAC;IACzB,2BAA2B,EAAE,iBAAiB,CAAC;CAChD,QAmBF"}
@@ -1,7 +1,3 @@
1
1
  import type { ProviderContext, ProviderProps } from './types.js';
2
- import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
3
- export type LegacyProviderProps = Omit<ProviderProps, 'providers'> & {
4
- providers: LegacyProviderInterface[];
5
- };
6
- export declare function useLegacyProviders(props: LegacyProviderProps): ProviderContext;
2
+ export declare function useLegacyProviders(props: ProviderProps): ProviderContext;
7
3
  //# sourceMappingURL=useLegacyProviders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLegacyProviders.d.ts","sourceRoot":"","sources":["../../src/legacy/useLegacyProviders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAGV,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AAoBxC,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GAAG;IACnE,SAAS,EAAE,uBAAuB,EAAE,CAAC;CACtC,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,mBAAmB,GACzB,eAAe,CAgOjB"}
1
+ {"version":3,"file":"useLegacyProviders.d.ts","sourceRoot":"","sources":["../../src/legacy/useLegacyProviders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAmBjE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAsMxE"}
@@ -1 +1 @@
1
- {"inputs":{"src/hub/constants.ts":{"bytes":146,"imports":[],"format":"esm"},"src/hub/lastConnectedWallets.ts":{"bytes":3866,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/helpers.ts":{"bytes":4652,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/context.ts":{"bytes":905,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/hub/helpers.ts":{"bytes":2205,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/utils.ts":{"bytes":11349,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/autoConnect.ts":{"bytes":2509,"imports":[{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"../hub/lastConnectedWallets.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/hooks.ts":{"bytes":1545,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/utils.ts":{"bytes":230,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useAutoConnect.ts":{"bytes":628,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useLegacyProviders.ts":{"bytes":7895,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./hooks.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"./useAutoConnect.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/mod.ts":{"bytes":321,"imports":[{"path":"src/hub/constants.ts","kind":"import-statement","original":"../hub/constants.js"},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"src/legacy/useLegacyProviders.ts","kind":"import-statement","original":"./useLegacyProviders.js"}],"format":"esm"},"src/hub/autoConnect.ts":{"bytes":6028,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubRefs.ts":{"bytes":1031,"imports":[{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/useHubAdapter.ts":{"bytes":10766,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"../legacy/mod.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"../legacy/useAutoConnect.js"},{"path":"src/hub/autoConnect.ts","kind":"import-statement","original":"./autoConnect.js"},{"path":"src/hub/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/hub/lastConnectedWallets.ts","kind":"import-statement","original":"./lastConnectedWallets.js"},{"path":"src/hub/useHubRefs.ts","kind":"import-statement","original":"./useHubRefs.js"},{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/hub/mod.ts":{"bytes":132,"imports":[{"path":"src/hub/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/hub/useHubAdapter.ts","kind":"import-statement","original":"./useHubAdapter.js"}],"format":"esm"},"src/useProviders.ts":{"bytes":3513,"imports":[{"path":"src/hub/mod.ts","kind":"import-statement","original":"./hub/mod.js"},{"path":"src/legacy/mod.ts","kind":"import-statement","original":"./legacy/mod.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/provider.tsx":{"bytes":405,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./legacy/context.js"},{"path":"src/useProviders.ts","kind":"import-statement","original":"./useProviders.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/types.ts":{"bytes":5101,"imports":[],"format":"esm"},"src/index.ts":{"bytes":173,"imports":[{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./legacy/helpers.js"},{"path":"src/provider.tsx","kind":"import-statement","original":"./provider.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./legacy/hooks.js"},{"path":"src/legacy/types.ts","kind":"import-statement","original":"./legacy/types.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93721},"dist/index.js":{"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/utils","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["Events","Provider","availableWallets","checkWalletProviders","choose","clearPersistance","connectedWallets","defaultWalletState","isAsync","makeEventHandler","needsCheckInstallation","stateReducer","tryPersistWallet","tryRemoveWalletFromPersistance","useWallets"],"entryPoint":"src/index.ts","inputs":{"src/legacy/helpers.ts":{"bytesInOutput":1401},"src/hub/constants.ts":{"bytesInOutput":65},"src/hub/lastConnectedWallets.ts":{"bytesInOutput":998},"src/index.ts":{"bytesInOutput":0},"src/provider.tsx":{"bytesInOutput":133},"src/legacy/context.ts":{"bytesInOutput":431},"src/hub/utils.ts":{"bytesInOutput":3693},"src/hub/helpers.ts":{"bytesInOutput":771},"src/hub/mod.ts":{"bytesInOutput":0},"src/hub/useHubAdapter.ts":{"bytesInOutput":3575},"src/legacy/mod.ts":{"bytesInOutput":0},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":2173},"src/legacy/autoConnect.ts":{"bytesInOutput":444},"src/legacy/hooks.ts":{"bytesInOutput":460},"src/legacy/useAutoConnect.ts":{"bytesInOutput":197},"src/legacy/utils.ts":{"bytesInOutput":94},"src/hub/autoConnect.ts":{"bytesInOutput":1673},"src/hub/useHubRefs.ts":{"bytesInOutput":425},"src/useProviders.ts":{"bytesInOutput":942},"src/legacy/types.ts":{"bytesInOutput":164}},"bytes":18078}}}
1
+ {"inputs":{"src/legacy/constants.ts":{"bytes":64,"imports":[],"format":"esm"},"src/legacy/helpers.ts":{"bytes":6923,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"src/legacy/constants.ts","kind":"import-statement","original":"./constants.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/context.ts":{"bytes":905,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/hooks.ts":{"bytes":1545,"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./context.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useAutoConnect.ts":{"bytes":916,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/useLegacyProviders.ts":{"bytes":6608,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./helpers.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./hooks.js"},{"path":"src/legacy/useAutoConnect.ts","kind":"import-statement","original":"./useAutoConnect.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/provider.tsx":{"bytes":442,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/legacy/context.ts","kind":"import-statement","original":"./legacy/context.js"},{"path":"src/legacy/useLegacyProviders.ts","kind":"import-statement","original":"./legacy/useLegacyProviders.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/legacy/types.ts":{"bytes":4851,"imports":[],"format":"esm"},"src/index.ts":{"bytes":173,"imports":[{"path":"src/legacy/helpers.ts","kind":"import-statement","original":"./legacy/helpers.js"},{"path":"src/provider.tsx","kind":"import-statement","original":"./provider.js"},{"path":"src/legacy/hooks.ts","kind":"import-statement","original":"./legacy/hooks.js"},{"path":"src/legacy/types.ts","kind":"import-statement","original":"./legacy/types.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":32801},"dist/index.js":{"imports":[{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@rango-dev/wallets-core/legacy","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["Events","Provider","autoConnect","availableWallets","checkWalletProviders","choose","clearPersistance","connectedWallets","defaultWalletState","isAsync","makeEventHandler","needsCheckInstallation","stateReducer","tryPersistWallet","tryRemoveWalletFromPersistance","useWallets"],"entryPoint":"src/index.ts","inputs":{"src/legacy/helpers.ts":{"bytesInOutput":1940},"src/legacy/constants.ts":{"bytesInOutput":31},"src/index.ts":{"bytesInOutput":0},"src/provider.tsx":{"bytesInOutput":126},"src/legacy/context.ts":{"bytesInOutput":427},"src/legacy/useLegacyProviders.ts":{"bytesInOutput":2071},"src/legacy/hooks.ts":{"bytesInOutput":450},"src/legacy/useAutoConnect.ts":{"bytesInOutput":283},"src/legacy/types.ts":{"bytesInOutput":162}},"bytes":5938}}}