@ordao/ethers-decode-error
Version:
Decode ethers.js smart contract errors into human-readable messages
36 lines (35 loc) • 1.38 kB
TypeScript
import { Interface } from 'ethers';
import { DecodedError } from '../types';
type ErrorHandlerErrorInfo = {
errorInterface: Interface;
error: Error;
};
export interface ErrorHandler {
predicate: (data: string | undefined, error: Error) => boolean;
handle: (data: string | undefined, errorInfo: ErrorHandlerErrorInfo) => DecodedError;
}
export declare class EmptyErrorHandler implements ErrorHandler {
predicate(data: string): boolean;
handle(data: string): DecodedError;
}
export declare class RevertErrorHandler implements ErrorHandler {
predicate(data: string): boolean;
handle(data: string): DecodedError;
}
export declare class PanicErrorHandler implements ErrorHandler {
predicate(data: string): boolean;
handle(data: string): DecodedError;
}
export declare class CustomErrorHandler implements ErrorHandler {
predicate(data: string): boolean;
handle(data: string, { errorInterface }: ErrorHandlerErrorInfo): DecodedError;
}
export declare class UserRejectionHandler implements ErrorHandler {
predicate(data: string, error: Error): boolean;
handle(_data: string, { error }: ErrorHandlerErrorInfo): DecodedError;
}
export declare class RpcErrorHandler implements ErrorHandler {
predicate(data: string, error: Error): boolean;
handle(_data: string, { error }: ErrorHandlerErrorInfo): DecodedError;
}
export {};