Crates.io | static-pubkey |
lib.rs | static-pubkey |
version | 1.0.3 |
source | src |
created_at | 2021-09-28 09:41:48.545505 |
updated_at | 2022-06-10 21:01:46.072716 |
description | macro used for compile-time parsing of public key strings into byte arrays for near 0-cost static public keys |
homepage | |
repository | https://github.com/sol-farm/static-pubkey |
max_upload_size | |
id | 457378 |
size | 7,810 |
The static-pubkey
crate provides a macro static_pubkey!
, used for compile-time parsing of strings into a static public key. This prvodies an efficient way of declaring public keys in source code while incurring almost no runtime cost in solana programs, without having to declare the byte array yourself. The actual code is taken from here.
#[cfg(test)]
mod test {
use static_pubkey::static_pubkey;
#[test]
fn example() {
let key = static_pubkey!("GjphYQcbP1m3FuDyCTUJf2mUMxKPE3j6feWU1rxvC7Ps");
assert!(key.to_string() == "GjphYQcbP1m3FuDyCTUJf2mUMxKPE3j6feWU1rxvC7Ps");
}
}