-
Notifications
You must be signed in to change notification settings - Fork 18
Add pumpx_signLimitOrder
#3358
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 pumpx_signLimitOrder
#3358
Conversation
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.
Thanks!
Would you update apifox once it's merged?
let Ok(token) = | ||
jwt::decode::<AuthTokenClaims>(¶ms.auth_token, public_key.as_bytes()) | ||
else { | ||
return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into()); | ||
}; | ||
if token.sub != "access" { | ||
return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into()); | ||
} |
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.
Thank you
Shall we make a per task fn (like expected_auth_token_type()
and add it as parameter to verify_auth
) as it should be verified in most RPC methods?
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.
is it possible to reuse and keep alignment with other rpc calls?
Something like:
let wrapper: NativeTaskWrapper<NativeTask> = params.into();
if wrapper.task.require_auth() && verify_auth(ctx.clone(), &wrapper).await.is_err() {
return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into());
}
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.
is it possible to reuse and keep alignment with other rpc calls? Something like:
let wrapper: NativeTaskWrapper<NativeTask> = params.into(); if wrapper.task.require_auth() && verify_auth(ctx.clone(), &wrapper).await.is_err() { return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into()); }
Yes but that would require some time for rework.
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 copy/paste and change fields? can it help?
Like:
impl From<RequestJwtParams> for NativeTaskWrapper<NativeTask> {
fn from(p: RequestJwtParams) -> Self {
Self {
task: NativeTask::PumpxRequestJwt(
Identity::from_web2_account(p.user_email.as_str(), Web2IdentityType::Email),
p.invite_code,
p.google_code,
p.language,
),
nonce: None,
auth: Some(OmniAuth::Email(p.email_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.
Nope, simple copy paste doesn't help in this case 😂
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.
The main problem is that verify_auth
function derives omni_account from sender Identity
.
In case of JWT type: access
sub
field already contains omni_account.
apifox should be already up to date 🙃 |
Adds a rpc methods for signing arbitrary bytes.