feat(sdk-core): add freeze/unfreeze unspent methods and frozen filter#9162
Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Draft
feat(sdk-core): add freeze/unfreeze unspent methods and frozen filter#9162bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
Add freezeUnspent() and unfreezeUnspent() methods to the Wallet class and IWallet interface. These methods call the BitGo API to freeze or unfreeze a specific UTXO by its ID (txid:vout format), preventing or allowing it to be selected during transaction building. Also add a frozen filter to UnspentsOptions so callers can list only frozen or non-frozen unspents via the existing unspents() method. Why: UTXOs can become frozen on BitGo's platform (e.g. the ZEC unspent 52d9e671...:0 reported in T1-3661). The SDK previously had no way to inspect or manage the frozen state of individual UTXOs programmatically, leaving operators with no self-service path to unfreeze stuck funds. Ticket: T1-3662 Session-Id: efcc06e2-ce7b-46e0-a938-bf99174ce650 Task-Id: 267141cf-1bb3-4cad-ae90-bd7ed76a54d0
Contributor
a43474c to
a656b45
Compare
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.
What
freezeUnspent(params: FreezeUnspentOptions)method toWalletandIWalletthat callsPOST /api/v2/{coin}/wallet/{id}/unspents/{unspentId}/freezeunfreezeUnspent(params: UnfreezeUnspentOptions)method toWalletandIWalletthat callsDELETE /api/v2/{coin}/wallet/{id}/unspents/{unspentId}/freezefrozen?: booleanfilter toUnspentsOptionsso callers can list only frozen or non-frozen unspents via the existingunspents()methodWhy
52d9e671...:0) stuck in a frozen state on a hot withdrawal wallet (T1-3661), leaving the balance spendable short of confirmedTest plan
modules/bitgo/test/v2/unit/unspents.ts— 7 new passing tests covering:unspents({ frozen: true })includesfrozenquery paramunspents({ frozen: false })includesfrozen=falsequery paramunspents({})omitsfrozenparamfreezeUnspent({ unspentId })calls correct POST endpointunfreezeUnspent({ unspentId })calls correct DELETE endpointfreezeUnspent({ unspentId: '' })throwsunspentId is requiredunfreezeUnspent({ unspentId: '' })throwsunspentId is requiredsdk-coreandbitgomodulesTicket: T1-3662