From e0bd2d502301f55028eeadc6381be7c45eae5194 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:38:26 -0800 Subject: [PATCH 1/3] Use an init tx that doesn't require storage --- .../templates/transaction_counter.cdc.tmpl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/super/generator/templates/transaction_counter.cdc.tmpl b/internal/super/generator/templates/transaction_counter.cdc.tmpl index b120a843c..dc3b513b4 100644 --- a/internal/super/generator/templates/transaction_counter.cdc.tmpl +++ b/internal/super/generator/templates/transaction_counter.cdc.tmpl @@ -1,16 +1,17 @@ import "{{ .ContractName }}" transaction { - prepare(signer: auth(BorrowValue) &Account) { - // Borrow a reference to the {{ .ContractName }} contract's public capability - let counterRef = signer.borrow<&{{ .ContractName }}>(from: /storage/counter) - ?? panic("Could not borrow reference to the counter") - // Call the increment function on the Counter contract - counterRef.increment() + prepare(acct: &Account) { + // Authorizes the transaction } execute { - log("Counter incremented successfully") + // Increment the counter + Counter.increment() + + // Retrieve the new count and log it + let newCount = Counter.getCount() + log("New count after incrementing: ".concat(newCount.toString())) } } \ No newline at end of file From be99042b2bde662d6e3cf925fc143f731dd1847b Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:38:32 -0800 Subject: [PATCH 2/3] Change readme --- internal/super/generator/fixtures/README_no_deps.md | 2 +- internal/super/generator/fixtures/README_with_deps.md | 2 +- internal/super/generator/templates/README.md.tmpl | 2 +- testing/better/README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/super/generator/fixtures/README_no_deps.md b/internal/super/generator/fixtures/README_no_deps.md index d44869cca..324adde09 100644 --- a/internal/super/generator/fixtures/README_no_deps.md +++ b/internal/super/generator/fixtures/README_no_deps.md @@ -1,6 +1,6 @@ ## 👋 Welcome Flow Developer! -Welcome to your new Flow project. This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. +This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. ## 🔨 Getting Started diff --git a/internal/super/generator/fixtures/README_with_deps.md b/internal/super/generator/fixtures/README_with_deps.md index c1c2bfc9f..49b45a4de 100644 --- a/internal/super/generator/fixtures/README_with_deps.md +++ b/internal/super/generator/fixtures/README_with_deps.md @@ -1,6 +1,6 @@ ## 👋 Welcome Flow Developer! -Welcome to your new Flow project. This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. +This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. ## 🔨 Getting Started diff --git a/internal/super/generator/templates/README.md.tmpl b/internal/super/generator/templates/README.md.tmpl index 1e3d61cfb..9b49e9208 100644 --- a/internal/super/generator/templates/README.md.tmpl +++ b/internal/super/generator/templates/README.md.tmpl @@ -1,6 +1,6 @@ ## 👋 Welcome Flow Developer! -Welcome to your new Flow project. This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. +This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. ## 🔨 Getting Started diff --git a/testing/better/README.md b/testing/better/README.md index 2502ef6de..76c8b2f87 100644 --- a/testing/better/README.md +++ b/testing/better/README.md @@ -1,6 +1,6 @@ ## 👋 Welcome Flow Developer! -Welcome to your new Flow project. This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. +This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started. ## 🔨 Getting started From c6a283932299b0b406e98bdc0fce891f9a335799 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:44:03 -0800 Subject: [PATCH 3/3] Add more to readme --- .../generator/fixtures/README_no_deps.md | 20 +++++++++++++++++++ .../generator/fixtures/README_with_deps.md | 20 +++++++++++++++++++ .../super/generator/templates/README.md.tmpl | 20 +++++++++++++++++++ testing/better/README.md | 20 +++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/internal/super/generator/fixtures/README_no_deps.md b/internal/super/generator/fixtures/README_no_deps.md index 324adde09..cfd07146a 100644 --- a/internal/super/generator/fixtures/README_no_deps.md +++ b/internal/super/generator/fixtures/README_no_deps.md @@ -29,6 +29,26 @@ Inside the `cadence` folder you will find: - `/tests` - This folder contains your Cadence tests (integration tests for your contracts, scripts, and transactions to verify they behave as expected) - `ExampleTest.cdc` +## Running the Existing Project + +### Executing the `GetCounter` Script + +To run the `GetCounter` script, use the following command: + +```shell +flow scripts execute cadence/scripts/GetCounter.cdc +``` + +### Sending the `IncrementCounter` Transaction + +To run the `IncrementCounter` transaction, use the following command: + +```shell +flow transactions send cadence/transactions/IncrementCounter.cdc +``` + +To learn more about using the CLI, check out the [Flow CLI Documentation](https://developers.flow.com/tools/flow-cli). + ## 👨‍💻 Start Developing ### Creating a New Contract diff --git a/internal/super/generator/fixtures/README_with_deps.md b/internal/super/generator/fixtures/README_with_deps.md index 49b45a4de..a9cc405e7 100644 --- a/internal/super/generator/fixtures/README_with_deps.md +++ b/internal/super/generator/fixtures/README_with_deps.md @@ -34,6 +34,26 @@ Inside the `cadence` folder you will find: - `/tests` - This folder contains your Cadence tests (integration tests for your contracts, scripts, and transactions to verify they behave as expected) - `ExampleTest.cdc` +## Running the Existing Project + +### Executing the `GetCounter` Script + +To run the `GetCounter` script, use the following command: + +```shell +flow scripts execute cadence/scripts/GetCounter.cdc +``` + +### Sending the `IncrementCounter` Transaction + +To run the `IncrementCounter` transaction, use the following command: + +```shell +flow transactions send cadence/transactions/IncrementCounter.cdc +``` + +To learn more about using the CLI, check out the [Flow CLI Documentation](https://developers.flow.com/tools/flow-cli). + ## 👨‍💻 Start Developing ### Creating a New Contract diff --git a/internal/super/generator/templates/README.md.tmpl b/internal/super/generator/templates/README.md.tmpl index 9b49e9208..139f47b78 100644 --- a/internal/super/generator/templates/README.md.tmpl +++ b/internal/super/generator/templates/README.md.tmpl @@ -33,6 +33,26 @@ Inside the `cadence` folder you will find: - `/tests` - This folder contains your Cadence tests (integration tests for your contracts, scripts, and transactions to verify they behave as expected){{ range .Tests }} - `{{ .Name }}.cdc`{{ end }} +## Running the Existing Project + +### Executing the `GetCounter` Script + +To run the `GetCounter` script, use the following command: + +```shell +flow scripts execute cadence/scripts/GetCounter.cdc +``` + +### Sending the `IncrementCounter` Transaction + +To run the `IncrementCounter` transaction, use the following command: + +```shell +flow transactions send cadence/transactions/IncrementCounter.cdc +``` + +To learn more about using the CLI, check out the [Flow CLI Documentation](https://developers.flow.com/tools/flow-cli). + ## 👨‍💻 Start Developing ### Creating a New Contract diff --git a/testing/better/README.md b/testing/better/README.md index 76c8b2f87..834a0eeff 100644 --- a/testing/better/README.md +++ b/testing/better/README.md @@ -38,6 +38,26 @@ Inside `cadence` folder you will find: - `/tests` - This folder contains your Cadence tests (integration tests for your contracts, scripts, and transactions to verify they behave as expected) - `Counter_test.cdc` +## Running the Existing Project + +### Executing the `GetCounter` Script + +To run the `GetCounter` script, use the following command: + +```shell +flow scripts execute cadence/scripts/GetCounter.cdc +``` + +### Sending the `IncrementCounter` Transaction + +To run the `IncrementCounter` transaction, use the following command: + +```shell +flow transactions send cadence/transactions/IncrementCounter.cdc +``` + +To learn more about using the CLI, check out the [Flow CLI Documentation](https://developers.flow.com/tools/flow-cli). + ## 👨‍💻 Start Developing ### Creating a New Contract