diff --git a/internal/super/generator/fixtures/README_no_deps.md b/internal/super/generator/fixtures/README_no_deps.md index d44869cca..cfd07146a 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 @@ -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 c1c2bfc9f..a9cc405e7 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 @@ -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 1e3d61cfb..139f47b78 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 @@ -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/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 diff --git a/testing/better/README.md b/testing/better/README.md index 2502ef6de..834a0eeff 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 @@ -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