Use common function

This commit is contained in:
Willian Mitsuda 2021-09-25 14:29:09 -03:00
parent ccb33b4637
commit b57518ba96
2 changed files with 3 additions and 3 deletions

View File

@ -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<MethodNameProps> = ({ data }) => {
const rawFourBytes = data.slice(0, 10);
const rawFourBytes = rawInputTo4Bytes(data);
const methodName = use4Bytes(rawFourBytes);
const isSimpleTransfer = data === "0x";
const methodTitle = isSimpleTransfer

View File

@ -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