postchain-client
Version:
Client library for accessing a Postchain node through REST.
14 lines • 532 B
JavaScript
import { z } from "zod";
import { MERKLE_HASH_VERSIONS } from "../../utils/constants";
const MerkleHashSchema = z.object({
merkle_hash_version: z.number().int().positive(),
});
export const validateMerkleHash = (data) => {
const result = MerkleHashSchema.safeParse(data);
if (!result.success) {
console.warn("MERKLE_HASH_WARNING: version not found or endpoint unreachable");
return { merkle_hash_version: MERKLE_HASH_VERSIONS.ONE };
}
return result.data;
};
//# sourceMappingURL=merkleHash.js.map