> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SUI

> Sign messages, send transactions, and interact with the SUI blockchain using the Dynamic Swift SDK.

## Overview

`SuiModule` provides native SUI blockchain operations including message signing, transaction signing (raw or built from `to`/`value`), sending transactions, and network queries. Access it via `DynamicSDK.instance().sui`.

## Prerequisites

* Dynamic SDK initialized (see [Quickstart](/swift/quickstart))
* User authenticated (see [Authentication](/swift/authentication))
* SUI enabled in the [Dynamic dashboard](https://app.dynamic.xyz/dashboard/chains-and-networks#sui)

## Get a SUI Wallet

If SUI is enabled in the dashboard, the user gets a SUI wallet on signup. Find it via `userWallets`, or create one explicitly with `EmbeddedWalletChain.sui`:

```swift theme={"system"}
let sdk = DynamicSDK.instance()

// Filter existing
let suiWallet = sdk.wallets.userWallets.first(where: { $0.chain == "SUI" })

// Or create
let wallet = try await sdk.wallets.embedded.createWallet(chain: .sui)
```

## Get Network Name

Query the network name for the connected SUI wallet:

```swift theme={"system"}
let network = try await sdk.sui.getNetworkName(walletId: wallet.id)
print("Network: \(network)") // e.g. "mainnet", "testnet"
```

## Sign a Message

Sign a message using the connected SUI wallet:

```swift theme={"system"}
let signature = try await sdk.sui.signMessage(
  walletId: wallet.id,
  message: "Hello, SUI!"
)
print("Signature: \(signature)")
```

## Sign a Transaction

Sign a raw base64-encoded SUI transaction without broadcasting it:

```swift theme={"system"}
let signature = try await sdk.sui.signTransaction(
  walletId: wallet.id,
  transaction: "base64EncodedTransaction..."
)
```

## Sign a Transfer Transaction

Build and sign a SUI transfer from convenient `to`/`value` parameters:

```swift theme={"system"}
let signature = try await sdk.sui.signTransferTransaction(
  walletId: wallet.id,
  to: "0x...",
  value: "0.001",   // SUI
  gasPrice: nil,    // optional override
  gasBudget: nil    // optional override
)
```

## Send Transactions

There are three flavors of broadcast:

```swift theme={"system"}
// Broadcast an already-signed transaction
let txDigest = try await sdk.sui.sendTransaction(
  walletId: wallet.id,
  transaction: "base64SignedTransaction..."
)

// Sign and send a raw transaction in one call
let txDigest2 = try await sdk.sui.signAndSendTransaction(
  walletId: wallet.id,
  transaction: "base64UnsignedTransaction..."
)

// Sign and send a transfer built from to/value
let txDigest3 = try await sdk.sui.signAndSendTransferTransaction(
  walletId: wallet.id,
  to: "0x...",
  value: "0.001",
  gasPrice: nil,
  gasBudget: nil
)
```

## API Reference

| Method                           | Returns  | Description                             |
| -------------------------------- | -------- | --------------------------------------- |
| `getNetworkName`                 | `String` | Get the connected network name          |
| `signMessage`                    | `String` | Sign a message                          |
| `signTransaction`                | `String` | Sign a raw base64 transaction           |
| `signTransferTransaction`        | `String` | Sign a transfer built from `to`/`value` |
| `sendTransaction`                | `String` | Broadcast a signed transaction          |
| `signAndSendTransaction`         | `String` | Sign and broadcast a raw transaction    |
| `signAndSendTransferTransaction` | `String` | Sign and broadcast a transfer           |

## Next Steps

* [Bitcoin Operations](/swift/wallets/bitcoin/overview) — Bitcoin operations
* [TON Operations](/swift/wallets/ton/overview) — TON operations
* [Token Balances](/swift/wallets/general/token-balances) — Multi-chain balance queries
