Skip to content

Commit ffa484b

Browse files
committed
Use solana-instruction-view
1 parent 8aea106 commit ffa484b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+278
-903
lines changed

Cargo.lock

+29-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ pinocchio-pubkey = { path = "sdk/pubkey", version = "0.2" }
2222
pinocchio-log-macro = { version = "0.4", path = "sdk/log/macro" }
2323
quote = "1.0"
2424
regex = "1"
25-
solana-account-view = { version = "0.0.0", git = "https://github.com/febo/solana-sdk.git", branch = "account-view" }
26-
solana-address = { version = "0.0.0", git = "https://github.com/febo/solana-sdk.git", branch = "solana-address" }
25+
solana-account-view = { version = "0.0.0", git = "https://github.com/febo/solana-sdk.git", branch = "instruction-view" }
26+
solana-address = { version = "0.0.0", git = "https://github.com/febo/solana-sdk.git", branch = "instruction-view" }
27+
solana-instruction-view = { version = "0.0.0", git = "https://github.com/febo/solana-sdk.git", branch = "instruction-view" }
28+
solana-program-error = { version = "2.2.1", git = "https://github.com/kevinheavey/solana-sdk.git", branch = "program-error-pinocchio-compat" }
2729
syn = "1.0"
2830

2931
[workspace.metadata.cli]

programs/associated-token-account/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ repository = { workspace = true }
1111
crate-type = ["rlib"]
1212

1313
[dependencies]
14-
pinocchio = { workspace = true }
14+
solana-account-view = { workspace = true }
15+
solana-instruction-view = { workspace = true, features = ["cpi"] }
16+
solana-program-error = { workspace = true }
1517
pinocchio-pubkey = { workspace = true }

programs/associated-token-account/src/instructions/create.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_instruction_view::{
3+
cpi::{invoke_signed, Signer},
4+
AccountMeta, InstructionView,
65
};
6+
use solana_program_error::ProgramResult;
77

88
/// Creates an associated token account for the given wallet address and token mint.
99
/// Returns an error if the account exists.
@@ -52,7 +52,7 @@ impl Create<'_> {
5252

5353
let instruction_data = [0u8];
5454

55-
let instruction = Instruction {
55+
let instruction = InstructionView {
5656
program_id: &crate::ID,
5757
accounts: &account_metas,
5858
data: &instruction_data,

programs/associated-token-account/src/instructions/create_idempotent.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_instruction_view::{
3+
cpi::{invoke_signed, Signer},
4+
AccountMeta, InstructionView,
65
};
6+
use solana_program_error::ProgramResult;
77

88
/// Creates an associated token account for the given wallet address and
99
/// token mint, if it doesn't already exist. Returns an error if the
@@ -53,7 +53,7 @@ impl CreateIdempotent<'_> {
5353

5454
let instruction_data = [1u8];
5555

56-
let instruction = Instruction {
56+
let instruction = InstructionView {
5757
program_id: &crate::ID,
5858
accounts: &account_metas,
5959
data: &instruction_data,

programs/associated-token-account/src/instructions/recover_nested.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_instruction_view::{
3+
cpi::{invoke_signed, Signer},
4+
AccountMeta, InstructionView,
65
};
6+
use solana_program_error::ProgramResult;
77

88
/// Transfers from and closes a nested associated token account: an
99
/// associated token account owned by an associated token account.
@@ -64,7 +64,7 @@ impl RecoverNested<'_> {
6464

6565
let instruction_data = [2u8];
6666

67-
let instruction = Instruction {
67+
let instruction = InstructionView {
6868
program_id: &crate::ID,
6969
accounts: &account_metas,
7070
data: &instruction_data,

programs/system/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ repository = { workspace = true }
1111
crate-type = ["rlib"]
1212

1313
[dependencies]
14-
pinocchio = { workspace = true }
14+
solana-account-view = { workspace = true }
15+
solana-address = { workspace = true }
16+
solana-instruction-view = { workspace = true, features = ["cpi"] }
17+
solana-program-error = { workspace = true }
1518
pinocchio-pubkey = { workspace = true }

programs/system/src/instructions/advance_nonce_account.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_instruction_view::{
3+
cpi::{invoke_signed, Signer},
4+
AccountMeta, InstructionView,
65
};
6+
use solana_program_error::ProgramResult;
77

88
/// Consumes a stored nonce, replacing it with a successor.
99
///
@@ -37,7 +37,7 @@ impl AdvanceNonceAccount<'_> {
3737
];
3838

3939
// instruction
40-
let instruction = Instruction {
40+
let instruction = InstructionView {
4141
program_id: &crate::ID,
4242
accounts: &account_metas,
4343
data: &[4],

programs/system/src/instructions/allocate.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_instruction_view::{
3+
cpi::{invoke_signed, Signer},
4+
AccountMeta, InstructionView,
65
};
6+
use solana_program_error::ProgramResult;
77

88
/// Allocate space in a (possibly new) account without funding.
99
///
@@ -34,7 +34,7 @@ impl Allocate<'_> {
3434
instruction_data[0] = 8;
3535
instruction_data[4..12].copy_from_slice(&self.space.to_le_bytes());
3636

37-
let instruction = Instruction {
37+
let instruction = InstructionView {
3838
program_id: &crate::ID,
3939
accounts: &account_metas,
4040
data: &instruction_data,

programs/system/src/instructions/allocate_with_seed.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
Address, ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_address::Address;
3+
use solana_instruction_view::{
4+
cpi::{invoke_signed, Signer},
5+
AccountMeta, InstructionView,
66
};
7+
use solana_program_error::ProgramResult;
78

89
/// Allocate space for and assign an account at an address derived
910
/// from a base address and a seed.
@@ -62,7 +63,7 @@ impl AllocateWithSeed<'_, '_, '_> {
6263
instruction_data[offset..offset + 8].copy_from_slice(&self.space.to_le_bytes());
6364
instruction_data[offset + 8..offset + 40].copy_from_slice(self.owner.as_ref());
6465

65-
let instruction = Instruction {
66+
let instruction = InstructionView {
6667
program_id: &crate::ID,
6768
accounts: &account_metas,
6869
data: &instruction_data[..offset + 40],

programs/system/src/instructions/assign.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
Address, ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_address::Address;
3+
use solana_instruction_view::{
4+
cpi::{invoke_signed, Signer},
5+
AccountMeta, InstructionView,
66
};
7+
use solana_program_error::ProgramResult;
78

89
/// Assign account to a program
910
///
@@ -34,7 +35,7 @@ impl Assign<'_, '_> {
3435
instruction_data[0] = 1;
3536
instruction_data[4..36].copy_from_slice(self.owner.as_ref());
3637

37-
let instruction = Instruction {
38+
let instruction = InstructionView {
3839
program_id: &crate::ID,
3940
accounts: &account_metas,
4041
data: &instruction_data,

programs/system/src/instructions/assign_with_seed.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
Address, ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_address::Address;
3+
use solana_instruction_view::{
4+
cpi::{invoke_signed, Signer},
5+
AccountMeta, InstructionView,
66
};
7+
use solana_program_error::ProgramResult;
78

89
/// Assign account to a program based on a seed.
910
///
@@ -56,7 +57,7 @@ impl AssignWithSeed<'_, '_, '_> {
5657
instruction_data[44..offset].copy_from_slice(self.seed.as_bytes());
5758
instruction_data[offset..offset + 32].copy_from_slice(self.owner.as_ref());
5859

59-
let instruction = Instruction {
60+
let instruction = InstructionView {
6061
program_id: &crate::ID,
6162
accounts: &account_metas,
6263
data: &instruction_data[..offset + 32],

programs/system/src/instructions/authorize_nonce_account.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
Address, ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_address::Address;
3+
use solana_instruction_view::{
4+
cpi::{invoke_signed, Signer},
5+
AccountMeta, InstructionView,
66
};
7+
use solana_program_error::ProgramResult;
78

89
/// Change the entity authorized to execute nonce instructions on the account.
910
///
@@ -43,7 +44,7 @@ impl AuthorizeNonceAccount<'_, '_> {
4344
instruction_data[0] = 7;
4445
instruction_data[4..36].copy_from_slice(self.new_authority);
4546

46-
let instruction = Instruction {
47+
let instruction = InstructionView {
4748
program_id: &crate::ID,
4849
accounts: &account_metas,
4950
data: &instruction_data,

programs/system/src/instructions/create_account.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use pinocchio::{
2-
account_view::AccountView,
3-
instruction::{AccountMeta, Instruction, Signer},
4-
program::invoke_signed,
5-
Address, ProgramResult,
1+
use solana_account_view::AccountView;
2+
use solana_address::Address;
3+
use solana_instruction_view::{
4+
cpi::{invoke_signed, Signer},
5+
AccountMeta, InstructionView,
66
};
7+
use solana_program_error::ProgramResult;
78

89
/// Create a new account.
910
///
@@ -51,7 +52,7 @@ impl CreateAccount<'_> {
5152
instruction_data[12..20].copy_from_slice(&self.space.to_le_bytes());
5253
instruction_data[20..52].copy_from_slice(self.owner.as_ref());
5354

54-
let instruction = Instruction {
55+
let instruction = InstructionView {
5556
program_id: &crate::ID,
5657
accounts: &account_metas,
5758
data: &instruction_data,

0 commit comments

Comments
 (0)