Skip to content

Commit

Permalink
refactor: add __dir__ to Plan and also some TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Jul 24, 2024
1 parent 74d361d commit dd23dc9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions uniswap_sdk/universal_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ class PERMIT2_PERMIT(Command):


class WRAP_ETH(Command):
"""Wrap `amountMin` (or more) ether and send to `recipient`"""

type = 0x0B

definition = [
Expand Down Expand Up @@ -578,10 +580,18 @@ def __getattr__(self, command_name: str) -> Callable[..., "Plan"]:
command_cls = ALL_COMMANDS_BY_NAME[command_name.upper()]

def add_command(*args, **kwargs):
# TODO: Conversion and kwarg stripping
return self.add(command_cls(args=args, **kwargs))

# TODO: Make `add_command` repr nicely and show args
add_command.__doc__ = command_cls.__doc__
return add_command

# TODO: Add nice __repr__/__str__

def __dir__(self) -> list[str]:
return list(n.lower() for n in ALL_COMMANDS_BY_NAME)


class UniversalRouter(ManagerAccessMixin):
"""
Expand Down

0 comments on commit dd23dc9

Please sign in to comment.