Skip to content

docs: add documentation for buyer-initiated offers and createOfferAnd…#1017

Open
levalleux-ludo wants to merge 1 commit intomainfrom
documentation
Open

docs: add documentation for buyer-initiated offers and createOfferAnd…#1017
levalleux-ludo wants to merge 1 commit intomainfrom
documentation

Conversation

@levalleux-ludo
Copy link
Copy Markdown
Member

…Commit method

Description

{{what was done}}

How to test

{{how can it be tested}}

Copilot AI review requested due to automatic review settings April 2, 2026 11:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new internal documentation pages describing two offer flows covered by the e2e test suite: (1) the createOfferAndCommit helper flow (seller-initiated vs buyer-initiated) and (2) buyer-initiated offers committed via commitToBuyerOffer.

Changes:

  • Documented the createOfferAndCommit helper’s purpose, prerequisites, and covered test scenarios.
  • Documented buyer-initiated offer flow in core-sdk-offers.test.ts, including prerequisites, fund movements, and error cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
docs/details/createOfferAndCommit.md New doc explaining how createOfferAndCommit is used in e2e tests for seller-initiated and buyer-initiated offers.
docs/details/buyerInitiatedOffers.md New doc explaining buyer-initiated offers and the seller-side commitToBuyerOffer test coverage and fund flows.


## What the method does

`createOfferAndCommit` (helper in `e2e/tests/utils.ts:660`) atomically:
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The referenced helper location e2e/tests/utils.ts:660 is out of date; createOfferAndCommit currently starts at e2e/tests/utils.ts:662. Consider removing exact line numbers (they drift) or updating them to match the current file.

Suggested change
`createOfferAndCommit` (helper in `e2e/tests/utils.ts:660`) atomically:
`createOfferAndCommit` (helper in `e2e/tests/utils.ts`) atomically:

Copilot uses AI. Check for mistakes.
`initSellerAndBuyerSDKs` (`utils.ts:263`) creates two fresh wallets (seller + buyer), each funded with ETH from a seed wallet. Both parties must have enough native ETH to pay for gas (and for the commit price in native-ETH offers).

### 2. Seller account registered on-chain — `createSeller` is mandatory
`createSeller` (`utils.ts:954`) must be called before any `createOfferAndCommit`. It:
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

createSeller is referenced as utils.ts:954, but createSeller currently starts at e2e/tests/utils.ts:956 (954 is the end of a different helper). Please update the reference or drop the line number to avoid future drift.

Suggested change
`createSeller` (`utils.ts:954`) must be called before any `createOfferAndCommit`. It:
`createSeller` (`utils.ts`) must be called before any `createOfferAndCommit`. It:

Copilot uses AI. Check for mistakes.
Comment on lines +118 to +120
## Files
- Helper definition: `e2e/tests/utils.ts:660`
- Test file: `e2e/tests/core-sdk.test.ts` (seller-initiated ~L245–430, buyer-initiated ~L534–680)
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The Files section references e2e/tests/utils.ts:660, but createOfferAndCommit currently starts at line 662. Either update the line number(s) or link to the file/function without a hardcoded line reference (more stable).

Copilot uses AI. Check for mistakes.

## Overview

In a **buyer-initiated offer**, the buyer creates and signs the offer; the seller is the one who "commits" to it (i.e. accepts the deal). This is the reverse of the standard flow.
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

This overview says the buyer "creates and signs" the offer, but in core-sdk-offers.test.ts the buyer-initiated offer is created on-chain via createOffer(buyerCoreSDK, ...) (no separate EIP-712 offer signature step). Rewording to "creates the offer on-chain" would better match the test flow and avoid confusion with the createOfferAndCommit signed-offer path.

Suggested change
In a **buyer-initiated offer**, the buyer creates and signs the offer; the seller is the one who "commits" to it (i.e. accepts the deal). This is the reverse of the standard flow.
In a **buyer-initiated offer**, the buyer creates the offer on-chain; the seller is the one who "commits" to it (i.e. accepts the deal). This is the reverse of the standard flow.

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +131
- `commitToBuyerOffer` — `utils.ts:1272`
- `commitToOffer` — `utils.ts:1252`
- `createOffer` — `utils.ts:478`
- `createSeller` — `utils.ts:954`
- `createDisputeResolver` — `utils.ts:446`
- `initSellerAndBuyerSDKs` — `utils.ts:263`
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

Several helper references in this Files section have stale line numbers in e2e/tests/utils.ts (e.g., commitToOffer starts at 1254, commitToBuyerOffer at 1274, createSeller at 956). Please update these or remove hardcoded line numbers to keep the docs from going stale as the helpers change.

Suggested change
- `commitToBuyerOffer``utils.ts:1272`
- `commitToOffer``utils.ts:1252`
- `createOffer``utils.ts:478`
- `createSeller``utils.ts:954`
- `createDisputeResolver``utils.ts:446`
- `initSellerAndBuyerSDKs``utils.ts:263`
- `commitToBuyerOffer`
- `commitToOffer`
- `createOffer`
- `createSeller`
- `createDisputeResolver`
- `initSellerAndBuyerSDKs`

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
# Synthesis: `createOfferAndCommit` in core-sdk.test.ts

## What the method does
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The PR description still contains template placeholders (e.g., {{what was done}}, {{how can it be tested}}). Please replace these with a short summary and concrete testing steps so reviewers know what changed and how to validate it.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.96%. Comparing base (95432e5) to head (e8e1cab).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1017   +/-   ##
=======================================
  Coverage   90.96%   90.96%           
=======================================
  Files         179      179           
  Lines        7297     7297           
  Branches     1366     1366           
=======================================
  Hits         6638     6638           
  Misses        659      659           
Flag Coverage Δ
common 92.59% <ø> (ø)
core-sdk 56.43% <ø> (ø)
e2e 85.79% <ø> (ø)
eth-connect-sdk 95.06% <ø> (ø)
ethers-sdk 74.45% <ø> (ø)
ipfs-storage 91.75% <ø> (ø)
metadata 94.70% <ø> (ø)
unittests 60.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants