7 releases

0.2.2 Jan 3, 2025
0.2.1 Oct 26, 2024
0.1.3 Oct 10, 2024
0.1.0 Sep 25, 2024
0.0.0 Sep 25, 2024

#406 in Cryptography

Download history 173/week @ 2024-10-25 164/week @ 2024-11-01 72/week @ 2024-11-08 79/week @ 2024-11-15 67/week @ 2024-11-22 60/week @ 2024-11-29 61/week @ 2024-12-06 56/week @ 2024-12-13 40/week @ 2024-12-20 18/week @ 2024-12-27 204/week @ 2025-01-03 142/week @ 2025-01-10 122/week @ 2025-01-17 56/week @ 2025-01-24 59/week @ 2025-01-31 83/week @ 2025-02-07

358 downloads per month
Used in 4 crates

Apache-2.0

4KB

pinocchio-pubkey

Companion Pubkey helpers for pinocchio.

This crate provides two convenience macros to resolve Pubkeys at compile time:

  • pubkey!: takes a pubkey value as a base58 &str and generates its correpondent Pubkey (byte array)
  • declare_id!: takes a pubkey value as a base58 &str (usually representing a program address) and generates an ID constant, check_id() and id() helpers

It also defines a from_str helper that takes a &str and returns the correspondent Pubkey value.

Examples

Creating a Pubkey constant value from a static &str:

use pinocchio::pubkey::Pubkey;

pub const AUTHORITY: Pubkey = pinocchio_pubkey::pubkey!("7qtAvP4CJuSKauWHtHZJt9wmQRgvcFeUcU3xKrFzxKf1");

Declaring the program address of a program (usually on your lib.rs):

pinocchio_pubkey::declare_id!("Ping111111111111111111111111111111111111111");

Creating a Pubkey from a &str:

let address = String::from("7qtAvP4CJuSKauWHtHZJt9wmQRgvcFeUcU3xKrFzxKf1");
let owner = pinocchio_pubkey::from_str(&address);

License

The code is licensed under the Apache License Version 2.0

Dependencies

~145KB