UNPKG

@crypdex/hydro-sdk

Version:

Javascript SDK for the Hydro API

32 lines (31 loc) 1.11 kB
import { SignatureHandler } from '../types'; export declare function getAuthHeaders(account: string, sign: SignatureHandler): Promise<{}>; /** * Handle building requests to the server, including authentication * in the request header. */ export declare class RequestHandler { readonly sign: SignatureHandler; readonly account: string | undefined; static BASE_MESSAGE: string; static BASE_URL: string; static HEADER: string; baseUrl: string; constructor(sign: SignatureHandler, account?: string | undefined, baseUrl?: string); /** * Methods to perform standard get/post/delete requests to the api server. * Only implemented these three since they are the only ones the api * currently requires. */ get(path: string, params?: {}, sign?: boolean): Promise<any>; post(path: string, data?: {}): Promise<any>; delete(path: string): Promise<any>; /** * The baseUrl MUST have a trailing slash for this to work. * TODO: fix * @param path */ private getURL(path); private getAuthHeaders(); private handleResponse(res); }