ClientOptions

public final class ClientOptions : Sendable

Configuration options for SorobanClient instances.

ClientOptions specifies the connection parameters and authentication details needed to interact with a deployed smart contract.

Required configuration:

  • Source account keypair (public key required, private key needed for signing)
  • Contract ID (the address of the deployed contract)
  • Network selection (testnet, mainnet, or custom)
  • RPC URL (endpoint for Soroban RPC server)

Example:

let clientOptions = ClientOptions(
    sourceAccountKeyPair: sourceKeyPair,
    contractId: "CCONTRACT123...",
    network: Network.testnet,
    rpcUrl: "https://soroban-testnet.stellar.org",
    enableServerLogging: false
)

let client = try await SorobanClient.forClientOptions(options: clientOptions)

See also:

  • [SorobanClient.forClientOptions] for creating client instances
  • [MethodOptions] for transaction-specific settings
  • Keypair of the Stellar account that will send this transaction. If restore is set to true, and restore is needed, the keypair must contain the private key (secret seed) otherwise the public key is sufficient.

    Declaration

    Swift

    public let sourceAccountKeyPair: KeyPair
  • The address of the contract the client will interact with.

    Declaration

    Swift

    public let contractId: String
  • The Stellar network this contract is deployed

    Declaration

    Swift

    public let network: Network
  • The URL of the RPC instance that will be used to interact with this contract.

    Declaration

    Swift

    public let rpcUrl: String
  • Enable soroban server logging (helpful for debugging). Default: false.

    Declaration

    Swift

    public let enableServerLogging: Bool
  • Constructor

    Declaration

    Swift

    public init(sourceAccountKeyPair: KeyPair, contractId: String, network: Network, rpcUrl: String, enableServerLogging: Bool = false)

    Parameters

    sourceAccountKeyPair

    Keypair of the Stellar account that will send this transaction. If restore is set to true, and restore is needed, the keypair must contain the private key (secret seed) otherwise the public key is sufficient.

    contractId

    The address of the contract the client will interact with.

    network

    The Stellar network this contract is deployed

    rpcUrl

    The URL of the RPC instance that will be used to interact with this contract.

    enableServerLogging

    Enable soroban server logging (helpful for debugging). Default: false.