UNPKG

yamaswap-sdk

Version:
49 lines (40 loc) 1.44 kB
export class DexSDKError extends Error { constructor(message: string) { super(message); this.name = 'DexSDKError'; Object.setPrototypeOf(this, DexSDKError.prototype); } } export class ETFNotExistsError extends DexSDKError { constructor(message: string) { super(message); this.name = 'ETFNotExistsError'; Object.setPrototypeOf(this, ETFNotExistsError.prototype); } } export class ETFExistsError extends DexSDKError { constructor(message: string) { super(message); this.name = 'ETFExistsError'; Object.setPrototypeOf(this, ETFExistsError.prototype); } } export class ETFInsufficientBalanceError extends DexSDKError { constructor(message: string) { super(message); this.name = 'ETFInsufficientBalanceError'; Object.setPrototypeOf(this, ETFInsufficientBalanceError.prototype); } } export class ETFInvalidParamsError extends DexSDKError { constructor(message: string) { super(message); this.name = 'ETFInvalidParamsError'; Object.setPrototypeOf(this, ETFInvalidParamsError.prototype); } } export const isETFError = (error: unknown): error is ETFNotExistsError | ETFInsufficientBalanceError | ETFInvalidParamsError => { return error instanceof ETFNotExistsError || error instanceof ETFInsufficientBalanceError || error instanceof ETFInvalidParamsError; };