Skip to content

Commit

Permalink
fix trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan-zilliqa committed Jun 13, 2024
1 parent a362c67 commit b0d09d7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions products/devex/src/utils/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const zilAddrToHexAddr: (addr: string) => string = (zilAddr: string) => {

// Convert timestamp to display format, M/D/YYYY, h:mm:ssa
export const timestampToDisplay: (timestamp: string | number) => string = (
timestamp: string | number
timestamp: string | number,
) => {
if (typeof timestamp === "string")
return moment(parseInt(timestamp) / 1000).format("M/D/YYYY, h:mm:ssa");
Expand All @@ -33,23 +33,23 @@ export const timestampToDisplay: (timestamp: string | number) => string = (

// Convert timestamp from microseconds to milliseconds and find timeago
export const timestampToTimeago: (timestamp: string | number) => string = (
timestamp: string | number
timestamp: string | number,
) => {
if (typeof timestamp === "string")
return moment(parseInt(timestamp) / 1000).fromNow();
else return moment(timestamp / 1000).fromNow();
};

export const qaToZilSimplified: (amount: string | number) => number | string = (
amount: string | number
amount: string | number,
) => {
return units.fromQa(new BN(amount), units.Units.Zil);
};

// Convert from Qa to Zil
export const qaToZil: (
amount: string | number,
numOfDigits?: number
numOfDigits?: number,
) => string = (amount: string | number, numOfDigits?: number) => {
// Check if the amount is a number and convert to string if necessary
if (typeof amount === "number") {
Expand Down Expand Up @@ -77,23 +77,23 @@ export const qaToZil: (

// Strips hex prefix if exists
export const stripHexPrefix: (inputHex: string) => string = (
inputHex: string
inputHex: string,
) => {
if (inputHex.substring(0, 2) === "0x") return inputHex.substring(2);
return inputHex;
};

// Add hex prefix if not already
export const addHexPrefix: (inputHex: string) => string = (
inputHex: string
inputHex: string,
) => {
if (inputHex.substring(0, 2) !== "0x") return "0x" + inputHex;
return inputHex;
};

// Check whether is valid addr (regardless of bech32 or hex format)
export const isValidAddr: (inputStr: string) => boolean = (
inputStr: string
inputStr: string,
) => {
const trimmedInput = inputStr.trim();
let prefixedInput = trimmedInput;
Expand Down

0 comments on commit b0d09d7

Please sign in to comment.