Skip to content

feat(pricing): add sender-less preview quotes - #11

Merged
ozwaldorf merged 3 commits into
mainfrom
feat/pricing-preview-quote
Aug 11, 2026
Merged

feat(pricing): add sender-less preview quotes#11
ozwaldorf merged 3 commits into
mainfrom
feat/pricing-preview-quote

Conversation

@ozwaldorf

Copy link
Copy Markdown
Member

Summary

  • New previewTransfer() returns a TransferPreview with no sender, wallet, or attestation fetch required.
  • Wallet gas is simulated against a stand-in sender when a publicClient is supplied; omitted entirely when it is not.
  • fetchPricingQuote now rejects an unsigned response for a committed sender with INVALID_PRICING_QUOTE.
  • TransferPreview deliberately omits every deployable field, so a preview cannot be mistaken for an executable quote at the type level.

Details

approve gas is independent of the caller's balance. Verified on anvil, where a zero-balance address and a funded one both estimated 45899 gas. The stand-in sender therefore yields the same wallet gas the connected wallet will pay, assuming a zero-to-nonzero allowance write (the first-time-approver case). A user with a leftover non-zero allowance pays slightly less, so the estimate errs high.

The downgrade rejection is not cosmetic: without it, a sender-bound request satisfied by a preview response would carry undefined into the constructor and deploy against a partial quote.

110 unit tests pass, typecheck and build clean.

Note: 3 pre-existing failures in test/integration/transfer.test.ts ("Escrow deployment failed") reproduce identically on 0fd31af and are unrelated to this branch.

Requires MiragePrivacy/api#97. Merge that first.

Adds previewTransfer for quoting fees before a wallet is connected. The
API returns unsigned economics with no commitment, constructor, or
pricing authorization, so a preview can never be deployed. A sender-bound
request that receives an unsigned response is rejected.
Approve gas is independent of the caller's balance, so a preview can
report the same wallet gas the connected wallet will pay. Requires a
publicClient; without one the preview omits gas rather than reporting
zero.
@ozwaldorf
ozwaldorf force-pushed the feat/pricing-preview-quote branch from d3e7456 to 92c36e3 Compare August 10, 2026 14:33
g4titanx
g4titanx previously approved these changes Aug 11, 2026
@ozwaldorf
ozwaldorf merged commit bcefb06 into main Aug 11, 2026
3 checks passed
@ozwaldorf
ozwaldorf deleted the feat/pricing-preview-quote branch August 11, 2026 04:08
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