1#![cfg_attr(docsrs, feature(doc_cfg))]
22
23pub mod config;
24pub mod error;
25pub mod maturity;
26pub mod protocol;
27pub mod tx;
28pub mod wallet;
29
30#[cfg(feature = "native")]
31pub mod rpc;
32
33pub use config::{
34 NetworkConfig, DEFAULT_LOCAL_MAINNET_CANDIDATE_RPC, DEFAULT_MAINNET_CANDIDATE_POOL,
35 DEFAULT_MAINNET_CANDIDATE_RPC,
36};
37pub use error::{Result, SdkError};
38pub use maturity::{
39 pool_block_maturity, MaturityProgress, MaturityStatus, DEFAULT_BLOCK_MATURITY_CONFIRMATIONS,
40};
41pub use tx::{SignedTransfer, TransferBuilder};
42pub use wallet::{GeneratedMnemonic, WalletAccount};
43
44#[cfg(feature = "native")]
45pub use rpc::{
46 AddressAccountResponse, AddressBalanceResponse, AtomicValue, BlockResponse,
47 ChainHeightResponse, ChainTipResponse, HealthResponse, IndexSummary, IndexedAddressResponse,
48 IndexedBlockResponse, IndexedTransactionResponse, IndexerStatusResponse,
49 IndexerSummaryResponse, MempoolStatusResponse, NetworkResponse, P2pStatusResponse, PoolBlock,
50 PoolBlockWithMaturity, PoolHistoryResponse, PoolStatusResponse, PoolWorker, RpcClient,
51 StatusResponse, SubmitTransactionResponse, SupplyResponse, SupplySummary, SyncStatusResponse,
52 TransactionResponse,
53};
54
55#[cfg(all(feature = "native", feature = "blocking"))]
56pub use rpc::BlockingRpcClient;
57
58pub use protocol::{
60 generate_mnemonic, hash_to_hex, Address, Amount, MnemonicWordCount, Network, PrivateKey,
61 PublicKey, Signature, Transaction, UnsignedTransaction, VeironError, WalletDerivationPath,
62 ATOMIC_UNITS_PER_VIRE, BLOCK_TIME_SECONDS, CURRENT_STATUS, DECIMALS, INITIAL_BASE_FEE_ATOMIC,
63 INITIAL_BLOCK_REWARD_ATOMIC, MAX_SUPPLY_ATOMIC, TICKER,
64};
65
66#[cfg(feature = "wasm")]
68pub const WASM_LOGIC_FEATURE: bool = true;
69
70#[cfg(feature = "wasm")]
71pub mod wasm_logic {
73 use crate::error::Result;
74 use crate::protocol::{Address, Amount, Transaction};
75
76 pub fn parse_address(value: &str) -> Result<Address> {
77 Ok(Address::parse(value)?)
78 }
79
80 pub fn format_vire(amount: Amount) -> String {
81 amount.format_vire()
82 }
83
84 pub fn parse_vire(value: &str) -> Result<Amount> {
85 Ok(Amount::parse_vire(value)?)
86 }
87
88 pub fn verify_transaction(tx: &Transaction) -> Result<()> {
89 Ok(tx.verify()?)
90 }
91}