casper-js-sdk
Version:
SDK to interact with the Casper blockchain
37 lines (36 loc) • 1.65 kB
TypeScript
import { BlockIdentifier } from './request';
import { SpeculativeExecResult } from './response';
import { IHandler } from './client';
import { Deploy } from '../types';
/**
* A client for interacting with the speculative execution endpoint in the Casper Network.
* This class is responsible for executing speculative transactions on the Casper Network and processing their responses.
*/
export declare class SpeculativeClient {
private handler;
/**
* Creates an instance of the `SpeculativeClient`.
*
* @param handler The handler used to process RPC requests.
*/
constructor(handler: IHandler);
/**
* Static method to create a new `SpeculativeClient` instance.
*
* @param handler The handler used to process RPC requests.
* @returns A new instance of the `SpeculativeClient`.
*/
static newSpeculativeClient(handler: IHandler): SpeculativeClient;
/**
* Executes a speculative transaction on the Casper Network.
*
* @param reqID The request identifier for the RPC call.
* @param deploy The deploy object that represents the transaction to be executed.
* @param identifier (Optional) The block identifier where the speculative transaction should be executed.
*
* @returns A promise that resolves to a `SpeculativeExecResult`, which contains the results of the speculative execution.
*
* @throws {Error} If the handler response is empty or if an error occurs while processing the RPC call or parsing the response.
*/
speculativeExec(reqID: string, deploy: Deploy, identifier?: BlockIdentifier): Promise<SpeculativeExecResult>;
}