-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into account-subcommand
- Loading branch information
Showing
39 changed files
with
2,589 additions
and
16 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,9 @@ | |
}, | ||
"scripts": { | ||
"test": "anchor test" | ||
}, | ||
"dependencies": { | ||
"mocha": "^10.0.0", | ||
"ts-mocha": "^10.0.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,20 @@ | ||
[package] | ||
name = "native-system" | ||
version = "0.1.0" | ||
description = "Created with Anchor" | ||
rust-version = "1.56" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "lib"] | ||
name = "native_system" | ||
|
||
[features] | ||
no-entrypoint = [] | ||
no-idl = [] | ||
no-log-ix-name = [] | ||
cpi = ["no-entrypoint"] | ||
default = [] | ||
|
||
[dependencies] | ||
anchor-lang = { path = "../../../../lang" } |
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,214 @@ | ||
use anchor_lang::prelude::*; | ||
|
||
declare_id!("9NxAd91hhJ3ZBTHytYP894y4ESRKG7n8VbLgdyYGJFLB"); | ||
|
||
#[program] | ||
pub mod native_system { | ||
use super::*; | ||
|
||
pub fn create_account( | ||
ctx: Context<CreateAccount>, | ||
lamports: u64, | ||
space: u64, | ||
owner: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn assign(ctx: Context<Assign>, owner: Pubkey) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn transfer(ctx: Context<Transfer>, lamports: u64) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn create_account_with_seed( | ||
ctx: Context<CreateAccountWithSeed>, | ||
base: Pubkey, | ||
seed: String, | ||
lamports: u64, | ||
space: u64, | ||
owner: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn advance_nonce_account( | ||
ctx: Context<AdvanceNonceAccount>, | ||
authorized: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn withdraw_nonce_account(ctx: Context<WithdrawNonceAccount>, lamports: u64) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn initialize_nonce_account( | ||
ctx: Context<InitializeNonceAccount>, | ||
authorized: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn authorize_nonce_account( | ||
ctx: Context<AuthorizeNonceAccount>, | ||
authorized: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn allocate(ctx: Context<Allocate>, space: u64) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn allocate_with_seed( | ||
ctx: Context<AllocateWithSeed>, | ||
base: Pubkey, | ||
seed: String, | ||
space: u64, | ||
owner: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn assign_with_seed( | ||
ctx: Context<AssignWithSeed>, | ||
base: Pubkey, | ||
seed: String, | ||
owner: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
pub fn transfer_with_seed( | ||
ctx: Context<TransferWithSeed>, | ||
lamports: u64, | ||
seed: String, | ||
owner: Pubkey, | ||
) -> Result<()> { | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct CreateAccount<'info> { | ||
#[account(mut)] | ||
from: Signer<'info>, | ||
#[account(mut)] | ||
to: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct Assign<'info> { | ||
#[account(mut)] | ||
pubkey: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct Transfer<'info> { | ||
#[account(mut)] | ||
from: Signer<'info>, | ||
#[account(mut)] | ||
/// CHECK: | ||
to: AccountInfo<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct CreateAccountWithSeed<'info> { | ||
#[account(mut)] | ||
from: Signer<'info>, | ||
#[account(mut)] | ||
/// CHECK: | ||
to: AccountInfo<'info>, | ||
base: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct AdvanceNonceAccount<'info> { | ||
#[account(mut)] | ||
/// CHECK: | ||
nonce: AccountInfo<'info>, | ||
/// CHECK: | ||
recent_blockhashes: AccountInfo<'info>, | ||
authorized: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct WithdrawNonceAccount<'info> { | ||
#[account(mut)] | ||
/// CHECK: | ||
nonce: AccountInfo<'info>, | ||
#[account(mut)] | ||
/// CHECK: | ||
to: AccountInfo<'info>, | ||
/// CHECK: | ||
recent_blockhashes: AccountInfo<'info>, | ||
rent: Sysvar<'info, Rent>, | ||
authorized: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct InitializeNonceAccount<'info> { | ||
#[account(mut)] | ||
nonce: Signer<'info>, | ||
/// CHECK: | ||
recent_blockhashes: AccountInfo<'info>, | ||
rent: Sysvar<'info, Rent>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct AuthorizeNonceAccount<'info> { | ||
#[account(mut)] | ||
/// CHECK: | ||
nonce: AccountInfo<'info>, | ||
authorized: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct Allocate<'info> { | ||
#[account(mut)] | ||
pubkey: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct AllocateWithSeed<'info> { | ||
#[account(mut)] | ||
/// CHECK: | ||
account: AccountInfo<'info>, | ||
base: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct AssignWithSeed<'info> { | ||
#[account(mut)] | ||
/// CHECK: | ||
account: AccountInfo<'info>, | ||
base: Signer<'info>, | ||
} | ||
|
||
#[derive(Accounts)] | ||
pub struct TransferWithSeed<'info> { | ||
#[account(mut)] | ||
/// CHECK: | ||
from: AccountInfo<'info>, | ||
base: Signer<'info>, | ||
#[account(mut)] | ||
/// CHECK: | ||
to: AccountInfo<'info>, | ||
} | ||
|
||
#[derive(AnchorSerialize, AnchorDeserialize, Clone)] | ||
pub struct FeeCalculator { | ||
pub lamports_per_signature: u64, | ||
} | ||
|
||
#[account] | ||
pub struct Nonce { | ||
pub version: u32, | ||
pub state: u32, | ||
pub authorized_pubkey: Pubkey, | ||
pub nonce: Pubkey, | ||
pub fee_calculator: FeeCalculator, | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/custom-coder/programs/spl-associated-token/Cargo.toml
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,22 @@ | ||
[package] | ||
name = "spl-associated-token" | ||
version = "0.1.0" | ||
description = "Created with Anchor" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "lib"] | ||
name = "spl_associated_token" | ||
|
||
[features] | ||
no-entrypoint = [] | ||
no-idl = [] | ||
no-log-ix-name = [] | ||
cpi = ["no-entrypoint"] | ||
default = [] | ||
|
||
[profile.release] | ||
overflow-checks = true | ||
|
||
[dependencies] | ||
anchor-lang = "0.24.2" |
Oops, something went wrong.