Skip to content

SDK 0.8.1

Compare
Choose a tag to compare
@ericswanson-dfinity ericswanson-dfinity released this 17 May 22:19
· 1585 commits to master since this release
ad17124

DFX

feat: dfx generate types command

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

feat: 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 can manually copy the pem files to the target directory to "import". Such workaround still works.
We suggest to use the import subcommand since it also validate the private key.

feat: 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.

Asset Canister

fix: 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.