| Crates.io | apex-sdk-types |
| lib.rs | apex-sdk-types |
| version | 0.1.5 |
| created_at | 2025-11-15 08:44:19.065549+00 |
| updated_at | 2026-01-13 06:48:23.032487+00 |
| description | Common types for Apex SDK |
| homepage | https://apexsdk.dev/ |
| repository | https://github.com/carbobit/apex-sdk |
| max_upload_size | |
| id | 1934159 |
| size | 135,916 |
Common types and data structures for the Apex SDK ecosystem.
apex-sdk-types provides shared types, traits, and data structures used across all Apex SDK components. This crate serves as the foundation for type-safe interactions between EVM and Substrate blockchain adapters.
serdeAdd this to your Cargo.toml:
[dependencies]
apex-sdk-types = "0.1.3"
use apex_sdk_types::{
Account, ChainId, BlockNumber, Hash, Address
};
// Create a new account
let account = Account::new("0x1234567890abcdef1234567890abcdef12345678")?;
// Work with chain IDs
let ethereum_mainnet = ChainId::new(1);
let polkadot_relay = ChainId::new(0);
// Handle block numbers
let block = BlockNumber::new(1000000);
// Parse addresses
let address = Address::from_hex("0x1234567890abcdef1234567890abcdef12345678")?;
Account - Universal account representationAddress - Blockchain address abstractionChainId - Chain identifier for multi-chain supportBlockNumber - Block height representationHash - Generic hash type for different hash functionsPublicKey - Public key abstractionSignature - Digital signature representationTransactionHash - Transaction identifierNonce - Account nonce for transaction orderingFee - Transaction fee representationAll types implement serde::Serialize and serde::Deserialize:
use apex_sdk_types::Account;
use serde_json;
let account = Account::new("0x1234...")?;
// Serialize to JSON
let json = serde_json::to_string(&account)?;
// Deserialize from JSON
let deserialized: Account = serde_json::from_str(&json)?;
Types are designed to work seamlessly across different blockchain ecosystems:
use apex_sdk_types::{Address, ChainId};
// EVM-style address
let eth_address = Address::from_hex("0x742d35Cc6635C0532925a3b8D45B9909")?;
// Substrate-style address
let dot_address = Address::from_ss58("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa")?;
// Both work with the same API
println!("Address: {}", eth_address);
println!("Address: {}", dot_address);
Comprehensive error types for robust error handling:
use apex_sdk_types::{ApexError, Result};
fn parse_address(input: &str) -> Result<Address> {
Address::from_hex(input)
.map_err(|e| ApexError::InvalidAddress(e.to_string()))
}
cargo build
cargo test
cargo doc --open
This crate is automatically included when you use any of the higher-level Apex SDK crates:
apex-sdk - Main SDKapex-sdk-core - Core functionalityapex-sdk-evm - EVM adapterapex-sdk-substrate - Substrate adapterLicensed under the Apache License, Version 2.0. See LICENSE for details.
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.