经过5个小时左右的翻文档和反复调试,最终摸索出了当前版本适用的正确方法(完全按照文档来不行)」
复现过程:
1.Package the binary so dfx can install and run it:
echo ‘{“canisters”:{“reverse”:{“main”:”reverse”}}}’ > dfx.json
注意:这里main后面的reverse表示的是 .dfx/local/canisters/目录下的一个名为reverse的目录
(通过dfx build创建)
2.Test the app locally:
dfx start --background //会创建一个隐藏文件夹 .dfx
dfx canister create reverse //为reverse容器创建一个id,并在.dfx下创建local文件夹
dfx build //在.dfx/local/下创建canisters文件夹和子文件夹reverse
cp reverse.wasm .dfx/local/canisters/reverse //将编译出的wasm复制.dfx/local/canisters/reverse目录(也可手动移动)
dfx canister install --all //install code for canister reverse~~~
到此为止,项目创建完成~
接下来可以用canister call指令调用reverse中的go函数:
dfx canister call reverse go ‘(“test”)’
可以看到输出为:
(“tset”)
3.Stop and delete the canister:
dfx canister stop --all
dfx canister delete --all
如果不用的话,记得
dfx stop
Comments 2 条评论
博客作者 Caitlin Chalifoux
You actually make it appear so easy along with your presentation but I find this topic to be really one thing that I believe I’d never understand. It seems too complex and extremely extensive for me. I’m having a look forward to your next publish, I¦ll try to get the hang of it!
博客作者 https://europa-road.eu/hu/temperalt-szallitas.php
Hello, Neat post. There’s a problem together with your site in internet explorer, might test this?K IE nonetheless is the market chief and a large component to other folks will omit your fantastic writing due to this problem.