Guys, I cant seem to figure out how to get a response from Anchor Protocol bAsset contract (bLuna Hub). This is the code that I am using.
pub fn query_unbond(deps: Deps, contract: Addr, useraddress: Addr) -> StdResult<UnbondResponse> {
let query: UnbondRequestsResponse = deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: contract.to_string(),
msg: to_binary(&basset::hub::QueryMsg::UnbondRequests {
address: useraddress.to_string(),
})?,
}))?;
Ok(UnbondResponse { address: query.requests[0].1 })
//tried with Ok(UnbondResponse { address: query.address }) to return the useraddress. But, this also gives the same JSON error.
}
I get the following error message.
rpc error: code = Unknown desc = Error parsing into type basset::hub::UnbondRequestsResponse: JSON has non-whitespace trailing characters after the value.: contract query failed
Anyone know how to solve this?
Thank you.
Regards,
Aries