solana_program

Macro pubkey

source
pubkey!() { /* proc-macro */ }
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);