From 791d450143b5a3b6dc3b624e5dc397938d322b81 Mon Sep 17 00:00:00 2001 From: Ian Pun Date: Tue, 12 Dec 2023 09:26:24 -0800 Subject: [PATCH 1/4] update docs with UX fixes --- .../getting-started/quickstarts/flow-cli.md | 88 +++++++++++++++++-- docs/build/guides/flow-app-quickstart.md | 1 - 2 files changed, 81 insertions(+), 8 deletions(-) diff --git a/docs/build/getting-started/quickstarts/flow-cli.md b/docs/build/getting-started/quickstarts/flow-cli.md index c2a37069e7..09741c072c 100644 --- a/docs/build/getting-started/quickstarts/flow-cli.md +++ b/docs/build/getting-started/quickstarts/flow-cli.md @@ -18,10 +18,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 skaffolded project: ``` -mkdir cli-quickstart +flow setup cli-quickstart ``` And then let's navigate to our new directory: @@ -30,13 +30,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. + + +For additional details on how `flow.json` is configured, [read here.](../../../tools/flow-cli/flow.json/configuration.md) + ## Running Scripts @@ -81,7 +155,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 { diff --git a/docs/build/guides/flow-app-quickstart.md b/docs/build/guides/flow-app-quickstart.md index 3a875c5dc5..040042ebcd 100644 --- a/docs/build/guides/flow-app-quickstart.md +++ b/docs/build/guides/flow-app-quickstart.md @@ -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": { From 9de6903d3f28719c2a4a9646110501e75ac0e949 Mon Sep 17 00:00:00 2001 From: Ian Pun Date: Tue, 12 Dec 2023 16:46:48 -0800 Subject: [PATCH 2/4] update super commands for scaffolds --- docs/tools/flow-cli/super-commands.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/tools/flow-cli/super-commands.md b/docs/tools/flow-cli/super-commands.md index 7d6a56d915..9cf7436aa6 100644 --- a/docs/tools/flow-cli/super-commands.md +++ b/docs/tools/flow-cli/super-commands.md @@ -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: @@ -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. @@ -37,6 +43,7 @@ You can contribute by creating your own scaffold repository which can then be ad list by [following instructions here](https://github.com/onflow/flow-cli/blob/master/CONTRIBUTING.md#adding-a-scaffold). + ## Develop After creating the project using the flow setup command you can start the emulator in the project directory by running `flow emulator`. After emulator is started up you can continue by From 7f2f19ae924308672551faa54b8051c93108df50 Mon Sep 17 00:00:00 2001 From: Ian Pun Date: Tue, 12 Dec 2023 16:48:36 -0800 Subject: [PATCH 3/4] whitespace --- docs/tools/flow-cli/super-commands.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/tools/flow-cli/super-commands.md b/docs/tools/flow-cli/super-commands.md index 9cf7436aa6..5008af533a 100644 --- a/docs/tools/flow-cli/super-commands.md +++ b/docs/tools/flow-cli/super-commands.md @@ -43,7 +43,6 @@ You can contribute by creating your own scaffold repository which can then be ad list by [following instructions here](https://github.com/onflow/flow-cli/blob/master/CONTRIBUTING.md#adding-a-scaffold). - ## Develop After creating the project using the flow setup command you can start the emulator in the project directory by running `flow emulator`. After emulator is started up you can continue by From 3f6a1fe5b1084cf08173728cdfa167bed4bd2528 Mon Sep 17 00:00:00 2001 From: Ian Pun Date: Fri, 15 Dec 2023 11:20:56 -0800 Subject: [PATCH 4/4] typo --- docs/build/getting-started/quickstarts/flow-cli.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/build/getting-started/quickstarts/flow-cli.md b/docs/build/getting-started/quickstarts/flow-cli.md index 09741c072c..ffc56fcd5f 100644 --- a/docs/build/getting-started/quickstarts/flow-cli.md +++ b/docs/build/getting-started/quickstarts/flow-cli.md @@ -18,7 +18,7 @@ For other ways of installing, please [refer to the installation guide](../../../ ## Configuration -Lets first create the skaffolded project: +Lets first create the scaffolded project: ``` flow setup cli-quickstart @@ -287,4 +287,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). \ No newline at end of file +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).