feat: add signMetaTxCommitToBuyerOffer to meta-tx handler and mixin#1006
Conversation
|
|
…ests Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
|
@copilot the e2e test "native exchange token buyer-initiated offer" is failing. I understand that the protocol expect the fees (sellerDeposit + drFeeAmount) to be transfered in native currency (ETH) as value in the transaction itself, which can't be done with a meta-transaction (because the transaction is relayed and sent on-chain by another wallet than the signer). To make the test working, you have to ensure both the offer's sellerDeposit and the drFeeAmount are explicitely set to 0. Which also means that the seller doesn't need to call depositFunds prior to committing to the offer. |
…Offer e2e test Meta-tx relayers cannot forward ETH value, so commitToBuyerOffer with a non-zero sellerDeposit would fail with InsufficientValueReceived(). Set both sellerDeposit and drFeeAmount to 0 so no ETH transfer is needed. Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
Fixed in 885d8df. The test now uses |
|
@copilot please add another test case in the e2e test called "non-native exchange token buyer-initiated offer", where the offer exchangeToken is an ERC20 token (MOCK_ERC20_ADDRESS as done for the other tests) |
…rOffer Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
Added in ec348e4. The new test creates a dispute resolver with an ERC20 ( |
|
@copilot the e2e test "non-native exchange token buyer-initiated offer" is failing in the github action (https://github.com/bosonprotocol/core-components/actions/runs/22948373517/job/66616167890#step:10:634). |
…tive buyer offer test Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
Fixed in 72a683d. The fresh wallets from |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1006 +/- ##
==========================================
+ Coverage 87.92% 90.95% +3.03%
==========================================
Files 172 179 +7
Lines 7270 7288 +18
Branches 1366 1366
==========================================
+ Hits 6392 6629 +237
+ Misses 878 659 -219
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds CoreSDK support for signing/relaying commitToBuyerOffer meta-transactions, plus e2e coverage for buyer-initiated offers using both native and ERC20 exchange tokens.
Changes:
- Added
signMetaTxCommitToBuyerOffersigner inpackages/core-sdk/src/meta-tx/handler.ts. - Exposed
signMetaTxCommitToBuyerOfferon the CoreSDK meta-tx mixin. - Added e2e tests covering buyer-initiated offers for native and ERC20 exchange tokens (including setup fixes for fresh wallets / relayer value constraints).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core-sdk/src/meta-tx/mixin.ts | Exposes signMetaTxCommitToBuyerOffer on the SDK mixin. |
| packages/core-sdk/src/meta-tx/handler.ts | Implements the meta-tx signing helper for commitToBuyerOffer. |
| e2e/tests/meta-tx.test.ts | Adds e2e tests validating relayed commitToBuyerOffer flows for native/ERC20 exchange tokens. |
signMetaTxCommitToBuyerOfferfunction topackages/core-sdk/src/meta-tx/handler.tssignMetaTxCommitToBuyerOffermethod topackages/core-sdk/src/meta-tx/mixin.tse2e/tests/meta-tx.test.ts: "native exchange token buyer-initiated offer"sellerDeposit: "0"anddrFeeAmount: "0"for native token so meta-tx relayer doesn't need to forward ETH value (InsufficientValueReceivedfix)MOCK_ERC20_ADDRESSensureMintedAndAllowedTokensfor both fresh buyer/seller wallets before callingdepositFunds(fresh wallets have 0 ERC20 balance, causingERC20: transfer amount exceeds balance)Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.