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
Parameters
sourceAccountKeyPairKeypair 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.
contractIdThe address of the contract the client will interact with.
networkThe Stellar network this contract is deployed
rpcUrlThe URL of the RPC instance that will be used to interact with this contract.
enableServerLoggingEnable soroban server logging (helpful for debugging). Default: false.
View on GitHub
Install in Dash