import { GatewayErrorDetailsOneOf, GatewayErrorDetailsOneOf1, GatewayErrorDetailsOneOf2, GatewayErrorDetailsOneOf3, GatewayErrorDetailsOneOf4, GatewayErrorDetailsOneOf5, GatewayErrorDetailsOneOf6 } from '../generated-client'; import type { GatewayError as GatewayErrorInterface } from '../generated-client/models/GatewayError'; import { GatewayErrorCode } from '../generated-client/models/GatewayErrorCode'; export { GatewayErrorCode }; export type InsufficientAmountDetails = GatewayErrorDetailsOneOf; export type InsufficientSwapAmountDetails = GatewayErrorDetailsOneOf1; export type InsufficientFundsDetails = GatewayErrorDetailsOneOf2; export type UnableToCoverFeesDetails = GatewayErrorDetailsOneOf3; export type SimulationFailedDetails = GatewayErrorDetailsOneOf4; export type NoRouteDetails = GatewayErrorDetailsOneOf5; export type ExceededLimitDetails = GatewayErrorDetailsOneOf6; export type GatewayErrorDetailsMap = { [GatewayErrorCode.InsufficientAmount]: InsufficientAmountDetails; [GatewayErrorCode.InsufficientPaymentAmount]: InsufficientAmountDetails; [GatewayErrorCode.InsufficientSwapAmount]: InsufficientSwapAmountDetails; [GatewayErrorCode.InsufficientFunds]: InsufficientFundsDetails; [GatewayErrorCode.UnableToCoverFees]: UnableToCoverFeesDetails; [GatewayErrorCode.SimulationFailed]: SimulationFailedDetails; [GatewayErrorCode.GasEstimateFailed]: SimulationFailedDetails; [GatewayErrorCode.NoRoute]: NoRouteDetails; [GatewayErrorCode.ExceededLimit]: ExceededLimitDetails; }; export type DetailsFor = C extends keyof GatewayErrorDetailsMap ? GatewayErrorDetailsMap[C] : null; export declare class GatewayError extends Error implements GatewayErrorInterface { readonly code: C; readonly error: string; readonly details: DetailsFor; constructor(code: C, message: string, details: DetailsFor); static fromResponse(json: GatewayErrorInterface | object): AnyGatewayError; static fromText(message: string): GatewayError<(typeof GatewayErrorCode)['InternalError']>; } export type AnyGatewayError = { [C in GatewayErrorCode]: GatewayError; }[GatewayErrorCode]; export declare function isGatewayError(err: unknown): err is AnyGatewayError;