-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow confirmation DTOs signatures under
signedSafeTxHash
prop…
…erty (#2423) When adding [refinement of confirmations](#2382), we wrongly assumed only web used the confirmation endpoint. As such, we aligned the property name to match that of the Transaction Service. Since then, we've confirmed that the property was correct. This allows both the new and previous name: - Allow `signature` and `signedSafeTxHash` property, transforming the latter to `signature` - Add appropriate test coverage
- Loading branch information
Showing
2 changed files
with
57 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 15 additions & 3 deletions
18
src/routes/transactions/entities/schemas/add-confirmation.dto.schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
import { z } from 'zod'; | ||
import { HexSchema } from '@/validation/entities/schemas/hex.schema'; | ||
|
||
export const AddConfirmationDtoSchema = z.object({ | ||
signature: HexSchema, | ||
}); | ||
export const AddConfirmationDtoSchema = z | ||
.object({ | ||
signature: HexSchema, | ||
}) | ||
.or( | ||
z.object({ | ||
// Note: mobile proposes signatures under the signedSafeTxHash property | ||
signedSafeTxHash: HexSchema, | ||
}), | ||
) | ||
.transform((data) => { | ||
return { | ||
signature: 'signature' in data ? data.signature : data.signedSafeTxHash, | ||
}; | ||
}); |