1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Copyright (c) Subzero Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
//! # Rialo Client Development Kit (CDK)
//!
//! The `rialo-cdk` is a comprehensive library that provides all the core functionality
//! needed to interact with the Rialo blockchain. This includes wallet management,
//! transaction building and signing, RPC communication, and configuration management.
//!
//! ## Modules
//!
//! * [`config`] - Configuration management for networks, user preferences, and storage backends
//! * [`constants`] - Blockchain and protocol constants used throughout the CDK
//! * [`error`] - Error types and result handling for the CDK
//! * [`program`] - Program deployment and invocation utilities
//! * [`rpc`] - Client implementation for communicating with Rialo blockchain nodes
//! * [`transaction`] - Transaction building, signing, and serialization
//! * [`utils`] - Utility functions for cryptography, encoding, and other common operations
//! * [`keyring`] - Keyring management including creation, loading, and HD key derivation
//! * [`wallet`] - (Deprecated) Alias for [`keyring`] module for backward compatibility
//!
//! ## Key Components
//!
//! The CDK is designed around a trait-based architecture that allows for flexible
//! implementations while maintaining a consistent interface. Key components include:
//!
//! * Keyring management with BIP39 mnemonic support
//! * Transaction building and signing
//! * RPC client for blockchain communication
//! * Program deployment and invocation
//! * Configuration management with multiple storage backends
//!
//! ## Getting Started
//!
//! ```rust,no_run
//! use rialo_cdk::{Wallet, RpcClient, TransactionBuilder};
//! use rialo_cdk::rpc::HttpRpcClient;
//! use rialo_cdk::wallet::traits::WalletProvider;
//! use rialo_cdk::rpc::types::{Pubkey, Hash};
//! use ed25519_dalek::SigningKey as Keypair;
//! use std::str::FromStr;
//!
//! async fn example() -> rialo_cdk::Result<()> {
//! // Create a wallet with a generated keypair
//! let keypair = Keypair::generate(&mut rand::thread_rng());
//! let wallet = Wallet::new(
//! "my_wallet".to_string(),
//! keypair,
//! Some("your mnemonic phrase".to_string()),
//! Some("m/44'/501'/0'/0'".to_string()),
//! );
//!
//! // Connect to a Rialo node
//! let client = HttpRpcClient::new("https://api.devnet.rialo.xyz".to_string());
//!
//! // Check account balance - using appropriate method from WalletProvider trait
//! let wallet_pubkey = Pubkey::from_str(&wallet.pubkey_string()).unwrap();
//! let balance = client.get_balance(&wallet_pubkey).await?;
//!
//! // Build and send a transaction
//! // Get current time in milliseconds for valid_from
//! let valid_from = std::time::SystemTime::now()
//! .duration_since(std::time::UNIX_EPOCH)
//! .expect("Time went backwards")
//! .as_millis() as i64;
//!
//! let recipient_pubkey = Pubkey::from_str("11111111111111111111111111111112").unwrap();
//! // In production, fetch from network: client.get_recent_validator_config_hash()
//! // Using EXAMPLE_CONFIG_HASH for documentation purposes only
//! let config_hash_prefix = rialo_cdk::EXAMPLE_CONFIG_HASH;
//! let signed_tx = TransactionBuilder::new(wallet_pubkey, valid_from, config_hash_prefix)
//! .add_transfer_instruction(&wallet_pubkey, &recipient_pubkey, 100)
//! .sign_with_account(&wallet, 0)?;
//!
//! let signature = client.send_transaction(&signed_tx, None).await?;
//!
//! Ok(())
//! }
//! ```
/// Generated types and traits from spec.wit (RPC module only).
// New keyring module (replaces wallet)
// Deprecated wallet module - re-exports keyring for backward compatibility
// Re-export commonly used types
pub use ClientContext;
pub use ;
pub use ;
pub use ;
// Deprecated wallet types for backward compatibility
pub use ;
// New keyring types (recommended)
pub use ;
// Re-export utility functions (non-WASM only)
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;