diff --git a/docs/cli-reference/dfx-deps.mdx b/docs/cli-reference/dfx-deps.mdx index 0876e0cc74..427af8f603 100644 --- a/docs/cli-reference/dfx-deps.mdx +++ b/docs/cli-reference/dfx-deps.mdx @@ -6,7 +6,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; Use the `dfx deps` command with flags and subcommands to pull dependencies from the mainnet and deploy locally. -[Learn how to configure a canister as `pullable`](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/maintain/import). +[Learn how to configure a canister as `pullable`](https://internetcomputer.org/docs/building-apps/advanced/using-third-party-canisters). The basic syntax for running `dfx deps` commands is: @@ -30,7 +30,7 @@ dfx deps pull --help ## dfx deps pull -Use the `dfx deps pull` command to pull dependencies as defined in `dfx.json`. +Use the `dfx deps pull` command to pull dependencies as defined in `dfx.json`. It will resolve all transitive dependencies. ### Basic usage @@ -40,7 +40,7 @@ dfx deps pull [options] ### Arguments -You can specify the following argument for the `dfx deps delete` command. +You can specify the following argument for the `dfx deps pull` command. | Command | Description | | --------- | --------------------------------------------------------------- | @@ -48,12 +48,6 @@ You can specify the following argument for the `dfx deps delete` command. ### Examples -You can use the `dfx deps pull` command to pull the dependencies as defined in `dfx.json` from the mainnet. It will resolve all indirect dependencies. - -``` bash -dfx deps pull -``` - For testing, you may want to pull from local environment, then run: ```bash @@ -72,19 +66,13 @@ dfx deps init [options] [canister] ### Examples -You can use the `dfx deps init` command to set empty init arguments for all pulled dependencies. - -``` bash -dfx deps init -``` - If any of the dependencies require init arguments, the above command will alarm you with their canister ID and names if exist. Then you can specify canister ID or name to set init argument for individual dependency. ```bash -`dfx deps init --argument [--argument-type ]` +dfx deps init --argument [--argument-type ] ``` -The command below set number `1` for canister `dep_a` as the argument type is the default `idl` (candid). +The command below set number `1` for canister `dep_a` as the argument type is the default `idl` (Candid). ```bash dfx deps init dep_a --argument 1 @@ -114,8 +102,6 @@ dfx deps deploy [flag] ### Examples -You can use the `dfx deps deploy` command to deploy dependencies to the local environment. - ``` bash dfx deps deploy ``` diff --git a/docs/cli-reference/dfx-envars.mdx b/docs/cli-reference/dfx-envars.mdx index 8fefbbd72a..2e6b1bda4d 100644 --- a/docs/cli-reference/dfx-envars.mdx +++ b/docs/cli-reference/dfx-envars.mdx @@ -4,9 +4,9 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; -You can configure certain properties for your SDK execution environment using environment variables. +You can configure certain properties for your local development environment using environment variables. -This section lists the environment variables that are currently supported with examples of how to use them. In most cases, you can set environment variables for a session by executing an command in the terminal or by adding a line similar to the following to your `.profile` file: +This section lists the environment variables that are currently supported with examples of how to use them. In most cases, you can set environment variables for a session by executing a command in the terminal or by adding a line similar to the following to your `.profile` file: ```shell export DFX_NETWORK=ic @@ -18,11 +18,13 @@ Use environment variables with the `CANISTER_CANDID_PATH` prefix to reference th For example, if you have a `whoami_frontend` canister that lists `whoami` under the `dependencies` key, you could use the `CANISTER_CANDID_PATH_whoami_frontend` environment variable to refer to the location of the `whoami.did` file, which for local development might be: - $PROJECT_ROOT/.dfx/local/canisters/whoami/whoami.did +``` +$PROJECT_ROOT/.dfx/local/canisters/whoami/whoami.did +``` ## CANISTER_ID\_\{canister.name\} -Use environment variables with the `CANISTER_ID` prefix to reference the canister identifier for each canister in the `dfx.json` file for your project. Hyphens are invalid in environment variables and are replaced by underscores. Lowercase characters are replaced by uppercase characters. +Use environment variables with the `CANISTER_ID` prefix to reference the canister identifier for each canister in the `dfx.json` file for your project. Hyphens are invalid in environment variables and are replaced by underscores. Lowercase characters are replaced by uppercase characters. For example, if you have a `linkedup` project that consists of the `linkedup` and `connect-d` canisters, you could use the `CANISTER_ID_LINKEDUP` and `CANISTER_ID_CONNECT_D` environment variables to refer to the canister identifiers—for example `ryjl3-tyaaa-aaaaa-aaaba-cai` and `rrkah-fqaaa-aaaaa-aaaaq-cai`—created for your project. @@ -32,13 +34,15 @@ Use the `DFX_CONFIG_ROOT` environment variable to specify a different location f By default, the `.cache` and `.config` directories are located in the home directory for your development environment. For example, on macOS the default location is in the `/Users/` directory. Use the `DFX_CONFIG_ROOT` environment variable to specify a different location for these directories. - DFX_CONFIG_ROOT=~/ic-root +``` +DFX_CONFIG_ROOT=~/ic-root +``` ## DFX_INSTALLATION_ROOT Use the `DFX_INSTALLATION_ROOT` environment variable to specify a different location for the `dfx` binary if you are not using the default location for your operating system. -The `.cache/dfinity/uninstall.sh` script uses this environment variable to identify the root directory for your SDK installation. +The `.cache/dfinity/uninstall.sh` script uses this environment variable to identify the root directory for your `dfx` installation. ## DFX_NETWORK @@ -49,17 +53,19 @@ If you pass the `--network` option to a `dfx` command, the value of the `DFX_NET Use the `DFX_VERSION` environment variable to identify a specific version of the SDK that you want to install. - DFX_VERSION=0.10.0 sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" +``` +DFX_VERSION=0.10.0 sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" +``` ## DFX_MOC_PATH -Use the `DFX_MOC_PATH` environment variable to use a different version of the Motoko compiler than the one bundled with a given dfx version. +Use the `DFX_MOC_PATH` environment variable to use a different version of the Motoko compiler than the one bundled with a given `dfx` version. ## DFX_WARNING -Use the `DFX_WARNING` environment variable to disable one or more warnings that dfx may display. The value is a comma-separated list of warning names, each prefixed with a "-" to disable. The following warning names are currently supported: +Use the `DFX_WARNING` environment variable to disable one or more warnings that `dfx` may display. The value is a comma-separated list of warning names, each prefixed with a "-" to disable. The following warning name is currently supported: -- `mainnet_plaintext_identity`: Disables the warning message that is displayed when you use an insecure identity on the Internet Computer mainnet. +- `mainnet_plaintext_identity`: Disables the warning message that is displayed when you use an insecure identity on the mainnet. ```bash export DFX_WARNING="-mainnet_plaintext_identity" diff --git a/docs/cli-reference/dfx-generate.mdx b/docs/cli-reference/dfx-generate.mdx index ee4374d456..af31fff5f3 100644 --- a/docs/cli-reference/dfx-generate.mdx +++ b/docs/cli-reference/dfx-generate.mdx @@ -6,7 +6,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; Use the `dfx generate` command to generate canister type declarations for supported programming languages. Currently, `dfx generate` supports four languages: Motoko, Candid, JavaScript, and TypeScript. -You can use this command to generate type declarations for all canisters that are defined for a project in the project’s `dfx.json` configuration file or a specific canister. +You can use this command to generate type declarations for all canisters that are defined in the project’s `dfx.json` configuration file or for a specific canister. Note that you can only run this command from within the project directory structure. For example, if your project name is `hello_world`, your current working directory must be the `hello_world` top-level project directory or one of its subdirectories. @@ -47,7 +47,7 @@ Outputs from `dfx generate`: ## Examples -Note that the file name and path to the programs on your file system must match the information specified in the `dfx.json` configuration file. +Note that the file name and path to the canisters on your file system must match the information specified in the `dfx.json` configuration file. In this example, the `hello_world` canister itself is written in Motoko. The `declarations` section specifies that type declarations for all four languages will be generated and stored at `src/declarations/`. @@ -55,7 +55,7 @@ In this example, the `hello_world` canister itself is written in Motoko. The `de dfx generate hello_world ``` -Since there is only one canister in `dfx.json`, calling `dfx generate` without an argument will have the same effect as the above command. If there were multiple canisters defined in `dfx.json`, this would generate type declarations for all defined canisters. +If there is only one canister in `dfx.json`, calling `dfx generate` without an argument will have the same effect as the above command. If there were multiple canisters defined in `dfx.json`, this would generate type declarations for all defined canisters. ``` bash dfx generate diff --git a/docs/cli-reference/dfx-identity.mdx b/docs/cli-reference/dfx-identity.mdx index 420b2e4b0b..12bdce8efd 100644 --- a/docs/cli-reference/dfx-identity.mdx +++ b/docs/cli-reference/dfx-identity.mdx @@ -4,7 +4,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; -Use the `dfx identity` command with subcommands and flags to manage the identities used to execute commands and communicate with the IC or the local development environment. Creating multiple user identities enables you to test user-based access controls. +Use the `dfx identity` command with subcommands and flags to manage the identities used to execute commands and communicate with the mainnet or the local development environment. Creating multiple user identities enables you to test user-based access controls. The basic syntax for running `dfx identity` commands is: @@ -22,7 +22,7 @@ For reference information and examples that illustrate using `dfx identity` comm | Command | Description | |-------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| -| [`deploy-wallet`](#dfx-identity-deploy-wallet) | Installs the wallet Wasm to the provided canister id. | +| [`deploy-wallet`](#dfx-identity-deploy-wallet) | Installs the cycles wallet Wasm to the provided canister id. | | [`get-principal`](#dfx-identity-get-principal) | Shows the textual representation of the principal associated with the current identity. | | [`get-wallet`](#dfx-identity-get-wallet) | Shows the canister identifier for the wallet associated with your current identity principal. | | `help` | Displays this usage message or the help of the given subcommand(s). | @@ -42,15 +42,17 @@ The first time you run the `dfx canister create` command to register an identifi You can then use `dfx identity new` to create new user identities and store credentials for those identities in `$HOME/.config/dfx/identity//identity.pem` files. For example, you can create an identity named `ic_admin` by running the following command: - dfx identity new ic_admin +``` +dfx identity new ic_admin +``` This command adds a private key for the `ic_admin` user identity in the `~/.config/dfx/identity/ic_admin/identity.pem` file. ## dfx identity deploy-wallet -Use the `dfx identity deploy-wallet` command to turn a canister into a wallet canister by installing the wallet Wasm to it. +Use the `dfx identity deploy-wallet` command to turn a canister into a cycles wallet canister by installing the cycles wallet Wasm to it. -Note that you must be connected to the IC or the local development environment to run this command. In addition, you must be a controller of the canister you want to deploy the wallet to. +Note that you must be connected to the mainnet or the local development environment to run this command. In addition, you must be a controller of the canister you want to deploy the wallet to. ### Basic usage @@ -64,7 +66,7 @@ You must specify the following argument for the `dfx identity deploy-wallet` com | Argument | Description | |-----------------|----------------------------------------------------------------| -| `` | The ID of the canister where the wallet Wasm will be deployed. | +| `` | The ID of the canister where the cycles wallet Wasm will be deployed. | ## dfx identity get-principal @@ -93,7 +95,7 @@ In this example, the first command sets the user context to use the `ic_admin` i Use the `dfx identity get-wallet` command to display the canister identifier for the wallet associated with your current identity principal. -Note that you must be connected to the IC or the local development environment to run this command. In addition, you must be in a project directory to run the command. For example, if your project name is `hello_world`, your current working directory must be the `hello_world` top-level project directory or one of its subdirectories to run the `dfx identity get-wallet` command. +Note that you must be connected to the mainnet or the local development environment to run this command. In addition, you must be in a project directory to run the command. For example, if your project name is `hello_world`, your current working directory must be the `hello_world` top-level project directory or one of its subdirectories to run the `dfx identity get-wallet` command. ### Basic usage @@ -109,7 +111,7 @@ If you want to display the canister identifier for the wallet canister associate dfx identity get-wallet ``` -To display the canister identifier for the wallet canister associated with your identity on a specific testnet, you might run a command similar to the following: +To display the canister identifier for the wallet canister associated with your identity on a specific local network, you might run a command similar to the following: ``` bash dfx identity get-wallet --network=https://192.168.74.4 @@ -138,8 +140,7 @@ dfx identity export alice >generated-id.pem Use the `dfx identity import` command to create a user identity by importing the user’s key information or security certificate from a PEM file or seed phrase file. -*Password policy*: If an identity is imported using `--storage-mode password-protected`, the following requirements apply to the password: -- The password needs to be longer than 8 characters. +If an identity is imported using `--storage-mode password-protected`, the password needs to be longer than 8 characters. ### Basic usage @@ -201,8 +202,7 @@ In this example, the `bob_standard` identity is the currently-active user contex Use the `dfx identity new` command to add new user identities. You should note that the identities you add are global. They are not confined to a specific project context. Therefore, you can use any identity you add using the `dfx identity new` command in any project. Only the characters `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_@0123456789` are valid in identity names. -*Password policy*: If an identity is created using `--storage-mode password-protected`, the following requirements apply to the password: -- The password needs to be longer than 8 characters. +If an identity is created using `--storage-mode password-protected`, the password needs to be longer than 8 characters. ### Basic usage @@ -220,7 +220,7 @@ You must specify the following argument for the `dfx identity new` command. ### Options -You can specify the following options for the `+dfx identity new+` command. +You can specify the following options for the `dfx identity new` command. |Argument|Description| |--------|-----------| @@ -233,14 +233,18 @@ You can specify the following options for the `+dfx identity new+` command. You can then use `dfx identity new` to create new user identities and store credentials for those identities in `$HOME/.config/dfx/identity//identity.pem` files. For example, you can create an identity named `ic_admin` by running the following command: - dfx identity new ic_admin +``` +dfx identity new ic_admin +``` This command adds a private key for the `ic_admin` user identity in the `~/.config/dfx/identity/ic_admin/identity.pem` file. After adding the private key for the new identity, the command displays confirmation that the identity has been created: - Creating identity: "ic_admin". - Created identity: "ic_admin". +``` +Creating identity: "ic_admin". +Created identity: "ic_admin". +``` ## dfx identity remove @@ -272,22 +276,30 @@ You must specify the following argument for the `dfx identity remove` command. You can use the `dfx identity remove` command to remove any previously-created identity, including the `default` user identity. For example, if you have added named user identities and want to remove the `default` user identity, you can run the following command: - dfx identity remove default +``` +dfx identity remove default +``` The command displays confirmation that the identity has been removed: - Removing identity "default". - Removed identity "default". +``` +Removing identity "default". +Removed identity "default". +``` Although you can delete the `default` identity if you have created other identities to replace it, you must always have at least one identity available. If you attempt to remove the last remaining user context, the `dfx identity remove` command displays an error similar to the following: - Identity error: - Cannot delete the default identity +``` +Identity error: + Cannot delete the default identity +``` If you have an identity with one or more wallets configured, it will only be deleted if you call it with `--drop-wallets`. This is made so that users don't accidentally lose access to their cycles wallets. If you try to delete an identity with at least one wallet configured, it will display the attached wallets like this: - This identity is connected to the following wallets: - identity 'mainnet' on network 'ic' has wallet rwlgt-iiaaa-aaaaa-aaaaa-cai +``` +This identity is connected to the following wallets: + identity 'mainnet' on network 'ic' has wallet rwlgt-iiaaa-aaaaa-aaaaa-cai +``` ## dfx identity rename @@ -312,7 +324,9 @@ You must specify the following arguments for the `dfx identity rename` command. You can rename the `default` user or any identity you have previously created using the `dfx identity rename` command. For example, if you want to rename a `test_admin` identity that you previously created, you would specify the current identity name you want to change **from** and the new name you want to change **to** by running a command similar to the following: - dfx identity rename test_admin devops +``` +dfx identity rename test_admin devops +``` ## dfx identity set-wallet @@ -330,7 +344,7 @@ You can use the following optional flags with the `dfx identity set-wallet` comm | Flag | Description | |-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `--force` | Skips verification that the canister you specify is a valid wallet canister. This option is only useful if you are connecting to the IC running locally. | +| `--force` | Skips verification that the canister is a valid wallet canister. This option is only useful if you are connecting to the local development environment. | ### Example @@ -348,9 +362,9 @@ dfx identity set-wallet --canister-name ${WALLET_CANISTER_ID} --network=https:// Use the `dfx identity use` command to specify the user identity you want to active. You should note that the identities you have available to use are global. They are not confined to a specific project context. Therefore, you can use any identity you have previously created in any project. The identity used by a command is: -- the identity specified in the command with `--identity `, if defined -- else the identity specified by the environment variable `export DFX_IDENTITY=`, if defined -- the identity specified by `dfx identity use `. +- The identity specified in the command with `--identity `, if defined. +- The identity specified by the environment variable `export DFX_IDENTITY=`, if defined. +- The identity specified by `dfx identity use `. ### Basic usage @@ -370,7 +384,9 @@ You must specify the following argument for the `dfx identity use` command. If you want to run multiple commands with the same user identity context, you can run a command similar to the following: - dfx identity use ops +``` +dfx identity use ops +``` After running this command, subsequent commands use the credentials and access controls associated with the `ops` user. @@ -392,6 +408,4 @@ If you want to display the name of the currently-active user identity, you can r dfx identity whoami ``` -The command displays the name of the user identity. For example, you had previously run the command `dfx identity use bob_standard`, the command would display: - - bob_standard +The command displays the name of the user identity. diff --git a/docs/cli-reference/dfx-info.mdx b/docs/cli-reference/dfx-info.mdx index 1b4adbef0c..9b034c78b4 100644 --- a/docs/cli-reference/dfx-info.mdx +++ b/docs/cli-reference/dfx-info.mdx @@ -10,14 +10,14 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; dfx info [type] [flag] ``` -## Information Types +## Information types These are the types of information that the `dfx info` command can display. | Information | Description | |-------------------------------|----------------------------------------------------------------------------------------------------------------------| | candid-ui-url | The URL of the Candid UI canister. | -| config-json-path | Path to DFX configuration `config.json`. | +| config-json-path | Path to `dfx` configuration `config.json`. | | networks-json-path | Path to network definition file `networks.json`. | | default-effective-canister-id | The effective canister ID that dfx will use for management canister calls that don't imply one. | | replica-port | The listening port of the replica. | diff --git a/docs/cli-reference/dfx-killall.mdx b/docs/cli-reference/dfx-killall.mdx index 527046cdfc..9d519b1663 100644 --- a/docs/cli-reference/dfx-killall.mdx +++ b/docs/cli-reference/dfx-killall.mdx @@ -4,7 +4,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; -Use the `dfx killall` command to forcibly kill every DFX-related process. +Use the `dfx killall` command to forcibly kill all `dfx`-related process. ## Basic usage @@ -20,4 +20,4 @@ You can kill a stuck process that is not responding to `dfx stop` with this comm dfx killall ``` -This may impact IDE plugins, including from other versions of DFX. For ordinary usage `dfx stop` should be preferred. +This may impact IDE plugins, including from other versions of `dfx`. For ordinary usage `dfx stop` should be preferred. diff --git a/docs/cli-reference/dfx-ledger.mdx b/docs/cli-reference/dfx-ledger.mdx index 69f19fe1c2..b10a4ba8fb 100644 --- a/docs/cli-reference/dfx-ledger.mdx +++ b/docs/cli-reference/dfx-ledger.mdx @@ -4,9 +4,9 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; -Use the `dfx ledger` command to interact with the ledger canister. +Use the `dfx ledger` command to interact with the ICP token's ledger canister. -This command can be used to make ICP utility token transactions from one canister to another, or top up canisters with cycles from ICP. +This command can be used to make ICP utility token transactions from one canister to another, or top-up canisters with cycles from converting ICP. The basic syntax for running `dfx ledger` commands is: @@ -18,16 +18,16 @@ Depending on the `dfx ledger` subcommand you specify, additional arguments, opti | Command | Description | |---------------------------------------|--------------------------------------------------------------------------------------| -| [`account-id`](#dfx-ledger-account-id) | Prints the selected identity’s Account Identifier. | +| [`account-id`](#dfx-ledger-account-id) | Prints the selected identity’s account identifier. | | [`approve`](#dfx-ledger-approve) | Approve a principal to spend ICP on your behalf. | | [`balance`](#dfx-ledger-balance) | Prints the account balance of the user. | | [`create-canister`](#dfx-ledger-create-canister) | Creates a canister from ICP. | -| [`fabricate-cycles`](#dfx-ledger-fabricate-cycles) | Local development only: Fabricate cycles out of thin air and deposit them into the specified canister(s) | +| [`fabricate-cycles`](#dfx-ledger-fabricate-cycles) | Local development only: Fabricate cycles out of thin air and deposit them into the specified canister(s). | | `help` | Displays usage information message for a specified subcommand. | | [`notify`](#dfx-ledger-notify) | Notifies the ledger when there is a send transaction to the cycles minting canister. | | [`top-up`](#dfx-ledger-top-up) | Tops up a canister with cycles minted from ICP. | -| [`transfer`](#dfx-ledger-transfer) | Transfers ICP from the user to the destination Account Identifier or principal. | -| [`transfer-from`](#dfx-ledger-transfer-from) | Transfer ICP from the approver princiapl to another principal. | +| [`transfer`](#dfx-ledger-transfer) | Transfers ICP from the user to the destination account identifier or principal. | +| [`transfer-from`](#dfx-ledger-transfer-from) | Transfer ICP from the approver principal to another principal. | To view usage information for a specific subcommand, specify the subcommand and the `--help` flag. For example, to see usage information for `dfx ledger transfer`, you can run the following command: @@ -51,9 +51,9 @@ You can use the following optional flags with the `dfx ledger account-id` comman |------------------------------|--------------------------------------------------------| | `-h`, `--help` | Displays usage information. | | `-V`, `--version` | Displays version information. | -| `--of-canister ` | Alias or principal of the canister controlling the account | -| `--of-principal ` | Principal controlling the account | -| `--subaccount ` | Subaccount identifier (64 character long hex string) | +| `--of-canister ` | Alias or principal of the canister controlling the account. | +| `--of-principal ` | Principal controlling the account. | +| `--subaccount ` | Subaccount identifier (64 character long hex string). | | `--subaccount-of-principal ` | Principal from which the subaccount identifier is derived. | ### Examples @@ -72,7 +72,9 @@ dfx ledger account-id --of-canister qvhpv-4qaaa-aaaaa-aaagq-cai --subaccount-fro The commands display output similar to the following: - 03e3d86f29a069c6f2c5c48e01bc084e4ea18ad02b0eec8fccadf4487183c223 +``` +03e3d86f29a069c6f2c5c48e01bc084e4ea18ad02b0eec8fccadf4487183c223 +``` ## dfx ledger approve @@ -91,7 +93,7 @@ You must specify the following arguments for the `dfx ledger approve` command. | Argument | Description | |---------------------|---------------------------------------| | `` | Allow this principal to spend ICP. | -| `--amount ` | The number of ICPs to approve. Can be specified as a Decimal with the fractional portion up to 8 decimal places i.e. 100.012. | +| `--amount ` | The number of ICPs to approve. Can be specified as a decimal with the fractional portion up to 8 decimal places i.e. 100.012. | ### Options @@ -99,10 +101,10 @@ You can specify the following options for the `dfx ledger approve` command. | Option | Description | |-------------------------------------|----------------------------------------------------------------------------------------| -| `--created-at-time ` | Specify the timestamp-nanoseconds for the `created_at_time` field on the transfer request. Useful for controlling [transaction-de-duplication](https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication-). | +| `--created-at-time ` | Specify the timestamp-nanoseconds for the `created_at_time` field on the transfer request. Useful for controlling transaction-de-duplication. | | `--expected-allowance `| The number of previously approved ICP. See [ICRC-2 standard](https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/README.md) for details. | | `--expires-at ` | Timestamp in nanoseconds until which the approval is valid. None means that the approval is valid indefinitely. | -| `--fee ` | Transaction fee, default is 0.00010000 ICP (10000 e8s) | +| `--fee ` | Transaction fee, default is 0.00010000 ICP (10000 e8s). | | `--from-subaccount ` | Approve ICP to be spent from this subaccount. | | `--memo ` | Specifies a numeric memo for this transaction. | | `--spender-subaccount ` | Allow this subaccount to spend ICP. | @@ -167,7 +169,7 @@ You can specify the following argument for the `dfx ledger balance` command. | Argument | Description | |----------|------------------------------------------------------------------------------------------------| -| `` | Specify an Account Identifier to get the balance of. If both this argument and `--of-principal` option are not specified, the currently-selected user identity will be used. | +| `` | Specify an account identifier to get the balance of. If both this argument and `--of-principal` option are not specified, the currently-selected user identity will be used. | ### Options @@ -180,7 +182,7 @@ You can specify the following argument for the `dfx ledger balance` command. ### Examples -You can use the `dfx ledger balance` command to check the balance of another user. For example, you can run the following command to see the ICP utlity tokens associated with a known Account Identifier: +You can use the `dfx ledger balance` command to check the balance of another user. For example, you can run the following command to see the ICP utility tokens associated with a known account identifier: ``` bash dfx ledger balance 03e3d86f29a069c6f2c5c48e01bc084e4ea18ad02b0eec8fccadf4487183c223 --network ic @@ -202,7 +204,7 @@ dfx ledger balance --of-principal tdrdy-ztedg-ftfrj-mwmqh-wjl3j-pty4c-j63lp-xfvt ## dfx ledger create-canister -Use the `dfx ledger create-canister` command to convert ICP tokens to cycles and to register a new canister identifier on the IC. +Use the `dfx ledger create-canister` command to convert ICP tokens to cycles and to register a new canister identifier on the mainnet. ### Basic usage @@ -225,14 +227,14 @@ You can specify the following argument for the `dfx ledger create-canister` comm | Option | Description | |-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `--amount ` | Specify the number of ICP tokens to mint into cycles and deposit into destination canister. You can specify an amount as a number with up to eight (8) decimal places. | -| `--e8s ` | Specify ICP token fractional units—called e8s—as a whole number, where one e8 is smallest partition of an ICP token. For example, 1.05000000 is 1 ICP and 5000000 e8s. You can use this option on its own or in conjunction with the `--icp` option. | +| `--e8s ` | Specify ICP token fractional units (called e8s) as a whole number, where one e8 is smallest partition of an ICP token. For example, 1.05000000 is 1 ICP and 5000000 e8s. You can use this option on its own or in conjunction with the `--icp` option. | | `--fee ` | Specify a transaction fee. The default is 10000 e8s. | | `--icp ` | Specify ICP tokens as a whole number. You can use this option on its own or in conjunction with `--e8s`. | | `--max-fee ` | Specify a maximum transaction fee. The default is 10000 e8s. | | `--subnet-type ` | Specify the optional subnet type to create the canister on. If no subnet type is provided, the canister will be created on a random default application subnet. `dfx ledger show-subnet-types` can be used to list available subnet types. | | `--subnet ` | Specify the optional subnet to create the canister on. If no subnet is provided, the canister will be created on a random default application subnet. | | `--next-to ` | Create canisters on the same subnet as this canister. | -| `--created-at-time `| Specify the timestamp-nanoseconds for the `created_at_time` field on the ledger transfer request. Useful for controlling transaction-de-duplication. https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication- | +| `--created-at-time `| Specify the timestamp-nanoseconds for the `created_at_time` field on the ledger transfer request. Useful for controlling transaction-de-duplication. | ### Examples @@ -248,8 +250,10 @@ In this example, the command converts 1.25 ICP tokens into cycles and specifies If the transaction is successful, the ledger records the event and you should see output similar to the following: - Transfer sent at BlockHeight: 20 - Canister created with id: "53zcu-tiaaa-aaaaa-qaaba-cai" +``` +Transfer sent at BlockHeight: 20 +Canister created with id: "53zcu-tiaaa-aaaaa-qaaba-cai" +``` You can create a new canister by specifying separate values for ICP tokens and e8s by running a command similar to the following: @@ -275,8 +279,8 @@ If no amount is specified, 10T cycles are used by default. |Option |Description| |-------|-----------| -|`--all` |Deposit cycles to all of the canisters configured in the dfx.json file. | -|`--amount ` |ICP to mint into cycles and deposit into destination canister Can be specified as a Decimal with the fractional portion up to 8 decimal places i.e. 100.012 | +|`--all` |Deposit cycles to all of the canisters configured in the `dfx.json` file. | +|`--amount ` |ICP to mint into cycles and deposit into destination canister Can be specified as a decimal with the fractional portion up to 8 decimal places i.e. 100.012 | |`--canister ` |Specifies the name or id of the canister to receive the cycles deposit. You must specify either a canister name/id or the --all option. | |`--cycles ` | Specifies the amount of cycles to fabricate. | |`--e8s ` | Specify e8s as a whole number, helpful for use in conjunction with `--icp`| @@ -285,7 +289,7 @@ If no amount is specified, 10T cycles are used by default. ### Examples -If you are developing locally and want to add 8T cycles to all your canisters in your procject, you can do so like this: +If you are developing locally and want to add 8T cycles to all your canisters in your project, you can do so like this: ``` dfx ledger fabricate-cycles --all --cycles 8000000000000 @@ -311,15 +315,14 @@ Fabricating 8000000000000 cycles onto hello Fabricated 8000000000000 cycles, updated balance: 11_899_662_119_932 cycles ``` - ## dfx ledger notify -Use the `dfx ledger notify` command to notify the ledger about a transaction sent to the cycles minting canister. This command should only be used if `dfx ledger create-canister`, `dfx ledger top-up`, or `dfx cycles convert` successfully sent a message to the ledger, and a transaction was recorded at some block height, but for some reason the subsequent notify failed. +Use the `dfx ledger notify` command to notify the ledger about a transaction sent to the cycles minting canister. This command should only be used if `dfx ledger create-canister`, `dfx ledger top-up`, or `dfx cycles convert` successfully sent a message to the ledger, and a transaction was recorded at some block height but for some reason the subsequent notify failed. ### Basic usage ``` bash -dfx ledger notify [options] _block-height_ _destination-principal_ +dfx ledger notify [options] ``` ### Arguments @@ -329,11 +332,11 @@ You can specify the following argument for the `dfx ledger notify` command. | Argument | Description | |---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `` | Specifies the block height at which the send transaction was recorded. | -| `` | Specifies the principal of the destination, either a canister identifier or the textual representation of a user principal. If the send transaction was for the `create-canister` command, specify the `controller` principal. If the send transaction was for the `top-up` command, specify the `canister ID`. | +| `` | Specifies the principal of the destination, either a canister identifier or the textual representation of a user principal. If the send transaction was for the `create-canister` command, specify the `controller` principal. If the send transaction was for the `top-up` command, specify the canister ID. | ### Examples -The following example illustrates sending a `notify` message to the ledger in response to a `_send+` transaction that was recorded at the block height `75948`. +The following example illustrates sending a `notify` message to the ledger in response to a `send` transaction that was recorded at the block height `75948`. ``` bash dfx ledger notify 75948 tsqwz-udeik-5migd-ehrev-pvoqv-szx2g-akh5s-fkyqc-zy6q7-snav6-uqe --network ic @@ -355,11 +358,11 @@ You can specify the following options for the `dfx ledger show-subnet-types` com | Option | Description | |-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `--cycles-minting-canister-id ` | Canister id of the cycles minting canister. Useful if you want to test locally with a different id for the cycles minting canister. | +| `--cycles-minting-canister-id ` | Canister ID of the cycles minting canister. Useful if you want to test locally with a different ID for the cycles minting canister. | ### Examples -You can use the `dfx ledger show-subnet-types` command to list the available subnet types that can be chosen to create a canister on. If a specific cycles minting canister id is not provided, then the mainnet cycles minting canister id will be used. +You can use the `dfx ledger show-subnet-types` command to list the available subnet types that can be chosen to create a canister on. If a specific cycles minting canister ID is not provided, then the mainnet cycles minting canister ID will be used. For example, you can run the following command to get the subnet types available on mainnet: @@ -369,11 +372,13 @@ dfx ledger show-subnet-types This command displays output similar to the following: - ["Type1", "Type2", ..., "TypeN"] +``` +["Type1", "Type2", ..., "TypeN"] +``` ## dfx ledger top-up -Use the `dfx ledger top-up` command to top up a canister with cycles minted from ICP tokens. +Use the `dfx ledger top-up` command to top-up a canister with cycles minted from ICP tokens. ### Basic usage @@ -387,7 +392,7 @@ You can specify the following argument for the `dfx ledger top-up` command. | Argument | Description | |------------|--------------------------------------------------------------------------| -| `canister` | Specifies the canister identifier or name that you would like to top up. | +| `canister` | Specifies the canister identifier or name that you would like to top-up. | ### Options @@ -396,15 +401,15 @@ You can specify the following options for the `dfx ledger top-up` command. | Option | Description | |-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `--amount ` | Specifies the number of ICP tokens to mint into cycles and deposit into the destination canister. You can specify the amount as a number with up to eight (8) decimal places. | -| `--e8s ` | Specifies fractional units of an ICP token—called e8s—as a whole number, where one e8 is the smallest unit of an ICP token. For example, 1.05000000 is 1 ICP and 5000000 e8s. You can use this option on its own or in conjunction with the `--icp` option. | +| `--e8s ` | Specifies fractional units of an ICP token (called e8s) as a whole number, where one e8 is the smallest unit of an ICP token. For example, 1.05000000 is 1 ICP and 5000000 e8s. You can use this option on its own or in conjunction with the `--icp` option. | | `--fee ` | Specifies the transaction fee for the operation. The default is 10000 e8s. | | `--icp ` | Specifies ICP tokens as a whole number. You can use this option on its own or in conjunction with `--e8s`. | | `--max-fee ` | Specifies a maximum transaction fee. The default is 10000 e8s. | -| `--created-at-time `| Specify the timestamp-nanoseconds for the `created_at_time` field on the ledger transfer request. Useful for controlling transaction-de-duplication. https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication- | +| `--created-at-time `| Specify the timestamp-nanoseconds for the `created_at_time` field on the ledger transfer request. Useful for controlling transaction de-duplication. | ### Examples -You can use the `dfx ledger top-up` command to top up the cycles of a specific canister from the balance of ICP tokens you control. The canister identifier must be associated with a cycles wallet canister that is able to receive cycles. Alternatively, you can modify a non-cycles wallet canister to implement a method to receive cycles using system APIs described in the [Internet Computer Interface Specification](/docs/current/references/ic-interface-spec). +You can use the `dfx ledger top-up` command to top-up the cycles of a specific canister from the balance of ICP tokens you control. The canister identifier must be associated with a cycles wallet canister that is able to receive cycles. Alternatively, you can modify a non-cycles wallet canister to implement a method to receive cycles using system APIs described in the [IC interface specification](https://internetcomputer.org/docs/references/ic-interface-spec). For example, you can run the following command to top-up a cycles wallet canister deployed on the Internet Computer with 1 ICP worth of cycles: @@ -433,7 +438,7 @@ You can specify the following argument for the `dfx ledger transfer` command. | Argument | Description | |---------------------|-------------------------------------------------------------------------------------| -| `` | Specify the Account Identifier or address to which you want to transfer ICP tokens. | +| `` | Specify the account identifier or address to which you want to transfer ICP tokens. | | `--memo ` | Specifies a numeric memo for this transaction. | ### Options @@ -443,7 +448,7 @@ You can specify the following argument for the `dfx ledger transfer` command. | Option | Description | |---------------------|-------------------------------------------------------------------------------------| | `--amount ` | Specifies the number of ICP tokens to transfer. Can be specified as a number with up to eight (8) decimal places. | -| `--created-at-time `| Specify the timestamp-nanoseconds for the `created_at_time` field on the ledger transfer request. Useful for controlling transaction-de-duplication. https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication- | +| `--created-at-time `| Specify the timestamp-nanoseconds for the `created_at_time` field on the ledger transfer request. Useful for controlling transaction de-duplication. | | `--e8s ` | Specifies e8s as a whole number, where one e8 is smallest partition of an ICP token. For example, 1.05000000 is 1 ICP and 5000000 e8s. You can use this option alone or in conjunction with the `--icp` option. | | `--fee ` | Specifies a transaction fee. The default is 0.00010000 ICP (10000 e8s). | | `--from-subaccount ` | Specifies the subaccount from which you want to transfer ICP tokens. | @@ -453,7 +458,7 @@ You can specify the following argument for the `dfx ledger transfer` command. ### Examples -You can use the `dfx ledger transfer` command to send ICP to the Account Identifier of the destination. +You can use the `dfx ledger transfer` command to send ICP to the account identifier of the destination. For example, you can run the following command to check the account identifier associated with the principal you are currently using: @@ -463,7 +468,9 @@ dfx ledger account-id This command displays output similar to the following: - 30e596fd6c5ff5ad7b7d70bbbda1187c833e646c6251464da7f82bc217bba397 +``` +30e596fd6c5ff5ad7b7d70bbbda1187c833e646c6251464da7f82bc217bba397 +``` You can check the balance of this account by running the following command: @@ -473,7 +480,9 @@ dfx ledger balance --network ic This command displays output similar to the following: - 64.89580000 ICP +``` +64.89580000 ICP +``` Use the `dfx ledger transfer` command to send some of your ICP balance to another known destination using the following command: @@ -499,7 +508,7 @@ dfx ledger transfer --to-principal tdrdy-ztedg-ftfrj-mwmqh-wjl3j-pty4c-j63lp-xfv ## dfx ledger transfer-from -Use the `dfx ledger transfer-from` command to transfer ICP from the approver princiapl to another principal. Please check the [ICRC-2 standard](https://github.com/dfinity/ICRC-1/tree/main/standards/ICRC-2) for more information about token `approve` and `transfer-from`. +Use the `dfx ledger transfer-from` command to transfer ICP from the approver principal to another principal. Please check the [ICRC-2 standard](https://github.com/dfinity/ICRC-1/tree/main/standards/ICRC-2) for more information about token `approve` and `transfer-from`. ### Basic usage @@ -513,7 +522,7 @@ You must specify the following arguments for the `dfx ledger transfer-from` comm | Argument | Description | |---------------------|--------------------------------------------| -| `--amount ` | The number of ICPs to transfer. Can be specified as a Decimal with the fractional portion up to 8 decimal places i.e. 100.012. | +| `--amount ` | The number of ICPs to transfer. Can be specified as a decimal with the fractional portion up to 8 decimal places i.e. 100.012. | | `--from ` | Transfer ICP from this approver principal. | | `` | Transfer ICP to this principal. | @@ -523,7 +532,7 @@ You can specify the following options for the `dfx ledger transfer-from` command | Option | Description | |-------------------------------------|----------------------------------------------------------------------------------------| -| `--created-at-time ` | Specify the timestamp-nanoseconds for the `created_at_time` field on the transfer request. Useful for controlling [transaction-de-duplication](https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication-). | +| `--created-at-time ` | Specify the timestamp-nanoseconds for the `created_at_time` field on the transfer request. Useful for controlling transaction de-duplication. | | `--fee ` | Transaction fee, default is 0.00010000 ICP (10000 e8s). | | `--from-subaccount ` | Transfer ICP from this subaccount. | | `--memo ` | Specifies a numeric memo for this transaction. | diff --git a/docs/cli-reference/dfx-new.mdx b/docs/cli-reference/dfx-new.mdx index 50b7778240..611465d07c 100644 --- a/docs/cli-reference/dfx-new.mdx +++ b/docs/cli-reference/dfx-new.mdx @@ -4,7 +4,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; -Use the `dfx new` command to create a new project for the IC. This command creates a default project structure with template files that you can modify to suit your dapp. You must specify the name of the project to you want to create. +Use the `dfx new` command to create a new project. This command creates a default project structure with template files that you can modify to suit your dapp. You must specify the name of the project to you want to create. You can use the `--dry-run` option to preview the directories and files to be created without adding them to the file system. @@ -24,8 +24,8 @@ You can use the following optional flags with the `dfx new` command: |-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `--dry-run` | Generates a preview of the directories and files to be created for a new project without adding them to the file system. | | `--extras ` | Comma-separated list of additional features to add to the project template. `bitcoin` and `internet-identity` will insert the appropriate boilerplate into `dfx.json`, and `frontend-tests` adds a `vitest` skeleton to the frontend project. | -| `--frontend ` | Installs the template frontend code for the default project canister. The default value for the flag is `vanilla` if `node.js` is currently installed on your local computer. If `node.js` is not currently installed, you can set this flag to attempt to install `node.js` and the template file when creating the project or you can set the flag to `none` to skip the installation of template frontend code entirely. Possible values: `svelte`, `react`, `vue`, `vanilla`, `plain-assets`, `none`. | -| `--no-frontend` | Skips installing the frontend template code. This is the default behavior if `node.js` is currently not installed on your computer. Equivalent to `--frontend none`. | +| `--frontend ` | Installs the template frontend code for the default project canister. The default value for the flag is `vanilla` if NodeJS is currently installed on your local computer. If NodeJS is not currently installed, you can set this flag to attempt to install NodeJS and the template file when creating the project or you can set the flag to `none` to skip the installation of template frontend code entirely. Possible values: `svelte`, `react`, `vue`, `vanilla`, `plain-assets`, `none`. | +| `--no-frontend` | Skips installing the frontend template code. This is the default behavior if NodeJS is currently not installed on your computer. Equivalent to `--frontend none`. | | `--type ` | Selects the template backend code for the default project canister. The default value for the flag is `motoko`. Possible values: `motoko`, `rust`, `azle`, `kybra`. | ## Arguments @@ -35,7 +35,7 @@ You can specify the following argument for the `dfx new` command. | Argument | Description | |----------------|-------------------------------------------------------------------------| | `project_name` | Specifies the name of the project to create. This argument is required. | -| `--type` | Choose the canister type in the starter project, motoko and rust are available. The default is motoko. | +| `--type` | Choose the canister type in the starter project, `motoko`, `rust`, `azle`, and `kybra` are available. The default is `motoko`. | ## Examples diff --git a/docs/cli-reference/dfx-nns.mdx b/docs/cli-reference/dfx-nns.mdx index b4324f1c13..774963b17e 100644 --- a/docs/cli-reference/dfx-nns.mdx +++ b/docs/cli-reference/dfx-nns.mdx @@ -20,25 +20,24 @@ Depending on the `dfx nns` subcommand you specify, additional arguments, options | Command | Description | |-------------------------------------|-------------------------------------------------------------------------------| -| [`import`](#_dfx_nns_import) | Adds the NNS canisters to the local dfx.json as remote canisters. | -| [`install`](#_dfx_nns_install) | Deploys NNS canisters to the local dfx server. | +| [`import`](#_dfx_nns_import) | Adds the NNS canisters to the local `dfx.json` as remote canisters. | +| [`install`](#_dfx_nns_install) | Deploys NNS canisters to the local development environment. | | `help` | Displays usage information message for a specified subcommand. | To view usage information for a specific subcommand, specify the subcommand and the `--help` flag. For example, to see usage information for `dfx nns install`, you can run the following command: ``` bash -$ dfx nns install --help +dfx nns install --help ``` - ## dfx nns import -Use the `dfx nns import` command to add the NNS canisters to the local `dfx.json`. It also downloads the did files and sets the canister IDs of the NNS cansiters so that you can make API calls to NNS canisters. +Use the `dfx nns import` command to add the NNS canisters to the local `dfx.json`. It also downloads the `.did` files and sets the canister IDs of the NNS canisters so that you can make API calls to NNS canisters. ### Basic usage ``` bash -$ dfx nns import +dfx nns import ``` ### Flags @@ -51,25 +50,26 @@ You can use the following optional flags with the `dfx nns import` command. ### Examples -You can use the `dfx nns import` command to get did files and so query NNS canisters. +You can use the `dfx nns import` command to get `.did` files and query NNS canisters. ``` bash $ dfx nns import $ dfx canister call --network ic nns-governance get_pending_proposals '()' ``` -You can rename a network on import. For example, if you have `test-ic` set up as an alias of the `ic` network then you can set NNS canister IDs for `test-ic` with: +You can rename a network on import. For example, if you have `test-ic` set up as an alias of the `ic` network then you can set NNS canister IDs for `test-ic` with: ``` bash -$ dfx nns import --network-mapping test-ic=ic +dfx nns import --network-mapping test-ic=ic ``` ## dfx nns install -Use the `dfx nns install` command to install a local NNS. This provides local ledger and governance canisters as well as the GUI canisters Internet Identity and NNS-Dapp. +Use the `dfx nns install` command to install a local NNS. This creates local ledger and governance canisters as well as the GUI canisters Internet Identity and NNS dapp. ### Basic usage The local network needs to be set up with a very specific configuration: + ``` $ cat ~/.config/dfx/networks.json { @@ -89,11 +89,11 @@ This is because: * Some canisters are compiled to run on only very specific canister IDs and hostname/port pairs. -In addition, the local dfx server needs to be clean: +In addition, the local `dfx` server needs to be clean: ``` bash -$ dfx start --clean --background -$ dfx nns install +dfx start --clean --background +dfx nns install ``` This is because NNS canisters need to be installed before any others. @@ -104,23 +104,26 @@ This is because NNS canisters need to be installed before any others. #### Example: Making API calls to the local NNS. ``` bash -$ dfx stop -$ dfx start --clean --background -$ dfx nns install -$ dfx nns import -$ dfx canister call --network ic nns-governance get_pending_proposals '()' +dfx stop +dfx start --clean --background +dfx nns install +dfx nns import +dfx canister call --network ic nns-governance get_pending_proposals '()' ``` You can view the API calls that can be made for each NNS canister by looking at the interface definition files installed by `dfx nns import` in `candid/*.did`. The API methods are in the `service` section, which is usually located at the end of a `.did` file. It is easiest to start experimenting with methods that take no arguments. #### Example: Accessing ICP on the command line -Two accounts in the local ledger is initialized with ICP that can be used for testing. One uses a secp256k1 key, which is convenient for command line usage, another uses an ed25519 key, which is more convenient in web applications. +Two accounts in the local ledger is initialized with ICP that can be used for testing. One uses a secp256k1 key, which is convenient for command line usage, another uses an ed25519 key, which is more convenient in web applications. To use ICP on the command line: -* Start dfx and install the NNS, as described in [`install`](#_dfx_nns_install). -* Put this secret key into a file called `ident-1.pem`: + +1. Start `dfx` and install the NNS, as described in [`install`](#_dfx_nns_install). + +2. Put this secret key into a file called `ident-1.pem`: + ``` bash $ cat <ident-1.pem -----BEGIN EC PRIVATE KEY----- @@ -130,22 +133,31 @@ oUQDQgAEPas6Iag4TUx+Uop+3NhE6s3FlayFtbwdhRVjvOar0kPTfE/N8N6btRnd -----END EC PRIVATE KEY----- EOF ``` -* Check the key: (optional) + +3. Check the key: (optional) + ``` $ openssl ec -in ident-1.pem -noout -text ``` -* Create an identity with that secret key: + +4. Create an identity with that secret key: + ``` bash $ dfx identity import ident-1 ident-1.pem ``` -* Now you can use the (toy) funds: + +5. Now you can use the (test) funds: + ``` bash $ dfx ledger balance ``` To use ICP in an existing web application: -* Install the [@dfinity/agent npm module](https://www.npmjs.com/package/@dfinity/agent). -* Create an identity with this key pair: + +1. Install the [@dfinity/agent npm module](https://www.npmjs.com/package/@dfinity/agent). + +2. Create an identity with this key pair: + ``` const publicKey = "Uu8wv55BKmk9ZErr6OIt5XR1kpEGXcOSOC1OYzrAwuk="; const privateKey = @@ -164,4 +176,5 @@ To use ICP in an existing web application: return Uint8Array.from(window.atob(base64String), (c) => c.charCodeAt(0)); }; ``` -* That identity can now make API calls, including sending ICP. + +The identity can now make API calls, including sending ICP. diff --git a/docs/cli-reference/dfx-parent.mdx b/docs/cli-reference/dfx-parent.mdx index 5a466cf3e6..f92bb9346d 100644 --- a/docs/cli-reference/dfx-parent.mdx +++ b/docs/cli-reference/dfx-parent.mdx @@ -5,7 +5,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow"; The DFINITY command-line execution environment (`dfx`) is the primary tool for creating, deploying, and managing the -dapps you develop for the IC. +dapps you develop for ICP. Use the `dfx` parent command with flags and subcommands to specify the operations you want to perform with or without optional arguments. @@ -35,7 +35,7 @@ You can use the following options with the `dfx` command. |-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `--identity ` | Specifies the user identity to use when running a command. | | `--logfile ` | Writes log file messages to the specified log file name if you use the `--log file` logging option. | -| `--log ` | Specifies the logging mode to use. + You can set the log mode to one of the following:
- `stderr` to log messages to the standard error facility.
- `tee` to write messages to both standard output and to a specified file name.
- `file` to write messages to a specified file name.
The default logging mode is stderr. | +| `--log ` | Specifies the logging mode to use. You can set the log mode to one of the following:
- `stderr` to log messages to the standard error facility.
- `tee` to write messages to both standard output and to a specified file name.
- `file` to write messages to a specified file name.
The default logging mode is stderr. | ## Subcommands @@ -49,25 +49,25 @@ For reference information and examples, select an appropriate subcommand. | bootstrap | Removed. Use the `start` command instead. | | [`build`](./dfx-build.mdx) | Builds canister output from the source code in your project. | | [`cache`](./dfx-cache.mdx) | Manages the `dfx` cache on the local computer. | -| [`canister`](./dfx-canister.mdx) | Manages deployed canisters . | +| [`canister`](./dfx-canister.mdx) | Manages deployed canisters. | | [`deploy`](./dfx-deploy.mdx) | Deploys all or a specific canister from the code in your project. By default, all canisters are deployed. | -| diagnose | Detects known problems in the current environment caused by upgrading DFX, and suggests commands to fix them. These commands can be batch-run automatically via `dfx fix` | -| fix | Applies one-time fixes for known problems in the current environment caused by upgrading DFX. Makes no changes that would not have been suggested by `dfx diagnose` | +| diagnose | Detects known problems in the current environment caused by upgrading `dfx`, and suggests commands to fix them. These commands can be batch-run automatically via `dfx fix` | +| fix | Applies one-time fixes for known problems in the current environment caused by upgrading `dfx`. Makes no changes that would not have been suggested by `dfx diagnose` | | generate | Generate type declarations for canisters from the code in your project | | [`help`](./dfx-help.mdx) | Displays usage information for a specified subcommand. | | [`identity`](./dfx-identity.mdx) | Enables you to create and manage the identities used to communicate with the IC. | | info | Displays information like port numbers and version numbers. | -| [`killall`](./dfx-killall.mdx) | Kills any dfx-related processes that have gotten stuck | -| [`ledger`](./dfx-ledger.mdx) | Enables you to interact with accounts in the ledger canister running on the Internet Computer. | +| [`killall`](./dfx-killall.mdx) | Kills any `dfx`-related processes that have gotten stuck. | +| [`ledger`](./dfx-ledger.mdx) | Enables you to interact with accounts in the ledger canister running on ICP. | | [`new`](./dfx-new.mdx) | Creates a new project. | -| [`ping`](./dfx-ping.mdx) | Sends a response request to the IC or the local development environment to determine network connectivity. If the connection is successful, a status reply is returned. | +| [`ping`](./dfx-ping.mdx) | Sends a response request to the mainnet or the local development environment to determine network connectivity. If the connection is successful, a status reply is returned. | | quickstart | Perform initial one time setup for your identity and/or wallet. | | remote | Commands used to work with remote canisters. | -| [`replica`](./dfx-replica.mdx) | Removed. Use the `start` command instead. | +| [`replica`](./dfx-replica.mdx) | Removed. Use the `start` command instead. | | [`schema`](./dfx-schema.mdx) | Prints the schema for `dfx.json`. | -| [`start`](./dfx-start.mdx) | Starts the local development environment a web server for the current project. | +| [`start`](./dfx-start.mdx) | Starts the local development environment. | | [`stop`](./dfx-stop.mdx) | Stops the local development environment. | -| [`upgrade`](./dfx-upgrade.mdx) | Upgrades the version of `dfx` installed on the local computer to the latest version available. | +| [`upgrade`](./dfx-upgrade.mdx) | Replaced by `dfxvm`. The command `dfx upgrade` doesn't work with `dfxvm`. To upgrade `dfx`, run: `dfxvm update`. | | [`wallet`](./dfx-wallet.mdx) | Enables you to manage cycles, controllers, custodians, and addresses for the default cycles wallet associated with the currently-selected identity. | ## Examples @@ -121,4 +121,6 @@ for specific operations. For example, you might want to test whether the `devops` user identity can call the `modify_profile` function for the `accounts` canister by running the following command: - dfx canister call accounts modify_profile '("Kris Smith")' --identity devops +``` +dfx canister call accounts modify_profile '("Kris Smith")' --identity devops +``` \ No newline at end of file