Skip to content

Network / RPC

rpc.Api.isSimulationError

Checks if a simulation response indicates an error.

isSimulationError(sim: SimulateTransactionResponse): sim is SimulateTransactionErrorResponse

Parameters

  • simSimulateTransactionResponse (required) — The simulation response to check.

Returns

True if the response indicates an error, false otherwise.

Source: src/rpc/api.ts:479

rpc.Api.isSimulationRaw

Checks if a simulation response is in raw (unparsed) form.

isSimulationRaw(sim: SimulateTransactionResponse | RawSimulateTransactionResponse): sim is RawSimulateTransactionResponse

Parameters

  • simSimulateTransactionResponse | RawSimulateTransactionResponse (required) — The simulation response to check.

Returns

True if the response is raw, false otherwise.

Source: src/rpc/api.ts:516

rpc.Api.isSimulationRestore

Checks if a simulation response indicates that a restoration is needed.

isSimulationRestore(sim: SimulateTransactionResponse): sim is SimulateTransactionRestoreResponse

Parameters

  • simSimulateTransactionResponse (required) — The simulation response to check.

Returns

True if the response indicates a restoration is needed, false otherwise.

Source: src/rpc/api.ts:501

rpc.Api.isSimulationSuccess

Checks if a simulation response indicates success.

isSimulationSuccess(sim: SimulateTransactionResponse): sim is SimulateTransactionSuccessResponse

Parameters

  • simSimulateTransactionResponse (required) — The simulation response to check.

Returns

True if the response indicates success, false otherwise.

Source: src/rpc/api.ts:490

rpc.BasicSleepStrategy

const BasicSleepStrategy: SleepStrategy

Source: src/rpc/server.ts:117

rpc.LinearSleepStrategy

const LinearSleepStrategy: SleepStrategy

Source: src/rpc/server.ts:120

rpc.Server

Handles the network connection to a Soroban RPC instance, exposing an interface for requests to that instance.

class Server {
constructor(serverURL: string, opts: Options = {});
readonly httpClient: HttpClient;
readonly serverURL: URL;
_getEvents(request: GetEventsRequest): Promise<RawGetEventsResponse>;
_getLatestLedger(): Promise<RawGetLatestLedgerResponse>;
_getLedgerEntries(...keys: LedgerKey[]): Promise<RawGetLedgerEntriesResponse>;
_getLedgers(request: GetLedgersRequest): Promise<RawGetLedgersResponse>;
_getTransaction(hash: string): Promise<RawGetTransactionResponse>;
_getTransactions(request: GetTransactionsRequest): Promise<RawGetTransactionsResponse>;
_sendTransaction(transaction: Transaction | FeeBumpTransaction): Promise<RawSendTransactionResponse>;
_simulateTransaction(transaction: Transaction | FeeBumpTransaction, addlResources?: ResourceLeeway, authMode?: SimulationAuthMode, useUpgradedAuth: boolean = true): Promise<RawSimulateTransactionResponse>;
fundAddress(address: string, friendbotUrl?: string): Promise<GetSuccessfulTransactionResponse>;
getAccount(address: string): Promise<Account>;
getAccountEntry(address: string): Promise<AccountEntry>;
getAssetBalance(address: string | Address | Contract, asset: Asset, networkPassphrase?: string): Promise<BalanceResponse>;
getClaimableBalance(id: string): Promise<ClaimableBalanceEntry>;
getContractData(contract: string | Address | Contract, key: ScVal, durability: Durability = Durability.Persistent): Promise<LedgerEntryResult>;
getContractInstance(contractId: string): Promise<ScContractInstance>;
getContractMethods(contractId: string, networkPassphrase?: string): Promise<ContractMethod[]>;
getContractWasmByContractId(contractId: string): Promise<Uint8Array<ArrayBufferLike>>;
getContractWasmByHash(wasmHash: string | Uint8Array<ArrayBufferLike>, format: "hex" | "base64" | undefined = undefined): Promise<Uint8Array<ArrayBufferLike>>;
getEvents(request: GetEventsRequest): Promise<GetEventsResponse>;
getExternalRefWasmHash(ref: ContractExecutableExternalRef): Promise<Uint8Array<ArrayBufferLike>>;
getFeeStats(): Promise<GetFeeStatsResponse>;
getHealth(): Promise<GetHealthResponse>;
getLatestLedger(): Promise<GetLatestLedgerResponse>;
getLedgerEntries(...keys: LedgerKey[]): Promise<GetLedgerEntriesResponse>;
getLedgerEntry(key: LedgerKey): Promise<LedgerEntryResult>;
getLedgers(request: GetLedgersRequest): Promise<GetLedgersResponse>;
getNetwork(): Promise<GetNetworkResponse>;
getSACBalance(address: string | Address, sac: Asset, networkPassphrase?: string): Promise<BalanceResponse>;
getTransaction(hash: string): Promise<GetTransactionResponse>;
getTransactions(request: GetTransactionsRequest): Promise<GetTransactionsResponse>;
getTrustline(account: string, asset: Asset): Promise<TrustLineEntry>;
getVersionInfo(): Promise<GetVersionInfoResponse>;
pollTransaction(hash: string, opts?: PollingOptions): Promise<GetTransactionResponse>;
prepareTransaction(tx: Transaction | FeeBumpTransaction, useUpgradedAuth: boolean = true): Promise<Transaction>;
queryContract<T = any>(contractId: string, method: string, args: Record<string, unknown> = {}, networkPassphrase?: string): Promise<{ isReadCall: boolean; result: T }>;
requestAirdrop(address: string | Pick<Account, "accountId">, friendbotUrl?: string): Promise<Account>;
sendTransaction(transaction: Transaction | FeeBumpTransaction): Promise<SendTransactionResponse>;
simulateTransaction(tx: Transaction | FeeBumpTransaction, addlResources?: ResourceLeeway, authMode?: SimulationAuthMode, useUpgradedAuth: boolean = true): Promise<SimulateTransactionResponse>;
}

See also

  • API reference docs

Source: src/rpc/server.ts:80

new Server(serverURL, opts)

constructor(serverURL: string, opts: Options = {});

Parameters

  • serverURLstring (required)
  • optsOptions (optional) (default: {})

Source: src/rpc/server.ts:207

server.httpClient

HTTP client instance for making requests to Horizon. Exposes interceptors, defaults, and other configuration options.

readonly httpClient: HttpClient;

Example

// Add authentication header
server.httpClient.defaults.headers['Authorization'] = 'Bearer token';
// Add request interceptor
server.httpClient.interceptors.request.use((config) => {
console.log('Request:', config.url);
return config;
});

Source: src/rpc/server.ts:206

server.serverURL

readonly serverURL: URL;

Source: src/rpc/server.ts:189

server._getEvents(request)

_getEvents(request: GetEventsRequest): Promise<RawGetEventsResponse>;

Parameters

  • requestGetEventsRequest (required)

Source: src/rpc/server.ts:1265

server._getLatestLedger()

_getLatestLedger(): Promise<RawGetLatestLedgerResponse>;

Source: src/rpc/server.ts:1336

server._getLedgerEntries(keys)

_getLedgerEntries(...keys: LedgerKey[]): Promise<RawGetLedgerEntriesResponse>;

Parameters

  • ...keysLedgerKey[] (required)

Source: src/rpc/server.ts:1030

server._getLedgers(request)

_getLedgers(request: GetLedgersRequest): Promise<RawGetLedgersResponse>;

Parameters

  • requestGetLedgersRequest (required)

Source: src/rpc/server.ts:1954

server._getTransaction(hash)

_getTransaction(hash: string): Promise<RawGetTransactionResponse>;

Parameters

  • hashstring (required)

Source: src/rpc/server.ts:1153

server._getTransactions(request)

_getTransactions(request: GetTransactionsRequest): Promise<RawGetTransactionsResponse>;

Parameters

  • requestGetTransactionsRequest (required)

Source: src/rpc/server.ts:1204

server._sendTransaction(transaction)

_sendTransaction(transaction: Transaction | FeeBumpTransaction): Promise<RawSendTransactionResponse>;

Parameters

  • transactionTransaction | FeeBumpTransaction (required)

Source: src/rpc/server.ts:1593

server._simulateTransaction(transaction, addlResources, authMode, useUpgradedAuth)

_simulateTransaction(transaction: Transaction | FeeBumpTransaction, addlResources?: ResourceLeeway, authMode?: SimulationAuthMode, useUpgradedAuth: boolean = true): Promise<RawSimulateTransactionResponse>;

Parameters

  • transactionTransaction | FeeBumpTransaction (required)
  • addlResourcesResourceLeeway (optional)
  • authModeSimulationAuthMode (optional)
  • useUpgradedAuthboolean (optional) (default: true)

Source: src/rpc/server.ts:1422

server.fundAddress(address, friendbotUrl)

Fund an address using the network’s Friendbot faucet, if any.

This method supports both account (G…) and contract (C…) addresses.

fundAddress(address: string, friendbotUrl?: string): Promise<GetSuccessfulTransactionResponse>;

Parameters

  • addressstring (required) — The address to fund. Can be either a Stellar account (G…) or contract (C…) address.
  • friendbotUrlstring (optional) — (optional) Optionally, an explicit Friendbot URL (by default: this calls the Stellar RPC getNetwork method to try to discover this network’s Friendbot url).

Returns

The transaction response from the Friendbot funding transaction.

Throws

  • If Friendbot is not configured on this network or the funding transaction fails.

Example

// Funding an account (G... address)
const tx = await server.fundAddress("GBZC6Y2Y7...");
console.log("Funded! Hash:", tx.txHash);
// If you need the Account object:
const account = await server.getAccount("GBZC6Y2Y7...");

Example

// Funding a contract (C... address)
const tx = await server.fundAddress("CBZC6Y2Y7...");
console.log("Contract funded! Hash:", tx.txHash);

See also

  • Friendbot docs

Source: src/rpc/server.ts:1713

server.getAccount(address)

Fetch a minimal set of current info about a Stellar account.

Needed to get the current sequence number for the account so you can build a successful transaction with TransactionBuilder.

getAccount(address: string): Promise<Account>;

Parameters

  • addressstring (required) — The public address of the account to load.

Returns

A promise which resolves to the Account object with a populated sequence number

Example

const accountId = "GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4";
server.getAccount(accountId).then((account) => {
console.log("sequence:", account.sequence);
});

See also

  • getLedgerEntries docs

Source: src/rpc/server.ts:240

server.getAccountEntry(address)

Fetch the full account entry for a Stellar account.

getAccountEntry(address: string): Promise<AccountEntry>;

Parameters

  • addressstring (required) — The public address of the account to load.

Returns

Resolves to the full on-chain account entry

Example

const accountId = "GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4";
server.getAccountEntry(accountId).then((account) => {
console.log("sequence:", account.balance().toString());
});

See also

  • getLedgerEntries docs

Source: src/rpc/server.ts:263

server.getAssetBalance(address, asset, networkPassphrase)

Fetch the balance of an asset held by an account or contract.

The address argument may be provided as a string (as a StrKey), Address, or Contract.

getAssetBalance(address: string | Address | Contract, asset: Asset, networkPassphrase?: string): Promise<BalanceResponse>;

Parameters

  • addressstring | Address | Contract (required) — The account or contract whose balance should be fetched.
  • assetAsset (required) — The asset whose balance you want to inspect.
  • networkPassphrasestring (optional) — (optional) optionally, when requesting the balance of a contract, the network passphrase to which this token applies. If omitted and necessary, a request about network information will be made (see getNetwork), since contract IDs for assets are specific to a network. You can refer to Networks for a list of built-in passphrases, e.g., Networks.TESTNET.

Returns

Resolves with balance entry details when available.

Throws

  • If the supplied address is not a valid account or contract strkey.

Example

const usdc = new Asset(
"USDC",
"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
);
const balance = await server.getAssetBalance("GD...", usdc);
console.log(balance.balanceEntry?.amount);

Source: src/rpc/server.ts:424

server.getClaimableBalance(id)

Fetch the full claimable balance entry for a Stellar account.

getClaimableBalance(id: string): Promise<ClaimableBalanceEntry>;

Parameters

  • idstring (required) — The strkey (B...) or hex (00000000abcde...) (both IDs with and without the 000… version prefix are accepted) of the claimable balance to load

Returns

Resolves to the full on-chain claimable balance entry

Example

const id = "00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9";
server.getClaimableBalance(id).then((entry) => {
console.log(`Claimable balance {id.substr(0, 12)} has:`);
console.log(` asset: ${Asset.fromOperation(entry.asset).toString()}`);
console.log(` amount: ${entry.amount.toString()}`);
});

See also

  • getLedgerEntries docs

Source: src/rpc/server.ts:355

server.getContractData(contract, key, durability)

Reads the current value of contract data ledger entries directly.

Allows you to directly inspect the current state of a contract. This is a backup way to access your contract data which may not be available via events or rpc.Server.simulateTransaction.

getContractData(contract: string | Address | Contract, key: ScVal, durability: Durability = Durability.Persistent): Promise<LedgerEntryResult>;

Parameters

  • contractstring | Address | Contract (required) — The contract ID containing the data to load as a strkey (C... form), a Contract, or an Address instance
  • keyScVal (required) — The key of the contract data to load
  • durabilityDurability (optional) (default: Durability.Persistent) — (optional) The “durability keyspace” that this ledger key belongs to, which is either ‘temporary’ or ‘persistent’ (the default), see rpc.Durability.

Returns

The current data value

Warning: If the data entry in question is a ‘temporary’ entry, it’s entirely possible that it has expired out of existence.

Example

const contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5";
const key = xdr.ScVal.scvSymbol("counter");
server.getContractData(contractId, key, Durability.Temporary).then(data => {
console.log("value:", data.val);
console.log("liveUntilLedgerSeq:", data.liveUntilLedgerSeq);
console.log("lastModified:", data.lastModifiedLedgerSeq);
console.log("latestLedger:", data.latestLedger);
});

See also

  • getLedgerEntries docs

Source: src/rpc/server.ts:525

server.getContractInstance(contractId)

Retrieves the deployed contract instance for a given contract ID.

The instance describes the contract’s executable — either a Wasm hash or the built-in Stellar Asset Contract — along with its instance storage.

getContractInstance(contractId: string): Promise<ScContractInstance>;

Parameters

  • contractIdstring (required) — The contract ID (C...) to look up

Returns

The contract’s xdr.ScContractInstance

Throws

  • If the contract instance cannot be found on the network.

Example

const instance = await server.getContractInstance(
"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5",
);
console.log(instance.executable.type);

Source: src/rpc/server.ts:604

server.getContractMethods(contractId, networkPassphrase)

Lists a contract’s callable methods and their signatures.

A discovery helper for tooling, dapps, and agents that need to inspect an arbitrary contract without knowing its interface up front. It resolves the contract’s spec (embedded in the Wasm for regular contracts, or the built-in spec for Stellar Asset Contracts — see contract.Client.from) and reports each declared function’s name, inputs, and outputs. No method is invoked or simulated; this performs only the spec lookup.

The complement to queryContract: list methods here, then call a read-only one with server.queryContract(contractId, method, args?).

getContractMethods(contractId: string, networkPassphrase?: string): Promise<ContractMethod[]>;

Parameters

  • contractIdstring (required) — the contract to inspect (C...)
  • networkPassphrasestring (optional) — (optional) the network passphrase. If omitted, a request about network information will be made (see getNetwork). You can refer to Networks for a list of built-in passphrases, e.g., Networks.TESTNET.

Returns

The contract’s methods, in the order they appear in the spec

Example

const methods = await server.getContractMethods(
"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5",
);
// [
// { name: "decimals", inputs: [], outputs: ["U32"] },
// { name: "balance", inputs: [{ name: "id", type: "Address" }], outputs: ["I128"] },
// { name: "transfer", inputs: [...], outputs: [] },
// ]

Source: src/rpc/server.ts:953

server.getContractWasmByContractId(contractId)

Retrieves the WASM bytecode for a given contract.

This method allows you to fetch the WASM bytecode associated with a contract deployed on the Soroban network. The WASM bytecode represents the executable code of the contract.

This only works for Wasm-based contracts, including one created from a CAP-85 external executable reference, whose reference is resolved to a Wasm hash first (see getExternalRefWasmHash). A built-in Stellar Asset Contract (SAC) has no Wasm bytecode on-chain, so this throws for a SAC; use contract.Client.from to build a client from the embedded SAC spec.

getContractWasmByContractId(contractId: string): Promise<Uint8Array<ArrayBufferLike>>;

Parameters

  • contractIdstring (required) — The contract ID containing the WASM bytecode to retrieve

Returns

A Uint8Array containing the WASM bytecode

Throws

  • If the contract or its associated WASM bytecode cannot be found on the network, or if the contract is a Stellar Asset Contract (SAC).

Example

const contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5";
server.getContractWasmByContractId(contractId).then(wasmBytes => {
console.log("WASM bytecode length:", wasmBytes.length);
// ... do something with the WASM bytecode ...
}).catch(err => {
console.error("Error fetching WASM bytecode:", err);
});

Source: src/rpc/server.ts:730

server.getContractWasmByHash(wasmHash, format)

Retrieves the WASM bytecode for a given contract hash.

This method allows you to fetch the WASM bytecode associated with a contract deployed on the Soroban network using the contract’s WASM hash. The WASM bytecode represents the executable code of the contract.

getContractWasmByHash(wasmHash: string | Uint8Array<ArrayBufferLike>, format: "hex" | "base64" | undefined = undefined): Promise<Uint8Array<ArrayBufferLike>>;

Parameters

  • wasmHashstring | Uint8Array<ArrayBufferLike> (required) — The WASM hash of the contract
  • format"hex" | "base64" | undefined (optional) (default: undefined)

Returns

A Uint8Array containing the WASM bytecode

Throws

  • If the contract or its associated WASM bytecode cannot be found on the network.

Example

const wasmHash = hexToUint8Array("...");
server.getContractWasmByHash(wasmHash).then(wasmBytes => {
console.log("WASM bytecode length:", wasmBytes.length);
// ... do something with the WASM bytecode ...
}).catch(err => {
console.error("Error fetching WASM bytecode:", err);
});

Source: src/rpc/server.ts:785

server.getEvents(request)

Fetch all events that match a given set of filters.

The given filters (see Api.EventFilter for detailed fields) are combined only in a logical OR fashion, and all of the fields in each filter are optional.

To page through events, use the pagingToken field on the relevant Api.EventResponse object to set the cursor parameter.

getEvents(request: GetEventsRequest): Promise<GetEventsResponse>;

Parameters

Returns

A paginatable set of the events matching the given event filters

Example

server.getEvents({
startLedger: 1000,
endLedger: 2000,
filters: [
{
type: "contract",
contractIds: [ "deadb33f..." ],
topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc=", "*" ]]
}, {
type: "system",
contractIds: [ "...c4f3b4b3..." ],
topics: [[ "*" ], [ "*", "AAAAAQB6Mcc=" ]]
}, {
contractIds: [ "...c4f3b4b3..." ],
topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==" ]]
}, {
type: "diagnostic",
topics: [[ "AAAAAQB6Mcc=" ]]
}
],
limit: 10,
});

See also

  • getEvents docs

Source: src/rpc/server.ts:1259

server.getExternalRefWasmHash(ref)

Resolves a CAP-85 external executable reference to the Wasm hash it names.

A contract created with an external reference does not carry its own code hash. Instead the reference names an owner contract and a tag, and the owner holds a persistent contract data entry keyed by that tag whose value is the 32-byte hash of an existing Wasm. This performs exactly that lookup — the owner contract is not invoked.

getExternalRefWasmHash(ref: ContractExecutableExternalRef): Promise<Uint8Array<ArrayBufferLike>>;

Parameters

  • refContractExecutableExternalRef (required) — the external reference, e.g. from the contractExecutableExternalRef arm of a contract instance’s executable

Returns

the 32-byte Wasm hash the reference resolves to

Throws

  • If the owner is not a contract, the tag entry is missing or archived, or the entry does not hold a 32-byte hash.

Example

const instance = await server.getContractInstance(contractId);
if (instance.executable.type === "contractExecutableExternalRef") {
const hash = await server.getExternalRefWasmHash(
instance.executable.externalRef,
);
const wasm = await server.getContractWasmByHash(hash);
}

Source: src/rpc/server.ts:659

server.getFeeStats()

Provides an analysis of the recent fee stats for regular and smart contract operations.

getFeeStats(): Promise<GetFeeStatsResponse>;

Returns

the fee stats

See also

Source: src/rpc/server.ts:1759

server.getHealth()

General node health check.

getHealth(): Promise<GetHealthResponse>;

Returns

A promise which resolves to the Api.GetHealthResponse object with the status of the server (e.g. “healthy”).

Example

server.getHealth().then((health) => {
console.log("status:", health.status);
});

See also

  • getLedgerEntries docs

Source: src/rpc/server.ts:483

server.getLatestLedger()

Fetch the latest ledger meta info from network which this Soroban RPC server is connected to.

getLatestLedger(): Promise<GetLatestLedgerResponse>;

Returns

metadata about the latest ledger on the network that this RPC server is connected to

Example

server.getLatestLedger().then((response) => {
console.log("hash:", response.id);
console.log("sequence:", response.sequence);
console.log("protocolVersion:", response.protocolVersion);
});

See also

  • getLatestLedger docs

Source: src/rpc/server.ts:1332

server.getLedgerEntries(keys)

Reads the current value of arbitrary ledger entries directly.

Allows you to directly inspect the current state of contracts, contract’s code, accounts, or any other ledger entries.

To fetch a contract’s WASM byte-code, built the appropriate xdr.LedgerKeyContractCode ledger entry key (or see Contract.getFootprint).

getLedgerEntries(...keys: LedgerKey[]): Promise<GetLedgerEntriesResponse>;

Parameters

  • ...keysLedgerKey[] (required) — One or more ledger entry keys to load

Returns

The current on-chain values for the given ledger keys

Example

const contractId = "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM";
const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({
contractId: StrKey.decodeContract(contractId),
key: xdr.ScVal.scvSymbol("counter"),
}));
server.getLedgerEntries([key]).then(response => {
const ledgerData = response.entries[0];
console.log("key:", ledgerData.key);
console.log("value:", ledgerData.val);
console.log("liveUntilLedgerSeq:", ledgerData.liveUntilLedgerSeq);
console.log("lastModified:", ledgerData.lastModifiedLedgerSeq);
console.log("latestLedger:", response.latestLedger);
});

See also

    • getLedgerEntries docs
  • RpcServer._getLedgerEntries

Source: src/rpc/server.ts:1026

server.getLedgerEntry(key)

getLedgerEntry(key: LedgerKey): Promise<LedgerEntryResult>;

Parameters

  • keyLedgerKey (required)

Source: src/rpc/server.ts:1041

server.getLedgers(request)

Fetch a detailed list of ledgers starting from a specified point.

Returns ledger data with support for pagination as long as the requested pages fall within the history retention of the RPC provider.

getLedgers(request: GetLedgersRequest): Promise<GetLedgersResponse>;

Parameters

  • requestGetLedgersRequest (required) — The request parameters for fetching ledgers. Api.GetLedgersRequest

Returns

A promise that resolves to the ledgers response containing an array of ledger data and pagination info. Api.GetLedgersResponse

Throws

  • If startLedger is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node.

Example

// Fetch ledgers starting from a specific sequence number
server.getLedgers({
startLedger: 36233,
pagination: {
limit: 10
}
}).then((response) => {
console.log("Ledgers:", response.ledgers);
console.log("Latest Ledger:", response.latestLedger);
console.log("Cursor:", response.cursor);
});

Example

// Paginate through ledgers using cursor
const firstPage = await server.getLedgers({
startLedger: 36233,
pagination: {
limit: 5
}
});
const nextPage = await server.getLedgers({
pagination: {
cursor: firstPage.cursor,
limit: 5
}
});

See also

  • getLedgers docs

Source: src/rpc/server.ts:1938

server.getNetwork()

Fetch metadata about the network this Soroban RPC server is connected to.

getNetwork(): Promise<GetNetworkResponse>;

Returns

Metadata about the current network this RPC server is connected to

Example

server.getNetwork().then((network) => {
console.log("friendbotUrl:", network.friendbotUrl);
console.log("passphrase:", network.passphrase);
console.log("protocolVersion:", network.protocolVersion);
});

See also

  • getNetwork docs

Source: src/rpc/server.ts:1306

server.getSACBalance(address, sac, networkPassphrase)

Deprecated. Use getAssetBalance, instead

Returns a contract’s balance of a particular SAC asset, if any.

This is a convenience wrapper around Server.getLedgerEntries.

getSACBalance(address: string | Address, sac: Asset, networkPassphrase?: string): Promise<BalanceResponse>;

Parameters

  • addressstring | Address (required) — the contract (string C...) whose balance of sac you want to know
  • sacAsset (required) — the built-in SAC token (e.g. USDC:GABC...) that you are querying from the given contract.
  • networkPassphrasestring (optional) — (optional) optionally, the network passphrase to which this token applies. If omitted, a request about network information will be made (see getNetwork), since contract IDs for assets are specific to a network. You can refer to Networks for a list of built-in passphrases, e.g., Networks.TESTNET.

Returns

, which will contain the balance entry details if and only if the request returned a valid balance ledger entry. If it doesn’t, the balanceEntry field will not exist.

Throws

  • If address is not a valid contract ID (C…).

Example

// assume `address` is some contract or account with an XLM balance
// assume server is an instantiated `Server` instance.
const entry = (await server.getSACBalance(
new Address(address),
Asset.native(),
Networks.PUBLIC
));
// assumes BigInt support:
console.log(
entry.balanceEntry ?
BigInt(entry.balanceEntry.amount) :
"Address has no XLM");

See also

Source: src/rpc/server.ts:1823

server.getTransaction(hash)

Fetch the details of a submitted transaction.

After submitting a transaction, clients should poll this to tell when the transaction has completed.

getTransaction(hash: string): Promise<GetTransactionResponse>;

Parameters

  • hashstring (required) — Hex-encoded hash of the transaction to check

Returns

The status, result, and other details about the transaction

Example

const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
server.getTransaction(transactionHash).then((tx) => {
console.log("status:", tx.status);
console.log("envelopeXdr:", tx.envelopeXdr);
console.log("resultMetaXdr:", tx.resultMetaXdr);
console.log("resultXdr:", tx.resultXdr);
});

See also

  • getTransaction docs

Source: src/rpc/server.ts:1126

server.getTransactions(request)

Fetch transactions starting from a given start ledger or a cursor. The end ledger is the latest ledger in that RPC instance.

getTransactions(request: GetTransactionsRequest): Promise<GetTransactionsResponse>;

Parameters

  • requestGetTransactionsRequest (required) — The request parameters.

Returns

  • A promise that resolves to the transactions response.

Example

server.getTransactions({
startLedger: 10000,
limit: 10,
}).then((response) => {
console.log("Transactions:", response.transactions);
console.log("Latest Ledger:", response.latestLedger);
console.log("Cursor:", response.cursor);
});

See also

Source: src/rpc/server.ts:1186

server.getTrustline(account, asset)

Deprecated. Use getAssetBalance, instead

Fetch the full trustline entry for a Stellar account.

getTrustline(account: string, asset: Asset): Promise<TrustLineEntry>;

Parameters

  • accountstring (required) — The public address of the account whose trustline it is
  • assetAsset (required) — The trustline’s asset

Returns

Resolves to the full on-chain trustline entry

Example

const accountId = "GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4";
const asset = new Asset(
"USDC",
"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
);
server.getTrustline(accountId, asset).then((entry) => {
console.log(`{asset.toString()} balance for ${accountId}:", entry.balance().toString());
});

See also

  • getLedgerEntries docs

Source: src/rpc/server.ts:307

server.getVersionInfo()

Provides information about the current version details of the Soroban RPC and captive-core

getVersionInfo(): Promise<GetVersionInfoResponse>;

Returns

the version info

See also

Source: src/rpc/server.ts:1773

server.pollTransaction(hash, opts)

Poll for a particular transaction with certain parameters.

After submitting a transaction, clients can use this to poll for transaction completion and return a definitive state of success or failure.

pollTransaction(hash: string, opts?: PollingOptions): Promise<GetTransactionResponse>;

Parameters

  • hashstring (required) — the transaction you’re polling for
  • optsPollingOptions (optional) — (optional) polling options
    • attempts (optional): (optional) the number of attempts to make before returning the last-seen status. By default or on invalid inputs, try 5 times.
    • sleepStrategy (optional): (optional) the amount of time to wait for between each attempt. By default, sleep for 1 second between each attempt.

Returns

the response after a “found” response (which may be success or failure) or the last response obtained after polling the maximum number of specified attempts.

Example

const h = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a";
const txStatus = await server.pollTransaction(h, {
attempts: 100, // I'm a maniac
sleepStrategy: rpc.LinearSleepStrategy
}); // this will take 5,050 seconds to complete

Source: src/rpc/server.ts:1079

server.prepareTransaction(tx, useUpgradedAuth)

Submit a trial contract invocation, first run a simulation of the contract invocation as defined on the incoming transaction, and apply the results to a new copy of the transaction which is then returned. Setting the ledger footprint and authorization, so the resulting transaction is ready for signing & sending.

The returned transaction will also have an updated fee that is the sum of fee set on incoming transaction with the contract resource fees estimated from simulation. It is advisable to check the fee on returned transaction and validate or take appropriate measures for interaction with user to confirm it is acceptable.

You can call the rpc.Server.simulateTransaction method directly first if you want to inspect estimated fees for a given transaction in detail first, then re-assemble it manually or via rpc.assembleTransaction.

prepareTransaction(tx: Transaction | FeeBumpTransaction, useUpgradedAuth: boolean = true): Promise<Transaction>;

Parameters

  • txTransaction | FeeBumpTransaction (required) — the transaction to prepare. It should include exactly one operation, which must be one of xdr.InvokeHostFunctionOp, xdr.ExtendFootprintTtlOp, or xdr.RestoreFootprintOp.

    Any provided footprint will be overwritten. However, if your operation has existing auth entries, they will be preferred over ALL auth entries from the simulation. In other words, if you include auth entries, you don’t care about the auth returned from the simulation. Other fields (footprint, etc.) will be filled as normal.

  • useUpgradedAuthboolean (optional) (default: true) — (optional) whether the underlying simulation records v2 address credentials (CAP-71) instead of the legacy v1 address credentials. Defaults to true; pass false to ask for the legacy v1 format. It only affects the recording auth modes.

    Deprecated: this flag is transitional. Once the RPC server returns v2 credentials by default (protocol 28), it becomes a no-op — do not rely on passing false to keep receiving the legacy v1 format.

Returns

A copy of the transaction with the expected authorizations (in the case of invocation), resources, and ledger footprints added. The transaction fee will also automatically be padded with the contract’s minimum resource fees discovered from the simulation.

Throws

    • If simulation fails

Example

const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
const contract = new StellarSdk.Contract(contractId);
// Right now, this is just the default fee for this example.
const fee = StellarSdk.BASE_FEE;
const transaction = new StellarSdk.TransactionBuilder(account, { fee })
// Uncomment the following line to build transactions for the live network. Be
// sure to also change the horizon hostname.
//.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)
.setNetworkPassphrase(StellarSdk.Networks.FUTURENET)
.setTimeout(30) // valid for the next 30s
// Add an operation to call increment() on the contract
.addOperation(contract.call("increment"))
.build();
const preparedTransaction = await server.prepareTransaction(transaction);
// Sign this transaction with the secret key
// NOTE: signing is transaction is network specific. Test network transactions
// won't work in the public network. To switch networks, use the Network object
// as explained above (look for StellarSdk.Network).
const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);
preparedTransaction.sign(sourceKeypair);
server.sendTransaction(transaction).then(result => {
console.log("hash:", result.hash);
console.log("status:", result.status);
console.log("errorResultXdr:", result.errorResultXdr);
});

See also

    • module:rpc.assembleTransaction
  • simulateTransaction docs

Source: src/rpc/server.ts:1524

server.queryContract(contractId, method, args, networkPassphrase)

Performs a read-only call to a contract method and returns the decoded result.

This is a convenience wrapper for one-line contract state queries: it builds a contract.Client for the contract, simulates the method call, and returns the spec-decoded return value — no manual transaction assembly, signing, or submission required.

Works for both Wasm contracts and built-in Stellar Asset Contracts (SACs): the embedded SAC spec is used automatically for SACs (see contract.Client.from). The query reuses this server’s transport (headers, interceptors, allowHttp).

queryContract<T = any>(contractId: string, method: string, args: Record<string, unknown> = {}, networkPassphrase?: string): Promise<{ isReadCall: boolean; result: T }>;

Parameters

  • contractIdstring (required) — the contract to query (C...)
  • methodstring (required) — the contract method to call
  • argsRecord<string, unknown> (optional) (default: {}) — named arguments for the method, keyed by parameter name (omit for methods that take no arguments)
  • networkPassphrasestring (optional) — (optional) the network passphrase. If omitted, a request about network information will be made (see getNetwork). You can refer to Networks for a list of built-in passphrases, e.g., Networks.TESTNET.

Returns

An object with the method’s decoded return value (result) and isReadCall: whether this specific call is a side-effect-free read that needs no signature (it wrote no state and required no authorization). isReadCall is per-call, not per-method: it reflects the given args. Since queryContract never signs or sends, isReadCall: false means the result is a simulation preview of a call that would change state.

Throws

  • If the contract has no such method, or if the simulation fails.

Example

const { result: decimals, isReadCall } = await server.queryContract<number>(
"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5",
"decimals",
);
const { result: balance } = await server.queryContract<bigint>(
"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5",
"balance",
{ id: "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ" },
);

Source: src/rpc/server.ts:868

server.requestAirdrop(address, friendbotUrl)

Deprecated. Use Server.fundAddress instead, which supports both account (G…) and contract (C…) addresses.

Fund a new account using the network’s Friendbot faucet, if any.

requestAirdrop(address: string | Pick<Account, "accountId">, friendbotUrl?: string): Promise<Account>;

Parameters

  • addressstring | Pick<Account, "accountId"> (required) — The address or account instance that we want to create and fund with Friendbot
  • friendbotUrlstring (optional) — (optional) Optionally, an explicit address for friendbot (by default: this calls the Soroban RPC getNetwork method to try to discover this network’s Friendbot url).

Returns

An Account object for the created account, or the existing account if it’s already funded with the populated sequence number (note that the account will not be “topped off” if it already exists)

Throws

  • If Friendbot is not configured on this network or request failure

Example

server
.requestAirdrop("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4")
.then((accountCreated) => {
console.log("accountCreated:", accountCreated);
}).catch((error) => {
console.error("error:", error);
});

See also

Source: src/rpc/server.ts:1638

server.sendTransaction(transaction)

Submit a real transaction to the Stellar network.

Unlike Horizon, RPC does not wait for transaction completion. It simply validates the transaction and enqueues it. Clients should call rpc.Server.getTransaction to learn about transaction success/failure.

sendTransaction(transaction: Transaction | FeeBumpTransaction): Promise<SendTransactionResponse>;

Parameters

  • transactionTransaction | FeeBumpTransaction (required) — to submit

Returns

the transaction id, status, and any error if available

Example

const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
const contract = new StellarSdk.Contract(contractId);
// Right now, this is just the default fee for this example.
const fee = StellarSdk.BASE_FEE;
const transaction = new StellarSdk.TransactionBuilder(account, { fee })
// Uncomment the following line to build transactions for the live network. Be
// sure to also change the horizon hostname.
//.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)
.setNetworkPassphrase(StellarSdk.Networks.FUTURENET)
.setTimeout(30) // valid for the next 30s
// Add an operation to call increment() on the contract
.addOperation(contract.call("increment"))
.build();
// Sign this transaction with the secret key
// NOTE: signing is transaction is network specific. Test network transactions
// won't work in the public network. To switch networks, use the Network object
// as explained above (look for StellarSdk.Network).
const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);
transaction.sign(sourceKeypair);
server.sendTransaction(transaction).then((result) => {
console.log("hash:", result.hash);
console.log("status:", result.status);
console.log("errorResultXdr:", result.errorResultXdr);
});

See also

    • transaction docs
  • sendTransaction docs

Source: src/rpc/server.ts:1587

server.simulateTransaction(tx, addlResources, authMode, useUpgradedAuth)

Submit a trial contract invocation to get back return values, expected ledger footprint, expected authorizations, and expected costs.

simulateTransaction(tx: Transaction | FeeBumpTransaction, addlResources?: ResourceLeeway, authMode?: SimulationAuthMode, useUpgradedAuth: boolean = true): Promise<SimulateTransactionResponse>;

Parameters

  • txTransaction | FeeBumpTransaction (required) — the transaction to simulate, which should include exactly one operation (one of xdr.InvokeHostFunctionOp, xdr.ExtendFootprintTtlOp, or xdr.RestoreFootprintOp). Any provided footprint or auth information will be ignored.

  • addlResourcesResourceLeeway (optional) — (optional) any additional resources to add to the simulation-provided ones, for example if you know you will need extra CPU instructions

  • authModeSimulationAuthMode (optional) — (optional) optionally, specify the type of auth mode to use for simulation: enforce for enforcement mode, record for recording mode, or record_allow_nonroot for recording mode that allows non-root authorization

  • useUpgradedAuthboolean (optional) (default: true) — (optional) whether simulation records v2 address credentials (CAP-71) instead of the legacy v1 address credentials. Defaults to true; pass false to ask for the legacy v1 format. It only affects the recording auth modes.

    Deprecated: this flag is transitional. Once the network returns v2 credentials by default (protocol 28), it becomes a no-op — do not rely on passing false to keep receiving the legacy v1 format.

Returns

An object with the cost, footprint, result/auth requirements (if applicable), and error of the transaction

Example

const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';
const contract = new StellarSdk.Contract(contractId);
// Right now, this is just the default fee for this example.
const fee = StellarSdk.BASE_FEE;
const transaction = new StellarSdk.TransactionBuilder(account, { fee })
// Uncomment the following line to build transactions for the live network. Be
// sure to also change the horizon hostname.
//.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)
.setNetworkPassphrase(StellarSdk.Networks.FUTURENET)
.setTimeout(30) // valid for the next 30s
// Add an operation to call increment() on the contract
.addOperation(contract.call("increment"))
.build();
server.simulateTransaction(transaction).then((sim) => {
console.log("cost:", sim.cost);
console.log("result:", sim.result);
console.log("error:", sim.error);
console.log("latestLedger:", sim.latestLedger);
});

See also

    • transaction docs
  • simulateTransaction docs
  • authorization modes
  • module:rpc.Server#prepareTransaction
  • module:rpc.assembleTransaction

Source: src/rpc/server.ts:1408

rpc.assembleTransaction

Combines the given raw transaction alongside the simulation results. If the given transaction already has authorization entries in a host function invocation (see Operation.invokeHostFunction), the simulation entries are ignored.

If the given transaction already has authorization entries in a host function invocation (see Operation.invokeHostFunction), the simulation entries are ignored.

assembleTransaction(raw: Transaction | FeeBumpTransaction, simulation: SimulateTransactionResponse | RawSimulateTransactionResponse): TransactionBuilder

Parameters

  • rawTransaction | FeeBumpTransaction (required) — the initial transaction, w/o simulation applied
  • simulationSimulateTransactionResponse | RawSimulateTransactionResponse (required) — the Soroban RPC simulation result (see rpc.Server.simulateTransaction)

Returns

a new, cloned transaction with the proper auth and resource (fee, footprint) simulation data applied

See also

Source: src/rpc/transaction.ts:45

rpc.parseRawEvents

Parse and return the retrieved events, if any, from a raw response from a RPC server.

parseRawEvents(raw: RawGetEventsResponse): GetEventsResponse

Parameters

  • rawRawGetEventsResponse (required) — the raw getEvents response from the RPC server to parse

Returns

events parsed from the RPC server’s response

Source: src/rpc/parsers.ts:112

rpc.parseRawSimulation

Converts a raw response schema into one with parsed XDR fields and a simplified interface.

Warning: This API is only exported for testing purposes and should not be relied on or considered “stable”.

parseRawSimulation(sim: SimulateTransactionResponse | RawSimulateTransactionResponse): SimulateTransactionResponse

Parameters

  • simSimulateTransactionResponse | RawSimulateTransactionResponse (required) — the raw response schema (parsed ones are allowed, best-effort detected, and returned untouched)

Returns

the original parameter (if already parsed), parsed otherwise

Source: src/rpc/parsers.ts:248

Types

rpc.Api.BalanceResponse

interface BalanceResponse {
balanceEntry?: { amount: string; authorized: boolean; authorizedToMaintainLiabilities?: boolean; clawback: boolean; lastModifiedLedgerSeq?: number; liveUntilLedgerSeq?: number; revocable?: boolean };
latestLedger: number;
}

Source: src/rpc/api.ts:597

balanceResponse.balanceEntry

present only on success, otherwise request malformed or no balance

balanceEntry?: { amount: string; authorized: boolean; authorizedToMaintainLiabilities?: boolean; clawback: boolean; lastModifiedLedgerSeq?: number; liveUntilLedgerSeq?: number; revocable?: boolean };

Source: src/rpc/api.ts:600

balanceResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:598

rpc.Api.BaseSendTransactionResponse

interface BaseSendTransactionResponse {
hash: string;
latestLedger: number;
latestLedgerCloseTime: number;
status: SendTransactionStatus;
}

Source: src/rpc/api.ts:389

baseSendTransactionResponse.hash

hash: string;

Source: src/rpc/api.ts:391

baseSendTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:392

baseSendTransactionResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:393

baseSendTransactionResponse.status

status: SendTransactionStatus;

Source: src/rpc/api.ts:390

rpc.Api.BaseSimulateTransactionResponse

interface BaseSimulateTransactionResponse {
_parsed: boolean;
events: DiagnosticEvent[];
id: string;
latestLedger: number;
}

Source: src/rpc/api.ts:421

baseSimulateTransactionResponse._parsed

a private field to mark the schema as parsed

_parsed: boolean;

Source: src/rpc/api.ts:436

baseSimulateTransactionResponse.events

The field is always present, but may be empty in cases where:

  • you didn’t simulate an invocation or
  • there were no events
events: DiagnosticEvent[];

Source: src/rpc/api.ts:433

baseSimulateTransactionResponse.id

always present: the JSON-RPC request ID

id: string;

Source: src/rpc/api.ts:423

baseSimulateTransactionResponse.latestLedger

always present: the LCL known to the server when responding

latestLedger: number;

Source: src/rpc/api.ts:426

rpc.Api.ContractMethod

A callable method declared in a contract’s spec, as returned by RpcServer.getContractMethods.

interface ContractMethod {
doc?: string;
inputs: ContractMethodInput[];
name: string;
outputs: string[];
}

Source: src/rpc/api.ts:728

contractMethod.doc

the method’s spec doc string, when the contract declares one

doc?: string;

Source: src/rpc/api.ts:736

contractMethod.inputs

the method’s parameters, in declaration order

inputs: ContractMethodInput[];

Source: src/rpc/api.ts:732

contractMethod.name

the on-chain method name

name: string;

Source: src/rpc/api.ts:730

contractMethod.outputs

human-readable return type name(s); empty when the method returns void

outputs: string[];

Source: src/rpc/api.ts:734

rpc.Api.ContractMethodInput

A single input parameter of a ContractMethod.

interface ContractMethodInput {
name: string;
type: string;
}

Source: src/rpc/api.ts:717

contractMethodInput.name

the declared parameter name

name: string;

Source: src/rpc/api.ts:719

contractMethodInput.type

a human-readable type name, e.g. U32, Address, or a UDT’s name

type: string;

Source: src/rpc/api.ts:721

rpc.Api.EventFilter

interface EventFilter {
contractIds?: string[];
topics?: string[][];
type?: EventType;
}

Source: src/rpc/api.ts:244

eventFilter.contractIds

contractIds?: string[];

Source: src/rpc/api.ts:246

eventFilter.topics

topics?: string[][];

Source: src/rpc/api.ts:247

eventFilter.type

type?: EventType;

Source: src/rpc/api.ts:245

rpc.Api.EventResponse

interface EventResponse extends BaseEventResponse {
contractId?: Contract;
id: string;
inSuccessfulContractCall: boolean;
ledger: number;
ledgerClosedAt: string;
operationIndex: number;
topic: ScVal[];
transactionIndex: number;
txHash: string;
type: EventType;
value: ScVal;
}

Source: src/rpc/api.ts:320

eventResponse.contractId

contractId?: Contract;

Source: src/rpc/api.ts:321

eventResponse.id

id: string;

Source: src/rpc/api.ts:332

eventResponse.inSuccessfulContractCall

inSuccessfulContractCall: boolean;

Source: src/rpc/api.ts:338

eventResponse.ledger

ledger: number;

Source: src/rpc/api.ts:334

eventResponse.ledgerClosedAt

ledgerClosedAt: string;

Source: src/rpc/api.ts:335

eventResponse.operationIndex

operationIndex: number;

Source: src/rpc/api.ts:337

eventResponse.topic

topic: ScVal[];

Source: src/rpc/api.ts:322

eventResponse.transactionIndex

transactionIndex: number;

Source: src/rpc/api.ts:336

eventResponse.txHash

txHash: string;

Source: src/rpc/api.ts:339

eventResponse.type

type: EventType;

Source: src/rpc/api.ts:333

eventResponse.value

value: ScVal;

Source: src/rpc/api.ts:323

rpc.Api.EventType

type EventType = "contract" | "system"

Source: src/rpc/api.ts:242

rpc.Api.GetEventsRequest

Request parameters for fetching events from the Stellar network.

Important: This type enforces mutually exclusive pagination modes:

  • Ledger range mode: Use startLedger and endLedger (cursor must be omitted)
  • Cursor pagination mode: Use cursor (startLedger and endLedger must be omitted)
type GetEventsRequest = { cursor?: never; endLedger?: number; filters: Api.EventFilter[]; limit?: number; startLedger: number } | { cursor: string; endLedger?: never; filters: Api.EventFilter[]; limit?: number; startLedger?: never }

Example

// ✅ Correct: Ledger range mode
const rangeRequest: GetEventsRequest = {
filters: [],
startLedger: 1000,
endLedger: 2000,
limit: 100
};

Example

// ✅ Correct: Cursor pagination mode
const cursorRequest: GetEventsRequest = {
filters: [],
cursor: "some-cursor-value",
limit: 100
};

Example

// ❌ Invalid: Cannot mix cursor with ledger range
const invalidRequest = {
filters: [],
startLedger: 1000, // ❌ Cannot use with cursor
endLedger: 2000, // ❌ Cannot use with cursor
cursor: "cursor", // ❌ Cannot use with ledger range
limit: 100
};

See also

  • getEvents API reference

Source: src/rpc/api.ts:299

rpc.Api.GetEventsResponse

interface GetEventsResponse extends RetentionState {
cursor: string;
events: EventResponse[];
latestLedger: number;
latestLedgerCloseTime: string;
oldestLedger: number;
oldestLedgerCloseTime: string;
}

Source: src/rpc/api.ts:315

getEventsResponse.cursor

cursor: string;

Source: src/rpc/api.ts:317

getEventsResponse.events

events: EventResponse[];

Source: src/rpc/api.ts:316

getEventsResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:251

getEventsResponse.latestLedgerCloseTime

latestLedgerCloseTime: string;

Source: src/rpc/api.ts:253

getEventsResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:252

getEventsResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: string;

Source: src/rpc/api.ts:254

rpc.Api.GetFailedTransactionResponse

interface GetFailedTransactionResponse extends GetAnyTransactionResponse {
applicationOrder: number;
createdAt: number;
diagnosticEventsXdr?: DiagnosticEvent[];
envelopeXdr: TransactionEnvelope;
events: TransactionEvents;
feeBump: boolean;
latestLedger: number;
latestLedgerCloseTime: number;
ledger: number;
oldestLedger: number;
oldestLedgerCloseTime: number;
resultMetaXdr: TransactionMeta;
resultXdr: TransactionResult;
status: FAILED;
txHash: string;
}

Source: src/rpc/api.ts:113

getFailedTransactionResponse.applicationOrder

applicationOrder: number;

Source: src/rpc/api.ts:118

getFailedTransactionResponse.createdAt

createdAt: number;

Source: src/rpc/api.ts:117

getFailedTransactionResponse.diagnosticEventsXdr

diagnosticEventsXdr?: DiagnosticEvent[];

Source: src/rpc/api.ts:123

getFailedTransactionResponse.envelopeXdr

envelopeXdr: TransactionEnvelope;

Source: src/rpc/api.ts:120

getFailedTransactionResponse.events

events: TransactionEvents;

Source: src/rpc/api.ts:124

getFailedTransactionResponse.feeBump

feeBump: boolean;

Source: src/rpc/api.ts:119

getFailedTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:103

getFailedTransactionResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:104

getFailedTransactionResponse.ledger

ledger: number;

Source: src/rpc/api.ts:116

getFailedTransactionResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:105

getFailedTransactionResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: number;

Source: src/rpc/api.ts:106

getFailedTransactionResponse.resultMetaXdr

resultMetaXdr: TransactionMeta;

Source: src/rpc/api.ts:122

getFailedTransactionResponse.resultXdr

resultXdr: TransactionResult;

Source: src/rpc/api.ts:121

getFailedTransactionResponse.status

status: FAILED;

Source: src/rpc/api.ts:114

getFailedTransactionResponse.txHash

txHash: string;

Source: src/rpc/api.ts:102

rpc.Api.GetFeeStatsResponse

interface GetFeeStatsResponse {
inclusionFee: FeeDistribution;
latestLedger: number;
sorobanInclusionFee: FeeDistribution;
}

Source: src/rpc/api.ts:571

getFeeStatsResponse.inclusionFee

inclusionFee: FeeDistribution;

Source: src/rpc/api.ts:573

getFeeStatsResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:574

getFeeStatsResponse.sorobanInclusionFee

sorobanInclusionFee: FeeDistribution;

Source: src/rpc/api.ts:572

rpc.Api.GetHealthResponse

interface GetHealthResponse {
latestLedger: number;
ledgerRetentionWindow: number;
oldestLedger: number;
status: "healthy";
}

Source: src/rpc/api.ts:21

getHealthResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:22

getHealthResponse.ledgerRetentionWindow

ledgerRetentionWindow: number;

Source: src/rpc/api.ts:23

getHealthResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:24

getHealthResponse.status

status: "healthy";

Source: src/rpc/api.ts:25

rpc.Api.GetLatestLedgerResponse

interface GetLatestLedgerResponse {
closeTime: string;
headerXdr: LedgerHeader;
id: string;
metadataXdr: LedgerCloseMeta;
protocolVersion: string;
sequence: number;
}

See also

Source: src/rpc/api.ts:68

getLatestLedgerResponse.closeTime

closeTime: string;

Source: src/rpc/api.ts:72

getLatestLedgerResponse.headerXdr

headerXdr: LedgerHeader;

Source: src/rpc/api.ts:73

getLatestLedgerResponse.id

id: string;

Source: src/rpc/api.ts:69

getLatestLedgerResponse.metadataXdr

metadataXdr: LedgerCloseMeta;

Source: src/rpc/api.ts:74

getLatestLedgerResponse.protocolVersion

protocolVersion: string;

Source: src/rpc/api.ts:71

getLatestLedgerResponse.sequence

sequence: number;

Source: src/rpc/api.ts:70

rpc.Api.GetLedgerEntriesResponse

An XDR-parsed version of RawLedgerEntryResult

interface GetLedgerEntriesResponse {
entries: LedgerEntryResult[];
latestLedger: number;
}

Source: src/rpc/api.ts:49

getLedgerEntriesResponse.entries

entries: LedgerEntryResult[];

Source: src/rpc/api.ts:50

getLedgerEntriesResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:51

rpc.Api.GetLedgersRequest

Request parameters for fetching a sequential list of ledgers.

This type supports two distinct pagination modes that are mutually exclusive:

  • Ledger-based pagination: Use startLedger to begin fetching from a specific ledger sequence
  • Cursor-based pagination: Use cursor to continue from a previous response’s pagination token
type GetLedgersRequest = { pagination?: { cursor?: never; limit?: number }; startLedger: number } | { pagination: { cursor: string; limit?: number }; startLedger?: never }

Example

// Ledger-based pagination - start from specific ledger
const ledgerRequest: GetLedgersRequest = {
startLedger: 36233,
pagination: {
limit: 10
}
};

Example

// Cursor-based pagination - continue from previous response
const cursorRequest: GetLedgersRequest = {
pagination: {
cursor: "36234",
limit: 5
}
};

See also

  • getLedgers API reference

Source: src/rpc/api.ts:644

rpc.Api.GetLedgersResponse

interface GetLedgersResponse {
cursor: string;
latestLedger: number;
latestLedgerCloseTime: number;
ledgers: LedgerResponse[];
oldestLedger: number;
oldestLedgerCloseTime: number;
}

See also

Source: src/rpc/api.ts:680

getLedgersResponse.cursor

cursor: string;

Source: src/rpc/api.ts:686

getLedgersResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:682

getLedgersResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:683

getLedgersResponse.ledgers

ledgers: LedgerResponse[];

Source: src/rpc/api.ts:681

getLedgersResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:684

getLedgersResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: number;

Source: src/rpc/api.ts:685

rpc.Api.GetMissingTransactionResponse

interface GetMissingTransactionResponse extends GetAnyTransactionResponse {
latestLedger: number;
latestLedgerCloseTime: number;
oldestLedger: number;
oldestLedgerCloseTime: number;
status: NOT_FOUND;
txHash: string;
}

Source: src/rpc/api.ts:109

getMissingTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:103

getMissingTransactionResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:104

getMissingTransactionResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:105

getMissingTransactionResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: number;

Source: src/rpc/api.ts:106

getMissingTransactionResponse.status

status: NOT_FOUND;

Source: src/rpc/api.ts:110

getMissingTransactionResponse.txHash

txHash: string;

Source: src/rpc/api.ts:102

rpc.Api.GetNetworkResponse

interface GetNetworkResponse {
friendbotUrl?: string;
passphrase: string;
protocolVersion: string;
}

See also

Source: src/rpc/api.ts:61

getNetworkResponse.friendbotUrl

friendbotUrl?: string;

Source: src/rpc/api.ts:62

getNetworkResponse.passphrase

passphrase: string;

Source: src/rpc/api.ts:63

getNetworkResponse.protocolVersion

protocolVersion: string;

Source: src/rpc/api.ts:64

rpc.Api.GetSuccessfulTransactionResponse

interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse {
applicationOrder: number;
createdAt: number;
diagnosticEventsXdr?: DiagnosticEvent[];
envelopeXdr: TransactionEnvelope;
events: TransactionEvents;
feeBump: boolean;
latestLedger: number;
latestLedgerCloseTime: number;
ledger: number;
oldestLedger: number;
oldestLedgerCloseTime: number;
resultMetaXdr: TransactionMeta;
resultXdr: TransactionResult;
returnValue?: ScVal;
status: SUCCESS;
txHash: string;
}

Source: src/rpc/api.ts:127

getSuccessfulTransactionResponse.applicationOrder

applicationOrder: number;

Source: src/rpc/api.ts:132

getSuccessfulTransactionResponse.createdAt

createdAt: number;

Source: src/rpc/api.ts:131

getSuccessfulTransactionResponse.diagnosticEventsXdr

diagnosticEventsXdr?: DiagnosticEvent[];

Source: src/rpc/api.ts:137

getSuccessfulTransactionResponse.envelopeXdr

envelopeXdr: TransactionEnvelope;

Source: src/rpc/api.ts:134

getSuccessfulTransactionResponse.events

events: TransactionEvents;

Source: src/rpc/api.ts:140

getSuccessfulTransactionResponse.feeBump

feeBump: boolean;

Source: src/rpc/api.ts:133

getSuccessfulTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:103

getSuccessfulTransactionResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:104

getSuccessfulTransactionResponse.ledger

ledger: number;

Source: src/rpc/api.ts:130

getSuccessfulTransactionResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:105

getSuccessfulTransactionResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: number;

Source: src/rpc/api.ts:106

getSuccessfulTransactionResponse.resultMetaXdr

resultMetaXdr: TransactionMeta;

Source: src/rpc/api.ts:136

getSuccessfulTransactionResponse.resultXdr

resultXdr: TransactionResult;

Source: src/rpc/api.ts:135

getSuccessfulTransactionResponse.returnValue

returnValue?: ScVal;

Source: src/rpc/api.ts:139

getSuccessfulTransactionResponse.status

status: SUCCESS;

Source: src/rpc/api.ts:128

getSuccessfulTransactionResponse.txHash

txHash: string;

Source: src/rpc/api.ts:102

rpc.Api.GetTransactionResponse

type GetTransactionResponse = GetSuccessfulTransactionResponse | GetFailedTransactionResponse | GetMissingTransactionResponse

See also

Source: src/rpc/api.ts:95

rpc.Api.GetTransactionStatus

enum GetTransactionStatus

Source: src/rpc/api.ts:88

rpc.Api.GetTransactionsRequest

type GetTransactionsRequest = { pagination?: { cursor?: never; limit?: number }; startLedger: number } | { pagination: { cursor: string; limit?: number }; startLedger?: never }

Source: src/rpc/api.ts:165

rpc.Api.GetTransactionsResponse

interface GetTransactionsResponse {
cursor: string;
latestLedger: number;
latestLedgerCloseTimestamp: number;
oldestLedger: number;
oldestLedgerCloseTimestamp: number;
transactions: TransactionInfo[];
}

Source: src/rpc/api.ts:224

getTransactionsResponse.cursor

cursor: string;

Source: src/rpc/api.ts:230

getTransactionsResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:226

getTransactionsResponse.latestLedgerCloseTimestamp

latestLedgerCloseTimestamp: number;

Source: src/rpc/api.ts:227

getTransactionsResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:228

getTransactionsResponse.oldestLedgerCloseTimestamp

oldestLedgerCloseTimestamp: number;

Source: src/rpc/api.ts:229

getTransactionsResponse.transactions

transactions: TransactionInfo[];

Source: src/rpc/api.ts:225

rpc.Api.GetVersionInfoResponse

interface GetVersionInfoResponse {
build_timestamp: string;
buildTimestamp: string;
captive_core_version: string;
captiveCoreVersion: string;
commit_hash: string;
commitHash: string;
protocol_version: number;
protocolVersion: number;
version: string;
}

Source: src/rpc/api.ts:554

getVersionInfoResponse.build_timestamp

build_timestamp: string;

Source: src/rpc/api.ts:564

getVersionInfoResponse.buildTimestamp

buildTimestamp: string;

Source: src/rpc/api.ts:557

getVersionInfoResponse.captive_core_version

captive_core_version: string;

Source: src/rpc/api.ts:566

getVersionInfoResponse.captiveCoreVersion

captiveCoreVersion: string;

Source: src/rpc/api.ts:558

getVersionInfoResponse.commit_hash

commit_hash: string;

Source: src/rpc/api.ts:562

getVersionInfoResponse.commitHash

commitHash: string;

Source: src/rpc/api.ts:556

getVersionInfoResponse.protocol_version

protocol_version: number;

Source: src/rpc/api.ts:568

getVersionInfoResponse.protocolVersion

protocolVersion: number;

Source: src/rpc/api.ts:559

getVersionInfoResponse.version

version: string;

Source: src/rpc/api.ts:555

rpc.Api.LedgerEntryChange

interface LedgerEntryChange {
after: LedgerEntry | null;
before: LedgerEntry | null;
key: LedgerKey;
type: number;
}

Source: src/rpc/api.ts:358

ledgerEntryChange.after

after: LedgerEntry | null;

Source: src/rpc/api.ts:362

ledgerEntryChange.before

before: LedgerEntry | null;

Source: src/rpc/api.ts:361

ledgerEntryChange.key

key: LedgerKey;

Source: src/rpc/api.ts:360

ledgerEntryChange.type

type: number;

Source: src/rpc/api.ts:359

rpc.Api.LedgerEntryResult

interface LedgerEntryResult {
key: LedgerKey;
lastModifiedLedgerSeq?: number;
liveUntilLedgerSeq?: number;
val: LedgerEntryData;
}

Source: src/rpc/api.ts:28

ledgerEntryResult.key

key: LedgerKey;

Source: src/rpc/api.ts:30

ledgerEntryResult.lastModifiedLedgerSeq

lastModifiedLedgerSeq?: number;

Source: src/rpc/api.ts:29

ledgerEntryResult.liveUntilLedgerSeq

liveUntilLedgerSeq?: number;

Source: src/rpc/api.ts:32

ledgerEntryResult.val

val: LedgerEntryData;

Source: src/rpc/api.ts:31

rpc.Api.LedgerResponse

interface LedgerResponse {
hash: string;
headerXdr: LedgerHeaderHistoryEntry;
ledgerCloseTime: string;
metadataXdr: LedgerCloseMeta;
sequence: number;
}

Source: src/rpc/api.ts:698

ledgerResponse.hash

hash: string;

Source: src/rpc/api.ts:699

ledgerResponse.headerXdr

headerXdr: LedgerHeaderHistoryEntry;

Source: src/rpc/api.ts:702

ledgerResponse.ledgerCloseTime

ledgerCloseTime: string;

Source: src/rpc/api.ts:701

ledgerResponse.metadataXdr

metadataXdr: LedgerCloseMeta;

Source: src/rpc/api.ts:703

ledgerResponse.sequence

sequence: number;

Source: src/rpc/api.ts:700

rpc.Api.RawEventResponse

interface RawEventResponse extends BaseEventResponse {
contractId: string;
id: string;
inSuccessfulContractCall: boolean;
ledger: number;
ledgerClosedAt: string;
operationIndex: number;
topic?: string[];
transactionIndex: number;
txHash: string;
type: EventType;
value: string;
}

Source: src/rpc/api.ts:342

rawEventResponse.contractId

contractId: string;

Source: src/rpc/api.ts:343

rawEventResponse.id

id: string;

Source: src/rpc/api.ts:332

rawEventResponse.inSuccessfulContractCall

inSuccessfulContractCall: boolean;

Source: src/rpc/api.ts:338

rawEventResponse.ledger

ledger: number;

Source: src/rpc/api.ts:334

rawEventResponse.ledgerClosedAt

ledgerClosedAt: string;

Source: src/rpc/api.ts:335

rawEventResponse.operationIndex

operationIndex: number;

Source: src/rpc/api.ts:337

rawEventResponse.topic

topic?: string[];

Source: src/rpc/api.ts:344

rawEventResponse.transactionIndex

transactionIndex: number;

Source: src/rpc/api.ts:336

rawEventResponse.txHash

txHash: string;

Source: src/rpc/api.ts:339

rawEventResponse.type

type: EventType;

Source: src/rpc/api.ts:333

rawEventResponse.value

value: string;

Source: src/rpc/api.ts:345

rpc.Api.RawGetEventsResponse

interface RawGetEventsResponse extends RetentionState {
cursor: string;
events: RawEventResponse[];
latestLedger: number;
latestLedgerCloseTime: string;
oldestLedger: number;
oldestLedgerCloseTime: string;
}

Source: src/rpc/api.ts:326

rawGetEventsResponse.cursor

cursor: string;

Source: src/rpc/api.ts:328

rawGetEventsResponse.events

events: RawEventResponse[];

Source: src/rpc/api.ts:327

rawGetEventsResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:251

rawGetEventsResponse.latestLedgerCloseTime

latestLedgerCloseTime: string;

Source: src/rpc/api.ts:253

rawGetEventsResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:252

rawGetEventsResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: string;

Source: src/rpc/api.ts:254

rpc.Api.RawGetLatestLedgerResponse

interface RawGetLatestLedgerResponse {
closeTime: string;
headerXdr: string;
id: string;
metadataXdr: string;
protocolVersion: string;
sequence: number;
}

Source: src/rpc/api.ts:77

rawGetLatestLedgerResponse.closeTime

closeTime: string;

Source: src/rpc/api.ts:81

rawGetLatestLedgerResponse.headerXdr

a base-64 encoded LedgerHeader instance

headerXdr: string;

Source: src/rpc/api.ts:83

rawGetLatestLedgerResponse.id

id: string;

Source: src/rpc/api.ts:78

rawGetLatestLedgerResponse.metadataXdr

a base-64 encoded LedgerCloseMeta instance

metadataXdr: string;

Source: src/rpc/api.ts:85

rawGetLatestLedgerResponse.protocolVersion

protocolVersion: string;

Source: src/rpc/api.ts:80

rawGetLatestLedgerResponse.sequence

sequence: number;

Source: src/rpc/api.ts:79

rpc.Api.RawGetLedgerEntriesResponse

interface RawGetLedgerEntriesResponse {
entries?: RawLedgerEntryResult[];
latestLedger: number;
}

See also

Source: src/rpc/api.ts:55

rawGetLedgerEntriesResponse.entries

entries?: RawLedgerEntryResult[];

Source: src/rpc/api.ts:56

rawGetLedgerEntriesResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:57

rpc.Api.RawGetLedgersResponse

interface RawGetLedgersResponse {
cursor: string;
latestLedger: number;
latestLedgerCloseTime: number;
ledgers: RawLedgerResponse[];
oldestLedger: number;
oldestLedgerCloseTime: number;
}

Source: src/rpc/api.ts:689

rawGetLedgersResponse.cursor

cursor: string;

Source: src/rpc/api.ts:695

rawGetLedgersResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:691

rawGetLedgersResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:692

rawGetLedgersResponse.ledgers

ledgers: RawLedgerResponse[];

Source: src/rpc/api.ts:690

rawGetLedgersResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:693

rawGetLedgersResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: number;

Source: src/rpc/api.ts:694

rpc.Api.RawGetTransactionResponse

interface RawGetTransactionResponse {
applicationOrder?: number;
createdAt?: number;
diagnosticEventsXdr?: string[];
envelopeXdr?: string;
events?: RawTransactionEvents;
feeBump?: boolean;
latestLedger: number;
latestLedgerCloseTime: number;
ledger?: number;
oldestLedger: number;
oldestLedgerCloseTime: number;
resultMetaXdr?: string;
resultXdr?: string;
status: GetTransactionStatus;
txHash: string;
}

Source: src/rpc/api.ts:143

rawGetTransactionResponse.applicationOrder

applicationOrder?: number;

Source: src/rpc/api.ts:152

rawGetTransactionResponse.createdAt

createdAt?: number;

Source: src/rpc/api.ts:155

rawGetTransactionResponse.diagnosticEventsXdr

diagnosticEventsXdr?: string[];

Source: src/rpc/api.ts:160

rawGetTransactionResponse.envelopeXdr

envelopeXdr?: string;

Source: src/rpc/api.ts:157

rawGetTransactionResponse.events

events?: RawTransactionEvents;

Source: src/rpc/api.ts:162

rawGetTransactionResponse.feeBump

feeBump?: boolean;

Source: src/rpc/api.ts:153

rawGetTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:145

rawGetTransactionResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:146

rawGetTransactionResponse.ledger

ledger?: number;

Source: src/rpc/api.ts:154

rawGetTransactionResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:147

rawGetTransactionResponse.oldestLedgerCloseTime

oldestLedgerCloseTime: number;

Source: src/rpc/api.ts:148

rawGetTransactionResponse.resultMetaXdr

resultMetaXdr?: string;

Source: src/rpc/api.ts:159

rawGetTransactionResponse.resultXdr

resultXdr?: string;

Source: src/rpc/api.ts:158

rawGetTransactionResponse.status

status: GetTransactionStatus;

Source: src/rpc/api.ts:144

rawGetTransactionResponse.txHash

txHash: string;

Source: src/rpc/api.ts:149

rpc.Api.RawGetTransactionsResponse

interface RawGetTransactionsResponse {
cursor: string;
latestLedger: number;
latestLedgerCloseTimestamp: number;
oldestLedger: number;
oldestLedgerCloseTimestamp: number;
transactions: RawTransactionInfo[] | null;
}

Source: src/rpc/api.ts:233

rawGetTransactionsResponse.cursor

cursor: string;

Source: src/rpc/api.ts:239

rawGetTransactionsResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:235

rawGetTransactionsResponse.latestLedgerCloseTimestamp

latestLedgerCloseTimestamp: number;

Source: src/rpc/api.ts:236

rawGetTransactionsResponse.oldestLedger

oldestLedger: number;

Source: src/rpc/api.ts:237

rawGetTransactionsResponse.oldestLedgerCloseTimestamp

oldestLedgerCloseTimestamp: number;

Source: src/rpc/api.ts:238

rawGetTransactionsResponse.transactions

transactions: RawTransactionInfo[] | null;

Source: src/rpc/api.ts:234

rpc.Api.RawLedgerEntryResult

interface RawLedgerEntryResult {
key: string;
lastModifiedLedgerSeq?: number;
liveUntilLedgerSeq?: number;
xdr: string;
}

Source: src/rpc/api.ts:35

rawLedgerEntryResult.key

a base-64 encoded LedgerKey instance

key: string;

Source: src/rpc/api.ts:38

rawLedgerEntryResult.lastModifiedLedgerSeq

lastModifiedLedgerSeq?: number;

Source: src/rpc/api.ts:36

rawLedgerEntryResult.liveUntilLedgerSeq

optional, a future ledger number upon which this entry will expire based on https://github.com/stellar/soroban-tools/issues/1010

liveUntilLedgerSeq?: number;

Source: src/rpc/api.ts:45

rawLedgerEntryResult.xdr

a base-64 encoded LedgerEntryData instance

xdr: string;

Source: src/rpc/api.ts:40

rpc.Api.RawLedgerResponse

interface RawLedgerResponse {
hash: string;
headerXdr: string;
ledgerCloseTime: string;
metadataXdr: string;
sequence: number;
}

Source: src/rpc/api.ts:706

rawLedgerResponse.hash

hash: string;

Source: src/rpc/api.ts:707

rawLedgerResponse.headerXdr

a base-64 encoded LedgerHeaderHistoryEntry instance

headerXdr: string;

Source: src/rpc/api.ts:711

rawLedgerResponse.ledgerCloseTime

ledgerCloseTime: string;

Source: src/rpc/api.ts:709

rawLedgerResponse.metadataXdr

a base-64 encoded LedgerCloseMeta instance

metadataXdr: string;

Source: src/rpc/api.ts:713

rawLedgerResponse.sequence

sequence: number;

Source: src/rpc/api.ts:708

rpc.Api.RawSendTransactionResponse

interface RawSendTransactionResponse extends BaseSendTransactionResponse {
diagnosticEventsXdr?: string[];
errorResultXdr?: string;
hash: string;
latestLedger: number;
latestLedgerCloseTime: number;
status: SendTransactionStatus;
}

Source: src/rpc/api.ts:373

rawSendTransactionResponse.diagnosticEventsXdr

This is a base64-encoded instance of an array of DiagnosticEvents, set only when status is "ERROR" and diagnostic events are enabled on the server.

diagnosticEventsXdr?: string[];

Source: src/rpc/api.ts:386

rawSendTransactionResponse.errorResultXdr

This is a base64-encoded instance of TransactionResult, set only when status is "ERROR".

It contains details on why the network rejected the transaction.

errorResultXdr?: string;

Source: src/rpc/api.ts:380

rawSendTransactionResponse.hash

hash: string;

Source: src/rpc/api.ts:391

rawSendTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:392

rawSendTransactionResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:393

rawSendTransactionResponse.status

status: SendTransactionStatus;

Source: src/rpc/api.ts:390

rpc.Api.RawSimulateTransactionResponse

interface RawSimulateTransactionResponse {
error?: string;
events?: string[];
id: string;
latestLedger: number;
minResourceFee?: string;
restorePreamble?: { minResourceFee: string; transactionData: string };
results?: RawSimulateHostFunctionResult[];
stateChanges?: RawLedgerEntryChange[];
transactionData?: string;
}

See also

Source: src/rpc/api.ts:530

rawSimulateTransactionResponse.error

error?: string;

Source: src/rpc/api.ts:533

rawSimulateTransactionResponse.events

These are DiagnosticEvents in base64

events?: string[];

Source: src/rpc/api.ts:537

rawSimulateTransactionResponse.id

id: string;

Source: src/rpc/api.ts:531

rawSimulateTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:532

rawSimulateTransactionResponse.minResourceFee

minResourceFee?: string;

Source: src/rpc/api.ts:538

rawSimulateTransactionResponse.restorePreamble

Present if succeeded but has expired ledger entries

restorePreamble?: { minResourceFee: string; transactionData: string };

Source: src/rpc/api.ts:545

rawSimulateTransactionResponse.results

This will only contain a single element if present, because only a single invokeHostFunctionOperation is supported per transaction.

results?: RawSimulateHostFunctionResult[];

Source: src/rpc/api.ts:543

rawSimulateTransactionResponse.stateChanges

State difference information

stateChanges?: RawLedgerEntryChange[];

Source: src/rpc/api.ts:551

rawSimulateTransactionResponse.transactionData

This is an SorobanTransactionData in base64

transactionData?: string;

Source: src/rpc/api.ts:535

rpc.Api.RawTransactionEvents

interface RawTransactionEvents {
contractEventsXdr?: string[][];
transactionEventsXdr?: string[];
}

Source: src/rpc/api.ts:181

rawTransactionEvents.contractEventsXdr

contractEventsXdr?: string[][];

Source: src/rpc/api.ts:183

rawTransactionEvents.transactionEventsXdr

transactionEventsXdr?: string[];

Source: src/rpc/api.ts:182

rpc.Api.RawTransactionInfo

interface RawTransactionInfo {
applicationOrder: number;
createdAt: number;
diagnosticEventsXdr?: string[];
envelopeXdr?: string;
events?: RawTransactionEvents;
feeBump: boolean;
ledger: number;
resultMetaXdr?: string;
resultXdr?: string;
status: GetTransactionStatus;
txHash: string;
}

Source: src/rpc/api.ts:186

rawTransactionInfo.applicationOrder

applicationOrder: number;

Source: src/rpc/api.ts:190

rawTransactionInfo.createdAt

createdAt: number;

Source: src/rpc/api.ts:189

rawTransactionInfo.diagnosticEventsXdr

diagnosticEventsXdr?: string[];

Source: src/rpc/api.ts:197

rawTransactionInfo.envelopeXdr

envelopeXdr?: string;

Source: src/rpc/api.ts:194

rawTransactionInfo.events

events?: RawTransactionEvents;

Source: src/rpc/api.ts:199

rawTransactionInfo.feeBump

feeBump: boolean;

Source: src/rpc/api.ts:191

rawTransactionInfo.ledger

ledger: number;

Source: src/rpc/api.ts:188

rawTransactionInfo.resultMetaXdr

resultMetaXdr?: string;

Source: src/rpc/api.ts:196

rawTransactionInfo.resultXdr

resultXdr?: string;

Source: src/rpc/api.ts:195

rawTransactionInfo.status

status: GetTransactionStatus;

Source: src/rpc/api.ts:187

rawTransactionInfo.txHash

txHash: string;

Source: src/rpc/api.ts:192

rpc.Api.SendTransactionResponse

interface SendTransactionResponse extends BaseSendTransactionResponse {
diagnosticEvents?: DiagnosticEvent[];
errorResult?: TransactionResult;
hash: string;
latestLedger: number;
latestLedgerCloseTime: number;
status: SendTransactionStatus;
}

Source: src/rpc/api.ts:368

sendTransactionResponse.diagnosticEvents

diagnosticEvents?: DiagnosticEvent[];

Source: src/rpc/api.ts:370

sendTransactionResponse.errorResult

errorResult?: TransactionResult;

Source: src/rpc/api.ts:369

sendTransactionResponse.hash

hash: string;

Source: src/rpc/api.ts:391

sendTransactionResponse.latestLedger

latestLedger: number;

Source: src/rpc/api.ts:392

sendTransactionResponse.latestLedgerCloseTime

latestLedgerCloseTime: number;

Source: src/rpc/api.ts:393

sendTransactionResponse.status

status: SendTransactionStatus;

Source: src/rpc/api.ts:390

rpc.Api.SendTransactionStatus

type SendTransactionStatus = "PENDING" | "DUPLICATE" | "TRY_AGAIN_LATER" | "ERROR"

Source: src/rpc/api.ts:365

rpc.Api.SimulateHostFunctionResult

interface SimulateHostFunctionResult {
auth: SorobanAuthorizationEntry[];
retval: ScVal;
}

Source: src/rpc/api.ts:396

simulateHostFunctionResult.auth

auth: SorobanAuthorizationEntry[];

Source: src/rpc/api.ts:397

simulateHostFunctionResult.retval

retval: ScVal;

Source: src/rpc/api.ts:398

rpc.Api.SimulateTransactionErrorResponse

Includes details about why the simulation failed

interface SimulateTransactionErrorResponse extends BaseSimulateTransactionResponse {
_parsed: boolean;
error: string;
events: DiagnosticEvent[];
id: string;
latestLedger: number;
}

Source: src/rpc/api.ts:452

simulateTransactionErrorResponse._parsed

a private field to mark the schema as parsed

_parsed: boolean;

Source: src/rpc/api.ts:436

simulateTransactionErrorResponse.error

error: string;

Source: src/rpc/api.ts:453

simulateTransactionErrorResponse.events

The field is always present, but may be empty in cases where:

  • you didn’t simulate an invocation or
  • there were no events
events: DiagnosticEvent[];

Source: src/rpc/api.ts:454

simulateTransactionErrorResponse.id

always present: the JSON-RPC request ID

id: string;

Source: src/rpc/api.ts:423

simulateTransactionErrorResponse.latestLedger

always present: the LCL known to the server when responding

latestLedger: number;

Source: src/rpc/api.ts:426

rpc.Api.SimulateTransactionResponse

Simplifies RawSimulateTransactionResponse into separate interfaces based on status:

  • on success, this includes all fields, though result is only present if an invocation was simulated (since otherwise there’s nothing to “resultify”)
  • if there was an expiration error, this includes error and restoration fields
  • for all other errors, this only includes error fields
type SimulateTransactionResponse = SimulateTransactionSuccessResponse | SimulateTransactionRestoreResponse | SimulateTransactionErrorResponse

See also

Source: src/rpc/api.ts:416

rpc.Api.SimulateTransactionRestoreResponse

Includes simplified fields only present on success.

interface SimulateTransactionRestoreResponse extends SimulateTransactionSuccessResponse {
_parsed: boolean;
events: DiagnosticEvent[];
id: string;
latestLedger: number;
minResourceFee: string;
restorePreamble: { minResourceFee: string; transactionData: SorobanDataBuilder };
result: SimulateHostFunctionResult;
stateChanges?: LedgerEntryChange[];
transactionData: SorobanDataBuilder;
}

Source: src/rpc/api.ts:457

simulateTransactionRestoreResponse._parsed

a private field to mark the schema as parsed

_parsed: boolean;

Source: src/rpc/api.ts:436

simulateTransactionRestoreResponse.events

The field is always present, but may be empty in cases where:

  • you didn’t simulate an invocation or
  • there were no events
events: DiagnosticEvent[];

Source: src/rpc/api.ts:433

simulateTransactionRestoreResponse.id

always present: the JSON-RPC request ID

id: string;

Source: src/rpc/api.ts:423

simulateTransactionRestoreResponse.latestLedger

always present: the LCL known to the server when responding

latestLedger: number;

Source: src/rpc/api.ts:426

simulateTransactionRestoreResponse.minResourceFee

minResourceFee: string;

Source: src/rpc/api.ts:442

simulateTransactionRestoreResponse.restorePreamble

Indicates that a restoration is necessary prior to submission.

In other words, seeing a restoration preamble means that your invocation was executed AS IF the required ledger entries were present, and this field includes information about what you need to restore for the simulation to succeed.

restorePreamble: { minResourceFee: string; transactionData: SorobanDataBuilder };

Source: src/rpc/api.ts:468

simulateTransactionRestoreResponse.result

present only for invocation simulation

result: SimulateHostFunctionResult;

Source: src/rpc/api.ts:458

simulateTransactionRestoreResponse.stateChanges

State Difference information

stateChanges?: LedgerEntryChange[];

Source: src/rpc/api.ts:448

simulateTransactionRestoreResponse.transactionData

transactionData: SorobanDataBuilder;

Source: src/rpc/api.ts:441

rpc.Api.SimulateTransactionSuccessResponse

Includes simplified fields only present on success.

interface SimulateTransactionSuccessResponse extends BaseSimulateTransactionResponse {
_parsed: boolean;
events: DiagnosticEvent[];
id: string;
latestLedger: number;
minResourceFee: string;
result?: SimulateHostFunctionResult;
stateChanges?: LedgerEntryChange[];
transactionData: SorobanDataBuilder;
}

Source: src/rpc/api.ts:440

simulateTransactionSuccessResponse._parsed

a private field to mark the schema as parsed

_parsed: boolean;

Source: src/rpc/api.ts:436

simulateTransactionSuccessResponse.events

The field is always present, but may be empty in cases where:

  • you didn’t simulate an invocation or
  • there were no events
events: DiagnosticEvent[];

Source: src/rpc/api.ts:433

simulateTransactionSuccessResponse.id

always present: the JSON-RPC request ID

id: string;

Source: src/rpc/api.ts:423

simulateTransactionSuccessResponse.latestLedger

always present: the LCL known to the server when responding

latestLedger: number;

Source: src/rpc/api.ts:426

simulateTransactionSuccessResponse.minResourceFee

minResourceFee: string;

Source: src/rpc/api.ts:442

simulateTransactionSuccessResponse.result

present only for invocation simulation

result?: SimulateHostFunctionResult;

Source: src/rpc/api.ts:445

simulateTransactionSuccessResponse.stateChanges

State Difference information

stateChanges?: LedgerEntryChange[];

Source: src/rpc/api.ts:448

simulateTransactionSuccessResponse.transactionData

transactionData: SorobanDataBuilder;

Source: src/rpc/api.ts:441

rpc.Api.SimulationAuthMode

type SimulationAuthMode = "enforce" | "record" | "record_allow_nonroot"

Source: src/rpc/api.ts:401

rpc.Api.TransactionEvents

interface TransactionEvents {
contractEventsXdr: ContractEvent[][];
transactionEventsXdr: TransactionEvent[];
}

Source: src/rpc/api.ts:202

transactionEvents.contractEventsXdr

contractEventsXdr: ContractEvent[][];

Source: src/rpc/api.ts:204

transactionEvents.transactionEventsXdr

transactionEventsXdr: TransactionEvent[];

Source: src/rpc/api.ts:203

rpc.Api.TransactionInfo

interface TransactionInfo {
applicationOrder: number;
createdAt: number;
diagnosticEventsXdr?: DiagnosticEvent[];
envelopeXdr: TransactionEnvelope;
events: TransactionEvents;
feeBump: boolean;
ledger: number;
resultMetaXdr: TransactionMeta;
resultXdr: TransactionResult;
returnValue?: ScVal;
status: GetTransactionStatus;
txHash: string;
}

Source: src/rpc/api.ts:207

transactionInfo.applicationOrder

applicationOrder: number;

Source: src/rpc/api.ts:211

transactionInfo.createdAt

createdAt: number;

Source: src/rpc/api.ts:210

transactionInfo.diagnosticEventsXdr

diagnosticEventsXdr?: DiagnosticEvent[];

Source: src/rpc/api.ts:219

transactionInfo.envelopeXdr

envelopeXdr: TransactionEnvelope;

Source: src/rpc/api.ts:215

transactionInfo.events

events: TransactionEvents;

Source: src/rpc/api.ts:221

transactionInfo.feeBump

feeBump: boolean;

Source: src/rpc/api.ts:212

transactionInfo.ledger

ledger: number;

Source: src/rpc/api.ts:209

transactionInfo.resultMetaXdr

resultMetaXdr: TransactionMeta;

Source: src/rpc/api.ts:217

transactionInfo.resultXdr

resultXdr: TransactionResult;

Source: src/rpc/api.ts:216

transactionInfo.returnValue

returnValue?: ScVal;

Source: src/rpc/api.ts:218

transactionInfo.status

status: GetTransactionStatus;

Source: src/rpc/api.ts:208

transactionInfo.txHash

txHash: string;

Source: src/rpc/api.ts:213

rpc.Durability

Specifies the durability namespace of contract-related ledger entries.

enum Durability

See also

    • State Archival docs
  • Rust SDK Storage docs

Source: src/rpc/server.ts:75

rpc.Server.GetEventsRequest

Deprecated. Use Api.GetEventsRequest instead.

type GetEventsRequest = Api.GetEventsRequest

See also

Source: src/rpc/server.ts:85

rpc.Server.Options

Options for configuring connections to RPC servers.

interface Options {
allowHttp?: boolean;
headers?: Record<string, string>;
timeout?: number;
}

Source: src/rpc/server.ts:103

options.allowHttp

Allow connecting to http servers, default: false. This must be set to false in production deployments!

allowHttp?: boolean;

Source: src/rpc/server.ts:105

options.headers

Additional headers that should be added to any requests to the RPC server.

headers?: Record<string, string>;

Source: src/rpc/server.ts:109

options.timeout

Allow a timeout, default: 0. Allows user to avoid nasty lag.

timeout?: number;

Source: src/rpc/server.ts:107

rpc.Server.PollingOptions

interface PollingOptions {
attempts?: number;
sleepStrategy?: SleepStrategy;
}

Source: src/rpc/server.ts:87

pollingOptions.attempts

attempts?: number;

Source: src/rpc/server.ts:88

pollingOptions.sleepStrategy

sleepStrategy?: SleepStrategy;

Source: src/rpc/server.ts:89

rpc.Server.ResourceLeeway

Describes additional resource leeways for transaction simulation.

interface ResourceLeeway {
cpuInstructions: number;
}

Source: src/rpc/server.ts:95

resourceLeeway.cpuInstructions

Simulate the transaction with more CPU instructions available.

cpuInstructions: number;

Source: src/rpc/server.ts:97