|
1 | | -<a href="https://rainbowkit.com"> |
2 | | - <img alt="rainbowkit" src="https://user-images.githubusercontent.com/372831/168174718-685980e0-391e-4621-94a1-29bf83979fa5.png" /> |
3 | | -</a> |
| 1 | +# Nexum-Kit 🔗 |
4 | 2 |
|
5 | | -# RainbowKit [](https://www.npmjs.com/package/@rainbow-me/rainbowkit) [](https://deepwiki.com/rainbow-me/rainbowkit) |
| 3 | +> **⚠️ WORK IN PROGRESS**: This repository is undergoing an active migration from TypeScript/React to Rust/Leptos. The Rust implementation is functional but not feature-complete. See [Migration Status](#migration-status) below. |
6 | 4 |
|
7 | | -**The best way to connect a wallet 🌈** |
| 5 | +**Type-safe Web3 wallet connections for Rust/Leptos** |
8 | 6 |
|
9 | | -RainbowKit is a [React](https://reactjs.org/) library that makes it easy to add wallet connection to your dapp. |
| 7 | +Nexum-Kit is a Rust/WASM port of [RainbowKit](https://github.com/rainbow-me/rainbowkit), providing type-safe, developer-friendly wallet connection components for Leptos applications. Built on [Alloy](https://github.com/alloy-rs/alloy) and EIP-1193, Nexum-Kit brings Rust's type safety and performance to Web3 dApp development. |
10 | 8 |
|
11 | | -- 🔥 Out-of-the-box wallet management |
12 | | -- ✅ Easily customizable |
13 | | -- 🦄 Built on top of [wagmi](https://wagmi.sh) and [viem](https://viem.sh) |
| 9 | +**nexum** (Latin): bond, connection, obligation |
14 | 10 |
|
15 | | -## Quick start |
| 11 | +## Features |
16 | 12 |
|
17 | | -You can scaffold a new RainbowKit + [wagmi](https://wagmi.sh) + [Next.js](https://nextjs.org) app with one of the following commands, using your package manager of choice: |
| 13 | +- 🦀 **Type-Safe**: Leverage Rust's type system for compile-time safety |
| 14 | +- ⚡ **Performance**: WASM-compiled for near-native browser performance |
| 15 | +- 🔌 **EIP-1193 Native**: First-class browser wallet integration |
| 16 | +- 🎨 **Themeable**: Customizable UI components with multiple built-in themes |
| 17 | +- 🌐 **Multi-Chain**: Support for Ethereum and EVM-compatible chains |
| 18 | +- 📦 **Modular**: Use what you need - from full UI kit to low-level primitives |
18 | 19 |
|
19 | | -```bash |
20 | | -npm init @rainbow-me/rainbowkit@latest |
21 | | -# or |
22 | | -pnpm create @rainbow-me/rainbowkit@latest |
23 | | -# or |
24 | | -yarn create @rainbow-me/rainbowkit |
25 | | -``` |
| 20 | +## Architecture |
26 | 21 |
|
27 | | -## Documentation |
| 22 | +Nexum-Kit consists of two main crates: |
28 | 23 |
|
29 | | -For full documentation, visit [rainbowkit.com](https://rainbowkit.com). |
| 24 | +### `nexum-kit` (AGPL-3.0) |
| 25 | +Leptos component library providing: |
| 26 | +- Wallet connection UI components |
| 27 | +- Account management modals |
| 28 | +- Chain switching interfaces |
| 29 | +- Themed, customizable design system |
30 | 30 |
|
31 | | -### Try it out |
| 31 | +### `alloy-eip1193` (MIT) |
| 32 | +Low-level Alloy integration providing: |
| 33 | +- EIP-1193 transport layer for browser wallets |
| 34 | +- Type-safe error handling for wallet operations |
| 35 | +- Provider and signer implementations |
| 36 | +- Wallet discovery via EIP-6963 |
32 | 37 |
|
33 | | -You can use the CodeSandbox links below to try out RainbowKit: |
| 38 | +## Quick Start |
34 | 39 |
|
35 | | -- with [Create React App](https://codesandbox.io/p/sandbox/github/rainbow-me/rainbowkit/tree/main/examples/with-create-react-app) |
36 | | -- with [Next.js](https://codesandbox.io/p/sandbox/github/rainbow-me/rainbowkit/tree/main/examples/with-next) |
37 | | -- with [Next.js App Router](https://codesandbox.io/p/sandbox/github/rainbow-me/rainbowkit/tree/main/examples/with-next-app) |
38 | | -- with [Remix](https://codesandbox.io/p/sandbox/github/rainbow-me/rainbowkit/tree/main/examples/with-remix) |
39 | | -- with [Vite](https://codesandbox.io/p/sandbox/github/rainbow-me/rainbowkit/tree/main/examples/with-vite) |
40 | | -- with [React Router](https://codesandbox.io/p/sandbox/github/rainbow-me/rainbowkit/tree/main/examples/with-react-router) |
| 40 | +### Installation |
41 | 41 |
|
42 | | -## Examples |
| 42 | +Add Nexum-Kit to your `Cargo.toml`: |
| 43 | + |
| 44 | +```toml |
| 45 | +[dependencies] |
| 46 | +nexum-kit = { git = "https://github.com/nxm-rs/nexum-kit" } |
| 47 | +alloy = { version = "1.1", features = ["provider-http", "signer-local"] } |
| 48 | +leptos = "0.8" |
| 49 | +``` |
43 | 50 |
|
44 | | -The following examples are provided in the [examples](./examples/) folder of this repo. |
| 51 | +### Basic Usage |
45 | 52 |
|
46 | | -- `with-create-react-app` |
47 | | -- `with-next` |
48 | | -- `with-next-app` |
49 | | -- `with-next-custom-button` |
50 | | -- `with-next-mint-nft` |
51 | | -- `with-next-siwe-next-auth` |
52 | | -- `with-next-siwe-iron-session` |
53 | | -- `with-remix` |
54 | | -- `with-vite` |
55 | | -- `with-react-router` |
| 53 | +```rust |
| 54 | +use leptos::*; |
| 55 | +use nexum_kit::prelude::*; |
| 56 | +use nexum_kit::components::modals::ConnectModal; |
56 | 57 |
|
57 | | -### Running examples |
| 58 | +#[component] |
| 59 | +pub fn App() -> impl IntoView { |
| 60 | + view! { |
| 61 | + <ConnectModal /> |
| 62 | + <YourDappComponents /> |
| 63 | + } |
| 64 | +} |
| 65 | +``` |
58 | 66 |
|
59 | | -To run an example locally, install dependencies. |
| 67 | +### Connect to a Wallet |
60 | 68 |
|
61 | | -```bash |
62 | | -pnpm install |
| 69 | +```rust |
| 70 | +use alloy_eip1193::prelude::*; |
| 71 | +use alloy::providers::RootProvider; |
| 72 | + |
| 73 | +// Create provider from browser wallet |
| 74 | +let transport = Eip1193Transport::client_from_window()?; |
| 75 | +let provider = RootProvider::new(transport); |
| 76 | + |
| 77 | +// Request account access |
| 78 | +let accounts = provider.request_accounts().await?; |
| 79 | + |
| 80 | +// Send transactions |
| 81 | +let tx = TransactionRequest::default() |
| 82 | + .to(address!("0x...")) |
| 83 | + .value(U256::from(1000000000000000000u64)); |
| 84 | + |
| 85 | +let pending = provider.send_transaction(tx).await?; |
63 | 86 | ``` |
64 | 87 |
|
65 | | -Then go into an example directory, eg: `with-next`. |
| 88 | +## Migration Status |
| 89 | + |
| 90 | +### ✅ Completed |
| 91 | +- [x] EIP-1193 transport layer and error handling |
| 92 | +- [x] Basic wallet connection flow |
| 93 | +- [x] Account display and management |
| 94 | +- [x] EIP-6963 wallet discovery |
| 95 | +- [x] Multi-chain support (chain switching) |
| 96 | +- [x] Transaction sending with error handling |
| 97 | +- [x] Theme system (Light, Dark, Midnight) |
| 98 | + |
| 99 | +### 🚧 In Progress |
| 100 | +- [ ] Complete component library parity with RainbowKit |
| 101 | +- [ ] Wallet connection persistence |
| 102 | +- [ ] Advanced chain configuration |
| 103 | +- [ ] Sign-In with Ethereum (SIWE) integration |
| 104 | +- [ ] Comprehensive documentation |
| 105 | +- [ ] Example applications |
| 106 | + |
| 107 | +### 📋 Planned |
| 108 | +- [ ] Additional wallet connectors |
| 109 | +- [ ] WalletConnect integration |
| 110 | +- [ ] Mobile wallet support |
| 111 | +- [ ] Testing suite |
| 112 | +- [ ] Performance optimizations |
| 113 | + |
| 114 | +## Examples |
| 115 | + |
| 116 | +See the [`examples/basic/`](./examples/basic/) directory for a working example application. |
| 117 | + |
| 118 | +To run the example: |
66 | 119 |
|
67 | 120 | ```bash |
68 | | -cd examples/with-next |
| 121 | +cd examples/basic |
| 122 | +trunk serve |
69 | 123 | ``` |
70 | 124 |
|
71 | | -Then run the dev script. |
| 125 | +Then open http://localhost:8080 in your browser with a Web3 wallet installed (MetaMask, Coinbase Wallet, etc.). |
| 126 | + |
| 127 | +## Development |
| 128 | + |
| 129 | +### Prerequisites |
| 130 | + |
| 131 | +- Rust 1.75+ |
| 132 | +- wasm32-unknown-unknown target |
| 133 | +- trunk for WASM development |
| 134 | + |
| 135 | +### Building |
72 | 136 |
|
73 | 137 | ```bash |
74 | | -pnpm run dev |
| 138 | +# Install trunk |
| 139 | +cargo install trunk |
| 140 | + |
| 141 | +# Build all crates |
| 142 | +cargo build --target wasm32-unknown-unknown |
| 143 | + |
| 144 | +# Run example |
| 145 | +cd examples/basic && trunk serve |
75 | 146 | ``` |
76 | 147 |
|
| 148 | +## Dual Licensing |
| 149 | + |
| 150 | +This repository contains code under multiple licenses: |
| 151 | + |
| 152 | +- **`nexum-kit`** (Rust/Leptos components): **AGPL-3.0-or-later** |
| 153 | + - Ensures derivative works remain open source |
| 154 | + - See [`crates/nexum-kit/LICENSE-AGPL`](./crates/nexum-kit/LICENSE-AGPL) |
| 155 | + |
| 156 | +- **`alloy-eip1193`** (Alloy integration): **MIT** |
| 157 | + - Enables broader adoption and upstream contributions |
| 158 | + - See [`crates/alloy-eip1193/LICENSE-MIT`](./crates/alloy-eip1193/LICENSE-MIT) |
| 159 | + |
| 160 | +- **TypeScript/React packages**: **MIT** (Original RainbowKit) |
| 161 | + - In transition - not actively maintained |
| 162 | + |
| 163 | +See [`LICENSE`](./LICENSE) for complete licensing details and [`NOTICE`](./NOTICE) for attribution. |
| 164 | + |
| 165 | +## Attribution |
| 166 | + |
| 167 | +Nexum-Kit is a derivative work based on [RainbowKit](https://github.com/rainbow-me/rainbowkit) by [Rainbow](https://rainbow.me). We are grateful to the Rainbow team for their excellent work on the original project. This Rust/Leptos port reimplements RainbowKit's functionality using Rust, WASM, and the Alloy library ecosystem. |
| 168 | + |
77 | 169 | ## Contributing |
78 | 170 |
|
79 | | -Please follow our [contributing guidelines](/.github/CONTRIBUTING.md). |
| 171 | +Contributions are welcome! Please note the dual-licensing structure: |
80 | 172 |
|
81 | | -## License |
| 173 | +- Contributions to `nexum-kit/` fall under AGPL-3.0-or-later |
| 174 | +- Contributions to `alloy-eip1193/` fall under MIT |
| 175 | + |
| 176 | +See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for guidelines. |
| 177 | + |
| 178 | +## Funding |
| 179 | + |
| 180 | +Support development via Ethereum: |
82 | 181 |
|
83 | | -Licensed under the MIT License, Copyright © 2022-present [Rainbow](https://rainbow.me). |
| 182 | +**0xC1FC64b34FA86D8fac48565E44882a32cC08EB97** |
| 183 | + |
| 184 | +## Links |
| 185 | + |
| 186 | +- **Original RainbowKit**: https://rainbowkit.com |
| 187 | +- **Alloy**: https://github.com/alloy-rs/alloy |
| 188 | +- **Leptos**: https://github.com/leptos-rs/leptos |
| 189 | +- **Issues**: https://github.com/nxm-rs/nexum-kit/issues |
| 190 | + |
| 191 | +## License |
84 | 192 |
|
85 | | -See [LICENSE](/LICENSE) for more information. |
| 193 | +Dual-licensed - see [`LICENSE`](./LICENSE) for details. |
0 commit comments