From 126d50c6f77a633102086dae58b60bd2d94fb712 Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 23 Sep 2023 14:19:38 -0500 Subject: [PATCH] add more multisig confirmation conditions --- src/entities/multisigSession.ts | 6 +++++- src/routes/v1/multisigAuthenticationRouter.ts | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/entities/multisigSession.ts b/src/entities/multisigSession.ts index b78774b..d2577b9 100644 --- a/src/entities/multisigSession.ts +++ b/src/entities/multisigSession.ts @@ -66,7 +66,11 @@ export class MultisigSession extends BaseEntity { if (this.isExpired()) this.status = MultisigStatuses.Failed; - if (safeMessageData.status === 'CONFIRMED') + if ( + safeMessageData.status === 'CONFIRMED' && + safeMessageData.confirmationsSubmitted >= + safeMessageData.confirmationsRequired + ) this.status = MultisigStatuses.Successful; await this.save(); diff --git a/src/routes/v1/multisigAuthenticationRouter.ts b/src/routes/v1/multisigAuthenticationRouter.ts index 3894e45..a5ea8a0 100644 --- a/src/routes/v1/multisigAuthenticationRouter.ts +++ b/src/routes/v1/multisigAuthenticationRouter.ts @@ -9,8 +9,9 @@ multisigAuthenticationRouter.post( '/multisigAuthentication', async (req: Request, res: Response, next) => { try { - const { safeMessageTimestamp, safeAddress, network, jwt } = req.body; - if (!safeMessageTimestamp || !safeAddress || !jwt || !network) { + const { safeAddress, network, jwt } = req.body; + const safeMessageTimestamp = req.body?.safeMessageTimestamp; + if (!safeAddress || !jwt || !network) { res.status(422).json({ message: errorMessagesEnum.MISSING_LOGIN_DATA }); return; }