-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stargate: no pagination available for Bank/TotalSupply #1057
Comments
Which backend are you connecting to? The pagination field only exists for Cosmos SDK 0.43+. See // QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
// method.
message QueryTotalSupplyRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// pagination defines an optional pagination for the request.
//
// Since: cosmos-sdk 0.43
cosmos.base.query.v1beta1.PageRequest pagination = 1;
} |
@webmaster128 I've confirmed that our node is already on 0.44 |
okay. Does it work for other values. E.g. what happens if you set a limit of 42? |
Same effect, I tried numbers like 10, 20, undefined etc. |
Is the node supposed to be able to return total supply paginated? If so, can I see an example of how to make the call with Stargate? I should be able to use it with a public endpoint |
Looking at the Cosmos SDK code, the pagination was implemented in Cosmos SDK 0.43. I assume it should work. I don't know more than that. Could you ask the Cosmos SDK team or open a bug report in https://github.com/cosmos/cosmos-sdk? |
Well Stargate itself is not listed as supporting 0.43: |
This info is outdatet. The latest 0.27 series supports 0.42-0.45. |
The problem was purely client side, but unfortunately Stargate doesn't support specifying any pagination params, here's my custom solution: import { QueryClient } from "@cosmjs/stargate"
import { Tendermint34Client } from "@cosmjs/tendermint-rpc"
import { QueryClientImpl as BankQueryClientImpl } from "cosmjs-types/cosmos/bank/v1beta1/query"
const setupCustomBankExtension = base => {
const queryService = new BankQueryClientImpl({
request: (service, method, data) => {
const path = `/${service}/${method}`
return base.queryUnverified(path, data)
},
})
return {
customBank: {
totalSupply: async paginationKey => {
return await queryService.TotalSupply({
pagination: {
countTotal: false,
key: paginationKey,
offset: Long.fromNumber(0, true),
limit: Long.fromNumber(100, true),
reverse: false,
} as PageRequest,
})
},
},
}
}
const tmClient = QueryClient.withExtensions(
await Tendermint34Client.connect(rpcEndpoint),
setupCustomBankExtension,
)
const paginationKey = new Uint8Array()
const { supply, pagination } = await tmClient.customBank.totalSupply(paginationKey) Please thumbs up this or something so people know to use this |
Yeah, true. This is becasue the pagination did not exist in 0.42. We can add it now. I thought you already did that in your first screenshot. |
It looks like I didn't form the pagination object correctly |
Thanks. The implementation is now tracked in #1095. |
I am trying to paginate my call to TotalSupply in stargate's Bank module but it returns the same response whether I pass pagination params or not:
In this screenshot I'm showing what I've done to create my own BankExtension, since stargate's own one does not relay pagination details to the underlying call. I've had success creating my own extensions before, and I've verified that passing a pagination key in this way works when calling Staking/ValidatorDelegations, so it seems that this is purely an issue on the RPC node itself. The response is always the same (maxed out at 100) whether I pass pagination details or not.
The reason I think it's on the RPC side is that stargate's method of calling these endpoints is exactly the same:
Staking/ValidatorDelegations
Bank/TotalSupply
The text was updated successfully, but these errors were encountered: