Repository navigation
feat(sdk-core): seamless recovery for in-flight defi deposits - #10229
Draft
mullapudipruthvik wants to merge 1 commit into
Draft
mullapudipruthvik wants to merge 1 commit into
mullapudipruthvik wants to merge 1 commit into
Conversation
Contributor
mullapudipruthvik
force-pushed
the
pruthvikpruthvik/DEFI-1360-defi-earn-bitgojs
branch
from
November 24, 2026 11:12
21a827c to
855a95f
Compare
mullapudipruthvik
force-pushed
the
pruthvikpruthvik/DEFI-1359-defi-earn-bitgojs
branch
from
November 24, 2026 11:12
a7bebdb to
1d258a7
Compare
depositToVault pre-flights against the vault-scoped operations route (state pending, type DEPOSIT, filtered by wallet — a pending withdraw never blocks a deposit) and rejects with an enriched ActiveOperationExistsError carrying operationId, vaultId, and assetAmount, so catching it and calling resumeDeposit needs zero extra API calls. resumeDeposit is now idempotent: calling it on a fully-created operation returns the existing leg ids instead of throwing a dead end, so the catch-and-resume loop always converges to the standard deposit result shape. Only an operation with no approve leg at all still throws — that state is unrecoverable client-side. Known limitation, documented on resumeDeposit: the fully-created path returns leg ids only; callers discover pending approvals via the wallet's approval listing. ActiveOperationExistsError's constructor now takes the operation record fields (additive on instances). Ticket: DEFI-1360
mullapudipruthvik
force-pushed
the
pruthvikpruthvik/DEFI-1359-defi-earn-bitgojs
branch
from
November 25, 2026 17:02
1d258a7 to
3e00ac7
Compare
mullapudipruthvik
force-pushed
the
pruthvikpruthvik/DEFI-1360-defi-earn-bitgojs
branch
from
November 25, 2026 17:02
855a95f to
521516a
Compare
This branch has not been 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.
Summary
depositToVaultpre-flights against the vault-scoped operations route (statepending, typeDEPOSIT, filtered by wallet — a pending withdraw never blocks a deposit) and rejects with an enrichedActiveOperationExistsErrorcarryingoperationId,vaultId, andassetAmount, so catching it and callingresumeDepositneeds zero extra API calls.resumeDepositis now idempotent: calling it on a fully-created operation returns the existing leg ids instead of throwing a dead end, so the catch-and-resume loop always converges to the standard deposit result shape. Guards: cancelled operations and operations belonging to a different wallet/vault are refused before anything is issued. Only an operation with no approve leg at all still throws — unrecoverable client-side.Operation-record field semantics (verified live):
associatedTxRequestId= the approve leg,txRequestId= the deposit leg. Known limitation, documented onresumeDeposit: the fully-created path returns leg ids only; callers discover pending approvals via the wallet's approval listing.Verification
Unit suite green (111 in the defi suite: enriched-error fields, type filter, idempotent resume, cancelled/wallet/vault guards). Live (DEFI-1362): the crash-recover loop passed end-to-end on test env — approve-only crash → duplicate rejected with matching enriched fields → resume issued the missing leg → both approved →
completed; fully-created duplicate → resume returned the existing legs, no second deposit.Stack
Stacked on #10228.
Ticket: DEFI-1360