Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify and fix the init Counter transaction #1818

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion internal/super/generator/fixtures/README_no_deps.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down
22 changes: 21 additions & 1 deletion internal/super/generator/fixtures/README_with_deps.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down
22 changes: 21 additions & 1 deletion internal/super/generator/templates/README.md.tmpl
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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()))
}
}
22 changes: 21 additions & 1 deletion testing/better/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down
Loading