From 5559fb7be372977b134153f5718913628bbf439a Mon Sep 17 00:00:00 2001 From: Valtteri Karesto Date: Thu, 14 Apr 2022 11:51:56 +0300 Subject: [PATCH] rename hash to sha256 --- state/actions/deployHook.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/state/actions/deployHook.ts b/state/actions/deployHook.ts index 2997553..5fcb8e6 100644 --- a/state/actions/deployHook.ts +++ b/state/actions/deployHook.ts @@ -5,7 +5,7 @@ import state, { IAccount } from "../index"; import calculateHookOn, { TTS } from "../../utils/hookOnCalculator"; import { SetHookData } from "../../components/SetHookDialog"; -const hash = async (string: string) => { +export const sha256 = async (string: string) => { const utf8 = new TextEncoder().encode(string); const hashBuffer = await crypto.subtle.digest('SHA-256', utf8); const hashArray = Array.from(new Uint8Array(hashBuffer)); @@ -66,7 +66,7 @@ export const deployHook = async (account: IAccount & { name?: string }, data: Se if (!state.client) { return; } - const HookNamespace = (await hash(data.HookNamespace)).toUpperCase(); + const HookNamespace = (await sha256(data.HookNamespace)).toUpperCase(); const hookOnValues: (keyof TTS)[] = data.Invoke.map(tt => tt.value); const { HookParameters } = data; const filteredHookParameters = HookParameters.filter(hp => hp.HookParameter.HookParameterName && hp.HookParameter.HookParameterValue)?.map(aa => ({ HookParameter: { HookParameterName: toHex(aa.HookParameter.HookParameterName || ''), HookParameterValue: toHex(aa.HookParameter.HookParameterValue || '') } }));