add new macro: pubkey! (#21245)

* add new macro: `pubkey!`

* fmt
This commit is contained in:
Kirill Fomichev
2021-11-15 22:22:51 +03:00
committed by GitHub
parent f331ae95ad
commit d8a392c20b
3 changed files with 74 additions and 0 deletions

View File

@ -87,6 +87,22 @@ pub use solana_sdk_macro::program_declare_deprecated_id as declare_deprecated_id
/// assert_eq!(id(), my_id);
/// ```
pub use solana_sdk_macro::program_declare_id as declare_id;
/// Convenience macro to define a static public key
///
/// Input: a single literal base58 string representation of a Pubkey
///
/// # Example
///
/// ```
/// use std::str::FromStr;
/// use solana_program::{pubkey, pubkey::Pubkey};
///
/// static ID: Pubkey = pubkey!("My11111111111111111111111111111111111111111");
///
/// let my_id = Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap();
/// assert_eq!(ID, my_id);
/// ```
pub use solana_sdk_macro::program_pubkey as pubkey;
#[macro_use]
extern crate serde_derive;