Repository navigation
feat(deposit): send USDC on Injective on to dYdX automatically - #2148
Merged
Merged
Conversation
Deposits are bridged to the user's Injective address, and until now the user was prompted to send them on to dYdX from a dialog. A new lifecycle does that for them: whenever the address holds at least 1 USDC, it sends the balance to the dYdX address over IBC, with gas paid by the sponsor unless the account holds enough INJ. The prompt (notification and account menu) is only shown while the lifecycle is not looking after the account: for Cosmos wallets, which would have to be asked to sign, for restricted or view-only accounts, and after an attempt has failed. Failed attempts are retried with a growing delay. Withdrawals leave through the same Injective address, so nothing is sent while one is passing through, nor while the user has the dialog open to send the balance themselves. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jaredvu
approved these changes
Nov 30, 2026
This branch was successfully deployed
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.
Changes
Deposits are bridged to the user's Injective address, and until now the user was prompted ("Complete your deposit") to send them on to dYdX from
InjectiveDepositDialog. This adds a lifecycle that does it for them.injectiveBalanceSweepLifecycle: whenever the Injective address holds at least 1 USDC, it sends the whole balance to the dYdX address over IBC. Gas is paid by the sponsor unless the account holds enough INJ. It reusesgetInjectiveBalances,requestGasSponsorshipandsendInjectiveUsdcToDydxfrom feat(usdc-migration): re-enable deposits + support gas sponsorship #2132, so it does what the dialog's Continue button does. From the dYdX wallet the funds reach the trading account through the existing USDC rebalance lifecycle.walletEphemeral.injectiveAutoSweepActive). The notification and the account-menu item are shown only while it is not:selectTxAuthorizedAccount)selectHasNonExpiredPendingWithdraws, evaluated on each poll since it depends on the time)useInjectiveBalances(one poll for both), and the query is invalidated when a tracked deposit reaches Injective.InjectiveDepositDialogis unchanged and remains the manual fallback.Testing
injectiveBalanceSweepLifecycle.spec.tscovering the transfer, who is left to the prompt, the withdrawal and dialog guards, failure/retry, and account switches.tsc,eslintand the full suite (351 tests) pass.Known limitations
Issue
Related Issues (Optional)
Screenshots/Recordings (Optional)