Skip to content

Commit

Permalink
Change the de/serialization of reward destination struct to be compat…
Browse files Browse the repository at this point in the history
…ible with Swift and Android libs. Turn off 2 Telegram bot test cases due to a timeout issue with sub.id API.
  • Loading branch information
kukabi committed Jul 28, 2022
1 parent 11be49e commit db9beb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
2 changes: 2 additions & 0 deletions subvt-telegram-bot/src/test/command/nfts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async fn test_nfts_no_validator() {
/// but the validator stash doesn't have any NFTs owned by it. Data is provided by sub.id.
#[tokio::test]
#[allow(clippy::borrowed_box)]
#[ignore]
async fn test_nfts_single_validator_no_nfts() {
let chat_id = get_random_chat_id();
let account_id = get_random_account_id();
Expand Down Expand Up @@ -57,6 +58,7 @@ async fn test_nfts_single_validator_no_nfts() {
/// Tests the successful result of the /nfts command with a validator stash address with NFTs.
#[tokio::test]
#[allow(clippy::borrowed_box)]
#[ignore]
async fn test_nfts_single_validator_with_nfts() {
let chat_id = get_random_chat_id();
let account_id =
Expand Down
13 changes: 1 addition & 12 deletions subvt-types/src/substrate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ impl From<&Stake> for StakeSummary {
}

#[derive(Clone, Decode, Debug, Deserialize, Encode, Eq, Hash, PartialEq, Serialize)]
#[serde(tag = "destination_type", content = "destination")]
pub enum RewardDestination {
Staked,
Stash,
Expand All @@ -669,18 +670,6 @@ pub enum RewardDestination {
None,
}

impl Display for RewardDestination {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Self::Staked => f.write_str("Staked"),
Self::Stash => f.write_str("Stash"),
Self::Controller => f.write_str("Controller"),
Self::Account(account_id) => f.write_str(&format!("Account({})", account_id)),
Self::None => f.write_str("None"),
}
}
}

impl Default for RewardDestination {
fn default() -> Self {
Self::None
Expand Down

0 comments on commit db9beb4

Please sign in to comment.