Crates.io | pinocchio-system |
lib.rs | pinocchio-system |
version | |
source | src |
created_at | 2024-10-02 11:43:41.887504+00 |
updated_at | 2025-03-29 00:15:47.308963+00 |
description | Pinocchio helpers to invoke System program instructions |
homepage | |
repository | https://github.com/anza-xyz/pinocchio |
max_upload_size | |
id | 1393962 |
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-system
This crate contains pinocchio
helpers to perform cross-program invocations (CPIs) for System program instructions.
Each instruction defines a struct
with the accounts and parameters required. Once all values are set, you can call directly invoke
or invoke_signed
to perform the CPI.
This is a no_std
crate.
Note: The API defined in this crate is subject to change.
Creating a new account:
// This example assumes that the instruction receives a writable signer `payer_info`
// and `new_account_info` accounts.
CreateAccount {
from: payer_info,
to: new_account_info,
lamports: 1_000_000_000, // 1 SOL
space: 200, // 200 bytes
owner: &spl_token::ID,
}.invoke()?;
Performing a transfer of lamports:
// This example assumes that the instruction receives a writable signer `payer_info`
// account and a writable `recipient_info` account.
Transfer {
from: payer_info,
to: recipient_info,
lamports: 500_000_000, // 0.5 SOL
}.invoke()?;
The code is licensed under the Apache License Version 2.0