-
Notifications
You must be signed in to change notification settings - Fork 213
fix: more null checks #2061
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
base: master
Are you sure you want to change the base?
fix: more null checks #2061
Conversation
| direction, | ||
| marketType ?? null, | ||
| marketIndex ?? null, | ||
| direction ?? 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.
seems like we should consider doing a null check inside of getCancelOrdersIx and throw error if any of these are 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.
I hesitate to change the behavior like adding exception throwing if there wasn't any before. I guess the only issue here is they were T | undefined before and the function wanted T | null instead. I think in 99.99% of the time coalescing to null will not change the behavior right?
sdk/src/driftClient.ts
Outdated
| postOnly: postOnly || null, | ||
| bitFlags: bitFlags || null, | ||
| policy: policy || null, | ||
| policy: policy || 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.
how come we are only doing undefined on the policy param and keeping null for the rest? is there something with how this gets converted over to rust and we will get an error there?
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.
just what the internal type wanted. Always tricky to know least disruptive way to fix these errors. Are you thinking instead we should change the type instead of the passed value?
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.
actually I think we should change the type instead...
* fix: many null checks fixed * fix: prettier * feat: get active markets helpers * fix: prettier
4591301 to
4d49913
Compare
No description provided.