A powerful, framework-agnostic library for seamless multi-chain blockchain interactions, providing a unified interface for EVM, and Solana operations.
- Multi-Chain Architecture: Provides a consistent API for interacting with EVM, Solana, and potentially other blockchains through a flexible adapter system.
- Simplified UI Development: Offers utilities specifically designed to make building web3 user interfaces easier and faster.
- Framework Agnostic: Use Orbit Utils with your favorite framework (React, Vue, Svelte, Angular, etc.) or even vanilla JavaScript.
- Type-Safe: Fully written in TypeScript for enhanced developer experience and fewer runtime errors.
- Modular Packages: Includes separate packages for core logic and chain-specific implementations (EVM, Solana).
- Optimized Performance: Minimal overhead for blockchain operations.
- Robust Error Handling: Comprehensive error management across different chains.
# Using pnpm (recommended), but you can use npm, yarn or bun as well
pnpm add @tuwaio/orbit-core
# Add chain-specific adapters as needed
pnpm add @tuwaio/orbit-evm @wagmi/core viem
pnpm add @tuwaio/orbit-solana gill @wallet-standard/app @wallet-standard/ui-core @wallet-standard/ui-registryimport { OrbitAdapter, selectAdapterByKey } from '@tuwaio/orbit-core';
// Example adapter configuration (replace with actual implementations)
const adapters = [
{ key: OrbitAdapter.EVM, /* ...EVM specific implementation */ },
{ key: OrbitAdapter.SOLANA, /* ...Solana specific implementation */ }
];
// Select the EVM adapter based on its key
const evmAdapter = selectAdapterByKey({
adapterKey: OrbitAdapter.EVM,
adapter: adapters,
});
if (evmAdapter) {
console.log('EVM Adapter selected:', evmAdapter);
// Now you can use evmAdapter for EVM-specific operations
} else {
console.error('EVM Adapter not found or configured.');
}
// Select the Solana adapter
const solanaAdapter = selectAdapterByKey({
adapterKey: OrbitAdapter.SOLANA,
adapter: adapters,
});
if (solanaAdapter) {
console.log('Solana Adapter selected:', solanaAdapter);
// Use solanaAdapter for Solana operations
} else {
console.error('Solana Adapter not found or configured.');
}Note: The adapter objects in this example are placeholders. You need to provide the actual adapter implementations based on @tuwaio/orbit-evm, @tuwaio/orbit-solana, or your custom adapters.
The OrbitAdapter enum defines the core supported blockchain architectures:
import { OrbitAdapter } from '@tuwaio/orbit-core';
console.log(OrbitAdapter.EVM); // 'evm' - For Ethereum, Polygon, BSC, etc.
console.log(OrbitAdapter.SOLANA); // 'solana' - For Solana blockchain
console.log(OrbitAdapter.Starknet); // 'starknet' - For Starknet L2Orbit Utils is built on these main concepts:
- Adapters: Chain-specific implementations that handle blockchain interactions.
- Type System: Comprehensive TypeScript definitions for type-safe development.
- Utilities: Helper functions for common blockchain operations and UI tasks.
OrbitAdapter: Enum defining supported blockchain types (EVM, Solana, Starknet).selectAdapterByKey: Utility for runtime adapter selection based on theOrbitAdapterkey.- Various type definitions (
BaseAdapter,ConnectorType, etc.). - Helper functions for formatting, storage management (
lastConnectedConnectorHelpers,impersonatedHelpers), and general utilities (delay,filterUniqueByKey, etc.).
@tuwaio/orbit-evm: Provides EVM utilities like chain switching (checkAndSwitchChain), Viem client creation (createViemClient), and ENS interactions (getName,getAvatar,getAddress,isEnsName).@tuwaio/orbit-solana: Offers Solana utilities such as RPC client creation with caching (createSolanaClientWithCache,createSolanaRPC), connector discovery (getAvailableConnectors,getConnectedSolanaConnector), name/avatar resolution (getSolanaAddressName,getSolanaAddressAvatar), and explorer link generation (getSolanaExplorerLink).
The Orbit ecosystem consists of several modular packages:
@tuwaio/orbit-core: The foundation providing core functionality, types, and the adapter system.@tuwaio/orbit-evm: EVM-specific helpers and utilities.@tuwaio/orbit-solana: Solana blockchain helpers and utilities.
Each package serves a specific purpose while maintaining modularity and flexibility, allowing developers to import only what they need.
Contributions are welcome! Please read our main Contribution Guidelines.
If you find this library useful, please consider supporting its development. Every contribution helps!
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
