| Crates.io | frame_rs |
| lib.rs | frame_rs |
| version | 0.1.2 |
| created_at | 2024-02-21 04:41:12.153752+00 |
| updated_at | 2024-03-11 20:24:17.053642+00 |
| description | A Frame wallet client written in rust to programmatically change the provider network for Frame's Omnichain setup. |
| homepage | |
| repository | https://github.com/AnonJon/frame-rs |
| max_upload_size | |
| id | 1147532 |
| size | 14,620 |
frame-rs is a Rust library designed to facilitate interaction with the Frame Ethereum wallet. It provides a straightforward, asynchronous API for switching Ethereum networks via Frame's JSON-RPC interface and performing Ethereum blockchain operations, leveraging the security and user-friendliness of Frame for managing accounts and signing transactions.
Add frame-rs to your Cargo.toml:
[dependencies]
frame-rs = "0.1.2"
Here's a quick example to get you started with frame-rs:
use frame_rs::client::FrameClient;
use ethers::types::U256;
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
// Initialize the Frame client
let client = FrameClient::new(U256::from(1), None).await?; // Ethereum Mainnet
// Switch to Arbitrum One
let arbitrum_chain_id = U256::from(42161);
client.switch_network(arbitrum_chain_id).await?;
println!("Successfully switched to Arbitrum One.");
Ok(())
}
To start interacting with Frame, create a FrameClient instance:
use frame_rs::client::FrameClient;
use ethers::types::U256;
#[tokio::main]
async fn main() {
let chain_id = U256::from(1); // Example for Ethereum Mainnet
let client = FrameClient::new(chain_id, None).await.expect("Failed to create FrameClient");
}
To switch the connected network:
use frame_rs::client::FrameClient;
use ethers::types::U256;
#[tokio::main]
async fn main() {
let new_chain_id = U256::from(42161); // Example for Arbitrum One
let client = FrameClient::new(U256::from(1), None).await.expect("Failed to create FrameClient");
client.switch_network(new_chain_id).await.expect("Failed to switch network");
}
frame-rs aims to support additional Ethereum wallet operations. Stay tuned for more features!
frame-rs is licensed under the MIT License - see the LICENSE file for details.