Crates.io | pinocchio-pubkey |
lib.rs | pinocchio-pubkey |
version | |
source | src |
created_at | 2024-09-25 10:55:40.586731+00 |
updated_at | 2025-03-19 12:15:24.344091+00 |
description | Companion pubkey helpers for Pinocchio |
homepage | |
repository | https://github.com/anza-xyz/pinocchio |
max_upload_size | |
id | 1386243 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
pinocchio-pubkey
Companion Pubkey
helpers for 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 correspondent 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()
helpersIt also defines a from_str
helper that takes a &str
and returns the correspondent Pubkey
value.
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);
The code is licensed under the Apache License Version 2.0