https://github.com/reown-com/yttrium
A cross-platform smart account library
https://github.com/reown-com/yttrium
prod team-walletkit
Last synced: 6 days ago
JSON representation
A cross-platform smart account library
- Host: GitHub
- URL: https://github.com/reown-com/yttrium
- Owner: reown-com
- License: apache-2.0
- Created: 2024-09-03T09:55:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-05-22T15:42:02.000Z (12 days ago)
- Last Synced: 2026-05-22T20:26:41.764Z (12 days ago)
- Topics: prod, team-walletkit
- Language: Rust
- Homepage:
- Size: 13.8 MB
- Stars: 12
- Watchers: 4
- Forks: 6
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Funding: funding.json
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# Yttrium
Yttrium is a cross-platform library designed for working with smart accounts, currently focused on the Ethereum ecosystem.
> [!CAUTION]
> This project is under heavy development and is currently in a pre-alpha state.
## Overview
Yttrium simplifies the process of building applications that utilize account abstraction. It provides essential abstractions and primitives for Wallets and DApps to interact with and implement smart account functionality.
A primary goal of this project is to enable externally owned account (EOA) wallets to offer advanced features such as batch transactions and transaction sponsorship to their users.
While initially focused on Ethereum, Yttrium aims to be a cross-chain account abstraction library.
## Architecture
The following diagram provides an overview of the Yttrium architecture:
```mermaid
graph TD;
CoreRustLibrary[Core Rust Library] -->|Compiled to| NativeLibrary[Native Library]
NativeLibrary --> |Is consumed by| SwiftWrapper[Swift Wrapper]
NativeLibrary -.-> OtherNativePlatform["Other Native Platform"]
CoreRustLibrary -->|Compiled to| WebAssemblyModule[WebAssembly Module]
WebAssemblyModule --> |Is consumed by| TypeScriptWrapper[TypeScript Wrapper]
WebAssemblyModule -.-> OtherWebAssemblyPlatform["Other WebAssembly Platform"]
style CoreRustLibrary color:#fff,fill:#CE422B,stroke:#fff,stroke-width:2px
style NativeLibrary fill:#0000FF,stroke:#fff,stroke-width:2px
style SwiftWrapper color:#fff,fill:#F05138,stroke:#fff,stroke-width:2px
style WebAssemblyModule fill:#654ff0,stroke:#fff,stroke-width:2px,color:#fff
style TypeScriptWrapper color:#fff,fill:#3178c6,stroke:#fff,stroke-width:2px
style OtherNativePlatform color:#333,fill:#ccc,stroke:#ccc,stroke-dasharray: 5,5
style OtherWebAssemblyPlatform color:#333,fill:#ccc,stroke:#ccc,stroke-dasharray: 5,5
```
## Standards
In the near future, Yttrium will implement the following standards:
* ERC-4337 (in development)
* ERC-7702 (in development)
Additional standards and features will be added as the project evolves.
## Available APIs
Yttrium currently provides APIs for:
* Swift
* Rust
Planned future APIs include:
* JavaScript/TypeScript (via WebAssembly)
* Kotlin
* Flutter
* C#/Unity
## Target Platforms
Currently supported platforms:
* Apple platforms (iOS, macOS)
* Linux
Planned future support includes:
* WebAssembly
* Android
* Web
* Windows
## Installation and Setup
### Development Dependencies
To contribute to this project, ensure you have the following dependencies installed:
- `just` - `cargo install just`
- `rustup`
- Rust latest stable installed
- `swiftc` and Xcode
- `make`
For Android (`./build-kotlin.sh`):
```bash
rustup toolchain install stable -t armv7-linux-androideabi,aarch64-linux-android -c rust-src
cargo install cargo-ndk --locked
```
You will also need to install Android Studio and the "NDK (Side by side)" SDK Tools.
### Building Swift Frameworks Locally
To build and test the Swift XCFrameworks locally:
```bash
make set-up-local-swift-package
```
This command:
1. Builds `libyttrium.xcframework` for iOS devices and simulators
2. Builds `libyttrium-utils.xcframework`
3. Generates a local `Package.swift` pointing to the built artifacts
4. Marks `Package.swift` as git-ignored to prevent accidental commits
#### Testing in reown-swift
To test your local yttrium changes in the [reown-swift](https://github.com/reown-com/reown-swift) repository:
1. Clone reown-swift as a sibling directory:
```
StudioProjects/
├── yttrium/ # This repo
└── reown-swift/ # Clone here
```
2. Build yttrium locally:
```bash
cd yttrium
make set-up-local-swift-package
```
3. Edit `reown-swift/Package.swift` and set the debug flag:
```swift
// Line 5-6 in Package.swift
let yttriumDebug = true // Change from false to true
```
4. Build/run reown-swift - it will use your local yttrium artifacts.
#### Reverting Local Package.swift
To restore the original `Package.swift` after local testing:
```bash
git update-index --no-assume-unchanged Package.swift
git checkout -- Package.swift
```
### Setup
After installing the above dependencies, you can run `just ci` to run the checks that CI does and initialize your repo.
You must run `just infra` to run a local anvil and a mock alto bundler which is required by some of these tests.
### Devloop
During normal development you can use the `just devloop` command to test your code both during development and before comitting/pushing. This is handy as it runs as many checks as possible and fixes any issues (such as formatting) automatically.
This command does not require any configuration.
```bash
just devloop
```
TODO: make this setup anvil automatically
### Specific tests
Some tests require some configuration (such as funds on Sepolia). For these, supply `FAUCET_MNEMONIC` and add some funds on the account.
#### Pimlico/Sepolia
```bash
just test-pimlico-api
```
Required environment variables:
```text
FAUCET_MNEMONIC
PIMLICO_API_KEY
PIMLICO_BUNDLER_URL
PIMLICO_RPC_URL
```
## Justfile targets
There are various `just` targets to use depending on your scenario. This shows approximately what happens for each target, as this diagram may be out-of-date. Take a look at the comments inside `justfile` for more information.
```mermaid
flowchart TD
_pass --> p[PASS]
check --> setup
check --> lint
check --> test
devloop --> check
devloop --> env-tests
%% devloop --> _pass
env-tests --> test-pimlico-api
costly-tests --> test-blockchain-api
lint --> fmt
lint --> clippy
_ci --> udeps
_ci --> swift
_ci --> kotlin
ci --> check
ci --> _ci
%% ci --> _pass
devloop-ci --> check
devloop-ci --> env-tests
devloop-ci --> _ci
%% devloop-ci --> _pass
devloop-ci-costly --> check
devloop-ci-costly --> env-tests
devloop-ci-costly --> _ci
devloop-ci-costly --> costly-tests
%% devloop-ci-costly --> _pass
infra
```