我正在尝试在近协议智能合约中返回两个变量
pub fn get_product(&self, product_id: u128) -> (String, bool) {
let product = self.product_map.get(&product_id).unwrap();
(product.product_details_hash, product.product_expired)
}
Javascript代码:
let hash = await nearcontract.contract.get_product({ product_id: 1 })
它给出了一个错误
Cannot deserialize value with Borsh
另外,是否可以直接返回 struct ?例如
pub fn get_product(&self, product_id: u128) -> Product {
let product = self.product_map.get(&product_id).unwrap();
product
}
它也给出了错误:
the trait `avrit::create_profile::_IMPL_SERIALIZE_FOR_Input::_serde::Serialize` is not implemented for `avrit::avritstructs::Product