Skip to content

CW20 All accounts query sorting issue #864

@haris8103

Description

@haris8103

Hi team,

Hope you are doing well, I am a beginner in rust and cosmwasm. I am facing an issue in querying all accounts they are not in sorted manner and also there are repeating accounts in query as i am using cw20-base-0.13.4 for this query to being called for cw20 token contract.
Kindly look into it and suggest. Your prompt response will be highly appreciated.

For the reference i have attached the code from cw20-base-0.13.4/src/enumerable.rs .

pub fn query_all_accounts(
    deps: Deps,
    start_after: Option<String>,
    limit: Option<u32>,
) -> StdResult<AllAccountsResponse> {
    let limit = limit.unwrap_or(DEFAULT_LIMIT).min(MAX_LIMIT) as usize;
    let start = start_after.map(|s| Bound::ExclusiveRaw(s.into()));

    let accounts = BALANCES
        .keys(deps.storage, start, None, Order::Ascending)
        .take(limit)
        .map(|item| item.map(Into::into))
        .collect::<StdResult<_>>()?;

    Ok(AllAccountsResponse { accounts })
}

Regards,
Haris.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions