forked from Txio-labs/txio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtraits.rs
More file actions
23 lines (18 loc) · 690 Bytes
/
Copy pathtraits.rs
File metadata and controls
23 lines (18 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use async_trait::async_trait;
use serde_json::Value;
use anyhow::Result;
#[async_trait]
pub trait ChainAdapter: Send + Sync {
/// The name of the blockchain (e.g., "Sui", "Ethereum")
fn name(&self) -> &'static str;
/// The default RPC endpoint for this chain
fn default_rpc(&self) -> &'static str;
/// Call a JSON-RPC method on this chain
async fn call_rpc(&self, method: &str, params: Value) -> Result<Value>;
/// Optional: Resolve a name (SuiNS, ENS, etc.)
async fn resolve_name(&self, name: &str) -> Result<Option<String>> {
Ok(None)
}
/// Get balance for an account
async fn get_balance(&self, address: &str) -> Result<Value>;
}