From 7e5f11d7e7284c3a14050fd8bb283474f951e135 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Tue, 5 Sep 2023 11:30:30 +0100 Subject: [PATCH] close on rejection of signature --- .../modals/WalletConnectSigning.tsx | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/ui/src/components/modals/WalletConnectSigning.tsx b/packages/ui/src/components/modals/WalletConnectSigning.tsx index cf35d660..a934d6f5 100644 --- a/packages/ui/src/components/modals/WalletConnectSigning.tsx +++ b/packages/ui/src/components/modals/WalletConnectSigning.tsx @@ -159,19 +159,16 @@ const ProposalSigning = ({ onClose, className, request, onSuccess }: SigningModa ) const onReject = useCallback(() => { - const response = { - id: request.id, - jsonrpc: '2.0', - error: { - code: 5000, - message: 'User rejected request on Multix' - } - } - web3wallet?.respondSessionRequest({ - topic: request.topic, - response - }) - }, [request.id, request.topic, web3wallet]) + const response = getWalletConnectErrorResponse(request.id, 'User rejected request on Multix') + + web3wallet + ?.respondSessionRequest({ + topic: request.topic, + response + }) + .catch(console.error) + .finally(() => onClose()) + }, [onClose, request, web3wallet]) return ( - Approve + Sign )}