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

Add datasource for Safe Decoder Service #2313

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Jan 29, 2025

Summary

The new Safe Decoder Service improves upon the decoder of the Safe Transaction Service. As such, we intend to migrate to it.

This lays the foundation of usage, by creating a datasource (with manager) and base repository for validating the responses.

Changes

  • Add safeDataDecoder.baseUri (test) configuration
  • Add DataDecoderApiManager interface, implementation and module
  • Add DataDecoderApi interface, implementation and module
  • Add validation schemas for DataDecoded and `Contract, with inferred types and builders
  • Add base DataDecoderRepository for accessing/validating datasource responses
  • Add appropriate test coverage of service and schemas

@iamacook iamacook self-assigned this Jan 29, 2025
@iamacook iamacook linked an issue Jan 29, 2025 that may be closed by this pull request
Base automatically changed from version-data-decoded to main January 29, 2025 16:08
@iamacook iamacook force-pushed the safe-decoder-datasource branch from ef803f7 to 4b4cb62 Compare January 29, 2025 16:09

export const DataDecodedSchema = z.lazy(() =>
z.object(BaseDataDecodedSchemaShape).extend({
accuracy: z.enum([...Accuracy, 'UNKNOWN']).catch('UNKNOWN'),
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only thing that's changed in comparison to the existing DataDecoded entity. I think it's better we validate the entity correctly nonetheless. What do we think?

@iamacook iamacook marked this pull request as ready for review February 4, 2025 08:11
@iamacook iamacook requested a review from a team as a code owner February 4, 2025 08:11
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.

Add/migrate to Safe Decoder Service
1 participant