From dbe729ecd3e7db7069ceb2137c9dc6e45861d685 Mon Sep 17 00:00:00 2001 From: "Justin R. Evans" Date: Tue, 10 Sep 2024 15:39:22 +0200 Subject: [PATCH] fix: pass failed description, styles --- apps/namadillo/src/App/Common/Toast.tsx | 19 ++++++++++++++----- .../src/hooks/useTransactionNotifications.tsx | 9 ++++++++- apps/namadillo/src/lib/query.ts | 3 +-- apps/namadillo/src/types.d.ts | 1 + 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/apps/namadillo/src/App/Common/Toast.tsx b/apps/namadillo/src/App/Common/Toast.tsx index d058dbdf30..d3ce6ae949 100644 --- a/apps/namadillo/src/App/Common/Toast.tsx +++ b/apps/namadillo/src/App/Common/Toast.tsx @@ -9,6 +9,7 @@ import { useAtomValue, useSetAtom } from "jotai"; import { useCallback, useEffect, useRef, useState } from "react"; import { FaCheck, FaTimes } from "react-icons/fa"; import { FaRegHourglassHalf, FaXmark } from "react-icons/fa6"; +import { GoAlert } from "react-icons/go"; import { ToastNotification } from "types"; export const Toasts = (): JSX.Element => { @@ -113,6 +114,11 @@ const Toast = ({ )} + {notification.type === "partialSuccess" && ( + + + + )} )} {notification.failedDetails && (viewDetails || forceDetailsOpen) && ( -
-
-
The following Tx were not applied:
- {notification.failedDetails} -
+ <> +
+ + {notification.failedDescription} + + {notification.failedDetails} +
+ )}
{ succeeded ), + failedDescription: ( + <>The following staking transactions were not applied: + ), details: getAmountByValidatorList(e.detail.data), failedDetails: getAmountByValidatorList(e.detail.failedData || []), type: "partialSuccess", @@ -149,9 +152,12 @@ export const useTransactionNotifications = (): void => { title: "Some Unstake transactions failed", description: ( <> - Your unbonding of has succeeded + Your unstaking of has succeeded ), + failedDescription: ( + <>The following unstaking transactions were not applied: + ), details: getAmountByValidatorList(e.detail.data), failedDetails: e.detail.failedData ? @@ -246,6 +252,7 @@ export const useTransactionNotifications = (): void => { has succeeded ), + failedDescription: <>The following redelegations were not applied:, details: getReDelegateDetailList(e.detail.data), failedDetails: e.detail.failedData ? diff --git a/apps/namadillo/src/lib/query.ts b/apps/namadillo/src/lib/query.ts index 555a687bfd..6efb10716e 100644 --- a/apps/namadillo/src/lib/query.ts +++ b/apps/namadillo/src/lib/query.ts @@ -9,7 +9,6 @@ import { } from "@namada/types"; import { getIndexerApi } from "atoms/api"; import { chainParametersAtom } from "atoms/chain"; -import BigNumber from "bignumber.js"; import { getSdkInstance } from "hooks"; import invariant from "invariant"; import { getDefaultStore } from "jotai"; @@ -59,7 +58,7 @@ const getTxProps = ( return { token: chain.nativeTokenAddress, feeAmount: gasConfig.gasPrice, - gasLimit: BigNumber(200), + gasLimit: gasConfig.gasLimit, chainId: chain.chainId, publicKey: account.publicKey!, memo: "", diff --git a/apps/namadillo/src/types.d.ts b/apps/namadillo/src/types.d.ts index a7c922f306..007213e30a 100644 --- a/apps/namadillo/src/types.d.ts +++ b/apps/namadillo/src/types.d.ts @@ -144,6 +144,7 @@ export type ToastNotification = { type: "pending" | "success" | "partialSuccess" | "error"; title: React.ReactNode; description: React.ReactNode; + failedDescription?: React.ReactNode; details?: React.ReactNode; failedDetails?: React.ReactNode; timeout?: number;