WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
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
122 changes: 71 additions & 51 deletions docs/build/tools/flow-cli/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description: Essential Flow CLI commands for project development
sidebar_position: 2
---

Flow CLI provides a set of powerful commands that simplify your development workflow. These "super commands" handle complex tasks automatically, letting you focus on writing your smart contracts while the CLI manages the rest.
Flow CLI provides a set of powerful commands that simplify your development workflow. These "super commands" handle complex tasks automatically, which lets you focus on writing your smart contracts while the CLI manages the rest.

## Project Lifecycle
## Project lifecycle

### 1. Initialize a Project
### 1. Initialize a project

Start a new Flow project with `flow init`:

Expand All @@ -34,9 +34,9 @@ flow init --global
flow init --service-private-key <key>
```

📖 **[Learn more about project initialization](./flow.json/initialize-configuration.md)**
📖 **[Learn more about project initialization]**

### 2. Generate Project Files
### 2. Generate project files

Create new files with the `flow generate` command:

Expand All @@ -54,7 +54,7 @@ flow generate transaction TransferTokens
flow generate test MyToken
```

**Generated Structure:**
**Generated structure:**
```
cadence/
├── contracts/
Expand All @@ -67,7 +67,7 @@ cadence/
└── MyToken_test.cdc
```

📖 **[Learn more about generating Cadence boilerplate](./generate.md)**
📖 **[Learn more about generating Cadence boilerplate]**

### 3. Run Tests

Expand All @@ -87,9 +87,9 @@ flow test --coverage
flow test --verbose
```

📖 **[Learn more about testing](./tests.md)**
📖 **[Learn more about testing]**

### 4. Deploy Contracts
### 4. Deploy contracts

Deploy your contracts with `flow project deploy`:

Expand All @@ -107,11 +107,11 @@ flow project deploy --network=mainnet
flow project deploy --update
```

📖 **[Learn more about project deployment](./deployment/deploy-project-contracts.md)**
📖 **[Learn more about project deployment]**

## Configuration Management
## Configuration management

### Add Configuration Items
### Add configuration items

Use `flow config add` to manage your project configuration:

Expand All @@ -126,7 +126,7 @@ flow config add contract --name MyToken --filename ./cadence/contracts/MyToken.c
flow config add deployment --network testnet --account my-account --contract MyToken
```

### Remove Configuration Items
### Remove configuration items

```bash
# Remove an account
Expand All @@ -139,18 +139,18 @@ flow config remove contract MyToken
flow config remove deployment testnet my-account MyToken
```

📖 **[Learn more about configuration management](./flow.json/manage-configuration.md)**
📖 **[Learn more about configuration management]**

## Account Management
## Account management

### List Accounts
### List accounts

```bash
# List all configured accounts with status
flow accounts list
```

### Create Accounts
### Create accounts

```bash
# Interactive account creation
Expand All @@ -163,7 +163,7 @@ flow accounts create --network testnet
flow accounts create --key <private-key>
```

### Fund Accounts
### Fund accounts

```bash
# Interactive funding prompt
Expand All @@ -176,7 +176,7 @@ flow accounts fund testnet-account
flow accounts fund 0x8e94eaa81771313a
```

### Manage Account Keys
### Manage account keys

```bash
# Generate new key pair
Expand All @@ -189,11 +189,11 @@ flow keys decode <key>
flow keys derive <private-key>
```

📖 **[Learn more about account management](./accounts/create-accounts.md)**
📖 **[Learn more about account management]**

## Contract Interactions
## Contract interactions

### Execute Scripts
### Execute scripts

```bash
# Run a script
Expand All @@ -206,7 +206,7 @@ flow scripts execute cadence/scripts/GetBalance.cdc --arg 0x123
flow scripts execute cadence/scripts/GetBalance.cdc --network testnet
```

### Send Transactions
### Send transactions

```bash
# Send a transaction
Expand All @@ -219,7 +219,7 @@ flow transactions send cadence/transactions/TransferTokens.cdc --arg 0x123 --arg
flow transactions send cadence/transactions/TransferTokens.cdc --signer my-account
```

### Get System Transactions
### Get system transactions

```bash
# Get system transaction from latest block
Expand All @@ -232,11 +232,12 @@ flow transactions get-system latest 07a8...b433
flow transactions get-system 12345
```

📖 **[Learn more about scripts](./scripts/execute-scripts.md)** | **[Learn more about transactions](./transactions/send-transactions.md)**
- 📖 **[Learn more about scripts]**
- 📖 **[Learn more about transactions]**

## Dependency Management
## Dependency management

### Install Dependencies
### Install dependencies

```bash
# Install a contract dependency
Expand All @@ -249,7 +250,7 @@ flow dependencies install mainnet://f233dcee88fe0abe.FungibleToken
flow dependencies install testnet://8a4dce54554b225d.NumberFormatter --account my-account
```

### Manage Dependencies
### Manage dependencies

```bash
# List installed dependencies
Expand All @@ -262,43 +263,43 @@ flow dependencies discover
flow dependencies install testnet://8a4dce54554b225d.NumberFormatter
```

📖 **[Learn more about dependency management](./dependency-manager.md)**
📖 **[Learn more about dependency management]**

## Scheduled Transactions
## Scheduled transactions

### Setup Manager Resource
### Setup manager resource

```bash
# Initialize Manager resource for scheduled transactions
flow schedule setup --network testnet --signer my-account
```

### List Scheduled Transactions
### List scheduled transactions

```bash
# List all scheduled transactions for an account
flow schedule list my-account --network testnet
```

### Get Transaction Details
### Get transaction details

```bash
# Get details for a specific scheduled transaction
flow schedule get 123 --network testnet
```

### Cancel Scheduled Transaction
### Cancel scheduled transaction

```bash
# Cancel a scheduled transaction and receive refund
flow schedule cancel 123 --network testnet --signer my-account
```

📖 **[Learn more about scheduled transactions](./scheduled-transactions.md)**
📖 **[Learn more about scheduled transactions]**

## Development Workflow
## Development workflow

### Local Development
### Local development

1. **Start the emulator:**
```bash
Expand All @@ -325,7 +326,7 @@ flow scripts execute cadence/scripts/GetBalance.cdc
flow transactions send cadence/transactions/TransferTokens.cdc
```

### Testnet Deployment
### Testnet deployment

1. **Configure testnet account:**
```bash
Expand All @@ -342,7 +343,7 @@ flow project deploy --network=testnet
flow scripts execute cadence/scripts/GetBalance.cdc --network=testnet
```

## Import Schema
## Import schema

Use simplified imports in your Cadence code:

Expand All @@ -358,9 +359,9 @@ The CLI automatically resolves imports based on your `flow.json` configuration.

## Best Practices

### 1. Use Configuration Commands
### 1. Use configuration commands

Instead of manually editing `flow.json`, use CLI commands:
Rather than manually edit `flow.json`, use CLI commands:
```bash
# ✅ Good
flow config add account --name my-account --address 0x123
Expand All @@ -369,9 +370,9 @@ flow config add account --name my-account --address 0x123
# Manually editing flow.json
```

### 2. Test Locally First
### 2. Test locally first

Always test on emulator before deploying:
Always test on emulator before you deploy:
```bash
# 1. Start emulator
flow emulator start
Expand All @@ -386,7 +387,7 @@ flow test
flow project deploy --network=testnet
```

### 3. Use Descriptive Names
### 3. Use descriptive names

Choose clear names for accounts and contracts:
```bash
Expand All @@ -399,7 +400,7 @@ flow config add account --name acc1
flow generate contract c1
```

### 4. Secure Your Keys
### 4. Secure your keys

Use secure key management:
```bash
Expand All @@ -410,12 +411,31 @@ flow config add account --name my-account --key-file ./keys/my-account.key
FLOW_PRIVATE_KEY=abc123 flow project deploy
```

📖 **[Learn more about security best practices](./flow.json/security.md)**
📖 **[Learn more about security best practices]**

## Related Documentation

- **[Configuration Management](./flow.json/manage-configuration.md)** - Learn how to manage your `flow.json` file
- **[Project Deployment](./deployment/deploy-project-contracts.md)** - Deploy contracts to different networks
- **[Account Management](./accounts/create-accounts.md)** - Create and manage Flow accounts
- **[Testing](./tests.md)** - Write and run tests for your contracts
- **[Security](./flow.json/security.md)** - Secure your private keys and configuration
- **[Configuration Management]** - Learn how to manage your `flow.json` file
- **[Project Deployment]** - Deploy contracts to different networks
- **[Account Management]** - Create and manage Flow accounts
- **[Testing]** - Write and run tests for your contracts
- **[Security]** - Secure your private keys and configuration

<!-- Reference-style links, will not render on page. -->

[Learn more about project initialization]: ./flow.json/initialize-configuration.md
[Learn more about generating Cadence boilerplate]: ./generate.md
[Learn more about testing]: ./tests.md
[Learn more about project deployment]: ./deployment/deploy-project-contracts.md
[Learn more about configuration management]: ./flow.json/manage-configuration.md
[Learn more about account management]: ./accounts/create-accounts.md
[Learn more about scripts]: ./scripts/execute-scripts.md
[Learn more about transactions]: ./transactions/send-transactions.md
[Learn more about dependency management]: ./dependency-manager.md
[Learn more about scheduled transactions]: ./scheduled-transactions.md
[Learn more about security best practices]: ./flow.json/security.md
[Configuration Management]: ./flow.json/manage-configuration.md
[Project Deployment]: ./deployment/deploy-project-contracts.md
[Account Management]: ./accounts/create-accounts.md
[Testing]: ./tests.md
[Security]: ./flow.json/security.md
23 changes: 11 additions & 12 deletions docs/build/tools/flow-cli/data-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@ description: Data collected from Flow CLI usage
sidebar_position: 17
---

Flow CLI tracks flow command usage count using Mixpanel.
Flow CLI tracks flow command usage count with Mixpanel.

Data collection is turned on by default. To opt out of our data collection, users can run `flow settings metrics disable`.

Data collection is enabled by default. Users can opt out of our data collection through running `flow settings metrics disable`.
To opt back in, users can run `flow settings metrics enable`.

## Why do we collect data about flow cli usage?
## Why do we collect data about flow CLI usage?

Collecting aggregate command count allow us to prioritise features and fixes based on how users use flow cli.
When we collect aggregate command count, it allow us to prioritise features and fixes based on how users use flow CLI.

## What data do we collect?

We only collect the number of times a command is executed.

We don't keep track of the values of arguments, flags used
and the values of the flags used. We also don't associate any commands to any particular user.
We don't keep track of the values of arguments, flags used and the values of the flags used. We also don't associate any commands to any particular user.

The only property that we collect from our users are their preferences for opting in / out of data collection.
The analytics user ID is specific to Mixpanel and does not permit Flow CLI maintainers to e.g. track you across websites you visit.
The only property that we collect from our users are their opt in / out data collection preferences.
T
he analytics user ID is specific to Mixpanel and does not permit Flow CLI maintainers to, for exxample, track you across websites you visit.

Further details regarding the data collected can be found under Mixpanel's data collection page in `Ingestion API`
section of https://help.mixpanel.com/hc/en-us/articles/115004613766-Default-Properties-Collected-by-Mixpanel.
For more information about the data collected, see Mixpanel's data collection page in the `Ingestion API` section of https://help.mixpanel.com/hc/en-us/articles/115004613766-Default-Properties-Collected-by-Mixpanel.

Please note that although Mixpanel's page above mentions that geolocation properties are recorded by default,
we have turned off geolocation data reporting to Mixpanel.
Although Mixpanel's page above mentions that geolocation properties are recorded by default, we have turned off geolocation data reporting to Mixpanel.
Loading