You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a contract which requires to query the length of a HashMap, So when the Key of this particular HashMap I use as Vec<u8> , the length is always returned as 0, whereas If I use String as the Key type, the function works perfectly fine. Am I missing something in here? Sharing the Query function snippet below for reference:
pub fn get_no_of_root_hashes(deps: Deps) -> Result<usize, ContractError> {
let state = STATE.load(deps.storage)?;
println!("Query: {:?}", state.root_hashes.len());
Ok(state.root_hashes.len())
}
What does the json look like that is saved inside STATE and how do you save it there?
When I try serializing a State struct, it correctly errors with "JSON object key is required to be a string type."
I have created a contract which requires to query the length of a HashMap, So when the Key of this particular HashMap I use as
Vec<u8>
, the length is always returned as 0, whereas If I use String as the Key type, the function works perfectly fine. Am I missing something in here? Sharing the Query function snippet below for reference:The text was updated successfully, but these errors were encountered: