@tuwaio/nova-connect 1.0.0-fix-test-alpha.51.1ef6db6 → 1.0.0-fix-test-alpha.53.a751bf7
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/chunk-KKCRUSJT.js +2 -0
- package/dist/chunk-KKCRUSJT.js.map +1 -0
- package/dist/chunk-NJDPFYUJ.js +2 -0
- package/dist/chunk-NJDPFYUJ.js.map +1 -0
- package/dist/chunk-RR5G7U5F.js +2 -0
- package/dist/chunk-RR5G7U5F.js.map +1 -0
- package/dist/evm-F7OJEDX3.js +2 -0
- package/dist/evm-F7OJEDX3.js.map +1 -0
- package/dist/evm-RBGEX4L3.js +2 -0
- package/dist/evm-RBGEX4L3.js.map +1 -0
- package/dist/getChainsListByWalletType-KXWMBNB4.js +2 -0
- package/dist/getChainsListByWalletType-KXWMBNB4.js.map +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +584 -763
- package/dist/index.d.cts +845 -24
- package/dist/index.d.ts +845 -24
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/providers/evm-5323YCLC.js +2 -0
- package/dist/providers/evm-5323YCLC.js.map +1 -0
- package/dist/providers/index.cjs +2 -2
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/solana-WHT5KTOF.js +2 -0
- package/dist/providers/solana-WHT5KTOF.js.map +1 -0
- package/dist/providers/utils-FHHKXQ5Z.js +2 -0
- package/dist/providers/utils-FHHKXQ5Z.js.map +1 -0
- package/dist/providers/utils-L6CFHW4B.js +2 -0
- package/dist/providers/utils-L6CFHW4B.js.map +1 -0
- package/dist/solana-2MXIY6UT.js +2 -0
- package/dist/solana-2MXIY6UT.js.map +1 -0
- package/dist/solana-EV65GS7Q.js +2 -0
- package/dist/solana-EV65GS7Q.js.map +1 -0
- package/dist/utils-5KC7QXWB.js +2 -0
- package/dist/utils-5KC7QXWB.js.map +1 -0
- package/dist/utils-72MDY3OH.js +2 -0
- package/dist/utils-72MDY3OH.js.map +1 -0
- package/package.json +93 -20
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { OrbitAdapter, WalletType } from '@tuwaio/orbit-core';
|
|
1
2
|
import * as react from 'react';
|
|
2
3
|
import react__default, { FC, ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import { TransactionPool, Transaction, TxAdapter } from '@tuwaio/pulsar-core';
|
|
5
6
|
import { ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
6
7
|
import { StoreApi } from 'zustand/index';
|
|
7
|
-
import { OrbitAdapter, WalletType } from '@tuwaio/orbit-core';
|
|
8
8
|
import { Connector as Connector$1 } from '@tuwaio/satellite-react';
|
|
9
9
|
import * as Select from '@radix-ui/react-select';
|
|
10
10
|
|
|
@@ -212,6 +212,56 @@ type ConnectButtonProps = InitialChains & Pick<NovaConnectProviderProps, 'store'
|
|
|
212
212
|
|
|
213
213
|
declare function ConnectButton({ store, labels, ...props }: Pick<NovaConnectProviderProps, 'labels'> & ConnectButtonProps): react_jsx_runtime.JSX.Element;
|
|
214
214
|
|
|
215
|
+
/**
|
|
216
|
+
* ChainSelector - Main component for blockchain network selection
|
|
217
|
+
*
|
|
218
|
+
* This component provides a comprehensive interface for users to select between
|
|
219
|
+
* different blockchain networks. It automatically detects available chains from
|
|
220
|
+
* wallet configuration and renders an appropriate selector interface.
|
|
221
|
+
*
|
|
222
|
+
* Key features:
|
|
223
|
+
* - Automatic chain detection from wallet type and configuration
|
|
224
|
+
* - Responsive design with separate mobile/desktop interfaces
|
|
225
|
+
* - Asynchronous chain loading with fallback to synchronous operation
|
|
226
|
+
* - Single chain optimization (no selector needed for one chain)
|
|
227
|
+
* - Full accessibility support with screen reader compatibility
|
|
228
|
+
* - Integration with wallet switching functionality
|
|
229
|
+
* - Error handling and loading states
|
|
230
|
+
*
|
|
231
|
+
* Architecture:
|
|
232
|
+
* - Uses dynamic imports for better performance
|
|
233
|
+
* - Supports both sync and async chain resolution
|
|
234
|
+
* - Provides fallback behavior when adapters fail
|
|
235
|
+
* - Integrates with existing store and state management
|
|
236
|
+
*
|
|
237
|
+
* Visual behavior:
|
|
238
|
+
* - Desktop: Dropdown select with animated content
|
|
239
|
+
* - Mobile: Modal dialog with scrollable list
|
|
240
|
+
* - Single chain: Simple display with icon and name
|
|
241
|
+
* - Multiple chains: Full selector with network switching
|
|
242
|
+
*
|
|
243
|
+
* @param appChains - Configuration for supported blockchain networks
|
|
244
|
+
* @param solanaRPCUrls - RPC URLs configuration for Solana network
|
|
245
|
+
* @param store - State management store for wallet operations
|
|
246
|
+
* @returns JSX element representing the chain selector or null if no wallet
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```tsx
|
|
250
|
+
* <ChainSelector
|
|
251
|
+
* appChains={[
|
|
252
|
+
* { id: 1, name: 'Ethereum' },
|
|
253
|
+
* { id: 137, name: 'Polygon' }
|
|
254
|
+
* ]}
|
|
255
|
+
* solanaRPCUrls={{
|
|
256
|
+
* 'mainnet-beta': 'https://api.mainnet-beta.solana.com'
|
|
257
|
+
* }}
|
|
258
|
+
* store={walletStore}
|
|
259
|
+
* />
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* @public
|
|
263
|
+
* @since 1.0.0
|
|
264
|
+
*/
|
|
215
265
|
declare function ChainSelector({ appChains, solanaRPCUrls, store }: InitialChains & Pick<ConnectButtonProps, 'store'>): react_jsx_runtime.JSX.Element | null;
|
|
216
266
|
|
|
217
267
|
interface ChainListProps {
|
|
@@ -1489,29 +1539,546 @@ declare const defaultLabels: NovaConnectLabels;
|
|
|
1489
1539
|
declare const ukrainianLabels: NovaConnectLabels;
|
|
1490
1540
|
|
|
1491
1541
|
/**
|
|
1492
|
-
* Parameters for
|
|
1542
|
+
* Parameters for retrieving chain lists based on wallet configuration.
|
|
1543
|
+
*
|
|
1544
|
+
* Combines chain configuration with wallet-specific requirements to determine
|
|
1545
|
+
* which chains should be available for a given wallet type.
|
|
1546
|
+
*
|
|
1547
|
+
* @interface GetChainsListParams
|
|
1548
|
+
* @extends InitialChains
|
|
1549
|
+
* @since 1.0.0
|
|
1550
|
+
*
|
|
1551
|
+
* @example
|
|
1552
|
+
* ```typescript
|
|
1553
|
+
* const params: GetChainsListParams = {
|
|
1554
|
+
* walletType: WalletType.EVM_METAMASK,
|
|
1555
|
+
* appChains: [
|
|
1556
|
+
* { id: 1, name: 'Ethereum' },
|
|
1557
|
+
* { id: 137, name: 'Polygon' }
|
|
1558
|
+
* ],
|
|
1559
|
+
* chains: [1, 137] // Optional filter
|
|
1560
|
+
* };
|
|
1561
|
+
* ```
|
|
1493
1562
|
*/
|
|
1494
1563
|
interface GetChainsListParams extends InitialChains {
|
|
1495
|
-
/** The wallet type to
|
|
1564
|
+
/** The wallet type to determine chain compatibility */
|
|
1496
1565
|
walletType: WalletType;
|
|
1497
|
-
/** Optional array of chain identifiers to filter
|
|
1566
|
+
/** Optional array of specific chain identifiers to filter or validate */
|
|
1498
1567
|
chains?: ChainIdentifierArray;
|
|
1499
1568
|
}
|
|
1500
1569
|
/**
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1570
|
+
* Retrieves chain list for a specific wallet type with automatic adapter loading.
|
|
1571
|
+
*
|
|
1572
|
+
* This is the primary function for getting blockchain-compatible chains based on
|
|
1573
|
+
* wallet type and configuration. It automatically determines the correct adapter,
|
|
1574
|
+
* loads it if necessary, and falls back to safe defaults if loading fails.
|
|
1575
|
+
*
|
|
1576
|
+
* The function supports all major blockchain types:
|
|
1577
|
+
* - EVM chains: Returns numeric chain IDs from app configuration
|
|
1578
|
+
* - Solana clusters: Returns string cluster names from RPC configuration
|
|
1579
|
+
* - Future blockchains: Extensible through the adapter pattern
|
|
1580
|
+
*
|
|
1581
|
+
* @param params - Configuration object with wallet type and chain data
|
|
1582
|
+
* @returns Promise resolving to array of chain identifiers
|
|
1583
|
+
*
|
|
1584
|
+
* @example
|
|
1585
|
+
* ```typescript
|
|
1586
|
+
* // Get EVM chains for MetaMask
|
|
1587
|
+
* const evmChains = await getChainsListByWalletType({
|
|
1588
|
+
* walletType: WalletType.EVM_METAMASK,
|
|
1589
|
+
* appChains: [
|
|
1590
|
+
* { id: 1, name: 'Ethereum' },
|
|
1591
|
+
* { id: 137, name: 'Polygon' }
|
|
1592
|
+
* ]
|
|
1593
|
+
* });
|
|
1594
|
+
* // Returns: [1, 137]
|
|
1595
|
+
*
|
|
1596
|
+
* // Get Solana clusters for Phantom
|
|
1597
|
+
* const solanaClusters = await getChainsListByWalletType({
|
|
1598
|
+
* walletType: WalletType.SOLANA_PHANTOM,
|
|
1599
|
+
* solanaRPCUrls: {
|
|
1600
|
+
* 'mainnet-beta': 'https://api.mainnet-beta.solana.com',
|
|
1601
|
+
* 'devnet': 'https://api.devnet.solana.com'
|
|
1602
|
+
* }
|
|
1603
|
+
* });
|
|
1604
|
+
* // Returns: ['mainnet-beta', 'devnet']
|
|
1605
|
+
* ```
|
|
1606
|
+
*
|
|
1607
|
+
* @since 1.0.0
|
|
1608
|
+
*/
|
|
1609
|
+
declare function getChainsListByWalletType(params: GetChainsListParams): Promise<(string | number)[]>;
|
|
1610
|
+
/**
|
|
1611
|
+
* Synchronous version that only works with pre-loaded adapters.
|
|
1612
|
+
*
|
|
1613
|
+
* This function provides immediate results by using only adapters that have
|
|
1614
|
+
* already been loaded into the registry cache. It will not trigger new
|
|
1615
|
+
* loading operations, making it safe for synchronous contexts but potentially
|
|
1616
|
+
* less complete than the async version.
|
|
1617
|
+
*
|
|
1618
|
+
* Use this function when:
|
|
1619
|
+
* - You've pre-loaded adapters during app initialization
|
|
1620
|
+
* - You need immediate results without async overhead
|
|
1621
|
+
* - You're in a synchronous context where async calls aren't feasible
|
|
1622
|
+
*
|
|
1623
|
+
* @param params - Configuration object with wallet type and chain data
|
|
1624
|
+
* @returns Array of chain identifiers (empty if adapter not loaded)
|
|
1625
|
+
*
|
|
1626
|
+
* @example
|
|
1627
|
+
* ```typescript
|
|
1628
|
+
* // Pre-load adapters first
|
|
1629
|
+
* await preloadChainAdapters([OrbitAdapter.EVM, OrbitAdapter.SOLANA]);
|
|
1630
|
+
*
|
|
1631
|
+
* // Now safe to use sync version
|
|
1632
|
+
* const chains = getChainsListByWalletTypeSync({
|
|
1633
|
+
* walletType: WalletType.EVM_METAMASK,
|
|
1634
|
+
* appChains: evmConfiguration
|
|
1635
|
+
* });
|
|
1636
|
+
* ```
|
|
1637
|
+
*
|
|
1638
|
+
* @since 1.0.0
|
|
1639
|
+
*/
|
|
1640
|
+
declare function getChainsListByWalletTypeSync(params: GetChainsListParams): (string | number)[];
|
|
1641
|
+
/**
|
|
1642
|
+
* Validates if a chain list conforms to EVM format (with adapter loading).
|
|
1643
|
+
*
|
|
1644
|
+
* Uses the EVM adapter to perform comprehensive validation, falling back to
|
|
1645
|
+
* basic type checking if the adapter isn't available. EVM chains typically
|
|
1646
|
+
* use numeric identifiers.
|
|
1647
|
+
*
|
|
1648
|
+
* @param chains - Array of chain identifiers to validate
|
|
1649
|
+
* @returns Promise resolving to true if chains are valid for EVM
|
|
1650
|
+
*
|
|
1651
|
+
* @example
|
|
1652
|
+
* ```typescript
|
|
1653
|
+
* const isEvm = await isEvmChainList([1, 137, 56]); // true
|
|
1654
|
+
* const notEvm = await isEvmChainList(['mainnet-beta']); // false
|
|
1655
|
+
* ```
|
|
1656
|
+
*
|
|
1657
|
+
* @since 1.0.0
|
|
1658
|
+
*/
|
|
1659
|
+
declare function isEvmChainList(chains: (string | number)[]): Promise<boolean>;
|
|
1660
|
+
/**
|
|
1661
|
+
* Validates if a chain list conforms to Solana format (with adapter loading).
|
|
1662
|
+
*
|
|
1663
|
+
* Uses the Solana adapter to perform comprehensive validation, falling back to
|
|
1664
|
+
* basic type checking if the adapter isn't available. Solana chains typically
|
|
1665
|
+
* use string cluster names.
|
|
1666
|
+
*
|
|
1667
|
+
* @param chains - Array of chain identifiers to validate
|
|
1668
|
+
* @returns Promise resolving to true if chains are valid for Solana
|
|
1669
|
+
*
|
|
1670
|
+
* @example
|
|
1671
|
+
* ```typescript
|
|
1672
|
+
* const isSolana = await isSolanaChainList(['mainnet-beta', 'devnet']); // true
|
|
1673
|
+
* const notSolana = await isSolanaChainList([1, 137]); // false
|
|
1674
|
+
* ```
|
|
1675
|
+
*
|
|
1676
|
+
* @since 1.0.0
|
|
1677
|
+
*/
|
|
1678
|
+
declare function isSolanaChainList(chains: (string | number)[]): Promise<boolean>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Synchronous EVM chain list validation using pre-loaded adapters.
|
|
1681
|
+
*
|
|
1682
|
+
* Provides immediate validation results without triggering adapter loading.
|
|
1683
|
+
* Falls back to basic type checking if adapter isn't pre-loaded.
|
|
1684
|
+
*
|
|
1685
|
+
* @param chains - Array of chain identifiers to validate
|
|
1686
|
+
* @returns True if chains are valid for EVM
|
|
1687
|
+
*
|
|
1688
|
+
* @example
|
|
1689
|
+
* ```typescript
|
|
1690
|
+
* const isEvm = isEvmChainListSync([1, 137, 56]); // true (immediate result)
|
|
1691
|
+
* ```
|
|
1692
|
+
*
|
|
1693
|
+
* @since 1.0.0
|
|
1694
|
+
*/
|
|
1695
|
+
declare function isEvmChainListSync(chains: (string | number)[]): boolean;
|
|
1696
|
+
/**
|
|
1697
|
+
* Synchronous Solana chain list validation using pre-loaded adapters.
|
|
1698
|
+
*
|
|
1699
|
+
* Provides immediate validation results without triggering adapter loading.
|
|
1700
|
+
* Falls back to basic type checking if adapter isn't pre-loaded.
|
|
1701
|
+
*
|
|
1702
|
+
* @param chains - Array of chain identifiers to validate
|
|
1703
|
+
* @returns True if chains are valid for Solana
|
|
1704
|
+
*
|
|
1705
|
+
* @example
|
|
1706
|
+
* ```typescript
|
|
1707
|
+
* const isSolana = isSolanaChainListSync(['mainnet-beta', 'devnet']); // true
|
|
1708
|
+
* ```
|
|
1709
|
+
*
|
|
1710
|
+
* @since 1.0.0
|
|
1711
|
+
*/
|
|
1712
|
+
declare function isSolanaChainListSync(chains: (string | number)[]): boolean;
|
|
1713
|
+
/**
|
|
1714
|
+
* Retrieves all available Solana clusters from the current configuration.
|
|
1715
|
+
*
|
|
1716
|
+
* This function loads the Solana adapter and queries it for all configured
|
|
1717
|
+
* cluster names. Useful for populating UI dropdowns or validating cluster
|
|
1718
|
+
* availability before connection attempts.
|
|
1719
|
+
*
|
|
1720
|
+
* @returns Promise resolving to array of available cluster names
|
|
1721
|
+
*
|
|
1722
|
+
* @example
|
|
1723
|
+
* ```typescript
|
|
1724
|
+
* const clusters = await getAvailableSolanaClusters();
|
|
1725
|
+
* console.log('Available clusters:', clusters);
|
|
1726
|
+
* // Might log: ['mainnet-beta', 'devnet', 'testnet', 'localnet']
|
|
1727
|
+
*
|
|
1728
|
+
* // Use for UI population
|
|
1729
|
+
* const clusterOptions = clusters.map(cluster => ({
|
|
1730
|
+
* value: cluster,
|
|
1731
|
+
* label: cluster.replace('-', ' ').toUpperCase()
|
|
1732
|
+
* }));
|
|
1733
|
+
* ```
|
|
1734
|
+
*
|
|
1735
|
+
* @since 1.0.0
|
|
1736
|
+
*/
|
|
1737
|
+
declare function getAvailableSolanaClusters$1(): Promise<string[]>;
|
|
1738
|
+
/**
|
|
1739
|
+
* Validates whether a cluster name is valid for Solana connections.
|
|
1740
|
+
*
|
|
1741
|
+
* This function loads the Solana adapter and uses it to validate cluster
|
|
1742
|
+
* names against known Solana cluster monikers and custom configurations.
|
|
1743
|
+
*
|
|
1744
|
+
* @param cluster - Cluster name to validate
|
|
1745
|
+
* @returns Promise resolving to true if cluster is valid
|
|
1746
|
+
*
|
|
1747
|
+
* @example
|
|
1748
|
+
* ```typescript
|
|
1749
|
+
* const isValid = await isValidSolanaCluster('mainnet-beta'); // true
|
|
1750
|
+
* const isInvalid = await isValidSolanaCluster('invalid-cluster'); // false
|
|
1751
|
+
*
|
|
1752
|
+
* // Use for form validation
|
|
1753
|
+
* if (await isValidSolanaCluster(userInput)) {
|
|
1754
|
+
* // Proceed with connection
|
|
1755
|
+
* } else {
|
|
1756
|
+
* // Show error message
|
|
1757
|
+
* }
|
|
1758
|
+
* ```
|
|
1759
|
+
*
|
|
1760
|
+
* @since 1.0.0
|
|
1761
|
+
*/
|
|
1762
|
+
declare function isValidSolanaCluster$1(cluster: string): Promise<boolean>;
|
|
1763
|
+
/**
|
|
1764
|
+
* Safely extracts chain information from a wallet object.
|
|
1765
|
+
*
|
|
1766
|
+
* This utility function handles the complex nested structure of wallet objects
|
|
1767
|
+
* and safely extracts chain information without throwing errors. It performs
|
|
1768
|
+
* comprehensive type checking to ensure data integrity.
|
|
1769
|
+
*
|
|
1770
|
+
* The function expects wallet objects with this structure:
|
|
1771
|
+
* ```
|
|
1772
|
+
* {
|
|
1773
|
+
* connectedWallet: {
|
|
1774
|
+
* chains: [chain1, chain2, ...]
|
|
1775
|
+
* }
|
|
1776
|
+
* }
|
|
1777
|
+
* ```
|
|
1778
|
+
*
|
|
1779
|
+
* @param activeWallet - Wallet object to extract chains from
|
|
1780
|
+
* @returns Array of chain identifiers or undefined if not found/invalid
|
|
1781
|
+
*
|
|
1782
|
+
* @example
|
|
1783
|
+
* ```typescript
|
|
1784
|
+
* // With valid wallet structure
|
|
1785
|
+
* const wallet = {
|
|
1786
|
+
* connectedWallet: {
|
|
1787
|
+
* chains: [1, 137, 56]
|
|
1788
|
+
* }
|
|
1789
|
+
* };
|
|
1790
|
+
* const chains = getWalletChains(wallet); // [1, 137, 56]
|
|
1791
|
+
*
|
|
1792
|
+
* // With invalid/missing structure
|
|
1793
|
+
* const invalidWallet = { someOtherProperty: true };
|
|
1794
|
+
* const noChains = getWalletChains(invalidWallet); // undefined
|
|
1795
|
+
*
|
|
1796
|
+
* // Use in conditional logic
|
|
1797
|
+
* const walletChains = getWalletChains(activeWallet);
|
|
1798
|
+
* if (walletChains) {
|
|
1799
|
+
* console.log('Wallet supports chains:', walletChains);
|
|
1800
|
+
* }
|
|
1801
|
+
* ```
|
|
1802
|
+
*
|
|
1803
|
+
* @since 1.0.0
|
|
1504
1804
|
*/
|
|
1505
1805
|
declare function getWalletChains(activeWallet: any): (string | number)[] | undefined;
|
|
1506
1806
|
/**
|
|
1507
|
-
*
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1807
|
+
* Pre-loads blockchain adapters for improved application performance.
|
|
1808
|
+
*
|
|
1809
|
+
* This function should be called during application initialization to load
|
|
1810
|
+
* commonly used adapters ahead of time. This eliminates loading delays when
|
|
1811
|
+
* users first interact with wallet connections.
|
|
1812
|
+
*
|
|
1813
|
+
* All loading operations run concurrently for maximum efficiency, and the
|
|
1814
|
+
* function completes even if some adapters fail to load (partial success).
|
|
1815
|
+
*
|
|
1816
|
+
* @param types - Array of adapter types to preload (defaults to EVM and Solana)
|
|
1817
|
+
* @returns Promise that resolves when all loading attempts complete
|
|
1818
|
+
*
|
|
1819
|
+
* @example
|
|
1820
|
+
* ```typescript
|
|
1821
|
+
* // During app initialization
|
|
1822
|
+
* export async function initializeApp() {
|
|
1823
|
+
* // Preload common adapters
|
|
1824
|
+
* await preloadChainAdapters([OrbitAdapter.EVM, OrbitAdapter.SOLANA]);
|
|
1825
|
+
*
|
|
1826
|
+
* // Continue with other initialization
|
|
1827
|
+
* // ...
|
|
1828
|
+
* }
|
|
1829
|
+
*
|
|
1830
|
+
* // Later usage will be instant for loaded adapters
|
|
1831
|
+
* const evmChains = getChainsListByWalletTypeSync({
|
|
1832
|
+
* walletType: WalletType.EVM_METAMASK,
|
|
1833
|
+
* appChains: configuration
|
|
1834
|
+
* }); // Instant result since adapter is pre-loaded
|
|
1835
|
+
* ```
|
|
1836
|
+
*
|
|
1837
|
+
* @since 1.0.0
|
|
1838
|
+
*/
|
|
1839
|
+
declare function preloadChainAdapters(types?: OrbitAdapter[]): Promise<void>;
|
|
1840
|
+
/**
|
|
1841
|
+
* Gets the current loading status of a specific adapter.
|
|
1842
|
+
*
|
|
1843
|
+
* Returns the current state of an adapter in the loading lifecycle. Useful
|
|
1844
|
+
* for UI indicators, debugging, or conditional logic based on adapter
|
|
1845
|
+
* availability.
|
|
1846
|
+
*
|
|
1847
|
+
* @param type - The adapter type to check
|
|
1848
|
+
* @returns Current loading status of the adapter
|
|
1849
|
+
*
|
|
1850
|
+
* @example
|
|
1851
|
+
* ```typescript
|
|
1852
|
+
* const evmStatus = getAdapterStatus(OrbitAdapter.EVM);
|
|
1853
|
+
*
|
|
1854
|
+
* switch (evmStatus) {
|
|
1855
|
+
* case 'idle':
|
|
1856
|
+
* console.log('EVM adapter not yet requested');
|
|
1857
|
+
* break;
|
|
1858
|
+
* case 'loading':
|
|
1859
|
+
* // Show loading spinner
|
|
1860
|
+
* break;
|
|
1861
|
+
* case 'loaded':
|
|
1862
|
+
* // Enable EVM features
|
|
1863
|
+
* break;
|
|
1864
|
+
* case 'error':
|
|
1865
|
+
* // Show fallback UI
|
|
1866
|
+
* break;
|
|
1867
|
+
* }
|
|
1868
|
+
* ```
|
|
1869
|
+
*
|
|
1870
|
+
* @since 1.0.0
|
|
1871
|
+
*/
|
|
1872
|
+
declare function getAdapterStatus(type: OrbitAdapter): AdapterLoadStatus;
|
|
1873
|
+
/**
|
|
1874
|
+
* Gets comprehensive status information for all registered adapters.
|
|
1875
|
+
*
|
|
1876
|
+
* Returns a complete overview of all adapter states, useful for debugging,
|
|
1877
|
+
* monitoring, or displaying system status in admin interfaces.
|
|
1878
|
+
*
|
|
1879
|
+
* @returns Record mapping adapter types to their current loading status
|
|
1880
|
+
*
|
|
1881
|
+
* @example
|
|
1882
|
+
* ```typescript
|
|
1883
|
+
* const allStatuses = getAllAdaptersStatus();
|
|
1884
|
+
* console.log('System overview:', allStatuses);
|
|
1885
|
+
* // Output: { "evm": "loaded", "solana": "loading", "starknet": "idle" }
|
|
1886
|
+
*
|
|
1887
|
+
* // Use for system health monitoring
|
|
1888
|
+
* const loadedAdapters = Object.entries(allStatuses)
|
|
1889
|
+
* .filter(([_, status]) => status === 'loaded')
|
|
1890
|
+
* .map(([type, _]) => type);
|
|
1891
|
+
*
|
|
1892
|
+
* console.log('Available blockchain support:', loadedAdapters);
|
|
1893
|
+
* ```
|
|
1894
|
+
*
|
|
1895
|
+
* @since 1.0.0
|
|
1896
|
+
*/
|
|
1897
|
+
declare function getAllAdaptersStatus(): Record<string, AdapterLoadStatus>;
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* Generic chain adapter interface that provides blockchain-specific functionality.
|
|
1901
|
+
*
|
|
1902
|
+
* This interface abstracts the differences between various blockchain architectures
|
|
1903
|
+
* (EVM, Solana, Starknet, etc.) while providing a consistent API for chain operations.
|
|
1904
|
+
* Each adapter implementation handles the specifics of its blockchain type.
|
|
1905
|
+
*
|
|
1906
|
+
* @interface ChainAdapter
|
|
1907
|
+
* @since 1.0.0
|
|
1908
|
+
*
|
|
1909
|
+
* @example
|
|
1910
|
+
* ```typescript
|
|
1911
|
+
* // EVM adapter usage
|
|
1912
|
+
* const evmAdapter = await createEvmAdapter();
|
|
1913
|
+
* const evmChains = evmAdapter.getChains([
|
|
1914
|
+
* { id: 1, name: 'Ethereum' },
|
|
1915
|
+
* { id: 137, name: 'Polygon' }
|
|
1916
|
+
* ]);
|
|
1917
|
+
*
|
|
1918
|
+
* // Solana adapter usage
|
|
1919
|
+
* const solanaAdapter = await createSolanaAdapter();
|
|
1920
|
+
* const solanaClusters = solanaAdapter.getChains({
|
|
1921
|
+
* 'mainnet-beta': 'https://api.mainnet-beta.solana.com'
|
|
1922
|
+
* });
|
|
1923
|
+
* ```
|
|
1924
|
+
*/
|
|
1925
|
+
interface ChainAdapter {
|
|
1926
|
+
/**
|
|
1927
|
+
* Extracts chain identifiers from the provided configuration.
|
|
1928
|
+
*
|
|
1929
|
+
* The exact behavior depends on the blockchain type:
|
|
1930
|
+
* - EVM: Extracts numeric chain IDs from chain objects or arrays
|
|
1931
|
+
* - Solana: Extracts cluster names from RPC URL configurations
|
|
1932
|
+
* - Others: Implementation-specific logic
|
|
1933
|
+
*
|
|
1934
|
+
* @param config Chain configuration data (format varies by blockchain)
|
|
1935
|
+
* @param chains Optional array of specific chains to filter or process
|
|
1936
|
+
* @returns Array of chain identifiers (numbers for EVM, strings for Solana)
|
|
1937
|
+
*
|
|
1938
|
+
* @example
|
|
1939
|
+
* ```typescript
|
|
1940
|
+
* // EVM chains
|
|
1941
|
+
* const evmChains = adapter.getChains([
|
|
1942
|
+
* { id: 1, name: 'Ethereum' },
|
|
1943
|
+
* { id: 56, name: 'BSC' }
|
|
1944
|
+
* ]);
|
|
1945
|
+
* // Returns: [1, 56]
|
|
1946
|
+
*
|
|
1947
|
+
* // Solana clusters
|
|
1948
|
+
* const solanaClusters = adapter.getChains({
|
|
1949
|
+
* 'mainnet-beta': 'https://api.mainnet-beta.solana.com',
|
|
1950
|
+
* devnet: 'https://api.devnet.solana.com'
|
|
1951
|
+
* });
|
|
1952
|
+
* // Returns: ['mainnet-beta', 'devnet']
|
|
1953
|
+
* ```
|
|
1954
|
+
*/
|
|
1955
|
+
getChains(config: any, chains?: any): (string | number)[];
|
|
1956
|
+
/**
|
|
1957
|
+
* Validates whether a chain identifier array conforms to this adapter's expected format.
|
|
1958
|
+
*
|
|
1959
|
+
* Different blockchains use different identifier formats:
|
|
1960
|
+
* - EVM: Typically numeric chain IDs (e.g., 1, 137, 56)
|
|
1961
|
+
* - Solana: String cluster names (e.g., 'mainnet-beta', 'devnet')
|
|
1962
|
+
* - Others: Implementation-specific validation rules
|
|
1963
|
+
*
|
|
1964
|
+
* @param chains Array of chain identifiers to validate
|
|
1965
|
+
* @returns True if the chain list format is valid for this blockchain type
|
|
1966
|
+
*
|
|
1967
|
+
* @example
|
|
1968
|
+
* ```typescript
|
|
1969
|
+
* // EVM validation
|
|
1970
|
+
* const evmValid = evmAdapter.isChainList([1, 137, 56]); // true
|
|
1971
|
+
* const evmInvalid = evmAdapter.isChainList(['mainnet']); // false
|
|
1972
|
+
*
|
|
1973
|
+
* // Solana validation
|
|
1974
|
+
* const solanaValid = solanaAdapter.isChainList(['mainnet-beta', 'devnet']); // true
|
|
1975
|
+
* const solanaInvalid = solanaAdapter.isChainList([1, 2]); // false
|
|
1976
|
+
* ```
|
|
1977
|
+
*/
|
|
1978
|
+
isChainList(chains: (string | number)[]): boolean;
|
|
1979
|
+
/**
|
|
1980
|
+
* Gets all available clusters for Solana-based adapters.
|
|
1981
|
+
*
|
|
1982
|
+
* This method is specific to Solana and returns the configured cluster names
|
|
1983
|
+
* that can be used for connections. Not applicable to other blockchain types.
|
|
1984
|
+
*
|
|
1985
|
+
* @returns Array of available cluster names
|
|
1986
|
+
* @optional This method is only available on Solana adapters
|
|
1987
|
+
*
|
|
1988
|
+
* @example
|
|
1989
|
+
* ```typescript
|
|
1990
|
+
* const solanaAdapter = await createSolanaAdapter();
|
|
1991
|
+
* const clusters = solanaAdapter.getAvailableClusters?.();
|
|
1992
|
+
* // Might return: ['mainnet-beta', 'devnet', 'testnet', 'localnet']
|
|
1993
|
+
* ```
|
|
1994
|
+
*/
|
|
1995
|
+
getAvailableClusters?(): string[];
|
|
1996
|
+
/**
|
|
1997
|
+
* Validates whether a cluster name is valid for Solana.
|
|
1998
|
+
*
|
|
1999
|
+
* This method is specific to Solana and checks if the provided cluster name
|
|
2000
|
+
* is a known/valid Solana cluster moniker. Not applicable to other blockchain types.
|
|
2001
|
+
*
|
|
2002
|
+
* @param cluster Cluster name to validate
|
|
2003
|
+
* @returns True if the cluster name is valid for Solana
|
|
2004
|
+
* @optional This method is only available on Solana adapters
|
|
2005
|
+
*
|
|
2006
|
+
* @example
|
|
2007
|
+
* ```typescript
|
|
2008
|
+
* const solanaAdapter = await createSolanaAdapter();
|
|
2009
|
+
* const isValid = solanaAdapter.isValidCluster?.('mainnet-beta'); // true
|
|
2010
|
+
* const isInvalid = solanaAdapter.isValidCluster?.('invalid-cluster'); // false
|
|
2011
|
+
* ```
|
|
2012
|
+
*/
|
|
2013
|
+
isValidCluster?(cluster: string): boolean;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Represents the current loading state of a blockchain adapter.
|
|
2017
|
+
*
|
|
2018
|
+
* The adapter lifecycle progresses through these states:
|
|
2019
|
+
* - `idle`: Adapter hasn't been requested yet
|
|
2020
|
+
* - `loading`: Adapter is currently being loaded/initialized
|
|
2021
|
+
* - `loaded`: Adapter is successfully loaded and ready for use
|
|
2022
|
+
* - `error`: Adapter failed to load due to missing dependencies or errors
|
|
2023
|
+
*
|
|
2024
|
+
* @type AdapterLoadStatus
|
|
2025
|
+
* @since 1.0.0
|
|
2026
|
+
*
|
|
2027
|
+
* @example
|
|
2028
|
+
* ```typescript
|
|
2029
|
+
* import { adapterRegistry } from './registry';
|
|
2030
|
+
*
|
|
2031
|
+
* const status = adapterRegistry.getAdapterStatus(OrbitAdapter.EVM);
|
|
2032
|
+
*
|
|
2033
|
+
* switch (status) {
|
|
2034
|
+
* case 'idle':
|
|
2035
|
+
* console.log('EVM adapter not yet requested');
|
|
2036
|
+
* break;
|
|
2037
|
+
* case 'loading':
|
|
2038
|
+
* console.log('EVM adapter is loading...');
|
|
2039
|
+
* break;
|
|
2040
|
+
* case 'loaded':
|
|
2041
|
+
* console.log('EVM adapter ready for use');
|
|
2042
|
+
* break;
|
|
2043
|
+
* case 'error':
|
|
2044
|
+
* console.log('EVM adapter failed to load');
|
|
2045
|
+
* break;
|
|
2046
|
+
* }
|
|
2047
|
+
* ```
|
|
2048
|
+
*/
|
|
2049
|
+
type AdapterLoadStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
2050
|
+
/**
|
|
2051
|
+
* Complete information about an adapter's loading state and instance.
|
|
2052
|
+
*
|
|
2053
|
+
* This interface tracks both the loading status and the actual adapter instance
|
|
2054
|
+
* (if successfully loaded), along with any error information if loading failed.
|
|
1510
2055
|
*
|
|
1511
|
-
* @
|
|
1512
|
-
* @
|
|
2056
|
+
* @interface AdapterInfo
|
|
2057
|
+
* @since 1.0.0
|
|
2058
|
+
*
|
|
2059
|
+
* @example
|
|
2060
|
+
* ```typescript
|
|
2061
|
+
* // Internal registry usage (not typically used directly)
|
|
2062
|
+
* const adapterInfo: AdapterInfo = {
|
|
2063
|
+
* status: 'loaded',
|
|
2064
|
+
* adapter: evmAdapterInstance
|
|
2065
|
+
* };
|
|
2066
|
+
*
|
|
2067
|
+
* // Error case
|
|
2068
|
+
* const errorInfo: AdapterInfo = {
|
|
2069
|
+
* status: 'error',
|
|
2070
|
+
* error: new Error('EVM utilities not available')
|
|
2071
|
+
* };
|
|
2072
|
+
* ```
|
|
1513
2073
|
*/
|
|
1514
|
-
|
|
2074
|
+
interface AdapterInfo {
|
|
2075
|
+
/** Current loading status of the adapter */
|
|
2076
|
+
status: AdapterLoadStatus;
|
|
2077
|
+
/** The loaded adapter instance (only present when status is 'loaded') */
|
|
2078
|
+
adapter?: ChainAdapter;
|
|
2079
|
+
/** Error information (only present when status is 'error') */
|
|
2080
|
+
error?: Error;
|
|
2081
|
+
}
|
|
1515
2082
|
|
|
1516
2083
|
/**
|
|
1517
2084
|
* Gets the appropriate chain ID for connecting based on the selected adapter.
|
|
@@ -1541,6 +2108,19 @@ interface GroupedConnector {
|
|
|
1541
2108
|
adapter: OrbitAdapter;
|
|
1542
2109
|
})[];
|
|
1543
2110
|
}
|
|
2111
|
+
interface GetGroupedConnectorsParams {
|
|
2112
|
+
connectors: Partial<Record<OrbitAdapter, Connector$1[]>>;
|
|
2113
|
+
excludeConnectors?: string[];
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Groups wallet connectors by their formatted names across different adapters.
|
|
2117
|
+
* Filters out specified excluded connectors (like 'injected' wallets).
|
|
2118
|
+
*/
|
|
2119
|
+
declare function getGroupedConnectors({ connectors, excludeConnectors }?: GetGroupedConnectorsParams): GroupedConnector[];
|
|
2120
|
+
/**
|
|
2121
|
+
* Quick helper to check if connectors are available
|
|
2122
|
+
*/
|
|
2123
|
+
declare function hasAvailableConnectors(connectors: Partial<Record<OrbitAdapter, Connector$1[]>>): boolean;
|
|
1544
2124
|
|
|
1545
2125
|
interface GetFilteredConnectorsParams {
|
|
1546
2126
|
connectors: Partial<Record<OrbitAdapter, Connector$1[]>>;
|
|
@@ -1593,15 +2173,256 @@ declare const networksLinks: Partial<Record<OrbitAdapter, {
|
|
|
1593
2173
|
about: string;
|
|
1594
2174
|
}>>;
|
|
1595
2175
|
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
2176
|
+
/**
|
|
2177
|
+
* @fileoverview Central export hub for blockchain utility functions and types.
|
|
2178
|
+
*
|
|
2179
|
+
* This module provides a unified interface for accessing blockchain-related utilities,
|
|
2180
|
+
* offering both synchronous and asynchronous versions of functions to support different
|
|
2181
|
+
* usage patterns and performance requirements.
|
|
2182
|
+
*
|
|
2183
|
+
* Export Strategy:
|
|
2184
|
+
* - Synchronous functions by default for backward compatibility
|
|
2185
|
+
* - Asynchronous versions with "Async" suffix for better performance
|
|
2186
|
+
* - Adapter management functions for system control
|
|
2187
|
+
* - Type exports for TypeScript integration
|
|
2188
|
+
*
|
|
2189
|
+
* @example
|
|
2190
|
+
* ```typescript
|
|
2191
|
+
* // Import synchronous version (backward compatible)
|
|
2192
|
+
* import { getChainsListByWalletType, isEvmChainList } from './utils';
|
|
2193
|
+
*
|
|
2194
|
+
* // Import asynchronous version (better performance)
|
|
2195
|
+
* import {
|
|
2196
|
+
* getChainsListByWalletTypeAsync,
|
|
2197
|
+
* isEvmChainListAsync
|
|
2198
|
+
* } from './utils';
|
|
2199
|
+
*
|
|
2200
|
+
* // Import adapter management
|
|
2201
|
+
* import { preloadChainAdapters, getAdapterStatus } from './utils';
|
|
2202
|
+
*
|
|
2203
|
+
* // Import types
|
|
2204
|
+
* import type { ChainAdapter, AdapterLoadStatus } from './utils';
|
|
2205
|
+
* ```
|
|
2206
|
+
*
|
|
2207
|
+
* @since 1.0.0
|
|
2208
|
+
*/
|
|
2209
|
+
/**
|
|
2210
|
+
* Re-export all functions from the main chain utilities module.
|
|
2211
|
+
* This includes both sync and async versions with proper naming.
|
|
2212
|
+
*/
|
|
2213
|
+
|
|
2214
|
+
/**
|
|
2215
|
+
* Synchronous fallback for getting available Solana clusters.
|
|
2216
|
+
*
|
|
2217
|
+
* This function provides immediate results but with limited functionality.
|
|
2218
|
+
* It serves as a compatibility layer for synchronous contexts where the
|
|
2219
|
+
* async version cannot be used.
|
|
2220
|
+
*
|
|
2221
|
+
* @returns Empty array with warning (use async version for real results)
|
|
2222
|
+
*
|
|
2223
|
+
* @example
|
|
2224
|
+
* ```typescript
|
|
2225
|
+
* // Synchronous fallback (limited functionality)
|
|
2226
|
+
* const clusters = getAvailableSolanaClusters(); // []
|
|
2227
|
+
*
|
|
2228
|
+
* // Preferred async version (full functionality)
|
|
2229
|
+
* const clustersAsync = await getAvailableSolanaClustersAsync();
|
|
2230
|
+
* ```
|
|
2231
|
+
*
|
|
2232
|
+
* @since 1.0.0
|
|
2233
|
+
* @deprecated Use getAvailableSolanaClustersAsync for full functionality
|
|
2234
|
+
*/
|
|
2235
|
+
declare function getAvailableSolanaClusters(): string[];
|
|
2236
|
+
/**
|
|
2237
|
+
* Synchronous fallback for Solana cluster validation.
|
|
2238
|
+
*
|
|
2239
|
+
* This function provides basic validation against known cluster names but
|
|
2240
|
+
* lacks the comprehensive validation logic of the async version. It performs
|
|
2241
|
+
* a simple lookup against standard Solana cluster monikers.
|
|
2242
|
+
*
|
|
2243
|
+
* @param cluster - Cluster name to validate
|
|
2244
|
+
* @returns True if cluster name matches known standard clusters
|
|
2245
|
+
*
|
|
2246
|
+
* @example
|
|
2247
|
+
* ```typescript
|
|
2248
|
+
* // Synchronous fallback (basic validation)
|
|
2249
|
+
* const isValid = isValidSolanaCluster('mainnet-beta'); // true
|
|
2250
|
+
* const isCustom = isValidSolanaCluster('custom-cluster'); // false
|
|
2251
|
+
*
|
|
2252
|
+
* // Preferred async version (comprehensive validation)
|
|
2253
|
+
* const isValidAsync = await isValidSolanaClusterAsync('custom-cluster');
|
|
2254
|
+
* ```
|
|
2255
|
+
*
|
|
2256
|
+
* @since 1.0.0
|
|
2257
|
+
* @deprecated Use isValidSolanaClusterAsync for comprehensive validation
|
|
2258
|
+
*/
|
|
2259
|
+
declare function isValidSolanaCluster(cluster: string): boolean;
|
|
2260
|
+
|
|
2261
|
+
/**
|
|
2262
|
+
* Information about available blockchain-specific utilities and their status.
|
|
2263
|
+
*
|
|
2264
|
+
* @interface BlockchainUtilities
|
|
2265
|
+
* @since 1.0.0
|
|
2266
|
+
*
|
|
2267
|
+
* @example
|
|
2268
|
+
* ```typescript
|
|
2269
|
+
* const utilities = await getBlockchainUtilities();
|
|
2270
|
+
*
|
|
2271
|
+
* if (utilities.hasEvmUtils) {
|
|
2272
|
+
* console.log('EVM utilities are available');
|
|
2273
|
+
* }
|
|
2274
|
+
*
|
|
2275
|
+
* console.log('Adapter statuses:', utilities.adaptersStatus);
|
|
2276
|
+
* ```
|
|
2277
|
+
*/
|
|
2278
|
+
interface BlockchainUtilities {
|
|
2279
|
+
/** Whether EVM utilities are available and loaded */
|
|
2280
|
+
hasEvmUtils: boolean;
|
|
2281
|
+
/** Whether Solana utilities are available and loaded */
|
|
2282
|
+
hasSolanaUtils: boolean;
|
|
2283
|
+
/** Current loading status of all registered adapters */
|
|
2284
|
+
adaptersStatus: Record<string, string>;
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Gets comprehensive information about available blockchain utilities and their loading status.
|
|
2288
|
+
* This function dynamically checks which blockchain adapters are available and their current state.
|
|
2289
|
+
*
|
|
2290
|
+
* @returns Promise resolving to blockchain utilities information
|
|
2291
|
+
*
|
|
2292
|
+
* @example
|
|
2293
|
+
* ```typescript
|
|
2294
|
+
* // Check what's available in your current setup
|
|
2295
|
+
* const info = await getBlockchainUtilities();
|
|
2296
|
+
*
|
|
2297
|
+
* if (info.hasEvmUtils && info.hasSolanaUtils) {
|
|
2298
|
+
* console.log('Full multi-chain support available');
|
|
2299
|
+
* } else {
|
|
2300
|
+
* console.log('Limited blockchain support:', info.adaptersStatus);
|
|
2301
|
+
* }
|
|
2302
|
+
* ```
|
|
2303
|
+
*
|
|
2304
|
+
* @since 1.0.0
|
|
2305
|
+
*/
|
|
2306
|
+
declare function getBlockchainUtilities(): Promise<BlockchainUtilities>;
|
|
2307
|
+
/**
|
|
2308
|
+
* Result type for blockchain utility loading operations.
|
|
2309
|
+
*
|
|
2310
|
+
* @template T The type of utilities being loaded
|
|
2311
|
+
*
|
|
2312
|
+
* @since 1.0.0
|
|
2313
|
+
*/
|
|
2314
|
+
type BlockchainUtilityResult<T = any> = ({
|
|
2315
|
+
available: true;
|
|
2316
|
+
} & T) | {
|
|
2317
|
+
available: false;
|
|
2318
|
+
error: string;
|
|
2319
|
+
};
|
|
2320
|
+
/**
|
|
2321
|
+
* Dynamically loads EVM utilities if available in the current environment.
|
|
2322
|
+
* Returns the utilities along with their availability status.
|
|
2323
|
+
*
|
|
2324
|
+
* @returns Promise resolving to EVM utilities or error information
|
|
2325
|
+
*
|
|
2326
|
+
* @example
|
|
2327
|
+
* ```typescript
|
|
2328
|
+
* const evmUtils = await getEvmUtils();
|
|
2329
|
+
*
|
|
2330
|
+
* if (evmUtils.available) {
|
|
2331
|
+
* // Use EVM-specific functions
|
|
2332
|
+
* const chains = evmUtils.getEvmChains(appChains);
|
|
2333
|
+
* console.log('Available EVM chains:', chains);
|
|
2334
|
+
* } else {
|
|
2335
|
+
* console.warn('EVM not supported:', evmUtils.error);
|
|
2336
|
+
* }
|
|
2337
|
+
* ```
|
|
2338
|
+
*
|
|
2339
|
+
* @since 1.0.0
|
|
2340
|
+
*/
|
|
2341
|
+
declare function getEvmUtils(): Promise<BlockchainUtilityResult>;
|
|
2342
|
+
/**
|
|
2343
|
+
* Dynamically loads Solana utilities if available in the current environment.
|
|
2344
|
+
* Returns the utilities along with their availability status.
|
|
2345
|
+
*
|
|
2346
|
+
* @returns Promise resolving to Solana utilities or error information
|
|
2347
|
+
*
|
|
2348
|
+
* @example
|
|
2349
|
+
* ```typescript
|
|
2350
|
+
* const solanaUtils = await getSolanaUtils();
|
|
2351
|
+
*
|
|
2352
|
+
* if (solanaUtils.available) {
|
|
2353
|
+
* // Use Solana-specific functions
|
|
2354
|
+
* const clusters = solanaUtils.getSolanaClusters(rpcUrls);
|
|
2355
|
+
* console.log('Available Solana clusters:', clusters);
|
|
2356
|
+
* } else {
|
|
2357
|
+
* console.warn('Solana not supported:', solanaUtils.error);
|
|
2358
|
+
* }
|
|
2359
|
+
* ```
|
|
2360
|
+
*
|
|
2361
|
+
* @since 1.0.0
|
|
2362
|
+
*/
|
|
2363
|
+
declare function getSolanaUtils(): Promise<BlockchainUtilityResult>;
|
|
2364
|
+
/**
|
|
2365
|
+
* Result of blockchain support initialization.
|
|
2366
|
+
*
|
|
2367
|
+
* @interface InitializationResult
|
|
2368
|
+
* @since 1.0.0
|
|
2369
|
+
*/
|
|
2370
|
+
interface InitializationResult {
|
|
2371
|
+
/** Whether EVM support was successfully initialized */
|
|
2372
|
+
evm: boolean;
|
|
2373
|
+
/** Whether Solana support was successfully initialized */
|
|
2374
|
+
solana: boolean;
|
|
2375
|
+
/** Array of error messages encountered during initialization */
|
|
2376
|
+
errors: string[];
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Preloads and initializes all available blockchain adapters.
|
|
2380
|
+
* This function should be called during application startup for optimal performance.
|
|
2381
|
+
* It attempts to load both EVM and Solana adapters and reports which ones are available.
|
|
2382
|
+
*
|
|
2383
|
+
* @returns Promise resolving to initialization results
|
|
2384
|
+
*
|
|
2385
|
+
* @example
|
|
2386
|
+
* ```typescript
|
|
2387
|
+
* // Call during app initialization
|
|
2388
|
+
* const initResult = await initializeBlockchainSupport();
|
|
2389
|
+
*
|
|
2390
|
+
* if (initResult.evm && initResult.solana) {
|
|
2391
|
+
* console.log('Full blockchain support initialized');
|
|
2392
|
+
* } else {
|
|
2393
|
+
* console.log('Partial support:', initResult);
|
|
2394
|
+
* if (initResult.errors.length > 0) {
|
|
2395
|
+
* console.warn('Initialization errors:', initResult.errors);
|
|
2396
|
+
* }
|
|
2397
|
+
* }
|
|
2398
|
+
* ```
|
|
2399
|
+
*
|
|
2400
|
+
* @since 1.0.0
|
|
2401
|
+
*/
|
|
2402
|
+
declare function initializeBlockchainSupport(): Promise<InitializationResult>;
|
|
2403
|
+
/**
|
|
2404
|
+
* Checks whether a specific blockchain adapter is supported in the current environment.
|
|
2405
|
+
* This function performs runtime checks to determine adapter availability.
|
|
2406
|
+
*
|
|
2407
|
+
* @param adapter The blockchain adapter to check for support
|
|
2408
|
+
* @returns Promise resolving to true if the adapter is supported
|
|
2409
|
+
*
|
|
2410
|
+
* @example
|
|
2411
|
+
* ```typescript
|
|
2412
|
+
* // Check individual adapter support
|
|
2413
|
+
* const evmSupported = await isAdapterSupported(OrbitAdapter.EVM);
|
|
2414
|
+
* const solanaSupported = await isAdapterSupported(OrbitAdapter.SOLANA);
|
|
2415
|
+
* const starknetSupported = await isAdapterSupported(OrbitAdapter.Starknet);
|
|
2416
|
+
*
|
|
2417
|
+
* console.log('Adapter support:', {
|
|
2418
|
+
* evm: evmSupported,
|
|
2419
|
+
* solana: solanaSupported,
|
|
2420
|
+
* starknet: starknetSupported, // Currently always false
|
|
2421
|
+
* });
|
|
2422
|
+
* ```
|
|
2423
|
+
*
|
|
2424
|
+
* @since 1.0.0
|
|
2425
|
+
*/
|
|
2426
|
+
declare function isAdapterSupported(adapter: OrbitAdapter): Promise<boolean>;
|
|
1606
2427
|
|
|
1607
|
-
export { AboutWallets, type AllChainConfigs, type AllConnectors, type AllWallets, type ChainIdentifierArray, ChainListRenderer, ChainSelector, ConnectButton, type ConnectButtonProps, ConnectCard, ConnectedContent, ConnectedModal, ConnectedModalFooter, ConnectedModalMainContent, type ConnectedModalMainContentProps, ConnectedModalNameAndBalance, ConnectedModalTxHistory, Connecting, type Connector, ConnectorsBlock, ConnectorsSelections, type ConnectorsSelectionsProps, Disclaimer,
|
|
2428
|
+
export { AboutWallets, type AdapterInfo, type AdapterLoadStatus, type AllChainConfigs, type AllConnectors, type AllWallets, type BlockchainUtilities, type BlockchainUtilityResult, type ChainAdapter, type ChainIdentifierArray, ChainListRenderer, ChainSelector, ConnectButton, type ConnectButtonProps, ConnectCard, ConnectedContent, ConnectedModal, ConnectedModalFooter, ConnectedModalMainContent, type ConnectedModalMainContentProps, ConnectedModalNameAndBalance, ConnectedModalTxHistory, Connecting, type Connector, ConnectorsBlock, ConnectorsSelections, type ConnectorsSelectionsProps, Disclaimer, GetWallet, type GroupedConnector, IconButton, ImpersonateForm, type InitialChains, type InitializationResult, NetworkSelections, NetworkTabs, type NovaConnectLabels, RecentBadge, ScrollableChainList, SelectContentAnimated, StatusIcon, ToBottomButton, ToTopButton, ToastError, WaitForConnectionContent, type Wallet, WalletAvatar, type WalletAvatarProps, WalletIcon, defaultLabels, getAdapterStatus, getAllAdaptersStatus, getAvailableChainIds, getAvailableSolanaClusters, getAvailableSolanaClusters$1 as getAvailableSolanaClustersAsync, getBlockchainUtilities, getChainsListByWalletTypeSync as getChainsListByWalletType, getChainsListByWalletType as getChainsListByWalletTypeAsync, getChainsListByWalletTypeSync, getConnectChainId, getEvmUtils, getFilteredConnectors, getGroupedConnectors, getNetworkIcon, getSolanaUtils, getWalletChains, hasAvailableConnectors, hasConnectorsForAdapter, initializeBlockchainSupport, isAdapterSupported, isEvmChainListSync as isEvmChainList, isEvmChainList as isEvmChainListAsync, isEvmChainListSync, isSolanaChainListSync as isSolanaChainList, isSolanaChainList as isSolanaChainListAsync, isSolanaChainListSync, isTouchDevice, isValidSolanaCluster, isValidSolanaCluster$1 as isValidSolanaClusterAsync, networksLinks, preloadChainAdapters, ukrainianLabels };
|