From d7d83c9a9c11bce1c832ceea73801c6f511eee97 Mon Sep 17 00:00:00 2001 From: Vincent Brunet Date: Mon, 17 Jun 2024 17:28:22 +0100 Subject: [PATCH 1/3] up --- .github/pull_request_template.md | 41 ++++---------------------------- .vscode/settings.json | 7 ++++++ cli/src/lib.rs | 1 - 3 files changed, 11 insertions(+), 38 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f0edc54..8bc6bf9 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,45 +1,12 @@ -> ⚠️ NOTE: Use notes like this to emphasize something important about the PR. -> -> This could include other PRs this PR is built on top of; API breaking changes; reasons for why the PR is on hold; or anything else you would like to draw attention to. - -| Status | Type | ⚠️ Core Change | Issue | -| :---: | :---: | :---: | :--: | -| Ready/Hold | Feature/Bug/Tooling/Refactor/Hotfix | Yes/No | [Link]() | - -## Problem +# Problem _What problem are you trying to solve?_ - -## Solution +# Solution _How did you solve the problem?_ +# Other changes (e.g. bug fixes, small refactors) -## Before & After Screenshots - -_Insert screenshots of example code output_ - -**BEFORE**: -[insert screenshot here] - -**AFTER**: -[insert screenshot here] - - -## Other changes (e.g. bug fixes, small refactors) - - -## Deploy Notes - -_Notes regarding deployment of the contained body of work. These should note any -new dependencies, new scripts, etc._ - -**New scripts**: - -- `script` : script details - -**New dependencies**: - -- `dependency` : dependency details \ No newline at end of file +_What other unrelated changes are included in this PR ?_ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2175ca5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "workbench.colorCustomizations": { + "activityBar.background": "#13341D", + "titleBar.activeBackground": "#1B4829", + "titleBar.activeForeground": "#F7FCF9" + } +} \ No newline at end of file diff --git a/cli/src/lib.rs b/cli/src/lib.rs index 14c892f..4150c19 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -174,7 +174,6 @@ fn init( fs::create_dir(&project_name)?; } std::env::set_current_dir(&project_name)?; - fs::create_dir_all("app")?; let mut cfg = Config::default(); let jest = test_template == anchor_cli::rust_template::TestTemplate::Jest; From cdfb9fd598a584a6ad6b5c59d4fedd179ac5cf98 Mon Sep 17 00:00:00 2001 From: Vincent Brunet Date: Tue, 18 Jun 2024 11:40:33 +0100 Subject: [PATCH 2/3] adding-arguments-to-system --- cli/src/rust_template.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cli/src/rust_template.rs b/cli/src/rust_template.rs index 91062ac..b92c1f4 100644 --- a/cli/src/rust_template.rs +++ b/cli/src/rust_template.rs @@ -98,10 +98,10 @@ declare_id!("{}"); #[system] pub mod {} {{ - pub fn execute(ctx: Context, _args_p: Vec) -> Result {{ + pub fn execute(ctx: Context, args: Args) -> Result {{ let position = &mut ctx.accounts.position; - position.x += 1; - position.y += 1; + position.x += args.x; + position.y += args.y; Ok(ctx.accounts) }} @@ -110,6 +110,11 @@ pub mod {} {{ pub position: Position, }} + #[arguments] + struct Args {{ + pub x: i64, + pub y: i64, + }} }} "#, anchor_cli::rust_template::get_or_create_program_id(name), @@ -473,6 +478,9 @@ describe("{}", () => {{ entity: entityPda, components: [{{ componentId: positionComponent.programId }}], }}] + }}, {{ + x: 1, + y: 1, }}); const txSign = await provider.sendAndConfirm(applySystem.transaction); console.log(`Applied a system. Signature: ${{txSign}}`); From d235d1f4f701cac1015f4ef57f4504447a4c958b Mon Sep 17 00:00:00 2001 From: Vincent Brunet Date: Tue, 18 Jun 2024 17:20:30 +0200 Subject: [PATCH 3/3] nit --- cli/src/rust_template.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/src/rust_template.rs b/cli/src/rust_template.rs index b92c1f4..db6ce5a 100644 --- a/cli/src/rust_template.rs +++ b/cli/src/rust_template.rs @@ -477,10 +477,11 @@ describe("{}", () => {{ entities: [{{ entity: entityPda, components: [{{ componentId: positionComponent.programId }}], - }}] - }}, {{ + }}], + args: {{ x: 1, y: 1, + }} }}); const txSign = await provider.sendAndConfirm(applySystem.transaction); console.log(`Applied a system. Signature: ${{txSign}}`); @@ -491,7 +492,6 @@ describe("{}", () => {{ ); expect(positionAfter.x.toNumber()).to.gt(0); }}); - }}); "#, name.to_upper_camel_case(),