CSHLD-1451: Pass bridgingParams/sbtcWithdrawParams through to /tx/initiate for custody sBTC mint/burn - #9475
Open
abhi-bitgo wants to merge 1 commit into
Open
CSHLD-1451: Pass bridgingParams/sbtcWithdrawParams through to /tx/initiate for custody sBTC mint/burn#9475abhi-bitgo wants to merge 1 commit into
abhi-bitgo wants to merge 1 commit into
Conversation
Custody (custodial, non-TSS) sBTC mint/burn requests go through sendMany -> initiateTransaction -> POST /tx/initiate, but that codec only allowed TxSendBody's known keys, silently stripping bridgingParams (BTC->sBTC mint) and sbtcWithdrawParams (sBTC burn) before the request left the client, even though BGMS already supports both fields on this route. Scope the whitelist/codec addition to initiateTransaction only, so sendTransaction (/tx/send) is unaffected, and add structured BridgingParams/SbtcBridgingParams codecs in BuildParams.ts to validate bridgingParams with the same rigor as the existing SbtcWithdrawParams codec. Ticket: CSHLD-1451
Contributor
Contributor
Author
|
@claude review this pr |
Contributor
|
Claude finished @abhi-bitgo's task —— View job PR Review: CSHLD-1451 - Pass bridgingParams/sbtcWithdrawParams to /tx/initiateReview Progress:
Overall Assessment: ✅ APPROVEDThis is a well-implemented PR that addresses a specific gap in the custody sBTC workflow. The implementation is clean, follows existing patterns, and includes comprehensive test coverage. 🔍 Detailed ReviewProblem & Solution ✅
Code Quality & Architecture ✅modules/sdk-core/src/bitgo/wallet/BuildParams.ts
modules/sdk-core/src/bitgo/wallet/wallet.ts
Test Coverage ✅BuildParams.ts unit tests
Wallet integration tests
🔧 Technical CorrectnessType Safety ✅
API Routing Logic ✅// Custodial: sendMany → initiateTransaction → /tx/initiate (server builds/signs)
if (this._wallet.type === 'custodial') {
return this.initiateTransaction(selectParams, reqId); // ✅ includes bridging params
}
// Non-custodial: sendMany → prebuildAndSignTransaction → sendTransaction → /tx/send
return this.sendTransaction(finalTxParams, reqId); // ✅ excludes build-time paramsBackward Compatibility ✅
🧪 Testing Notes
📋 Minor Suggestions
/**
* Parameters whitelisted for /tx/initiate requests. Extends whitelistedSendParams
* with bridging-specific fields that are build-time only and shouldn't go to /tx/send.
*/
const whitelistedInitiateParams = [...whitelistedSendParams, 'bridgingParams', 'sbtcWithdrawParams'];
✅ Approval Criteria Met
Recommendation: LGTM - Ready to merge 🚀 Job run: View details |
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
Custody (custodial, non-TSS) sBTC mint/burn requests go through
sendMany->initiateTransaction->POST /tx/initiate, but that path silently droppedbridgingParams(BTC->sBTC mint) andsbtcWithdrawParams(sBTC burn) sinceTxSendBodydoesn't declare them, even though BGMS already supports both fields on this route.Linear: CSHLD-1451
Changes
wallet.ts: addedwhitelistedInitiateParams, scoped toinitiateTransaction//tx/initiateonly (leavingsendTransaction//tx/senduntouched), and extendedinitiateTransaction's encoding codec with a localt.intersectionforbridgingParams/sbtcWithdrawParams, mirroring the existingattestationpass-through pattern for the sameTxSendBodygap.BuildParams.ts: added structured io-ts codecsSbtcBridgingParams/BridgingParams, mirroringiWallet.ts's TS interfaces, to validatebridgingParamswith the same rigor as the existingSbtcWithdrawParamscodec.BridgingParams/SbtcBridgingParamsshapes, plus wallet-level tests confirming custodialsendManyforwards these fields to/tx/initiatewhile non-custodialsendManydoes not forward them to/tx/send.Test Plan
BuildParams.tsunit tests pass (8/8)tsc --noEmit/eslintclean on touched filesmodules/bitgowallet.ts test suite (blocked locally by an unrelated missing@bitgo/sdk-coin-pearlworkspace symlink — needs verification in CI)