@tuwaio/satellite-core 1.0.0-fix-test-alpha.45.9abac57 → 1.0.0-fix-test-alpha.46.00f5d3d
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.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var orbitCore=require('@tuwaio/orbit-core'),immer=require('immer'),vanilla=require('zustand/vanilla');function I({adapter:o,callbackAfterConnected:f}){return vanilla.createStore()((
|
|
1
|
+
'use strict';var orbitCore=require('@tuwaio/orbit-core'),immer=require('immer'),vanilla=require('zustand/vanilla');function I({adapter:o,callbackAfterConnected:f}){return vanilla.createStore()((r,n)=>({getAdapter:e=>orbitCore.selectAdapterByKey({adapter:o,adapterKey:e}),getConnectors:()=>{let e;return Array.isArray(o)?e=o.map(t=>t.getConnectors()):e=[o.getConnectors()],e.reduce((t,a)=>{let l=a.adapter,i=a.connectors;return {...t,[l]:i}},{})},initializeAutoConnect:async e=>{if(e){let t=orbitCore.lastConnectedWalletHelpers.getLastConnectedWallet();t&&!["impersonatedwallet","walletconnect","coinbasewallet"].includes(t.walletType.split(":")[1])&&(await orbitCore.delay(null,200),await n().connect({walletType:t.walletType,chainId:t.chainId}));}else if(orbitCore.isSafeApp){await orbitCore.delay(null,200);let t=n().getAdapter(orbitCore.OrbitAdapter.EVM);if(t&&t.getSafeConnectorChainId){let a=await t.getSafeConnectorChainId();a&&await n().connect({walletType:`${orbitCore.OrbitAdapter.EVM}:safewallet`,chainId:a});}}},walletConnecting:false,walletConnectionError:void 0,switchNetworkError:void 0,activeWallet:void 0,connect:async({walletType:e,chainId:t})=>{r({walletConnecting:true,walletConnectionError:void 0});let a=n().getAdapter(orbitCore.getAdapterFromWalletType(e));if(!a){r({walletConnecting:false,walletConnectionError:`No adapter found for wallet type: ${e}`});return}try{n().activeWallet?.isConnected&&await n().disconnectAll();let l=await a.connect({walletType:e,chainId:t});if(r({activeWallet:l}),a.checkIsContractWallet){let i=await a.checkIsContractWallet({address:l.address,chainId:t});n().updateActiveWallet({isContractAddress:i});}if(f){let i=n().activeWallet;i&&await f(i);}r({walletConnecting:!1}),orbitCore.lastConnectedWalletHelpers.setLastConnectedWallet({walletType:e,chainId:t,address:n().activeWallet?.address}),orbitCore.recentConnectedWalletHelpers.setRecentConnectedWallet({[orbitCore.getAdapterFromWalletType(e)]:{[e.split(":")[1]]:!0}});}catch(l){await n().disconnectAll(),orbitCore.lastConnectedWalletHelpers.removeLastConnectedWallet(),r({walletConnecting:false,walletConnectionError:"Wallet connection failed: "+(l instanceof Error?l.message:String(l))});}},disconnect:async()=>{let e=n().activeWallet;e&&(r({activeWallet:void 0,walletConnectionError:void 0,switchNetworkError:void 0}),orbitCore.lastConnectedWalletHelpers.removeLastConnectedWallet(),orbitCore.impersonatedHelpers.removeImpersonated(),await n().getAdapter(orbitCore.getAdapterFromWalletType(e.walletType))?.disconnect(e));},disconnectAll:async()=>{if(await orbitCore.delay(null,150),r({activeWallet:void 0,walletConnectionError:void 0,switchNetworkError:void 0}),orbitCore.impersonatedHelpers.removeImpersonated(),Array.isArray(o))await Promise.allSettled(o.map(async e=>{try{await e.disconnect();}catch{}}));else try{await o.disconnect();}catch{}},resetWalletConnectionError:()=>{r({walletConnectionError:void 0});},updateActiveWallet:e=>{let t=n().activeWallet;t?(e.chainId&&orbitCore.lastConnectedWalletHelpers.setLastConnectedWallet({walletType:e.walletType??t.walletType,chainId:e.chainId??t.chainId,address:e.address??t.address}),r(a=>immer.produce(a,l=>{l.activeWallet&&(l.activeWallet={...l.activeWallet,...e});}))):e.walletType!==void 0&&e.chainId!==void 0&&e.address!==void 0?(orbitCore.lastConnectedWalletHelpers.setLastConnectedWallet({walletType:e.walletType,chainId:e.chainId,address:e.address}),r({activeWallet:e})):console.warn("Attempted to set activeWallet with incomplete data while activeWallet was undefined.");},switchNetwork:async e=>{r({switchNetworkError:void 0});let t=n().activeWallet;if(t){let a=n().getAdapter(orbitCore.getAdapterFromWalletType(t.walletType));if(!a){r({switchNetworkError:`No adapter found for active wallet type: ${t.walletType}`});return}try{await a.checkAndSwitchNetwork(e,t.chainId,n().updateActiveWallet);}catch(l){r({switchNetworkError:"Switch network failed: "+(l instanceof Error?l.message:String(l))});}}},resetSwitchNetworkError:()=>r({switchNetworkError:void 0})}))}exports.createSatelliteConnectStore=I;//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/store/satelliteConnectStore.ts"],"names":["createSatelliteConnectStore","adapter","callbackAfterConnected","createStore","set","get","adapterKey","selectAdapterByKey","results","a","accumulator","currentResult","key","value","autoConnect","lastConnectedWallet","lastConnectedWalletHelpers","delay","isSafeApp","foundAdapter","OrbitAdapter","safeConnectorChainId","walletType","chainId","getAdapterFromWalletType","wallet","isContractAddress","updatedWallet","recentConnectedWalletHelpers","e","activeWallet","impersonatedHelpers","state","produce","draft"],"mappings":"mHAyBO,SAASA,CAAAA,CAAkE,CAChF,OAAA,CAAAC,CAAAA,CACA,uBAAAC,CACF,CAAA,CAAiD,CAC/C,OAAOC,qBAA0C,CAAE,CAACC,CAAAA,CAAKC,CAAAA,IAAS,CAIhE,UAAA,CAAaC,CAAAA,EAAeC,4BAAAA,CAAmB,CAAE,QAAAN,CAAAA,CAAS,UAAA,CAAAK,CAAW,CAAC,EAKtE,aAAA,CAAe,IAAM,CACnB,IAAIE,EAEJ,OAAI,KAAA,CAAM,OAAA,CAAQP,CAAO,EACvBO,CAAAA,CAAUP,CAAAA,CAAQ,GAAA,CAAKQ,CAAAA,EAAMA,EAAE,aAAA,EAAe,CAAA,CAG9CD,CAAAA,CAAU,CAACP,CAAAA,CAAQ,aAAA,EAAe,CAAA,CAG7BO,EAAQ,M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f,CAAAA,CAAI,CAAE,kBAAA,CAAoB,CAAA,yCAAA,EAA4C0B,EAAa,UAAU,CAAA,CAAG,CAAC,CAAA,CACjG,MACF,CAEA,GAAI,CAEF,MAAMX,EAAa,qBAAA,CAAsBI,CAAAA,CAASO,CAAAA,CAAa,OAAA,CAASzB,GAAI,CAAE,kBAAkB,EAClG,CAAA,MAASwB,EAAG,CACVzB,CAAAA,CAAI,CAAE,kBAAA,CAAoB,2BAA6ByB,CAAAA,YAAa,KAAA,CAAQA,CAAAA,CAAE,OAAA,CAAU,OAAOA,CAAC,CAAA,CAAG,CAAC,EACtG,CACF,CACF,CAAA,CAUA,uBAAA,CAAyB,IAAMzB,EAAI,CAAE,kBAAA,CAAoB,MAAU,CAAC,CACtE,EAAE,CACJ","file":"index.js","sourcesContent":["import {\n delay,\n getAdapterFromWalletType,\n impersonatedHelpers,\n isSafeApp,\n lastConnectedWalletHelpers,\n OrbitAdapter,\n RecentConnectedWallet,\n recentConnectedWalletHelpers,\n selectAdapterByKey,\n} from '@tuwaio/orbit-core';\nimport { produce } from 'immer';\nimport { createStore } from 'zustand/vanilla';\n\nimport { BaseWallet, ISatelliteConnectStore, SatelliteConnectStoreInitialParameters, Wallet } from '../types';\n\n/**\n * Creates a Satellite Connect store instance for managing wallet connections and state\n *\n * @param params - Configuration parameters for the store\n * @param params.adapter - Single adapter or array of adapters for different chains\n * @param params.callbackAfterConnected - Optional callback function called after successful wallet connection\n *\n * @returns A Zustand store instance with wallet connection state and methods\n */\nexport function createSatelliteConnectStore<C, W extends BaseWallet = BaseWallet>({\n adapter,\n callbackAfterConnected,\n}: SatelliteConnectStoreInitialParameters<C, W>) {\n return createStore<ISatelliteConnectStore<C, W>>()((set, get) => ({\n /**\n * Returns active adapter\n */\n getAdapter: (adapterKey) => selectAdapterByKey({ adapter, adapterKey }),\n\n /**\n * Get wallet connectors for all configured adapters\n */\n getConnectors: () => {\n let results: { adapter: OrbitAdapter; connectors: C[] }[];\n\n if (Array.isArray(adapter)) {\n results = adapter.map((a) => a.getConnectors());\n } else {\n // Ensure the single adapter result is wrapped in an array for consistent processing\n results = [adapter.getConnectors()];\n }\n\n return results.reduce(\n (accumulator, currentResult) => {\n const key = currentResult.adapter;\n const value = currentResult.connectors;\n return {\n ...accumulator,\n [key]: value,\n };\n },\n {} as Partial<Record<OrbitAdapter, C[]>>,\n );\n },\n\n initializeAutoConnect: async (autoConnect) => {\n if (autoConnect) {\n const lastConnectedWallet = lastConnectedWalletHelpers.getLastConnectedWallet();\n if (lastConnectedWallet) {\n await delay(null, 200);\n await get().connect({ walletType: lastConnectedWallet.walletType, chainId: lastConnectedWallet.chainId });\n }\n } else if (isSafeApp) {\n await delay(null, 200);\n const foundAdapter = get().getAdapter(OrbitAdapter.EVM);\n if (foundAdapter && foundAdapter.getSafeConnectorChainId) {\n const safeConnectorChainId = await foundAdapter.getSafeConnectorChainId();\n if (safeConnectorChainId) {\n await get().connect({ walletType: `${OrbitAdapter.EVM}:safewallet`, chainId: safeConnectorChainId });\n }\n }\n }\n },\n\n walletConnecting: false,\n walletConnectionError: undefined,\n switchNetworkError: undefined,\n activeWallet: undefined,\n\n /**\n * Connects to a wallet\n * @param walletType - Type of wallet to connect to\n * @param chainId - Chain ID to connect on\n */\n connect: async ({ walletType, chainId }) => {\n set({ walletConnecting: true, walletConnectionError: undefined });\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(walletType));\n\n if (!foundAdapter) {\n set({\n walletConnecting: false,\n walletConnectionError: `No adapter found for wallet type: ${walletType}`,\n });\n return;\n }\n\n try {\n // 1. Check if wallet is already connected, case when you reconnect by another wallet\n if (get().activeWallet?.isConnected) {\n await get().disconnectAll();\n }\n const wallet = await foundAdapter.connect({\n walletType,\n chainId,\n });\n\n // 2. Set initial wallet state\n set({ activeWallet: wallet });\n\n // 3. Check for contract address if the adapter supports it\n if (foundAdapter.checkIsContractWallet) {\n const isContractAddress = await foundAdapter.checkIsContractWallet({\n address: wallet.address,\n chainId,\n });\n\n // Update only the isContractAddress property\n get().updateActiveWallet({ isContractAddress });\n }\n\n // 4. Run callback if provided\n if (callbackAfterConnected) {\n // Use the latest wallet state after potential updates (like isContractAddress)\n const updatedWallet = get().activeWallet;\n if (updatedWallet) {\n await callbackAfterConnected(updatedWallet);\n }\n }\n\n // 5. Final state updates\n set({ walletConnecting: false });\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType,\n chainId,\n address: get().activeWallet?.address,\n });\n recentConnectedWalletHelpers.setRecentConnectedWallet({\n [getAdapterFromWalletType(walletType)]: {\n [walletType.split(':')[1]]: true,\n },\n } as RecentConnectedWallet);\n } catch (e) {\n await get().disconnectAll();\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n set({\n walletConnecting: false,\n walletConnectionError: 'Wallet connection failed: ' + (e instanceof Error ? e.message : String(e)),\n });\n }\n },\n\n /**\n * Disconnects the currently active wallet\n */\n disconnect: async () => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // Clear all states and storages\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n impersonatedHelpers.removeImpersonated();\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n // Call disconnect only if adapter is found\n await foundAdapter?.disconnect(activeWallet);\n }\n },\n\n disconnectAll: async () => {\n await delay(null, 150);\n\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n impersonatedHelpers.removeImpersonated();\n\n if (Array.isArray(adapter)) {\n await Promise.allSettled(\n adapter.map(async (a) => {\n try {\n await a.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }),\n );\n } else {\n try {\n await adapter.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }\n },\n\n /**\n * Contains error message if connection failed\n */\n // walletConnectionError is declared above with an initial value\n\n /**\n * Resets any wallet connection errors\n */\n resetWalletConnectionError: () => {\n set({ walletConnectionError: undefined });\n },\n\n /**\n * Updates the active wallet's properties\n * @param wallet - Partial wallet object with properties to update\n */\n updateActiveWallet: (wallet: Partial<Wallet<W>>) => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // If chainId is updated, update storage\n if (wallet.chainId) {\n // Update lastConnectedWallet storage if chainId changes\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType ?? activeWallet.walletType,\n chainId: wallet.chainId ?? activeWallet.chainId,\n address: wallet.address ?? activeWallet.address,\n });\n }\n\n // Use produce for immutable state update\n set((state) =>\n produce(state, (draft) => {\n if (draft.activeWallet) {\n // Ensure we merge partial properties into the existing activeWallet object\n draft.activeWallet = {\n ...draft.activeWallet,\n ...wallet,\n } as W; // Cast ensures type compatibility after merging\n }\n }),\n );\n } else {\n const isWalletCanChange =\n wallet.walletType !== undefined && wallet.chainId !== undefined && wallet.address !== undefined;\n\n if (isWalletCanChange) {\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType!,\n chainId: wallet.chainId!,\n address: wallet.address!,\n });\n set({ activeWallet: wallet as W });\n } else {\n console.warn('Attempted to set activeWallet with incomplete data while activeWallet was undefined.');\n }\n }\n },\n\n /**\n * Switches the connected wallet to a different network\n * @param chainId - Target chain ID to switch to\n */\n switchNetwork: async (chainId: string | number) => {\n set({ switchNetworkError: undefined });\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n\n if (!foundAdapter) {\n set({ switchNetworkError: `No adapter found for active wallet type: ${activeWallet.walletType}` });\n return;\n }\n\n try {\n // Pass the local updateActiveWallet method from 'get()' to the adapter\n await foundAdapter.checkAndSwitchNetwork(chainId, activeWallet.chainId, get().updateActiveWallet);\n } catch (e) {\n set({ switchNetworkError: 'Switch network failed: ' + (e instanceof Error ? e.message : String(e)) });\n }\n }\n },\n\n /**\n * Contains error message if network switch failed\n */\n // switchNetworkError is declared above with an initial value\n\n /**\n * Resets any network switching errors\n */\n resetSwitchNetworkError: () => set({ switchNetworkError: undefined }),\n }));\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/store/satelliteConnectStore.ts"],"names":["createSatelliteConnectStore","adapter","callbackAfterConnected","createStore","set","get","adapterKey","selectAdapterByKey","results","a","accumulator","currentResult","key","value","autoConnect","lastConnectedWallet","lastConnectedWalletHelpers","delay","isSafeApp","foundAdapter","OrbitAdapter","safeConnectorChainId","walletType","chainId","getAdapterFromWalletType","wallet","isContractAddress","updatedWallet","recentConnectedWalletHelpers","e","activeWallet","impersonatedHelpers","state","produce","draft"],"mappings":"mHAyBO,SAASA,CAAAA,CAAkE,CAChF,OAAA,CAAAC,CAAAA,CACA,uBAAAC,CACF,CAAA,CAAiD,CAC/C,OAAOC,mBAAAA,GAA4C,CAACC,CAAAA,CAAKC,CAAAA,IAAS,CAIhE,WAAaC,CAAAA,EAAeC,4BAAAA,CAAmB,CAAE,OAAA,CAAAN,EAAS,UAAA,CAAAK,CAAW,CAAC,CAAA,CAKtE,cAAe,IAAM,CACnB,IAAIE,CAAAA,CAEJ,OAAI,KAAA,CAAM,OAAA,CAAQP,CAAO,CAAA,CACvBO,EAAUP,CAAAA,CAAQ,GAAA,CAAKQ,CAAAA,EAAMA,CAAAA,CAAE,eAAe,CAAA,CAG9CD,CAAAA,CAAU,CAACP,EAAQ,aAAA,EAAe,EAG7BO,CAAAA,CAAQ,MAAA,CACb,CAACE,CAAAA,CAAaC,CAAAA,GAAkB,CAC9B,IAAMC,EAAMD,CAAAA,CAAc,OAAA,CACpBE,CAAAA,CAAQF,CAAAA,CAAc,WAC5B,OAAO,CACL,GAAGD,CAAAA,CACH,CAACE,CAAG,EAAGC,CACT,CACF,EACA,EACF,CACF,CAAA,CAEA,sBAAuB,MAAOC,CAAAA,EAAgB,CAC5C,GAAIA,EAAa,CACf,IAAMC,CAAAA,CAAsBC,oCAAAA,CAA2B,wBAAuB,CAE5ED,CAAAA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,kBAAA,CAAoB,2BAA6ByB,CAAAA,YAAa,KAAA,CAAQA,CAAAA,CAAE,OAAA,CAAU,OAAOA,CAAC,CAAA,CAAG,CAAC,EACtG,CACF,CACF,CAAA,CAUA,uBAAA,CAAyB,IAAMzB,EAAI,CAAE,kBAAA,CAAoB,MAAU,CAAC,CACtE,EAAE,CACJ","file":"index.js","sourcesContent":["import {\n delay,\n getAdapterFromWalletType,\n impersonatedHelpers,\n isSafeApp,\n lastConnectedWalletHelpers,\n OrbitAdapter,\n RecentConnectedWallet,\n recentConnectedWalletHelpers,\n selectAdapterByKey,\n} from '@tuwaio/orbit-core';\nimport { produce } from 'immer';\nimport { createStore } from 'zustand/vanilla';\n\nimport { BaseWallet, ISatelliteConnectStore, SatelliteConnectStoreInitialParameters, Wallet } from '../types';\n\n/**\n * Creates a Satellite Connect store instance for managing wallet connections and state\n *\n * @param params - Configuration parameters for the store\n * @param params.adapter - Single adapter or array of adapters for different chains\n * @param params.callbackAfterConnected - Optional callback function called after successful wallet connection\n *\n * @returns A Zustand store instance with wallet connection state and methods\n */\nexport function createSatelliteConnectStore<C, W extends BaseWallet = BaseWallet>({\n adapter,\n callbackAfterConnected,\n}: SatelliteConnectStoreInitialParameters<C, W>) {\n return createStore<ISatelliteConnectStore<C, W>>()((set, get) => ({\n /**\n * Returns active adapter\n */\n getAdapter: (adapterKey) => selectAdapterByKey({ adapter, adapterKey }),\n\n /**\n * Get wallet connectors for all configured adapters\n */\n getConnectors: () => {\n let results: { adapter: OrbitAdapter; connectors: C[] }[];\n\n if (Array.isArray(adapter)) {\n results = adapter.map((a) => a.getConnectors());\n } else {\n // Ensure the single adapter result is wrapped in an array for consistent processing\n results = [adapter.getConnectors()];\n }\n\n return results.reduce(\n (accumulator, currentResult) => {\n const key = currentResult.adapter;\n const value = currentResult.connectors;\n return {\n ...accumulator,\n [key]: value,\n };\n },\n {} as Partial<Record<OrbitAdapter, C[]>>,\n );\n },\n\n initializeAutoConnect: async (autoConnect) => {\n if (autoConnect) {\n const lastConnectedWallet = lastConnectedWalletHelpers.getLastConnectedWallet();\n if (\n lastConnectedWallet &&\n !['impersonatedwallet', 'walletconnect', 'coinbasewallet'].includes(\n lastConnectedWallet.walletType.split(':')[1],\n )\n ) {\n await delay(null, 200);\n await get().connect({ walletType: lastConnectedWallet.walletType, chainId: lastConnectedWallet.chainId });\n }\n } else if (isSafeApp) {\n await delay(null, 200);\n const foundAdapter = get().getAdapter(OrbitAdapter.EVM);\n if (foundAdapter && foundAdapter.getSafeConnectorChainId) {\n const safeConnectorChainId = await foundAdapter.getSafeConnectorChainId();\n if (safeConnectorChainId) {\n await get().connect({ walletType: `${OrbitAdapter.EVM}:safewallet`, chainId: safeConnectorChainId });\n }\n }\n }\n },\n\n walletConnecting: false,\n walletConnectionError: undefined,\n switchNetworkError: undefined,\n activeWallet: undefined,\n\n /**\n * Connects to a wallet\n * @param walletType - Type of wallet to connect to\n * @param chainId - Chain ID to connect on\n */\n connect: async ({ walletType, chainId }) => {\n set({ walletConnecting: true, walletConnectionError: undefined });\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(walletType));\n\n if (!foundAdapter) {\n set({\n walletConnecting: false,\n walletConnectionError: `No adapter found for wallet type: ${walletType}`,\n });\n return;\n }\n\n try {\n // 1. Check if wallet is already connected, case when you reconnect by another wallet\n if (get().activeWallet?.isConnected) {\n await get().disconnectAll();\n }\n const wallet = await foundAdapter.connect({\n walletType,\n chainId,\n });\n\n // 2. Set initial wallet state\n set({ activeWallet: wallet });\n\n // 3. Check for contract address if the adapter supports it\n if (foundAdapter.checkIsContractWallet) {\n const isContractAddress = await foundAdapter.checkIsContractWallet({\n address: wallet.address,\n chainId,\n });\n\n // Update only the isContractAddress property\n get().updateActiveWallet({ isContractAddress });\n }\n\n // 4. Run callback if provided\n if (callbackAfterConnected) {\n // Use the latest wallet state after potential updates (like isContractAddress)\n const updatedWallet = get().activeWallet;\n if (updatedWallet) {\n await callbackAfterConnected(updatedWallet);\n }\n }\n\n // 5. Final state updates\n set({ walletConnecting: false });\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType,\n chainId,\n address: get().activeWallet?.address,\n });\n recentConnectedWalletHelpers.setRecentConnectedWallet({\n [getAdapterFromWalletType(walletType)]: {\n [walletType.split(':')[1]]: true,\n },\n } as RecentConnectedWallet);\n } catch (e) {\n await get().disconnectAll();\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n set({\n walletConnecting: false,\n walletConnectionError: 'Wallet connection failed: ' + (e instanceof Error ? e.message : String(e)),\n });\n }\n },\n\n /**\n * Disconnects the currently active wallet\n */\n disconnect: async () => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // Clear all states and storages\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n impersonatedHelpers.removeImpersonated();\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n // Call disconnect only if adapter is found\n await foundAdapter?.disconnect(activeWallet);\n }\n },\n\n disconnectAll: async () => {\n await delay(null, 150);\n\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n impersonatedHelpers.removeImpersonated();\n\n if (Array.isArray(adapter)) {\n await Promise.allSettled(\n adapter.map(async (a) => {\n try {\n await a.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }),\n );\n } else {\n try {\n await adapter.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }\n },\n\n /**\n * Contains error message if connection failed\n */\n // walletConnectionError is declared above with an initial value\n\n /**\n * Resets any wallet connection errors\n */\n resetWalletConnectionError: () => {\n set({ walletConnectionError: undefined });\n },\n\n /**\n * Updates the active wallet's properties\n * @param wallet - Partial wallet object with properties to update\n */\n updateActiveWallet: (wallet: Partial<Wallet<W>>) => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // If chainId is updated, update storage\n if (wallet.chainId) {\n // Update lastConnectedWallet storage if chainId changes\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType ?? activeWallet.walletType,\n chainId: wallet.chainId ?? activeWallet.chainId,\n address: wallet.address ?? activeWallet.address,\n });\n }\n\n // Use produce for immutable state update\n set((state) =>\n produce(state, (draft) => {\n if (draft.activeWallet) {\n // Ensure we merge partial properties into the existing activeWallet object\n draft.activeWallet = {\n ...draft.activeWallet,\n ...wallet,\n } as W; // Cast ensures type compatibility after merging\n }\n }),\n );\n } else {\n const isWalletCanChange =\n wallet.walletType !== undefined && wallet.chainId !== undefined && wallet.address !== undefined;\n\n if (isWalletCanChange) {\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType!,\n chainId: wallet.chainId!,\n address: wallet.address!,\n });\n set({ activeWallet: wallet as W });\n } else {\n console.warn('Attempted to set activeWallet with incomplete data while activeWallet was undefined.');\n }\n }\n },\n\n /**\n * Switches the connected wallet to a different network\n * @param chainId - Target chain ID to switch to\n */\n switchNetwork: async (chainId: string | number) => {\n set({ switchNetworkError: undefined });\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n\n if (!foundAdapter) {\n set({ switchNetworkError: `No adapter found for active wallet type: ${activeWallet.walletType}` });\n return;\n }\n\n try {\n // Pass the local updateActiveWallet method from 'get()' to the adapter\n await foundAdapter.checkAndSwitchNetwork(chainId, activeWallet.chainId, get().updateActiveWallet);\n } catch (e) {\n set({ switchNetworkError: 'Switch network failed: ' + (e instanceof Error ? e.message : String(e)) });\n }\n }\n },\n\n /**\n * Contains error message if network switch failed\n */\n // switchNetworkError is declared above with an initial value\n\n /**\n * Resets any network switching errors\n */\n resetSwitchNetworkError: () => set({ switchNetworkError: undefined }),\n }));\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {selectAdapterByKey,getAdapterFromWalletType,lastConnectedWalletHelpers,delay,impersonatedHelpers,recentConnectedWalletHelpers,isSafeApp,OrbitAdapter}from'@tuwaio/orbit-core';import {produce}from'immer';import {createStore}from'zustand/vanilla';function I({adapter:o,callbackAfterConnected:f}){return createStore()((
|
|
1
|
+
import {selectAdapterByKey,getAdapterFromWalletType,lastConnectedWalletHelpers,delay,impersonatedHelpers,recentConnectedWalletHelpers,isSafeApp,OrbitAdapter}from'@tuwaio/orbit-core';import {produce}from'immer';import {createStore}from'zustand/vanilla';function I({adapter:o,callbackAfterConnected:f}){return createStore()((r,n)=>({getAdapter:e=>selectAdapterByKey({adapter:o,adapterKey:e}),getConnectors:()=>{let e;return Array.isArray(o)?e=o.map(t=>t.getConnectors()):e=[o.getConnectors()],e.reduce((t,a)=>{let l=a.adapter,i=a.connectors;return {...t,[l]:i}},{})},initializeAutoConnect:async e=>{if(e){let t=lastConnectedWalletHelpers.getLastConnectedWallet();t&&!["impersonatedwallet","walletconnect","coinbasewallet"].includes(t.walletType.split(":")[1])&&(await delay(null,200),await n().connect({walletType:t.walletType,chainId:t.chainId}));}else if(isSafeApp){await delay(null,200);let t=n().getAdapter(OrbitAdapter.EVM);if(t&&t.getSafeConnectorChainId){let a=await t.getSafeConnectorChainId();a&&await n().connect({walletType:`${OrbitAdapter.EVM}:safewallet`,chainId:a});}}},walletConnecting:false,walletConnectionError:void 0,switchNetworkError:void 0,activeWallet:void 0,connect:async({walletType:e,chainId:t})=>{r({walletConnecting:true,walletConnectionError:void 0});let a=n().getAdapter(getAdapterFromWalletType(e));if(!a){r({walletConnecting:false,walletConnectionError:`No adapter found for wallet type: ${e}`});return}try{n().activeWallet?.isConnected&&await n().disconnectAll();let l=await a.connect({walletType:e,chainId:t});if(r({activeWallet:l}),a.checkIsContractWallet){let i=await a.checkIsContractWallet({address:l.address,chainId:t});n().updateActiveWallet({isContractAddress:i});}if(f){let i=n().activeWallet;i&&await f(i);}r({walletConnecting:!1}),lastConnectedWalletHelpers.setLastConnectedWallet({walletType:e,chainId:t,address:n().activeWallet?.address}),recentConnectedWalletHelpers.setRecentConnectedWallet({[getAdapterFromWalletType(e)]:{[e.split(":")[1]]:!0}});}catch(l){await n().disconnectAll(),lastConnectedWalletHelpers.removeLastConnectedWallet(),r({walletConnecting:false,walletConnectionError:"Wallet connection failed: "+(l instanceof Error?l.message:String(l))});}},disconnect:async()=>{let e=n().activeWallet;e&&(r({activeWallet:void 0,walletConnectionError:void 0,switchNetworkError:void 0}),lastConnectedWalletHelpers.removeLastConnectedWallet(),impersonatedHelpers.removeImpersonated(),await n().getAdapter(getAdapterFromWalletType(e.walletType))?.disconnect(e));},disconnectAll:async()=>{if(await delay(null,150),r({activeWallet:void 0,walletConnectionError:void 0,switchNetworkError:void 0}),impersonatedHelpers.removeImpersonated(),Array.isArray(o))await Promise.allSettled(o.map(async e=>{try{await e.disconnect();}catch{}}));else try{await o.disconnect();}catch{}},resetWalletConnectionError:()=>{r({walletConnectionError:void 0});},updateActiveWallet:e=>{let t=n().activeWallet;t?(e.chainId&&lastConnectedWalletHelpers.setLastConnectedWallet({walletType:e.walletType??t.walletType,chainId:e.chainId??t.chainId,address:e.address??t.address}),r(a=>produce(a,l=>{l.activeWallet&&(l.activeWallet={...l.activeWallet,...e});}))):e.walletType!==void 0&&e.chainId!==void 0&&e.address!==void 0?(lastConnectedWalletHelpers.setLastConnectedWallet({walletType:e.walletType,chainId:e.chainId,address:e.address}),r({activeWallet:e})):console.warn("Attempted to set activeWallet with incomplete data while activeWallet was undefined.");},switchNetwork:async e=>{r({switchNetworkError:void 0});let t=n().activeWallet;if(t){let a=n().getAdapter(getAdapterFromWalletType(t.walletType));if(!a){r({switchNetworkError:`No adapter found for active wallet type: ${t.walletType}`});return}try{await a.checkAndSwitchNetwork(e,t.chainId,n().updateActiveWallet);}catch(l){r({switchNetworkError:"Switch network failed: "+(l instanceof Error?l.message:String(l))});}}},resetSwitchNetworkError:()=>r({switchNetworkError:void 0})}))}export{I as createSatelliteConnectStore};//# sourceMappingURL=index.mjs.map
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/store/satelliteConnectStore.ts"],"names":["createSatelliteConnectStore","adapter","callbackAfterConnected","createStore","set","get","adapterKey","selectAdapterByKey","results","a","accumulator","currentResult","key","value","autoConnect","lastConnectedWallet","lastConnectedWalletHelpers","delay","isSafeApp","foundAdapter","OrbitAdapter","safeConnectorChainId","walletType","chainId","getAdapterFromWalletType","wallet","isContractAddress","updatedWallet","recentConnectedWalletHelpers","e","activeWallet","impersonatedHelpers","state","produce","draft"],"mappings":"4PAyBO,SAASA,CAAAA,CAAkE,CAChF,OAAA,CAAAC,CAAAA,CACA,uBAAAC,CACF,CAAA,CAAiD,CAC/C,OAAOC,aAA0C,CAAE,CAACC,CAAAA,CAAKC,CAAAA,IAAS,CAIhE,UAAA,CAAaC,CAAAA,EAAeC,kBAAAA,CAAmB,CAAE,QAAAN,CAAAA,CAAS,UAAA,CAAAK,CAAW,CAAC,EAKtE,aAAA,CAAe,IAAM,CACnB,IAAIE,EAEJ,OAAI,KAAA,CAAM,OAAA,CAAQP,CAAO,EACvBO,CAAAA,CAAUP,CAAAA,CAAQ,GAAA,CAAKQ,CAAAA,EAAMA,EAAE,aAAA,EAAe,CAAA,CAG9CD,CAAAA,CAAU,CAACP,CAAAA,CAAQ,aAAA,EAAe,CAAA,CAG7BO,EAAQ,MAAA,CACb,CAACE,CAAAA,CAAaC,CAAAA,GAAkB,CAC9B,IAAMC,CAAAA,CAAMD,CAAAA,CAAc,OAAA,CACpBE,EAAQF,CAAAA,CAAc,UAAA,CAC5B,OAAO,CACL,GAAGD,CAAAA,CACH,CAACE,CAAG,EAAGC,CACT,CACF,CAAA,CACA,EACF,CACF,CAAA,CAEA,qBAAA,CAAuB,MAAOC,CAAAA,EAAgB,CAC5C,GAAIA,CAAAA,CAAa,CACf,IAAMC,EAAsBC,0BAAAA,CAA2B,s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OAAA,CAAU,OAAOA,CAAC,CAAA,CAAG,CAAC,EACtG,CACF,CACF,CAAA,CAUA,uBAAA,CAAyB,IAAMzB,EAAI,CAAE,kBAAA,CAAoB,MAAU,CAAC,CACtE,EAAE,CACJ","file":"index.mjs","sourcesContent":["import {\n delay,\n getAdapterFromWalletType,\n impersonatedHelpers,\n isSafeApp,\n lastConnectedWalletHelpers,\n OrbitAdapter,\n RecentConnectedWallet,\n recentConnectedWalletHelpers,\n selectAdapterByKey,\n} from '@tuwaio/orbit-core';\nimport { produce } from 'immer';\nimport { createStore } from 'zustand/vanilla';\n\nimport { BaseWallet, ISatelliteConnectStore, SatelliteConnectStoreInitialParameters, Wallet } from '../types';\n\n/**\n * Creates a Satellite Connect store instance for managing wallet connections and state\n *\n * @param params - Configuration parameters for the store\n * @param params.adapter - Single adapter or array of adapters for different chains\n * @param params.callbackAfterConnected - Optional callback function called after successful wallet connection\n *\n * @returns A Zustand store instance with wallet connection state and methods\n */\nexport function createSatelliteConnectStore<C, W extends BaseWallet = BaseWallet>({\n adapter,\n callbackAfterConnected,\n}: SatelliteConnectStoreInitialParameters<C, W>) {\n return createStore<ISatelliteConnectStore<C, W>>()((set, get) => ({\n /**\n * Returns active adapter\n */\n getAdapter: (adapterKey) => selectAdapterByKey({ adapter, adapterKey }),\n\n /**\n * Get wallet connectors for all configured adapters\n */\n getConnectors: () => {\n let results: { adapter: OrbitAdapter; connectors: C[] }[];\n\n if (Array.isArray(adapter)) {\n results = adapter.map((a) => a.getConnectors());\n } else {\n // Ensure the single adapter result is wrapped in an array for consistent processing\n results = [adapter.getConnectors()];\n }\n\n return results.reduce(\n (accumulator, currentResult) => {\n const key = currentResult.adapter;\n const value = currentResult.connectors;\n return {\n ...accumulator,\n [key]: value,\n };\n },\n {} as Partial<Record<OrbitAdapter, C[]>>,\n );\n },\n\n initializeAutoConnect: async (autoConnect) => {\n if (autoConnect) {\n const lastConnectedWallet = lastConnectedWalletHelpers.getLastConnectedWallet();\n if (lastConnectedWallet) {\n await delay(null, 200);\n await get().connect({ walletType: lastConnectedWallet.walletType, chainId: lastConnectedWallet.chainId });\n }\n } else if (isSafeApp) {\n await delay(null, 200);\n const foundAdapter = get().getAdapter(OrbitAdapter.EVM);\n if (foundAdapter && foundAdapter.getSafeConnectorChainId) {\n const safeConnectorChainId = await foundAdapter.getSafeConnectorChainId();\n if (safeConnectorChainId) {\n await get().connect({ walletType: `${OrbitAdapter.EVM}:safewallet`, chainId: safeConnectorChainId });\n }\n }\n }\n },\n\n walletConnecting: false,\n walletConnectionError: undefined,\n switchNetworkError: undefined,\n activeWallet: undefined,\n\n /**\n * Connects to a wallet\n * @param walletType - Type of wallet to connect to\n * @param chainId - Chain ID to connect on\n */\n connect: async ({ walletType, chainId }) => {\n set({ walletConnecting: true, walletConnectionError: undefined });\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(walletType));\n\n if (!foundAdapter) {\n set({\n walletConnecting: false,\n walletConnectionError: `No adapter found for wallet type: ${walletType}`,\n });\n return;\n }\n\n try {\n // 1. Check if wallet is already connected, case when you reconnect by another wallet\n if (get().activeWallet?.isConnected) {\n await get().disconnectAll();\n }\n const wallet = await foundAdapter.connect({\n walletType,\n chainId,\n });\n\n // 2. Set initial wallet state\n set({ activeWallet: wallet });\n\n // 3. Check for contract address if the adapter supports it\n if (foundAdapter.checkIsContractWallet) {\n const isContractAddress = await foundAdapter.checkIsContractWallet({\n address: wallet.address,\n chainId,\n });\n\n // Update only the isContractAddress property\n get().updateActiveWallet({ isContractAddress });\n }\n\n // 4. Run callback if provided\n if (callbackAfterConnected) {\n // Use the latest wallet state after potential updates (like isContractAddress)\n const updatedWallet = get().activeWallet;\n if (updatedWallet) {\n await callbackAfterConnected(updatedWallet);\n }\n }\n\n // 5. Final state updates\n set({ walletConnecting: false });\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType,\n chainId,\n address: get().activeWallet?.address,\n });\n recentConnectedWalletHelpers.setRecentConnectedWallet({\n [getAdapterFromWalletType(walletType)]: {\n [walletType.split(':')[1]]: true,\n },\n } as RecentConnectedWallet);\n } catch (e) {\n await get().disconnectAll();\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n set({\n walletConnecting: false,\n walletConnectionError: 'Wallet connection failed: ' + (e instanceof Error ? e.message : String(e)),\n });\n }\n },\n\n /**\n * Disconnects the currently active wallet\n */\n disconnect: async () => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // Clear all states and storages\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n impersonatedHelpers.removeImpersonated();\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n // Call disconnect only if adapter is found\n await foundAdapter?.disconnect(activeWallet);\n }\n },\n\n disconnectAll: async () => {\n await delay(null, 150);\n\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n impersonatedHelpers.removeImpersonated();\n\n if (Array.isArray(adapter)) {\n await Promise.allSettled(\n adapter.map(async (a) => {\n try {\n await a.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }),\n );\n } else {\n try {\n await adapter.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }\n },\n\n /**\n * Contains error message if connection failed\n */\n // walletConnectionError is declared above with an initial value\n\n /**\n * Resets any wallet connection errors\n */\n resetWalletConnectionError: () => {\n set({ walletConnectionError: undefined });\n },\n\n /**\n * Updates the active wallet's properties\n * @param wallet - Partial wallet object with properties to update\n */\n updateActiveWallet: (wallet: Partial<Wallet<W>>) => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // If chainId is updated, update storage\n if (wallet.chainId) {\n // Update lastConnectedWallet storage if chainId changes\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType ?? activeWallet.walletType,\n chainId: wallet.chainId ?? activeWallet.chainId,\n address: wallet.address ?? activeWallet.address,\n });\n }\n\n // Use produce for immutable state update\n set((state) =>\n produce(state, (draft) => {\n if (draft.activeWallet) {\n // Ensure we merge partial properties into the existing activeWallet object\n draft.activeWallet = {\n ...draft.activeWallet,\n ...wallet,\n } as W; // Cast ensures type compatibility after merging\n }\n }),\n );\n } else {\n const isWalletCanChange =\n wallet.walletType !== undefined && wallet.chainId !== undefined && wallet.address !== undefined;\n\n if (isWalletCanChange) {\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType!,\n chainId: wallet.chainId!,\n address: wallet.address!,\n });\n set({ activeWallet: wallet as W });\n } else {\n console.warn('Attempted to set activeWallet with incomplete data while activeWallet was undefined.');\n }\n }\n },\n\n /**\n * Switches the connected wallet to a different network\n * @param chainId - Target chain ID to switch to\n */\n switchNetwork: async (chainId: string | number) => {\n set({ switchNetworkError: undefined });\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n\n if (!foundAdapter) {\n set({ switchNetworkError: `No adapter found for active wallet type: ${activeWallet.walletType}` });\n return;\n }\n\n try {\n // Pass the local updateActiveWallet method from 'get()' to the adapter\n await foundAdapter.checkAndSwitchNetwork(chainId, activeWallet.chainId, get().updateActiveWallet);\n } catch (e) {\n set({ switchNetworkError: 'Switch network failed: ' + (e instanceof Error ? e.message : String(e)) });\n }\n }\n },\n\n /**\n * Contains error message if network switch failed\n */\n // switchNetworkError is declared above with an initial value\n\n /**\n * Resets any network switching errors\n */\n resetSwitchNetworkError: () => set({ switchNetworkError: undefined }),\n }));\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/store/satelliteConnectStore.ts"],"names":["createSatelliteConnectStore","adapter","callbackAfterConnected","createStore","set","get","adapterKey","selectAdapterByKey","results","a","accumulator","currentResult","key","value","autoConnect","lastConnectedWallet","lastConnectedWalletHelpers","delay","isSafeApp","foundAdapter","OrbitAdapter","safeConnectorChainId","walletType","chainId","getAdapterFromWalletType","wallet","isContractAddress","updatedWallet","recentConnectedWalletHelpers","e","activeWallet","impersonatedHelpers","state","produce","draft"],"mappings":"4PAyBO,SAASA,CAAAA,CAAkE,CAChF,OAAA,CAAAC,CAAAA,CACA,uBAAAC,CACF,CAAA,CAAiD,CAC/C,OAAOC,WAAAA,GAA4C,CAACC,CAAAA,CAAKC,CAAAA,IAAS,CAIhE,WAAaC,CAAAA,EAAeC,kBAAAA,CAAmB,CAAE,OAAA,CAAAN,EAAS,UAAA,CAAAK,CAAW,CAAC,CAAA,CAKtE,cAAe,IAAM,CACnB,IAAIE,CAAAA,CAEJ,OAAI,KAAA,CAAM,OAAA,CAAQP,CAAO,CAAA,CACvBO,EAAUP,CAAAA,CAAQ,GAAA,CAAKQ,CAAAA,EAAMA,CAAAA,CAAE,eAAe,CAAA,CAG9CD,CAAAA,CAAU,CAACP,EAAQ,aAAA,EAAe,EAG7BO,CAAAA,CAAQ,MAAA,CACb,CAACE,CAAAA,CAAaC,CAAAA,GAAkB,CAC9B,IAAMC,EAAMD,CAAAA,CAAc,OAAA,CACpBE,CAAAA,CAAQF,CAAAA,CAAc,WAC5B,OAAO,CACL,GAAGD,CAAAA,CACH,CAACE,CAAG,EAAGC,CACT,CACF,EACA,EACF,CACF,CAAA,CAEA,sBAAuB,MAAOC,CAAAA,EAAgB,CAC5C,GAAIA,EAAa,CACf,IAAMC,CAAAA,CAAsBC,0BAAAA,CAA2B,wBAAuB,CAE5ED,CAAAA,EACA,CAAC,CAAC,oBAAA,CAAsB,gBAAiB,gBAAgB,CAAA,CAAE,QAAA,CACzDA,CAAAA,CAAoB,WAAW,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAC7C,CAAA,GAEA,MAAME,KAAAA,CAAM,IAAA,CAAM,GAAG,CAAA,CACrB,MAAMZ,CAAAA,EAAI,CAAE,QAAQ,CAAE,UAAA,CAAYU,CAAAA,CAAoB,UAAA,CAAY,QAASA,CAAAA,CAAoB,OAAQ,CAAC,CAAA,EAE5G,S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,CAAAA,CAAO,UAAA,GAAe,QAAaA,CAAAA,CAAO,OAAA,GAAY,MAAA,EAAaA,CAAAA,CAAO,UAAY,MAAA,EAGtFT,0BAAAA,CAA2B,sBAAA,CAAuB,CAChD,WAAYS,CAAAA,CAAO,UAAA,CACnB,OAAA,CAASA,CAAAA,CAAO,QAChB,OAAA,CAASA,CAAAA,CAAO,OAClB,CAAC,EACDrB,CAAAA,CAAI,CAAE,YAAA,CAAcqB,CAAY,CAAC,CAAA,EAEjC,OAAA,CAAQ,KAAK,sFAAsF,EAGzG,EAMA,aAAA,CAAe,MAAOF,CAAAA,EAA6B,CACjDnB,EAAI,CAAE,kBAAA,CAAoB,MAAU,CAAC,EACrC,IAAM0B,CAAAA,CAAezB,CAAAA,EAAI,CAAE,aAC3B,GAAIyB,CAAAA,CAAc,CAChB,IAAMX,EAAed,CAAAA,EAAI,CAAE,UAAA,CAAWmB,wBAAAA,CAAyBM,EAAa,UAAU,CAAC,CAAA,CAEvF,GAAI,CAACX,CAAAA,CAAc,CACjBf,CAAAA,CAAI,CAAE,mBAAoB,CAAA,yCAAA,EAA4C0B,CAAAA,CAAa,UAAU,CAAA,CAAG,CAAC,EACjG,MACF,CAEA,GAAI,CAEF,MAAMX,CAAAA,CAAa,qBAAA,CAAsBI,CAAAA,CAASO,CAAAA,CAAa,QAASzB,CAAAA,EAAI,CAAE,kBAAkB,EAClG,OAASwB,CAAAA,CAAG,CACVzB,EAAI,CAAE,kBAAA,CAAoB,2BAA6ByB,CAAAA,YAAa,KAAA,CAAQA,CAAAA,CAAE,OAAA,CAAU,OAAOA,CAAC,CAAA,CAAG,CAAC,EACtG,CACF,CACF,CAAA,CAUA,uBAAA,CAAyB,IAAMzB,EAAI,CAAE,kBAAA,CAAoB,MAAU,CAAC,CACtE,EAAE,CACJ","file":"index.mjs","sourcesContent":["import {\n delay,\n getAdapterFromWalletType,\n impersonatedHelpers,\n isSafeApp,\n lastConnectedWalletHelpers,\n OrbitAdapter,\n RecentConnectedWallet,\n recentConnectedWalletHelpers,\n selectAdapterByKey,\n} from '@tuwaio/orbit-core';\nimport { produce } from 'immer';\nimport { createStore } from 'zustand/vanilla';\n\nimport { BaseWallet, ISatelliteConnectStore, SatelliteConnectStoreInitialParameters, Wallet } from '../types';\n\n/**\n * Creates a Satellite Connect store instance for managing wallet connections and state\n *\n * @param params - Configuration parameters for the store\n * @param params.adapter - Single adapter or array of adapters for different chains\n * @param params.callbackAfterConnected - Optional callback function called after successful wallet connection\n *\n * @returns A Zustand store instance with wallet connection state and methods\n */\nexport function createSatelliteConnectStore<C, W extends BaseWallet = BaseWallet>({\n adapter,\n callbackAfterConnected,\n}: SatelliteConnectStoreInitialParameters<C, W>) {\n return createStore<ISatelliteConnectStore<C, W>>()((set, get) => ({\n /**\n * Returns active adapter\n */\n getAdapter: (adapterKey) => selectAdapterByKey({ adapter, adapterKey }),\n\n /**\n * Get wallet connectors for all configured adapters\n */\n getConnectors: () => {\n let results: { adapter: OrbitAdapter; connectors: C[] }[];\n\n if (Array.isArray(adapter)) {\n results = adapter.map((a) => a.getConnectors());\n } else {\n // Ensure the single adapter result is wrapped in an array for consistent processing\n results = [adapter.getConnectors()];\n }\n\n return results.reduce(\n (accumulator, currentResult) => {\n const key = currentResult.adapter;\n const value = currentResult.connectors;\n return {\n ...accumulator,\n [key]: value,\n };\n },\n {} as Partial<Record<OrbitAdapter, C[]>>,\n );\n },\n\n initializeAutoConnect: async (autoConnect) => {\n if (autoConnect) {\n const lastConnectedWallet = lastConnectedWalletHelpers.getLastConnectedWallet();\n if (\n lastConnectedWallet &&\n !['impersonatedwallet', 'walletconnect', 'coinbasewallet'].includes(\n lastConnectedWallet.walletType.split(':')[1],\n )\n ) {\n await delay(null, 200);\n await get().connect({ walletType: lastConnectedWallet.walletType, chainId: lastConnectedWallet.chainId });\n }\n } else if (isSafeApp) {\n await delay(null, 200);\n const foundAdapter = get().getAdapter(OrbitAdapter.EVM);\n if (foundAdapter && foundAdapter.getSafeConnectorChainId) {\n const safeConnectorChainId = await foundAdapter.getSafeConnectorChainId();\n if (safeConnectorChainId) {\n await get().connect({ walletType: `${OrbitAdapter.EVM}:safewallet`, chainId: safeConnectorChainId });\n }\n }\n }\n },\n\n walletConnecting: false,\n walletConnectionError: undefined,\n switchNetworkError: undefined,\n activeWallet: undefined,\n\n /**\n * Connects to a wallet\n * @param walletType - Type of wallet to connect to\n * @param chainId - Chain ID to connect on\n */\n connect: async ({ walletType, chainId }) => {\n set({ walletConnecting: true, walletConnectionError: undefined });\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(walletType));\n\n if (!foundAdapter) {\n set({\n walletConnecting: false,\n walletConnectionError: `No adapter found for wallet type: ${walletType}`,\n });\n return;\n }\n\n try {\n // 1. Check if wallet is already connected, case when you reconnect by another wallet\n if (get().activeWallet?.isConnected) {\n await get().disconnectAll();\n }\n const wallet = await foundAdapter.connect({\n walletType,\n chainId,\n });\n\n // 2. Set initial wallet state\n set({ activeWallet: wallet });\n\n // 3. Check for contract address if the adapter supports it\n if (foundAdapter.checkIsContractWallet) {\n const isContractAddress = await foundAdapter.checkIsContractWallet({\n address: wallet.address,\n chainId,\n });\n\n // Update only the isContractAddress property\n get().updateActiveWallet({ isContractAddress });\n }\n\n // 4. Run callback if provided\n if (callbackAfterConnected) {\n // Use the latest wallet state after potential updates (like isContractAddress)\n const updatedWallet = get().activeWallet;\n if (updatedWallet) {\n await callbackAfterConnected(updatedWallet);\n }\n }\n\n // 5. Final state updates\n set({ walletConnecting: false });\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType,\n chainId,\n address: get().activeWallet?.address,\n });\n recentConnectedWalletHelpers.setRecentConnectedWallet({\n [getAdapterFromWalletType(walletType)]: {\n [walletType.split(':')[1]]: true,\n },\n } as RecentConnectedWallet);\n } catch (e) {\n await get().disconnectAll();\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n set({\n walletConnecting: false,\n walletConnectionError: 'Wallet connection failed: ' + (e instanceof Error ? e.message : String(e)),\n });\n }\n },\n\n /**\n * Disconnects the currently active wallet\n */\n disconnect: async () => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // Clear all states and storages\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n lastConnectedWalletHelpers.removeLastConnectedWallet();\n impersonatedHelpers.removeImpersonated();\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n // Call disconnect only if adapter is found\n await foundAdapter?.disconnect(activeWallet);\n }\n },\n\n disconnectAll: async () => {\n await delay(null, 150);\n\n set({ activeWallet: undefined, walletConnectionError: undefined, switchNetworkError: undefined });\n impersonatedHelpers.removeImpersonated();\n\n if (Array.isArray(adapter)) {\n await Promise.allSettled(\n adapter.map(async (a) => {\n try {\n await a.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }),\n );\n } else {\n try {\n await adapter.disconnect();\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* empty */\n }\n }\n },\n\n /**\n * Contains error message if connection failed\n */\n // walletConnectionError is declared above with an initial value\n\n /**\n * Resets any wallet connection errors\n */\n resetWalletConnectionError: () => {\n set({ walletConnectionError: undefined });\n },\n\n /**\n * Updates the active wallet's properties\n * @param wallet - Partial wallet object with properties to update\n */\n updateActiveWallet: (wallet: Partial<Wallet<W>>) => {\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n // If chainId is updated, update storage\n if (wallet.chainId) {\n // Update lastConnectedWallet storage if chainId changes\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType ?? activeWallet.walletType,\n chainId: wallet.chainId ?? activeWallet.chainId,\n address: wallet.address ?? activeWallet.address,\n });\n }\n\n // Use produce for immutable state update\n set((state) =>\n produce(state, (draft) => {\n if (draft.activeWallet) {\n // Ensure we merge partial properties into the existing activeWallet object\n draft.activeWallet = {\n ...draft.activeWallet,\n ...wallet,\n } as W; // Cast ensures type compatibility after merging\n }\n }),\n );\n } else {\n const isWalletCanChange =\n wallet.walletType !== undefined && wallet.chainId !== undefined && wallet.address !== undefined;\n\n if (isWalletCanChange) {\n lastConnectedWalletHelpers.setLastConnectedWallet({\n walletType: wallet.walletType!,\n chainId: wallet.chainId!,\n address: wallet.address!,\n });\n set({ activeWallet: wallet as W });\n } else {\n console.warn('Attempted to set activeWallet with incomplete data while activeWallet was undefined.');\n }\n }\n },\n\n /**\n * Switches the connected wallet to a different network\n * @param chainId - Target chain ID to switch to\n */\n switchNetwork: async (chainId: string | number) => {\n set({ switchNetworkError: undefined });\n const activeWallet = get().activeWallet;\n if (activeWallet) {\n const foundAdapter = get().getAdapter(getAdapterFromWalletType(activeWallet.walletType));\n\n if (!foundAdapter) {\n set({ switchNetworkError: `No adapter found for active wallet type: ${activeWallet.walletType}` });\n return;\n }\n\n try {\n // Pass the local updateActiveWallet method from 'get()' to the adapter\n await foundAdapter.checkAndSwitchNetwork(chainId, activeWallet.chainId, get().updateActiveWallet);\n } catch (e) {\n set({ switchNetworkError: 'Switch network failed: ' + (e instanceof Error ? e.message : String(e)) });\n }\n }\n },\n\n /**\n * Contains error message if network switch failed\n */\n // switchNetworkError is declared above with an initial value\n\n /**\n * Resets any network switching errors\n */\n resetSwitchNetworkError: () => set({ switchNetworkError: undefined }),\n }));\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/satellite-core",
|
|
3
|
-
"version": "1.0.0-fix-test-alpha.
|
|
3
|
+
"version": "1.0.0-fix-test-alpha.46.00f5d3d",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"tsup": "^8.5.0",
|
|
50
50
|
"typescript": "^5.9.3",
|
|
51
51
|
"zustand": "^5.0.8",
|
|
52
|
-
"@tuwaio/orbit-core": "^1.0.0-fix-test-alpha.
|
|
52
|
+
"@tuwaio/orbit-core": "^1.0.0-fix-test-alpha.46.00f5d3d"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"start": "tsup src/index.ts --watch",
|