ferrox_wallet/
lib.rs

1pub mod simple_wallet_manager;
2use std::{future::Future, pin::Pin, sync::Arc};
3
4use solana_sdk::{pubkey::Pubkey, signature::Keypair};
5
6#[derive(Clone)]
7pub enum Wallet {
8    Solana(Arc<Keypair>),
9}
10
11//Implement this trait to manage the wallets of multiple users
12pub trait WalletManager: Send + Sync + Clone {
13    // Returns a wallet for a user
14    fn get_wallet(
15        &self,
16        user_id: &str,
17    ) -> Pin<Box<dyn Future<Output = Result<Wallet, String>> + Send + Sync>>;
18
19    fn get_wallets(
20        &self,
21        user_id: &str,
22    ) -> Pin<Box<dyn Future<Output = Result<Vec<Wallet>, String>> + Send + Sync>>;
23
24    fn create_wallet(
25        &self,
26        user_id: &str,
27    ) -> Pin<Box<dyn Future<Output = Result<Wallet, String>> + Send + Sync>>;
28}