0.8.1 中的新功能亮点
0.8.1 版本概述:
- 
添加 dfx generate命令为代码编辑器生成类型。
- 
添加对匿名身份的支持。 
- 
使 dfx import使用默认身份。
- 
添加对非标准钱包模块的支持。 
- 
提高资产容器的性能,以允许存储更多和更大的资产。 
- 
更新到 Motoko 0.6.7 版。 
对 DFX 的更改
新命令:dfx generate
dfx generate这个新命令将为 dfx.json 中的容器生成类型声明。
您可以使用 dfx.json 中的相应配置控制将生成什么以及如何生成。
在 dfx.json → "canisters" → "<canister_name>" 下,开发人员可以添加“声明”配置。 选项是:
*“输出”→放置该容器声明的目录| 默认为“src/declarations/<canister_name>”
- 
"bindings" → [] 选项列表, ("js", "ts", "did", "mo") | 默认为 "js", "ts", "did" 
- 
"env_override" → 将替换 "src/dfx/assets/language_bindings/canister.js" 模板中的 process.env.{canister_name_uppercase}_CANISTER_ID 的字符串。 
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: 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以前,人们可以手动将 pem 文件复制到目标目录以“导入”。 该解决方法仍然有效。
我们建议使用 import 子命令,因为它也会验证私钥。