feat(pricing): add sender-less preview quotes - #11
Merged
Conversation
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
force-pushed
the
feat/pricing-preview-quote
branch
from
August 10, 2026 14:33
d3e7456 to
92c36e3
Compare
g4titanx
previously approved these changes
Aug 11, 2026
g4titanx
approved these changes
Aug 11, 2026
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
previewTransfer()returns aTransferPreviewwith no sender, wallet, or attestation fetch required.publicClientis supplied; omitted entirely when it is not.fetchPricingQuotenow rejects an unsigned response for a committed sender withINVALID_PRICING_QUOTE.TransferPreviewdeliberately omits every deployable field, so a preview cannot be mistaken for an executable quote at the type level.Details
approvegas 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
undefinedinto 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 on0fd31afand are unrelated to this branch.Requires MiragePrivacy/api#97. Merge that first.