Skip to content

CSHLD-597: Add sBTC burn function to BitGo JS SDK#8641

Open
abhi-bitgo wants to merge 1 commit intomasterfrom
CSHLD-597-add-sbtc-withdraw-builder
Open

CSHLD-597: Add sBTC burn function to BitGo JS SDK#8641
abhi-bitgo wants to merge 1 commit intomasterfrom
CSHLD-597-add-sbtc-withdraw-builder

Conversation

@abhi-bitgo
Copy link
Copy Markdown
Contributor

@abhi-bitgo abhi-bitgo commented Apr 28, 2026

Summary

Add sBTC withdrawal transaction builder to the STX SDK, enabling construction and signing of initiate-withdrawal-request contract calls to the sBTC withdrawal contract.

Linear: CSHLD-597

Changes

  • Add SbtcWithdrawBuilder extending AbstractContractBuilder for sBTC withdrawal transactions
  • Add btcAddressUtils.ts with BTC address decoding supporting P2PKH, P2SH, P2WPKH, P2WSH, and P2TR
  • Add sbtcWithdrawalContractAddress to StacksNetwork interface and implementations (mainnet + testnet)
  • Wire SbtcWithdrawBuilder into TransactionBuilderFactory for deserialization routing
  • Add bech32 and bs58check dependencies for BTC address decoding
  • Add constants for sBTC withdrawal contract name and function name
  • Add SbtcWithdrawParams interface
  • Add unit tests for BTC address decoding (all 5 address types, mainnet + testnet)
  • Add unit tests for SbtcWithdrawBuilder (build, round-trip serialize/deserialize, validation)

Test Plan

  • Unit tests cover all 5 BTC address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR)
  • Round-trip tests verify serialize → deserialize → rebuild produces identical hex
  • Validation tests cover negative, zero, empty amounts/fees and invalid BTC addresses
  • All 170 existing + new tests pass

Closes CSHLD-597

@linear
Copy link
Copy Markdown

linear Bot commented Apr 28, 2026

@abhi-bitgo abhi-bitgo marked this pull request as ready for review April 29, 2026 08:16
@abhi-bitgo abhi-bitgo requested review from a team as code owners April 29, 2026 08:16
@mukeshsp
Copy link
Copy Markdown
Contributor

@claude review this PR as grug; call out only potential issues, risks, or areas for improvement (no summaries or praise), be direct and actionable, max ~500 words.

@mukeshsp
Copy link
Copy Markdown
Contributor

@claude

Add SbtcWithdrawBuilder for constructing initiate-withdrawal-request
contract calls to the sBTC withdrawal contract. Includes BTC address
decoding utilities supporting P2PKH, P2SH, P2WPKH, P2WSH, and P2TR
address types, with post-condition enforcement for fungible token
transfers.

Ticket: CSHLD-597
@abhi-bitgo abhi-bitgo force-pushed the CSHLD-597-add-sbtc-withdraw-builder branch from 8e60af3 to 02193be Compare April 30, 2026 11:07
@abhi-bitgo abhi-bitgo requested review from a team as code owners April 30, 2026 11:07
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.

3 participants