Removed an 'expect' in mixnet contract query (#1257)

* Removed an 'expect' in mixnet contract query

* Updated changelog
This commit is contained in:
Jędrzej Stuczyński
2022-05-06 15:28:57 +02:00
committed by GitHub
parent cd5fff92ad
commit f684664472
2 changed files with 14 additions and 6 deletions
+5
View File
@@ -7,8 +7,13 @@
- validator-api: add Swagger to document the REST API ([#1249]).
- all: added network compilation target to `--help` (or `--version`) commands ([#1256]).
### Fixed
- mixnet-contract: removed `expect` in `query_delegator_reward` and queries containing invalid proxy address should now return a more human-readable error ([#1257])
[#1249]: https://github.com/nymtech/nym/pull/1249
[#1256]: https://github.com/nymtech/nym/pull/1256
[#1257]: https://github.com/nymtech/nym/pull/1257
## [nym-wallet-v1.0.4](https://github.com/nymtech/nym/tree/nym-wallet-v1.0.4) (2022-05-04)
+9 -6
View File
@@ -48,12 +48,15 @@ pub fn query_delegator_reward(
mix_identity: IdentityKey,
proxy: Option<String>,
) -> Result<Uint128, ContractError> {
let proxy = proxy.map(|p| {
deps.api
.addr_validate(&p)
.map_err(|_| ContractError::InvalidAddress(p))
.expect("proxy address is invalid")
});
let proxy = match proxy {
Some(proxy) => Some(
deps.api
.addr_validate(&proxy)
.map_err(|_| ContractError::InvalidAddress(proxy))?,
),
None => None,
};
let key = mixnet_contract_common::delegation::generate_storage_key(
&deps.api.addr_validate(&owner)?,
proxy.as_ref(),