Skip to content

Commit

Permalink
cleaner way
Browse files Browse the repository at this point in the history
  • Loading branch information
kuegi committed Jun 15, 2023
1 parent 1bf9a24 commit 55b33df
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/ain-grpc/src/transaction_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ impl From<TransactionRequest> for Option<TransactionMessage> {
value: req.value.unwrap_or_default(),
input: req
.input
.or_else(||req.data)
.map(Bytes::into_vec)
.unwrap_or(req.data.map(Bytes::into_vec).unwrap_or_default()),
.unwrap_or_default(),
action: match req.to {
Some(to) => ethereum::TransactionAction::Call(to),
None => ethereum::TransactionAction::Create,
Expand All @@ -74,8 +75,9 @@ impl From<TransactionRequest> for Option<TransactionMessage> {
value: req.value.unwrap_or_default(),
input: req
.input
.or_else(||req.data)
.map(Bytes::into_vec)
.unwrap_or(req.data.map(Bytes::into_vec).unwrap_or_default()),
.unwrap_or_default(),
action: match req.to {
Some(to) => ethereum::TransactionAction::Call(to),
None => ethereum::TransactionAction::Create,
Expand All @@ -94,8 +96,9 @@ impl From<TransactionRequest> for Option<TransactionMessage> {
value: req.value.unwrap_or_default(),
input: req
.input
.or_else(||req.data)
.map(Bytes::into_vec)
.unwrap_or(req.data.map(Bytes::into_vec).unwrap_or_default()),
.unwrap_or_default(),
action: match req.to {
Some(to) => ethereum::TransactionAction::Call(to),
None => ethereum::TransactionAction::Create,
Expand Down

0 comments on commit 55b33df

Please sign in to comment.