Skip to content

Commit

Permalink
refactor: simplify *_token_balance handling in `UiTransactionStatus…
Browse files Browse the repository at this point in the history
…Meta`
  • Loading branch information
ifiokjr committed Jan 4, 2025
1 parent bf0e113 commit 77b2f62
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions crates/wasm_client_solana/src/solana_transaction_status/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,8 @@ impl UiTransactionStatusMeta {
.collect()
}),
log_messages: meta.log_messages,
pre_token_balances: meta
.pre_token_balances
.map(|balance| balance.into_iter().map(Into::into).collect()),
post_token_balances: meta
.post_token_balances
.map(|balance| balance.into_iter().map(Into::into).collect()),
pre_token_balances: meta.pre_token_balances,
post_token_balances: meta.post_token_balances,
rewards: if show_rewards { meta.rewards } else { None },
loaded_addresses: None,
return_data: meta.return_data.map(Into::into),
Expand All @@ -448,12 +444,8 @@ impl UiTransactionStatusMeta {
post_balances: meta.post_balances,
inner_instructions: None,
log_messages: None,
pre_token_balances: meta
.pre_token_balances
.map(|balance| balance.into_iter().map(Into::into).collect()),
post_token_balances: meta
.post_token_balances
.map(|balance| balance.into_iter().map(Into::into).collect()),
pre_token_balances: meta.pre_token_balances,
post_token_balances: meta.post_token_balances,
rewards: if show_rewards { meta.rewards } else { None },
loaded_addresses: None,
return_data: None,
Expand All @@ -476,10 +468,10 @@ impl From<TransactionStatusMeta> for UiTransactionStatusMeta {
log_messages: meta.log_messages,
pre_token_balances: meta
.pre_token_balances
.map(|balance| balance.into_iter().map(Into::into).collect()),
.map(|balance| balance.into_iter().collect()),
post_token_balances: meta
.post_token_balances
.map(|balance| balance.into_iter().map(Into::into).collect()),
.map(|balance| balance.into_iter().collect()),
rewards: meta.rewards,
loaded_addresses: Some(UiLoadedAddresses::from(&meta.loaded_addresses)),
return_data: meta.return_data.map(Into::into),
Expand Down

0 comments on commit 77b2f62

Please sign in to comment.