Skip to main content

Highlights of what’s new in 0.8.1

An overview of the 0.8.1 release:

  • Adds a dfx generate command to generate types for code editors.

  • Adds support for anonymous identities.

  • Makes dfx import work with default identities.

  • Adds support for nonstandard wallet modules.

  • Improves performance of the asset canister to allow for storage of more and larger assets.

  • Updates to version 0.6.7 of Motoko.

Changes to DFX

New command: dfx generate

dfx generate

This new command will generate type declarations for canisters in dfx.json.

You can control what will be generated and how with corresponding configuration in dfx.json.

Under dfx.json → "canisters" → "\<canister_name>", developers can add a "declarations" config. Options are:

  • "output" → directory to place declarations for that canister | default is "src/declarations/\<canister_name>"

  • "bindings" → [] list of options, ("js", "ts", "did", "mo") | default is "js", "ts", "did"

  • "env_override" → a string that will replace process.env.{canister_name_uppercase}_CANISTER_ID in the "src/dfx/assets/language_bindings/canister.js" template.

js declarations output

  • index.js (generated from "src/dfx/assets/language_bindings/canister.js" template)

  • \<canister_name>.did.js - candid js binding output

ts declarations output

  • \<canister_name>.did.d.ts - candid ts binding output

did declarations output

  • \<canister_name>.did - candid did binding output

mo declarations output

  • \<canister_name>.mo - candid mo binding output

New feature: dfx now supports the anonymous identity

Use it with either of these forms:

dfx identity use anonymous
dfx --identity anonymous ...

feat: import default identities

Default identities are the pem files generated by dfx identity new …​ which contain Ed25519 private keys. They are located at ~/.config/dfx/identity/xxx/identity.pem. Now, you can copy such pem file to another computer and import it there.

dfx identity new alice
cp ~/.config/dfx/identity/xxx/identity.pem alice.pem
# copy the pem file to another computer, then
dfx identity import alice alice.pem

Before, people could manually copy the pem files to the target directory to "import". That workaround still works. We suggest using the import subcommand since it also validate the private key.

New feature: Can now provide a nonstandard wallet module with DFX_WALLET_WASM environment variable

Define DFX_WALLET_WASM in the environment to use a different wasm module when creating or upgrading the wallet.

Changes to the Asset Canister

Performance improvement: trust full asset SHA-256 hashes provided by the caller

When the caller provides SHA-256 hashes (which dfx does), the asset canister will no longer recompute these hashes when committing the changes. These recomputations were causing canisters to run out of cycles, or to attempt to exceed the maximum cycle limit per update.