Add sanity checks to Derive client & fix manager address handling#36
Merged
Add sanity checks to Derive client & fix manager address handling#36
Conversation
Karrenbelt
commented
May 8, 2025
Comment on lines
+74
to
+77
| @validate_arguments(config=dict(arbitrary_types_allowed=True)) | ||
| def __init__( | ||
| self, | ||
| wallet: str, | ||
| wallet: Address, |
Collaborator
Author
There was a problem hiding this comment.
This validates and type casts input (address to check-summed address, subaccount_id is str to int)
Karrenbelt
commented
May 8, 2025
Comment on lines
+827
to
+831
| def get_unique_manager(margin_type, currency): | ||
| matches = manager_by_type.get((margin_type, currency), []) | ||
| if len(matches) != 1: | ||
| raise ValueError(f"Expected exactly one ManagerAddress for {(margin_type, currency)}, found {matches}") | ||
| return matches[0] |
Collaborator
Author
There was a problem hiding this comment.
the order changed; indexing is brittle. Also now there are 5 managers retrieved. We're selecting by margin type and currency, ensuring there is exactly one unique match (as we assume)
Karrenbelt
commented
May 8, 2025
Comment on lines
+52
to
+55
| class MarginType(Enum): | ||
| SM = "SM" | ||
| PM = "PM" | ||
| PM2 = "PM2" |
Collaborator
Author
There was a problem hiding this comment.
note that PM2 is new among the manager addresses
Karrenbelt
commented
May 8, 2025
| [tool.poetry.group.dev.dependencies] | ||
| pytest = "^7.4.2" | ||
| black = "^23.10.1" | ||
| black = "^24" |
Collaborator
Author
There was a problem hiding this comment.
otherwise this throws since <24 doesn't know of / deal with py313
Line 62 in e2ade1e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
base_client.py#32NOTE: temporarily disables "create_order" related tests; these continuously timeout, also in the v2-action-signing-python