1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
pub mod http;
pub mod json_rpc;
pub mod serde_helpers;

use std::sync::Arc;

use starknet_core::starknet::Starknet;
use tokio::sync::RwLock;

/// Data that can be shared between threads with read write lock access
/// Whatever needs to be accessed as information outside of Starknet could be added to this struct
#[derive(Clone)]
pub struct Api {
    // maybe the config should be added here next to the starknet instance
    pub starknet: Arc<RwLock<Starknet>>,
}

impl Api {
    pub fn new(starknet: Starknet) -> Self {
        Self { starknet: Arc::new(RwLock::new(starknet)) }
    }
}