Queries
This document outlines the queries supported by the AMM module.
Params
Fetch the current value of module parameters.
// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}
// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false];
}
PoolToken
Fetch the pool token for a specific pool ID and denomination.
// QueryGetPoolTokenRequest is request type for the Query/GetPoolToken RPC method.
message QueryGetPoolTokenRequest {
// pool_id is the ID of the pool to fetch the token for.
uint64 pool_id = 1;
// denom is the denomination of the token to fetch.
string denom = 2;
}
// QueryGetPoolTokenResponse is response type for the Query/GetPoolToken RPC method.
message QueryGetPoolTokenResponse {
// pool_token is the pool token for the given pool ID and denomination.
PoolToken pool_token = 1 [(gogoproto.nullable) = false];
}
AllPoolToken
Fetch all pool tokens.
message QueryAllPoolTokenRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
string pool_id = 2;
}
message QueryAllPoolTokenResponse {
repeated PoolToken pool_token = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
AllPoolTokenForPool
Fetch all pool tokens for a given pool ID.
message QueryAllPoolTokenForPoolRequest {
uint64 pool_id = 1;
}
message QueryAllPoolTokenForPoolResponse {
repeated PoolToken pool_token = 1 [(gogoproto.nullable) = false];
}
GetPool
Fetch a pool using its ID.
message QueryGetPoolRequest {
uint64 id = 1;
}
message QueryGetPoolResponse {
Pool pool = 1 [(gogoproto.nullable) = false];
}
AllPool
Fetch all pools.
message QueryAllPoolRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
message QueryAllPoolResponse {
repeated Pool pool = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
GetWeightedToken
Fetch the weighted token for a specific pool ID and denomination.
message QueryGetWeightedTokenRequest {
uint64 pool_id = 1;
string denom = 2;
}
message QueryGetWeightedTokenResponse {
WeightedToken weighted_token = 1 [(gogoproto.nullable) = false];
}
AllWeightedToken
Fetch all weighted tokens.
message QueryAllWeightedTokenRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
message QueryAllWeightedTokenResponse {
repeated WeightedToken weighted_token = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
GetWeightUpdateTiming
Fetch the weight update timing for a specific pool ID.
message QueryGetWeightUpdateTimingRequest {
uint64 pool_id = 1;
}
message QueryGetWeightUpdateTimingResponse {
WeightUpdateTiming weight_update_timing = 1 [(gogoproto.nullable) = false];
}
AllWeightUpdateTiming
Fetch all weight update timings.
message QueryAllWeightUpdateTimingRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
message QueryAllWeightUpdateTimingResponse {
repeated WeightUpdateTiming weight_update_timing = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
AllTokenWeight
Fetch all token weights for a pool.
// computing normalized weights requires reading all tokens from the context
// and computing weight for all of them
// therefore, this query is not paginated
message QueryAllPoolTokenWeightRequest {
uint64 pool_id = 1;
}
// computing normalized weights requires reading all tokens from the context
// and computing weight for all of them
// therefore, this query is not paginated
message QueryAllPoolTokenWeightResponse {
repeated TokenWeight token_weight = 1 [(gogoproto.nullable) = false];
}