github-actions bfee28654d Publish pinocchio-system v0.4.0 2 zile în urmă
..
src 39925fc9d1 system: Add create account helper (#282) 2 zile în urmă
Cargo.toml bfee28654d Publish pinocchio-system v0.4.0 2 zile în urmă
README.md 8ffab5aaaf Update README layout (#100) 8 luni în urmă

README.md

pinocchio-system

pinocchio-system

Overview

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.

Examples

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()?;

License

The code is licensed under the Apache License Version 2.0