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

feat(cli): improve storeArgument, refactor cli #500

Merged
merged 5 commits into from
Mar 16, 2023
Merged

Conversation

dk1a
Copy link
Contributor

@dk1a dk1a commented Mar 16, 2023

A bunch of code improvements for solidity renderers and store config
And some fixes:

  • storeArgument is now always 1st and present for all relevant functions
  • singletons work
  • added pure to encode

this is extracted from #459

Comment on lines +98 to +99
valueSchema.validate(false);
keySchema.validate(true);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if the following compiles, but it would be more readable in this case. Should test if it compiles before committing though

Suggested change
valueSchema.validate(false);
keySchema.validate(true);
valueSchema.validate({ allowEmpty: false });
keySchema.validate({ allowEmpty: true });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

haha you merged it right before I pushed the changes. It does compile

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(wanted to do as a manual commit since it's used in 2 other places)

// tableIdArgument: true,
// },
Bool: {
// TODO: This table is only used for testing, move it to `test/tables` via the directory config once supported
Copy link
Member

@alvrs alvrs Mar 16, 2023

Choose a reason for hiding this comment

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

this should be supported now right?

Suggested change
// TODO: This table is only used for testing, move it to `test/tables` via the directory config once supported
directory: "../test/tables",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there're some problems with just doing this, so I left it for another PR, this one is big enough as it is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think forge doesn't see imports in test, unless we add test to libs, which is a questionable decision and I haven't looked into what to really do about it yet

Copy link
Member

Choose a reason for hiding this comment

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

I see, fine to leave it for later!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(like me, you might wonder how it works in solecs - because there test is in src/test)

},
storeArgument: true,
tableIdArgument: true,
},
AddressArray: {
// TODO: This table is only used for testing, move it to `test/tables` via the directory config once supported
Copy link
Member

Choose a reason for hiding this comment

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

same here

Suggested change
// TODO: This table is only used for testing, move it to `test/tables` via the directory config once supported
directory: "../test/tables",

Copy link
Member

@alvrs alvrs left a comment

Choose a reason for hiding this comment

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

lgtm!

@alvrs alvrs merged commit bb68670 into main Mar 16, 2023

export function parseStoreConfig(config: StoreUserConfig) {
export function parseStoreConfig(config: unknown) {
Copy link
Member

@holic holic Mar 17, 2023

Choose a reason for hiding this comment

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

Did this have to get reverted?
Nevermind, I don't think this impacted downstream types like I thought it would!

Copy link
Contributor Author

@dk1a dk1a Mar 17, 2023

Choose a reason for hiding this comment

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

this was an accidental revert actually - was adapting these changes from code before your PR and missed this. But good to know all works well

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