add new macro: pubkey! (backport #21245) (#21288)

This commit is contained in:
mergify[bot]
2021-11-15 13:42:30 -08:00
committed by GitHub
parent a05c08e711
commit 1a0eabe340
3 changed files with 74 additions and 0 deletions

View File

@@ -84,6 +84,22 @@ pub mod vote {
/// 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;