-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed chained lookup integration test
- Loading branch information
1 parent
ed1270d
commit 843eff7
Showing
13 changed files
with
474 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[26,39,164,161,246,97,149,0,58,187,146,162,53,35,107,2,117,242,83,171,48,7,63,240,69,221,239,45,97,55,112,106,192,228,214,205,123,71,58,23,62,229,166,213,149,122,96,145,35,150,16,156,247,199,242,108,173,80,62,231,39,196,27,192] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "write-test" | ||
version = "0.1.0" | ||
description = "Created with Anchor" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "lib"] | ||
name = "write_test" | ||
|
||
[features] | ||
no-entrypoint = [] | ||
no-idl = [] | ||
no-log-ix-name = [] | ||
cpi = ["no-entrypoint"] | ||
default = [] | ||
|
||
[dependencies] | ||
anchor-lang = "0.29.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[target.bpfel-unknown-unknown.dependencies.std] | ||
features = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use anchor_lang::prelude::*; | ||
|
||
declare_id!("39vbQVpEMtZtg3e6ZSE7nBSzmNZptmW45WnLkbqEe4TU"); | ||
|
||
#[program] | ||
pub mod write_test { | ||
use super::*; | ||
|
||
pub fn initialize(ctx: Context<Initialize>, lookup_table: Pubkey) -> Result<()> { | ||
let data = &mut ctx.accounts.data_account; | ||
data.version = 1; | ||
data.administrator = ctx.accounts.admin.key(); | ||
data.pending_administrator = Pubkey::default(); | ||
data.lookup_table = lookup_table; | ||
|
||
Ok(()) | ||
} | ||
|
||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct Initialize<'info> { | ||
/// PDA account, derived from seeds and created by the System Program in this instruction | ||
#[account( | ||
init, // Initialize the account | ||
payer = admin, // Specify the payer | ||
space = DataAccount::SIZE, // Specify the account size | ||
seeds = [b"data"], // Define the PDA seeds | ||
bump // Use the bump seed | ||
)] | ||
pub data_account: Account<'info, DataAccount>, | ||
|
||
/// Admin account that pays for PDA creation and signs the transaction | ||
#[account(mut)] | ||
pub admin: Signer<'info>, | ||
|
||
/// System Program is required for PDA creation | ||
pub system_program: Program<'info, System>, | ||
} | ||
|
||
#[account] | ||
pub struct DataAccount { | ||
pub version: u8, | ||
pub administrator: Pubkey, | ||
pub pending_administrator: Pubkey, | ||
pub lookup_table: Pubkey, | ||
} | ||
|
||
impl DataAccount { | ||
/// The total size of the `DataAccount` struct, including the discriminator | ||
pub const SIZE: usize = 8 + 1 + 32 * 3; // 8 bytes for discriminator + 1 byte for version + 32 bytes * 3 pubkeys | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.