Skip to content
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

feat: add orderbook API base url #106

Merged
merged 3 commits into from
Oct 18, 2023
Merged

feat: add orderbook API base url #106

merged 3 commits into from
Oct 18, 2023

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Oct 11, 2023

Description

Allow to set your own Orderbook API URL instead of the default ones from the SDK.

This PR is a follow up on cowprotocol/cow-sdk#177.

The motivation, is to allow to set our service IP instead of the external one, to make the connection more performant.

Bonus

While testing this, i realized that in case of an error, the SDK re-attempts 10 times using exponential backoff. This makes it take too much time in case of an error. I reduced to 5 the attempts, and now it re-attempts, but it will take at most a few seconds instead of 2-3 minutes.

Follow up

After this is merged, we will need to set it up (please, let me do it!)

See
https://cowservices.slack.com/archives/C05RMJB7ZFA/p1697021044757619?thread_ts=1697007472.259279&cid=C05RMJB7ZFA

Test

Pass the --orderBookApi and make sure it uses the parameter

ts-node ./src/index.ts run --rpc <your-rpc> --dployment-block 9847564 --page-size 5000 --orderBookApi https://api.cow.fi/goerli

Once this is in staging we can test this in the infrastructure project.

@socket-security
Copy link

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@cowprotocol/cow-sdk 4.0.0...4.0.3 None +0/-0 1.1 MB cowprotocol_dev

@anxolin anxolin requested review from mfw78 and ahhda October 12, 2023 10:16
@anxolin anxolin marked this pull request as ready for review October 12, 2023 10:16
@anxolin anxolin force-pushed the allow-set-your-own-orderbook branch from f4ad40f to d78c0c7 Compare October 13, 2023 12:53
@anxolin anxolin changed the base branch from main to feat-single-chain October 13, 2023 12:54
@mfw78 mfw78 force-pushed the feat-single-chain branch from c9e348d to fb93a2b Compare October 14, 2023 09:54
Base automatically changed from feat-single-chain to main October 14, 2023 09:57
@mfw78 mfw78 force-pushed the allow-set-your-own-orderbook branch from d78c0c7 to c11503d Compare October 14, 2023 10:00
Copy link
Contributor

@mfw78 mfw78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great that we can configure this now. I think there's some scope for some minor DRY'ing.

src/index.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
src/domain/chainContext.ts Show resolved Hide resolved
@mfw78 mfw78 merged commit a082126 into main Oct 18, 2023
@mfw78 mfw78 deleted the allow-set-your-own-orderbook branch October 18, 2023 05:14
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants