Skip to content

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

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

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

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
@linear
Copy link
Copy Markdown

linear Bot commented Apr 28, 2026

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.

1 participant