@velora-dex/sdk
Version:
52 lines • 2.17 kB
TypeScript
import type { Primitive } from 'ts-essentials';
export declare const objectToFilledEntries: <T extends Record<string, unknown>>(object: T) => [string, string][];
export declare const constructSearchString: <U extends Record<string, Exclude<Primitive, symbol>>>(queryOptions: U) => `?${string}` | "";
type MinAxiosError = {
code?: string;
request?: any;
isAxiosError: boolean;
message: string;
};
type MinAxiosResponse = {
data: any;
status: number;
statusText: string;
headers: Record<string, any>;
config: {
url?: string;
method?: string;
};
};
type FetcherErrorConstructorInput = MinAxiosError & {
response?: MinAxiosResponse;
};
export interface FetcherErrorInterface extends FetcherErrorConstructorInput {
status?: number;
code?: string;
}
export declare const isFetcherError: (error: unknown) => error is FetcherError;
export declare class FetcherError extends Error implements FetcherErrorInterface {
code: string | undefined;
status: number | undefined;
request: any;
response: MinAxiosResponse | undefined;
isAxiosError: boolean;
constructor({ code, request, response, isAxiosError, message, }: FetcherErrorConstructorInput);
}
export declare function isDataWithError(data: unknown): data is {
error: string;
};
export declare function isDataWithError2(data: unknown): data is {
errorType: string;
description?: string;
};
export type ExtractAbiMethodNames<T extends readonly {
name: string;
}[]> = T[number]['name'];
export declare function gatherObjectsByProp<T>(elements: T[], pickProp: (elem: T, index: number) => string): Record<string, T>;
export declare function gatherObjectsByProp<T, U>(elements: T[], pickProp: (elem: T, index: number) => string, transfrom: (elem: T, accumElem: U | undefined, index: number) => U): Record<string, U>;
export declare const isFilledArray: <T>(array: T[]) => array is [T, ...T[]];
export declare function getRandomInt(): number;
export declare function runOnceAndCache<T, Args extends any[]>(func: (...args: Args) => NonNullable<T>): (...args: Args) => NonNullable<T>;
export {};
//# sourceMappingURL=misc.d.ts.map