solana_sdk

Macro pubkey

Source
macro_rules! pubkey {
    ($input:literal) => { ... };
}
Expand description

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);

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_pubkey::{pubkey, Pubkey};

static ID: Pubkey = pubkey!("My11111111111111111111111111111111111111111");

let my_id = Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap();
assert_eq!(ID, my_id);