UNPKG

@tendermint/belt

Version:

A utility belt for TypeScript + JavaScript

39 lines (38 loc) 1.17 kB
import { Bytes, JSONValue } from '@tendermint/types'; /** * Canonicalize JSON for signing. * * This recursively sorts objects by key, removing any keys with `null` or `undefined` values, and replaces other * `undefined` values with `null`. * * @param value - any value (but usually a JSON object) * * @returns canonical JSON */ export declare function toCanonicalJSON(value: any): any; /** * Canonicalize JSON for signing, encode it as a string, then decode the string as JSON. * * @param value - JSON value * * @returns the canonical JSON * @throws will throw if encoding or decoding fails */ export declare function toCanonicalJSONClone(value: any): JSONValue; /** * Canonicalize JSON for signing, then encode it as a string. * * @param value - JSON value * * @returns the canonical JSON string * @throws will throw if encoding fails */ export declare function toCanonicalJSONString(value: any): string; /** * Canonicalize JSON for signing, encode it as a string, then encode the string as bytes. * * @param value - JSON value * * @returns the canonical JSON bytes */ export declare function toCanonicalJSONBytes(value: any): Bytes;