Skip to main content

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.

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

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:
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:
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:
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:
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:
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:
// 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

MethodReturnsDescription
getNetworkNameStringGet the connected network name
signMessageStringSign a message
signTransactionStringSign a raw base64 transaction
signTransferTransactionStringSign a transfer built from to/value
sendTransactionStringBroadcast a signed transaction
signAndSendTransactionStringSign and broadcast a raw transaction
signAndSendTransferTransactionStringSign and broadcast a transfer

Next Steps