Skip to content
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

Convert Order entity to Zod #1280

Merged
merged 3 commits into from
Mar 13, 2024
Merged

Convert Order entity to Zod #1280

merged 3 commits into from
Mar 13, 2024

Conversation

fmrsabino
Copy link
Collaborator

Uses Zod instead of AJV to validate and convert the Swap Order payload to an Order type.

Uses Zod instead of AJV to validate and convert the Swap Order payload to an `Order` type.
@fmrsabino fmrsabino self-assigned this Mar 11, 2024
@fmrsabino fmrsabino requested a review from a team as a code owner March 11, 2024 15:34
@coveralls
Copy link

coveralls commented Mar 11, 2024

Pull Request Test Coverage Report for Build 8246824940

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.007%) to 93.426%

Totals Coverage Status
Change from base Build 8231720309: -0.007%
Covered Lines: 6385
Relevant Lines: 6600

💛 - Coveralls

src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
Comment on lines 14 to 27
kind: z.union([z.literal('buy'), z.literal('sell')]),
partiallyFillable: z.boolean(),
sellTokenBalance: z.union([
z.literal('erc20'),
z.literal('internal'),
z.literal('external'),
]),
buyTokenBalance: z.union([z.literal('erc20'), z.literal('internal')]),
signingScheme: z.union([
z.literal('eip712'),
z.literal('ethsign'),
z.literal('presign'),
z.literal('eip1271'),
]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about changing these to either a native or Zod enum?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As well as class, status, onchainOrderData.placementError.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Done in 3c33daf

src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
src/domain/swaps/entities/schemas/order.schema.ts Outdated Show resolved Hide resolved
fmrsabino and others added 2 commits March 11, 2024 17:10
Co-authored-by: Aaron Cook <aaron@safe.global>
@fmrsabino fmrsabino requested a review from iamacook March 12, 2024 10:18
Copy link
Member

@iamacook iamacook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@fmrsabino fmrsabino merged commit 0fef49e into main Mar 13, 2024
16 checks passed
@fmrsabino fmrsabino deleted the order-zod branch March 13, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants