Comments (2)
I think cosmwasm need add more infomation about validator data.
https://github.com/CosmWasm/cosmwasm/blob/main/packages/std/src/query/staking.rs#L171-L186
from cw-plus.
In order to query more information about the data (tokens, delegate_shares), I modified validatorsResponse, but this doesn't get me the data I need, why is that?
code:
// msg.rs
/// Instances are created in the querier.
#[cw_serde]
pub struct Validator {
/// The operator address of the validator (e.g. cosmosvaloper1...).
/// See https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/proto/cosmos/staking/v1beta1/staking.proto#L95-L96
/// for more information.
///
/// This uses `String` instead of `Addr` since the bech32 address prefix is different from
/// the ones that regular user accounts use.
pub address: String,
pub commission: Decimal,
pub max_commission: Decimal,
/// The maximum daily increase of the commission
pub max_change_rate: Decimal,
pub tokens: String,
pub delegator_shares: String,
}
/// The data format returned from StakingRequest::AllValidators query
#[cw_serde]
pub struct AllValidatorsResponseBak {
pub validators: Vec<Validator>,
}
// contracts.rs
pub fn execute_test(
deps: DepsMut,
_env: Env,
_info: MessageInfo,
// beneficiaries: Vec<BeneficiaryBody>,
) -> Result<Response, ContractError> {
let vals = deps.querier.query_all_validators()?;
let request = StakingQuery::AllValidators {}.into();
let data: AllValidatorsResponseBak = deps.querier.query(&request)?;
let res_data = data.validators;
Ok(Response::new()
.add_attribute("action", "add_whitelists")
.add_attribute("vals", format!("{:?}", vals))
.add_attribute("vals", format!("{:?}", res_data)))
}
log:
Error: rpc error: code = Unknown desc = rpc error: code = Unknown desc = failed to execute message; message index: 0: Error parsing into type cw_vesting::msg::AllValidatorsResponseBak: missing field `tokens`: execute wasm contract failed [!cosm!wasm/[email protected]/x/wasm/keeper/keeper.go:395] With gas wanted: '18446744073709551615' and gas used: '102538' : unknown request
from cw-plus.
Related Issues (20)
- Decide what to do with `controllers` HOT 2
- Update README
- Simplify licenses
- Workspace optimizer build failed HOT 1
- u
- CW2: adding supported interfaces value HOT 7
- CW20: Remove IncreaseAllowance / DecreaseAllowance HOT 3
- MINT function is not working HOT 2
- Package versioning is a huge mess right now HOT 10
- CW2: add a `cw2::VersionError` error type
- discussion: cw20-base methods should be nonpayable, or forward funds HOT 5
- CW20 All accounts query sorting issue HOT 1
- Cryptotab
- “use of undeclared crate or module `imp`” on getrandom-0.2.8 when building for wasm32-unknown-unknown HOT 1
- thread 'main' panicked at 'called `Result::unwrap() HOT 1
- Bump cw2 version HOT 1
- Issue in providing cw4_stake.wasm contract values for initiating HOT 4
- `Admin` type of cw-controllers should have helper method for raw querying
- Error message on Kujira Fin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cw-plus.