For the complete documentation index, see llms.txt. This page is also available as Markdown.

BuildReclaimOpts

Options for buildReclaim: which branch to spend, the lockup UTXO, its witness script, and where the sats go.


Usage

import { buildReclaim } from '@stacks/bitcoin-staking';
import type { BuildReclaimOpts, RegisterMetadata } from '@stacks/bitcoin-staking';

declare const meta: RegisterMetadata; // stored from buildRegisterMetadata
declare const fundingTxid: string; // transaction that funded meta.lockAddress
declare const sweepAddress: string; // your Bitcoin address

const opts: BuildReclaimOpts = {
  path: 'locktime',
  utxo: {
    txid: fundingTxid,
    vout: 0,
    value: 100_000n, // sats in the lockup output
  },
  network: 'mainnet',
  output: {
    address: sweepAddress,
    feeSats: 1_000n,
  },
  lockScript: meta.lockScript,
};

const tx = buildReclaim(opts);

Definition


Properties

Property
Type
Description

path

ReclaimPath

Branch to spend, 'locktime' or 'early-exit'. See ReclaimPath

utxo

Utxo

The lockup output to spend. See Utxo. value is in sats. If scriptPubKey is set, it must equal the P2WSH form of lockScript

network

StacksNetworkName | StacksNetwork

Network whose Bitcoin address encoding output.address uses

output.address

string

Bitcoin address that receives the swept sats

output.feeSats

IntegerType

Fee in sats. The output receives utxo.value - feeSats

lockScript

Uint8Array | string

The lockup witness script, as bytes or hex. Use the stored RegisterMetadata lockScript, or rebuild it with buildLockScript from the same inputs. The locktime path reads the unlock height from it

Was this helpful?