-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use SDK to poll and create smart order and handle result #16
Merged
Conversation
This file contains 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
anxolin
force-pushed
the
poll-conditional-orders
branch
from
August 24, 2023 18:57
f055275
to
fa980b0
Compare
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: @cowprotocol/[email protected] |
This was referenced Aug 24, 2023
anxolin
commented
Aug 24, 2023
anxolin
force-pushed
the
poll-conditional-orders
branch
from
August 24, 2023 20:34
bf45e51
to
3be7215
Compare
anxolin
changed the title
Do polling and handle polling result
Use SDK to poll and create smart order and handle result
Aug 29, 2023
alfetopito
reviewed
Aug 29, 2023
alfetopito
approved these changes
Aug 29, 2023
mfw78
approved these changes
Aug 30, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An epic review. A few nits, and comments specifically dealing with merkle roots of orders.
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.
Poll logic
Incorporate all the poll logic from the SDK
Why the logic is being moved to the SDK?
It is great to delegate to the SDK because:
Auth Check in the SDK + Don't try again logic
The PR incorporate some handling of the poll result. Like when we don't need to try again to index an order.
Additionally, now by delegating to the SDK, we check out of the box if the order has been authenticated, and prints a nice message:
The watch tower will understand that this order doesn't need to be re-attempted in the future.
In order to test this, you can create an order and cancel it. Or you could index this block number:
In case of success
This version will still successfully post the order to the API:
The only difference is that now, the responsibility of who is returning the discrete order details is in the SDK.
Network is not a String anymore
This PR changes the network from a
String
to aSupportedChainId
. Since we use the SDK, it is nice we use its types.Sorry for the noise on the chain.
One place where I didn't change it, is in the
Registry
that is persisted. I haven't update there yet to avoid making an incompatible chain in this PR. I prefer to avoid migrating the model for this.To reproduce add this to your env
Utils refactor
The
utils.ts
was too big, i just broke it done into a few files.Not included