diff --git a/libs/wallet/src/connectors/json-rpc-connector.ts b/libs/wallet/src/connectors/json-rpc-connector.ts index db6c08329..0ffdc57e5 100644 --- a/libs/wallet/src/connectors/json-rpc-connector.ts +++ b/libs/wallet/src/connectors/json-rpc-connector.ts @@ -242,6 +242,16 @@ export class JsonRpcConnector implements VegaConnector { encodedTransaction: encodeTransaction(transaction), }); + if ('error' in result) { + // In the case of sending a tx, error code 3001 indicates that the + // user rejected the tx. Returning null will allow the dialog to close immediately + if (result.error.code === 3001) { + return null; + } else { + throw this.wrapError(result.error); + } + } + const parsedResult = SendTransactionSchema.safeParse(result); if (parsedResult.success) { @@ -252,12 +262,6 @@ export class JsonRpcConnector implements VegaConnector { signature: parsedResult.data.result.transaction.signature.value, }; } else { - // In the case of sending a tx, return null instead of throwing - // this indicates to the app that the user rejected the tx rather - // than it being a true error - if ('error' in result && result.error.code === 3001) { - return null; - } throw ClientErrors.INVALID_RESPONSE; } } diff --git a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx index 9d9f72e4c..865da3aba 100644 --- a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx +++ b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx @@ -108,9 +108,10 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => { if (transaction.status === VegaTxStatus.Error) { content = (
{transaction.error && transaction.error.message}
- {transaction.error && transaction.error.data && ( -{transaction.error.data}
+ {transaction.error && ( ++ {transaction.error.message}: {transaction.error.data} +
)}