Skip to content

Commit

Permalink
feat: improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspang committed Sep 21, 2024
1 parent 1787690 commit 3b69a9b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/web/lib/stores/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const useNotifyTransactions = () => {
(
status: "PENDING" | "SUCCESS" | "FAILURE",
transaction: UnsignedTransaction | PendingTransaction,
statusMessage?: string,
) => {
if (!client.client) return;

Expand All @@ -110,7 +111,6 @@ export const useNotifyTransactions = () => {
const [moduleName, methodName] = resolvedMethodDetails;

const hash = truncateMiddle(transaction.hash().toString(), 15, 15, "...");

function title() {
switch (status) {
case "PENDING":
Expand All @@ -124,7 +124,7 @@ export const useNotifyTransactions = () => {

toast({
title: title(),
description: `Hash: ${hash}`,
description: `Hash: ${hash}${statusMessage ? `\nMessage: ${statusMessage}` : ""}`,
});
},
[client.client],
Expand Down Expand Up @@ -168,9 +168,9 @@ export const useNotifyTransactions = () => {
},
);

confirmedPendingTransactions?.forEach(({ tx, status }) => {
confirmedPendingTransactions?.forEach(({ tx, status, statusMessage }) => {
wallet.removePendingTransaction(tx);
notifyTransaction(status ? "SUCCESS" : "FAILURE", tx);
notifyTransaction(status ? "SUCCESS" : "FAILURE", tx, statusMessage);
});
}, [
chain.block,
Expand Down

0 comments on commit 3b69a9b

Please sign in to comment.