> For the complete documentation index, see [llms.txt](https://docs.stacks.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stacks.co/reference/stacks.js/stacks-bitcoin-staking/reclaim/buildreclaimopts.md).

# BuildReclaimOpts

Options for [buildReclaim](/reference/stacks.js/stacks-bitcoin-staking/reclaim/buildreclaim.md): which branch to spend, the lockup UTXO, its witness script, and where the sats go.

***

### Usage

```ts
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);
```

[**Reference Link**](https://github.com/stx-labs/stacks.js/blob/6101c99efe5a9616ce7e16cef68e28fd10676e7e/packages/bitcoin-staking/src/reclaim.ts#L107-L134)

***

### Definition

```ts
interface BuildReclaimOpts {
  path: ReclaimPath;
  utxo: Utxo;
  network: StacksNetworkName | StacksNetwork;
  output: { address: string; feeSats: IntegerType };
  lockScript: Uint8Array | string;
}
```

***

### Properties

| Property         | Type                                 | Description                                                                                                                                                                                                                                                                                                                                             |
| ---------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `path`           | `ReclaimPath`                        | Branch to spend, `'locktime'` or `'early-exit'`. See [ReclaimPath](/reference/stacks.js/stacks-bitcoin-staking/reclaim/reclaimpath.md)                                                                                                                                                                                                                  |
| `utxo`           | `Utxo`                               | The lockup output to spend. See [Utxo](/reference/stacks.js/stacks-bitcoin-staking/types/utxo.md). `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](/reference/stacks.js/stacks-bitcoin-staking/script/registermetadata.md) `lockScript`, or rebuild it with [buildLockScript](/reference/stacks.js/stacks-bitcoin-staking/script/buildlockscript.md) from the same inputs. The locktime path reads the unlock height from it |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stacks.co/reference/stacks.js/stacks-bitcoin-staking/reclaim/buildreclaimopts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
