fix(checkout): remove fabricated batch transaction results - #960
Merged
nanaf6203-bit merged 1 commit intoAug 27, 2026
Merged
Conversation
nasalehj
force-pushed
the
fix/issue-813-real-batch-checkout
branch
from
August 26, 2026 13:41
90340fe to
b3987dc
Compare
|
@nasalehj Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Hey @nasalehj! 👋 It looks like this PR isn't linked to any issue. If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g.,
|
🔒 Preview Environment DestroyedThe preview environment for this PR has been torn down. |
10 tasks
nanaf6203-bit
pushed a commit
that referenced
this pull request
Aug 29, 2026
Completes the batch checkout integration started in #960 by wiring a real wagmi/viem executor. When a batch-purchase contract address is configured, executeBatchPurchase now resolves the connected wallet client, submits the batchPurchase call with per-item slippage-protected minimum amounts, and only reports success after the transaction receipt is observed on chain. The default path fails closed with a configuration error when no contract address is set, and disconnected wallets are rejected before any submission. The timeout/Math.random simulation is not reintroduced anywhere. Closes #813
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses part of #813
This slice removes fabricated batch checkout success and failure behavior from the frontend. Checkout now uses the connected wallet address, validates cart and slippage inputs before submission, and exposes an explicit executor boundary whose success result requires an observed successful receipt. The repository currently has no deployed batch-purchase or multicall ABI, address, function signature, or payment semantics, so the concrete chain adapter is intentionally not fabricated.
Why
The previous checkout waited for a timer, used Math.random() to select a failure branch, and returned a generated transaction hash without contacting a wallet or blockchain. That made the UI report purchases that never occurred and made failures nondeterministic. The new service fails closed when no configured executor exists and only returns success after an executor reports a successful receipt.
What was built
src/lib/batchTransaction.tssrc/components/CartSidebar.tsxsrc/lib/__tests__/batchTransaction.test.tsThe service tests inject an executor so receipt and error behavior can be verified without inventing a contract ABI or making network calls.
Integration changes outside
src/lib/src/components/CartSidebar.tsx— uses the canonical wallet store address and no longer supplies a placeholder account.Acceptance criteria coverage
src/lib/batchTransaction.tsand static inspection — no timer/random simulation remains)src/lib/batchTransaction.ts,calculateMinimumAmount, andbatchTransaction.test.ts— quote-derived estimates are passed to the executor seam)src/lib/__tests__/batchTransaction.test.ts— deterministic executor tests cover real executor hash, user rejection, decoded revert data, and no-call disconnected validation)Deliberately deferred
Test plan
npx prettier --check src/lib/batchTransaction.ts src/lib/__tests__/batchTransaction.test.ts src/components/CartSidebar.tsx— all matched files pass.npm test -- --runInBand src/lib/__tests__/batchTransaction.test.ts— 9/9 passing (9 rewritten tests).npm run validate:env— passes in development.npm run typecheck— blocked by pre-existing syntax errors in unrelated files includingsrc/app/compare/page.tsx,src/components/ComparisonBar.tsx,src/components/PropertyCard.tsx,src/components/TransactionConfirmation.tsx,src/lib/toast.ts, andsrc/stories/ResponsiveContainerExample.stories.ts.npm test -- --runInBand— 63/140 suites passing; 986/1145 tests passing. Failures include existing viem mock incompatibility, Vitest/CommonJS incompatibilities, missing modules, and unrelated component/test failures.npx eslint src/lib/batchTransaction.ts src/lib/__tests__/batchTransaction.test.ts src/components/CartSidebar.tsx --max-warnings=0— blocked before linting becauseeslint-plugin-jsdocis not installed.npm run build— stops at the same pre-existing typecheck failures.Env vars / Notes
No new environment variables.
No deployment or migration changes are included. The executor interface is the integration seam for the deployed contract details; until those details are added, valid checkout attempts return an explicit configuration error rather than claiming an on-chain purchase.