|
@@ -1,7 +1,7 @@
|
|
|
//! Misc optional example is a catchall program for testing unrelated features.
|
|
|
//! It's not too instructive/coherent by itself, so please see other examples.
|
|
|
|
|
|
-use account::MAX_SIZE;
|
|
|
+use account::*;
|
|
|
use anchor_lang::prelude::*;
|
|
|
use context::*;
|
|
|
use event::*;
|
|
@@ -62,11 +62,16 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn test_input_enum(ctx: Context<TestSimulate>, data: TestEnum) -> Result<()> {
|
|
|
+ pub fn test_input_enum(_ctx: Context<TestSimulate>, data: TestEnum) -> Result<()> {
|
|
|
emit!(E7 { data: data });
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
+ pub fn test_account_enum(ctx: Context<TestAccountEnum>, data: TestEnum) -> Result<()> {
|
|
|
+ ctx.accounts.data.as_mut().unwrap().data = data;
|
|
|
+ Ok(())
|
|
|
+ }
|
|
|
+
|
|
|
pub fn test_i8(ctx: Context<TestI8>, data: i8) -> Result<()> {
|
|
|
ctx.accounts.data.as_mut().unwrap().data = data;
|
|
|
Ok(())
|
|
@@ -171,7 +176,9 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn test_init_mint_with_token_program(_ctx: Context<TestInitMintWithTokenProgram>) -> Result<()> {
|
|
|
+ pub fn test_init_mint_with_token_program(
|
|
|
+ _ctx: Context<TestInitMintWithTokenProgram>,
|
|
|
+ ) -> Result<()> {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
@@ -182,11 +189,12 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn test_init_token_with_token_program(_ctx: Context<TestInitTokenWithTokenProgram>) -> Result<()> {
|
|
|
+ pub fn test_init_token_with_token_program(
|
|
|
+ _ctx: Context<TestInitTokenWithTokenProgram>,
|
|
|
+ ) -> Result<()> {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
-
|
|
|
pub fn test_composite_payer(ctx: Context<TestCompositePayer>) -> Result<()> {
|
|
|
ctx.accounts.composite.data.as_mut().unwrap().data = 1;
|
|
|
ctx.accounts.data.as_mut().unwrap().udata = 2;
|
|
@@ -201,7 +209,9 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn test_init_associated_token_with_token_program(ctx: Context<TestInitAssociatedTokenWithTokenProgram>) -> Result<()> {
|
|
|
+ pub fn test_init_associated_token_with_token_program(
|
|
|
+ _ctx: Context<TestInitAssociatedTokenWithTokenProgram>,
|
|
|
+ ) -> Result<()> {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
@@ -261,7 +271,9 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn test_init_token_if_needed_with_token_program(_ctx: Context<TestInitTokenIfNeededWithTokenProgram>) -> Result<()> {
|
|
|
+ pub fn test_init_token_if_needed_with_token_program(
|
|
|
+ _ctx: Context<TestInitTokenIfNeededWithTokenProgram>,
|
|
|
+ ) -> Result<()> {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
@@ -277,7 +289,7 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn init_with_space(_ctx: Context<InitWithSpace>, data: u16) -> Result<()> {
|
|
|
+ pub fn init_with_space(_ctx: Context<InitWithSpace>, _data: u16) -> Result<()> {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
@@ -357,7 +369,9 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn test_only_token_program_constraint(_ctx: Context<TestOnlyTokenProgramConstraint>) -> Result<()> {
|
|
|
+ pub fn test_only_token_program_constraint(
|
|
|
+ _ctx: Context<TestOnlyTokenProgramConstraint>,
|
|
|
+ ) -> Result<()> {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
@@ -401,7 +415,9 @@ pub mod misc_optional {
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
- pub fn test_associated_token_with_token_program_constraint(_ctx: Context<TestAssociatedTokenWithTokenProgramConstraint>) -> Result<()> {
|
|
|
+ pub fn test_associated_token_with_token_program_constraint(
|
|
|
+ _ctx: Context<TestAssociatedTokenWithTokenProgramConstraint>,
|
|
|
+ ) -> Result<()> {
|
|
|
Ok(())
|
|
|
}
|
|
|
}
|