Skip to content

Commit

Permalink
Merge pull request #477 from onflow/ianthpun/doc-updates
Browse files Browse the repository at this point in the history
update docs with UX fixes
  • Loading branch information
ianthpun authored Jan 2, 2024
2 parents 58da2e6 + 3f6a1fe commit f860d08
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 11 deletions.
90 changes: 82 additions & 8 deletions docs/build/getting-started/quickstarts/flow-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ For other ways of installing, please [refer to the installation guide](../../../

## Configuration

Let's first create a directory, then set up a project.
Lets first create the scaffolded project:

```
mkdir cli-quickstart
flow setup cli-quickstart
```

And then let's navigate to our new directory:
Expand All @@ -31,13 +31,87 @@ And then let's navigate to our new directory:
cd cli-quickstart
```

Let's first create a `flow.json` file for our project. We'll use this in a later step, but this is a good spot to bring it up. The `flow.json` file is a configuration file used by the Flow CLI when interacting with the Flow blockchain. It helps manage various project-specific settings, such as network configurations, account details, contract names and source files, and deployment targets. To create one, run:
If you look at `flow.json` now, you'll see its listed access nodes for networks and accounts. The default `emulator-account` create will come in handy when we want to run the emulator.

```json
{
"contracts": {
"FlowToken": {
"source": "cadence/contracts/utility/FlowToken.cdc",
"aliases": {
"emulator": "0ae53cb6e3f42a79",
"testnet": "7e60df042a9c0868",
"mainnet": "1654653399040a61"
}
},
"FungibleToken": {
"source": "cadence/contracts/utility/FungibleToken.cdc",
"aliases": {
"emulator": "ee82856bf20e2aa6",
"testnet": "9a0766d93b6608b7",
"mainnet": "f233dcee88fe0abe"
}
},
"FungibleTokenMetadataViews": {
"source": "cadence/contracts/utility/FungibleTokenMetadataViews.cdc",
"aliases": {
"emulator": "ee82856bf20e2aa6",
"testnet": "9a0766d93b6608b7",
"mainnet": "f233dcee88fe0abe"
}
},
"MetadataViews": {
"source": "cadence/contracts/utility/MetadataViews.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"testnet": "631e88ae7f1d7c20",
"mainnet": "1d7e57aa55817448"
}
},
"RandomBeaconHistory": {
"source": "cadence/contracts/utility/RandomBeaconHistory.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"testnet": "8c5303eaa26202d6",
"mainnet": "e467b9dd11fa00df"
}
},
"ViewResolver": {
"source": "cadence/contracts/utility/ViewResolver.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"testnet": "631e88ae7f1d7c20",
"mainnet": "1d7e57aa55817448"
}
},
"NonFungibleToken": {
"source": "cadence/contracts/kitty-items/NonFungibleToken.cdc",
"aliases": {
"emulator": "f8d6e0586b0a20c7",
"testnet": "631e88ae7f1d7c20",
"mainnet": "1d7e57aa55817448"
}
}
},
"networks": {
"emulator": "127.0.0.1:3569",
"mainnet": "access.mainnet.nodes.onflow.org:9000",
"testnet": "access.devnet.nodes.onflow.org:9000"
},
"accounts": {
"emulator-account": {
"address": "f8d6e0586b0a20c7",
"key": "6d12eebfef9866c9b6fa92b97c6e705c26a1785b1e7944da701fc545a51d4673"
}
}
}

```
flow init
```

If you look at `flow.json` now, you'll see its listed access nodes for networks and accounts. The default `emulator-account` create will come in handy when we want to run the emulator.

<Callout type="info">
For additional details on how `flow.json` is configured, [read here.](../../../tools/flow-cli/flow.json/configuration.md)
</Callout>

## Running Scripts

Expand Down Expand Up @@ -82,7 +156,7 @@ Let's create a local version of the HelloWorld contract. We'll deploy it to the
touch HelloWorld.cdc
```

Copy the contract to `HelloWorld.cdc`. Then let's add the contract into our project by updating `flow.json`.
Copy the contract to `HelloWorld.cdc`.

```
pub contract HelloWorld {
Expand Down Expand Up @@ -214,4 +288,4 @@ You've just modified the state of the Flow Blockchain!

## Next Steps

Dive deeper by checking out the scaffolds generated by the Flow CLI. They can serve as a great starting point for any project you're trying to create. See how to [create a scaffold here](../../../tools/flow-cli/index.md).
Dive deeper by checking out the scaffolds generated by the Flow CLI. They can serve as a great starting point for any project you're trying to create. See how to [create a scaffold here](../../../tools/flow-cli/index.md).
1 change: 0 additions & 1 deletion docs/build/guides/flow-app-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Your `flow.json` file should look like this:
"networks": {
"emulator": "127.0.0.1:3569",
"mainnet": "access.mainnet.nodes.onflow.org:9000",
"sandboxnet": "access.sandboxnet.nodes.onflow.org:9000",
"testnet": "access.devnet.nodes.onflow.org:9000"
},
"accounts": {
Expand Down
10 changes: 8 additions & 2 deletions docs/tools/flow-cli/super-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ basic folder structure and a flow.json configuration.

Running the command:
```
> flow setup
> flow setup $PROJECT_NAME
```

Will create the following folders and files:
Expand All @@ -29,7 +29,13 @@ Will create the following folders and files:
Based on the purpose of your project you can select from a list of available scaffolds.
You can access the scaffolds by simply using the `--scaffold` flag like so:
```
> flow setup --scaffold
> flow setup $PROJECT_NAME --scaffold
```

If you'd like to skip the interactive mode of selecting a scaffold, use the `--scaffold-id` flag with a known ID:

```
> flow setup $PROJECT_NAME --scaffold-id=1
```

The list of scaffolds will continuously grow, and you are welcome to contribute to that.
Expand Down

1 comment on commit f860d08

@vercel
Copy link

@vercel vercel bot commented on f860d08 Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.