# Sui

## Transaction

Signs an unsigned transaction and broadcasts it to chain.

| Field         | Description                                                                                                                                   | Type - Optional     |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| `kind`        | `Transaction`                                                                                                                                 | String              |
| `transaction` | The unsigned hex encoded transaction as shown below.                                                                                          | String              |
| `externalId`  | A unique ID from your system. It can be leveraged to be used as an idempotency key (read more [here](/d/advanced-topics/api-idempotency.md)). | String *(optional)* |

```shell
{
  "kind": "Transaction",
  "transaction": "0x0000020008010000000000000000201d9c96adb0eda0b3beca44ed89143444b4147b30f06eef7bfc39cbbff848f6e5020200010100000101030000000001010020d672470dc607fe9afb01f4c20778716ebeb69a542e7a7dea9bebafdbd28546016d03aa3a104560ced4e75b988fcd5913576258fe664c7d6a8f27f065c36035a5ae11d0140000000020a4053ac8443987ed5f189777e783ddb7570e46f3ec31eef082d0b35c9d5ef88120d672470dc607fe9afb01f4c20778716ebeb69a542e7a7dea9bebafdbd28546e80300000000000040ab3c000000000000"
}
```

### Typescript Example with Sui SDK <a href="#typescript-example" id="typescript-example"></a>

First install the Sui SDK. You can find the full documentation here: <https://sdk.mystenlabs.com/typescript>

Here a code sample to broadcast a transaction via [the Dfns TypeScript SDK](https://github.com/dfns/dfns-sdk-ts):

```typescript
import { SuiClient } from '@mysten/sui/client'
import { Transaction } from '@mysten/sui/transactions'

const walletId = 'wa-3b6ka-b6a4k-xxxxxxxxxxxxxxxx'
const wallet = await dfnsClient.wallets.getWallet({ walletId })

const client = new SuiClient({ url: process.env.SUI_RPC_URL! })

const transaction = new Transaction()
const [coin] = transaction.splitCoins(transaction.gas, [1])
transaction.transferObjects([coin], '0x20d672470dc607fe9afb01f4c20778716ebeb69a542e7a7dea9bebafdbd28546')
transaction.setSender(wallet.address!)
const bytes = await transaction.build({ client })

const res = await dfnsClient.wallets.broadcastTransaction({
  walletId,
  body: {
    kind: 'Transaction',
    transaction: `0x${Buffer.from(bytes).toString('hex')}`,
  },
})
```


---

# 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://docs-legacy.dfns.co/d/api-docs/wallets/broadcast-transaction/sui.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.
