Skip to content

Commit

Permalink
use filter construct for deposit_preauth validity check
Browse files Browse the repository at this point in the history
  • Loading branch information
ckeshava committed Nov 1, 2024
1 parent 6e42798 commit 0719107
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions xrpl/models/transactions/deposit_preauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,21 @@ def _get_errors(self: Self) -> Dict[str, str]:
+ "invalid if none of the params are specified."
)

# Filter for input parameters which are provided in the transaction
# Optional fields in the transaction model are set to None
if (
sum(
[
param is not None
for param in (
self.authorize,
self.unauthorize,
self.authorize_credentials,
self.unauthorize_credentials,
len(
list(
filter(
lambda x: x is not None,
[
self.authorize,
self.unauthorize,
self.authorize_credentials,
self.unauthorize_credentials,
],
)
]
)
)
> 1
):
Expand Down

0 comments on commit 0719107

Please sign in to comment.