-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate MultisigTransaction
to zod
#1385
Conversation
@@ -1301,7 +1301,7 @@ describe('TransactionApi', () => { | |||
executionDateGte: executedDateGte, | |||
executionDateLte: executedDateLte, | |||
to: multisigTransaction.to, | |||
value: multisigTransaction.value, | |||
value: multisigTransaction.value ?? undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is purely used to satisfy TypeScript.
@@ -1,6 +1,7 @@ | |||
import { MessageConfirmationSchema } from '@/domain/messages/entities/schemas/message.schema'; | |||
import { z } from 'zod'; | |||
|
|||
// TODO: Move to a shared location as used for other entities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't do this to reduce the footprint of the PR.
this.jsonSchemaService.getSchema( | ||
CONFIRMATION_SCHEMA_ID, | ||
confirmationSchema, | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is temporarily needed until we migrate the transactionTypePageSchema
.
...ons/__tests__/controllers/list-multisig-transactions-by-safe.transactions.controller.spec.ts
Outdated
Show resolved
Hide resolved
@@ -28,7 +28,7 @@ export class TransactionData { | |||
hexData: string | null, | |||
dataDecoded: DataDecoded | null, | |||
to: AddressInfo, | |||
value: string, | |||
value: string | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we weren't inferring the types from the schema, this was not caught. It matches the types of the Transaction Service.
@@ -19,7 +19,7 @@ export class MultisigTransactionStatusMapper { | |||
} | |||
if ( | |||
(transaction.confirmations?.length || 0) < | |||
transaction.confirmationsRequired | |||
(transaction.confirmationsRequired || 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before regarding matching the Transaction Service.
Pull Request Test Coverage Report for Build 8786536293Details
💛 - Coveralls |
src/domain/safe/entities/schemas/multisig-transaction.schema.ts
Outdated
Show resolved
Hide resolved
signature: HexSchema.nullish().default(null), | ||
}); | ||
|
||
export const MultisigTransactionSchema = z.object({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The multisigTransactionPageSchema
and MULTISIG_TRANSACTION_PAGE_SCHEMA_ID
are no longer needed right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I've removed them in d8857aa.
...ons/__tests__/controllers/list-multisig-transactions-by-safe.transactions.controller.spec.ts
Outdated
Show resolved
Hide resolved
src/routes/transactions/entities/multisig-execution-info.entity.ts
Outdated
Show resolved
Hide resolved
It won't let me respond to this. It was a poor invalid value. It won't validate a string. I changed it to |
Oh I see. Thanks for clarifying! Now I understand that it was the difference between a valid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏 👏
Summary
This migrates the validation of
MultisigTransaction
s tozod
.Changes
confirmationSchema
withConfirmationSchema
multisigTransactionSchema
withMultisigTransactionSchema
multisigTransactionPageSchema