UNPKG

@gnolang/tm2-js-client

Version:

Tendermint2 JS / TS Client

36 lines (35 loc) 1.45 kB
import { BinaryReader } from '@bufbuild/protobuf/wire'; import { RPCError, RPCRequest, RPCResponse } from '../types'; /** * Creates a new JSON-RPC 2.0 request * @param {string} method the requested method * @param {string[]} [params] the requested params, if any */ export declare const newRequest: (method: string, params?: any[]) => RPCRequest; /** * Creates a new JSON-RPC 2.0 response * @param {Result} result the response result, if any * @param {RPCError} error the response error, if any */ export declare const newResponse: <Result>(result?: Result, error?: RPCError) => RPCResponse<Result>; /** * Parses the base64 encoded ABCI JSON into a concrete type * @param {string} data the base64-encoded JSON */ export declare const parseABCI: <Result>(data: string) => Result; export declare const parseProto: <T>(data: string, decodeFn: (input: BinaryReader | Uint8Array, length?: number) => T) => T; /** * Converts a string into base64 representation * @param {string} str the raw string */ export declare const stringToBase64: (str: string) => string; /** * Converts a base64 string into a Uint8Array representation * @param {string} str the base64-encoded string */ export declare const base64ToUint8Array: (str: string) => Uint8Array; /** * Converts a Uint8Array into base64 representation * @param {Uint8Array} data the Uint8Array to be encoded */ export declare const uint8ArrayToBase64: (data: Uint8Array) => string;