diff --git a/src/components/MethodName.tsx b/src/components/MethodName.tsx index 1ed596d..ff45cae 100644 --- a/src/components/MethodName.tsx +++ b/src/components/MethodName.tsx @@ -1,12 +1,12 @@ import React from "react"; -import { use4Bytes } from "../use4Bytes"; +import { rawInputTo4Bytes, use4Bytes } from "../use4Bytes"; type MethodNameProps = { data: string; }; const MethodName: React.FC = ({ data }) => { - const rawFourBytes = data.slice(0, 10); + const rawFourBytes = rawInputTo4Bytes(data); const methodName = use4Bytes(rawFourBytes); const isSimpleTransfer = data === "0x"; const methodTitle = isSimpleTransfer diff --git a/src/use4Bytes.ts b/src/use4Bytes.ts index 5f837e6..a1ab465 100644 --- a/src/use4Bytes.ts +++ b/src/use4Bytes.ts @@ -84,7 +84,7 @@ export const use4Bytes = (rawFourBytes: string) => { return name; }; -export const rawInputTo4Bytes = (rawInput: string) => rawInput.substr(0, 10); +export const rawInputTo4Bytes = (rawInput: string) => rawInput.slice(0, 10); /** * Extract 4bytes DB info