Skip to content

feat: deposit to money account after swap/bridge - #11147

Draft
micaelae wants to merge 6 commits into
mainfrom
swaps5253-deposit-after-swap
Draft

micaelae wants to merge 6 commits into
mainfrom
swaps5253-deposit-after-swap

Conversation

@micaelae

@micaelae micaelae commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

High Risk
Automatically submits follow-on vault deposit transactions after swaps, using on-chain receipts and new controller dependencies—errors could mis-deposit funds or leave tokens stuck in the wallet.

Overview
Adds an end-to-end money account deposit path on top of unified swap/bridge: clients can mark quote requests with isMoneyAccount, which is sent to bridge-api and forces relay as the aggregator for those quotes.

During quote streaming, the bridge controller resolves vault/account details via MoneyAccountController and feature flags, attaches that setup to quotes, and extends types/history with depositConfig. Shared messenger helpers for accounts, networks, and remote flags replace duplicated private methods and are re-exported for bridge-status-controller.

After the swap or bridge leg finishes (same-chain source completion or destination completion with the expected token), bridge-status-controller reads the received ERC-20 amount from the receipt, builds a deposit batch with money-account-utils, and submits an internal sponsored transaction batch into the vault.

Reviewed by Cursor Bugbot for commit c19f2ef. Bugbot is set up for automated code reviews on this repo. Configure here.

@micaelae
micaelae requested review from a team as code owners October 28, 2026 00:22
@micaelae
micaelae deployed to default-branch October 28, 2026 00:22 — with GitHub Actions Active

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 4 potential issues.

Fix All in Cursor

❌ 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 c19f2ef. Configure here.

messenger,
quoteRequest: matchingQuoteRequest,
}),
}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote deposit field name mismatch

High Severity

Quote stream attach uses depositSetup, but QuoteResponse and all consumers read depositConfig. Money-account deposit metadata is dropped on every quote, so later deposit logic never sees a config.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c19f2ef. Configure here.

inputPrimaryDenomination,
customSlippage: quotesReceivedContext?.custom_slippage,
slippagePercentage: quotesReceivedContext?.slippage_limit,
isMoneyAccountDeposit,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deposit config never reaches history

High Severity

submitTx copies depositConfig onto the quote and accepts isMoneyAccountDeposit, but #executeSubmitStrategy is only given isMoneyAccountDeposit. History is written from sharedHistoryItemProperties.depositConfig, which stays unset, so completed swaps never trigger a deposit.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c19f2ef. Configure here.

},
],
skipInitialGasEstimate: true,
transactions: Object.values(txs),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deposit batch builder not awaited

High Severity

buildMoneyAccountDepositBatch is async, but handleMoneyAccountDeposit does not await it. Object.values then runs on the Promise, so addTransactionBatchFn receives invalid transactions instead of the approve and deposit calls.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c19f2ef. Configure here.

txHash: txMeta.hash,
addTransactionBatchFn: this.#addTransactionBatchFn,
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deposit errors left unhandled

Medium Severity

Both completion paths call handleMoneyAccountDeposit without awaiting or catching. That helper throws when the provider or received amount is missing, producing an unhandled rejection and a silent failed deposit.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c19f2ef. Configure here.

@micaelae
micaelae marked this pull request as draft October 28, 2026 06:35

This branch was successfully deployed

1 active deployment
default-branch — c19f2efa Deployed Oct 28, 2026 by micaelae via Determine whether this PR is a release PR #6161
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.

1 participant