SorobanServer class

Client for interacting with a Soroban RPC server.

SorobanServer provides methods to interact with Stellar's smart contract platform (Soroban) through its RPC interface. Use this class to simulate transactions, submit them to the network, query contract state, retrieve events, and manage contract deployments.

The Soroban RPC server is separate from Horizon and provides specialized endpoints for smart contract operations including transaction simulation, resource footprint calculation, and contract state queries.

Parameters:

  • _serverUrl URL of the Soroban RPC server endpoint

Example:

final server = SorobanServer('https://soroban-testnet.stellar.org:443');

// Check server health
final health = await server.getHealth();
if (health.status == GetHealthResponse.HEALTHY) {
  print('Server is healthy');
}

// Get network information
final network = await server.getNetwork();
print('Network passphrase: ${network.passphrase}');

// Simulate a transaction
final simulation = await server.simulateTransaction(request);
final resourceFee = simulation.minResourceFee;

See also:

Constructors

SorobanServer(String _serverUrl)
Creates a SorobanServer instance with explicit RPC server URL.

Properties

enableLogging bool
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
httpOverrides bool
Dio HTTP Overrides Enable overrides to handle badCertificateCallback. Available only for the non-Web platform.
no getter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getAccount(String accountId) Future<Account?>
Fetches current account information from the ledger state.
getContractData(String contractId, XdrSCVal key, XdrContractDataDurability durability) Future<LedgerEntry?>
Reads the current value of contract data from the ledger state.
getEvents(GetEventsRequest request) Future<GetEventsResponse>
Retrieves contract events emitted within a specified ledger range.
getFeeStats() Future<GetFeeStatsResponse>
Retrieves statistical information about inclusion fees charged by the network.
getHealth() Future<GetHealthResponse>
Retrieves the health status of the Soroban RPC server.
getLatestLedger() Future<GetLatestLedgerResponse>
Retrieves information about the latest ledger known to the Soroban RPC server.
getLedgerEntries(List<String> base64EncodedKeys) Future<GetLedgerEntriesResponse>
Reads ledger entries directly from the current ledger state.
getLedgers(GetLedgersRequest request) Future<GetLedgersResponse>
Retrieves a paginated list of ledgers with detailed information.
getNetwork() Future<GetNetworkResponse>
Retrieves information about the Stellar network configuration.
getTransaction(String transactionHash) Future<GetTransactionResponse>
Retrieves the status and results of a submitted transaction.
getTransactions(GetTransactionsRequest request) Future<GetTransactionsResponse>
Retrieves a paginated list of transactions from the ledger history.
getVersionInfo() Future<GetVersionInfoResponse>
Retrieves version information about the Soroban RPC server and Captive Core.
loadContractCodeForContractId(String contractId) Future<XdrContractCodeEntry?>
Loads the WebAssembly bytecode for a contract given its contract ID.
loadContractCodeForWasmId(String wasmId) Future<XdrContractCodeEntry?>
Loads the WebAssembly bytecode for a contract given its Wasm ID.
loadContractInfoForContractId(String contractId) Future<SorobanContractInfo?>
Loads and parses contract metadata for a given contract ID.
loadContractInfoForWasmId(String wasmId) Future<SorobanContractInfo?>
Loads and parses contract metadata for a given Wasm ID.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendTransaction(Transaction transaction) Future<SendTransactionResponse>
Submits a signed transaction to the Stellar network.
simulateTransaction(SimulateTransactionRequest request) Future<SimulateTransactionResponse>
Simulates a transaction to estimate resources and preview results.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited