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: [TD-1677] Add support for bids #2186

Merged
merged 40 commits into from
Sep 25, 2024
Merged

feat: [TD-1677] Add support for bids #2186

merged 40 commits into from
Sep 25, 2024

Conversation

lfportal
Copy link
Contributor

@lfportal lfportal commented Sep 18, 2024

Hi👋, please prefix this PR's title with:

  • breaking-change: if you have introduced modification that necessitates immediate adjustments by this SDK's users to their applications, clients, or integrations to avert disruptions to existing features or functionalities.
  • feat:, fix:, refactor:, docs:, or chore:.

Summary

Adds support to manage creation, cancellation and fulfilment of bids.

Detail and impact of the change

Added

To support bids on the zkEVM orderbook:

  • Orderbook.prepareBid and Orderbook.createBid functions to create bids
  • Orderbook.getBid and Orderbook.listBids functions to retrieve bids

@lfportal lfportal requested review from a team as code owners September 18, 2024 02:52
Copy link

nx-cloud bot commented Sep 18, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit a3ab266. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 5 targets

Sent with 💌 from NxCloud.

Copy link
Contributor

@Sam-Jeston Sam-Jeston left a comment

Choose a reason for hiding this comment

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

Just left a question

* the unsigned approval transaction, the typed order message for signing and
* the order components that can be submitted to {@linkcode createBid} with a signature.
*/
async prepareBid({
Copy link
Contributor

Choose a reason for hiding this comment

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

question: do we intend to support bulk bid creation? If so would we prefer implement that method instead of this singular version? It hasn't been discussed as a requirement I don't think - but I suspect TT will ask for it.

I'm happy not having the bulk methods BTW, just wanted to flag it as a consideration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed earlier with Steve. Summary: no clear usecase for creating bids in bulk, we can add it later if a partner asks for it.

const listingResultsPromises = Promise.all(
orderIds.map((id) => this.apiClient.getListing(id).catch((e: ApiError) => {
if (e.status === 404) {
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this something we've always done specifically for 404's?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we're given an order ID, we don't know what order type it refers to. To retrieve the order, we hit each of the endpoints (/listings, /bids') to retrieve the order. Given an order will only be of one order type, it will 404 for all but one of the endpoints. Further below we then check that all orders were found. This is an incredibly naive approach for now. The thinking is on-chain cancellation via the SDK isn't something we'll see often. We can invest in a less naive implementation should this assumption change.

CodeSchwert
CodeSchwert previously approved these changes Sep 24, 2024
@lfportal lfportal added this pull request to the merge queue Sep 25, 2024
Merged via the queue into main with commit bc5626d Sep 25, 2024
13 checks passed
@lfportal lfportal deleted the TD-1677-add-bids branch September 25, 2024 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants