【发布时间】:2020-10-10 11:13:11
【问题描述】:
https://docs.rs/near-sdk/0.11.0/near_sdk/struct.Promise.html
它包含以下承诺
impl CrossContract {
pub fn deploy_status_message(&self, account_id: String, amount: u64) {
Promise::new(account_id)
.create_account()
.transfer(amount as u128)
.add_full_access_key(env::signer_account_pk())
.deploy_contract(
include_bytes!("../status-message-contract/status_message.wasm").to_vec(),
);
}
这是调用 deploy_status_message 的近命令
near call cross_contract deploy_status_message '{"account_id": "status_message", "amount":1000000000000000}' --accountId mainaccount
你能解释一下这个 Promise 链吗:
1) 它需要参数status_message 作为account_id,create_account 应该创建一个帐户status_message,
但是
near state status_message
报错
account status_message does not exist while viewing
2) 还有什么应该
include_bytes!(...)
包含,哪个字符串?
3) 这里的传递函数是什么?是从mainaccount取1000000000000000存入status_message账户吗?
4) add_full_access_key 将完全访问密钥添加到哪个帐户? status_message?需要env::signer_account_pk() 作为参数吗?
【问题讨论】:
标签: nearprotocol