UNPKG

stellar-plus

Version:

beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain

92 lines (91 loc) 4.04 kB
import { FeeBumpTransaction, rpc as SorobanRpc, Transaction, xdr } from '@stellar/stellar-sdk'; import { RpcHandler } from '../../../stellar-plus/rpc/types'; import { NetworkConfig } from '../../../stellar-plus/types'; export declare class DefaultRpcHandler implements RpcHandler { readonly type = "RpcHandler"; private server; private networkConfig; /** * * @param {NetworkConfig} networkConfig - The network to use. * * @description - The default rpc handler is used for interacting with the Soroban server. * It uses the URL provided by the network to connect to the Soroban server and carry out the RPC functions. * */ constructor(networkConfig: NetworkConfig); /** * * @param {string} txHash - The transaction hash to get. * * @returns {SorobanRpc.GetTransactionResponse} The transaction response from the Soroban server. * * @description - Gets the transaction from the Soroban server. */ getTransaction(txHash: string): Promise<SorobanRpc.Api.GetTransactionResponse>; /** * * @param {Transaction} tx - The transaction to simulate. * * @returns {SorobanRpc.SimulateTransactionResponse} The transaction simulation response from the Soroban server. * * @description - Simulates the transaction on the Soroban server. */ simulateTransaction(tx: Transaction | FeeBumpTransaction): Promise<SorobanRpc.Api.SimulateTransactionResponse>; /** * * @param {Transaction} tx - The transaction to prepare. * * @returns {Transaction} The prepared transaction. * * @description - Prepares the transaction on the Soroban server. */ prepareTransaction(tx: Transaction): Promise<Transaction>; /** * * @param {Transaction | SorobanFeeBumpTransaction} tx - The transaction to submit. * * @returns {SorobanRpc.SendTransactionResponse} The transaction submission response from the Soroban server. * * @description - Submits the transaction on the Soroban server. */ submitTransaction(tx: Transaction | FeeBumpTransaction): Promise<SorobanRpc.Api.SendTransactionResponse>; /** * @returns {Promise<SorobanRpc.GetLatestLedgerResponse>} The latest ledger response from the Soroban server. * @description - Gets the latest ledger from the Soroban RPC server. * */ getLatestLedger(): Promise<SorobanRpc.Api.GetLatestLedgerResponse>; /** * @returns {Promise<SorobanRpc.GetHealthResponse>} The health response from the Soroban server. * @description - Gets the health of the Soroban RPC server. * */ getHealth(): Promise<SorobanRpc.Api.GetHealthResponse>; /** * @returns {Promise<SorobanRpc.GetNetworkResponse>} The network response from the Soroban server. * @description - Gets the network of the Soroban RPC server. * */ getNetwork(): Promise<SorobanRpc.Api.GetNetworkResponse>; /** * * @args {SorobanRpc.GetEventsRequest} request - The events request to get. * @args {Api.EventFilter[]} request.filters - The filters to apply to the events. * @args {number} request.startLedger - The start ledger to get the events from. * @args {string} request.cursor - The cursor to get the events from. * @args {number} request.limit - The limit of events to get. * * * @returns {SorobanRpc.GetEventsResponse} The events response from the Soroban server. * * @description - Gets the events from the Soroban server. */ getEvents(request: SorobanRpc.Server.GetEventsRequest): Promise<SorobanRpc.Api.GetEventsResponse>; /** * * @param {xdr.LedgerKey[]} keys - The keys to get the ledger entries for. * * @returns {SorobanRpc.GetLedgerEntriesResponse} The ledger entries response from the Soroban server. * * @description - Gets the ledger entries from the Soroban server. */ getLedgerEntries(...keys: xdr.LedgerKey[]): Promise<SorobanRpc.Api.GetLedgerEntriesResponse>; }