Skip to content

Commit

Permalink
fix: throw speed up mutation if depositor does not match signer (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
dohaki authored Nov 2, 2023
1 parent 15a2a84 commit 2fc157d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/views/Transactions/hooks/useSpeedUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Deposit } from "hooks/useDeposits";
const config = getConfig();

export function useSpeedUp(transfer: Deposit, token: Token) {
const { signer, notify } = useConnection();
const { signer, notify, account } = useConnection();
const { isWrongNetwork, isWrongNetworkHandler } = useIsWrongNetwork(
transfer.sourceChainId
);
Expand Down Expand Up @@ -42,8 +42,12 @@ export function useSpeedUp(transfer: Deposit, token: Token) {
newRecipient: string;
}>;
}) => {
if (!signer) {
return;
if (!signer || !account) {
throw new Error("No wallet connected");
}

if (transfer.depositorAddr.toLowerCase() !== account.toLowerCase()) {
throw new Error("Speed up not possible for this deposit");
}

if (isWrongNetwork) {
Expand Down

0 comments on commit 2fc157d

Please sign in to comment.