Skip to content

extract pinocchio-cpi crate #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"programs/associated-token-account",
"programs/system",
"programs/token",
"sdk/cpi",
"sdk/log/crate",
"sdk/log/macro",
"sdk/pinocchio",
Expand All @@ -18,10 +19,12 @@ repository = "https://github.com/anza-xyz/pinocchio"
[workspace.dependencies]
five8_const = "0.1.3"
pinocchio = { path = "sdk/pinocchio", version = "0.7" }
pinocchio-cpi = { path = "sdk/cpi", version = "0.1.0" }
pinocchio-pubkey = { path = "sdk/pubkey", version = "0.2" }
pinocchio-log-macro = { version = "0.3", path = "sdk/log/macro" }
quote = "1.0"
regex = "1"
solana-define-syscall = "2.2"
syn = "1.0"

[workspace.metadata.cli]
Expand All @@ -32,3 +35,9 @@ build = "1.81.0"
format = "nightly-2024-08-08"
lint = "nightly-2024-08-08"
test = "1.81.0"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(target_os, values("solana"))',
'cfg(target_feature, values("static-syscalls"))',
] }
1 change: 1 addition & 0 deletions programs/associated-token-account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ crate-type = ["rlib"]

[dependencies]
pinocchio = { workspace = true }
pinocchio-cpi = { workspace = true }
pinocchio-pubkey = { workspace = true }
12 changes: 7 additions & 5 deletions programs/associated-token-account/src/instructions/create.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Creates an associated token account for the given wallet address and token mint.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Creates an associated token account for the given wallet address and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Transfers from and closes a nested associated token account: an
Expand Down
1 change: 1 addition & 0 deletions programs/system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ crate-type = ["rlib"]

[dependencies]
pinocchio = { workspace = true }
pinocchio-cpi = { workspace = true }
pinocchio-pubkey = { workspace = true }
12 changes: 7 additions & 5 deletions programs/system/src/instructions/advance_nonce_account.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Consumes a stored nonce, replacing it with a successor.
Expand Down
12 changes: 7 additions & 5 deletions programs/system/src/instructions/allocate.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Allocate space in a (possibly new) account without funding.
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/allocate_with_seed.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Allocate space for and assign an account at an address derived
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/assign.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Assign account to a program
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/assign_with_seed.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Assign account to a program based on a seed.
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/authorize_nonce_account.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Change the entity authorized to execute nonce instructions on the account.
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/create_account.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Create a new account.
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/create_account_with_seed.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Create a new account at an address derived from a base pubkey and a seed.
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/initialize_nonce_account.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Drive state of Uninitialized nonce account to Initialized, setting the nonce value.
Expand Down
12 changes: 7 additions & 5 deletions programs/system/src/instructions/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Transfer lamports.
Expand Down
14 changes: 8 additions & 6 deletions programs/system/src/instructions/transfer_with_seed.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
pubkey::Pubkey,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
pubkey::Pubkey,
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Transfer lamports from a derived address.
Expand Down
12 changes: 7 additions & 5 deletions programs/system/src/instructions/update_nonce_account.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// One-time idempotent upgrade of legacy nonce versions in order to bump
Expand Down
12 changes: 7 additions & 5 deletions programs/system/src/instructions/withdraw_nonce_account.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

/// Withdraw funds from a nonce account.
Expand Down
1 change: 1 addition & 0 deletions programs/token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ crate-type = ["rlib"]

[dependencies]
pinocchio = { workspace = true }
pinocchio-cpi = { workspace = true }
pinocchio-pubkey = { workspace = true }
12 changes: 7 additions & 5 deletions programs/token/src/instructions/approve.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use core::slice::from_raw_parts;

use pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
program::invoke_signed,
ProgramResult,
use {
pinocchio::{
account_info::AccountInfo,
instruction::{AccountMeta, Instruction, Signer},
ProgramResult,
},
pinocchio_cpi::invoke_signed,
};

use crate::{write_bytes, UNINIT_BYTE};
Expand Down
Loading