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

Generic CDE #179

Merged
merged 17 commits into from
Jun 30, 2023
Merged

Generic CDE #179

merged 17 commits into from
Jun 30, 2023

Conversation

martin-tomko-vacuumlabs
Copy link
Contributor

  • added implementation of generic CDE
  • slightly reworked how config works for other CDE
    • including renaming initializationPrefix to scheduledPrefix
  • fixed and moved pgtyped dependencies

@robkorn robkorn requested a review from acedward June 23, 2023 12:01
Comment on lines 25 to 32
private extensionsValid: boolean;

constructor(
web3: Web3,
paimaL2Contract: PaimaL2Contract,
extensions: ChainDataExtension[],
extensionsValid: boolean
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ts has a great shortcut for constructors

constructor( 
   private readonly web3: Web3,
   private readonlypaimaL2Contract: PaimaL2Contract,
   private readonly extensions: ChainDataExtension[],
   private readonly extensionsValid: boolean,
) {
 // No body necessary and you can remove the definition from the class (private extensionsValid: boolean)
}  

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not know this, do you mean like this? https://dev.to/satansdeer/typescript-constructor-shorthand-3ibd

Sounds pretty cool, I will go update that (and we might have superfluous constructors in other places as well in that case)

Copy link
Contributor

Choose a reason for hiding this comment

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

Exactly that! Parameter Properties https://www.typescriptlang.org/docs/handbook/2/classes.html#parameter-properties. Also readonly keyword is great for the compiler, so it does not get modified , but also for humans - to understand its just data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, I still have a lot to learn about tricks like this in TS (as I've only been using JS/TS since last March), so I appreciate it the tips. Should be updated now :)

Copy link
Contributor

@acedward acedward left a comment

Choose a reason for hiding this comment

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

🎖️

@robkorn robkorn merged commit 899c553 into master Jun 30, 2023
2 checks passed
@robkorn robkorn deleted the generic-cde branch June 30, 2023 20: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.

3 participants