///
import { EventEmitter } from 'events';
import { PrefixedHexString, Transaction } from 'ethereumjs-tx';
import GsnTransactionDetails from '../common/types/GsnTransactionDetails';
import { AsyncDataCallback, PingFilter, Web3ProviderBaseInterface } from '../common/types/Aliases';
import { AuditResponse } from '../common/types/AuditRequest';
import { LoggerInterface } from '../common/LoggerInterface';
import { RelayInfo } from '../common/types/RelayInfo';
import { RelayTransactionRequest } from '../common/types/RelayTransactionRequest';
import { AccountKeypair } from './AccountManager';
import { GSNConfig, GSNDependencies } from './GSNConfigurator';
import { GsnEvent } from './GsnEvents';
export declare const EmptyDataCallback: AsyncDataCallback;
export declare const GasPricePingFilter: PingFilter;
export interface GSNUnresolvedConstructorInput {
provider: Web3ProviderBaseInterface;
config: Partial;
overrideDependencies?: Partial;
}
interface RelayingAttempt {
transaction?: Transaction;
error?: Error;
auditPromise?: Promise;
}
export interface RelayingResult {
transaction?: Transaction;
pingErrors: Map;
relayingErrors: Map;
auditPromises?: Array>;
}
export declare class RelayClient {
readonly emitter: EventEmitter;
config: GSNConfig;
dependencies: GSNDependencies;
private readonly rawConstructorInput;
private initialized;
logger: LoggerInterface;
initializingPromise?: Promise;
constructor(rawConstructorInput: GSNUnresolvedConstructorInput);
init(): Promise;
_initInternal(): Promise;
/**
* register a listener for GSN events
* @see GsnEvent and its subclasses for emitted events
* @param handler callback function to handle events
*/
registerEventListener(handler: (event: GsnEvent) => void): void;
/**
* unregister previously registered event listener
* @param handler callback function to unregister
*/
unregisterEventListener(handler: (event: GsnEvent) => void): void;
private emit;
/**
* In case Relay Server does not broadcast the signed transaction to the network,
* client also broadcasts the same transaction. If the transaction fails with nonce
* error, it indicates Relay may have signed multiple transactions with same nonce,
* causing a DoS attack.
*
* @param {*} transaction - actual Ethereum transaction, signed by a relay
*/
_broadcastRawTx(transaction: Transaction): Promise<{
hasReceipt: boolean;
broadcastError?: Error;
wrongNonce?: boolean;
}>;
_isAlreadySubmitted(txHash: string): Promise;
relayTransaction(gsnTransactionDetails: GsnTransactionDetails): Promise;
_warn(msg: string): void;
_calculateGasPrice(): Promise;
_attemptRelay(relayInfo: RelayInfo, gsnTransactionDetails: GsnTransactionDetails): Promise;
_prepareRelayHttpRequest(relayInfo: RelayInfo, gsnTransactionDetails: GsnTransactionDetails): Promise;
newAccount(): AccountKeypair;
addAccount(privateKey: PrefixedHexString): void;
_verifyInitialized(): void;
auditTransaction(hexTransaction: PrefixedHexString, sourceRelayUrl: string): Promise;
getUnderlyingProvider(): Web3ProviderBaseInterface;
_resolveConfiguration({ provider, config }: GSNUnresolvedConstructorInput): Promise;
_resolveDependencies({ provider, config, overrideDependencies }: GSNUnresolvedConstructorInput): Promise;
}
export declare function _dumpRelayingResult(relayingResult: RelayingResult): string;
export {};