2 unstable releases
new 0.1.0 | Sep 25, 2024 |
---|---|
0.0.0 | Sep 25, 2024 |
#446 in Cryptography
158 downloads per month
81KB
1K
SLoC
Companion Pubkey
helpers pinocchio
.
This crate provides two convenience macros to resolve Pubkey
s at compile time:
pubkey!
: takes a pubkey value as a base58&str
and generates its correpondentPubkey
(byte array)declare_id!
: takes a pubkey value as a base58&str
(usually representing a program address) and generates anID
constant,check_id()
andid()
helpers
It also defines a decode
helper that takes a &str
and returns the correspondent Pubkey
value.
Examples
Creating a Pubkey
constant value from a &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 owner = pinocchio_pubkey::decode("7qtAvP4CJuSKauWHtHZJt9wmQRgvcFeUcU3xKrFzxKf1");
License
The code is licensed under the Apache License Version 2.0