【发布时间】:2020-02-27 18:56:00
【问题描述】:
我有以下带有 impl 的结构:
#[near_bindgen]
#[derive(Default, Serialize, Deserialize, BorshDeserialize, BorshSerialize, Debug)]
pub struct MyStruct {
owner: String
}
#[near_bindgen(init => new)]
impl MyStruct {
fn new() -> Self {
Self {
owner: "bob".to_string()
}
}
fn get_owner(&self) -> String {
return self.owner;
}
}
然后我使用near deploy my_contract --masterAccount myAccount部署合约
如果我使用近壳调用 get_owner:near call my_contract get_owner --accountId=myAccount 它总是返回 "" 而不是预期的 "bob"。
似乎新方法可能不会在部署时被调用。
【问题讨论】:
标签: nearprotocol