From a362c670e07272310c463a5167cea1cc824a547a Mon Sep 17 00:00:00 2001 From: Chetan Phirke Date: Thu, 13 Jun 2024 13:29:50 +0800 Subject: [PATCH 1/3] Fix devex to not crash for high gas txn --- products/devex/src/utils/Utils.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/products/devex/src/utils/Utils.tsx b/products/devex/src/utils/Utils.tsx index 72a5914d9..7798f4bf6 100644 --- a/products/devex/src/utils/Utils.tsx +++ b/products/devex/src/utils/Utils.tsx @@ -51,6 +51,10 @@ export const qaToZil: ( amount: string | 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") { + amount = amount.toString(); + } let parsedAmt = ""; const splitAmt = units.fromQa(new BN(amount), units.Units.Zil).split("."); if (splitAmt.length === 1) { From b0d09d70c9c5624e623562058ae5145f6e3130f4 Mon Sep 17 00:00:00 2001 From: Chetan Phirke Date: Thu, 13 Jun 2024 13:43:54 +0800 Subject: [PATCH 2/3] fix trunk --- products/devex/src/utils/Utils.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/products/devex/src/utils/Utils.tsx b/products/devex/src/utils/Utils.tsx index 7798f4bf6..4a37759c3 100644 --- a/products/devex/src/utils/Utils.tsx +++ b/products/devex/src/utils/Utils.tsx @@ -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"); @@ -33,7 +33,7 @@ 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(); @@ -41,7 +41,7 @@ export const timestampToTimeago: (timestamp: string | number) => string = ( }; export const qaToZilSimplified: (amount: string | number) => number | string = ( - amount: string | number + amount: string | number, ) => { return units.fromQa(new BN(amount), units.Units.Zil); }; @@ -49,7 +49,7 @@ export const qaToZilSimplified: (amount: string | number) => number | string = ( // 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") { @@ -77,7 +77,7 @@ 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; @@ -85,7 +85,7 @@ export const stripHexPrefix: (inputHex: string) => string = ( // 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; @@ -93,7 +93,7 @@ export const addHexPrefix: (inputHex: string) => string = ( // 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; From 81658de1ccf434b06d5cc10ce4170b8474f9026c Mon Sep 17 00:00:00 2001 From: Chetan Phirke Date: Fri, 14 Jun 2024 12:04:47 +0800 Subject: [PATCH 3/3] fix formatting --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3df6d2fd9..e3874e4d7 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "elliptic": "^6.5.0", "enzyme": "^3.11.0", "enzyme-to-json": "^3.6.2", - "eslint": "8", + "eslint": "^7.32.0", "eslint-plugin-react": "^7.31.10", "events": "^3.3.0", "expect": "^29.3.1",