6b3700aefe
* Expanded emitted events for delegation-related transactions * Expanded emitted events for gateway-related transactions * Expanded emitted events for mixnode-related transactions * Expanded emitted events for settings update transaction * Expanded emitted events for rewarding-related transactions * Fixed attribute look up in tests * Making linter happier * Reorganised cosmwasm contract-related modules * Introduced similar event handling to the vesting contract
32 lines
943 B
Rust
32 lines
943 B
Rust
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use mixnet_contract_common::Delegation;
|
|
|
|
pub(crate) async fn get_single_mixnode_delegations(pubkey: &str) -> Vec<Delegation> {
|
|
let client = super::utils::new_nymd_client();
|
|
let delegates = match client
|
|
.get_all_nymd_single_mixnode_delegations(pubkey.to_string())
|
|
.await
|
|
{
|
|
Ok(result) => result,
|
|
Err(e) => {
|
|
error!("Could not get delegations for mix node {}: {:?}", pubkey, e);
|
|
vec![]
|
|
}
|
|
};
|
|
delegates
|
|
}
|
|
|
|
pub(crate) async fn get_mixnode_delegations() -> Vec<Delegation> {
|
|
let client = super::utils::new_nymd_client();
|
|
let delegates = match client.get_all_network_delegations().await {
|
|
Ok(result) => result,
|
|
Err(e) => {
|
|
error!("Could not get all mix delegations: {:?}", e);
|
|
vec![]
|
|
}
|
|
};
|
|
delegates
|
|
}
|