diff --git a/components/transactions/TxItem.tsx b/components/transactions/TxItem.tsx
index a31e7cbc..dc6651f0 100644
--- a/components/transactions/TxItem.tsx
+++ b/components/transactions/TxItem.tsx
@@ -5,8 +5,8 @@ import Container from "../container/container";
import Spacer from "../layout/spacer";
import {
dateToMomentsAgo,
- formatError,
formatSecondsToMinutes,
+ parseError,
} from "@/utils/formatting";
import StatusIcon from "../icon/statusIcon";
import { useQuery } from "react-query";
@@ -120,7 +120,7 @@ const TxItem = (props: TxItemProps) => {
)}
{props.tx.error && (
- {formatError(props.tx.error)}
+ {parseError(props.tx)}
)}
diff --git a/utils/cosmos/accountMeta.utils.ts b/utils/cosmos/accountMeta.utils.ts
index 452dfc69..737ffcb9 100644
--- a/utils/cosmos/accountMeta.utils.ts
+++ b/utils/cosmos/accountMeta.utils.ts
@@ -29,7 +29,7 @@ export async function getCantoAccountMetaData(
const { data, error } =
await tryFetchWithRetry(
`${cantoNetwork.restEndpoint}/cosmos/auth/v1beta1/accounts/${cantoAddress}`,
- 5
+ 2
);
if (error) throw error;
diff --git a/utils/formatting/errors.utils.ts b/utils/formatting/errors.utils.ts
index 45d60aa6..960e9057 100644
--- a/utils/formatting/errors.utils.ts
+++ b/utils/formatting/errors.utils.ts
@@ -1,3 +1,8 @@
+import { TransactionWithStatus } from "@/transactions/interfaces";
+import {
+ CantoFETxType
+} from "@/transactions/interfaces";
+
/**
* @notice Formats an error message to be more readable
* @param {string} errorMsg Error message to format
@@ -8,3 +13,33 @@ export function formatError(errorMsg: string): string {
const split = errorMsg.split(":");
return "Error:" + split[split.length - 1];
}
+
+
+export function parseError(tx: TransactionWithStatus): string {
+ const error = tx.error ?? ""
+ switch (tx.tx.feTxType) {
+ case CantoFETxType.ADD_LIQUIDITY_CANTO_DEX:
+ case CantoFETxType.REMOVE_LIQUIDITY_CANTO_DEX:
+ if((/BaseV1Router: INSUFFICIENT_(A|B)_AMOUNT/).test(error)){
+ return "Error: Insufficient slippage";
+ }
+ if((/BaseV1Router: EXPIRED/).test(error)){
+ return "Error: Insufficient deadline";
+ }
+ break;
+ case CantoFETxType.ADD_CONC_LIQUIDITY_AMBIENT:
+ case CantoFETxType.REMOVE_CONC_LIQUIDITY_AMBIENT:
+ if((/execution reverted: J/).test(error)){
+ return "Error: Cannot remove liquidity, try after sometime";
+ }
+ if((/execution reverted: RC/).test(error)){
+ return "Error: Price not in given execution range";
+ }
+ break;
+ default:
+ if((/not available/).test(error)){
+ return "Error: Timeout";
+ }
+ }
+ return formatError(error);
+}