IC SDK: a Software Development Kit for creating and managing canister smart contracts on the ICP blockchain.
CANISTER_CANDID_PATH_<canister name>
properly for remote canistersIn the remote canister declaration it is possible to set a candid file to use when the canister is remote on a specific network.
dfx
now correctly sets the CANISTER_CANDID_PATH_<canister name>
environment variable during the build process on remote networks if the file exists.
dfx schema --for dfx-metadata
to display JSON schema of the "dfx" metadata.
The standardized dfx
metadata is extended with another object: tech_stack
.
Please check tech-stack for more details.
dfx completion
commandThis command generates shell completion scripts for bash
, elvish
, fish
, zsh
, or PowerShell.
Describing how to install shell completion scripts is beyond the scope of this document. Here are two commands that would enable command completion in the current shell:
In zsh:
source <(dfx completion zsh)
In bash:
source <(dfx completion)
Previously, dfx
would always create a .dfx
directory in the project root if dfx.json
was present.
Now, it only does so if the command accesses the .dfx directory in some way.
For example, this will work now:
echo garbage >dfx.json && dfx identity get-principal
Updated replica to elected commit 02dcaf3ccdfe46bd959d683d43c5513d37a1420d. This incorporates the following executed proposals:
Rather than increasing indentation, dfx now aligns the error causes with a "Caused by: " prefix.
Also changed error types to report error causes as causes, rather than embedding their error cause in the error text.
Before:
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed to build all canisters.
Failed while trying to build all canisters.
The build step failed for canister 'bw4dl-smaaa-aaaaa-qaacq-cai' (wasminst_backend) with an embedded error: Failed to build Motoko canister 'wasminst_backend'.: Failed to compile Motoko.: Failed to run 'moc'.: The command '"/Users/ericswanson/.cache/dfinity/versions/0.19.0/moc" ... params ... failed with exit status 'exit status: 1'.
Stdout:
Stderr:
/Users/ericswanson/w/wasminst/src/wasminst_backend/main2.mo: No such file or directory
After:
Error: Failed while trying to deploy canisters.
Caused by: Failed to build all canisters.
Caused by: Failed while trying to build all canisters.
Caused by: The build step failed for canister 'bw4dl-smaaa-aaaaa-qaacq-cai' (wasminst_backend)
Caused by: Failed to build Motoko canister 'wasminst_backend'.
Caused by: Failed to compile Motoko.
Caused by: Failed to run 'moc'.
Caused by: The command '"/Users/ericswanson/.cache/dfinity/versions/0.20.0/moc" ... params ... failed with exit status 'exit status: 1'.
Stdout:
Stderr:
/Users/ericswanson/w/wasminst/src/wasminst_backend/main2.mo: No such file or directory
Adds support for the wasm_memory_limit
canister setting, which limits the canister's heap during most calls but does not affect queries. As with other canister settings, it can be set in dfx canister create
or dfx canister update-settings
via the --wasm-memory-limit
flag, as well as in dfx.json
under canisters[].initialization_values.wasm_memory_limit
.
Please see extension-defined-canister-types for details.
Introduces support for the init_arg_file
field in dfx.json
, providing an alternative method to specify initialization arguments.
This field accepts a relative path, from the directory containing the dfx.json
file.
Note
init_arg
and init_arg_file
can be defined at a time.--argument
or --argument-file
are set, the argument from the command line takes precedence over the one in dfx.json.dfx new
could fail with "Failed to scaffold frontend code" if node was installed but npm was not installed.
Updated cycles wallet to a gzipped version of 20240410
release:
7745d3114e3e5fbafe8a7150a0a8c15a5b8dc9257f294d5ced67d41be76065bc
, in gzipped form: 664df1045e093084f4ebafedd3a793cc3b3be0a7ef1b245d8d3defe20b33057c
Updated replica to elected commit 5e285dcaf77db014ac85d6f96ff392fe461945f5. This incorporates the following executed proposals:
CANISTER_CANDID_PATH_<canister name>
properly for remote canistersIn the remote canister declaration it is possible to set a candid file to use when the canister is remote on a specific network.
dfx
now correctly sets the CANISTER_CANDID_PATH_<canister name>
environment variable during the build process on remote networks if the file exists.
dfx schema --for dfx-metadata
to display JSON schema of the "dfx" metadata.
The standardized dfx
metadata is extended with another object: tech_stack
.
Please check tech-stack for more details.
dfx completion
commandThis command generates shell completion scripts for bash
, elvish
, fish
, zsh
, or PowerShell.
Describing how to install shell completion scripts is beyond the scope of this document. Here are two commands that would enable command completion in the current shell:
In zsh:
source <(dfx completion zsh)
In bash:
source <(dfx completion)
Previously, dfx
would always create a .dfx
directory in the project root if dfx.json
was present.
Now, it only does so if the command accesses the .dfx directory in some way.
For example, this will work now:
echo garbage >dfx.json && dfx identity get-principal
Updated replica to elected commit 02dcaf3ccdfe46bd959d683d43c5513d37a1420d. This incorporates the following executed proposals:
dfx canister call --query
defaults to use "Replica-signed query" feature.
It doesn't work with bitcoin query calls to the management canister because the Boundary Nodes cannot route the read_state
call.
Only for these particular queries, dfx
will make the query calls without checking the replica signatures.
If the response reliability is a concern, you can make update calls to the secure alternatives.
If the environment variable DFX_CYCLES_LEDGER_SUPPORT_ENABLE
is set and no cycles wallet is configured, then dfx will try to use the cycles ledger to perform any operation that the cycles wallet usually is used for.
The following commands/options have been unhidden:
dfx cycles
--from-subaccount
for dfx deploy
, dfx canister create
, dfx canister deposit-cycles
to determine which cycles ledger subaccount the used cycles should be used from--created-at-time
for dfx deploy
, dfx create canister
, dfx canister deposit-cycles
to control transaction deduplication on the cycles ledger--to-subaccount
for dfx canister delete
to control into which subaccount cycles are withdrawn before the canister is deletedThe cycles ledger will not be supported by default until the cycles ledger canister is under NNS control.
This is the same as dfx canister call ... | idl2json
, for convenience.
See also: https://github.com/dfinity/idl2json
Added commas in between fields, and newlines to improve formatting.
dfx canister status
now outputs to stdout
, rather than stderr
, so that its output is grep
compatible.
dfx canister logs
now outputs to stdout, rather than stderr, so that its output is grep
and tail
compatible.
The management canister method fetch_canister_logs
can be called only as a query, not as an update call. Therefore, dfx canister logs <canister_id>
now uses a query call for this purpose.
dfx wallet set-name
now actually sets the name of the walletDFX no longer forbids hyphens in project names. Anywhere they appear as the name of a variable, e.g. environment variables or generated JS variables, they will be replaced with underscores.
allow_raw_access
Previously, any configuration element in .ic-assets.json functioned as if a setting of
"allow_raw_access": true
were present in the json object.
For example, given the following configuration, all files would be configured
with allow_raw_access
set to true
, as if the second entry specified
"allow_raw_access": true
(which is the default), even though it does not.
[
{
"match": "**/*",
"allow_raw_access": false
},
{
"match": "**/*",
"headers": {
"X-Anything": "Something"
}
}
]
Now, given the same configuration, all files would be configured with allow_raw_access
set to false, as expected.
Note that the default value of allow_raw_access
is still true
.
Removed the logic for calling a different version of dfx based on DFX_VERSION or the dfx
field in
dfx.json. This is now performed by dfxvm.
dfx canister call/install/sign and dfx deploy
When all the arguments are optional, dfx automatically provides a null
value when no arguments are provided.
--always-assist
flag enables the candid assist feature for optional arguments, instead of providing a default null
value.
When the dependency has been in the cache, dfx deps pull
forgot to set correct wasm_hash_download
in pulled.json
.
It caused the following init/deploy
commands to fail.
Updated replica to elected commit 425a0012aeb40008e2e72d913318bc9dbdf3b4f4. This incorporates the following executed proposals:
Downgraded Bitcoin canister to release/2023-10-13
Updated Motoko to 0.11.1
dfx canister call --query
defaults to use "Replica-signed query" feature.
It doesn't work with bitcoin query calls to the management canister because the Boundary Nodes cannot route the read_state
call.
Only for these particular queries, dfx
will make the query calls without checking the replica signatures.
If the response reliability is a concern, you can make update calls to the secure alternatives.
If the environment variable DFX_CYCLES_LEDGER_SUPPORT_ENABLE
is set and no cycles wallet is configured, then dfx will try to use the cycles ledger to perform any operation that the cycles wallet usually is used for.
The following commands/options have been unhidden:
dfx cycles
--from-subaccount
for dfx deploy
, dfx canister create
, dfx canister deposit-cycles
to determine which cycles ledger subaccount the used cycles should be used from--created-at-time
for dfx deploy
, dfx create canister
, dfx canister deposit-cycles
to control transaction deduplication on the cycles ledger--to-subaccount
for dfx canister delete
to control into which subaccount cycles are withdrawn before the canister is deletedThe cycles ledger will not be supported by default until the cycles ledger canister is under NNS control.
This is the same as dfx canister call ... | idl2json
, for convenience.
See also: https://github.com/dfinity/idl2json
Added commas in between fields, and newlines to improve formatting.
dfx canister status
now outputs to stdout
, rather than stderr
, so that its output is grep
compatible.
dfx canister logs
now outputs to stdout, rather than stderr, so that its output is grep
and tail
compatible.
The management canister method fetch_canister_logs
can be called only as a query, not as an update call. Therefore, dfx canister logs <canister_id>
now uses a query call for this purpose.
dfx wallet set-name
now actually sets the name of the walletDFX no longer forbids hyphens in project names. Anywhere they appear as the name of a variable, e.g. environment variables or generated JS variables, they will be replaced with underscores.
allow_raw_access
Previously, any configuration element in .ic-assets.json functioned as if a setting of
"allow_raw_access": true
were present in the json object.
For example, given the following configuration, all files would be configured
with allow_raw_access
set to true
, as if the second entry specified
"allow_raw_access": true
(which is the default), even though it does not.
[
{
"match": "**/*",
"allow_raw_access": false
},
{
"match": "**/*",
"headers": {
"X-Anything": "Something"
}
}
]
Now, given the same configuration, all files would be configured with allow_raw_access
set to false, as expected.
Note that the default value of allow_raw_access
is still true
.
Removed the logic for calling a different version of dfx based on DFX_VERSION or the dfx
field in
dfx.json. This is now performed by dfxvm.
dfx canister call/install/sign and dfx deploy
When all the arguments are optional, dfx automatically provides a null
value when no arguments are provided.
--always-assist
flag enables the candid assist feature for optional arguments, instead of providing a default null
value.
When the dependency has been in the cache, dfx deps pull
forgot to set correct wasm_hash_download
in pulled.json
.
It caused the following init/deploy
commands to fail.
Updated replica to elected commit 425a0012aeb40008e2e72d913318bc9dbdf3b4f4. This incorporates the following executed proposals:
Downgraded Bitcoin canister to release/2023-10-13
dfx upgrade
commandThe dfx upgrade
command now prints a message directing the user to install dfxvm.
In dfx 0.14.0, we standardized on CANISTER_ID_<CANISTER_NAME_UPPERCASE>
and
CANISTER_CANDID_PATH_<CANISTER_NAME_UPPERCASE>
for
environment variables for canister IDs and candid paths respectively,
and deprecated the old formats. This version removes the old formats.
The only variable names now provided are the following, all uppercase, with any '-' replaced by '_':
CANISTER_CANDID_PATH_<CANISTER_NAME>
CANISTER_ID_<CANISTER_NAME>
For reference, these formats were removed (any '-' characters were replaced by '_'):
CANISTER_CANDID_PATH_<canister_name_case_from_dfx_json>
<CANISTER_NAME_UPPERCASE>_CANISTER_ID
dfx canister logs <canister_id>
for fetching canister's logs (preview)There is a new subcommand logs
to fetch canister's logs.
When printing the log entries it tries to guess if the content can be converted to UTF-8 text and prints an array of hex bytes if it fails.
Note
This feature is still in development. Changes may occur in following releases.
Locally, canisters can either be accessed via <canister_id>.localhost:<port>
or localhost:<port>?canisterId=<canister_id>
.
The query parameter format is annoying to handle in SPAs, therefore the subdomain format is now displayed alongside the subdomain version after deployments.
The query parameter format is not removed because Safari does not support localhost subdomains.
Made it so dfx deploy
and dfx canister install
will always write
environment variables for all canisters in the project that have canister ids
to the .env file, even if they aren't being deployed/installed
or a dependency of a canister being deployed/installed.
There are a few subcommands that take --argument
/--argument-file
options to set canister call/init arguments.
We unify the related logic to provide consistent user experience.
The notable changes are:
dfx deploy
now accepts --argument-file
.dfx deps init
now accepts --argument-file
.Ask for user input when Candid argument is not provided in dfx canister call
, dfx canister install
and dfx deploy
.
Previously, we cannot call dfx deploy --all
when multiple canisters require init args, unless the init args are specified in dfx.json
. With the Candid assist feature, dfx now asks for init args in terminal when a canister requires init args.
Pinned icx-proxy at 69e1408347723dbaa7a6cd2faa9b65c42abbe861, shipped with dfx 0.15.2
This means commands like the following will work again:
curl -v --http2-prior-knowledge "http://localhost:$(dfx info webserver-port)/api/v2/status" --output -
dfx cycles approve
and transfer --from
It is now possible to approve other principals to spend cycles on your behalf using dfx cycles approve <spender> <amount>
.
dfx cycles transfer
now also supports --from
, --from-subaccount
, and --spender-subaccount
.
For detailed explanations on how these fields work please refer to the ICRC-2 specification.
The script at https://internetcomputer.org/install.sh now installs the dfxvm version manager instead of the dfx binary.
dfx deps pull
was recently changed to allow hash mismatch wasm. But init
and deploy
weren't change accordingly.
Also the warning of hash mismatch is removed since it scares users and users can't fix it locally.
Fixed a bug where dfx generate
would delete a canister's source candid file if the declarations.bindings
in dfx.json
did not include "did".
Fixed a bug where dfx canister install
would fail when specify a canister id and there is no dfx.json.
Fixed a bug where dfx canister call
would fail when the deployed canister was removed from dfx.json.
Fix the Typescript binding for init args.
Updated replica to elected commit d966b2737ca75f1bfaa84f21e7f3f7c54b5d7f33. This incorporates the following executed proposals:
Updated Motoko to 0.11.0
Module hash: 32e92f1190d8321e97f8d8f3e793019e4fd2812bfc595345d46d2c23f74c1ab5
bump ic-cdk to 0.13.1
Module hash: 1208093dcc5b31286a073f00f748ac6612dbae17b66c22332762705960a8aaad
bump ic-cdk to 0.13.1