SOLVED: JSON error when Querying UnbondRequests from Anchor bLunaHub Contract

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.


the query looks ok to me tbh.
how do it look in testing?

maybe try returning the actually ‘query’? without messing with it?
otherwise maybe a package version issue?

Thank you for the reply.

Just wanted to let you know that I am trying to parse the following response which is got from the bLunaHub contract.

  "address": "<address>",
  "requests": [

@petes-fan-club Thank you. With your clue, I figured it out and got it working. Anchor’s github repo is not upto date. In the repo, I found this.

pub type UnbondRequest = Vec<(u64, Uint128)>;

In the above, only batch id and bLuna was included.

However, when I was searching for Anchor Docs, I found the updated code as below. Here, it contains batch id, bLuna and stLuna.

pub type UnbondRequest = Vec<(u64, Uint128, Uint128)>;

This was the issue. This is solved. Thank you.