From 851e75eb28948c53a3bb1f80d88dbd67b4fa1cc6 Mon Sep 17 00:00:00 2001 From: Daniel Somoza Date: Thu, 28 Nov 2024 16:57:48 +0100 Subject: [PATCH] use toHex instead of Buffer.from in generateHash --- .../src/utils/on-chain-tracking/generateOnChainIdentifier.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol-kit/src/utils/on-chain-tracking/generateOnChainIdentifier.ts b/packages/protocol-kit/src/utils/on-chain-tracking/generateOnChainIdentifier.ts index 1a159367e..b5f87cfbe 100644 --- a/packages/protocol-kit/src/utils/on-chain-tracking/generateOnChainIdentifier.ts +++ b/packages/protocol-kit/src/utils/on-chain-tracking/generateOnChainIdentifier.ts @@ -8,7 +8,7 @@ import { keccak256, toHex } from 'viem' * @returns {string} A hexadecimal string representation of the truncated hash, without the `0x` prefix. */ export function generateHash(input: string, size: number): string { - const fullHash = keccak256(Buffer.from(input)) + const fullHash = keccak256(toHex(input)) return toHex(fullHash.slice(-size)).replace('0x', '') // Take the last X bytes }