Skip to main content

qorechain/
lib.rs

1//! QoreChain SDK for Rust.
2//!
3//! This crate mirrors the QoreChain TypeScript, Python, and Go SDKs and
4//! provides the building blocks dApp developers need to talk to a QoreChain
5//! network:
6//!
7//! - [`networks`] — built-in network presets (testnet and mainnet, both live).
8//! - [`denom`] — exact integer conversion between display and base amounts.
9//! - [`address`] — bech32 / hex address conversion and validation.
10//! - [`accounts`] — BIP-39 mnemonics and HD derivation of native (Cosmos-style
11//!   secp256k1), EVM (secp256k1), and SVM (ed25519) accounts.
12//! - [`pqc`] — post-quantum ML-DSA-87 (FIPS 204) keygen / sign / verify and the
13//!   on-chain hybrid-signature extension builder.
14//! - [`query`] — async REST (LCD) and JSON-RPC read clients, including the typed
15//!   `qor_*` namespace.
16//! - [`client`] — the top-level [`create_client`](client::create_client)
17//!   factory.
18//! - [`tx`] — native bank-send building/signing, REST broadcast, and end-to-end
19//!   hybrid (classical + ML-DSA-87) transaction signing.
20
21#![forbid(unsafe_code)]
22#![warn(missing_docs)]
23
24pub mod accounts;
25pub mod address;
26pub mod client;
27pub mod denom;
28pub mod error;
29pub mod msg;
30pub mod networks;
31pub mod pqc;
32pub mod proto;
33pub mod query;
34pub mod subscribe;
35pub mod tx;
36pub mod utils;
37
38pub use error::{Error, Result};
39
40pub use networks::{
41    get_network, list_networks, networks, Bech32Prefixes, CoinInfo, Endpoints, NetworkConfig,
42};
43
44pub use denom::{from_base, to_base, DEFAULT_EXPONENT};
45
46pub use address::{bech32_to_hex, bytes_to_bech32, hex_to_bech32, is_valid_bech32, DEFAULT_PREFIX};
47
48pub use accounts::{
49    derive_evm_account, derive_native_account, derive_svm_account, generate_mnemonic,
50    validate_mnemonic, Ed25519Account, Secp256k1Account,
51};
52
53pub use pqc::{
54    build_hybrid_signature_extension, generate_pqc_keypair, pqc_sign, pqc_verify,
55    HybridSignatureExtension, PqcKeypair, ALGORITHM_DILITHIUM5, ALGORITHM_MLKEM1024,
56    HYBRID_SIG_TYPE_URL, MLDSA87_PUBLIC_KEY_LEN, MLDSA87_SECRET_KEY_LEN, MLDSA87_SIGNATURE_LEN,
57};
58
59pub use query::{JsonRpcClient, QorClient, RestClient, TypedQueryClient, QOR_METHODS};
60
61pub use client::{create_client, Client, ClientBuilder, Fees};
62
63pub use tx::{
64    bank_send, broadcast, broadcast_and_wait, build_hybrid_tx, calculate_fee, decode_tx_error,
65    estimate_fee, estimate_gas, fee_from_estimate, get_block, get_latest_block, get_tx, search_txs,
66    send_messages, wait_for_tx, with_retry, BankSendParams, BroadcastMode, BuildHybridTxParams,
67    BuiltTx, Coin, Fee, GasPrice, Message, QoreTxError, SendMessagesParams, TxResult,
68    TxSearchResult, WaitOptions, MSG_SEND_TYPE_URL,
69};
70
71pub use subscribe::{Event, SubscribeClient, Subscription};
72
73pub use utils::{
74    format_units, hash160, is_valid_evm_address, is_valid_svm_address, keccak256, parse_units,
75    ripemd160, sha256, to_checksum_address,
76};