@tuwaio/nova-connect 0.1.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 (56) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +279 -0
  3. package/dist/chunk-KKCRUSJT.js +2 -0
  4. package/dist/chunk-KKCRUSJT.js.map +1 -0
  5. package/dist/chunk-NJDPFYUJ.js +2 -0
  6. package/dist/chunk-NJDPFYUJ.js.map +1 -0
  7. package/dist/chunk-RR5G7U5F.js +2 -0
  8. package/dist/chunk-RR5G7U5F.js.map +1 -0
  9. package/dist/evm/index.cjs +2 -0
  10. package/dist/evm/index.cjs.map +1 -0
  11. package/dist/evm/index.js +2 -0
  12. package/dist/evm/index.js.map +1 -0
  13. package/dist/evm-F7OJEDX3.js +2 -0
  14. package/dist/evm-F7OJEDX3.js.map +1 -0
  15. package/dist/evm-RBGEX4L3.js +2 -0
  16. package/dist/evm-RBGEX4L3.js.map +1 -0
  17. package/dist/getChainsListByWalletType-KXWMBNB4.js +2 -0
  18. package/dist/getChainsListByWalletType-KXWMBNB4.js.map +1 -0
  19. package/dist/hooks/index.cjs +2 -0
  20. package/dist/hooks/index.cjs.map +1 -0
  21. package/dist/hooks/index.js +2 -0
  22. package/dist/hooks/index.js.map +1 -0
  23. package/dist/index.cjs +6 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.css +2030 -0
  26. package/dist/index.d.cts +8154 -0
  27. package/dist/index.d.ts +8154 -0
  28. package/dist/index.js +6 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/providers/evm-5323YCLC.js +2 -0
  31. package/dist/providers/evm-5323YCLC.js.map +1 -0
  32. package/dist/providers/index.cjs +6 -0
  33. package/dist/providers/index.cjs.map +1 -0
  34. package/dist/providers/index.d.cts +506 -0
  35. package/dist/providers/index.d.ts +506 -0
  36. package/dist/providers/index.js +6 -0
  37. package/dist/providers/index.js.map +1 -0
  38. package/dist/providers/solana-WHT5KTOF.js +2 -0
  39. package/dist/providers/solana-WHT5KTOF.js.map +1 -0
  40. package/dist/providers/utils-FHHKXQ5Z.js +2 -0
  41. package/dist/providers/utils-FHHKXQ5Z.js.map +1 -0
  42. package/dist/providers/utils-L6CFHW4B.js +2 -0
  43. package/dist/providers/utils-L6CFHW4B.js.map +1 -0
  44. package/dist/solana/index.cjs +2 -0
  45. package/dist/solana/index.cjs.map +1 -0
  46. package/dist/solana/index.js +2 -0
  47. package/dist/solana/index.js.map +1 -0
  48. package/dist/solana-2MXIY6UT.js +2 -0
  49. package/dist/solana-2MXIY6UT.js.map +1 -0
  50. package/dist/solana-EV65GS7Q.js +2 -0
  51. package/dist/solana-EV65GS7Q.js.map +1 -0
  52. package/dist/utils-5KC7QXWB.js +2 -0
  53. package/dist/utils-5KC7QXWB.js.map +1 -0
  54. package/dist/utils-72MDY3OH.js +2 -0
  55. package/dist/utils-72MDY3OH.js.map +1 -0
  56. package/package.json +235 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 FOP Tkach Oleksandr
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,279 @@
1
+ # Nova Connect
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/@tuwaio/nova-connect.svg)](https://www.npmjs.com/package/@tuwaio/nova-connect)
4
+ [![License](https://img.shields.io/npm/l/@tuwaio/nova-connect.svg)](./LICENSE)
5
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/TuwaIO/nova-uikit/release.yml?branch=main)](https://github.com/TuwaIO/nova-uikit/actions)
6
+
7
+ Feature-rich React components for connecting Web3 wallets with a comprehensive customization system and support for multiple blockchain networks.
8
+
9
+ ---
10
+
11
+ ## 🏛️ What is `@tuwaio/nova-connect`?
12
+
13
+ `@tuwaio/nova-connect` is a comprehensive solution for integrating Web3 wallets into React applications. The package provides ready-to-use components with deep customization and support for both EVM and Solana blockchains.
14
+
15
+ Built on top of the Satellite Connect ecosystem, Nova Connect offers a unified interface for working with various wallet types and blockchain networks.
16
+
17
+ ---
18
+
19
+ ## ✨ Key Features
20
+
21
+ - **🎨 Full Customization**: Comprehensive customization system for all components and behaviors.
22
+ - **⚡ TypeScript**: Full TypeScript support with proper type definitions.
23
+ - **🌐 Multi-Blockchain**: Unified support for EVM and Solana wallets.
24
+ - **🔗 Modern React**: Built using React 19+ features and best practices.
25
+ - **🎯 Ready-made Components**: Connection button, modals, network selectors.
26
+ - **♿ Accessibility**: Full ARIA and keyboard navigation support.
27
+ - **🎭 Internationalization**: Support for multiple languages.
28
+ - **🔄 State Management**: Zustand-based store for efficient state management.
29
+ - **📱 Responsiveness**: Mobile-first design.
30
+
31
+ ---
32
+
33
+ ## 💾 Installation
34
+
35
+ ### Requirements
36
+ - React 19+
37
+ - Node.js 24+
38
+ - TypeScript 5.9+
39
+
40
+ ```bash
41
+ # Using pnpm (recommended)
42
+ pnpm add @tuwaio/nova-connect @tuwaio/satellite-core @tuwaio/orbit-core @tuwaio/pulsar-core @tuwaio/satellite-evm @tuwaio/satellite-solana @wagmi/core @wallet-standard/react viem zustand
43
+
44
+ # Using npm
45
+ npm install @tuwaio/nova-connect @tuwaio/satellite-core @tuwaio/orbit-core @tuwaio/pulsar-core @tuwaio/satellite-evm @tuwaio/satellite-solana @wagmi/core @wallet-standard/react viem zustand
46
+
47
+ # Using yarn
48
+ yarn add @tuwaio/nova-connect @tuwaio/satellite-core @tuwaio/orbit-core @tuwaio/pulsar-core @tuwaio/satellite-evm @tuwaio/satellite-solana @wagmi/core @wallet-standard/react viem zustand
49
+ ````
50
+
51
+ -----
52
+
53
+ ## 🚀 Quick Start
54
+
55
+ ### Basic Provider Setup
56
+
57
+ ```tsx
58
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
59
+ import { satelliteEVMAdapter } from '@tuwaio/satellite-evm';
60
+ import { EVMWalletsWatcher, SatelliteConnectProvider, SolanaWalletsWatcher } from '@tuwaio/satellite-react';
61
+ import { initializeSolanaMobileConnectors, satelliteSolanaAdapter } from '@tuwaio/satellite-solana';
62
+ import { ReactNode } from 'react';
63
+ import { WagmiProvider } from 'wagmi';
64
+ import { createWagmiConfig } from '@tuwaio/satellite-evm';
65
+ import { Chain, mainnet, polygon, arbitrum } from 'viem/chains';
66
+
67
+ export const appConfig = {
68
+ appName: 'My Nova Connect App',
69
+ };
70
+
71
+ export const solanaRPCUrls = {
72
+ mainnet: '[https://api.mainnet-beta.solana.com](https://api.mainnet-beta.solana.com)',
73
+ };
74
+
75
+ export const appEVMChains = [mainnet, polygon, arbitrum] as readonly [Chain, ...Chain[]];
76
+
77
+ export const wagmiConfig = createWagmiConfig({
78
+ ...appConfig,
79
+ chains: appEVMChains,
80
+ ssr: true,
81
+ syncConnectedChain: true,
82
+ });
83
+
84
+ const queryClient = new QueryClient();
85
+
86
+ initializeSolanaMobileConnectors({
87
+ rpcUrls: solanaRPCUrls,
88
+ ...appConfig,
89
+ });
90
+
91
+ export function Providers({ children }: { children: ReactNode }) {
92
+ return (
93
+ <WagmiProvider config={wagmiConfig}>
94
+ <QueryClientProvider client={queryClient}>
95
+ <SatelliteConnectProvider
96
+ adapters={[satelliteEVMAdapter({ wagmiConfig }), satelliteSolanaAdapter()]}
97
+ appName={appConfig.appName}
98
+ >
99
+ <EVMWalletsWatcher />
100
+ <SolanaWalletsWatcher />
101
+ {children}
102
+ </SatelliteConnectProvider>
103
+ </QueryClientProvider>
104
+ </WagmiProvider>
105
+ );
106
+ }
107
+ ```
108
+
109
+ ### Using NovaConnectButton
110
+
111
+ ```tsx
112
+ import { NovaConnectButton } from '@tuwaio/nova-connect';
113
+ import { SatelliteStoreContext } from '@tuwaio/satellite-react';
114
+ import { useContext } from 'react';
115
+
116
+ function App() {
117
+ const store = useContext(SatelliteStoreContext);
118
+
119
+ return (
120
+ <div>
121
+ <NovaConnectButton
122
+ store={store}
123
+ appChains={appEVMChains}
124
+ solanaRPCUrls={solanaRPCUrls}
125
+ withBalance
126
+ withChain
127
+ withImpersonated
128
+ />
129
+ </div>
130
+ );
131
+ }
132
+ ```
133
+
134
+ -----
135
+
136
+ ## 🎨 Customization
137
+
138
+ Nova Connect provides three levels of customization:
139
+
140
+ ### Basic Customization
141
+
142
+ ```tsx
143
+ <NovaConnectButton
144
+ store={store}
145
+ appChains={appEVMChains}
146
+ solanaRPCUrls={solanaRPCUrls}
147
+ className="custom-button"
148
+ labels={{
149
+ connectWallet: 'Connect Wallet',
150
+ disconnect: 'Disconnect',
151
+ }}
152
+ />
153
+ ```
154
+
155
+ ### Advanced Customization
156
+
157
+ ```tsx
158
+ <NovaConnectButton
159
+ store={store}
160
+ appChains={appEVMChains}
161
+ solanaRPCUrls={solanaRPCUrls}
162
+ customization={{
163
+ connectButton: {
164
+ classNames: {
165
+ button: ({ buttonData }) => `btn ${buttonData.isConnected ? 'btn-connected' : 'btn-connect'}`,
166
+ },
167
+ },
168
+ provider: {
169
+ errors: {
170
+ position: 'bottom-right',
171
+ autoClose: 5000,
172
+ },
173
+ },
174
+ }}
175
+ />
176
+ ```
177
+
178
+ ### Full Provider Customization
179
+
180
+ ```tsx
181
+ <NovaConnectButton
182
+ store={store}
183
+ appChains={appEVMChains}
184
+ solanaRPCUrls={solanaRPCUrls}
185
+ customization={{
186
+ provider: {
187
+ // Custom components
188
+ components: {
189
+ ErrorsProvider: CustomErrorsProvider,
190
+ LabelsProvider: CustomLabelsProvider,
191
+ },
192
+ // Label customization
193
+ labels: {
194
+ merge: (defaultLabels, userLabels) => ({ ...defaultLabels, ...userLabels }),
195
+ transform: (mergedLabels, context) => ({
196
+ ...mergedLabels,
197
+ connectWallet: context.isConnected ? 'Reconnect' : 'Connect Wallet',
198
+ }),
199
+ },
200
+ // Lifecycle hooks
201
+ initialization: {
202
+ onConnectionStateChange: (isConnected, wallet, context) => {
203
+ console.log('Connection state changed:', isConnected);
204
+ },
205
+ },
206
+ },
207
+ }}
208
+ />
209
+ ```
210
+
211
+ -----
212
+
213
+ ## 🧩 Key Components
214
+
215
+ ### 1. **NovaConnectButton**
216
+
217
+ - Main component for wallet connection.
218
+ - Built-in support for balance display and network selector.
219
+ - Full customization system.
220
+
221
+ ### 2. **NovaConnectProvider**
222
+
223
+ - Context provider with state management.
224
+ - Customizable error handling.
225
+ - Flexible internationalization system.
226
+
227
+ ### 3. **Hooks**
228
+
229
+ - `useWalletBalance`: Get the wallet balance.
230
+
231
+ -----
232
+
233
+ ## 🌍 Internationalization
234
+
235
+ Nova Connect supports full label customization:
236
+
237
+ ```tsx
238
+ const customLabels = {
239
+ connectWallet: 'Connect Wallet',
240
+ disconnect: 'Disconnect',
241
+ connecting: 'Connecting...',
242
+ connected: 'Connected',
243
+ // ... other labels
244
+ };
245
+
246
+ <NovaConnectButton
247
+ store={store}
248
+ labels={customLabels}
249
+ // ... other props
250
+ />
251
+ ```
252
+
253
+ -----
254
+
255
+ ## ♿ Accessibility
256
+
257
+ Nova Connect fully supports accessibility standards:
258
+
259
+ - ARIA labels and descriptions
260
+ - Keyboard navigation
261
+ - Screen reader support
262
+ - Semantic HTML elements
263
+ - High contrast
264
+
265
+ ## 🤝 Contributing & Support
266
+
267
+ Contributions are welcome! Please read our main **[Contribution Guidelines](https://github.com/TuwaIO/workflows/blob/main/CONTRIBUTING.md)**.
268
+
269
+ If you find this library useful, please consider supporting its development. Every contribution helps!
270
+
271
+ [**➡️ View Support Options**](https://github.com/TuwaIO/workflows/blob/main/Donation.md)
272
+
273
+ ## 📄 License
274
+
275
+ This project is licensed under the **Apache-2.0 License** - see the [LICENSE](./LICENSE) file for details.
276
+
277
+ ## 👥 Contributors
278
+
279
+ - **Oleksandr Tkach** - [GitHub](https://github.com/Argeare5)
@@ -0,0 +1,2 @@
1
+ import {defaultRpcUrlsByMoniker}from'@tuwaio/orbit-solana';function o(r){let n=r.split(":");if(n.length<2)return null;let t=n[1];return t in defaultRpcUrlsByMoniker?t:null}function s(r,n){let t={};for(let i of r){if(typeof i!="string")continue;let l=o(i);if(!l)continue;let a=n?.[l]??defaultRpcUrlsByMoniker[l];a&&(t[l]=a);}return t}function f(r,n){if(n&&n.length>0){let t=s(n,r);return Object.keys(t)}return Object.keys(r||defaultRpcUrlsByMoniker)}function p(r){return r.length>0&&r.every(n=>typeof n=="string")}function C(){return Object.keys(defaultRpcUrlsByMoniker)}function S(r){return r in defaultRpcUrlsByMoniker}export{f as a,p as b,C as c,S as d};//# sourceMappingURL=chunk-KKCRUSJT.js.map
2
+ //# sourceMappingURL=chunk-KKCRUSJT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/solana/utils.ts"],"names":["extractSolanaCluster","chainId","parts","cluster","defaultRpcUrlsByMoniker","buildSolanaRpcUrls","chains","solanaRPCUrls","availableRpcUrls","rpcUrl","getSolanaClusters","isSolanaChainList","chain","getAvailableSolanaClusters","isValidSolanaCluster"],"mappings":"2DAQA,SAASA,CAAAA,CAAqBC,CAAAA,CAA8C,CAC1E,IAAMC,CAAAA,CAAQD,CAAAA,CAAQ,KAAA,CAAM,GAAG,EAC/B,GAAIC,CAAAA,CAAM,MAAA,CAAS,CAAA,CAAG,OAAO,IAAA,CAE7B,IAAMC,CAAAA,CAAUD,CAAAA,CAAM,CAAC,CAAA,CAEvB,OAAOC,CAAAA,IAAWC,uBAAAA,CAA0BD,CAAAA,CAAU,IACxD,CAKA,SAASE,CAAAA,CACPC,CAAAA,CACAC,CAAAA,CAC0B,CAC1B,IAAMC,CAAAA,CAA6C,EAAC,CAEpD,IAAA,IAAWP,CAAAA,IAAWK,CAAAA,CAAQ,CAC5B,GAAI,OAAOL,CAAAA,EAAY,SAAU,SAEjC,IAAME,CAAAA,CAAUH,CAAAA,CAAqBC,CAAO,CAAA,CAC5C,GAAI,CAACE,EAAS,SAGd,IAAMM,CAAAA,CAASF,CAAAA,GAAgBJ,CAAO,CAAA,EAAKC,uBAAAA,CAAwBD,CAAO,EAEtEM,CAAAA,GACFD,CAAAA,CAAiBL,CAAO,CAAA,CAAIM,CAAAA,EAEhC,CAEA,OAAOD,CACT,CAKO,SAASE,CAAAA,CACdH,CAAAA,CACAD,CAAAA,CACU,CACV,GAAIA,CAAAA,EAAUA,EAAO,MAAA,CAAS,CAAA,CAAG,CAE/B,IAAME,CAAAA,CAAmBH,CAAAA,CAAmBC,CAAAA,CAAQC,CAAa,EACjE,OAAO,MAAA,CAAO,IAAA,CAAKC,CAAgB,CACrC,CAGA,OAAO,MAAA,CAAO,KAAKD,CAAAA,EAAiBH,uBAAuB,CAC7D,CAKO,SAASO,CAAAA,CAAkBL,CAAAA,CAAiD,CACjF,OAAOA,CAAAA,CAAO,MAAA,CAAS,CAAA,EAAKA,CAAAA,CAAO,KAAA,CAAOM,CAAAA,EAAU,OAAOA,GAAU,QAAQ,CAC/E,CAKO,SAASC,CAAAA,EAAqD,CACnE,OAAO,MAAA,CAAO,KAAKT,uBAAuB,CAC5C,CAKO,SAASU,CAAAA,CAAqBX,CAAAA,CAAkD,CACrF,OAAOA,KAAWC,uBACpB","file":"chunk-KKCRUSJT.js","sourcesContent":["import { defaultRpcUrlsByMoniker, SolanaRPCUrls } from '@tuwaio/orbit-solana';\nimport type { SolanaClusterMoniker } from 'gill';\n\nimport { ChainIdentifierArray } from '../types';\n\n/**\n * Extracts Solana cluster from chain identifier\n */\nfunction extractSolanaCluster(chainId: string): SolanaClusterMoniker | null {\n const parts = chainId.split(':');\n if (parts.length < 2) return null;\n\n const cluster = parts[1] as SolanaClusterMoniker;\n // Validate that it's a known cluster\n return cluster in defaultRpcUrlsByMoniker ? cluster : null;\n}\n\n/**\n * Builds available Solana RPC URLs from chain identifiers\n */\nfunction buildSolanaRpcUrls(\n chains: ChainIdentifierArray,\n solanaRPCUrls?: SolanaRPCUrls['rpcUrls'],\n): SolanaRPCUrls['rpcUrls'] {\n const availableRpcUrls: SolanaRPCUrls['rpcUrls'] = {};\n\n for (const chainId of chains) {\n if (typeof chainId !== 'string') continue;\n\n const cluster = extractSolanaCluster(chainId);\n if (!cluster) continue;\n\n // Get RPC URL with fallback to default\n const rpcUrl = solanaRPCUrls?.[cluster] ?? defaultRpcUrlsByMoniker[cluster];\n\n if (rpcUrl) {\n availableRpcUrls[cluster] = rpcUrl;\n }\n }\n\n return availableRpcUrls;\n}\n\n/**\n * Get Solana clusters from configuration\n */\nexport function getSolanaClusters(\n solanaRPCUrls?: Partial<Record<SolanaClusterMoniker, string>>,\n chains?: ChainIdentifierArray,\n): string[] {\n if (chains && chains.length > 0) {\n // For Solana, build RPC URLs and return cluster names\n const availableRpcUrls = buildSolanaRpcUrls(chains, solanaRPCUrls);\n return Object.keys(availableRpcUrls);\n }\n\n // Return configured clusters or defaults\n return Object.keys(solanaRPCUrls || defaultRpcUrlsByMoniker);\n}\n\n/**\n * Type guard to check if a chain list contains Solana cluster names\n */\nexport function isSolanaChainList(chains: (string | number)[]): chains is string[] {\n return chains.length > 0 && chains.every((chain) => typeof chain === 'string');\n}\n\n/**\n * Gets available Solana clusters from the default configuration\n */\nexport function getAvailableSolanaClusters(): SolanaClusterMoniker[] {\n return Object.keys(defaultRpcUrlsByMoniker) as SolanaClusterMoniker[];\n}\n\n/**\n * Validates if a string is a valid Solana cluster moniker\n */\nexport function isValidSolanaCluster(cluster: string): cluster is SolanaClusterMoniker {\n return cluster in defaultRpcUrlsByMoniker;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import {OrbitAdapter,getAdapterFromWalletType}from'@tuwaio/orbit-core';var l=class{adapters=new Map;async getAdapter(t){let e=this.adapters.get(t);return e?.status==="loaded"&&e.adapter?e.adapter:e?.status==="loading"?this.waitForAdapter(t):(e?.status==="error"&&console.warn(`Retrying to load ${t} adapter after previous error`),this.loadAdapter(t))}async loadAdapter(t){this.adapters.set(t,{status:"loading"});try{let e;switch(t){case OrbitAdapter.EVM:{let{createEvmAdapter:a}=await import('./evm-RBGEX4L3.js');e=await a();break}case OrbitAdapter.SOLANA:{let{createSolanaAdapter:a}=await import('./solana-2MXIY6UT.js');e=await a();break}case OrbitAdapter.Starknet:return console.warn("Starknet adapter not implemented yet"),this.adapters.set(t,{status:"error",error:new Error("Starknet adapter not yet implemented")}),null;default:{let a=new Error(`Unknown adapter type: ${t}`);return this.adapters.set(t,{status:"error",error:a}),null}}return this.adapters.set(t,{status:"loaded",adapter:e}),e}catch(e){let a=e instanceof Error?e:new Error(`Failed to load ${t} adapter`);return console.warn(`Failed to load ${t} adapter:`,a),this.adapters.set(t,{status:"error",error:a}),null}}async waitForAdapter(t){let e=0,a=50,n=100;for(;e<a;){let s=this.adapters.get(t);if(s?.status==="loaded"&&s.adapter)return s.adapter;if(s?.status==="error")return null;await new Promise(d=>setTimeout(d,n)),e++;}return console.warn(`Timeout waiting for ${t} adapter to load after ${a*n}ms`),null}getLoadedAdapter(t){let e=this.adapters.get(t);return e?.status==="loaded"&&e.adapter||null}getAdapterStatus(t){return this.adapters.get(t)?.status||"idle"}async isAdapterAvailable(t){return await this.getAdapter(t)!==null}async preloadAdapters(t=[OrbitAdapter.EVM,OrbitAdapter.SOLANA]){await Promise.allSettled(t.map(e=>this.getAdapter(e)));}clearCache(){this.adapters.clear();}getAdaptersInfo(){let t={};for(let[e,a]of this.adapters.entries())t[e]=a.status;return t}},i=new l;function A(r){return r!=null&&(typeof r=="string"||typeof r=="number")}async function C(r){let{walletType:t,chains:e=[],...a}=r;if(!t)return console.warn("getChainsListByWalletType: walletType is required"),[];let n=getAdapterFromWalletType(t),s=await i.getAdapter(n);if(!s)return console.warn(`No adapter available for ${n}, using fallback`),u(n,a);try{return n===OrbitAdapter.SOLANA?s.getChains(a.solanaRPCUrls,e):s.getChains(a.appChains)}catch(d){return console.warn(`Error getting chains for ${n}:`,d),u(n,a)}}function b(r){let{walletType:t,chains:e=[],...a}=r;if(!t)return console.warn("getChainsListByWalletType: walletType is required"),[];let n=getAdapterFromWalletType(t),s=i.getLoadedAdapter(n);if(s)try{return n===OrbitAdapter.SOLANA?s.getChains(a.solanaRPCUrls,e):s.getChains(a.appChains)}catch(d){console.warn(`Error with loaded adapter for ${n}:`,d);}return u(n,a)}function u(r,t){switch(r){case OrbitAdapter.EVM:{let e=t.appChains;return Array.isArray(e)?e.map(a=>typeof a=="object"&&a?.id?a.id:typeof a=="number"||typeof a=="string"?a:null).filter(A):[]}case OrbitAdapter.SOLANA:{let e=t.solanaRPCUrls;return e&&typeof e=="object"?Object.keys(e):[]}default:return []}}async function w(r){return (await i.getAdapter(OrbitAdapter.EVM))?.isChainList(r)??r.every(e=>typeof e=="number")}async function L(r){return (await i.getAdapter(OrbitAdapter.SOLANA))?.isChainList(r)??r.every(e=>typeof e=="string")}function S(r){return i.getLoadedAdapter(OrbitAdapter.EVM)?.isChainList(r)??r.every(e=>typeof e=="number")}function O(r){return i.getLoadedAdapter(OrbitAdapter.SOLANA)?.isChainList(r)??r.every(e=>typeof e=="string")}async function P(){return (await i.getAdapter(OrbitAdapter.SOLANA))?.getAvailableClusters?.()??[]}async function T(r){return (await i.getAdapter(OrbitAdapter.SOLANA))?.isValidCluster?.(r)??false}function x(r){if(r&&typeof r=="object"&&"connectedWallet"in r&&r.connectedWallet&&typeof r.connectedWallet=="object"&&"chains"in r.connectedWallet){let t=r.connectedWallet.chains;if(Array.isArray(t))return t}}async function E(r=[OrbitAdapter.EVM,OrbitAdapter.SOLANA]){await i.preloadAdapters(r);}function v(r){return i.getAdapterStatus(r)}function I(){return i.getAdaptersInfo()}export{C as a,b,w as c,L as d,S as e,O as f,P as g,T as h,x as i,E as j,v as k,I as l};//# sourceMappingURL=chunk-NJDPFYUJ.js.map
2
+ //# sourceMappingURL=chunk-NJDPFYUJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/adapters/registry.ts","../src/utils/getChainsListByWalletType.ts"],"names":["LazyAdapterRegistry","type","info","adapter","OrbitAdapter","createEvmAdapter","createSolanaAdapter","error","err","attempts","maxAttempts","pollInterval","resolve","types","adapterInfo","adapterRegistry","isValidChainId","id","getChainsListByWalletType","params","walletType","chains","config","adapterType","getAdapterFromWalletType","getFallbackChains","getChainsListByWalletTypeSync","appChains","chain","solanaRPCUrls","isEvmChainList","isSolanaChainList","isEvmChainListSync","isSolanaChainListSync","getAvailableSolanaClusters","isValidSolanaCluster","cluster","getWalletChains","activeWallet","preloadChainAdapters","getAdapterStatus","getAllAdaptersStatus"],"mappings":"uEAgBA,IAAMA,EAAN,KAA0B,CAKhB,SAAW,IAAI,GAAA,CAwBvB,MAAM,UAAA,CAAWC,CAAAA,CAAkD,CACjE,IAAMC,CAAAA,CAAO,KAAK,QAAA,CAAS,GAAA,CAAID,CAAI,CAAA,CAGnC,OAAIC,GAAM,MAAA,GAAW,QAAA,EAAYA,EAAK,OAAA,CAC7BA,CAAAA,CAAK,QAIVA,CAAAA,EAAM,MAAA,GAAW,UACZ,IAAA,CAAK,cAAA,CAAeD,CAAI,CAAA,EAI7BC,CAAAA,EAAM,MAAA,GAAW,OAAA,EACnB,OAAA,CAAQ,IAAA,CAAK,oBAAoBD,CAAI,CAAA,6BAAA,CAA+B,EAI/D,IAAA,CAAK,WAAA,CAAYA,CAAI,CAAA,CAC9B,CAWA,MAAc,WAAA,CAAYA,CAAAA,CAAkD,CAE1E,IAAA,CAAK,QAAA,CAAS,IAAIA,CAAAA,CAAM,CAAE,OAAQ,SAAU,CAAC,CAAA,CAE7C,GAAI,CACF,IAAIE,EAEJ,OAAQF,CAAAA,EACN,KAAKG,YAAAA,CAAa,IAAK,CACrB,GAAM,CAAE,gBAAA,CAAAC,CAAiB,EAAI,MAAM,OAAO,mBAAO,CAAA,CACjDF,CAAAA,CAAU,MAAME,CAAAA,EAAiB,CACjC,KACF,CACA,KAAKD,YAAAA,CAAa,OAAQ,CACxB,GAAM,CAAE,mBAAA,CAAAE,CAAoB,EAAI,MAAM,OAAO,sBAAU,CAAA,CACvDH,CAAAA,CAAU,MAAMG,CAAAA,EAAoB,CACpC,KACF,CACA,KAAKF,aAAa,QAAA,CAEhB,OAAA,OAAA,CAAQ,KAAK,sCAAsC,CAAA,CACnD,KAAK,QAAA,CAAS,GAAA,CAAIH,EAAM,CACtB,MAAA,CAAQ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7C,CAkCO,SAAS2B,CAAAA,CAAiBvC,EAAoB,CACnD,OAAOc,EAAgB,gBAAA,CAAiBd,CAAI,CAC9C,CA0BO,SAASwC,GAAuB,CACrC,OAAO1B,CAAAA,CAAgB,eAAA,EACzB","file":"chunk-NJDPFYUJ.js","sourcesContent":["import { OrbitAdapter } from '@tuwaio/orbit-core';\n\nimport type { AdapterInfo, AdapterLoadStatus, ChainAdapter } from './types';\n\n/**\n * Registry for blockchain adapters with lazy loading and intelligent caching.\n *\n * This class manages the lifecycle of blockchain adapters, providing:\n * - Lazy loading of adapters only when needed\n * - Intelligent caching to avoid redundant loads\n * - Graceful error handling and retry logic\n * - Thread-safe loading with concurrent request handling\n *\n * @internal\n * @since 1.0.0\n */\nclass LazyAdapterRegistry {\n /**\n * Internal cache mapping adapter types to their loading information.\n * @private\n */\n private adapters = new Map<OrbitAdapter, AdapterInfo>();\n\n /**\n * Gets an adapter with automatic loading and caching.\n *\n * This method implements intelligent loading logic:\n * - Returns immediately if adapter is already loaded\n * - Waits for completion if adapter is currently loading\n * - Retries loading if previous attempt failed\n * - Initiates new load if adapter hasn't been requested before\n *\n * @param type The blockchain adapter type to retrieve\n * @returns Promise resolving to the loaded adapter or null if unavailable\n *\n * @example\n * ```typescript\n * const evmAdapter = await registry.getAdapter(OrbitAdapter.EVM);\n * if (evmAdapter) {\n * const chains = evmAdapter.getChains(appChains);\n * }\n * ```\n *\n * @since 1.0.0\n */\n async getAdapter(type: OrbitAdapter): Promise<ChainAdapter | null> {\n const info = this.adapters.get(type);\n\n // Return cached adapter if already loaded\n if (info?.status === 'loaded' && info.adapter) {\n return info.adapter;\n }\n\n // Wait for completion if currently loading\n if (info?.status === 'loading') {\n return this.waitForAdapter(type);\n }\n\n // Retry loading if previous attempt failed\n if (info?.status === 'error') {\n console.warn(`Retrying to load ${type} adapter after previous error`);\n }\n\n // Start new loading process\n return this.loadAdapter(type);\n }\n\n /**\n * Loads a specific adapter with error handling and state management.\n *\n * @private\n * @param type The adapter type to load\n * @returns Promise resolving to the loaded adapter or null on failure\n *\n * @since 1.0.0\n */\n private async loadAdapter(type: OrbitAdapter): Promise<ChainAdapter | null> {\n // Set loading status to prevent concurrent loads\n this.adapters.set(type, { status: 'loading' });\n\n try {\n let adapter: ChainAdapter;\n\n switch (type) {\n case OrbitAdapter.EVM: {\n const { createEvmAdapter } = await import('./evm');\n adapter = await createEvmAdapter();\n break;\n }\n case OrbitAdapter.SOLANA: {\n const { createSolanaAdapter } = await import('./solana');\n adapter = await createSolanaAdapter();\n break;\n }\n case OrbitAdapter.Starknet: {\n // Future implementation placeholder\n console.warn('Starknet adapter not implemented yet');\n this.adapters.set(type, {\n status: 'error',\n error: new Error('Starknet adapter not yet implemented'),\n });\n return null;\n }\n default: {\n const error = new Error(`Unknown adapter type: ${type}`);\n this.adapters.set(type, { status: 'error', error });\n return null;\n }\n }\n\n // Mark as successfully loaded\n this.adapters.set(type, { status: 'loaded', adapter });\n return adapter;\n } catch (error) {\n const err = error instanceof Error ? error : new Error(`Failed to load ${type} adapter`);\n console.warn(`Failed to load ${type} adapter:`, err);\n this.adapters.set(type, { status: 'error', error: err });\n return null;\n }\n }\n\n /**\n * Waits for an adapter that's currently loading to complete.\n *\n * Implements polling with timeout to handle concurrent loading requests.\n * Multiple calls to getAdapter() for the same type will wait for a single\n * loading operation to complete rather than starting multiple loads.\n *\n * @private\n * @param type The adapter type to wait for\n * @returns Promise resolving to the loaded adapter or null on timeout/error\n *\n * @since 1.0.0\n */\n private async waitForAdapter(type: OrbitAdapter): Promise<ChainAdapter | null> {\n let attempts = 0;\n const maxAttempts = 50; // 5 seconds with 100ms intervals\n const pollInterval = 100; // milliseconds\n\n while (attempts < maxAttempts) {\n const info = this.adapters.get(type);\n\n if (info?.status === 'loaded' && info.adapter) {\n return info.adapter;\n }\n\n if (info?.status === 'error') {\n return null;\n }\n\n // Wait before next poll\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n attempts++;\n }\n\n console.warn(`Timeout waiting for ${type} adapter to load after ${maxAttempts * pollInterval}ms`);\n return null;\n }\n\n /**\n * Synchronously retrieves an already loaded adapter.\n *\n * This method only returns adapters that have been successfully loaded\n * and cached. It will not trigger loading of new adapters.\n *\n * @param type The adapter type to retrieve\n * @returns The loaded adapter or null if not available/loaded\n *\n * @example\n * ```typescript\n * // Check if adapter is already loaded\n * const adapter = registry.getLoadedAdapter(OrbitAdapter.EVM);\n * if (adapter) {\n * // Use immediately without waiting\n * const isValid = adapter.isChainList([1, 137]);\n * }\n * ```\n *\n * @since 1.0.0\n */\n getLoadedAdapter(type: OrbitAdapter): ChainAdapter | null {\n const info = this.adapters.get(type);\n return info?.status === 'loaded' ? info.adapter || null : null;\n }\n\n /**\n * Gets the current loading status of a specific adapter.\n *\n * @param type The adapter type to check\n * @returns Current status of the adapter\n *\n * @example\n * ```typescript\n * const status = registry.getAdapterStatus(OrbitAdapter.EVM);\n * console.log(`EVM adapter status: ${status}`);\n * // Possible values: 'idle', 'loading', 'loaded', 'error'\n * ```\n *\n * @since 1.0.0\n */\n getAdapterStatus(type: OrbitAdapter): AdapterLoadStatus {\n return this.adapters.get(type)?.status || 'idle';\n }\n\n /**\n * Checks if an adapter is available by attempting to load it.\n *\n * @param type The adapter type to check for availability\n * @returns Promise resolving to true if adapter can be loaded successfully\n *\n * @example\n * ```typescript\n * const hasEvm = await registry.isAdapterAvailable(OrbitAdapter.EVM);\n * const hasSolana = await registry.isAdapterAvailable(OrbitAdapter.SOLANA);\n *\n * if (hasEvm && hasSolana) {\n * console.log('Multi-chain support available');\n * }\n * ```\n *\n * @since 1.0.0\n */\n async isAdapterAvailable(type: OrbitAdapter): Promise<boolean> {\n const adapter = await this.getAdapter(type);\n return adapter !== null;\n }\n\n /**\n * Preloads multiple adapters for improved performance.\n *\n * This method is useful for application initialization to load commonly\n * used adapters ahead of time. All loading operations run concurrently.\n *\n * @param types Array of adapter types to preload (defaults to EVM and Solana)\n * @returns Promise that resolves when all loading attempts complete\n *\n * @example\n * ```typescript\n * // Preload during app startup\n * await registry.preloadAdapters([OrbitAdapter.EVM, OrbitAdapter.SOLANA]);\n *\n * // Later usage will be instant for loaded adapters\n * const evmAdapter = registry.getLoadedAdapter(OrbitAdapter.EVM);\n * ```\n *\n * @since 1.0.0\n */\n async preloadAdapters(types: OrbitAdapter[] = [OrbitAdapter.EVM, OrbitAdapter.SOLANA]): Promise<void> {\n // Use Promise.allSettled to continue even if some adapters fail\n await Promise.allSettled(types.map((type) => this.getAdapter(type)));\n }\n\n /**\n * Clears all cached adapters and resets the registry state.\n *\n * This method is useful for testing scenarios or when you need to\n * force reload of all adapters (e.g., after configuration changes).\n *\n * @example\n * ```typescript\n * // Clear cache to force reload\n * registry.clearCache();\n *\n * // Next getAdapter() call will reload from scratch\n * const adapter = await registry.getAdapter(OrbitAdapter.EVM);\n * ```\n *\n * @since 1.0.0\n */\n clearCache(): void {\n this.adapters.clear();\n }\n\n /**\n * Gets comprehensive information about all registered adapters.\n *\n * @returns Record mapping adapter types to their current loading status\n *\n * @example\n * ```typescript\n * const info = registry.getAdaptersInfo();\n * console.log('Adapter status overview:', info);\n * // Output: { \"evm\": \"loaded\", \"solana\": \"loading\", \"starknet\": \"idle\" }\n *\n * // Check specific status\n * if (info.evm === 'loaded') {\n * console.log('EVM adapter ready for use');\n * }\n * ```\n *\n * @since 1.0.0\n */\n getAdaptersInfo(): Record<string, AdapterLoadStatus> {\n const info: Record<string, AdapterLoadStatus> = {};\n for (const [type, adapterInfo] of this.adapters.entries()) {\n info[type] = adapterInfo.status;\n }\n return info;\n }\n}\n\n/**\n * Global singleton instance of the adapter registry.\n *\n * This is the primary interface for accessing blockchain adapters throughout\n * the application. The registry handles all loading, caching, and lifecycle\n * management automatically.\n *\n * @example\n * ```typescript\n * import { adapterRegistry } from './registry';\n *\n * // Get an adapter (loads if needed)\n * const evmAdapter = await adapterRegistry.getAdapter(OrbitAdapter.EVM);\n *\n * // Check loading status\n * const status = adapterRegistry.getAdapterStatus(OrbitAdapter.EVM);\n *\n * // Preload adapters during initialization\n * await adapterRegistry.preloadAdapters();\n * ```\n *\n * @since 1.0.0\n */\nexport const adapterRegistry = new LazyAdapterRegistry();\n","import { getAdapterFromWalletType, OrbitAdapter, WalletType } from '@tuwaio/orbit-core';\n\nimport { ChainIdentifierArray, InitialChains } from '../types';\nimport { adapterRegistry } from './adapters/registry';\n\n/**\n * Parameters for retrieving chain lists based on wallet configuration.\n *\n * Combines chain configuration with wallet-specific requirements to determine\n * which chains should be available for a given wallet type.\n *\n * @interface GetChainsListParams\n * @extends InitialChains\n * @since 1.0.0\n *\n * @example\n * ```typescript\n * const params: GetChainsListParams = {\n * walletType: WalletType.EVM_METAMASK,\n * appChains: [\n * { id: 1, name: 'Ethereum' },\n * { id: 137, name: 'Polygon' }\n * ],\n * chains: [1, 137] // Optional filter\n * };\n * ```\n */\ninterface GetChainsListParams extends InitialChains {\n /** The wallet type to determine chain compatibility */\n walletType: WalletType;\n /** Optional array of specific chain identifiers to filter or validate */\n chains?: ChainIdentifierArray;\n}\n\n/**\n * Type guard that validates if a value represents a valid chain identifier.\n *\n * Chain identifiers can be strings (for Solana clusters) or numbers (for EVM chain IDs).\n * This function filters out null, undefined, and other invalid values.\n *\n * @param id - Value to check for validity as chain identifier\n * @returns True if the value is a valid string or number chain ID\n *\n * @example\n * ```typescript\n * const rawChains = [1, 'mainnet-beta', null, undefined, 137];\n * const validChains = rawChains.filter(isValidChainId);\n * // Result: [1, 'mainnet-beta', 137]\n * ```\n *\n * @since 1.0.0\n */\nfunction isValidChainId(id: unknown): id is string | number {\n return id !== undefined && id !== null && (typeof id === 'string' || typeof id === 'number');\n}\n\n/**\n * Retrieves chain list for a specific wallet type with automatic adapter loading.\n *\n * This is the primary function for getting blockchain-compatible chains based on\n * wallet type and configuration. It automatically determines the correct adapter,\n * loads it if necessary, and falls back to safe defaults if loading fails.\n *\n * The function supports all major blockchain types:\n * - EVM chains: Returns numeric chain IDs from app configuration\n * - Solana clusters: Returns string cluster names from RPC configuration\n * - Future blockchains: Extensible through the adapter pattern\n *\n * @param params - Configuration object with wallet type and chain data\n * @returns Promise resolving to array of chain identifiers\n *\n * @example\n * ```typescript\n * // Get EVM chains for MetaMask\n * const evmChains = await getChainsListByWalletType({\n * walletType: WalletType.EVM_METAMASK,\n * appChains: [\n * { id: 1, name: 'Ethereum' },\n * { id: 137, name: 'Polygon' }\n * ]\n * });\n * // Returns: [1, 137]\n *\n * // Get Solana clusters for Phantom\n * const solanaClusters = await getChainsListByWalletType({\n * walletType: WalletType.SOLANA_PHANTOM,\n * solanaRPCUrls: {\n * 'mainnet-beta': 'https://api.mainnet-beta.solana.com',\n * 'devnet': 'https://api.devnet.solana.com'\n * }\n * });\n * // Returns: ['mainnet-beta', 'devnet']\n * ```\n *\n * @since 1.0.0\n */\nexport async function getChainsListByWalletType(params: GetChainsListParams): Promise<(string | number)[]> {\n const { walletType, chains = [], ...config } = params;\n\n if (!walletType) {\n console.warn('getChainsListByWalletType: walletType is required');\n return [];\n }\n\n const adapterType = getAdapterFromWalletType(walletType);\n const adapter = await adapterRegistry.getAdapter(adapterType);\n\n if (!adapter) {\n console.warn(`No adapter available for ${adapterType}, using fallback`);\n return getFallbackChains(adapterType, config);\n }\n\n try {\n if (adapterType === OrbitAdapter.SOLANA) {\n return adapter.getChains(config.solanaRPCUrls, chains);\n } else {\n return adapter.getChains(config.appChains);\n }\n } catch (error) {\n console.warn(`Error getting chains for ${adapterType}:`, error);\n return getFallbackChains(adapterType, config);\n }\n}\n\n/**\n * Synchronous version that only works with pre-loaded adapters.\n *\n * This function provides immediate results by using only adapters that have\n * already been loaded into the registry cache. It will not trigger new\n * loading operations, making it safe for synchronous contexts but potentially\n * less complete than the async version.\n *\n * Use this function when:\n * - You've pre-loaded adapters during app initialization\n * - You need immediate results without async overhead\n * - You're in a synchronous context where async calls aren't feasible\n *\n * @param params - Configuration object with wallet type and chain data\n * @returns Array of chain identifiers (empty if adapter not loaded)\n *\n * @example\n * ```typescript\n * // Pre-load adapters first\n * await preloadChainAdapters([OrbitAdapter.EVM, OrbitAdapter.SOLANA]);\n *\n * // Now safe to use sync version\n * const chains = getChainsListByWalletTypeSync({\n * walletType: WalletType.EVM_METAMASK,\n * appChains: evmConfiguration\n * });\n * ```\n *\n * @since 1.0.0\n */\nexport function getChainsListByWalletTypeSync(params: GetChainsListParams): (string | number)[] {\n const { walletType, chains = [], ...config } = params;\n\n if (!walletType) {\n console.warn('getChainsListByWalletType: walletType is required');\n return [];\n }\n\n const adapterType = getAdapterFromWalletType(walletType);\n const adapter = adapterRegistry.getLoadedAdapter(adapterType);\n\n if (adapter) {\n try {\n if (adapterType === OrbitAdapter.SOLANA) {\n return adapter.getChains(config.solanaRPCUrls, chains);\n } else {\n return adapter.getChains(config.appChains);\n }\n } catch (error) {\n console.warn(`Error with loaded adapter for ${adapterType}:`, error);\n }\n }\n\n return getFallbackChains(adapterType, config);\n}\n\n/**\n * Provides fallback chain extraction without external dependencies.\n *\n * This function implements basic chain extraction logic that works without\n * requiring blockchain-specific packages to be installed. It provides a\n * safety net when adapters fail to load or aren't available.\n *\n * Fallback behaviors:\n * - EVM: Extracts `id` field from chain objects or direct identifiers\n * - Solana: Extracts keys from RPC URL configuration objects\n * - Unknown: Returns empty array\n *\n * @private\n * @param adapterType - The blockchain adapter type\n * @param config - Configuration object containing chain data\n * @returns Array of extracted chain identifiers\n *\n * @since 1.0.0\n */\nfunction getFallbackChains(adapterType: OrbitAdapter, config: any): (string | number)[] {\n switch (adapterType) {\n case OrbitAdapter.EVM: {\n const appChains = config.appChains;\n if (!Array.isArray(appChains)) return [];\n\n return appChains\n .map((chain: any) => {\n // Handle chain objects with id property (e.g., { id: 1, name: 'Ethereum' })\n if (typeof chain === 'object' && chain?.id) return chain.id;\n // Handle direct chain identifiers (numbers or strings)\n if (typeof chain === 'number' || typeof chain === 'string') return chain;\n return null;\n })\n .filter(isValidChainId);\n }\n case OrbitAdapter.SOLANA: {\n const solanaRPCUrls = config.solanaRPCUrls;\n // Extract cluster names from RPC URL configuration\n return solanaRPCUrls && typeof solanaRPCUrls === 'object' ? Object.keys(solanaRPCUrls) : [];\n }\n default:\n return [];\n }\n}\n\n// ========================================\n// Chain List Validation Functions\n// ========================================\n\n/**\n * Validates if a chain list conforms to EVM format (with adapter loading).\n *\n * Uses the EVM adapter to perform comprehensive validation, falling back to\n * basic type checking if the adapter isn't available. EVM chains typically\n * use numeric identifiers.\n *\n * @param chains - Array of chain identifiers to validate\n * @returns Promise resolving to true if chains are valid for EVM\n *\n * @example\n * ```typescript\n * const isEvm = await isEvmChainList([1, 137, 56]); // true\n * const notEvm = await isEvmChainList(['mainnet-beta']); // false\n * ```\n *\n * @since 1.0.0\n */\nexport async function isEvmChainList(chains: (string | number)[]): Promise<boolean> {\n const adapter = await adapterRegistry.getAdapter(OrbitAdapter.EVM);\n return adapter?.isChainList(chains) ?? chains.every((chain) => typeof chain === 'number');\n}\n\n/**\n * Validates if a chain list conforms to Solana format (with adapter loading).\n *\n * Uses the Solana adapter to perform comprehensive validation, falling back to\n * basic type checking if the adapter isn't available. Solana chains typically\n * use string cluster names.\n *\n * @param chains - Array of chain identifiers to validate\n * @returns Promise resolving to true if chains are valid for Solana\n *\n * @example\n * ```typescript\n * const isSolana = await isSolanaChainList(['mainnet-beta', 'devnet']); // true\n * const notSolana = await isSolanaChainList([1, 137]); // false\n * ```\n *\n * @since 1.0.0\n */\nexport async function isSolanaChainList(chains: (string | number)[]): Promise<boolean> {\n const adapter = await adapterRegistry.getAdapter(OrbitAdapter.SOLANA);\n return adapter?.isChainList(chains) ?? chains.every((chain) => typeof chain === 'string');\n}\n\n/**\n * Synchronous EVM chain list validation using pre-loaded adapters.\n *\n * Provides immediate validation results without triggering adapter loading.\n * Falls back to basic type checking if adapter isn't pre-loaded.\n *\n * @param chains - Array of chain identifiers to validate\n * @returns True if chains are valid for EVM\n *\n * @example\n * ```typescript\n * const isEvm = isEvmChainListSync([1, 137, 56]); // true (immediate result)\n * ```\n *\n * @since 1.0.0\n */\nexport function isEvmChainListSync(chains: (string | number)[]): boolean {\n const adapter = adapterRegistry.getLoadedAdapter(OrbitAdapter.EVM);\n return adapter?.isChainList(chains) ?? chains.every((chain) => typeof chain === 'number');\n}\n\n/**\n * Synchronous Solana chain list validation using pre-loaded adapters.\n *\n * Provides immediate validation results without triggering adapter loading.\n * Falls back to basic type checking if adapter isn't pre-loaded.\n *\n * @param chains - Array of chain identifiers to validate\n * @returns True if chains are valid for Solana\n *\n * @example\n * ```typescript\n * const isSolana = isSolanaChainListSync(['mainnet-beta', 'devnet']); // true\n * ```\n *\n * @since 1.0.0\n */\nexport function isSolanaChainListSync(chains: (string | number)[]): boolean {\n const adapter = adapterRegistry.getLoadedAdapter(OrbitAdapter.SOLANA);\n return adapter?.isChainList(chains) ?? chains.every((chain) => typeof chain === 'string');\n}\n\n// ========================================\n// Solana-Specific Utilities\n// ========================================\n\n/**\n * Retrieves all available Solana clusters from the current configuration.\n *\n * This function loads the Solana adapter and queries it for all configured\n * cluster names. Useful for populating UI dropdowns or validating cluster\n * availability before connection attempts.\n *\n * @returns Promise resolving to array of available cluster names\n *\n * @example\n * ```typescript\n * const clusters = await getAvailableSolanaClusters();\n * console.log('Available clusters:', clusters);\n * // Might log: ['mainnet-beta', 'devnet', 'testnet', 'localnet']\n *\n * // Use for UI population\n * const clusterOptions = clusters.map(cluster => ({\n * value: cluster,\n * label: cluster.replace('-', ' ').toUpperCase()\n * }));\n * ```\n *\n * @since 1.0.0\n */\nexport async function getAvailableSolanaClusters(): Promise<string[]> {\n const adapter = await adapterRegistry.getAdapter(OrbitAdapter.SOLANA);\n return adapter?.getAvailableClusters?.() ?? [];\n}\n\n/**\n * Validates whether a cluster name is valid for Solana connections.\n *\n * This function loads the Solana adapter and uses it to validate cluster\n * names against known Solana cluster monikers and custom configurations.\n *\n * @param cluster - Cluster name to validate\n * @returns Promise resolving to true if cluster is valid\n *\n * @example\n * ```typescript\n * const isValid = await isValidSolanaCluster('mainnet-beta'); // true\n * const isInvalid = await isValidSolanaCluster('invalid-cluster'); // false\n *\n * // Use for form validation\n * if (await isValidSolanaCluster(userInput)) {\n * // Proceed with connection\n * } else {\n * // Show error message\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport async function isValidSolanaCluster(cluster: string): Promise<boolean> {\n const adapter = await adapterRegistry.getAdapter(OrbitAdapter.SOLANA);\n return adapter?.isValidCluster?.(cluster) ?? false;\n}\n\n// ========================================\n// Wallet Chain Extraction Utilities\n// ========================================\n\n/**\n * Safely extracts chain information from a wallet object.\n *\n * This utility function handles the complex nested structure of wallet objects\n * and safely extracts chain information without throwing errors. It performs\n * comprehensive type checking to ensure data integrity.\n *\n * The function expects wallet objects with this structure:\n * ```\n * {\n * connectedWallet: {\n * chains: [chain1, chain2, ...]\n * }\n * }\n * ```\n *\n * @param activeWallet - Wallet object to extract chains from\n * @returns Array of chain identifiers or undefined if not found/invalid\n *\n * @example\n * ```typescript\n * // With valid wallet structure\n * const wallet = {\n * connectedWallet: {\n * chains: [1, 137, 56]\n * }\n * };\n * const chains = getWalletChains(wallet); // [1, 137, 56]\n *\n * // With invalid/missing structure\n * const invalidWallet = { someOtherProperty: true };\n * const noChains = getWalletChains(invalidWallet); // undefined\n *\n * // Use in conditional logic\n * const walletChains = getWalletChains(activeWallet);\n * if (walletChains) {\n * console.log('Wallet supports chains:', walletChains);\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport function getWalletChains(activeWallet: any): (string | number)[] | undefined {\n if (\n activeWallet &&\n typeof activeWallet === 'object' &&\n 'connectedWallet' in activeWallet &&\n activeWallet.connectedWallet &&\n typeof activeWallet.connectedWallet === 'object' &&\n 'chains' in activeWallet.connectedWallet\n ) {\n const chains = activeWallet.connectedWallet.chains;\n if (Array.isArray(chains)) {\n return chains;\n }\n }\n return undefined;\n}\n\n// ========================================\n// Adapter Management Utilities\n// ========================================\n\n/**\n * Pre-loads blockchain adapters for improved application performance.\n *\n * This function should be called during application initialization to load\n * commonly used adapters ahead of time. This eliminates loading delays when\n * users first interact with wallet connections.\n *\n * All loading operations run concurrently for maximum efficiency, and the\n * function completes even if some adapters fail to load (partial success).\n *\n * @param types - Array of adapter types to preload (defaults to EVM and Solana)\n * @returns Promise that resolves when all loading attempts complete\n *\n * @example\n * ```typescript\n * // During app initialization\n * export async function initializeApp() {\n * // Preload common adapters\n * await preloadChainAdapters([OrbitAdapter.EVM, OrbitAdapter.SOLANA]);\n *\n * // Continue with other initialization\n * // ...\n * }\n *\n * // Later usage will be instant for loaded adapters\n * const evmChains = getChainsListByWalletTypeSync({\n * walletType: WalletType.EVM_METAMASK,\n * appChains: configuration\n * }); // Instant result since adapter is pre-loaded\n * ```\n *\n * @since 1.0.0\n */\nexport async function preloadChainAdapters(\n types: OrbitAdapter[] = [OrbitAdapter.EVM, OrbitAdapter.SOLANA],\n): Promise<void> {\n await adapterRegistry.preloadAdapters(types);\n}\n\n/**\n * Gets the current loading status of a specific adapter.\n *\n * Returns the current state of an adapter in the loading lifecycle. Useful\n * for UI indicators, debugging, or conditional logic based on adapter\n * availability.\n *\n * @param type - The adapter type to check\n * @returns Current loading status of the adapter\n *\n * @example\n * ```typescript\n * const evmStatus = getAdapterStatus(OrbitAdapter.EVM);\n *\n * switch (evmStatus) {\n * case 'idle':\n * console.log('EVM adapter not yet requested');\n * break;\n * case 'loading':\n * // Show loading spinner\n * break;\n * case 'loaded':\n * // Enable EVM features\n * break;\n * case 'error':\n * // Show fallback UI\n * break;\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport function getAdapterStatus(type: OrbitAdapter) {\n return adapterRegistry.getAdapterStatus(type);\n}\n\n/**\n * Gets comprehensive status information for all registered adapters.\n *\n * Returns a complete overview of all adapter states, useful for debugging,\n * monitoring, or displaying system status in admin interfaces.\n *\n * @returns Record mapping adapter types to their current loading status\n *\n * @example\n * ```typescript\n * const allStatuses = getAllAdaptersStatus();\n * console.log('System overview:', allStatuses);\n * // Output: { \"evm\": \"loaded\", \"solana\": \"loading\", \"starknet\": \"idle\" }\n *\n * // Use for system health monitoring\n * const loadedAdapters = Object.entries(allStatuses)\n * .filter(([_, status]) => status === 'loaded')\n * .map(([type, _]) => type);\n *\n * console.log('Available blockchain support:', loadedAdapters);\n * ```\n *\n * @since 1.0.0\n */\nexport function getAllAdaptersStatus() {\n return adapterRegistry.getAdaptersInfo();\n}\n"]}
@@ -0,0 +1,2 @@
1
+ function r(n){return n!=null&&typeof n=="number"&&n>0}function i(n){return !n||n.length===0?[]:n.map(e=>e.id).filter(r)}function t(n){return n.length>0&&n.every(e=>typeof e=="number")}export{i as a,t as b};//# sourceMappingURL=chunk-RR5G7U5F.js.map
2
+ //# sourceMappingURL=chunk-RR5G7U5F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/evm/utils.ts"],"names":["isValidEvmChainId","id","getEvmChains","appChains","chain","isEvmChainList","chains"],"mappings":"AAKA,SAASA,CAAAA,CAAkBC,EAA2B,CACpD,OAA2BA,GAAO,IAAA,EAAQ,OAAOA,CAAAA,EAAO,QAAA,EAAYA,CAAAA,CAAK,CAC3E,CAKO,SAASC,CAAAA,CAAaC,EAAoD,CAC/E,OAAI,CAACA,CAAAA,EAAaA,CAAAA,CAAU,MAAA,GAAW,CAAA,CAC9B,EAAC,CAGHA,EAAU,GAAA,CAAKC,CAAAA,EAAUA,EAAM,EAAE,CAAA,CAAE,OAAOJ,CAAiB,CACpE,CAKO,SAASK,CAAAA,CAAeC,CAAAA,CAAiD,CAC9E,OAAOA,CAAAA,CAAO,OAAS,CAAA,EAAKA,CAAAA,CAAO,MAAOF,CAAAA,EAAU,OAAOA,CAAAA,EAAU,QAAQ,CAC/E","file":"chunk-RR5G7U5F.js","sourcesContent":["import type { Chain } from 'viem/chains';\n\n/**\n * Type guard to check if a value is a valid EVM chain ID\n */\nfunction isValidEvmChainId(id: unknown): id is number {\n return id !== undefined && id !== null && typeof id === 'number' && id > 0;\n}\n\n/**\n * Get EVM chain IDs from app chains configuration\n */\nexport function getEvmChains(appChains?: readonly [Chain, ...Chain[]]): number[] {\n if (!appChains || appChains.length === 0) {\n return [];\n }\n\n return appChains.map((chain) => chain.id).filter(isValidEvmChainId);\n}\n\n/**\n * Type guard to check if a chain list contains EVM chain IDs\n */\nexport function isEvmChainList(chains: (string | number)[]): chains is number[] {\n return chains.length > 0 && chains.every((chain) => typeof chain === 'number');\n}\n"]}
@@ -0,0 +1,2 @@
1
+ 'use strict';function r(e){return e!=null&&typeof e=="number"&&e>0}function t(e){return !e||e.length===0?[]:e.map(n=>n.id).filter(r)}function i(e){return e.length>0&&e.every(n=>typeof n=="number")}exports.getEvmChains=t;exports.isEvmChainList=i;//# sourceMappingURL=index.cjs.map
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/evm/utils.ts"],"names":["isValidEvmChainId","id","getEvmChains","appChains","chain","isEvmChainList","chains"],"mappings":"aAKA,SAASA,CAAAA,CAAkBC,EAA2B,CACpD,OAA2BA,GAAO,IAAA,EAAQ,OAAOA,CAAAA,EAAO,QAAA,EAAYA,CAAAA,CAAK,CAC3E,CAKO,SAASC,CAAAA,CAAaC,EAAoD,CAC/E,OAAI,CAACA,CAAAA,EAAaA,CAAAA,CAAU,MAAA,GAAW,CAAA,CAC9B,EAAC,CAGHA,EAAU,GAAA,CAAKC,CAAAA,EAAUA,EAAM,EAAE,CAAA,CAAE,OAAOJ,CAAiB,CACpE,CAKO,SAASK,CAAAA,CAAeC,CAAAA,CAAiD,CAC9E,OAAOA,CAAAA,CAAO,OAAS,CAAA,EAAKA,CAAAA,CAAO,MAAOF,CAAAA,EAAU,OAAOA,CAAAA,EAAU,QAAQ,CAC/E","file":"index.cjs","sourcesContent":["import type { Chain } from 'viem/chains';\n\n/**\n * Type guard to check if a value is a valid EVM chain ID\n */\nfunction isValidEvmChainId(id: unknown): id is number {\n return id !== undefined && id !== null && typeof id === 'number' && id > 0;\n}\n\n/**\n * Get EVM chain IDs from app chains configuration\n */\nexport function getEvmChains(appChains?: readonly [Chain, ...Chain[]]): number[] {\n if (!appChains || appChains.length === 0) {\n return [];\n }\n\n return appChains.map((chain) => chain.id).filter(isValidEvmChainId);\n}\n\n/**\n * Type guard to check if a chain list contains EVM chain IDs\n */\nexport function isEvmChainList(chains: (string | number)[]): chains is number[] {\n return chains.length > 0 && chains.every((chain) => typeof chain === 'number');\n}\n"]}
@@ -0,0 +1,2 @@
1
+ function r(e){return e!=null&&typeof e=="number"&&e>0}function t(e){return !e||e.length===0?[]:e.map(n=>n.id).filter(r)}function i(e){return e.length>0&&e.every(n=>typeof n=="number")}export{t as getEvmChains,i as isEvmChainList};//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/evm/utils.ts"],"names":["isValidEvmChainId","id","getEvmChains","appChains","chain","isEvmChainList","chains"],"mappings":"AAKA,SAASA,CAAAA,CAAkBC,EAA2B,CACpD,OAA2BA,GAAO,IAAA,EAAQ,OAAOA,CAAAA,EAAO,QAAA,EAAYA,CAAAA,CAAK,CAC3E,CAKO,SAASC,CAAAA,CAAaC,EAAoD,CAC/E,OAAI,CAACA,CAAAA,EAAaA,CAAAA,CAAU,MAAA,GAAW,CAAA,CAC9B,EAAC,CAGHA,EAAU,GAAA,CAAKC,CAAAA,EAAUA,EAAM,EAAE,CAAA,CAAE,OAAOJ,CAAiB,CACpE,CAKO,SAASK,CAAAA,CAAeC,CAAAA,CAAiD,CAC9E,OAAOA,CAAAA,CAAO,OAAS,CAAA,EAAKA,CAAAA,CAAO,MAAOF,CAAAA,EAAU,OAAOA,CAAAA,EAAU,QAAQ,CAC/E","file":"index.js","sourcesContent":["import type { Chain } from 'viem/chains';\n\n/**\n * Type guard to check if a value is a valid EVM chain ID\n */\nfunction isValidEvmChainId(id: unknown): id is number {\n return id !== undefined && id !== null && typeof id === 'number' && id > 0;\n}\n\n/**\n * Get EVM chain IDs from app chains configuration\n */\nexport function getEvmChains(appChains?: readonly [Chain, ...Chain[]]): number[] {\n if (!appChains || appChains.length === 0) {\n return [];\n }\n\n return appChains.map((chain) => chain.id).filter(isValidEvmChainId);\n}\n\n/**\n * Type guard to check if a chain list contains EVM chain IDs\n */\nexport function isEvmChainList(chains: (string | number)[]): chains is number[] {\n return chains.length > 0 && chains.every((chain) => typeof chain === 'number');\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export{a as getEvmChains,b as isEvmChainList}from'./chunk-RR5G7U5F.js';//# sourceMappingURL=evm-F7OJEDX3.js.map
2
+ //# sourceMappingURL=evm-F7OJEDX3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"evm-F7OJEDX3.js"}
@@ -0,0 +1,2 @@
1
+ async function n(){try{return await import('./utils-5KC7QXWB.js')}catch(r){return console.warn("EVM utilities not available:",r),null}}async function i(){let r=await n();return {getChains(e){return r?.getEvmChains?r.getEvmChains(e):!Array.isArray(e)||e.length===0?[]:e.map(t=>typeof t=="object"&&t?.id!==void 0?t.id:typeof t=="number"||typeof t=="string"?t:null).filter(t=>t!==null&&(typeof t=="string"||typeof t=="number"))},isChainList(e){return r?.isEvmChainList?r.isEvmChainList(e):e.length>0&&e.every(t=>typeof t=="number")}}}async function s(){try{return await import('./utils-5KC7QXWB.js'),!0}catch{return false}}export{i as createEvmAdapter,s as isEvmAdapterAvailable};//# sourceMappingURL=evm-RBGEX4L3.js.map
2
+ //# sourceMappingURL=evm-RBGEX4L3.js.map