feat: call getPaymentOverrideData method to get payment override steps for transactions when paymentOverride is defined#8870
feat: call getPaymentOverrideData method to get payment override steps for transactions when paymentOverride is defined#8870jpuri wants to merge 36 commits into
Conversation
…ditional_trxn_steps
…Mask/core into build_additional_trxn_steps
…Mask/core into build_additional_trxn_steps
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8332556. Configure here.
| ): TransactionMeta['type'] { | ||
| // Post-quote index 0 is the original transaction | ||
| if (isPostQuote && index === 0) { | ||
| const hasPrependedTx = isPostQuote ?? hasPaymentOverride; |
There was a problem hiding this comment.
Nullish coalescing misclassifies prepended transaction state
Medium Severity
const hasPrependedTx = isPostQuote ?? hasPaymentOverride uses nullish coalescing (??) instead of logical OR. When a quote has both isPostQuote: true and paymentOverride set (possible because paymentOverride is passed through to buildPostQuoteRequests), the paymentOverride branch in submitTransactions takes precedence. If the override callback returns undefined, no transaction is prepended, yet hasPrependedTx evaluates to true (because isPostQuote is truthy and ?? only falls through on null/undefined). This causes incorrect transaction type assignment and off-by-one relay index calculations. A more robust approach would derive hasPrependedTx from whether allParams actually grew (e.g., allParams.length > normalizedParams.length).
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8332556. Configure here.


Explanation
If
paymentOverrideis defined callgetPaymentOverrideDatamethod to get payment override steps for transactions.References
Related to https://consensyssoftware.atlassian.net/browse/CONF-1404
Checklist
Note
Medium Risk
Changes relay batch assembly and balance checks for payment-override flows; impact is limited to when paymentOverride is set and a client implements the callback, but mistakes could affect submitted transaction ordering or funding assumptions.
Overview
Adds an optional
getPaymentOverrideDatahook onTransactionPayController(exposed via messenger) so clients can supply extraTransactionParamswhen a pay transaction usespaymentOverride.During Relay submit, if
paymentOverrideis set on the quote request, the controller calls that hook with the transaction id and human source amount, prepends the returned tx to the relay batch (when defined), skips live source-balance validation (same idea as post-quote), and offsets gas limits / transaction types so the prepended step is treated like other “prepended first tx” flows. If the callback is missing or returnsundefined, behavior falls back to a normal single relay deposit.paymentOverrideis also threaded from transaction config intoQuoteRequestbuilding so quotes carry the flag through execution. Changelog and unit tests cover the controller delegate and relay batch edge cases.Reviewed by Cursor Bugbot for commit 8332556. Bugbot is set up for automated code reviews on this repo. Configure here.