Skip to content

Commit 46dd140

Browse files
committed
Use solana-account-view
1 parent ea7c848 commit 46dd140

Some content is hidden

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

49 files changed

+246
-1010
lines changed

Cargo.lock

Lines changed: 24 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ 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" }
2526
solana-address = { version = "0.0.0", git = "https://github.com/febo/solana-sdk.git", branch = "solana-address" }
2627
syn = "1.0"
2728

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ If all dependencies are `no_std`, you should append [`nostd_panic_handler!`](htt
6868
To use the `entrypoint!` macro, use the following in your entrypoint definition:
6969
```rust
7070
use pinocchio::{
71-
account_info::AccountInfo,
71+
account_view::AccountView,
7272
entrypoint,
7373
msg,
7474
ProgramResult,
@@ -79,7 +79,7 @@ entrypoint!(process_instruction);
7979

8080
pub fn process_instruction(
8181
program_id: &Address,
82-
accounts: &[AccountInfo],
82+
accounts: &[AccountView],
8383
instruction_data: &[u8],
8484
) -> ProgramResult {
8585
msg!("Hello from my program!");
@@ -147,7 +147,7 @@ When writing programs, it can be useful to make sure the program does not attemp
147147
To use the `no_allocator!` macro, use the following in your entrypoint definition:
148148
```rust
149149
use pinocchio::{
150-
account_info::AccountInfo,
150+
account_view::AccountView,
151151
default_panic_handler,
152152
msg,
153153
no_allocator,
@@ -162,7 +162,7 @@ no_allocator!();
162162

163163
pub fn process_instruction(
164164
program_id: &Address,
165-
accounts: &[AccountInfo],
165+
accounts: &[AccountView],
166166
instruction_data: &[u8],
167167
) -> ProgramResult {
168168
msg!("Hello from `no_std` program!");
@@ -189,7 +189,7 @@ The symbols emitted by the entrypoint macros — program entrypoint, global
189189
#[cfg(feature = "bpf-entrypoint")]
190190
mod entrypoint {
191191
use pinocchio::{
192-
account_info::AccountInfo,
192+
account_view::AccountView,
193193
entrypoint,
194194
msg,
195195
ProgramResult,
@@ -200,7 +200,7 @@ mod entrypoint {
200200

201201
pub fn process_instruction(
202202
program_id: &Address,
203-
accounts: &[AccountInfo],
203+
accounts: &[AccountView],
204204
instruction_data: &[u8],
205205
) -> ProgramResult {
206206
msg!("Hello from my program!");

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pinocchio::{
2-
account_info::AccountInfo,
2+
account_view::AccountView,
33
instruction::{AccountMeta, Instruction, Signer},
44
program::invoke_signed,
55
ProgramResult,
@@ -17,17 +17,17 @@ use pinocchio::{
1717
/// 5. `[]` SPL Token program
1818
pub struct Create<'a> {
1919
/// Funding account (must be a system account)
20-
pub funding_account: &'a AccountInfo,
20+
pub funding_account: &'a AccountView,
2121
/// Associated token account address to be created
22-
pub account: &'a AccountInfo,
22+
pub account: &'a AccountView,
2323
/// Wallet address for the new associated token account
24-
pub wallet: &'a AccountInfo,
24+
pub wallet: &'a AccountView,
2525
/// The token mint for the new associated token account
26-
pub mint: &'a AccountInfo,
26+
pub mint: &'a AccountView,
2727
/// System program
28-
pub system_program: &'a AccountInfo,
28+
pub system_program: &'a AccountView,
2929
/// SPL Token program
30-
pub token_program: &'a AccountInfo,
30+
pub token_program: &'a AccountView,
3131
}
3232

3333
impl Create<'_> {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pinocchio::{
2-
account_info::AccountInfo,
2+
account_view::AccountView,
33
instruction::{AccountMeta, Instruction, Signer},
44
program::invoke_signed,
55
ProgramResult,
@@ -18,17 +18,17 @@ use pinocchio::{
1818
/// 5. `[]` SPL Token program
1919
pub struct CreateIdempotent<'a> {
2020
/// Funding account (must be a system account)
21-
pub funding_account: &'a AccountInfo,
21+
pub funding_account: &'a AccountView,
2222
/// Associated token account address to be created
23-
pub account: &'a AccountInfo,
23+
pub account: &'a AccountView,
2424
/// Wallet address for the new associated token account
25-
pub wallet: &'a AccountInfo,
25+
pub wallet: &'a AccountView,
2626
/// The token mint for the new associated token account
27-
pub mint: &'a AccountInfo,
27+
pub mint: &'a AccountView,
2828
/// System program
29-
pub system_program: &'a AccountInfo,
29+
pub system_program: &'a AccountView,
3030
/// SPL Token program
31-
pub token_program: &'a AccountInfo,
31+
pub token_program: &'a AccountView,
3232
}
3333

3434
impl CreateIdempotent<'_> {

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pinocchio::{
2-
account_info::AccountInfo,
2+
account_view::AccountView,
33
instruction::{AccountMeta, Instruction, Signer},
44
program::invoke_signed,
55
ProgramResult,
@@ -26,19 +26,19 @@ use pinocchio::{
2626
/// 6. `[]` SPL Token program
2727
pub struct RecoverNested<'a> {
2828
/// Nested associated token account, must be owned by `owner_associated_token_account`
29-
pub account: &'a AccountInfo,
29+
pub account: &'a AccountView,
3030
/// Token mint for the nested associated token account
31-
pub mint: &'a AccountInfo,
31+
pub mint: &'a AccountView,
3232
/// Wallet's associated token account
33-
pub destination_account: &'a AccountInfo,
33+
pub destination_account: &'a AccountView,
3434
/// Owner associated token account address, must be owned by `wallet_account`
35-
pub owner_account: &'a AccountInfo,
35+
pub owner_account: &'a AccountView,
3636
/// Token mint for the owner associated token account
37-
pub owner_mint: &'a AccountInfo,
37+
pub owner_mint: &'a AccountView,
3838
/// Wallet address for the owner associated token account
39-
pub wallet: &'a AccountInfo,
39+
pub wallet: &'a AccountView,
4040
/// SPL Token program
41-
pub token_program: &'a AccountInfo,
41+
pub token_program: &'a AccountView,
4242
}
4343

4444
impl RecoverNested<'_> {

programs/system/src/instructions/advance_nonce_account.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pinocchio::{
2-
account_info::AccountInfo,
2+
account_view::AccountView,
33
instruction::{AccountMeta, Instruction, Signer},
44
program::invoke_signed,
55
ProgramResult,
@@ -13,13 +13,13 @@ use pinocchio::{
1313
/// 2. `[SIGNER]` Nonce authority
1414
pub struct AdvanceNonceAccount<'a> {
1515
/// Nonce account.
16-
pub account: &'a AccountInfo,
16+
pub account: &'a AccountView,
1717

1818
/// RecentBlockhashes sysvar.
19-
pub recent_blockhashes_sysvar: &'a AccountInfo,
19+
pub recent_blockhashes_sysvar: &'a AccountView,
2020

2121
/// Nonce authority.
22-
pub authority: &'a AccountInfo,
22+
pub authority: &'a AccountView,
2323
}
2424

2525
impl AdvanceNonceAccount<'_> {

programs/system/src/instructions/allocate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pinocchio::{
2-
account_info::AccountInfo,
2+
account_view::AccountView,
33
instruction::{AccountMeta, Instruction, Signer},
44
program::invoke_signed,
55
ProgramResult,
@@ -11,7 +11,7 @@ use pinocchio::{
1111
/// 0. `[WRITE, SIGNER]` New account
1212
pub struct Allocate<'a> {
1313
/// Account to be assigned.
14-
pub account: &'a AccountInfo,
14+
pub account: &'a AccountView,
1515

1616
/// Number of bytes of memory to allocate.
1717
pub space: u64,

programs/system/src/instructions/allocate_with_seed.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pinocchio::{
2-
account_info::AccountInfo,
2+
account_view::AccountView,
33
instruction::{AccountMeta, Instruction, Signer},
44
program::invoke_signed,
55
Address, ProgramResult,
@@ -13,14 +13,14 @@ use pinocchio::{
1313
/// 1. `[SIGNER]` Base account
1414
pub struct AllocateWithSeed<'a, 'b, 'c> {
1515
/// Allocated account.
16-
pub account: &'a AccountInfo,
16+
pub account: &'a AccountView,
1717

1818
/// Base account.
1919
///
2020
/// The account matching the base address below must be provided as
2121
/// a signer, but may be the same as the funding account and provided
2222
/// as account 0.
23-
pub base: &'a AccountInfo,
23+
pub base: &'a AccountView,
2424

2525
/// String of ASCII chars, no longer than [MAX_SEED_LEN](https://docs.rs/solana-address/latest/solana_address/constant.MAX_SEED_LEN.html).
2626
pub seed: &'b str,

programs/system/src/instructions/assign.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pinocchio::{
2-
account_info::AccountInfo,
2+
account_view::AccountView,
33
instruction::{AccountMeta, Instruction, Signer},
44
program::invoke_signed,
55
Address, ProgramResult,
@@ -11,7 +11,7 @@ use pinocchio::{
1111
/// 0. `[WRITE, SIGNER]` Assigned account address
1212
pub struct Assign<'a, 'b> {
1313
/// Account to be assigned.
14-
pub account: &'a AccountInfo,
14+
pub account: &'a AccountView,
1515

1616
/// Program account to assign as owner.
1717
pub owner: &'b Address,

0 commit comments

Comments
 (0)