feat: enable gas account for private send(OK-59993) - #12867
Conversation
|
@codex review |
|
@codex security review |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Automated code review found blocking issuesReviewed commit Review summaryThis PR extends the Private Send sponsorship path across the foreground confirmation flow and the background broadcast service. What needs attention: Verify that the Private Send Megafuel override keeps display payer, Issues to address
Validation gaps
|
OK-59993
Summary
privateSend(OK-59993)Intent & Context
Per OK-59993, Private Send should participate in Gas Account sponsorship: request
gasAccountEnabledon/estimate-feewith a dedicatedscenario=privateSend(coordinated with the backend team), and when a valid quote comes back, show the sponsored UI and select Gas Account for submit.Private Send rides the normal TxConfirm page (single deposit transfer to the provider's payin address, built via the internal-swap pipeline), so all Gas Account infrastructure — estimate request, quote state machine, sponsored UI, quote-expiry ticker, 90212 deep retry, Refresh/Fallback/Hint error strategies — was already live on this path. It was only switched off by explicit gates, with a code comment noting Private Send was "user-paid by contract". This PR removes that restriction now that the contract is changing.
Design Decisions
privateSend(as suggested in the Jira ticket) instead of reusingswap: added toGAS_ACCOUNT_SCENARIOSand resolved inresolveGasAccountScenariofromtransferPayload.isPrivateSend. The branch must run before the swap branch because Private Send setsisInternalSwap: true.sponsorDisabledForPrivateSendwas renamed tomegafuelDisabledForPrivateSendand scoped to megafuel-only branches; the effective-payer fallback now only forcesuserwhenserverPayer === 'megafuel'.privateSendto its L3 scenario gate, estimate-fee returnsgasAccountScenarioReason=scenario_unknown, Gas Account simply stays off, and Private Send remains user-paid (plus a console.error telemetry line). No hard dependency ordering.isMultiTxsonly.Changes Detail
packages/shared/types/fee.ts— add'privateSend'toGAS_ACCOUNT_SCENARIOS(frontend contract enum, backend lands via coordinated PR)packages/kit/src/hooks/useSignatureConfirm.ts— resolvegasAccountScenariofromtransferPayload.isPrivateSendbefore the internal-swap branchpackages/kit/src/views/SignatureConfirm/components/TxFee/TxFeeInfo.tsx— requestgasAccountEnabledfor Private Send; keep megafuel disabled (renamed gate variable); stop resetting Gas Account UI state for Private Sendpackages/kit-bg/src/services/ServiceSend.ts—batchSignAndSendTransactionno longer stripsgasAccountUiState/gasAccountSubmitIdfor Private Send (single-tx); batch flows still strippackages/kit/src/views/Send/pages/SendAmountInput/SendAmountInputContainer.tsx— threadisNetworkFeeSponsoredfrom send success data into the Private Send history item (swapInfo.isFreeNetworkFee) soSwapHistoryDetailModalshows the sponsored badgeuseSignatureConfirm.test.tsxexpectation updated toprivateSend; two newServiceSendtests pin the pass-through for single-tx Private Send and the strip for multi-tx batchesRisk Assessment
TxFeeInfo) and the background strip (ServiceSend) must stay consistent — they are both changed in this PR, and a regression on either side would show a "0 network fee" badge while broadcasting user-paid (or vice versa). Megafuel behavior for Private Send is intentionally unchanged; regressions would surface on BNB-chain sponsored transfers.Test plan
yarn jest packages/kit/src/hooks/useSignatureConfirm.test.tsx packages/kit-bg/src/services/ServiceSend.broadcastDeadline.test.ts(34 passed)yarn agent:check --profile commit(lint/format/tsc all green)privateSendscenario enabled: Private Send on an eligible EVM chain shows the sponsored coupon ("0 Network Fee") and "Send free" confirm button; broadcast carriesquoteId+isPrivateSendand the fee is not deducted