feat(core-sdk): add signMetaTxCreateOfferAndCommit to meta-tx handler and mixin#1012
Conversation
|
|
… and mixin Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
|
@copilot fix the errors got in the e2e test:
|
Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
Fixed in commit 48cf6e6:
|
|
@copilot the e2e test "#signMetaTxCreateOfferAndCommit() › native exchange token seller-initiated offer" is failing with error "ValidationError: buyerCancelPenalty has to be less than or equal price". The most convenient fix is to set the buyerCancelPenalty to 0 when creating the offer for that test case |
… offer test Co-authored-by: levalleux-ludo <7184124+levalleux-ludo@users.noreply.github.com>
Fixed in commit f77b029 — added |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1012 +/- ##
==========================================
+ Coverage 90.95% 90.96% +0.01%
==========================================
Files 179 179
Lines 7288 7297 +9
Branches 1366 1366
==========================================
+ Hits 6629 6638 +9
Misses 659 659
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 a new Core SDK meta-transaction signing flow for createOfferAndCommit, enabling relayed execution for both buyer-initiated and seller-initiated offers (native + ERC20), with supporting e2e coverage.
Changes:
- Added
signMetaTxCreateOfferAndCommitto the meta-tx handler and exposed it via the Core SDK meta-tx mixin. - Updated e2e utilities to avoid attempting zero-amount deposits (prevents
ZeroDepositNotAllowed). - Added e2e tests covering
signMetaTxCreateOfferAndCommitacross native/ERC20 and buyer-/seller-initiated scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core-sdk/src/meta-tx/handler.ts | Adds signMetaTxCreateOfferAndCommit (validation, metadata storage, and meta-tx signature generation). |
| packages/core-sdk/src/meta-tx/mixin.ts | Exposes signMetaTxCreateOfferAndCommit on MetaTxMixin for SDK consumers. |
| e2e/tests/utils.ts | Skips depositFunds when the calculated deposit is zero to avoid a protocol revert. |
| e2e/tests/meta-tx.test.ts | Adds e2e coverage for relayed createOfferAndCommit meta-tx signing/execution for native + ERC20 in both initiation modes. |
FullOfferArgsto imports and addencodeCreateOfferAndCommitimport inpackages/core-sdk/src/meta-tx/handler.tssignMetaTxCreateOfferAndCommitfunction topackages/core-sdk/src/meta-tx/handler.tssignMetaTxCreateOfferAndCommitmethod topackages/core-sdk/src/meta-tx/mixin.tssignMetaTxCreateOfferAndCommitine2e/tests/meta-tx.test.ts:quantityAvailable: 1(required for buyer-initiated offers)depositFundsinbuildFullOfferArgswhen amount is zero to avoid "ZeroDepositNotAllowed" errorbuyerCancelPenalty: "0"sincebuyerCancelPenaltymust be ≤price(which is 0)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.