# Rebuilding Transaction

Rebuilding a transaction starts from obtaining the `TxBuilderBody` , which can be obtained by either of the methods from `TxParser`:

* `get_builder_body` - get the entire `TxBuilderBody` of the current transaction parsed
* `get_builder_body_without_change` - get the `TxBuilderBody` without the last output
  * This is the recommended method for rebuilding the transaction since the `complete` method of `TxBuilder` would re-calculate the change as per the manipulation. Thus, the rebuilt transaction will be in an expected shape without one extra output.

### Full Example

```rust
// let body = tx_parser.get_builder_body();
let body = tx_parser.get_builder_body_without_change();

let mut new_tx_builder = TxBuilder::new_core();

// manipulation of the `tx_builder_body` as needed here
new_tx_builder.tx_builder_body = body.clone();

new_tx_builder
    // extra tx building methods as needed here
    .complete_sync(None)
    .unwrap();
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whisky.sidan.io/tx-parser/rebuilding-transaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
