Use common function
This commit is contained in:
parent
ccb33b4637
commit
b57518ba96
|
@ -1,12 +1,12 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { use4Bytes } from "../use4Bytes";
|
import { rawInputTo4Bytes, use4Bytes } from "../use4Bytes";
|
||||||
|
|
||||||
type MethodNameProps = {
|
type MethodNameProps = {
|
||||||
data: string;
|
data: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MethodName: React.FC<MethodNameProps> = ({ data }) => {
|
const MethodName: React.FC<MethodNameProps> = ({ data }) => {
|
||||||
const rawFourBytes = data.slice(0, 10);
|
const rawFourBytes = rawInputTo4Bytes(data);
|
||||||
const methodName = use4Bytes(rawFourBytes);
|
const methodName = use4Bytes(rawFourBytes);
|
||||||
const isSimpleTransfer = data === "0x";
|
const isSimpleTransfer = data === "0x";
|
||||||
const methodTitle = isSimpleTransfer
|
const methodTitle = isSimpleTransfer
|
||||||
|
|
|
@ -84,7 +84,7 @@ export const use4Bytes = (rawFourBytes: string) => {
|
||||||
return name;
|
return name;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const rawInputTo4Bytes = (rawInput: string) => rawInput.substr(0, 10);
|
export const rawInputTo4Bytes = (rawInput: string) => rawInput.slice(0, 10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract 4bytes DB info
|
* Extract 4bytes DB info
|
||||||
|
|
Loading…
Reference in New Issue