Expand description
Main ApexSDK implementation
This module provides the core SDK struct and methods for interacting with multiple blockchain networks through a unified interface.
§Examples
use apex_sdk::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
// Initialize SDK with both Substrate and EVM support
let sdk = ApexSDK::builder()
.with_substrate_endpoint("wss://polkadot.api.onfinality.io/public-ws")
.with_evm_endpoint("https://mainnet.infura.io/v3/YOUR_KEY")
.build()
.await?;
// Check chain support
if sdk.is_chain_supported(&Chain::Ethereum) {
println!("Ethereum is supported!");
}
// Create and execute a transaction
let tx = sdk.transaction()
.from_evm_address("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7")
.to_evm_address("0x1234567890123456789012345678901234567890")
.amount(1000)
.build()?;
let result = sdk.execute(tx).await?;
println!("Transaction hash: {}", result.source_tx_hash);
Ok(())
}Structs§
- ApexSDK
- Main Apex SDK struct providing unified interface to blockchain operations.