@unielon/wallet-tg-sdk
Version:
unielon wallet sdk for telegram
43 lines (42 loc) • 1.48 kB
TypeScript
import { MessageResponse, ResponseResult } from '../types/connect.ts';
import { BridgeRequestOptions } from '../types/unielon.ts';
/**
* Interface for the request body to send a message.
*/
export interface SendMessageRequest {
data?: any;
token: string;
}
/**
* Sends a message to the server.
* @param body - The request body containing the data and token.
* @returns The response data from the server.
*/
export declare const sendMessage: <T>(body: SendMessageRequest) => Promise<MessageResponse<T>>;
/**
* Fetches a message using the provided token.
* @param token - The token to authenticate the request.
* @returns The message data.
*/
export declare const getMessage: <T>(token: string) => Promise<MessageResponse<T>>;
/**
* Creates an EventSource to listen for messages from the server.
* @param token - The token to authenticate the request.
* @returns An EventSource instance.
*/
export declare const listenerMessage: (token: string) => EventSource;
/**
* Interface for decrypt parameters.
*/
export interface DecryptParamsType {
method: string | null;
options?: BridgeRequestOptions | null;
token: string;
data?: any | null;
}
/**
* Retrieves client parameters using the provided token.
* @param token - The token to authenticate the request.
* @returns The client parameters or null if an error occurs.
*/
export declare const getClientParams: (token: string) => Promise<ResponseResult<ResponseResult<any>> | null | undefined>;