> For the complete documentation index, see [llms.txt](https://docs.endless.link/endless/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.endless.link/endless/devbuild/build/endless-sdks/typescript-sdk/transaction-builder.md).

# Transaction Builder

## TS SDK Transaction Builder <a href="#ts-sdk-transaction-builder" id="ts-sdk-transaction-builder"></a>

The SDK provides a simplified and meaningful transaction builder flow to handles the transaction creation lifecycle.

The transaction builder is separated to different namespaces for each transaction step in the transaction submission flow. Each namespace/step can be accessed by initiating the Endless class

* **build** - Build a raw transaction that can be signed and then submitted to chain
* **simulate** - Simulate a transaction before signing and submitting to chain
* **sign** - Sign a raw transaction to later submit to chain
* **submit** - Submit a transaction to chain

### Submit transaction <a href="#submit-transaction" id="submit-transaction"></a>

**Simple transaction**

```js
// build a transaction
const transaction = await endless.transaction.build.simple({
  sender: alice.accountAddress,
  data: {
    function: "0x1::endless_coin::transfer",
    typeArguments: [],
    functionArguments: [bob.accountAddress, 100],
  },
});

// using sign and submit separately
const senderAuthenticator = endless.transaction.sign({
  signer: alice,
  transaction,
});
const committedTransaction = await endless.transaction.submit.simple({
  transaction,
  senderAuthenticator,
});

// or using signAndSubmit combined
const committedTransaction = await endless.signAndSubmitTransaction({
  signer: alice,
  transaction,
});
```

### Simulate transaction <a href="#simulate-transaction" id="simulate-transaction"></a>

**Simple transaction**

```js
const transaction = await endless.transaction.build.simple({
  sender: alice.accountAddress,
  data: {
    function: "0x1::endless_coin::transfer",
    functionArguments: [bob.accountAddress, 100],
  },
});
const [userTransactionResponse] = await endless.transaction.simulate.simple({
  signerPublicKey: alice.publicKey,
  transaction,
});
```


---

# 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 dynamically by asking a question.

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

```
GET https://docs.endless.link/endless/devbuild/build/endless-sdks/typescript-sdk/transaction-builder.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
