solana_pubkey/
lib.rs

1//! Solana account addresses.
2#![no_std]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
5#![allow(clippy::arithmetic_side_effects)]
6
7// If target_os = "solana", then this panics so there are no dependencies.
8// When target_os != "solana", this should be opt-in so users
9// don't need the curve25519 dependency.
10#[cfg(any(target_os = "solana", feature = "curve25519"))]
11pub use solana_address::bytes_are_curve_point;
12#[cfg(target_os = "solana")]
13pub use solana_address::syscalls;
14pub use solana_address::{
15    address as pubkey, declare_deprecated_id, declare_id,
16    error::{AddressError as PubkeyError, ParseAddressError as ParsePubkeyError},
17    Address as Pubkey, ADDRESS_BYTES as PUBKEY_BYTES, MAX_SEEDS, MAX_SEED_LEN,
18};
19#[cfg(all(feature = "rand", not(target_os = "solana")))]
20pub use solana_address::{
21    AddressHasher as PubkeyHasher, AddressHasherBuilder as PubkeyHasherBuilder,
22};
23
24/// New random `Pubkey` for tests and benchmarks.
25#[cfg(all(feature = "rand", not(target_os = "solana")))]
26pub fn new_rand() -> Pubkey {
27    Pubkey::from(rand::random::<[u8; PUBKEY_BYTES]>())
28}