-
Notifications
You must be signed in to change notification settings - Fork 15
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: call compliance endpoint for keplr #588
Conversation
val signedMessage = helper.parser.asString(result["signedMessage"]) | ||
val publicKey = helper.parser.asString(result["publicKey"]) | ||
val timestamp = helper.parser.asString(result["timestamp"]) | ||
val isKeplr = helper.parser.asBool(result["isKeplr"]) | ||
val url = if (isKeplr == true) complianceGeoblockKeplrUrl() else complianceGeoblockUrl() |
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.
[discussion] we're starting to get a lot of branching in this function. you think it's worth splitting this into 2 separate functions? or creating 2 separate helper functions?
if this is urgent i'm down to stamp right away though since the logic makes sense
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.
Definitely thought about it, and tried initially. Ended with this approach because the only code path change is just the body and url, but if you feel strongly I can take another stab!
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.
nah no worries! i think we can do this as part of a larger cleanup task in the future to reduce code duplication. the OnboardingSupervisor
is a really bad offender of this... so easy to make mistakes when updating things since there's so much duplicate code
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.
yea, feel that
src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountSupervisor.kt
Outdated
Show resolved
Hide resolved
"address" to address.rawAddress, | ||
"message" to message, | ||
"action" to complianceAction.toString(), | ||
"signedMessage" to signedMessage!!, |
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.
[q] why do these properties have to be assumed non-null? (i know it's part of previously committed code too, but curious if you have the answer)
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 that the request needs all these fields.
I check for it to be not null with isUrlAndKeysPresent
before the body gets used, so if anything is null, the request would not send.
I don't know if there is a better kotlin way to do this tho
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.
oh, does kotlin remove the field entirely if the value is 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.
oh it will actually throw, thats a good catch actually. I think it should be inside the if statement
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.
stamped but i think we need to wait for https://github.com/dydxprotocol/v4-chain/pull/2117/files to merge right? so just ping me when you need a restamp (you will, most likely, as you'll have to bump versions)
"address" to address.rawAddress, | ||
"message" to message, | ||
"action" to complianceAction.toString(), | ||
"signedMessage" to signedMessage!!, |
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.
[nit] we shouldn't need the non-null casting anymore, right?
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.
still need to do for the type check haha
Should be fine, since the request won't get called unless the user is using Keplr which isn't launched yet |
Backend endpoint PR: dydxprotocol/v4-chain#2117